summaryrefslogtreecommitdiffstats
path: root/include/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/AccessibleBrowseBoxObjType.hxx35
-rw-r--r--include/vcl/BinaryDataContainer.hxx72
-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.hxx39
-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.hxx199
-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.hxx95
-rw-r--r--include/vcl/BitmapPopArtFilter.hxx33
-rw-r--r--include/vcl/BitmapReadAccess.hxx235
-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/BitmapWriteAccess.hxx128
-rw-r--r--include/vcl/ColorMask.hxx193
-rw-r--r--include/vcl/DocWindow.hxx30
-rw-r--r--include/vcl/EnumContext.hxx168
-rw-r--r--include/vcl/FilterConfigItem.hxx96
-rw-r--r--include/vcl/GestureEventPan.hxx58
-rw-r--r--include/vcl/GestureEventRotate.hxx46
-rw-r--r--include/vcl/GestureEventZoom.hxx46
-rw-r--r--include/vcl/GraphicAttributes.hxx148
-rw-r--r--include/vcl/GraphicExternalLink.hxx32
-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.hxx51
-rw-r--r--include/vcl/ITiledRenderable.hxx390
-rw-r--r--include/vcl/IconThemeInfo.hxx98
-rw-r--r--include/vcl/ImageTree.hxx95
-rw-r--r--include/vcl/InterimItemWindow.hxx78
-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.hxx60
-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/WindowPosSize.hxx138
-rw-r--r--include/vcl/abstdlg.hxx195
-rw-r--r--include/vcl/accessibility/AccessibleTextAttributeHelper.hxx79
-rw-r--r--include/vcl/accessiblefactory.hxx174
-rw-r--r--include/vcl/accessibletable.hxx165
-rw-r--r--include/vcl/accessibletableprovider.hxx227
-rw-r--r--include/vcl/alpha.hxx130
-rw-r--r--include/vcl/animate/Animation.hxx125
-rw-r--r--include/vcl/animate/AnimationFrame.hxx85
-rw-r--r--include/vcl/bitmap.hxx652
-rw-r--r--include/vcl/bitmap/BitmapTypes.hxx66
-rw-r--r--include/vcl/bitmapex.hxx534
-rw-r--r--include/vcl/builder.hxx451
-rw-r--r--include/vcl/builderfactory.hxx51
-rw-r--r--include/vcl/builderpage.hxx50
-rw-r--r--include/vcl/cairo.hxx103
-rw-r--r--include/vcl/canvastools.hxx169
-rw-r--r--include/vcl/checksum.hxx43
-rw-r--r--include/vcl/commandevent.hxx396
-rw-r--r--include/vcl/commandinfoprovider.hxx107
-rw-r--r--include/vcl/ctrl.hxx237
-rw-r--r--include/vcl/cursor.hxx113
-rw-r--r--include/vcl/customweld.hxx192
-rw-r--r--include/vcl/cvtgrf.hxx50
-rw-r--r--include/vcl/decoview.hxx95
-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/errinf.hxx134
-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.hxx249
-rw-r--r--include/vcl/filter/PngImageReader.hxx78
-rw-r--r--include/vcl/filter/PngImageWriter.hxx47
-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.hxx47
-rw-r--r--include/vcl/fntstyle.hxx41
-rw-r--r--include/vcl/font.hxx195
-rw-r--r--include/vcl/font/Feature.hxx129
-rw-r--r--include/vcl/font/FeatureParser.hxx48
-rw-r--r--include/vcl/fontcapabilities.hxx203
-rw-r--r--include/vcl/fontcharmap.hxx157
-rw-r--r--include/vcl/formatter.hxx323
-rw-r--r--include/vcl/formpdfexport.hxx55
-rw-r--r--include/vcl/gdimetafiletools.hxx55
-rw-r--r--include/vcl/gdimtf.hxx203
-rw-r--r--include/vcl/gfxlink.hxx115
-rw-r--r--include/vcl/glyphitem.hxx57
-rw-r--r--include/vcl/glyphitemcache.hxx119
-rw-r--r--include/vcl/gradient.hxx100
-rw-r--r--include/vcl/graph.hxx206
-rw-r--r--include/vcl/graphic/GraphicMetadata.hxx68
-rw-r--r--include/vcl/graphicfilter.hxx356
-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/htmltransferable.hxx51
-rw-r--r--include/vcl/i18nhelp.hxx77
-rw-r--r--include/vcl/idle.hxx70
-rw-r--r--include/vcl/idletask.hxx34
-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.hxx59
-rw-r--r--include/vcl/inputctx.hxx82
-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.hxx147
-rw-r--r--include/vcl/kernarray.hxx106
-rw-r--r--include/vcl/keycod.hxx116
-rw-r--r--include/vcl/keycodes.hxx205
-rw-r--r--include/vcl/layout.hxx843
-rw-r--r--include/vcl/lazydelete.hxx139
-rw-r--r--include/vcl/lineinfo.hxx119
-rw-r--r--include/vcl/locktoplevels.hxx38
-rw-r--r--include/vcl/lok.hxx38
-rw-r--r--include/vcl/mapmod.hxx93
-rw-r--r--include/vcl/menu.hxx550
-rw-r--r--include/vcl/menubarupdateicon.hxx93
-rw-r--r--include/vcl/metaact.hxx1769
-rw-r--r--include/vcl/metaactiontypes.hxx85
-rw-r--r--include/vcl/metric.hxx109
-rw-r--r--include/vcl/mnemonic.hxx80
-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.hxx75
-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.hxx1896
-rw-r--r--include/vcl/outdev/ScopedStates.hxx41
-rw-r--r--include/vcl/pdf/PDFAnnotAActionType.hxx25
-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/PDFFormFieldType.hxx29
-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.hxx514
-rw-r--r--include/vcl/pdfread.hxx107
-rw-r--r--include/vcl/pdfwriter.hxx1266
-rw-r--r--include/vcl/print.hxx616
-rw-r--r--include/vcl/printer/Options.hxx116
-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.hxx58
-rw-r--r--include/vcl/rendercontext/DrawTextFlags.hxx52
-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.hxx122
-rw-r--r--include/vcl/rendercontext/SystemTextColorFlags.hxx37
-rw-r--r--include/vcl/roadmapwizard.hxx189
-rw-r--r--include/vcl/salctype.hxx65
-rw-r--r--include/vcl/salgtype.hxx85
-rw-r--r--include/vcl/salnativewidgets.hxx501
-rw-r--r--include/vcl/scheduler.hxx88
-rw-r--r--include/vcl/scrollable.hxx50
-rw-r--r--include/vcl/seleng.hxx240
-rw-r--r--include/vcl/settings.hxx748
-rw-r--r--include/vcl/skia/SkiaHelper.hxx45
-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.hxx195
-rw-r--r--include/vcl/stdtext.hxx53
-rw-r--r--include/vcl/svapp.hxx1454
-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.hxx204
-rw-r--r--include/vcl/syswin.hxx249
-rw-r--r--include/vcl/tabctrl.hxx211
-rw-r--r--include/vcl/tabpage.hxx75
-rw-r--r--include/vcl/task.hxx115
-rw-r--r--include/vcl/taskpanelist.hxx54
-rw-r--r--include/vcl/test/GraphicsRenderTests.hxx168
-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.hxx176
-rw-r--r--include/vcl/timer.hxx77
-rw-r--r--include/vcl/toolbox.hxx531
-rw-r--r--include/vcl/toolboxid.hxx23
-rw-r--r--include/vcl/toolkit/README2
-rw-r--r--include/vcl/toolkit/button.hxx511
-rw-r--r--include/vcl/toolkit/calendar.hxx99
-rw-r--r--include/vcl/toolkit/combobox.hxx199
-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.hxx268
-rw-r--r--include/vcl/toolkit/menubtn.hxx101
-rw-r--r--include/vcl/toolkit/morebtn.hxx56
-rw-r--r--include/vcl/toolkit/prgsbar.hxx88
-rw-r--r--include/vcl/toolkit/roadmap.hxx116
-rw-r--r--include/vcl/toolkit/scrbar.hxx153
-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.hxx207
-rw-r--r--include/vcl/toolkit/tabdlg.hxx49
-rw-r--r--include/vcl/toolkit/throbber.hxx85
-rw-r--r--include/vcl/toolkit/treelist.hxx295
-rw-r--r--include/vcl/toolkit/treelistbox.hxx684
-rw-r--r--include/vcl/toolkit/treelistentries.hxx23
-rw-r--r--include/vcl/toolkit/treelistentry.hxx127
-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.hxx514
-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.hxx591
-rw-r--r--include/vcl/uitest/uitest.hxx38
-rw-r--r--include/vcl/unohelp.hxx50
-rw-r--r--include/vcl/unohelp2.hxx68
-rw-r--r--include/vcl/vclenum.hxx388
-rw-r--r--include/vcl/vclevent.hxx221
-rw-r--r--include/vcl/vcllayout.hxx131
-rw-r--r--include/vcl/vclmain.hxx33
-rw-r--r--include/vcl/vclptr.hxx443
-rw-r--r--include/vcl/vclreferencebase.hxx72
-rw-r--r--include/vcl/vectorgraphicdata.hxx137
-rw-r--r--include/vcl/virdev.hxx160
-rw-r--r--include/vcl/wall.hxx117
-rw-r--r--include/vcl/weld.hxx2737
-rw-r--r--include/vcl/weldutils.hxx473
-rw-r--r--include/vcl/window.hxx1574
-rw-r--r--include/vcl/windowstate.hxx149
-rw-r--r--include/vcl/winscheduler.hxx44
-rw-r--r--include/vcl/wintypes.hxx262
-rw-r--r--include/vcl/wizardmachine.hxx359
-rw-r--r--include/vcl/wmf.hxx41
-rw-r--r--include/vcl/wmfexternal.hxx58
-rw-r--r--include/vcl/wrkwin.hxx104
-rw-r--r--include/vcl/xtextedt.hxx39
303 files changed, 49260 insertions, 0 deletions
diff --git a/include/vcl/AccessibleBrowseBoxObjType.hxx b/include/vcl/AccessibleBrowseBoxObjType.hxx
new file mode 100644
index 0000000000..481c414350
--- /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 0000000000..72bd852281
--- /dev/null
+++ b/include/vcl/BinaryDataContainer.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 <sal/config.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <unotools/tempfile.hxx>
+#include <tools/stream.hxx>
+#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
+{
+ struct Impl;
+
+ std::shared_ptr<Impl> mpImpl;
+
+ void ensureSwappedIn() const;
+
+public:
+ BinaryDataContainer() = default;
+ BinaryDataContainer(SvStream& stream, size_t size);
+
+ BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) = default;
+
+ BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept = default;
+
+ BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer) = default;
+
+ BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) noexcept = default;
+
+ size_t getSize() const;
+ bool isEmpty() const;
+ const sal_uInt8* getData() const;
+ css::uno::Sequence<sal_Int8> getCopyAsByteSequence() const;
+
+ // Returns the data as a readonly stream open for reading
+ std::shared_ptr<SvStream> getAsStream();
+
+ // Returns the data as a readonly stream open for reading
+ css::uno::Reference<css::io::XInputStream> getAsXInputStream();
+
+ /// writes the contents to the given stream
+ std::size_t writeToStream(SvStream& rStream) const;
+
+ /// return the in-memory size in bytes as of now.
+ std::size_t getSizeBytes() const;
+
+ /// swap out to disk for now
+ void swapOut() const;
+
+ size_t calculateHash() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BinaryDataContainerTools.hxx b/include/vcl/BinaryDataContainerTools.hxx
new file mode 100644
index 0000000000..3d50379a82
--- /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 0000000000..66cc2b56bc
--- /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 0000000000..6926c3274e
--- /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 0000000000..055e1e14e6
--- /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 0000000000..a02a459489
--- /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::optional<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 0000000000..b5364b4d14
--- /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 0000000000..266a384a3c
--- /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 0000000000..a504ff0eeb
--- /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 0000000000..27ade1cb29
--- /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 0000000000..34d9b5bb8c
--- /dev/null
+++ b/include/vcl/BitmapEmbossGreyFilter.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_VCL_BITMAPEMBOSSGREYFILTER_HXX
+#define INCLUDED_VCL_BITMAPEMBOSSGREYFILTER_HXX
+
+#include <sal/config.h>
+
+#include <tools/degree.hxx>
+#include <vcl/BitmapFilter.hxx>
+
+class BitmapEx;
+
+class VCL_DLLPUBLIC BitmapEmbossGreyFilter final : public BitmapFilter
+{
+public:
+ BitmapEmbossGreyFilter(Degree100 nAzimuthAngle, Degree100 nElevationAngle)
+ : mnAzimuthAngle(nAzimuthAngle)
+ , mnElevationAngle(nElevationAngle)
+ {
+ }
+
+ virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
+
+private:
+ Degree100 mnAzimuthAngle;
+ Degree100 mnElevationAngle;
+};
+
+#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 0000000000..c19d83b2d5
--- /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 0000000000..2fdb78b0b1
--- /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 0000000000..72b3fdb81f
--- /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 0000000000..7ded0c9a95
--- /dev/null
+++ b/include/vcl/BitmapInfoAccess.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 .
+ */
+#pragma once
+
+#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(const Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
+ BitmapInfoAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
+
+ virtual ~BitmapInfoAccess();
+
+ bool operator!() const { return mpBuffer == nullptr; }
+ explicit operator bool() 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;
+ }
+
+ /// Returns the BitmapColor (i.e. palette index) that is either an exact match
+ /// of the required color, or failing that, the entry that is the closest i.e. least error
+ /// as measured by Color::GetColorError.
+ 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];
+ }
+
+ /// Returns the BitmapColor (i.e. palette index) that is either an exact match
+ /// of the required color, or failing that, the entry that is the closest i.e. least error
+ /// as measured by Color::GetColorError.
+ sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
+ /// Returns the BitmapColor (i.e. palette index) that is an exact match
+ /// of the required color. Returns SAL_MAX_UINT16 if nothing found.
+ sal_uInt16 GetMatchingPaletteIndex(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;
+};
+
+class BitmapScopedInfoAccess
+{
+public:
+ BitmapScopedInfoAccess(const Bitmap& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedInfoAccess(const AlphaMask& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedInfoAccess() {}
+
+ BitmapScopedInfoAccess& operator=(const Bitmap& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ BitmapScopedInfoAccess& operator=(const AlphaMask& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ bool operator!() const { return !moAccess.has_value() || !*moAccess; }
+ explicit operator bool() const { return moAccess && bool(*moAccess); }
+
+ void reset() { moAccess.reset(); }
+
+ BitmapInfoAccess* get() { return moAccess ? &*moAccess : nullptr; }
+ const BitmapInfoAccess* get() const { return moAccess ? &*moAccess : nullptr; }
+
+ BitmapInfoAccess* operator->() { return &*moAccess; }
+ const BitmapInfoAccess* operator->() const { return &*moAccess; }
+
+ BitmapInfoAccess& operator*() { return *moAccess; }
+ const BitmapInfoAccess& operator*() const { return *moAccess; }
+
+private:
+ std::optional<BitmapInfoAccess> moAccess;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapMedianFilter.hxx b/include/vcl/BitmapMedianFilter.hxx
new file mode 100644
index 0000000000..941ba0dae5
--- /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 0000000000..81a505e1f7
--- /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 0000000000..92a5afda4c
--- /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 0000000000..1d5f79de5a
--- /dev/null
+++ b/include/vcl/BitmapPalette.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 <vcl/dllapi.h>
+#include <vcl/BitmapColor.hxx>
+#include <vcl/checksum.hxx>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <array>
+
+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);
+ template <size_t N> BitmapPalette(const std::array<BitmapColor, N>& colors);
+ 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);
+
+ /// Returns the BitmapColor (i.e. palette index) that is either an exact match
+ /// of the required color, or failing that, the entry that is the closest i.e. least error
+ /// as measured by Color::GetColorError.
+ sal_uInt16 GetBestIndex(const BitmapColor& rCol) const;
+ /// Returns the BitmapColor (i.e. palette index) that is an exact match
+ /// of the required color. Returns SAL_MAX_UINT16 if nothing found.
+ sal_uInt16 GetMatchingIndex(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:
+ BitmapPalette(const BitmapColor* first, const BitmapColor* last);
+
+ ImplType mpImpl;
+};
+
+template <size_t N>
+BitmapPalette::BitmapPalette(const std::array<BitmapColor, N>& colors)
+ : BitmapPalette(colors.data(), colors.data() + N)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapPopArtFilter.hxx b/include/vcl/BitmapPopArtFilter.hxx
new file mode 100644
index 0000000000..c25804d359
--- /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_uInt16 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 0000000000..5a99adb56b
--- /dev/null
+++ b/include/vcl/BitmapReadAccess.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 .
+ */
+#pragma once
+
+#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(const Bitmap& rBitmap,
+ BitmapAccessMode nMode = BitmapAccessMode::Read);
+ VCL_DLLPUBLIC BitmapReadAccess(const AlphaMask& 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!");
+
+ return GetPixelFromData(GetScanline(nY), nX);
+ }
+
+ BitmapColor GetPixel(const Point& point) const { return GetPixel(point.Y(), point.X()); }
+
+ BitmapColor GetColorFromData(sal_uInt8* pData, tools::Long nX) const
+ {
+ if (HasPalette())
+ return GetPaletteColor(GetIndexFromData(pData, nX));
+ else
+ return GetPixelFromData(pData, nX);
+ }
+
+ BitmapColor GetColor(tools::Long nY, tools::Long nX) const
+ {
+ assert(mpBuffer && "Access is not valid!");
+ assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ return GetColorFromData(GetScanline(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 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 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);
+};
+
+class BitmapScopedReadAccess
+{
+public:
+ BitmapScopedReadAccess(const Bitmap& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedReadAccess(const AlphaMask& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedReadAccess() {}
+
+ BitmapScopedReadAccess& operator=(const Bitmap& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ BitmapScopedReadAccess& operator=(const AlphaMask& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ bool operator!() const { return !moAccess.has_value() || !*moAccess; }
+ explicit operator bool() const { return moAccess && bool(*moAccess); }
+
+ void reset() { moAccess.reset(); }
+
+ BitmapReadAccess* get() { return moAccess ? &*moAccess : nullptr; }
+ const BitmapReadAccess* get() const { return moAccess ? &*moAccess : nullptr; }
+
+ BitmapReadAccess* operator->() { return &*moAccess; }
+ const BitmapReadAccess* operator->() const { return &*moAccess; }
+
+ BitmapReadAccess& operator*() { return *moAccess; }
+ const BitmapReadAccess& operator*() const { return *moAccess; }
+
+private:
+ std::optional<BitmapReadAccess> moAccess;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapSeparableUnsharpenFilter.hxx b/include/vcl/BitmapSeparableUnsharpenFilter.hxx
new file mode 100644
index 0000000000..69dcfe3bf9
--- /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 0000000000..3121987ed0
--- /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 0000000000..d4a3207a13
--- /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 0000000000..079e1d418d
--- /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 0000000000..7e306e051c
--- /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 0000000000..1a002c960d
--- /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 0000000000..31e56bf5ae
--- /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 0000000000..f3e36e10fa
--- /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 0000000000..f06f736e45
--- /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
+
+VCL_DLLPUBLIC sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a);
+VCL_DLLPUBLIC 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,
+ sal_Int8 nBitsPerPixel,
+ 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/BitmapWriteAccess.hxx b/include/vcl/BitmapWriteAccess.hxx
new file mode 100644
index 0000000000..9027210adb
--- /dev/null
+++ b/include/vcl/BitmapWriteAccess.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/.
+ *
+ */
+#pragma once
+
+#include <vcl/alpha.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/BitmapReadAccess.hxx>
+#include <optional>
+
+class VCL_DLLPUBLIC BitmapWriteAccess final : public BitmapReadAccess
+{
+public:
+ BitmapWriteAccess(Bitmap& rBitmap);
+ BitmapWriteAccess(AlphaMask& rBitmap);
+ virtual ~BitmapWriteAccess() override;
+
+ void CopyScanline(tools::Long nY, const BitmapReadAccess& rReadAcc);
+ void CopyScanline(tools::Long nY, ConstScanline aSrcScanline, ScanlineFormat nSrcScanlineFormat,
+ sal_uInt32 nSrcScanlineSize);
+
+ void SetPalette(const BitmapPalette& rPalette)
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ mpBuffer->maPalette = rPalette;
+ }
+
+ void SetPaletteEntryCount(sal_uInt16 nCount)
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ mpBuffer->maPalette.SetEntryCount(nCount);
+ }
+
+ void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor)
+ {
+ assert(mpBuffer && "Access is not valid!");
+ assert(HasPalette() && "Bitmap has no palette!");
+
+ mpBuffer->maPalette[nColor] = rBitmapColor;
+ }
+
+ void SetPixel(tools::Long nY, tools::Long nX, const BitmapColor& rBitmapColor)
+ {
+ assert(mpBuffer && "Access is not valid!");
+ assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
+
+ mFncSetPixel(GetScanline(nY), nX, rBitmapColor, maColorMask);
+ }
+
+ void SetPixelIndex(tools::Long nY, tools::Long nX, sal_uInt8 cIndex)
+ {
+ SetPixel(nY, nX, BitmapColor(cIndex));
+ }
+
+ void SetLineColor(const Color& rColor);
+
+ void SetFillColor();
+ void SetFillColor(const Color& rColor);
+
+ void Erase(const Color& rColor);
+
+ void DrawLine(const Point& rStart, const Point& rEnd);
+
+ void FillRect(const tools::Rectangle& rRect);
+ void DrawRect(const tools::Rectangle& rRect);
+
+private:
+ std::optional<BitmapColor> mpLineColor;
+ std::optional<BitmapColor> mpFillColor;
+
+ BitmapWriteAccess() = delete;
+ BitmapWriteAccess(const BitmapWriteAccess&) = delete;
+ BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete;
+};
+
+class BitmapScopedWriteAccess
+{
+public:
+ BitmapScopedWriteAccess(Bitmap& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedWriteAccess(AlphaMask& rBitmap)
+ : moAccess(rBitmap)
+ {
+ }
+ BitmapScopedWriteAccess() {}
+
+ BitmapScopedWriteAccess& operator=(Bitmap& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ BitmapScopedWriteAccess& operator=(AlphaMask& rBitmap)
+ {
+ moAccess.emplace(rBitmap);
+ return *this;
+ }
+
+ bool operator!() const { return !moAccess.has_value() || !*moAccess; }
+ explicit operator bool() const { return moAccess && bool(*moAccess); }
+
+ void reset() { moAccess.reset(); }
+
+ BitmapWriteAccess* get() { return moAccess ? &*moAccess : nullptr; }
+ const BitmapWriteAccess* get() const { return moAccess ? &*moAccess : nullptr; }
+
+ BitmapWriteAccess* operator->() { return &*moAccess; }
+ const BitmapWriteAccess* operator->() const { return &*moAccess; }
+
+ BitmapWriteAccess& operator*() { return *moAccess; }
+ const BitmapWriteAccess& operator*() const { return *moAccess; }
+
+private:
+ std::optional<BitmapWriteAccess> moAccess;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/ColorMask.hxx b/include/vcl/ColorMask.hxx
new file mode 100644
index 0000000000..7610aa87e8
--- /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/DocWindow.hxx b/include/vcl/DocWindow.hxx
new file mode 100644
index 0000000000..681ad11041
--- /dev/null
+++ b/include/vcl/DocWindow.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_VCL_DOCWINDOW_HXX
+#define INCLUDED_VCL_DOCWINDOW_HXX
+
+#include <vcl/window.hxx>
+
+namespace vcl
+{
+class VCL_DLLPUBLIC DocWindow : public Window
+{
+ // inherit all Window constructors
+ using Window::Window;
+
+public:
+ virtual void SetPointer(PointerStyle) override;
+};
+} // namespace vcl
+
+#endif // INCLUDED_VCL_DOCWINDOW_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 0000000000..b8e02efd1f
--- /dev/null
+++ b/include/vcl/EnumContext.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_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() 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 0000000000..9a2bb1f51f
--- /dev/null
+++ b/include/vcl/FilterConfigItem.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_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();
+
+ bool IsReadOnly(const OUString& rPropName);
+
+ // 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/GestureEventPan.hxx b/include/vcl/GestureEventPan.hxx
new file mode 100644
index 0000000000..4ce0866a91
--- /dev/null
+++ b/include/vcl/GestureEventPan.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/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+
+enum class GestureEventPanType
+{
+ Begin,
+ Update,
+ End
+};
+
+enum class PanningOrientation
+{
+ Horizontal,
+ Vertical
+};
+
+class VCL_DLLPUBLIC GestureEventPan
+{
+public:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ GestureEventPanType meEventType;
+
+ sal_Int32 mnOffset;
+ PanningOrientation meOrientation;
+
+ GestureEventPan()
+ : mnX(0)
+ , mnY(0)
+ , meEventType(GestureEventPanType::Begin)
+ , mnOffset(0)
+ , meOrientation(PanningOrientation::Horizontal)
+ {
+ }
+
+ GestureEventPan(sal_Int32 nX, sal_Int32 nY, GestureEventPanType eEventType, sal_Int32 nOffset,
+ PanningOrientation eOrientation)
+ : mnX(nX)
+ , mnY(nY)
+ , meEventType(eEventType)
+ , mnOffset(nOffset)
+ , meOrientation(eOrientation)
+ {
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GestureEventRotate.hxx b/include/vcl/GestureEventRotate.hxx
new file mode 100644
index 0000000000..39f4b310f9
--- /dev/null
+++ b/include/vcl/GestureEventRotate.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/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+
+enum class GestureEventRotateType
+{
+ Begin,
+ Update,
+ End
+};
+
+class VCL_DLLPUBLIC GestureEventRotate
+{
+public:
+ sal_Int32 mnX = 0;
+ sal_Int32 mnY = 0;
+
+ GestureEventRotateType meEventType = GestureEventRotateType::Begin;
+
+ // The difference of between the current gesture scale and the scale at the beginning of the
+ // gesture.
+ double mfAngleDelta = 0;
+
+ GestureEventRotate() = default;
+
+ GestureEventRotate(sal_Int32 nInitialX, sal_Int32 nInitialY, GestureEventRotateType eEventType,
+ double fAngleDelta)
+ : mnX(nInitialX)
+ , mnY(nInitialY)
+ , meEventType(eEventType)
+ , mfAngleDelta(fAngleDelta)
+ {
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GestureEventZoom.hxx b/include/vcl/GestureEventZoom.hxx
new file mode 100644
index 0000000000..3c4e637aca
--- /dev/null
+++ b/include/vcl/GestureEventZoom.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/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/dllapi.h>
+
+enum class GestureEventZoomType
+{
+ Begin,
+ Update,
+ End
+};
+
+class VCL_DLLPUBLIC GestureEventZoom
+{
+public:
+ sal_Int32 mnX = 0;
+ sal_Int32 mnY = 0;
+
+ GestureEventZoomType meEventType = GestureEventZoomType::Begin;
+
+ // The difference of between the current gesture scale and the scale at the beginning of the
+ // gesture.
+ double mfScaleDelta = 0;
+
+ GestureEventZoom() = default;
+
+ GestureEventZoom(sal_Int32 nX, sal_Int32 nY, GestureEventZoomType eEventType,
+ double fScaleDelta)
+ : mnX(nX)
+ , mnY(nY)
+ , meEventType(eEventType)
+ , mfScaleDelta(fScaleDelta)
+ {
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx
new file mode 100644
index 0000000000..442158cda2
--- /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 0000000000..58317f828c
--- /dev/null
+++ b/include/vcl/GraphicExternalLink.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_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+#define INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <utility>
+
+class VCL_DLLPUBLIC GraphicExternalLink
+{
+public:
+ OUString msURL;
+
+ GraphicExternalLink() {}
+
+ GraphicExternalLink(OUString aURL)
+ : msURL(std::move(aURL))
+ {
+ }
+};
+
+#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 0000000000..d99c547313
--- /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 0000000000..7ef2adee8b
--- /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 0000000000..2f82aa1583
--- /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 0000000000..4ee6b4f5d3
--- /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( Graphic aGraphic );
+ 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 0000000000..f4a913576e
--- /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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 0000000000..49e22c3c53
--- /dev/null
+++ b/include/vcl/IDialogRenderable.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_IDIALOGRENDERABLE_HXX
+#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX
+
+#include <config_options.h>
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+namespace tools { class Rectangle; }
+
+class SfxItemSet;
+
+namespace vcl
+{
+
+typedef std::pair<const OString, const OString> LOKPayloadItem;
+
+typedef sal_uInt32 LOKWindowId;
+
+class 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 OString& pPayload) const = 0;
+
+ /// Emits a LOK_CALLBACK_INVALIDATE_TILES.
+ virtual void notifyInvalidation(tools::Rectangle const *) 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 0000000000..be6c050ad3
--- /dev/null
+++ b/include/vcl/ITiledRenderable.hxx
@@ -0,0 +1,390 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.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/viewsh.hxx>
+#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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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;
+
+ /**
+ * Get the data area size (in Calc last column and row).
+ */
+ virtual Size getDataArea(long /*nPart*/)
+ {
+ return Size(1, 1);
+ }
+
+ /**
+ * 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) {}
+
+ /**
+ * Get the currently used EditMode (supported in Impress).
+ */
+ virtual int getEditMode()
+ {
+ return 0;
+ }
+
+ /**
+ * Set the currently used EditMode (supported in Impress).
+ */
+ virtual void setEditMode(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 ""_ostr;
+ }
+
+ /**
+ * 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&) {}
+
+ /**
+ * Allow / disable drawing current text edit (used in Impress for slide previews)
+ */
+ virtual void setPaintTextEdit(bool) {}
+
+ /// Decides if it's OK to call getCommandValues(rCommand).
+ virtual bool supportsCommand(std::u16string_view /*rCommand*/) { return false; }
+
+ /// Returns a json mapping of the possible values for the given command.
+ virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, std::string_view /*rCommand*/)
+ {
+ }
+
+ /**
+ * Returns an opaque string reflecting the render state of a component
+ * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ * @param pViewShell the view to get the options from, if nullptr the current view shell is used
+ */
+ virtual OString getViewRenderState(SfxViewShell* = nullptr) { return rtl::OString(); }
+};
+} // 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 0000000000..5d1fa4a68b
--- /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 OUString HIGH_CONTRAST_ID_BRIGHT = u"sifr"_ustr;
+ static constexpr OUString HIGH_CONTRAST_ID_DARK = u"sifr_dark"_ustr;
+
+ /** 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 0000000000..4de20d74e9
--- /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 0000000000..ba4aa4c313
--- /dev/null
+++ b/include/vcl/InterimItemWindow.hxx
@@ -0,0 +1,78 @@
+/* -*- 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;
+
+ void SetPriority(TaskPriority nPriority);
+
+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 OUString& 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 0000000000..6ded466585
--- /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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 0000000000..bde01fa194
--- /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 0000000000..a011e125e2
--- /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 0000000000..12c924dbb8
--- /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 0000000000..fbf8cfce1f
--- /dev/null
+++ b/include/vcl/Scanline.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_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,
+
+ 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, 0x0001fb11> {};
+}
+
+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 0000000000..b27b3a316a
--- /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 0000000000..e85b25b1cf
--- /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 0000000000..fe1fcd5d73
--- /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 aGraphic);
+ ~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 0000000000..073902f2d1
--- /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/WindowPosSize.hxx b/include/vcl/WindowPosSize.hxx
new file mode 100644
index 0000000000..6c5484c47b
--- /dev/null
+++ b/include/vcl/WindowPosSize.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_FRAMEPOSSIZE_HXX
+#define INCLUDED_VCL_FRAMEPOSSIZE_HXX
+
+#include <vcl/dllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/string.hxx>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+namespace vcl
+{
+/**
+ * There are multiple ways to store the two different areas of a vcl::Window.
+ * But this representation is hopefully less error prone from the used types
+ * and more clear in what values in- or exclude the non-drawable window frame.
+ *
+ * There are especially two things to remember:
+ * * pos() is the top-left position of the window frame
+ * * size() returns just the drawable client area
+ *
+ * So these values actually don't represent any "real" geometry of either the
+ * outer frame or the inner client area of the window. That's my reason for
+ * naming the rectangle function posSize() instead of geometry(). Also to not
+ * be confused with Qt's geometry() function. YMMV.
+ *
+ * LO already is supposed to use this schema. FWIW, the Qt documentation claims
+ * "The differentiation is done in a way that covers the most common usage
+ * transparently." AFAIK this is common for most/all platforms / UI toolkits.
+ *
+ * The API is kept largely overload free, as we can now use list-initialization.
+ */
+class VCL_PLUGIN_PUBLIC WindowPosSize
+{
+ // position of the window frames left-top corner
+ sal_Int32 m_nX;
+ sal_Int32 m_nY;
+ // size of the client / drawable area, i.e. without decorations / borders
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nHeight;
+
+protected:
+ WindowPosSize()
+ : m_nX(0)
+ , m_nY(0)
+ , m_nWidth(1)
+ , m_nHeight(1)
+ {
+ }
+
+public:
+ constexpr sal_Int32 x() const { return m_nX; }
+ void setX(sal_Int32 nX) { m_nX = nX; }
+ constexpr sal_Int32 y() const { return m_nY; }
+ void setY(sal_Int32 nY) { m_nY = nY; }
+
+ constexpr Point pos() const { return { m_nX, m_nY }; }
+ void setPos(const Point& aPos)
+ {
+ setX(aPos.getX());
+ setY(aPos.getY());
+ }
+ void move(sal_Int32 nDX, sal_Int32 nDY)
+ {
+ m_nX += nDX;
+ m_nY += nDY;
+ }
+
+ constexpr sal_Int32 width() const { return m_nWidth; }
+ void setWidth(sal_Int32 nWidth)
+ {
+ assert(nWidth >= 0);
+ if (nWidth >= 0)
+ m_nWidth = nWidth;
+ else
+ m_nWidth = 0;
+ }
+
+ constexpr sal_Int32 height() const { return m_nHeight; }
+ void setHeight(sal_Int32 nHeight)
+ {
+ assert(nHeight >= 0);
+ if (nHeight >= 0)
+ m_nHeight = nHeight;
+ else
+ m_nHeight = 0;
+ }
+
+ constexpr Size size() const
+ {
+ return { static_cast<tools::Long>(m_nWidth), static_cast<tools::Long>(m_nHeight) };
+ }
+ void setSize(const Size& rSize)
+ {
+ setWidth(rSize.Width());
+ setHeight(rSize.Height());
+ }
+
+ constexpr tools::Rectangle posSize() const { return { pos(), size() }; }
+ void setPosSize(const tools::Rectangle& rRect)
+ {
+ setPos(rRect.GetPos());
+ setSize(rRect.GetSize());
+ }
+ // because tools::Rectangle has the ambiguous (Point&, Point&) constructor, which we don't want here
+ void setPosSize(const Point& rPos, const Size& rSize) { setPosSize({ rPos, rSize }); }
+};
+
+inline std::ostream& operator<<(std::ostream& s, const WindowPosSize& rPosSize)
+{
+ s << rPosSize.width() << "x" << rPosSize.height() << "@(" << rPosSize.x() << "," << rPosSize.y()
+ << ")";
+ return s;
+}
+
+} // namespace vcl
+
+#endif // INCLUDED_VCL_FRAMEPOSSIZE_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 0000000000..793d8cdd36
--- /dev/null
+++ b/include/vcl/abstdlg.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_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<OUString> getAllPageUIXMLDescriptions() const;
+ virtual bool selectPageByUIXMLDescription(const OUString& rUIXMLDescription);
+ virtual BitmapEx createScreenshot() const;
+ virtual OUString GetScreenshotId() const { return {}; };
+};
+
+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;
+ virtual void Response(sal_Int32) = 0;
+ virtual void AllowEmpty() = 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/accessibility/AccessibleTextAttributeHelper.hxx b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
new file mode 100644
index 0000000000..00c9c38392
--- /dev/null
+++ b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/beans/PropertyValue.hdl>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+
+/**
+ * According to the IAccessible2 specification, some of the attributes that LibreOffice
+ * handles as text attributes are mapped to IAccessible2 text attributes as well,
+ * but others should be reported as object attributes (e.g. text alignment is reported
+ * via the "text-align" object attribute on the paragraph object).
+ *
+ * https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes
+ * https://wiki.linuxfoundation.org/accessibility/iaccessible2/objectattributes
+ *
+ * This enum class is used to specify the type(s) of attributes of interest.
+ */
+enum class IA2AttributeType
+{
+ None = 0x0000,
+ ObjectAttributes = 0x0001,
+ TextAttributes = 0x0002
+};
+
+template <> struct o3tl::typed_flags<IA2AttributeType> : is_typed_flags<IA2AttributeType, 0x003>
+{
+};
+
+class VCL_DLLPUBLIC AccessibleTextAttributeHelper
+{
+public:
+ /** Converts UNO text attribute properties to a string holding
+ * the corresponding IAccessible2 text attributes.
+ * @param rUnoAttributes A sequence holding the UNO text attributes.
+ * @param eAttributeType: The type(s) of attributes of interest.
+ * @returns String holding the corresponding IAccessible2 text properties.
+ */
+ static OUString ConvertUnoToIAccessible2TextAttributes(
+ const css::uno::Sequence<css::beans::PropertyValue>& rUnoAttributes,
+ IA2AttributeType eAttributeType);
+
+ /**
+ * Get the IAccessible2 text attributes and the span of the attributes at the given index.
+ * @param xText The interface to query for the information.
+ * @param eAttributeType: The type(s) of attributes of interest.
+ * @param nOffset Character offset for which to retrieve the information.
+ * @param rStartOffset Out param that is set to the start index of the attribute run.
+ * @param rEndOffset Out param that is set to the end index of the attribute run.
+ * @return IAccessible2 text attributes at the given character offset.
+ */
+ static OUString
+ GetIAccessible2TextAttributes(css::uno::Reference<css::accessibility::XAccessibleText> xText,
+ IA2AttributeType eAttributeType, sal_Int32 nOffset,
+ sal_Int32& rStartOffset, sal_Int32& rEndOffset);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx
new file mode 100644
index 0000000000..fde375c798
--- /dev/null
+++ b/include/vcl/accessiblefactory.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_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>
+#include <rtl/ref.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 rtl::Reference<vcl::IAccessibleBrowseBox>
+ createAccessibleBrowseBox(
+ const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
+ vcl::IAccessibleTableProvider& _rBrowseBox
+ ) const = 0;
+ virtual rtl::Reference<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 0000000000..66f5a1e5c0
--- /dev/null
+++ b/include/vcl/accessibletable.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_VCL_ACCESSIBLETABLE_HXX
+#define INCLUDED_VCL_ACCESSIBLETABLE_HXX
+
+#include <tools/gen.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <cppuhelper/implbase.hxx>
+
+namespace vcl { class Window; }
+
+namespace vcl::table
+{
+
+typedef sal_Int32 RowPos;
+
+enum class AccessibleTableControlObjType
+{
+ GRIDCONTROL, /// The GridControl itself.
+ TABLE, /// The data table.
+ ROWHEADERBAR, /// The row header bar.
+ 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.
+};
+
+
+/** 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( sal_Int64& rStateSet,
+ AccessibleTableControlObjType eObjType ) const= 0;
+
+ // Window
+ virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const = 0;
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) 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( sal_Int64& _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 ::cppu::WeakImplHelper< css::accessibility::XAccessible >
+{
+public:
+
+ /** 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 0000000000..30eafea496
--- /dev/null
+++ b/include/vcl/accessibletableprovider.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 .
+ */
+
+#ifndef INCLUDED_VCL_ACCESSIBLETABLEPROVIDER_HXX
+#define INCLUDED_VCL_ACCESSIBLETABLEPROVIDER_HXX
+
+#include <vcl/AccessibleBrowseBoxObjType.hxx>
+#include <vcl/window.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+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 GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen ) = 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( sal_Int64& _rStateSet, AccessibleBrowseBoxObjType _eType ) const = 0;
+ virtual void FillAccessibleStateSetForCell( sal_Int64& _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 AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const = 0;
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) 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;
+
+ /** Returns the accessible object for the table.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible> getTable() = 0;
+
+protected:
+ ~IAccessibleTabListBox() {}
+};
+
+/** interface for an implementation of a browse box's Accessible component
+*/
+class IAccessibleBrowseBox : public cppu::WeakImplHelper<css::accessibility::XAccessible>
+{
+public:
+ /** 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 0000000000..fb5be9c163
--- /dev/null
+++ b/include/vcl/alpha.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_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:
+ AlphaMask();
+ explicit AlphaMask( const Bitmap& rBitmap );
+ AlphaMask( const AlphaMask& rAlphaMask );
+ AlphaMask( AlphaMask&& rAlphaMask );
+ explicit AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency = nullptr );
+ ~AlphaMask();
+
+ AlphaMask& operator=( const Bitmap& rBitmap );
+ AlphaMask& operator=( const AlphaMask& rAlphaMask ) { maBitmap = rAlphaMask.maBitmap; return *this; }
+ AlphaMask& operator=( AlphaMask&& rAlphaMask ) noexcept { maBitmap = std::move(rAlphaMask.maBitmap); return *this; }
+ bool operator==( const AlphaMask& rAlphaMask ) const { return maBitmap == rAlphaMask.maBitmap; }
+ bool operator!=( const AlphaMask& rAlphaMask ) const { return maBitmap != rAlphaMask.maBitmap; }
+
+ Bitmap const & GetBitmap() const { return maBitmap; }
+
+ void Erase( sal_uInt8 cTransparency );
+ void BlendWith(const AlphaMask& rOther);
+
+ /** Perform boolean OR operation with another alpha-mask
+
+ @param rMask
+ The mask bitmap in the selected combine operation
+
+ @return true, if the operation was completed successfully.
+ */
+ bool AlphaCombineOr( const AlphaMask& rMask );
+
+ // check if alpha is used, returns true if at least one pixel has transparence
+ bool hasAlpha() const;
+
+ bool IsEmpty() const { return maBitmap.IsEmpty(); }
+
+ void SetEmpty() { maBitmap.SetEmpty(); }
+
+ vcl::PixelFormat getPixelFormat() const { return maBitmap.getPixelFormat(); }
+
+ sal_Int64 GetSizeBytes() const { return maBitmap.GetSizeBytes(); }
+
+ Size GetSizePixel() const { return maBitmap.GetSizePixel(); }
+
+ void SetPrefSize( const Size& rSize ) { maBitmap.SetPrefSize(rSize); }
+
+ void SetPrefMapMode( const MapMode& rMapMode ) { maBitmap.SetPrefMapMode(rMapMode); }
+
+ BitmapChecksum GetChecksum() const { return maBitmap.GetChecksum(); }
+
+ bool Invert();
+
+ bool Mirror( BmpMirrorFlags nMirrorFlags ) { return maBitmap.Mirror(nMirrorFlags); }
+
+ bool Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default ) { return maBitmap.Scale(rNewSize, nScaleFlag); }
+
+ bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default )
+ { return maBitmap.Scale(rScaleX, rScaleY, nScaleFlag); }
+
+ bool Convert( BmpConversion eConversion ) { return maBitmap.Convert(eConversion); }
+
+ vcl::Region CreateRegion( const Color& rColor, const tools::Rectangle& rRect ) const { return maBitmap.CreateRegion(rColor, rRect); }
+
+ bool Rotate( Degree10 nAngle10, const Color& rFillColor ) { return maBitmap.Rotate(nAngle10, rFillColor); }
+
+ bool Crop( const tools::Rectangle& rRectPixel ) { return maBitmap.Crop(rRectPixel); }
+
+ bool Expand( sal_Int32 nDX, sal_Int32 nDY, const Color* pInitColor = nullptr ) { return maBitmap.Expand(nDX, nDY, pInitColor); }
+
+ bool CopyPixel( const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc )
+ { return maBitmap.CopyPixel(rRectDst, rRectSrc); }
+
+ bool CopyPixel( const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const AlphaMask& rBmpSrc )
+ { return maBitmap.CopyPixel(rRectDst, rRectSrc, rBmpSrc.maBitmap); }
+
+ bool CopyPixel_AlphaOptimized(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc )
+ { return maBitmap.CopyPixel_AlphaOptimized(rRectDst, rRectSrc); }
+
+ bool CopyPixel_AlphaOptimized(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const AlphaMask& rBmpSrc )
+ { return maBitmap.CopyPixel_AlphaOptimized(rRectDst, rRectSrc, rBmpSrc); }
+
+private:
+ friend class BitmapEx;
+ friend class ::OutputDevice;
+ friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm, bool bFileHeader, bool bMSOFormat);
+
+ Bitmap maBitmap;
+};
+
+#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 0000000000..cd8c464c05
--- /dev/null
+++ b/include/vcl/animate/Animation.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_ANIMATE_ANIMATION_HXX
+#define INCLUDED_VCL_ANIMATE_ANIMATION_HXX
+
+#include <tools/solar.h>
+#include <vcl/dllapi.h>
+#include <vcl/timer.hxx>
+#include <vcl/animate/AnimationFrame.hxx>
+
+#define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
+
+class AnimationRenderer;
+struct AnimationData;
+
+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 nRendererId, OutputDevice* pFirstFrameOutDev);
+
+ void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nRendererId = 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<AnimationFrame>>& GetAnimationFrames() { return maFrames; }
+ size_t Count() const { return maFrames.size(); }
+ bool Insert(const AnimationFrame& rAnimationFrame);
+ const AnimationFrame& Get(sal_uInt16 nAnimation) const;
+ void Replace(const AnimationFrame& 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() { gAnimationRendererCount++; }
+ SAL_DLLPRIVATE static void ImplDecAnimCount() { gAnimationRendererCount--; }
+ SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnFrameIndex; }
+
+private:
+ SAL_DLLPRIVATE static sal_uLong gAnimationRendererCount;
+
+ std::vector<std::unique_ptr<AnimationFrame>> maFrames;
+ std::vector<std::unique_ptr<AnimationRenderer>> maRenderers;
+
+ Link<Animation*, void> maNotifyLink;
+ BitmapEx maBitmapEx;
+ Timer maTimer;
+ Size maGlobalSize;
+ sal_uInt32 mnLoopCount;
+ sal_uInt32 mnLoops;
+ size_t mnFrameIndex;
+ bool mbIsInAnimation;
+ bool mbLoopTerminated;
+
+ SAL_DLLPRIVATE std::vector<std::unique_ptr<AnimationData>> CreateAnimationDataItems();
+ SAL_DLLPRIVATE void PopulateRenderers();
+ SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
+ SAL_DLLPRIVATE void PruneMarkedRenderers();
+ SAL_DLLPRIVATE bool IsAnyRendererActive();
+
+ 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/AnimationFrame.hxx b/include/vcl/animate/AnimationFrame.hxx
new file mode 100644
index 0000000000..3e9a4b21d1
--- /dev/null
+++ b/include/vcl/animate/AnimationFrame.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 <vcl/bitmapex.hxx>
+
+enum class Disposal
+{
+ Not,
+ Back,
+ Previous
+};
+
+enum class Blend
+{
+ Source,
+ Over
+};
+
+struct AnimationFrame
+{
+ BitmapEx maBitmapEx;
+ Point maPositionPixel;
+ Size maSizePixel;
+ tools::Long mnWait;
+ Disposal meDisposal;
+ Blend meBlend;
+ bool mbUserInput;
+
+ AnimationFrame()
+ : mnWait(0)
+ , meDisposal(Disposal::Not)
+ , meBlend(Blend::Over)
+ , mbUserInput(false)
+ {
+ }
+
+ AnimationFrame(const BitmapEx& rBitmapEx, const Point& rPositionPixel, const Size& rSizePixel,
+ tools::Long nWait = 0, Disposal eDisposal = Disposal::Not,
+ Blend eBlend = Blend::Over)
+ : maBitmapEx(rBitmapEx)
+ , maPositionPixel(rPositionPixel)
+ , maSizePixel(rSizePixel)
+ , mnWait(nWait)
+ , meDisposal(eDisposal)
+ , meBlend(eBlend)
+ , mbUserInput(false)
+ {
+ }
+
+ bool operator==(const AnimationFrame& rAnimationFrame) const
+ {
+ return (rAnimationFrame.maBitmapEx == maBitmapEx
+ && rAnimationFrame.maPositionPixel == maPositionPixel
+ && rAnimationFrame.maSizePixel == maSizePixel && rAnimationFrame.mnWait == mnWait
+ && rAnimationFrame.meDisposal == meDisposal && rAnimationFrame.meBlend == meBlend
+ && rAnimationFrame.mbUserInput == mbUserInput);
+ }
+
+ bool operator!=(const AnimationFrame& rAnimationFrame) const
+ {
+ return !(*this == rAnimationFrame);
+ }
+
+ BitmapChecksum GetChecksum() const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
new file mode 100644
index 0000000000..8ce5d9cf74
--- /dev/null
+++ b/include/vcl/bitmap.hxx
@@ -0,0 +1,652 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <tools/helpers.hxx>
+#include <vcl/checksum.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/mapmod.hxx>
+#include <vcl/region.hxx>
+#include <vcl/bitmap/BitmapTypes.hxx>
+
+#include <o3tl/typed_flags_set.hxx>
+
+#include <algorithm>
+#include <memory>
+
+inline sal_uInt8 GAMMA(double _def_cVal, double _def_InvGamma)
+{
+ return FRound(std::clamp(pow(_def_cVal / 255.0, _def_InvGamma) * 255.0, 0.0, 255.0));
+}
+
+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;
+
+namespace basegfx { class SystemDependentDataHolder; }
+
+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 final
+{
+public:
+
+ Bitmap();
+ Bitmap( const Bitmap& rBitmap );
+ Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal = nullptr );
+ explicit Bitmap( std::shared_ptr<SalBitmap> xSalBitmap );
+ ~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& rBmpSrc );
+
+ /** Copy a rectangular area inside this bitmap.
+
+ @param rRectDst
+ Destination rectangle in this bitmap. This is clipped to the
+ bitmap dimensions.
+
+ @param rRectSrc
+ Source rectangle. This is clipped to the
+ 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.
+
+ @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 );
+
+ bool CopyPixel_AlphaOptimized(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc,
+ const AlphaMask& rBmpSrc );
+
+ bool CopyPixel_AlphaOptimized(
+ const tools::Rectangle& rRectDst,
+ const tools::Rectangle& rRectSrc );
+
+ /** 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
+
+ @return the resulting bitmask.
+ */
+ Bitmap CreateMask( const Color& rTransColor ) const;
+
+ /** 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 ) const;
+
+ /** Create on-off alpha 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
+
+ @return the resulting bitmask.
+ */
+ AlphaMask CreateAlphaMask( const Color& rTransColor ) const;
+
+ /** Create on-off alpha 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.
+ */
+ AlphaMask CreateAlphaMask( const Color& rTransColor, sal_uInt8 nTol ) 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;
+
+ /** 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 where the given mask/alpha layer 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 ReplaceMask( const AlphaMask& rMask, 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 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 );
+
+ /** Remove existing blending against COL_WHITE based on given AlphaMask
+
+ Inside convertToBitmapEx the content gets rendered to RGB target (no 'A'),
+ so it gets blended against the start condition of the target device which
+ is blank (usually white background, but others may be used).
+ Usually rendering to RGB is sufficient (e.g. EditViews), but for conversion
+ to BitmapEx the alpha channel is needed to e.g. allow export/conversion to
+ pixel target formats which support Alpha, e.g. PNG.
+ It is possible though to create the fully valid and correct AlphaChannel.
+ If the content, the start condition and the alpha values are known it is
+ possible to calculate back ("remove") the white blending from the result,
+ and this is what this method does.
+
+ @param rColor
+ The Color we know this Bitmap is blended against (usually COL_WHITE)
+
+ @param rAlphaMask
+ The AlphaMask which was used to blend white against this
+ */
+ void RemoveBlendedStartColor(
+ const Color& rColor,
+ const AlphaMask& rAlphaMask);
+
+ // access to SystemDependentDataHolder, to support overload in derived class(es)
+ const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const;
+
+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();
+
+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 0000000000..6f1cc220a9
--- /dev/null
+++ b/include/vcl/bitmap/BitmapTypes.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 <sal/types.h>
+#include <cassert>
+
+namespace vcl
+{
+/** Pixel format of the bitmap in bits per pixel */
+enum class PixelFormat
+{
+ INVALID = 0,
+ 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:
+ case 4:
+ assert(false && "no longer supported");
+ 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 0000000000..c159e7d491
--- /dev/null
+++ b/include/vcl/bitmapex.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_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 ClearAlpha();
+
+ 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;
+ const AlphaMask & GetAlphaMask() const { return maAlphaMask; }
+
+ 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 rBmpExSrc
+ The source bitmap to copy from.
+
+ @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& rBmpExSrc );
+
+ /** Copy a rectangular area from one part of the bitmap to another.
+
+ @param rRectDst
+ Destination rectangle in this bitmap. This is clipped to the
+ bitmap dimensions.
+
+ @param rRectSrc
+ Source rectangle in this bitmap. This is clipped to the
+ 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.
+
+ @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 );
+
+ /** 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 ChangeColorAlpha( 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(); }
+
+ /// Dumps the pixels as PNG in bitmap.png.
+ void DumpAsPng(const char* pFileName = nullptr) const;
+
+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;
+ AlphaMask 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 0000000000..64538f8127
--- /dev/null
+++ b/include/vcl/builder.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/.
+ */
+
+#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 <utility>
+#include <vcl/window.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/toolboxid.hxx>
+#include <vcl/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;
+ OUString m_sId;
+ ComboBoxTextItem(OUString sItem, OUString sId)
+ : m_sItem(std::move(sItem))
+ , m_sId(std::move(sId))
+ {
+ }
+};
+
+/// Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc.
+class VCL_DLLPUBLIC VclBuilder
+{
+public:
+ typedef std::map<OUString, OUString> stringmap;
+ typedef std::map<OUString, std::pair<OUString, OUString>> 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,
+ OUString sID = {},
+ css::uno::Reference<css::frame::XFrame> xFrame
+ = 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 OUString& sID);
+
+ //sID may not exist, but must be of type T if it does
+ template <typename T = vcl::Window> T* get(const OUString& sID);
+
+ vcl::Window* get_widget_root();
+
+ //sID may not exist
+ PopupMenu* get_menu(std::u16string_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 OUString& 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
+ {
+ OUString m_sID;
+ VclPtr<vcl::Window> m_pWindow;
+ PackingData m_aPackingData;
+ WinAndId(OUString sId, vcl::Window *pWindow, bool bVertical)
+ : m_sID(std::move(sId))
+ , m_pWindow(pWindow)
+ , m_aPackingData(bVertical)
+ {
+ }
+ };
+ std::vector<WinAndId> m_aChildren;
+
+ struct MenuAndId
+ {
+ OUString m_sID;
+ VclPtr<Menu> m_pMenu;
+ MenuAndId(OUString sId, Menu *pMenu);
+ };
+ std::vector<MenuAndId> m_aMenus;
+
+ struct StringPair
+ {
+ OUString m_sID;
+ OUString m_sValue;
+ StringPair(OUString sId, OUString sValue)
+ : m_sID(std::move(sId))
+ , m_sValue(std::move(sValue))
+ {
+ }
+ };
+
+ struct UStringPair
+ {
+ OUString m_sID;
+ OUString m_sValue;
+ UStringPair(OUString sId, OUString sValue)
+ : m_sID(std::move(sId))
+ , m_sValue(std::move(sValue))
+ {
+ }
+ };
+
+ typedef StringPair RadioButtonGroupMap;
+
+ struct ButtonImageWidgetMap
+ {
+ OUString m_sID;
+ OUString m_sValue;
+ bool m_bRadio;
+ ButtonImageWidgetMap(OUString sId, OUString sValue, bool bRadio)
+ : m_sID(std::move(sId))
+ , m_sValue(std::move(sValue))
+ , m_bRadio(bRadio)
+ {
+ }
+ };
+
+ typedef UStringPair TextBufferMap;
+ typedef UStringPair WidgetAdjustmentMap;
+ typedef UStringPair ButtonMenuMap;
+ typedef UStringPair MnemonicWidgetMap;
+
+ struct ComboBoxModelMap
+ {
+ OUString m_sID;
+ OUString m_sValue;
+ sal_Int32 m_nActiveId;
+ ComboBoxModelMap(OUString sId, OUString sValue, sal_Int32 nActiveId)
+ : m_sID(std::move(sId))
+ , m_sValue(std::move(sValue))
+ , m_nActiveId(nActiveId)
+ {
+ }
+ };
+
+ struct ListStore
+ {
+ typedef std::vector<OUString> row;
+ std::vector<row> m_aEntries;
+ };
+
+ const ListStore* get_model_by_name(const OUString& 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 OUString& sID) const;
+
+ static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer);
+
+ typedef stringmap Adjustment;
+ const Adjustment* get_adjustment_by_name(const OUString& 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<OUString, int> ImageSizeMap;
+
+ struct SizeGroup
+ {
+ std::vector<OUString> m_aWidgets;
+ stringmap m_aProperties;
+ SizeGroup() {}
+ };
+
+
+ struct ParserState
+ {
+ std::locale m_aResLocale;
+
+ std::vector<RadioButtonGroupMap> m_aGroupMaps;
+
+ std::vector<ComboBoxModelMap> m_aModelMaps;
+ std::map<OUString, ListStore> m_aModels;
+
+ std::vector<TextBufferMap> m_aTextBufferMaps;
+ std::map<OUString, 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<OUString, 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();
+ };
+
+ OUString m_sID;
+ OUString 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::u16string_view sID);
+ void delete_by_name(const OUString& 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 OUString &rClass, const OUString &rID,
+ stringmap &rProps, stringmap &rPangoAttributes,
+ stringmap &rAtkProps);
+
+ VclPtr<vcl::Window> makeObject(vcl::Window *pParent,
+ const OUString &rClass, const OUString &rID,
+ stringmap &rVec);
+
+ void connectNumericFormatterAdjustment(const OUString &id, const OUString &rAdjustment);
+ void connectFormattedFormatterAdjustment(const OUString &id, const OUString &rAdjustment);
+
+ static int getImageSize(const stringmap &rMap);
+
+ void extractGroup(const OUString &id, stringmap &rVec);
+ void extractModel(const OUString &id, stringmap &rVec);
+ void extractBuffer(const OUString &id, stringmap &rVec);
+ static bool extractAdjustmentToMap(const OUString &id, stringmap &rVec, std::vector<WidgetAdjustmentMap>& rAdjustmentMap);
+ void extractButtonImage(const OUString &id, stringmap &rMap, bool bRadio);
+ void extractMnemonicWidget(const OUString &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 OUString 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 OUString &rClass,
+ const OUString &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 OUString &rID, std::u16string_view rClass);
+ void handleRow(xmlreader::XmlReader &reader, const OUString &rID);
+ void handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader);
+ VclPtr<Menu> handleMenu(xmlreader::XmlReader &reader, const OUString &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::u16string_view sID, short nResponse);
+
+ OUString 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 OUString& roleName);
+}
+
+template <typename T>
+inline T* VclBuilder::get(VclPtr<T>& ret, const OUString& 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 OUString& 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 0000000000..c6b1b0ccf8
--- /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 0000000000..eddbd4787c
--- /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 OUString& 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 OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); }
+ OUString 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 0000000000..9596b24ccb
--- /dev/null
+++ b/include/vcl/cairo.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 <sal/config.h>
+#include <osl/endian.h>
+#include <vcl/Scanline.hxx>
+#include <vcl/vclptr.hxx>
+#include <config_features.h>
+#include <config_cairo_rgba.h>
+#include <memory>
+
+// Using formats that match cairo's formats.
+// SVP_24BIT_FORMAT is used to store 24-bit images in 3-byte pixels to conserve memory.
+
+/*
+ For internal cairo we have the option --enable-cairo-rgba which is potentially
+ useful for Android or Online to switch the rgb components. For Android cairo then
+ matches the OpenGL GL_RGBA format so we can use it there where we don't have
+ GL_BGRA support. Similarly for Online we can then use cairo's pixel data
+ without needing to swizzle it for use as a canvas ImageData.
+*/
+#if ENABLE_CAIRO_RGBA
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown)
+#define SVP_CAIRO_BLUE 1
+#define SVP_CAIRO_GREEN 2
+#define SVP_CAIRO_RED 0
+#define SVP_CAIRO_ALPHA 3
+#elif defined OSL_BIGENDIAN
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown)
+#define SVP_CAIRO_BLUE 3
+#define SVP_CAIRO_GREEN 2
+#define SVP_CAIRO_RED 1
+#define SVP_CAIRO_ALPHA 0
+#else
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcBgr | ScanlineFormat::TopDown)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | ScanlineFormat::TopDown)
+#define SVP_CAIRO_BLUE 0
+#define SVP_CAIRO_GREEN 1
+#define SVP_CAIRO_RED 2
+#define SVP_CAIRO_ALPHA 3
+#endif
+
+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;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/canvastools.hxx b/include/vcl/canvastools.hxx
new file mode 100644
index 0000000000..778a092261
--- /dev/null
+++ b/include/vcl/canvastools.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_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;
+ class B2DSize;
+}
+
+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& );
+
+ VCL_DLLPUBLIC basegfx::B2DSize b2DSizeFromSize(const Size& rSize);
+ VCL_DLLPUBLIC basegfx::B2DVector b2DVectorFromSize(const Size& rSize);
+ 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 0000000000..ea2c9adb2e
--- /dev/null
+++ b/include/vcl/checksum.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 <sal/config.h>
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+
+#define BITMAP_CHECKSUM_SIZE 4
+
+typedef sal_uInt32 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;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
new file mode 100644
index 0000000000..9491137ace
--- /dev/null
+++ b/include/vcl/commandevent.hxx
@@ -0,0 +1,396 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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/GestureEventPan.hxx>
+#include <vcl/GestureEventZoom.hxx>
+#include <vcl/GestureEventRotate.hxx>
+
+class CommandExtTextInputData;
+class CommandWheelData;
+class CommandScrollData;
+class CommandModKeyData;
+class CommandDialogData;
+class CommandMediaData;
+class CommandSelectionChangeData;
+class CommandGestureSwipeData;
+class CommandGestureLongPressData;
+class CommandGesturePanData;
+class CommandGestureZoomData;
+class CommandGestureRotateData;
+
+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 CommandGestureSwipeData* GetGestureSwipeData() const;
+ const CommandGestureLongPressData* GetLongPressData() const;
+ const CommandGesturePanData* GetGesturePanData() const;
+ const CommandGestureZoomData* GetGestureZoomData() const;
+ const CommandGestureRotateData* GetGestureRotateData() const;
+};
+
+class VCL_DLLPUBLIC CommandExtTextInputData
+{
+private:
+ OUString maText;
+ std::unique_ptr<ExtTextInputAttr[]> mpTextAttr;
+ sal_Int32 mnCursorPos;
+ sal_uInt16 mnCursorFlags;
+ bool mbOnlyCursor;
+
+public:
+ CommandExtTextInputData( OUString aText,
+ 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 (double(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 CommandGestureSwipeData
+{
+ double mnVelocityX;
+public:
+ CommandGestureSwipeData()
+ : mnVelocityX(0)
+ {
+ }
+ CommandGestureSwipeData(double nVelocityX)
+ : mnVelocityX(nVelocityX)
+ {
+ }
+ double getVelocityX() const { return mnVelocityX; }
+};
+
+
+class VCL_DLLPUBLIC CommandGestureLongPressData
+{
+ double mnX;
+ double mnY;
+public:
+ CommandGestureLongPressData()
+ : mnX(0)
+ , mnY(0)
+ {
+ }
+ CommandGestureLongPressData(double nX, double nY)
+ : mnX(nX)
+ , mnY(nY)
+ {
+ }
+ double getX() const { return mnX; }
+ double getY() const { return mnY; }
+};
+
+class VCL_DLLPUBLIC CommandGesturePanData
+{
+public:
+ double const mfX;
+ double const mfY;
+ double const mfOffset;
+ GestureEventPanType const meEventType;
+ PanningOrientation const meOrientation;
+
+ CommandGesturePanData(double fX, double fY, GestureEventPanType eEventType, double fOffset,
+ PanningOrientation eOrientation)
+ : mfX(fX)
+ , mfY(fY)
+ , mfOffset(fOffset)
+ , meEventType(eEventType)
+ , meOrientation(eOrientation)
+ {}
+};
+
+class VCL_DLLPUBLIC CommandGestureZoomData
+{
+public:
+ const double mfX = 0;
+ const double mfY = 0;
+ const GestureEventZoomType meEventType = GestureEventZoomType::Begin;
+ const double mfScaleDelta = 0;
+
+ CommandGestureZoomData(double fX, double fY, GestureEventZoomType eEventType, double fScale)
+ : mfX(fX)
+ , mfY(fY)
+ , meEventType(eEventType)
+ , mfScaleDelta(fScale)
+ {}
+};
+
+class VCL_DLLPUBLIC CommandGestureRotateData
+{
+public:
+ const double mfX = 0;
+ const double mfY = 0;
+ const GestureEventRotateType meEventType = GestureEventRotateType::Begin;
+ const double mfAngleDelta = 0;
+
+ CommandGestureRotateData(double fX, double fY, GestureEventRotateType eEventType,
+ double fAngleDelta)
+ : mfX(fX)
+ , mfY(fY)
+ , meEventType(eEventType)
+ , mfAngleDelta(fAngleDelta)
+ {}
+};
+
+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,
+ GestureSwipe = 21,
+ GestureLongPress = 22,
+ GesturePan = 23,
+ GestureZoom = 24,
+ GestureRotate = 25,
+};
+
+#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 0000000000..016e53f79b
--- /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 0000000000..c922bcfd18
--- /dev/null
+++ b/include/vcl/ctrl.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_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 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;
+
+ virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const;
+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);
+
+ /// Notify the LOK client about an invalidated area.
+ virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) 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 0000000000..b6adf4926e
--- /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 0000000000..c7504fb94d
--- /dev/null
+++ b/include/vcl/customweld.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_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() { Invalidate(); }
+ 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 SetCursor(void* pData) { m_pDrawingArea->set_cursor_data(pData); }
+ 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 OUString& 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 SetDragDataTransferable(rtl::Reference<TransferDataContainer>& rTransferable,
+ sal_uInt8 eDNDConstants)
+ {
+ m_pDrawingArea->enable_drag_source(rTransferable, 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 OUString& 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 OUString& 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 0000000000..6027f66e56
--- /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 <comphelper/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 0000000000..4ab2fe70d3
--- /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/dialoghelper.hxx b/include/vcl/dialoghelper.hxx
new file mode 100644
index 0000000000..eedc6d37a5
--- /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 0000000000..6064491f8e
--- /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 0000000000..ccfd5e3b80
--- /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 0000000000..511f2f4538
--- /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 0000000000..40ffd28520
--- /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 0000000000..98b6e2bce8
--- /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 OUString& 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 OUString& 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 0000000000..cbf91ee7f0
--- /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, std::u16string_view 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, std::u16string_view 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/errinf.hxx b/include/vcl/errinf.hxx
new file mode 100644
index 0000000000..0f4d8d781d
--- /dev/null
+++ b/include/vcl/errinf.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_VCL_ERRINF_HXX
+#define INCLUDED_VCL_ERRINF_HXX
+
+#include <rtl/ustring.hxx>
+#include <utility>
+#include <comphelper/errcode.hxx>
+#include <vcl/dllapi.h>
+
+#include <vector>
+#include <memory>
+
+#include <limits.h>
+
+namespace weld { class Window; }
+
+class ErrorHandler;
+class ErrorContext;
+enum class DialogMask;
+
+class VCL_DLLPUBLIC ErrorStringFactory
+{
+public:
+ static bool CreateString(const ErrCodeMsg&, 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;
+
+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;
+
+ std::vector<ErrorHandler*> errorHandlers;
+ std::vector<ErrorContext*> contexts;
+};
+
+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(const ErrCodeMsg& nId, weld::Window* pParent = nullptr, DialogMask nMask = DialogMask::MAX);
+ static bool GetErrorString(const ErrCodeMsg& nId, OUString& rStr);
+
+protected:
+ virtual bool CreateString(const ErrCodeMsg&, OUString &) const = 0;
+
+};
+
+struct ImplErrorContext;
+
+class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorContext
+{
+ friend class ErrorHandler;
+
+public:
+ ErrorContext(weld::Window *pWin);
+ virtual ~ErrorContext();
+
+ virtual bool GetString(const ErrCodeMsg& 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 0000000000..83ff1f059e
--- /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 NotifyEventType
+{
+ 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;
+ NotifyEventType mnEventType;
+
+public:
+ NotifyEvent( NotifyEventType 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;
+
+ NotifyEventType 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 == NotifyEventType::KEYINPUT) || (mnEventType == NotifyEventType::KEYUP) )
+ return static_cast<const KeyEvent*>(mpData);
+ else
+ return nullptr;
+}
+
+inline const MouseEvent* NotifyEvent::GetMouseEvent() const
+{
+ if ( (mnEventType >= NotifyEventType::MOUSEBUTTONDOWN) && (mnEventType <= NotifyEventType::MOUSEMOVE) )
+ return static_cast<const MouseEvent*>(mpData);
+ else
+ return nullptr;
+}
+
+inline const CommandEvent* NotifyEvent::GetCommandEvent() const
+{
+ if ( mnEventType == NotifyEventType::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:
+ const AllSettings* mpData;
+ AllSettingsFlags mnFlags;
+ DataChangedEventType mnType;
+
+public:
+ explicit DataChangedEvent( DataChangedEventType nType,
+ const AllSettings* 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 AllSettings* pData,
+ AllSettingsFlags nChangeFlags )
+{
+ mpData = pData;
+ mnFlags = nChangeFlags;
+ mnType = nType;
+}
+
+inline const AllSettings* DataChangedEvent::GetOldSettings() const
+{
+ if ( mnType == DataChangedEventType::SETTINGS )
+ return 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 0000000000..ca6be18a6f
--- /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 0000000000..b0e63a982f
--- /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 0000000000..5374144352
--- /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 0000000000..220aef2e3b
--- /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::u16string_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 0000000000..68a0f26a81
--- /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 0000000000..3c087cf7b1
--- /dev/null
+++ b/include/vcl/filter/PDFiumLibrary.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/.
+ *
+ */
+
+#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>
+#include <vcl/pdf/PDFFormFieldType.hxx>
+#include <vcl/pdf/PDFAnnotAActionType.hxx>
+
+class SvMemoryStream;
+
+namespace vcl::pdf
+{
+inline constexpr OString constDictionaryKeyTitle = "T"_ostr;
+inline constexpr OString constDictionaryKeyContents = "Contents"_ostr;
+inline constexpr OString constDictionaryKeyPopup = "Popup"_ostr;
+inline constexpr OString constDictionaryKeyModificationDate = "M"_ostr;
+inline constexpr OString constDictionaryKeyInteriorColor = "IC"_ostr;
+
+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;
+ /// createBitmap can reduce requested size to possible value
+ 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;
+ virtual PDFFormFieldType getFormFieldType(PDFiumDocument* pDoc) = 0;
+ virtual float getFontSize(PDFiumDocument* pDoc) = 0;
+ virtual OUString getFormFieldAlternateName(PDFiumDocument* pDoc) = 0;
+ virtual int getFormFieldFlags(PDFiumDocument* pDoc) = 0;
+ virtual OUString getFormAdditionalActionJavaScript(PDFiumDocument* pDoc,
+ PDFAnnotAActionType eEvent)
+ = 0;
+ virtual OUString getFormFieldValue(PDFiumDocument* pDoc) = 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;
+
+ virtual void onAfterLoadPage(PDFiumDocument* pDoc) = 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(std::u16string_view 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 0000000000..201e3a08b8
--- /dev/null
+++ b/include/vcl/filter/PngImageReader.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_VCL_FILTER_PNGIMAGEREADER_HXX
+#define INCLUDED_VCL_FILTER_PNGIMAGEREADER_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <vcl/dllapi.h>
+#include <vcl/BinaryDataContainer.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
+constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
+constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
+constexpr sal_uInt32 PNG_PHYS_SIGNATURE = 0x70485973;
+constexpr sal_uInt32 PNG_TRNS_SIGNATURE = 0x74524E53;
+constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
+constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
+constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
+constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
+constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
+constexpr int PNG_SIGNATURE_SIZE = 8;
+constexpr int PNG_IHDR_SIZE = 13;
+constexpr int PNG_TYPE_SIZE = 4;
+constexpr int PNG_SIZE_SIZE = 4;
+constexpr int PNG_CRC_SIZE = 4;
+constexpr int PNG_IEND_SIZE = 0;
+
+namespace com::sun::star::task
+{
+class XStatusIndicator;
+}
+
+class Graphic;
+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);
+ bool read(Graphic& rGraphic);
+ // 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 BinaryDataContainer getMicrosoftGifChunk(SvStream& rStream);
+
+ static bool isAPng(SvStream& rStream);
+};
+
+} // namespace vcl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/filter/PngImageWriter.hxx b/include/vcl/filter/PngImageWriter.hxx
new file mode 100644
index 0000000000..b43c304fc1
--- /dev/null
+++ b/include/vcl/filter/PngImageWriter.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/.
+ */
+
+#include <vcl/dllapi.h>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <tools/stream.hxx>
+#include <vcl/graph.hxx>
+#include <vector>
+
+#pragma once
+
+namespace vcl
+{
+// Similar to png_unknown_chunk
+struct PngChunk
+{
+ std::array<uint8_t, 5> name;
+ std::vector<sal_uInt8> data;
+ size_t size;
+};
+class VCL_DLLPUBLIC PngImageWriter
+{
+ SvStream& mrStream;
+ css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
+
+ sal_Int32 mnCompressionLevel;
+ bool mbInterlaced, mbTranslucent;
+ std::vector<PngChunk> maAdditionalChunks;
+
+public:
+ PngImageWriter(SvStream& rStream);
+
+ void setParameters(css::uno::Sequence<css::beans::PropertyValue> const& rParameters);
+ bool write(const Graphic& rGraphic);
+};
+
+} // namespace vcl
+
+/* 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 0000000000..d16a775e37
--- /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 0000000000..ef8cf8c523
--- /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 0000000000..7e9d6dd804
--- /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 writeBufferBytes(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 0000000000..308ec65cae
--- /dev/null
+++ b/include/vcl/filter/pdfobjectcontainer.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/.
+ */
+
+#pragma once
+
+#include <sal/types.h>
+#include <string_view>
+
+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 writeBufferBytes(const void* pBuffer, sal_uInt64 nBytes) = 0;
+
+ // Utility method, reduces verbosity at call sites
+ bool writeBuffer(std::string_view aBuffer)
+ {
+ return writeBufferBytes(aBuffer.data(), aBuffer.size());
+ }
+
+ 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 0000000000..03814c2621
--- /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 0000000000..944b43fae2
--- /dev/null
+++ b/include/vcl/font.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_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;
+ FontEmphasisMark GetEmphasisMarkStyle() 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 );
+
+ // 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;
+ const Size& GetAverageFontSize() const;
+ const FontFamily& GetFontFamily() 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 SetFixKerning(const short nSpacing);
+ short GetFixKerning() const;
+ bool IsFixKerning() 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 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 0000000000..0c3c159dbc
--- /dev/null
+++ b/include/vcl/font/Feature.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/.
+ */
+
+#ifndef INCLUDED_VCL_FONT_FEATURE_HXX
+#define INCLUDED_VCL_FONT_FEATURE_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/character.hxx>
+#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;
+ int32_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 aDescription,
+ FeatureParameterType eType = FeatureParameterType::BOOL,
+ std::vector<FeatureParameter>&& rEnumParameters
+ = std::vector<FeatureParameter>{},
+ int32_t nDefault = -1);
+ FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID,
+ OUString aNumericPart = 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;
+ int32_t getDefault() const;
+
+ operator bool() const;
+};
+
+struct Feature
+{
+ Feature();
+ Feature(uint32_t const nCode, FeatureType eType);
+
+ bool isCharacterVariant() const
+ {
+ return ((m_nCode >> 24) & 0xFF) == 'c' && ((m_nCode >> 16) & 0xFF) == 'v'
+ && rtl::isAsciiDigit((m_nCode >> 8) & 0xFF)
+ && rtl::isAsciiDigit((m_nCode >> 0) & 0xFF);
+ }
+
+ bool isStylisticSet() const
+ {
+ return ((m_nCode >> 24) & 0xFF) == 's' && ((m_nCode >> 16) & 0xFF) == 's'
+ && rtl::isAsciiDigit((m_nCode >> 8) & 0xFF)
+ && rtl::isAsciiDigit((m_nCode >> 0) & 0xFF);
+ }
+
+ uint32_t m_nCode;
+ 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 0000000000..d69baf0e7a
--- /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, int32_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 0000000000..9698be7a53
--- /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 0000000000..7bfd074f3c
--- /dev/null
+++ b/include/vcl/fontcharmap.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_FONTCHARMAP_HXX
+#define INCLUDED_FONTCHARMAP_HXX
+
+#include <vcl/dllapi.h>
+#include <vcl/vclenum.hxx>
+#include <tools/ref.hxx>
+#include <vector>
+
+class ImplFontCharMap;
+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 passed arguments.
+ */
+ FontCharMap(bool bMicrosoftSymbolMap, std::vector<sal_UCS4> aRangeCodes);
+
+ virtual ~FontCharMap() override;
+
+ /** Get the default font character map
+
+ @returns the default font character map.
+ */
+ static FontCharMapRef GetDefaultMap(bool bMicrosoftSymbolMap);
+
+ /** 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;
+
+ bool isMicrosoftSymbolMap() const;
+
+private:
+ ImplFontCharMapRef mpImplFontCharMap;
+
+ friend class ::OutputDevice;
+
+ int findRangeIndex( sal_UCS4 ) const;
+
+ FontCharMap( ImplFontCharMapRef pIFCMap );
+
+ // prevent assignment and copy construction
+ FontCharMap( const FontCharMap& ) = delete;
+ void operator=( const FontCharMap& ) = delete;
+};
+
+#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 0000000000..54d6745587
--- /dev/null
+++ b/include/vcl/formatter.hxx
@@ -0,0 +1,323 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in 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;
+ bool m_bDefaultValueSet : 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; m_bDefaultValueSet = true; }
+ // If the current String is invalid, GetValue() returns this value
+ double GetDefaultValue() const { return m_dDefaultValue; }
+
+ // Make the formatter recreate the output text from the value on the next
+ // format attempt even if the value is the same as the current value.
+ // Needed if the associated widget had its text changed by something other
+ // that this Formatter (typically blanked out) since the last formatting
+ void InvalidateValueState() { m_ValueState = valueDirty; }
+
+ 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/formpdfexport.hxx b/include/vcl/formpdfexport.hxx
new file mode 100644
index 0000000000..a2aed55efe
--- /dev/null
+++ b/include/vcl/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 <vcl/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> VCL_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/vcl/gdimetafiletools.hxx b/include/vcl/gdimetafiletools.hxx
new file mode 100644
index 0000000000..576ba41f37
--- /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) SAL_LOPLUGIN_ANNOTATE("crosscast") 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 0000000000..63bde564dc
--- /dev/null
+++ b/include/vcl/gdimtf.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_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;
+
+ // tdf#155479 need to know if it's SVG export
+ bool m_bSVG;
+
+
+ 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 ScaleActions(double fScaleX, double fScaleY);
+ 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; }
+
+ // tdf#155479
+ bool getSVG() const { return m_bSVG; }
+ void setSVG(bool bNew) { m_bSVG = bNew; }
+
+ /// 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 0000000000..531633b3f7
--- /dev/null
+++ b/include/vcl/gfxlink.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_GFXLINK_HXX
+#define INCLUDED_VCL_GFXLINK_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/mapmod.hxx>
+#include <vcl/BinaryDataContainer.hxx>
+
+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(BinaryDataContainer aDataConainer, 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;
+
+ /// return the in-memory size as of now.
+ size_t getSizeBytes() const { return maDataContainer.getSizeBytes(); }
+
+ 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 0000000000..23ae5a877a
--- /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 0000000000..a5a8ec1518
--- /dev/null
+++ b/include/vcl/glyphitemcache.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_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();
+
+ /// Normally, we cannot cache glyphs when doing font fallback, because the font fallbacks
+ /// can cache during the lifetime of the cache, and they are not included in the cache key.
+ /// But during some processes, we can turn this on, as long as we remember to turn it off
+ /// at the end.
+ void SetCacheGlyphsWhenDoingFallbackFonts(bool bOK);
+
+ 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;
+ LanguageType digitLanguage;
+ vcl::text::ComplexTextLayoutFlags layoutMode;
+ bool rtl : 1;
+ bool disabledLigatures : 1; // because of fixed pitch
+ bool artificialItalic : 1;
+ bool artificialBold : 1;
+ size_t hashValue;
+ CachedGlyphsKey(const VclPtr<const OutputDevice>& dev, 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;
+ bool mbCacheGlyphsWhenDoingFallbackFonts = false;
+
+ 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 0000000000..fdb8df0b9a
--- /dev/null
+++ b/include/vcl/gradient.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_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>
+#include <com/sun/star/awt/GradientStyle.hpp>
+
+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( css::awt::GradientStyle eStyle,
+ const Color& rStartColor,
+ const Color& rEndColor );
+ ~Gradient();
+
+ void SetStyle( css::awt::GradientStyle eStyle );
+ css::awt::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 0000000000..e662987b67
--- /dev/null
+++ b/include/vcl/graph.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 <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;
+};
+
+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/graphic/GraphicMetadata.hxx b/include/vcl/graphic/GraphicMetadata.hxx
new file mode 100644
index 0000000000..33ee9d81c3
--- /dev/null
+++ b/include/vcl/graphic/GraphicMetadata.hxx
@@ -0,0 +1,68 @@
+/* -*- 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_GRAPHIC_GRAPHICMETADATA_HXX
+#define INCLUDED_VCL_GRAPHIC_GRAPHICMETADATA_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/mapmod.hxx>
+
+#include <optional>
+
+// 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,
+ MOV = 0x00e0,
+ PDF = 0x00e1,
+ DXF = 0x00f1,
+ MET = 0x00f2,
+ PCT = 0x00f3,
+ // retired SGF = 0x00f4,
+ SVM = 0x00f5,
+ WMF = 0x00f6,
+ // retired SGV = 0x00f7,
+ EMF = 0x00f8,
+ SVG = 0x00f9,
+ WMZ = 0x00fa,
+ EMZ = 0x00fb,
+ SVGZ = 0x00fc,
+ APNG = 0x00fd
+};
+struct GraphicMetadata
+{
+ Size maPixSize{};
+ Size maLogSize{};
+ std::optional<Size> maPreferredLogSize = std::nullopt;
+ std::optional<MapMode> maPreferredMapMode = std::nullopt;
+ sal_uInt16 mnBitsPerPixel = 0;
+ sal_uInt16 mnPlanes = 0;
+ GraphicFileFormat mnFormat = GraphicFileFormat::NOT;
+ sal_uInt8 mnNumberOfImageComponents = 0;
+ bool mbIsTransparent = false;
+ bool mbIsAlpha = false;
+};
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
new file mode 100644
index 0000000000..fd6c205bd4
--- /dev/null
+++ b/include/vcl/graphicfilter.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_GRAPHICFILTER_HXX
+#define INCLUDED_VCL_GRAPHICFILTER_HXX
+
+#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/graph.hxx>
+#include <comphelper/errcode.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <vcl/BinaryDataContainer.hxx>
+#include <vcl/graphic/GraphicMetadata.hxx>
+
+#include <memory>
+
+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_WMZ "SVWMZ"
+#define IMP_EMF "SVEMF"
+#define IMP_EMZ "SVEMZ"
+#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_SVGZ "SVISVGZ"
+#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_WMZ "SVWMZ"
+#define EXP_EMF "SVEMF"
+#define EXP_EMZ "SVEMZ"
+#define EXP_JPEG "SVEJPEG"
+#define EXP_SVG "SVESVG"
+#define EXP_SVGZ "SVESVGZ"
+#define EXP_PDF "SVEPDF"
+#define EXP_PNG "SVEPNG"
+#define EXP_APNG "SVEAPNG"
+#define EXP_TIFF "SVTIFF"
+#define EXP_EPS "SVEEPS"
+#define EXP_GIF "SVEGIF"
+#define EXP_WEBP "SVEWEBP"
+
+
+inline constexpr OUString BMP_SHORTNAME = u"BMP"_ustr;
+inline constexpr OUString GIF_SHORTNAME = u"GIF"_ustr;
+inline constexpr OUString JPG_SHORTNAME = u"JPG"_ustr;
+inline constexpr OUString MET_SHORTNAME = u"MET"_ustr;
+inline constexpr OUString PCT_SHORTNAME = u"PCT"_ustr;
+inline constexpr OUString PNG_SHORTNAME = u"PNG"_ustr;
+inline constexpr OUString SVM_SHORTNAME = u"SVM"_ustr;
+inline constexpr OUString TIF_SHORTNAME = u"TIF"_ustr;
+inline constexpr OUString WMF_SHORTNAME = u"WMF"_ustr;
+inline constexpr OUString EMF_SHORTNAME = u"EMF"_ustr;
+inline constexpr OUString SVG_SHORTNAME = u"SVG"_ustr;
+inline constexpr OUString PDF_SHORTNAME = u"PDF"_ustr;
+inline constexpr OUString WEBP_SHORTNAME = u"WEBP"_ustr;
+
+class VCL_DLLPUBLIC GraphicDescriptor final
+{
+ SvStream* pFileStm;
+ OUString aPathExt;
+ GraphicMetadata aMetadata;
+ bool bOwnStream;
+
+ 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 aMetadata.mnFormat; }
+
+ /** @return graphic size in pixels or 0 size */
+ const Size& GetSizePixel() const { return aMetadata.maPixSize; }
+
+ /** @return the logical graphic size in 1/100mm or 0 size */
+ const Size& GetSize_100TH_MM() const { return aMetadata.maLogSize; }
+
+ /**
+ * 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 aMetadata.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 aMetadata.maPreferredMapMode; }
+
+ /** @return bits/pixel or 0 **/
+ sal_uInt16 GetBitsPerPixel() const { return aMetadata.mnBitsPerPixel; }
+
+ /** @return number of color channels */
+ sal_uInt8 GetNumberOfImageComponents() const { return aMetadata.mnNumberOfImageComponents; }
+
+ /** @return whether image supports transparency */
+ bool IsTransparent() const { return aMetadata.mbIsTransparent; }
+
+ /** @return whether image supports alpha values for translucent colours */
+ bool IsAlpha() const { return aMetadata.mbIsAlpha; }
+
+ /** @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,
+ BinaryDataContainer & rpGraphicContent);
+ static ErrCode readJPEG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType,
+ GraphicFilterImportFlags nImportFlags);
+ static ErrCode readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType,
+ BinaryDataContainer & rpGraphicContent);
+ 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 0000000000..ab2371bb79
--- /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( tools::Polygon aPath,
+ tools::PolyPolygon aStartArrow,
+ tools::PolyPolygon aEndArrow,
+ 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( tools::PolyPolygon aPath,
+ 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.
+ 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 0000000000..713f22b95d
--- /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 0000000000..1f9fc429ae
--- /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 0000000000..7dc848a42e
--- /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/htmltransferable.hxx b/include/vcl/htmltransferable.hxx
new file mode 100644
index 0000000000..2576c7e31b
--- /dev/null
+++ b/include/vcl/htmltransferable.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 <com/sun/star/datatransfer/XTransferable.hpp>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/dllapi.h>
+
+namespace vcl::unohelper
+{
+// Helper class for passing HTML string as XTransferable to TransferableDataHelper object
+class VCL_DLLPUBLIC HtmlTransferable final : public css::datatransfer::XTransferable,
+ public ::cppu::OWeakObject
+{
+private:
+ OString data;
+
+public:
+ HtmlTransferable(OString sData);
+ virtual ~HtmlTransferable() 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;
+};
+
+} // namespace vcl::unohelper
diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx
new file mode 100644
index 0000000000..9f6e43bb6a
--- /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, LanguageTag aLanguageTag );
+ ~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 0000000000..d5162efcb7
--- /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/idletask.hxx b/include/vcl/idletask.hxx
new file mode 100644
index 0000000000..fd5b17c61b
--- /dev/null
+++ b/include/vcl/idletask.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/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <vcl/idle.hxx>
+
+//IdleTask class to add a low priority Idle task
+class VCL_DLLPUBLIC IdleTask
+{
+public:
+ bool GetFlag() const;
+ IdleTask();
+
+ // Launch an Idle at TaskPriority::LOWEST and wait until it completes. Can
+ // be used to wait until pending Idles at higher TaskPriority::DEFAULT_IDLE
+ // have completed.
+ static void waitUntilIdleDispatched();
+
+private:
+ DECL_LINK(FlipFlag, Timer*, void);
+ bool flag;
+ Idle maIdle{ "testtool IdleTask" };
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
new file mode 100644
index 0000000000..6c130bf4cd
--- /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 0000000000..8a34ad1bf7
--- /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( OUString aName );
+ 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 ) const;
+
+ // 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 0000000000..4fc5808afe
--- /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 0000000000..6e517fddb8
--- /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( OUString aURL,
+ OUString aAltText,
+ OUString aDesc,
+ OUString aTarget,
+ OUString aName,
+ 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 0000000000..5a9e80c27a
--- /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 0000000000..6637bb7719
--- /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 0000000000..99c9436d2f
--- /dev/null
+++ b/include/vcl/inetimg.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_INETIMG_HXX
+#define INCLUDED_VCL_INETIMG_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <sot/formats.hxx>
+#include <utility>
+
+
+class INetImage
+{
+ OUString aImageURL;
+ OUString aTargetURL;
+ OUString aTargetFrame;
+ Size aSizePixel;
+
+public:
+ INetImage(
+ OUString _aImageURL,
+ OUString _aTargetURL,
+ OUString _aTargetFrame )
+ : aImageURL(std::move( _aImageURL )),
+ aTargetURL(std::move( _aTargetURL )),
+ aTargetFrame(std::move( _aTargetFrame ))
+ {}
+ 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 0000000000..3d2f620ed0
--- /dev/null
+++ b/include/vcl/inputctx.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_INPUTCTX_HXX
+#define INCLUDED_VCL_INPUTCTX_HXX
+
+#include <vcl/dllapi.h>
+#include <utility>
+#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( vcl::Font aFont, InputContextFlags nOptions = InputContextFlags::NONE ) :
+ maFont(std::move( aFont ))
+ { 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 0000000000..c5805084b5
--- /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 0000000000..8d7d709e45
--- /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 0000000000..ff7b5dfb65
--- /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 0000000000..b60c035d58
--- /dev/null
+++ b/include/vcl/jsdialog/executor.hxx
@@ -0,0 +1,147 @@
+/* -*- 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_scrollv(weld::ScrolledWindow& rScrolledWindow)
+ {
+ rScrolledWindow.signal_vadjustment_changed();
+ }
+
+ static void trigger_scrollh(weld::ScrolledWindow& rScrolledWindow)
+ {
+ rScrolledWindow.signal_hadjustment_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 OUString& 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_dblclick(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.dblclick(rPos);
+ }
+
+ static void trigger_mouse_up(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.mouse_up(rPos);
+ }
+
+ static void trigger_mouse_down(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.mouse_down(rPos);
+ }
+
+ static void trigger_mouse_move(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.mouse_move(rPos);
+ }
+
+ static void trigger_selected(weld::MenuButton& rButton, const OUString& rIdent)
+ {
+ rButton.signal_selected(rIdent);
+ }
+
+ static void trigger_selected(weld::Calendar& rCalendar) { rCalendar.signal_selected(); }
+
+ static void trigger_activated(weld::Calendar& rCalendar) { rCalendar.signal_activated(); }
+
+ static void trigger_value_changed(weld::SpinButton& rSpinButton)
+ {
+ rSpinButton.signal_value_changed();
+ }
+
+ static void trigger_value_changed(weld::FormattedSpinButton& 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);
+ }
+
+ static void enter_page(weld::Notebook& rNotebook, const OUString& rPage)
+ {
+ rNotebook.m_aEnterPageHdl.Call(rPage);
+ }
+
+ static void leave_page(weld::Notebook& rNotebook, const OUString& rPage)
+ {
+ rNotebook.m_aLeavePageHdl.Call(rPage);
+ }
+};
+
+namespace jsdialog
+{
+// type used to store key-value pairs to put in the generated messages
+typedef std::unordered_map<OString, OUString> ActionDataMap;
+
+/// execute action on a widget
+VCL_DLLPUBLIC bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget,
+ StringMap& rData);
+/// send full update message to the client
+VCL_DLLPUBLIC void SendFullUpdate(const OUString& nWindowId, const OUString& rWidget);
+/// send action message to the client
+VCL_DLLPUBLIC void SendAction(const OUString& nWindowId, const OUString& 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/kernarray.hxx b/include/vcl/kernarray.hxx
new file mode 100644
index 0000000000..2e8939b542
--- /dev/null
+++ b/include/vcl/kernarray.hxx
@@ -0,0 +1,106 @@
+/* -*- 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 <cmath>
+#include <span>
+#include <vector>
+
+class KernArraySpan final
+{
+private:
+ int m_nSubUnitFactor;
+ std::span<const sal_Int32> m_DXArray;
+
+public:
+ KernArraySpan()
+ : m_nSubUnitFactor(1)
+ {
+ }
+
+ KernArraySpan(std::span<const sal_Int32> DXArray, int nSubUnitFactor = 1)
+ : m_nSubUnitFactor(nSubUnitFactor)
+ , m_DXArray(DXArray)
+ {
+ }
+ size_t size() const { return m_DXArray.size(); }
+ bool empty() const { return m_DXArray.empty(); }
+ sal_Int32 operator[](size_t nIndex) const { return get(nIndex); }
+ sal_Int32 get(size_t nIndex) const
+ {
+ return std::round(static_cast<double>(m_DXArray[nIndex]) / m_nSubUnitFactor);
+ }
+
+ int get_factor() const { return m_nSubUnitFactor; }
+ sal_Int32 get_subunit(size_t nIndex) const { return m_DXArray[nIndex]; }
+};
+
+class KernArray final
+{
+private:
+ int m_nSubUnitFactor;
+ std::vector<sal_Int32> m_aDXArray;
+
+public:
+ KernArray(int nSubUnitFactor = 1)
+ : m_nSubUnitFactor(nSubUnitFactor)
+ {
+ }
+
+ sal_Int32 operator[](size_t nIndex) const { return get(nIndex); }
+ sal_Int32 get(size_t nIndex) const
+ {
+ return std::round(static_cast<double>(m_aDXArray[nIndex]) / m_nSubUnitFactor);
+ }
+
+ int get_factor() const { return m_nSubUnitFactor; }
+ sal_Int32 get_subunit(size_t nIndex) const { return m_aDXArray[nIndex]; }
+
+ void set_subunit(size_t nIndex, sal_Int32 nValue) { m_aDXArray[nIndex] = nValue; }
+ std::vector<sal_Int32>& get_subunit_array() { return m_aDXArray; }
+
+ void adjust(size_t nIndex, sal_Int32 nDiff) { m_aDXArray[nIndex] += nDiff * m_nSubUnitFactor; }
+ void set(size_t nIndex, sal_Int32 nValue) { m_aDXArray[nIndex] = nValue * m_nSubUnitFactor; }
+ void push_back(sal_Int32 nUnit) { m_aDXArray.push_back(nUnit * m_nSubUnitFactor); }
+ sal_Int32 back() const { return m_aDXArray.back() * m_nSubUnitFactor; }
+ size_t size() const { return m_aDXArray.size(); }
+ bool empty() const { return m_aDXArray.empty(); }
+ void clear() { m_aDXArray.clear(); }
+ void assign(KernArraySpan other)
+ {
+ m_nSubUnitFactor = other.get_factor();
+ m_aDXArray.clear();
+ size_t nLen = other.size();
+ m_aDXArray.reserve(nLen);
+ for (size_t i = 0; i < nLen; ++i)
+ m_aDXArray.push_back(other.get_subunit(i));
+ }
+ void resize(size_t nSize) { m_aDXArray.resize(nSize); }
+ void resize(size_t nSize, sal_Int32 nDefault)
+ {
+ m_aDXArray.resize(nSize, nDefault * m_nSubUnitFactor);
+ }
+ void reserve(size_t nCapacity) { m_aDXArray.reserve(nCapacity); }
+
+ bool operator==(const KernArray& rOther) const
+ {
+ size_t nSize = size();
+ if (nSize != rOther.size())
+ return false;
+ for (size_t i = 0; i < nSize; ++i)
+ if (m_aDXArray[i] != rOther.m_aDXArray[i])
+ return false;
+ return true;
+ }
+
+ operator KernArraySpan() const { return KernArraySpan(m_aDXArray, m_nSubUnitFactor); }
+};
+
+/* 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 0000000000..68841ef85c
--- /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 0000000000..8eb1a0ec8c
--- /dev/null
+++ b/include/vcl/keycodes.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_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_RIGHTCURLYBRACKET = css::awt::Key::RIGHTCURLYBRACKET;
+constexpr sal_uInt16 KEY_NUMBERSIGN = css::awt::Key::NUMBERSIGN;
+constexpr sal_uInt16 KEY_XF86FORWARD = css::awt::Key::XF86FORWARD;
+constexpr sal_uInt16 KEY_XF86BACK = css::awt::Key::XF86BACK;
+constexpr sal_uInt16 KEY_COLON = css::awt::Key::COLON;
+
+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 0000000000..507225f4d2
--- /dev/null
+++ b/include/vcl/layout.hxx
@@ -0,0 +1,843 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If 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 OUString &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 OUString &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 OUString &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 OUString &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 OUString &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);
+ virtual void DumpAsPropertyTree(::tools::JsonWriter& rJsonWriter) override;
+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 OUString &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 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 void MouseMove(const MouseEvent& rMEvt) override
+ {
+ if (!m_aMouseMotionHdl.Call(rMEvt))
+ Control::MouseMove(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 0000000000..e700582f12
--- /dev/null
+++ b/include/vcl/lazydelete.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_LAZYDELETE_HXX
+#define INCLUDED_VCL_LAZYDELETE_HXX
+
+#include <vcl/dllapi.h>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <optional>
+#include <utility>
+
+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( ... );
+
+ 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(css::uno::Reference<I> _xI ) : m_xI(std::move( _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 0000000000..0644359954
--- /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 0000000000..9d0bf5f39b
--- /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 0000000000..ea7ffadd43
--- /dev/null
+++ b/include/vcl/lok.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_VCL_LOK_HXX
+#define INCLUDED_VCL_LOK_HXX
+
+#include <sal/config.h>
+#include <vcl/dllapi.h>
+#include <rtl/strbuf.hxx>
+#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);
+
+// Trim memory use by wiping various internal caches
+void VCL_DLLPUBLIC trimMemory(int nTarget);
+
+// Dump internal state of VCL windows etc. for debugging
+void VCL_DLLPUBLIC dumpState(rtl::OStringBuffer& rState);
+}
+
+#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 0000000000..f3c937a5f9
--- /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 0000000000..a28182e51f
--- /dev/null
+++ b/include/vcl/menu.hxx
@@ -0,0 +1,550 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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;
+ OUString 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;
+
+ // Stores the help ID of the menu
+ OUString m_sMenuHelpId;
+
+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 OUString &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 OUString &rIdent = {},
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OUString &rIdent = {},
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertItem(sal_uInt16 nItemId,
+ const OUString& rString, const Image& rImage,
+ MenuItemBits nItemBits = MenuItemBits::NONE,
+ const OUString &rIdent = {},
+ sal_uInt16 nPos = MENU_APPEND);
+ void InsertSeparator(const OUString &rIdent = {}, 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; }
+
+ bool HasValidEntries(bool bCheckPopups) const;
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemId(sal_uInt16 nPos) const;
+ sal_uInt16 GetItemId(std::u16string_view rIdent) const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ OUString GetItemIdent(sal_uInt16 nItemId) const;
+ MenuItemType GetItemType( sal_uInt16 nPos ) const;
+ sal_uInt16 GetCurItemId() const { return nSelectedId;}
+ OUString 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::u16string_view rIdent, bool bCheck = true );
+ bool IsItemCheckable(sal_uInt16 nItemId) const;
+ bool IsItemChecked( sal_uInt16 nItemId ) const;
+
+ virtual void SelectItem(sal_uInt16 nItemId) = 0;
+
+ void EnableItem( sal_uInt16 nItemId, bool bEnable = true );
+ void EnableItem(std::u16string_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 OUString& rHelpId );
+ OUString GetHelpId( sal_uInt16 nItemId ) const;
+
+ void SetHelpId( const OUString& rHelpId ) { m_sMenuHelpId = rHelpId; }
+ OUString GetHelpId() const { return m_sMenuHelpId; }
+
+ 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 bool PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom, bool& bRealExecute, VclPtr<MenuFloatingWindow>&);
+ SAL_DLLPRIVATE bool Run(const VclPtr<MenuFloatingWindow>&, bool bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, const tools::Rectangle& rRect);
+ SAL_DLLPRIVATE void FinishRun(const VclPtr<MenuFloatingWindow>&, const VclPtr<vcl::Window>& pParentWin, bool bRealExecute, bool bIsNativeMenu);
+ SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr<vcl::Window>& pParentWin, 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 0000000000..99aea9581a
--- /dev/null
+++ b/include/vcl/menubarupdateicon.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 <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> mpActiveSysWin;
+ VclPtr<MenuBar> mpActiveMBar;
+ std::vector<VclPtr<MenuBar>> maIconMBars;
+ std::vector<sal_uInt16> maIconIDs;
+
+ Link<VclWindowEvent&, void> maWindowEventHdl;
+ Link<VclSimpleEvent&, void> maApplicationEventHdl;
+ Link<LinkParamNone*, void> maClickHdl;
+
+ Timer maTimeoutTimer;
+ Idle maWaitIdle;
+
+ 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();
+
+ sal_uInt16 GetIconID(MenuBar* pMenuBar) const;
+
+ void AddMenuBarIcon(SystemWindow& rSysWin, bool bAddEventHdl);
+ void RemoveMenuBarIcon(MenuBar* pMenuBar);
+ void RemoveMenuBarIcons();
+
+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();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
new file mode 100644
index 0000000000..8f64669ac2
--- /dev/null
+++ b/include/vcl/metaact.hxx
@@ -0,0 +1,1769 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <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/kernarray.hxx>
+#include <vcl/lineinfo.hxx>
+#include <vcl/metaactiontypes.hxx>
+#include <vcl/region.hxx>
+#include <vcl/rendercontext/RasterOp.hxx>
+#include <vcl/wall.hxx>
+#include <basegfx/utils/bgradient.hxx>
+
+#include <memory>
+#include <span>
+
+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,
+ LineInfo aLineInfo );
+
+ 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( tools::Polygon );
+ explicit MetaPolyLineAction( tools::Polygon , 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( 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( 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, OUString aStr,
+ 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 VCL_DLLPUBLIC MetaTextArrayAction final : public MetaAction
+{
+private:
+
+ Point maStartPt;
+ OUString maStr;
+ KernArray maDXAry;
+ std::vector<sal_Bool> maKashidaAry;
+ sal_Int32 mnIndex;
+ sal_Int32 mnLen;
+
+ virtual ~MetaTextArrayAction() override;
+
+public:
+ MetaTextArrayAction();
+ MetaTextArrayAction( const MetaTextArrayAction& rAction );
+ MetaTextArrayAction( const Point& rStartPt, OUString aStr,
+ KernArray rDXAry,
+ std::vector<sal_Bool> pKashidaAry,
+ sal_Int32 nIndex,
+ sal_Int32 nLen );
+ MetaTextArrayAction( const Point& rStartPt, OUString aStr,
+ KernArraySpan pDXAry,
+ std::span<const sal_Bool> pKashidaAry,
+ 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 KernArray& GetDXArray() const { return maDXAry; }
+ const std::vector<sal_Bool> & GetKashidaArray() const { return maKashidaAry; }
+ 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(KernArray aArray);
+ void SetKashidaArray(std::vector<sal_Bool> 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,
+ OUString aStr,
+ 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,
+ OUString aStr, 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 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 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, Gradient aGradient );
+
+ 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( tools::PolyPolygon rPolyPoly, Gradient aGradient );
+
+ 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( tools::PolyPolygon aPolyPoly, 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 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( vcl::Region aRegion, 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( 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( 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( tools::PolyPolygon aPolyPoly, 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 VCL_DLLPUBLIC MetaFloatTransparentAction final : public MetaAction
+{
+private:
+
+ GDIMetaFile maMtf;
+ Point maPoint;
+ Size maSize;
+ Gradient maGradient;
+
+ // tdf#155479 allow holding MCGR infos
+ std::optional<basegfx::BColorStops> maSVGTransparencyColorStops;
+
+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, Gradient aGradient );
+
+ 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; }
+
+ // tdf#155479 allow holding MCGR infos
+ const basegfx::BColorStops* getSVGTransparencyColorStops() const
+ { return !maSVGTransparencyColorStops ? nullptr : &(*maSVGTransparencyColorStops); }
+ void addSVGTransparencyColorStops(const basegfx::BColorStops& rSVGTransparencyColorStops);
+};
+
+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,
+ GfxLink aGfxLink, 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( OString aComment, 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 0000000000..5a8a70cae2
--- /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 0000000000..5cf1d6e232
--- /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;
+
+ sal_Int32 GetAscent() const { return mnAscent; }
+ sal_Int32 GetDescent() const { return mnDescent; }
+ sal_Int32 GetInternalLeading() const { return mnIntLeading; }
+ sal_Int32 GetExternalLeading() const { return mnExtLeading; }
+ sal_Int32 GetLineHeight() const { return mnLineHeight; } // TODO this is ascent + descnt
+ sal_Int32 GetSlant() const { return mnSlant; }
+ sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
+ sal_Int32 GetHangingBaseline() const { return mnHangingBaseline; }
+
+ void SetAscent( sal_Int32 nAscent ) { mnAscent = nAscent; }
+ void SetDescent( sal_Int32 nDescent ) { mnDescent = nDescent; }
+ void SetExternalLeading( sal_Int32 nExtLeading ) { mnExtLeading = nExtLeading; }
+ void SetInternalLeading( sal_Int32 nIntLeading ) { mnIntLeading = nIntLeading; }
+ void SetLineHeight( sal_Int32 nHeight ) { mnLineHeight = nHeight; } // TODO this is ascent + descent
+ void SetSlant( sal_Int32 nSlant ) { mnSlant = nSlant; }
+ void SetBulletOffset( sal_Int32 nOffset ) { mnBulletOffset = nOffset; }
+ void SetHangingBaseline( sal_Int32 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;
+ sal_Int32 mnAscent; // Ascent
+ sal_Int32 mnDescent; // Descent
+ sal_Int32 mnIntLeading; // Internal Leading
+ sal_Int32 mnExtLeading; // External Leading
+ sal_Int32 mnLineHeight; // Ascent+Descent+EmphasisMark
+ sal_Int32 mnSlant; // Slant
+ sal_Int32 mnBulletOffset; // Offset for non-printing character
+ sal_Int32 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 0000000000..2a14415033
--- /dev/null
+++ b/include/vcl/mnemonic.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_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))
+
+VCL_DLLPUBLIC OUString removeMnemonicFromString(OUString const& rStr, sal_Int32& rMnemonicPos);
+VCL_DLLPUBLIC OUString removeMnemonicFromString(OUString const& rStr);
+
+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);
+
+ MnemonicGenerator& operator=(MnemonicGenerator const &); //MSVC2022 workaround
+ MnemonicGenerator(MnemonicGenerator const&); //MSVC2022 workaround
+
+ 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 0000000000..9970ea8a0d
--- /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 0000000000..1883bb3570
--- /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 0000000000..30ab04be2b
--- /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 OUString& 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 0000000000..15186fce2c
--- /dev/null
+++ b/include/vcl/notebookbar/notebookbar.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/.
+ */
+
+#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 NotebookBarContextChangeEventListener;
+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 OUString& 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 SetupListener(bool bListen);
+
+ 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;
+ rtl::Reference<NotebookBarContextChangeEventListener> m_pEventListener;
+ std::vector<NotebookbarContextControl*> m_pContextContainers;
+ 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 0000000000..3b74b0d767
--- /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 0000000000..428df12660
--- /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 0000000000..45383bd6fb
--- /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 0000000000..3711b3fd4b
--- /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 0000000000..3293645591
--- /dev/null
+++ b/include/vcl/outdev.hxx
@@ -0,0 +1,1896 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in 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/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/dllapi.h>
+#include <vcl/font.hxx>
+#include <vcl/kernarray.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/settings.hxx>
+#include <vcl/vclreferencebase.hxx>
+
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/point/b2dpoint.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 <optional>
+#include <span>
+#include <string_view>
+#include <vector>
+
+struct ImplOutDevData;
+class LogicalFontInstance;
+struct SystemGraphicsData;
+class ImplFontCache;
+class ImplMultiTextLineInfo;
+class SalGraphics;
+class Gradient;
+class Hatch;
+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 TextLayoutCommon;
+ 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;
+ class 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;
+}
+
+// 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);
+
+/**
+* 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;
+ rtl::Reference<LogicalFontInstance> mpForcedFallbackInstance;
+ 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::optional<AllSettings> moSettings;
+ MapMode maMapMode;
+ Point maRefPoint;
+ AntialiasingFlags mnAntialiasing;
+ LanguageType meTextLanguage;
+
+ 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 *moSettings; }
+
+ 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; }
+
+ 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::TextLayoutCommon* _pTextLayout = nullptr );
+
+ static void ImplDrawText( OutputDevice& rTargetDevice, const tools::Rectangle& rRect,
+ const OUString& rOrigStr, DrawTextFlags nStyle,
+ std::vector< tools::Rectangle >* pVector, OUString* pDisplayText, vcl::TextLayoutCommon& _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, double 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::TextLayoutCommon* _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, KernArraySpan aDXArray = KernArraySpan(),
+ std::span<const sal_Bool> pKashidaArray = {},
+ 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, KernArraySpan aDXArray = KernArraySpan(),
+ std::span<const sal_Bool> pKashidaArray = {} ) const;
+
+ bool GetTextOutlines( basegfx::B2DPolyPolygonVector &rVector,
+ const OUString& rStr, sal_Int32 nBase, sal_Int32 nIndex = 0,
+ sal_Int32 nLen = -1,
+ sal_uLong nLayoutWidth = 0, KernArraySpan aDXArray = KernArraySpan(),
+ std::span<const sal_Bool> pKashidaArray = {} ) 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;
+
+ /** 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,
+ KernArraySpan aKernArray,
+ std::span<const sal_Bool> pKashidaAry,
+ sal_Int32 nIndex,
+ sal_Int32 nLen,
+ SalLayoutFlags flags = SalLayoutFlags::NONE,
+ const SalLayoutGlyphs* pLayoutCache = nullptr);
+ tools::Long GetTextArray( const OUString& rStr, KernArray* pDXAry,
+ sal_Int32 nIndex = 0, sal_Int32 nLen = -1, bool bCaret = false,
+ vcl::text::TextLayoutCache const* = nullptr,
+ SalLayoutGlyphs const*const pLayoutCache = nullptr) const;
+
+ void GetCaretPositions( const OUString&, KernArray& rCaretXArray,
+ sal_Int32 nIndex, sal_Int32 nLen,
+ const SalLayoutGlyphs* pGlyphs = nullptr ) const;
+ void DrawStretchText( const Point& rStartPt, sal_Int32 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();
+ 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;
+
+ 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, std::u16string_view 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 );
+
+ LogicalFontInstance const* GetFontInstance() const;
+ bool ForceFallbackFont(vcl::Font const& rFallbackFont);
+
+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 );
+
+ 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 ;
+ void ReMirror( Point &rPoint ) const;
+ void ReMirror( tools::Rectangle &rRect ) const;
+ 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,
+ KernArraySpan aKernArray = KernArraySpan(),
+ std::span<const sal_Bool> pKashidaArray={},
+ 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,
+ double 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 );
+
+ void DrawTransparent(
+ const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
+ const Point& rMtfPos, const Size& rMtfSize,
+ 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 basegfx::B2DPoint ImplLogicToDeviceSubPixel(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 ImplLogicWidthToDeviceSubPixel(tools::Long nWidth) 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;
+ SAL_DLLPRIVATE double ImplLogicHeightToDeviceSubPixel(tools::Long nHeight) const;
+
+ SAL_DLLPRIVATE Point SubPixelToLogic(const basegfx::B2DPoint& rDevicePt) 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 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;
+
+private:
+ /** 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;
+
+ /** @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 0000000000..7542cfeed5
--- /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/PDFAnnotAActionType.hxx b/include/vcl/pdf/PDFAnnotAActionType.hxx
new file mode 100644
index 0000000000..099dcda813
--- /dev/null
+++ b/include/vcl/pdf/PDFAnnotAActionType.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 PDFAnnotAActionType
+{
+ KeyStroke = 12,
+ Format = 13,
+ Validate = 14,
+ Calculate = 15,
+};
+
+} // namespace vcl::pdf
+
+/* 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 0000000000..c4be54d693
--- /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 0000000000..749100e363
--- /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 0000000000..fe5921276e
--- /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 0000000000..82cee9e5e7
--- /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 0000000000..e5bc71f0d1
--- /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 0000000000..3ad8c77e39
--- /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/PDFFormFieldType.hxx b/include/vcl/pdf/PDFFormFieldType.hxx
new file mode 100644
index 0000000000..96be9bffc1
--- /dev/null
+++ b/include/vcl/pdf/PDFFormFieldType.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
+
+namespace vcl::pdf
+{
+enum class PDFFormFieldType
+{
+ Unknown = 0,
+ PushButton = 1,
+ CheckBox = 2,
+ RadioButton = 3,
+ ComboBox = 4,
+ ListBox = 5,
+ TextField = 6,
+ Signature = 7
+};
+
+} // namespace vcl::pdf
+
+/* 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 0000000000..c3ee6c7526
--- /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 0000000000..68e763e64b
--- /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 0000000000..98f74482e6
--- /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 0000000000..366a080fb7
--- /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 0000000000..206dfa4adc
--- /dev/null
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -0,0 +1,514 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <map>
+#include <memory>
+
+class Graphic;
+class GDIMetaFile;
+class SdrObject;
+struct SwEnhancedPDFState;
+
+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 mbExportNotesInMargin;
+ 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;
+ // map from annotation SdrObject to annotation index
+ ::std::map<SdrObject const*, ::std::vector<sal_Int32>> m_ScreenAnnotations;
+
+ SwEnhancedPDFState * m_pSwPDFState = nullptr;
+
+public:
+
+ PDFExtOutDevData( const OutputDevice& rOutDev );
+ virtual ~PDFExtOutDevData() override;
+
+ bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction, const GDIMetaFile& rMtf );
+ void ResetSyncData(PDFWriter * pWriterIfRemoveTransparencies);
+
+ void PlayGlobalActions( PDFWriter& rWriter );
+
+ bool GetIsExportNotes() const { return mbExportNotes;}
+ void SetIsExportNotes( const bool bExportNotes );
+
+ bool GetIsExportNotesInMargin() const { return mbExportNotesInMargin;}
+ void SetIsExportNotesInMargin( const bool bExportNotesInMargin );
+
+ 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; }
+
+ SwEnhancedPDFState * GetSwPDFState() { return m_pSwPDFState; }
+ void SetSwPDFState(SwEnhancedPDFState *const pSwPDFState) { m_pSwPDFState = pSwPDFState; }
+
+ 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, OUString const& rAltText, OUString const& rMimeType, sal_Int32 nPageNr, SdrObject const* pObj);
+
+ /// Get back the annotations created for one SdrObject.
+ ::std::vector<sal_Int32> const& GetScreenAnnotIds(SdrObject const* pObj) const;
+
+ /** 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 except 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.
+
+ The easy way is to call WrapBeginStructureElement, but it's also possible
+ to call EnsureStructureElement/InitStructureElement/BeginStructureElement
+ (its 3 parts) manually for more control; this way a placeholder SE can be
+ inserted and initialised later.
+
+ 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 WrapBeginStructureElement(PDFWriter::StructElement eType, const OUString& rAlias = OUString());
+ sal_Int32 EnsureStructureElement(void const* key);
+ void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, const OUString& rAlias);
+ void BeginStructureElement(sal_Int32 id);
+
+ /** 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, which must be valid
+ */
+ void 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 annotations that should be referenced as children of the
+ current structural element.
+ */
+ void SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds);
+
+ /** 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 structural 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 0000000000..72508a5482
--- /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 0000000000..cd8be2a505
--- /dev/null
+++ b/include/vcl/pdfwriter.hxx
@@ -0,0 +1,1266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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;
+ bool isFreeText = false;
+ std::vector<basegfx::B2DPolygon> maPolygons;
+ Color annotColor;
+ Color interiorColor;
+};
+
+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_2_0, please add just after PDF_1_7
+ enum class PDFVersion { PDF_1_4, PDF_1_5, PDF_1_6, PDF_1_7, 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, Annot,
+ Ruby, RB, RT, RP, Warichu, WT, WP,
+
+ // illustration elements
+ Figure, Formula, Form
+ };
+
+ enum StructAttribute
+ {
+ // Artifacts
+ Type, Subtype,
+
+ Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, EndIndent,
+ TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
+ LineHeight, BaselineShift, TextDecorationType, ListNumbering,
+ RowSpan, ColSpan, Scope, Role,
+ RubyAlign, RubyPosition,
+
+ // 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,
+ // Artifacts
+ Pagination, Layout, Page, Background,
+ Header, Footer, Watermark,
+ // 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,
+ // Role
+ Rb, Cb, Pb, Tv,
+ // RubyAlign
+ RStart, RCenter, REnd, RJustify, RDistribute,
+ // RubyPosition
+ RBefore, RAfter, RWarichu, RInline,
+ // 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 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& ) = delete; // 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 except 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 VCL_DLLPUBLIC 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 VCL_DLLPUBLIC 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 VCL_DLLPUBLIC 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
+ css::util::DateTime ModificationDate;
+ css::uno::Sequence<OUString> Contributor; // http://purl.org/dc/elements/1.1/contributor
+ OUString Coverage; // http://purl.org/dc/elements/1.1/coverage
+ OUString Identifier; // http://purl.org/dc/elements/1.1/identifier
+ css::uno::Sequence<OUString> Publisher; // http://purl.org/dc/elements/1.1/publisher
+ css::uno::Sequence<OUString> Relation; // http://purl.org/dc/elements/1.1/relation
+ OUString Rights; // http://purl.org/dc/elements/1.1/rights
+ OUString Source; // http://purl.org/dc/elements/1.1/source
+ OUString Type; // http://purl.org/dc/elements/1.1/type
+ 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_7),
+ 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,
+ KernArraySpan aKernArray,
+ std::span<const sal_Bool> pKashidaAry,
+ sal_Int32 nIndex,
+ sal_Int32 nLen );
+ void DrawStretchText( const Point& rStartPt, sal_Int32 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_uInt32 nHorzRount, sal_uInt32 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, OUString const& rAltText, OUString const& rMimeType);
+
+ /** 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.
+
+ The easy way is to call WrapBeginStructureElement, but it's also possible
+ to call EnsureStructureElement/InitStructureElement/BeginStructureElement
+ (its 3 parts) manually for more control; this way a placeholder SE can be
+ inserted and initialised later.
+
+ 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
+ */
+ void BeginStructureElement(sal_Int32 id);
+ sal_Int32 EnsureStructureElement();
+ void InitStructureElement(sal_Int32 id, PDFWriter::StructElement eType, std::u16string_view 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 annotations that should be referenced as children of the
+ current structural element.
+ */
+ void SetStructureAnnotIds(::std::vector<sal_Int32> const& rAnnotIds);
+
+ /** 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 structural 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 );
+
+ /** Attaches an additional file to the PDF file
+
+ This function adds an arbitrary stream that represents an attached file
+ in the PDF file.
+
+ This also adds an additional stream array entry (with the mimetype) in
+ the trailer dictionary for backwards compatibility.
+
+ @param rFileName
+ the filename of the additional file as presented in the stream
+
+ @param rMimeType
+ the mimetype of the stream
+
+ @param pStream
+ the interface to the additional stream
+ */
+ void AddAttachedFile(OUString const& rFileName, OUString const& rMimeType, OUString const& rDescription, std::unique_ptr<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();
+};
+
+}
+
+#endif // INCLUDED_VCL_PDFWRITER_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 0000000000..d6ce7728f9
--- /dev/null
+++ b/include/vcl/print.hxx
@@ -0,0 +1,616 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <utility>
+#include <vcl/PrinterSupport.hxx>
+#include <comphelper/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 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( OUString i_DependsOnName = OUString(),
+ sal_Int32 i_nDependsOnEntry = -1, bool i_bAttachToDependency = false)
+ : maDependsOnName(std::move( i_DependsOnName ))
+ , 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 0000000000..cd425bd101
--- /dev/null
+++ b/include/vcl/printer/Options.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
+
+#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;
+
+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; }
+
+ /** 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 0000000000..fab6a1bf65
--- /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 0000000000..fa45246a81
--- /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 0000000000..87e1d09a92
--- /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 0000000000..8d5004c18e
--- /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 0000000000..d2cb90a28a
--- /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 0000000000..98ce2e882f
--- /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 0000000000..4d783e7809
--- /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 0000000000..014b552dec
--- /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 0000000000..b51b1798e8
--- /dev/null
+++ b/include/vcl/rendercontext/DrawModeFlags.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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in 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,
+ SettingsForSelection = 0x00100000,
+ NoTransparency = 0x00200000,
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawModeFlags> : is_typed_flags<DrawModeFlags, 0x3fffff>
+{
+};
+}
+
+/* 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 0000000000..4eb4c45b60
--- /dev/null
+++ b/include/vcl/rendercontext/DrawTextFlags.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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in 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,
+};
+namespace o3tl
+{
+template <> struct typed_flags<DrawTextFlags> : is_typed_flags<DrawTextFlags, 0x1ffff>
+{
+};
+}
+
+/* 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 0000000000..a100e2f2f4
--- /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 0000000000..7a88a15af9
--- /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 0000000000..86fe96fd42
--- /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 0000000000..44b2a6c03a
--- /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 0000000000..576a4abd8f
--- /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,
+ DisableLigatures = 0x0200,
+ ForFallback = 0x2000,
+ GlyphItemsOnly = 0x4000,
+};
+namespace o3tl
+{
+template <> struct typed_flags<SalLayoutFlags> : is_typed_flags<SalLayoutFlags, 0x6277>
+{
+};
+}
+
+/* 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 0000000000..0359a486e4
--- /dev/null
+++ b/include/vcl/rendercontext/State.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 <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,
+ RTLENABLED = 0x4000,
+ 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::RTLENABLED | 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 : sal_uInt8
+{
+ 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;
+ bool mbRTLEnabled = 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 0000000000..459c219458
--- /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 0000000000..be2eb5669e
--- /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 OUString& _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 OUString&, 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 0000000000..c52128aef5
--- /dev/null
+++ b/include/vcl/salctype.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_VCL_SALCTYPE_HXX
+#define INCLUDED_VCL_SALCTYPE_HXX
+
+#include <sal/config.h>
+
+#include <utility>
+#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( Graphic aGraphic, SvStream& rStm, ConvertDataFormat nFormat ) :
+ maGraphic(std::move( aGraphic )), 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 0000000000..65213d4f7a
--- /dev/null
+++ b/include/vcl/salgtype.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_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,
+ WITHOUT_ALPHA = 0,
+ WITH_ALPHA = 1,
+#ifdef IOS
+ GRAYSCALE = 8
+#endif
+ };
+
+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 0000000000..aa856a16c3
--- /dev/null
+++ b/include/vcl/salnativewidgets.hxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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,
+ LevelBar = 133,
+// 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
+};
+
+/* 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 )
+ , 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 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 0000000000..1b63404139
--- /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/scrollable.hxx b/include/vcl/scrollable.hxx
new file mode 100644
index 0000000000..7544fe9b0e
--- /dev/null
+++ b/include/vcl/scrollable.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 <tools/long.hxx>
+#include <vcl/dllapi.h>
+
+class VCL_DLLPUBLIC Scrollable
+{
+public:
+ virtual tools::Long DoScroll(tools::Long nNewPos) = 0;
+
+ virtual void SetRangeMin(tools::Long nNewRange) = 0;
+ virtual tools::Long GetRangeMin() const = 0;
+ virtual void SetRangeMax(tools::Long nNewRange) = 0;
+ virtual tools::Long GetRangeMax() const = 0;
+ virtual void SetRange(const Range& rRange) = 0;
+ virtual Range GetRange() const = 0;
+ virtual void SetThumbPos(tools::Long nThumbPos) = 0;
+ virtual tools::Long GetThumbPos() const = 0;
+ virtual void SetLineSize(tools::Long nNewSize) = 0;
+ virtual tools::Long GetLineSize() const = 0;
+ virtual void SetPageSize(tools::Long nNewSize) = 0;
+ virtual tools::Long GetPageSize() const = 0;
+ virtual void SetVisibleSize(tools::Long nNewSize) = 0;
+ virtual tools::Long GetVisibleSize() const = 0;
+
+ virtual bool Inactive() const = 0;
+
+ virtual ~Scrollable() {}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/seleng.hxx b/include/vcl/seleng.hxx
new file mode 100644
index 0000000000..a0f069e04c
--- /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
+constexpr sal_uInt64 SELENG_DRAGDROP_TIMEOUT = 400;
+constexpr sal_uInt64 SELENG_AUTOREPEAT_INTERVAL = 50;
+constexpr sal_uInt64 SELENG_AUTOREPEAT_INTERVAL_MIN = 25;
+constexpr sal_uInt64 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_uInt64 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_uInt64 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 0000000000..3b8ac61ca5
--- /dev/null
+++ b/include/vcl/settings.hxx
@@ -0,0 +1,748 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <config_options.h>
+
+#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 SetAccentColor( const Color& rColor );
+ const Color& GetAccentColor() 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 SetListBoxWindowBackgroundColor( const Color& rColor );
+ const Color& GetListBoxWindowBackgroundColor() const;
+
+ void SetListBoxWindowTextColor( const Color& rColor );
+ const Color& GetListBoxWindowTextColor() const;
+
+ void SetListBoxWindowHighlightColor( const Color& rColor );
+ const Color& GetListBoxWindowHighlightColor() const;
+
+ void SetListBoxWindowHighlightTextColor( const Color& rColor );
+ const Color& GetListBoxWindowHighlightTextColor() 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 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;
+ // 0 auto, 1 light, 2, dark
+ static void SetDarkMode(int nMode);
+ static int GetDarkMode();
+ // return if dark mode is active, resolving 'auto' to dark (true) or light (false)
+ static bool GetUseDarkMode();
+ static void SetAppColorMode(int nMode);
+ static int GetAppColorMode();
+ // return true if system preferences are set to use reduced animation
+ static bool GetUseReducedAnimation();
+ 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 0000000000..769c4d27a9
--- /dev/null
+++ b/include/vcl/skia/SkiaHelper.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_VCL_SKIA_SKIAHELPER_HXX
+#define INCLUDED_VCL_SKIA_SKIAHELPER_HXX
+
+#include <vcl/dllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <config_features.h>
+
+namespace SkiaHelper
+{
+VCL_DLLPUBLIC bool isVCLSkiaEnabled();
+VCL_DLLPUBLIC OUString readLog();
+VCL_DLLPUBLIC bool isAlphaMaskBlendingEnabled();
+
+#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 0000000000..77398a3efe
--- /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 0000000000..5a7fe8cd3f
--- /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 0000000000..4d8624c49b
--- /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 0000000000..903bd56e7f
--- /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 0000000000..0c287ddbc1
--- /dev/null
+++ b/include/vcl/status.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_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, ControlType eControlType);
+
+
+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;
+
+ SAL_DLLPRIVATE void PaintSelfAndChildrenImmediately();
+
+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 OUString& 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 0000000000..561bbd18cb
--- /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 <vcl/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 0000000000..36d7eeb1fc
--- /dev/null
+++ b/include/vcl/svapp.hxx
@@ -0,0 +1,1454 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 KeyCode;
+ class ILibreOfficeKitNotifier;
+ class Window;
+}
+
+class NotifyEvent;
+class KeyEvent;
+class MouseEvent;
+class GestureEventPan;
+struct ImplSVEvent;
+struct ConvertData;
+namespace basegfx { class SystemDependentDataManager; }
+
+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;
+}
+
+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,
+ GestureEventPan 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();
+
+ /** access the DataManager for buffering system-dependent data
+
+ @returns the global instance of the SystemDependentDataManager
+ */
+ static basegfx::SystemDependentDataManager& GetSystemDependentDataManager();
+
+ /** 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 (std::u16string_view 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 AbsoluteScreenPixelRectangle GetScreenPosSizePixel( unsigned int nScreen );
+
+ /** Get the "best" screen.
+
+ @returns the return value will be nearest screen of the target rectangle.
+ */
+ SAL_DLLPRIVATE static unsigned int GetBestScreen( const AbsoluteScreenPixelRectangle& );
+
+ /** 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();
+
+ ///@}
+
+ /** 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 );
+
+ /** 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,
+ const ILibreOfficeKitNotifier* pNotifier = nullptr);
+
+ 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 OString& pPayload) const override;
+ virtual void notifyInvalidation(tools::Rectangle const *) 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 0000000000..ca60107844
--- /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 0000000000..14bcc65326
--- /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 0000000000..11d85b029b
--- /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 0000000000..b7bdb56228
--- /dev/null
+++ b/include/vcl/sysdata.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_VCL_SYSDATA_HXX
+#define INCLUDED_VCL_SYSDATA_HXX
+
+#include <sal/types.h>
+#include <vcl/dllapi.h>
+#include <config_vclplug.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
+#endif
+#if USE_HEADLESS_CODE
+ void* pSurface; // the cairo surface when using svp-based backends, which includes gtk[3|4]
+#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 )
+#endif
+#if USE_HEADLESS_CODE
+ , 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 0000000000..c59d7a2476
--- /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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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:
+ static 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 OUString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
+
+ void SetWindowState(const vcl::WindowData& 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::u16string_view rStr);
+ OUString GetWindowState(vcl::WindowDataMask nMask = vcl::WindowDataMask::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 GetWindowState(vcl::WindowData& 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 0000000000..f7db263d2e
--- /dev/null
+++ b/include/vcl/tabctrl.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_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 */
+
+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 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 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 OUString& 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 OUString& rName ) const;
+ OUString 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 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 OUString &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 0000000000..79e0b5a3c2
--- /dev/null
+++ b/include/vcl/tabpage.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_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;
+ 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 0000000000..5ed8cde7ff
--- /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 0000000000..c055882e76
--- /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 0000000000..f931d947e2
--- /dev/null
+++ b/include/vcl/test/GraphicsRenderTests.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/.
+ *
+ */
+#pragma once
+
+#include <utility>
+#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(std::move(atestName))
+ , m_aTestStatus(std::move(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 0000000000..c64d4e88b8
--- /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 0000000000..bcbbb3d384
--- /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, OUString aOldTextAfterStartPos);
+ ~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 0000000000..1dbbd5ba1f
--- /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 0000000000..0113b28bce
--- /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(OUString aForbiddenChars = 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 0000000000..2c212922f9
--- /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 0000000000..84a89e8c58
--- /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 SearchOptions2;
+}
+
+
+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( OUString aText );
+
+ 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( std::u16string_view 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::SearchOptions2& rSearchOptions, bool bForward );
+ sal_uInt16 Replace( const i18nutil::SearchOptions2& 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 0000000000..918b072ae2
--- /dev/null
+++ b/include/vcl/threadex.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_VCL_THREADEX_HXX
+#define INCLUDED_VCL_THREADEX_HXX
+
+#include <osl/conditn.hxx>
+#include <tools/link.hxx>
+#include <vcl/dllapi.h>
+
+#include <exception>
+#include <optional>
+#include <memory>
+#include <utility>
+
+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 func )
+ : m_func(std::move(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 func )
+ : m_func(std::move(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 0000000000..89cc623a18
--- /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 0000000000..6cf448a30b
--- /dev/null
+++ b/include/vcl/toolbox.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 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; }
+
+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;
+ 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,
+ 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;
+
+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;
+ static 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 OUString& 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,
+ const OUString& rCommand,
+ 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 OUString& 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 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 0000000000..009a10d74e
--- /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 0000000000..889f0b20aa
--- /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 0000000000..017c4d06ac
--- /dev/null
+++ b/include/vcl/toolkit/button.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 .
+ */
+
+#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; class XFrame; }
+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, const css::uno::Reference<css::frame::XFrame>& rFrame);
+ 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 OUString &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 OUString &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;
+
+ bool isToggleButton() { return mbIsToggleButton; }
+ void setToggleButton(bool bIsToggleButton) { mbIsToggleButton = bIsToggleButton; }
+
+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;
+ bool mbIsToggleButton = false;
+};
+
+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 OUString &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 OUString &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 0000000000..9652bb4464
--- /dev/null
+++ b/include/vcl/toolkit/calendar.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
+
+#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;
+ virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const 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 0000000000..c7628e7321
--- /dev/null
+++ b/include/vcl/toolkit/combobox.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 .
+ */
+
+#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 );
+ void SetHighlightColor(const Color& rColor);
+ void SetHighlightTextColor(const Color& rColor);
+
+ /**
+ * 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 OUString &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 0000000000..5e11d2f783
--- /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, const OUString& 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);
+ vcl::Window* GetFirstControlForFocus();
+
+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 OUString &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);
+
+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 0000000000..181940b6fe
--- /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;
+ css::uno::Reference<css::datatransfer::dnd::XDragSourceListener > mxDnDListener;
+
+ 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 );
+
+ // 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 bool PreNotify(NotifyEvent& rNEvt) 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 OUString &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 0000000000..71f1bd7033
--- /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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 OUString &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 0000000000..2b88e89518
--- /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 OUString &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 OUString &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 0000000000..1c199d501a
--- /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 OUString &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 0000000000..f71d664136
--- /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;
+ AbsoluteScreenPixelRectangle 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 AbsoluteScreenPixelPoint ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos);
+ static AbsoluteScreenPixelRectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect);
+ static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const AbsoluteScreenPixelRectangle& rRect);
+ SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId );
+ SAL_DLLPRIVATE AbsoluteScreenPixelRectangle 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 OUString& 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 0000000000..34b7ea7557
--- /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 OUString &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 0000000000..81e595ec2d
--- /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 0000000000..20b1863a00
--- /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 0000000000..ca96bc8e57
--- /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( OUString aText, Image aImage );
+
+ 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 0000000000..3206f39806
--- /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 0000000000..197122c254
--- /dev/null
+++ b/include/vcl/toolkit/lstbox.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 .
+ */
+
+#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 SetHighlightColor(const Color& rColor);
+ void SetHighlightTextColor(const Color& rColor);
+
+ 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 OUString &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 0000000000..2af263fae2
--- /dev/null
+++ b/include/vcl/toolkit/menubtn.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 .
+ */
+
+#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;
+ OUString 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 );
+ // override in derived classes to set up anything needed to execute menu
+ virtual void PrepareExecute() {};
+
+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(); }
+
+ OUString 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();
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+};
+
+/* 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 0000000000..ca2a4b21d8
--- /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 0000000000..1fcba74fda
--- /dev/null
+++ b/include/vcl/toolkit/prgsbar.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 .
+ */
+
+#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
+{
+public:
+ enum class BarStyle
+ {
+ Progress,
+ Level,
+ };
+
+private:
+ Point maPos;
+ tools::Long mnPrgsWidth;
+ tools::Long mnPrgsHeight;
+ sal_uInt16 mnPercent;
+ sal_uInt16 mnPercentCount;
+ bool mbCalcNew;
+ BarStyle meBarStyle;
+
+ 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, BarStyle eBarStyle );
+
+ 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 0000000000..ef1cec2501
--- /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/scrbar.hxx b/include/vcl/toolkit/scrbar.hxx
new file mode 100644
index 0000000000..6981b64fa6
--- /dev/null
+++ b/include/vcl/toolkit/scrbar.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
+
+#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/ctrl.hxx>
+#include <vcl/scrollable.hxx>
+#include <memory>
+
+struct ImplScrollBarData;
+
+class VCL_DLLPUBLIC ScrollBar final : public Control
+ , public Scrollable
+{
+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();
+ void EndScroll();
+
+ tools::Long DoScroll( tools::Long nNewPos ) override;
+ tools::Long DoScrollAction( ScrollType eScrollType );
+
+ void EnableDrag() { mbFullDrag = true; }
+
+ void SetRangeMin( tools::Long nNewRange ) override;
+ tools::Long GetRangeMin() const override { return mnMinRange; }
+ void SetRangeMax( tools::Long nNewRange ) override;
+ tools::Long GetRangeMax() const override { return mnMaxRange; }
+ void SetRange( const Range& rRange ) override;
+ Range GetRange() const override { return Range( GetRangeMin(), GetRangeMax() ); }
+ void SetThumbPos( tools::Long nThumbPos ) override;
+ tools::Long GetThumbPos() const override { return mnThumbPos; }
+ void SetLineSize( tools::Long nNewSize ) override { mnLineSize = nNewSize; }
+ tools::Long GetLineSize() const override { return mnLineSize; }
+ void SetPageSize( tools::Long nNewSize ) override { mnPageSize = nNewSize; }
+ tools::Long GetPageSize() const override { return mnPageSize; }
+ void SetVisibleSize( tools::Long nNewSize ) override;
+ tools::Long GetVisibleSize() const override { return mnVisibleSize; }
+
+ bool Inactive() const override;
+
+ 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;
+};
+
+/* 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 0000000000..bc1e14109f
--- /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 0000000000..499baa4ff5
--- /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:
+ 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 );
+
+ tools::Rectangle maUpperRect;
+ tools::Rectangle maLowerRect;
+ tools::Rectangle maDropDownRect; // not yet attached ...
+
+ 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 0000000000..c9aaaa46d9
--- /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,
+ HIGHLIGHTED = 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(OUString aText);
+ 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::HIGHLIGHTED);
+ }
+ void SetStateChecked();
+ void SetStateUnchecked();
+ void SetStateTristate();
+ void SetStateHilighted(bool bHilight);
+};
+
+inline void SvLBoxButton::SetStateChecked()
+{
+ nItemFlags &= SvItemStateFlags::HIGHLIGHTED;
+ nItemFlags |= SvItemStateFlags::CHECKED;
+}
+
+inline void SvLBoxButton::SetStateUnchecked()
+{
+ nItemFlags &= SvItemStateFlags::HIGHLIGHTED;
+ nItemFlags |= SvItemStateFlags::UNCHECKED;
+}
+inline void SvLBoxButton::SetStateTristate()
+{
+ nItemFlags &= SvItemStateFlags::HIGHLIGHTED;
+ nItemFlags |= SvItemStateFlags::TRISTATE;
+}
+inline void SvLBoxButton::SetStateHilighted( bool bHilight )
+{
+ if ( bHilight )
+ nItemFlags |= SvItemStateFlags::HIGHLIGHTED;
+ else
+ nItemFlags &= ~SvItemStateFlags::HIGHLIGHTED;
+}
+
+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 0000000000..1fd7b8b16e
--- /dev/null
+++ b/include/vcl/toolkit/svtabbx.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 .
+ */
+
+#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:
+ bool m_bFirstPaint;
+ std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl;
+ ::vcl::IAccessibleTabListBox* m_pAccessible;
+ std::vector<css::uno::Reference<css::accessibility::XAccessible>> 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 GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) 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( sal_Int64& _rStateSet, AccessibleBrowseBoxObjType _eType ) const override;
+ virtual void FillAccessibleStateSetForCell( sal_Int64& _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 AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const override;
+ virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) 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 0000000000..48fab3174e
--- /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 0000000000..ff1240074b
--- /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 0000000000..d0306ce915
--- /dev/null
+++ b/include/vcl/toolkit/treelist.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 .
+ */
+
+#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 );
+
+ 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 0000000000..ecbd489fd8
--- /dev/null
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -0,0 +1,684 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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;
+
+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; }
+ bool isEnable() const { return !mbDisabled; }
+
+ 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<SvTreeListEntry*, OUString> 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 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;
+ SvLBoxString* 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;
+
+ OUString GetEntryTooltip(SvTreeListEntry* pEntry) const { return aTooltipHdl.Call(pEntry); }
+
+ VclPtr<Edit> GetEditWidget() const; // for UITest
+ 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<SvTreeListEntry*, OUString>& 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, sal_Int64& 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 OUString &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;
+
+ virtual void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags ) 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;
+
+ // 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 0000000000..fdd86dbfaf
--- /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 0000000000..b8bffecefd
--- /dev/null
+++ b/include/vcl/toolkit/treelistentry.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
+
+#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;
+ 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 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 0000000000..359810652e
--- /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 XVclWindowPeer;
+}
+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::XVclWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0;
+ virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XVclWindowPeer > & 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 0000000000..2ca0104519
--- /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 <vcl/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 OUString &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 0000000000..b34a8e3ef5
--- /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 0000000000..e39fe13b03
--- /dev/null
+++ b/include/vcl/transfer.hxx
@@ -0,0 +1,514 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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/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>
+#include <utility>
+
+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,
+ css::datatransfer::dnd::DropTargetDragEvent aDragEvent ) :
+ maPosPixel( rPosPixel ),
+ maDragEvent(std::move( aDragEvent )),
+ 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,
+ css::datatransfer::dnd::DropTargetDropEvent aDropEvent ) :
+ maPosPixel( rPosPixel ),
+ maDropEvent(std::move( aDropEvent )),
+ mnAction( nAction ),
+ mbDefault( false ) {}
+};
+
+class VCL_DLLPUBLIC TransferableHelper : public cppu::WeakImplHelper< css::datatransfer::XTransferable2,
+ css::datatransfer::clipboard::XClipboardOwner,
+ css::datatransfer::dnd::XDragSourceListener>
+{
+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();
+};
+
+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 ) const;
+ bool GetTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
+
+ 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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 0000000000..186fbe1ad6
--- /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 0000000000..47bf9e117e
--- /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 0000000000..e514278766
--- /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 0000000000..0bbc95c75e
--- /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 0000000000..bc353ad4ea
--- /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(const 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 0000000000..f45da77230
--- /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 0000000000..d27140b2c2
--- /dev/null
+++ b/include/vcl/uitest/uiobject.hxx
@@ -0,0 +1,591 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If 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 final : 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, std::vector<sal_Int32> nTreePath);
+
+ 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:
+
+ SvTreeListEntry* getEntry() const;
+
+ VclPtr<SvTreeListBox> mxTreeList;
+
+ std::vector<sal_Int32> maTreePath;
+};
+
+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 0000000000..189df1de55
--- /dev/null
+++ b/include/vcl/uitest/uitest.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_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;
+
+namespace UITest
+{
+ bool executeCommand(const OUString& rCommand);
+
+ bool executeCommandWithParameters(const OUString& rCommand,
+ const css::uno::Sequence< css::beans::PropertyValue >& rArgs);
+
+ bool executeDialog(const OUString& rCommand);
+
+ std::unique_ptr<UIObject> getFocusTopWindow();
+
+ 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 0000000000..c7b9dcc069
--- /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 0000000000..b9dee333df
--- /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( OUString aText );
+ 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 0000000000..c8f27fb9da
--- /dev/null
+++ b/include/vcl/vclenum.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_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 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
+};
+
+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,
+ TransparentText // if alpha in TextColor can be honored
+};
+
+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,
+};
+
+// available button sizes for navigation bar
+enum class NavbarButtonSize
+{
+ Auto,
+ Small,
+ Large,
+ XLarge,
+};
+
+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> {};
+}
+
+enum class ScrollType
+{
+ DontKnow,
+ LineUp, LineDown,
+ PageUp, PageDown,
+ Drag
+};
+
+#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 0000000000..c60e89d836
--- /dev/null
+++ b/include/vcl/vclevent.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_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,
+ MenuItemRoleChanged,
+ 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 0000000000..7c7a179b9b
--- /dev/null
+++ b/include/vcl/vcllayout.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
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <tools/gen.hxx>
+#include <tools/degree.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
+ basegfx::B2DPoint& DrawBase() { return maDrawBase; }
+ const basegfx::B2DPoint& DrawBase() const { return maDrawBase; }
+ Point& DrawOffset() { return maDrawOffset; }
+ const Point& DrawOffset() const { return maDrawOffset; }
+ basegfx::B2DPoint GetDrawPosition( const basegfx::B2DPoint& rRelative = basegfx::B2DPoint(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 SetSubpixelPositioning(bool bSubpixelPositioning)
+ {
+ mbSubpixelPositioning = bSubpixelPositioning;
+ }
+
+ bool GetSubpixelPositioning() const
+ {
+ return mbSubpixelPositioning;
+ }
+
+ // methods using string indexing
+ virtual sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const = 0;
+ virtual double FillDXArray( std::vector<double>* pDXArray, const OUString& rStr ) const = 0;
+ virtual double GetTextWidth() const { return FillDXArray( nullptr, {} ); }
+ virtual void GetCaretPositions( std::vector<double>& rCaretPositions, const OUString& rStr ) const = 0;
+ virtual bool IsKashidaPosValid ( int /*nCharPos*/, int /*nNextCharPos*/ ) const = 0; // i60594
+
+ // methods using glyph indexing
+ virtual bool GetNextGlyph(const GlyphItem** pGlyph, basegfx::B2DPoint& rPos, int& nStart,
+ const LogicalFontInstance** ppGlyphFont = 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;
+ LanguageTag maLanguageTag;
+
+ Degree10 mnOrientation;
+
+ mutable Point maDrawOffset;
+ basegfx::B2DPoint maDrawBase;
+
+ bool mbSubpixelPositioning;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/vclmain.hxx b/include/vcl/vclmain.hxx
new file mode 100644
index 0000000000..6572d6d30e
--- /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 0000000000..ea2fffe417
--- /dev/null
+++ b/include/vcl/vclptr.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_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(std::move(m_rInnerRef));
+ // coverity[use_after_move : SUPPRESS] - the move ctor above must take care of it
+ assert(!m_rInnerRef);
+ 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 0000000000..2ba39026a3
--- /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 0000000000..bfa30b7af3
--- /dev/null
+++ b/include/vcl/vectorgraphicdata.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_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; }
+
+
+// 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(
+ BinaryDataContainer aDataContainer,
+ 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 0000000000..40cf445f03
--- /dev/null
+++ b/include/vcl/virdev.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 .
+ */
+
+#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 meFormatAndAlpha;
+ 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, bool bAlphaMaskTransparent = false );
+
+ 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.
+
+ @param eOutDevType
+ This real virtual output device type.
+ */
+ explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
+ OutDevType eOutDevType);
+
+public:
+
+ /** Create a virtual device of size 1x1
+
+ @param eFormat
+ Device format of the generated virtual device.
+ */
+ explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::WITHOUT_ALPHA)
+ : VirtualDevice(nullptr, eFormat, 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.
+ */
+ explicit VirtualDevice(const OutputDevice& rCompDev,
+ DeviceFormat eFormat = DeviceFormat::WITHOUT_ALPHA)
+ : VirtualDevice(&rCompDev, eFormat, 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 bAlphaMaskTransparent = false );
+ 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 0000000000..474d2afe50
--- /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 0000000000..2d8c4db085
--- /dev/null
+++ b/include/vcl/weld.hxx
@@ -0,0 +1,2737 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If 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 <utility>
+#include <vcl/vclenum.hxx>
+#include <vcl/font.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/uitest/factory.hxx>
+#include <vcl/windowstate.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<Widget&, void> m_aStyleUpdatedHdl;
+ 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 OUString 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 OUString& 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 OUString get_help_id() const = 0;
+ virtual void set_help_id(const OUString& 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 set_cursor_data(void* pData) = 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 connect_style_updated(const Link<Widget&, void>& rLink)
+ {
+ assert(!m_aStyleUpdatedHdl.IsSet() || !rLink.IsSet());
+ m_aStyleUpdatedHdl = 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 OUString&)>& 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
+{
+ Link<Container&, void> m_aContainerFocusChangedHdl;
+
+protected:
+ void signal_container_focus_changed() { m_aContainerFocusChangedHdl.Call(*this); }
+
+public:
+ // remove from old container and add to new container in one go
+ // new container can be null to just remove from old container
+ 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
+{
+ friend class ::LOKTrigger;
+
+ Link<ScrolledWindow&, void> m_aVChangeHdl;
+ Link<ScrolledWindow&, void> m_aHChangeHdl;
+
+protected:
+ 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
+{
+ friend class ::LOKTrigger;
+
+protected:
+ Link<const OUString&, bool> m_aLeavePageHdl;
+ Link<const OUString&, void> m_aEnterPageHdl;
+
+public:
+ virtual int get_current_page() const = 0;
+ virtual int get_page_index(const OUString& rIdent) const = 0;
+ virtual OUString get_page_ident(int nPage) const = 0;
+ virtual OUString get_current_page_ident() const = 0;
+ virtual void set_current_page(int nPage) = 0;
+ virtual void set_current_page(const OUString& rIdent) = 0;
+ virtual void remove_page(const OUString& rIdent) = 0;
+ virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) = 0;
+ void append_page(const OUString& rIdent, const OUString& rLabel)
+ {
+ insert_page(rIdent, rLabel, -1);
+ }
+ virtual void set_tab_label_text(const OUString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_tab_label_text(const OUString& rIdent) const = 0;
+ virtual void set_show_tabs(bool bShow) = 0;
+ virtual int get_n_pages() const = 0;
+ virtual weld::Container* get_page(const OUString& rIdent) const = 0;
+
+ void connect_leave_page(const Link<const OUString&, bool>& rLink) { m_aLeavePageHdl = rLink; }
+ void connect_enter_page(const Link<const OUString&, void>& rLink) { m_aEnterPageHdl = rLink; }
+};
+
+class VCL_DLLPUBLIC ScreenShotEntry
+{
+public:
+ ScreenShotEntry(OUString aHelpId, const basegfx::B2IRange& rB2IRange)
+ : msHelpId(std::move(aHelpId))
+ , maB2IRange(rB2IRange)
+ {
+ }
+
+ const basegfx::B2IRange& getB2IRange() const { return maB2IRange; }
+
+ const OUString& GetHelpId() const { return msHelpId; }
+
+private:
+ OUString 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 AbsoluteScreenPixelRectangle 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 OUString& rStr) = 0;
+ virtual OUString get_window_state(vcl::WindowDataMask 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;
+
+ virtual const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() = 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 OUString& rHelpId = {}) = 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
+{
+ Link<const OUString&, bool> m_aJumpPageHdl;
+
+protected:
+ bool signal_jump_page(const OUString& rIdent) { return m_aJumpPageHdl.Call(rIdent); }
+
+public:
+ virtual int get_current_page() const = 0;
+ virtual int get_n_pages() const = 0;
+ virtual OUString get_page_ident(int nPage) const = 0;
+ virtual OUString get_current_page_ident() const = 0;
+ virtual void set_current_page(int nPage) = 0;
+ virtual void set_current_page(const OUString& rIdent) = 0;
+ // move the page rIdent to position nIndex
+ virtual void set_page_index(const OUString& rIdent, int nIndex) = 0;
+ virtual void set_page_title(const OUString& rIdent, const OUString& rTitle) = 0;
+ virtual OUString get_page_title(const OUString& rIdent) const = 0;
+ virtual void set_page_sensitive(const OUString& rIdent, bool bSensitive) = 0;
+ virtual weld::Container* append_page(const OUString& rIdent) = 0;
+
+ virtual void set_page_side_help_id(const OUString& rHelpId) = 0;
+
+ virtual void set_page_side_image(const OUString& rImage) = 0;
+
+ void connect_jump_page(const Link<const OUString&, bool>& rLink) { m_aJumpPageHdl = rLink; }
+};
+
+inline OUString toId(const void* pValue)
+{
+ return OUString::number(reinterpret_cast<sal_uIntPtr>(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(OUString _aString)
+ : sString(std::move(_aString))
+ {
+ }
+ ComboBoxEntry(OUString _aString, OUString _aId)
+ : sString(std::move(_aString))
+ , sId(std::move(_aId))
+ {
+ }
+ ComboBoxEntry(OUString _aString, OUString _aId, OUString _aImage)
+ : sString(std::move(_aString))
+ , sId(std::move(_aId))
+ , sImage(std::move(_aImage))
+ {
+ }
+};
+
+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(int pos, const weld::ComboBoxEntry& rItem)
+ {
+ insert(pos, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
+ rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
+ }
+ void insert_text(int pos, const OUString& rStr)
+ {
+ insert(pos, rStr, nullptr, nullptr, nullptr);
+ }
+ void append(const weld::ComboBoxEntry& rItem) { insert(-1, rItem); }
+ 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 OUString& 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 all columns
+ virtual void set_sensitive(int row, bool bSensitive, int col = -1) = 0;
+ virtual bool get_sensitive(int row, int col) const = 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 all columns
+ virtual void set_sensitive(const TreeIter& rIter, bool bSensitive, int col = -1) = 0;
+ virtual bool get_sensitive(const TreeIter& rIter, int col) const = 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>& rTransferable,
+ 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,
+ bool bAutoScroll = true)
+ = 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;
+ using Widget::get_sensitive;
+};
+
+typedef std::tuple<tools::JsonWriter&, const TreeIter&, std::string_view> json_prop_query;
+
+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;
+ Link<const json_prop_query&, bool> m_aGetPropertyTreeElemHdl;
+
+ 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;
+ }
+
+ // 0: json writer, 1: TreeIter, 2: property. returns true if supported
+ virtual void connect_get_property_tree_elem(const Link<const json_prop_query&, bool>& rLink)
+ {
+ m_aGetPropertyTreeElemHdl = 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 OUString get_text(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(); }
+ bool is_custom_handler_set() { return m_aClickHdl.IsSet(); }
+
+ // 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
+{
+ friend class ::LOKTrigger;
+
+ Link<const OUString&, void> m_aSelectHdl;
+
+protected:
+ void signal_selected(const OUString& rIdent) { m_aSelectHdl.Call(rIdent); }
+
+public:
+ void connect_selected(const Link<const OUString&, 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 OUString& rId) = 0;
+ virtual void clear() = 0;
+ virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) = 0;
+ virtual void set_item_active(const OUString& rIdent, bool bActive) = 0;
+ virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_item_label(const OUString& rIdent) const = 0;
+ virtual void set_item_visible(const OUString& 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
+{
+ Link<LinkButton&, bool> m_aActivateLinkHdl;
+
+protected:
+ 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_label_wrap(bool wrap) = 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
+{
+ Link<Scale&, void> m_aValueChangedHdl;
+
+protected:
+ 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 LevelBar : virtual public Widget
+{
+public:
+ /// Sets LevelBar fill percentage.
+ /// @param fPercentage bar's fill percentage, [0.0, 100.0]
+ virtual void set_percentage(double fPercentage) = 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;
+
+ Link<SpinButton&, void> m_aValueChangedHdl;
+ Link<SpinButton&, void> m_aOutputHdl;
+ Link<int*, bool> m_aInputHdl;
+
+protected:
+ 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
+{
+ friend class ::LOKTrigger;
+
+ Link<FormattedSpinButton&, void> m_aValueChangedHdl;
+
+protected:
+ 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
+{
+ friend class ::LOKTrigger;
+
+ Link<Calendar&, void> m_aSelectedHdl;
+ Link<Calendar&, void> m_aActivatedHdl;
+
+protected:
+ 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)
+ append(rItem);
+ 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);
+ }
+ OUString get_buildable_name() const { return m_xSpinButton->get_buildable_name(); }
+ void set_help_id(const OUString& 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
+{
+ Link<Expander&, void> m_aExpandedHdl;
+
+protected:
+ 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<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_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>& rTransferable,
+ 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 AbsoluteScreenPixelPoint get_accessible_location_on_screen() = 0;
+
+private:
+ friend class ::LOKTrigger;
+
+ virtual void click(const Point&) = 0;
+
+ virtual void dblclick(const Point&){};
+
+ virtual void mouse_up(const Point&){};
+
+ virtual void mouse_down(const Point&){};
+
+ virtual void mouse_move(const Point&){};
+};
+
+enum class Placement
+{
+ Under,
+ End
+};
+
+class VCL_DLLPUBLIC Menu
+{
+ Link<const OUString&, void> m_aActivateHdl;
+
+protected:
+ void signal_activate(const OUString& rIdent) { m_aActivateHdl.Call(rIdent); }
+
+public:
+ virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
+ Placement ePlace = Placement::Under)
+ = 0;
+
+ void connect_activate(const Link<const OUString&, void>& rLink) { m_aActivateHdl = rLink; }
+
+ virtual void set_sensitive(const OUString& rIdent, bool bSensitive) = 0;
+ virtual bool get_sensitive(const OUString& rIdent) const = 0;
+ virtual void set_label(const OUString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_label(const OUString& rIdent) const = 0;
+ virtual void set_active(const OUString& rIdent, bool bActive) = 0;
+ virtual bool get_active(const OUString& rIdent) const = 0;
+ virtual void set_visible(const OUString& 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 set_item_help_id(const OUString& rIdent, const OUString& rHelpId) = 0;
+ virtual void remove(const OUString& 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 OUString 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
+{
+ Link<const OUString&, void> m_aClickHdl;
+ Link<const OUString&, void> m_aToggleMenuHdl;
+
+protected:
+ friend class ::LOKTrigger;
+
+ void signal_clicked(const OUString& rIdent) { m_aClickHdl.Call(rIdent); }
+ void signal_toggle_menu(const OUString& rIdent) { m_aToggleMenuHdl.Call(rIdent); }
+
+public:
+ virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) = 0;
+ virtual bool get_item_sensitive(const OUString& rIdent) const = 0;
+ virtual void set_item_active(const OUString& rIdent, bool bActive) = 0;
+ virtual bool get_item_active(const OUString& rIdent) const = 0;
+ virtual void set_menu_item_active(const OUString& rIdent, bool bActive) = 0;
+ virtual bool get_menu_item_active(const OUString& rIdent) const = 0;
+ virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) = 0;
+ virtual void set_item_popover(const OUString& rIdent, weld::Widget* pPopover) = 0;
+ virtual void set_item_visible(const OUString& rIdent, bool bVisible) = 0;
+ virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) = 0;
+ virtual bool get_item_visible(const OUString& rIdent) const = 0;
+ virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) = 0;
+ virtual OUString get_item_label(const OUString& rIdent) const = 0;
+ virtual void set_item_tooltip_text(const OUString& rIdent, const OUString& rTip) = 0;
+ virtual OUString get_item_tooltip_text(const OUString& rIdent) const = 0;
+ virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) = 0;
+ virtual void set_item_image_mirrored(const OUString& rIdent, bool bMirrored) = 0;
+ virtual void set_item_image(const OUString& rIdent,
+ const css::uno::Reference<css::graphic::XGraphic>& rIcon)
+ = 0;
+ virtual void set_item_image(const OUString& 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 OUString get_item_ident(int nIndex) const = 0;
+ virtual void set_item_ident(int nIndex, const OUString& 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 OUString&, void>& rLink) { m_aClickHdl = rLink; }
+ void connect_menu_toggled(const Link<const OUString&, void>& rLink)
+ {
+ m_aToggleMenuHdl = rLink;
+ }
+};
+
+class VCL_DLLPUBLIC Scrollbar : virtual public Widget
+{
+ Link<Scrollbar&, void> m_aChangeHdl;
+
+protected:
+ void signal_adjustment_changed() { m_aChangeHdl.Call(*this); }
+
+public:
+ virtual void adjustment_configure(int value, int lower, int upper, int step_increment,
+ int page_increment, int page_size)
+ = 0;
+ virtual int adjustment_get_value() const = 0;
+ virtual void adjustment_set_value(int value) = 0;
+ virtual int adjustment_get_upper() const = 0;
+ virtual void adjustment_set_upper(int upper) = 0;
+ virtual int adjustment_get_page_size() const = 0;
+ virtual void adjustment_set_page_size(int size) = 0;
+ virtual int adjustment_get_page_increment() const = 0;
+ virtual void adjustment_set_page_increment(int size) = 0;
+ virtual int adjustment_get_step_increment() const = 0;
+ virtual void adjustment_set_step_increment(int size) = 0;
+ virtual int adjustment_get_lower() const = 0;
+ virtual void adjustment_set_lower(int upper) = 0;
+
+ virtual int get_scroll_thickness() const = 0;
+ virtual void set_scroll_thickness(int nThickness) = 0;
+
+ virtual ScrollType get_scroll_type() const = 0;
+
+ void connect_adjustment_changed(const Link<Scrollbar&, void>& rLink) { m_aChangeHdl = 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 OUString& id) = 0;
+ virtual std::unique_ptr<Dialog> weld_dialog(const OUString& id) = 0;
+ virtual std::unique_ptr<Assistant> weld_assistant(const OUString& id) = 0;
+ virtual std::unique_ptr<Widget> weld_widget(const OUString& id) = 0;
+ virtual std::unique_ptr<Container> weld_container(const OUString& id) = 0;
+ virtual std::unique_ptr<Box> weld_box(const OUString& id) = 0;
+ virtual std::unique_ptr<Paned> weld_paned(const OUString& id) = 0;
+ virtual std::unique_ptr<Button> weld_button(const OUString& id) = 0;
+ virtual std::unique_ptr<MenuButton> weld_menu_button(const OUString& id) = 0;
+ virtual std::unique_ptr<MenuToggleButton> weld_menu_toggle_button(const OUString& id) = 0;
+ virtual std::unique_ptr<Frame> weld_frame(const OUString& 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 OUString& id,
+ bool bUserManagedScrolling = false)
+ = 0;
+ virtual std::unique_ptr<Notebook> weld_notebook(const OUString& id) = 0;
+ virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OUString& id) = 0;
+ virtual std::unique_ptr<RadioButton> weld_radio_button(const OUString& id) = 0;
+ virtual std::unique_ptr<CheckButton> weld_check_button(const OUString& id) = 0;
+ virtual std::unique_ptr<LinkButton> weld_link_button(const OUString& id) = 0;
+ virtual std::unique_ptr<SpinButton> weld_spin_button(const OUString& id) = 0;
+ virtual std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OUString& id,
+ FieldUnit eUnit)
+ = 0;
+ virtual std::unique_ptr<FormattedSpinButton> weld_formatted_spin_button(const OUString& id) = 0;
+ virtual std::unique_ptr<ComboBox> weld_combo_box(const OUString& id) = 0;
+ virtual std::unique_ptr<TreeView> weld_tree_view(const OUString& id) = 0;
+ virtual std::unique_ptr<IconView> weld_icon_view(const OUString& id) = 0;
+ virtual std::unique_ptr<Label> weld_label(const OUString& id) = 0;
+ virtual std::unique_ptr<TextView> weld_text_view(const OUString& id) = 0;
+ virtual std::unique_ptr<Expander> weld_expander(const OUString& id) = 0;
+ virtual std::unique_ptr<Entry> weld_entry(const OUString& id) = 0;
+ virtual std::unique_ptr<Scale> weld_scale(const OUString& id) = 0;
+ virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OUString& id) = 0;
+ virtual std::unique_ptr<LevelBar> weld_level_bar(const OUString& id) = 0;
+ virtual std::unique_ptr<Spinner> weld_spinner(const OUString& id) = 0;
+ virtual std::unique_ptr<Image> weld_image(const OUString& id) = 0;
+ virtual std::unique_ptr<Calendar> weld_calendar(const OUString& id) = 0;
+ virtual std::unique_ptr<DrawingArea>
+ weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
+ FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr)
+ = 0;
+ virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OUString& containerid,
+ const OUString& entryid,
+ const OUString& treeviewid)
+ = 0;
+ virtual std::unique_ptr<Menu> weld_menu(const OUString& id) = 0;
+ virtual std::unique_ptr<Popover> weld_popover(const OUString& id) = 0;
+ virtual std::unique_ptr<Toolbar> weld_toolbar(const OUString& id) = 0;
+ virtual std::unique_ptr<Scrollbar> weld_scrollbar(const OUString& 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 OUString& rHelpId) { getDialog()->set_help_id(rHelpId); }
+ OUString 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 OUString& 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 OUString& rDialogId, const OUString& rRelocateId = {});
+ 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_secondary_text(const OUString& rText) { m_xDialog->set_secondary_text(rText); }
+ OUString get_secondary_text() const { return m_xDialog->get_secondary_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 OUString& 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 0000000000..1987066bad
--- /dev/null
+++ b/include/vcl/weldutils.hxx
@@ -0,0 +1,473 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If 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
+{
+ weld::TreeView& m_rTreeView;
+
+protected:
+ 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,
+ bool bUseDeviceDPI = false);
+}
+
+#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 0000000000..640e9c6c99
--- /dev/null
+++ b/include/vcl/window.hxx
@@ -0,0 +1,1574 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except 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 <vcl/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 Scrollable;
+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 XVclWindowPeer;
+ }
+ 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 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 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;
+
+ virtual void ImplInvalidate( const vcl::Region* pRegion, 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, bool bUseRenderContextDPI = false) 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(Scrollable* pHScrl, double nX, Scrollable* pVScrl, double nY);
+
+ SAL_DLLPRIVATE AbsoluteScreenPixelRectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const AbsoluteScreenPixelRectangle& rRect ) const;
+ SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX() const;
+
+ // 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 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 IsNativeFrame() 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, bool bUseRenderContextDPI = false);
+ 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;
+ AbsoluteScreenPixelPoint OutputToAbsoluteScreenPixel( const Point& rPos ) const;
+ Point AbsoluteScreenToOutputPixel( const AbsoluteScreenPixelPoint& rPos ) const;
+ AbsoluteScreenPixelRectangle GetDesktopRectPixel() const;
+ // window extents including border and decoration, relative to passed in window
+ tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const;
+ // window extents including border and decoration, in absolute screen coordinates
+ AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() 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 );
+ void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE );
+ void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
+ 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;
+
+ virtual 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 OUString& );
+ const OUString& 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,
+ Scrollable* pHScrl,
+ Scrollable* pVScrl );
+
+ virtual const SystemEnvData* GetSystemData() const;
+
+ // API to set/query the component interfaces
+ virtual css::uno::Reference< css::awt::XVclWindowPeer >
+ GetComponentInterface( bool bCreate = true );
+
+ void SetComponentInterface( css::uno::Reference< css::awt::XVclWindowPeer > 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&);
+
+ /** @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;
+ ///@}
+
+ /*
+ * 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::XVclWindowPeer > 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 OUString &rKey, const OUString &rValue);
+
+ /*
+ * Sets a font attribute
+ *
+ * @return false if attribute is unknown
+ */
+ bool set_font_attribute(const OUString &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::TextLayoutCommon* _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;
+
+ /** 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 0000000000..527e3661e9
--- /dev/null
+++ b/include/vcl/windowstate.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_VCL_WINDOWSTATE_HXX
+#define INCLUDED_VCL_WINDOWSTATE_HXX
+
+#include <vcl/WindowPosSize.hxx>
+
+namespace vcl
+{
+enum class WindowState
+{
+ NONE = 0x0000,
+ Normal = 0x0001,
+ Minimized = 0x0002,
+ Maximized = 0x0004,
+ // Rollup is no longer used, but the bit is retained because WindowData 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
+};
+
+enum class WindowDataMask
+{
+ 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,
+ PosSize = Pos | Size,
+ PosSizeState = Pos | Size | State,
+ All = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight
+ | State | Minimized
+};
+
+class VCL_PLUGIN_PUBLIC WindowData final : public WindowPosSize
+{
+ WindowState m_nState;
+ WindowDataMask m_nMask;
+
+ int mnMaximizedX;
+ int mnMaximizedY;
+ unsigned int mnMaximizedWidth;
+ unsigned int mnMaximizedHeight;
+
+public:
+ WindowData()
+ : m_nState(WindowState::NONE)
+ , m_nMask(WindowDataMask::NONE)
+ , mnMaximizedX(0)
+ , mnMaximizedY(0)
+ , mnMaximizedWidth(0)
+ , mnMaximizedHeight(0)
+ {
+ }
+ WindowData(std::u16string_view rStr);
+
+ // serialize values to a string (the original WindowState representation)
+ OUString toStr() const;
+
+ void setState(WindowState nState) { m_nState = nState; }
+ WindowState state() const { return m_nState; }
+ WindowState& rState() { return m_nState; }
+
+ void setMask(WindowDataMask nMask) { m_nMask = nMask; }
+ WindowDataMask mask() const { return m_nMask; }
+ WindowDataMask& rMask() { return m_nMask; }
+
+ 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; }
+};
+
+} // namespace vcl
+
+namespace o3tl
+{
+template <> struct typed_flags<vcl::WindowState> : is_typed_flags<vcl::WindowState, 0xffff>
+{
+};
+template <> struct typed_flags<vcl::WindowDataMask> : is_typed_flags<vcl::WindowDataMask, 0x0f3f>
+{
+};
+}
+
+namespace vcl
+{
+inline std::ostream& operator<<(std::ostream& s, const WindowData& rData)
+{
+ if (rData.mask() & WindowDataMask::Width)
+ s << rData.width() << "x";
+ else
+ s << "?x";
+ if (rData.mask() & WindowDataMask::Height)
+ s << rData.height() << "@(";
+ else
+ s << "?@(";
+ if (rData.mask() & WindowDataMask::X)
+ s << rData.x() << ",";
+ else
+ s << "?,";
+ if (rData.mask() & WindowDataMask::Y)
+ s << rData.y() << ")^";
+ else
+ s << "?)^";
+ if (rData.mask() & WindowDataMask::State)
+ s << "0x" << std::hex << static_cast<unsigned>(rData.state()) << std::dec;
+ else
+ s << "?";
+ return s;
+}
+
+} // namespace vcl
+
+#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 0000000000..a984b45448
--- /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/wintypes.hxx b/include/vcl/wintypes.hxx
new file mode 100644
index 0000000000..644b2405cc
--- /dev/null
+++ b/include/vcl/wintypes.hxx
@@ -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 .
+ */
+
+#pragma once
+
+#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_FLATBUTTON = SAL_CONST_INT64(0x2000000000);
+
+// 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,
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
new file mode 100644
index 0000000000..3a3e6061a7
--- /dev/null
+++ b/include/vcl/wizardmachine.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_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 SAL_LOPLUGIN_ANNOTATE("crosscast") 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 OUString& 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);
+
+ virtual OUString getPageIdentForState(WizardTypes::WizardState nState) const;
+ virtual WizardTypes::WizardState getStateFromPageIdent(const OUString& rIdent) const;
+
+ 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 0000000000..4acc214657
--- /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 0000000000..dc2855b4f2
--- /dev/null
+++ b/include/vcl/wmfexternal.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_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();
+ 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 0000000000..615696f946
--- /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(vcl::WindowState);
+
+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 0000000000..c15707dcac
--- /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 SearchOptions2; }
+
+class VCL_DLLPUBLIC ExtTextEngine final : public TextEngine
+{
+public:
+ ExtTextEngine();
+ virtual ~ExtTextEngine() override;
+
+ TextSelection MatchGroup( const TextPaM& rCursor ) const;
+ bool Search( TextSelection& rSel, const i18nutil::SearchOptions2& rSearchOptions, bool bForward = true ) const;
+};
+
+#endif // INCLUDED_VCL_XTEXTEDT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */