diff options
Diffstat (limited to 'include')
113 files changed, 1914 insertions, 192 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index aff71dcc1f5d..899fdc7a2cf7 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -118,6 +118,15 @@ struct _LibreOfficeKitClass /// @see lok::Office::setOption void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* pValue); + + /// @see lok::Document::dumpState + /// @since LibreOffice 7.5 + void (*dumpState) (LibreOfficeKit* pThis, const char* pOptions, char** pState); + + /** @see lok::Office::extractRequest. + */ + char* (*extractRequest) (LibreOfficeKit* pThis, + const char* pFilePath); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) @@ -279,6 +288,7 @@ struct _LibreOfficeKitDocumentClass void (*paintPartTile) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nPart, + const int nMode, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, @@ -479,6 +489,18 @@ struct _LibreOfficeKitDocumentClass char** pText, char** pUsedMimeType); + /// @see lok::Document::getDataArea(). + void (*getDataArea) (LibreOfficeKitDocument* pThis, + long nPart, + long* pCol, + long* pRow); + + /// @see lok::Document::getEditMode(). + int (*getEditMode) (LibreOfficeKitDocument* pThis); + + /// @see lok::Document::setViewTimezone(). + void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const char* timezone); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 6dbfbf964b29..035a0923ce35 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -126,6 +126,11 @@ public: mpDoc->pClass->setPartMode(mpDoc, nMode); } + int getEditMode() + { + return mpDoc->pClass->getEditMode(mpDoc); + } + /** * Renders a subset of the document to a pre-allocated buffer. * @@ -208,6 +213,12 @@ public: mpDoc->pClass->getDocumentSize(mpDoc, pWidth, pHeight); } + /// Get the data area (in Calc last row and column). + void getDataArea(long nPart, long* pCol, long* pRow) + { + mpDoc->pClass->getDataArea(mpDoc, nPart, pCol, pRow); + } + /** * Initialize document for rendering. * @@ -598,6 +609,7 @@ public: */ void paintPartTile(unsigned char* pBuffer, const int nPart, + const int nMode, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, @@ -605,7 +617,7 @@ public: const int nTileWidth, const int nTileHeight) { - return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart, + return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart, nMode, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); @@ -863,6 +875,17 @@ public: mpDoc->pClass->sendContentControlEvent(mpDoc, pArguments); } + /** + * Set the timezone of the window with the specified nId. + * + * @param nId a view ID, returned by createView(). + * @param timezone a timezone in the tzfile(5) format (e.g. Pacific/Auckland). + */ + void setViewTimezone(int nId, const char* timezone) + { + mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; @@ -1103,6 +1126,26 @@ public: { mpThis->pClass->setOption(mpThis, pOption, pValue); } + + /** + * Debugging tool for triggering a dump of internal state. + * + * LibreOfficeKit can get into an unhelpful state at run-time when + * in heavy use. This provides a critical tool for inspecting + * relevant internal state. + * + * @param pOption future expansion - string options. + * @param pState - heap allocated, C string containing the state dump. + */ + void dumpState(const char* pOption, char** pState) + { + mpThis->pClass->dumpState(mpThis, pOption, pState); + } + + char* extractRequest(const char* pFilePath) + { + return mpThis->pClass->extractRequest(mpThis, pFilePath); + } }; /// Factory method to create a lok::Office instance. diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 22577a193e52..7e1110089e52 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -803,6 +803,7 @@ typedef enum * Entered a rich text content control: * { * "action": "show", + * "alias": "my alias", // omitted if empty * "rectangles": "1418, 1694, 720, 551; 10291, 1418, 1099, 275" * } * @@ -860,6 +861,58 @@ typedef enum * [<startColumn>, <startRow>, <endColumn>, <endRow>] */ LOK_CALLBACK_PRINT_RANGES = 56, + + /** + * Informs the LibreOfficeKit client that a font specified in the + * document is missing. + * + * This callback is emitted right after the document has been loaded. + * + * Payload example: + * { + * "fontsmissing": [ + * "Some Random Font", + * "Another Font" + * ] + * } + * + * The names are those of the font family. Sadly it is currently + * not possible to know the name of the font style that is + * missing. + * + */ + LOK_CALLBACK_FONTS_MISSING = 57, + + /** + * Insertion, removal, movement, and selection of a media shape. + * The payload is a json with the relevant details. + * + * { + * "action": "insert", + * "id": 123456, + * "url": "file:// ..." + * "x": ..., + * "y": ..., + * } + * + * where the "svg" property is a string containing an svg document + * which is a representation of the pie segment. + */ + LOK_CALLBACK_MEDIA_SHAPE = 58, + + /** + * The document is available to download by the client. + * + * Payload example: + * "file:///tmp/hello-world.pdf" + */ + LOK_CALLBACK_EXPORT_FILE = 59, + + /** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. + */ + LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 62 } LibreOfficeKitCallbackType; @@ -1002,6 +1055,14 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_CONTENT_CONTROL"; case LOK_CALLBACK_PRINT_RANGES: return "LOK_CALLBACK_PRINT_RANGES"; + case LOK_CALLBACK_FONTS_MISSING: + return "LOK_CALLBACK_FONTS_MISSING"; + case LOK_CALLBACK_MEDIA_SHAPE: + return "LOK_CALLBACK_MEDIA_SHAPE"; + case LOK_CALLBACK_EXPORT_FILE: + return "LOK_CALLBACK_EXPORT_FILE"; + case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: + return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h index 83a2a1f750f6..fe9310c46c51 100644 --- a/include/LibreOfficeKit/LibreOfficeKitGtk.h +++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h @@ -15,6 +15,13 @@ #include <LibreOfficeKit/LibreOfficeKit.h> + // Avoid "error C2375: 'foo': redefinition; different linkage" on MSVC +#if defined LOK_DOC_VIEW_IMPLEMENTATION +#define LOK_DOC_VIEW_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define LOK_DOC_VIEW_DLLPUBLIC +#endif + G_BEGIN_DECLS #define LOK_TYPE_DOC_VIEW (lok_doc_view_get_type()) @@ -38,7 +45,7 @@ struct _LOKDocViewClass GtkDrawingAreaClass parent_class; }; -GType lok_doc_view_get_type (void) G_GNUC_CONST; +LOK_DOC_VIEW_DLLPUBLIC GType lok_doc_view_get_type (void) G_GNUC_CONST; /** * lok_doc_view_new: @@ -50,7 +57,7 @@ GType lok_doc_view_get_type (void) G_GNUC * * Returns: (transfer none): The #LOKDocView widget instance. */ -GtkWidget* lok_doc_view_new (const gchar* pPath, +LOK_DOC_VIEW_DLLPUBLIC GtkWidget* lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error); @@ -67,7 +74,7 @@ GtkWidget* lok_doc_view_new (const gchar* * * Returns: (transfer none): The #LOKDocView widget instance. */ -GtkWidget* lok_doc_view_new_from_user_profile (const gchar* pPath, +LOK_DOC_VIEW_DLLPUBLIC GtkWidget* lok_doc_view_new_from_user_profile (const gchar* pPath, const gchar* pUserProfile, GCancellable *cancellable, GError **error); @@ -79,7 +86,7 @@ GtkWidget* lok_doc_view_new_from_user_profile (const gchar* * * Returns: (transfer none): The #LOKDocView widget instance. */ -GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView, const gchar* pRenderingArguments); /** @@ -91,7 +98,7 @@ GtkWidget* lok_doc_view_new_from_widget (LOKDocView* * @callback: * @userdata: */ -void lok_doc_view_open_document (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath, const gchar* pRenderingArguments, GCancellable* cancellable, @@ -106,7 +113,7 @@ void lok_doc_view_open_document (LOKDocView* * * Returns: %TRUE if the document is loaded successfully, %FALSE otherwise */ -gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GError** error); @@ -118,7 +125,7 @@ gboolean lok_doc_view_open_document_finish (LOKDocView* * * Returns: The #LibreOfficeKitDocument instance the widget is currently showing */ -LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView); /** * lok_doc_view_set_zoom: @@ -129,7 +136,7 @@ LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* * existing zoom level. Values outside the range [0.25, 5.0] are clamped into * the nearest allowed value in the interval. */ -void lok_doc_view_set_zoom (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom); /** * lok_doc_view_set_visible_area: @@ -140,7 +147,7 @@ void lok_doc_view_set_zoom (LOKDocView* * to jump the correct length, which depends on the amount of visible height of * the document. */ -void lok_doc_view_set_visible_area (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_visible_area (LOKDocView* pDocView, GdkRectangle* pVisibleArea); /** @@ -149,7 +156,7 @@ void lok_doc_view_set_visible_area (LOKDocView* * * Returns: The current zoom factor value in float for pDocView */ -gfloat lok_doc_view_get_zoom (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC gfloat lok_doc_view_get_zoom (LOKDocView* pDocView); /** * lok_doc_view_get_parts: @@ -158,7 +165,7 @@ gfloat lok_doc_view_get_zoom (LOKDocView* * Returns: Part refers to either individual sheets in a Calc, or slides in Impress, * and has no relevance for Writer. Returns -1 if no document is set currently. */ -gint lok_doc_view_get_parts (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC gint lok_doc_view_get_parts (LOKDocView* pDocView); /** * lok_doc_view_get_part: @@ -166,14 +173,14 @@ gint lok_doc_view_get_parts (LOKDocView* * * Returns: Current part number of the document. Returns -1 if no document is set currently. */ -gint lok_doc_view_get_part (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC gint lok_doc_view_get_part (LOKDocView* pDocView); /** * lok_doc_view_set_part: * @pDocView: The #LOKDocView instance * @nPart: */ -void lok_doc_view_set_part (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_part (LOKDocView* pDocView, int nPart); /** @@ -184,7 +191,7 @@ void lok_doc_view_set_part (LOKDocView* * Returns: Get current part name of loaded document. Returns null if no * document is set, or document has been destroyed using lok_doc_view_destroy_document. */ -gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart); /** @@ -192,14 +199,14 @@ gchar* lok_doc_view_get_part_name (LOKDocView* * @pDocView: The #LOKDocView instance * @nPartMode: */ -void lok_doc_view_set_partmode (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_partmode (LOKDocView* pDocView, int nPartMode); /** * lok_doc_view_reset_view: * @pDocView: The #LOKDocView instance */ -void lok_doc_view_reset_view (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_reset_view (LOKDocView* pDocView); /** * lok_doc_view_set_edit: @@ -208,7 +215,7 @@ void lok_doc_view_reset_view (LOKDocView* * * Sets if the viewer is actually an editor or not. */ -void lok_doc_view_set_edit (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_edit (LOKDocView* pDocView, gboolean bEdit); /** @@ -219,7 +226,7 @@ void lok_doc_view_set_edit (LOKDocView* * * Returns: %TRUE if the given pDocView is in edit mode. */ -gboolean lok_doc_view_get_edit (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC gboolean lok_doc_view_get_edit (LOKDocView* pDocView); /** * lok_doc_view_post_command: @@ -230,7 +237,7 @@ gboolean lok_doc_view_get_edit (LOKDocView* * * Posts the .uno: command to the LibreOfficeKit. */ -void lok_doc_view_post_command (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_post_command (LOKDocView* pDocView, const gchar* pCommand, const gchar* pArguments, gboolean bNotifyWhenFinished); @@ -245,7 +252,7 @@ void lok_doc_view_post_command (LOKDocView* * * Returns: A json mapping of the possible values for the given command */ -gchar * lok_doc_view_get_command_values (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gchar * lok_doc_view_get_command_values (LOKDocView* pDocView, const gchar* pCommand); /** @@ -257,7 +264,7 @@ gchar * lok_doc_view_get_command_values (LOKDocView* * Highlights the next matching text in the view. `search-not-found` signal will * be emitted when no search is found */ -void lok_doc_view_find_next (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_find_next (LOKDocView* pDocView, const gchar* pText, gboolean bHighlightAll); @@ -270,7 +277,7 @@ void lok_doc_view_find_next (LOKDocView* * Highlights the previous matching text in the view. `search-not-found` signal * will be emitted when no search is found */ -void lok_doc_view_find_prev (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_find_prev (LOKDocView* pDocView, const gchar* pText, gboolean bHighlightAll); @@ -282,7 +289,7 @@ void lok_doc_view_find_prev (LOKDocView* * Highlights all matching texts in the view. `search-not-found` signal * will be emitted when no search is found */ -void lok_doc_view_highlight_all (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_highlight_all (LOKDocView* pDocView, const gchar* pText); /** @@ -295,7 +302,7 @@ void lok_doc_view_highlight_all (LOKDocView* * Returns: Selected text. The caller must free the returned buffer after * use. Returns null if no document is set. */ -gchar* lok_doc_view_copy_selection (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gchar* lok_doc_view_copy_selection (LOKDocView* pDocView, const gchar* pMimeType, gchar** pUsedMimeType); @@ -310,7 +317,7 @@ gchar* lok_doc_view_copy_selection (LOKDocView* * * Returns: if pData was pasted successfully. */ -gboolean lok_doc_view_paste (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gboolean lok_doc_view_paste (LOKDocView* pDocView, const gchar* pMimeType, const gchar* pData, gsize nSize); @@ -323,7 +330,7 @@ gboolean lok_doc_view_paste (LOKDocView* * * Set the password for password protected documents */ -void lok_doc_view_set_document_password (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_set_document_password (LOKDocView* pDocView, const gchar* pURL, const gchar* pPassword); @@ -341,7 +348,7 @@ void lok_doc_view_set_document_password (LOKDocView* * "ProductExtension": ".0.0.alpha0", * "BuildId": "<full 40 char git hash>"} */ -gchar* lok_doc_view_get_version_info (LOKDocView* pDocView); +LOK_DOC_VIEW_DLLPUBLIC gchar* lok_doc_view_get_version_info (LOKDocView* pDocView); /** * lok_doc_view_pixel_to_twip: @@ -352,7 +359,7 @@ gchar* lok_doc_view_get_version_info (LOKDocView* * * Returns: The corresponding value in twips */ -gfloat lok_doc_view_pixel_to_twip (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gfloat lok_doc_view_pixel_to_twip (LOKDocView* pDocView, float fInput); /** @@ -364,7 +371,7 @@ gfloat lok_doc_view_pixel_to_twip (LOKDocView* * * Returns: The corresponding value in pixels */ -gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView, +LOK_DOC_VIEW_DLLPUBLIC gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView, float fInput); /** @@ -372,7 +379,7 @@ gfloat lok_doc_view_twip_to_pixel (LOKDocView* * @pDocView: The #LOKDocView instance * @pArguments: (nullable) (allow-none): see lok::Document::sendContentControlEvent() for the details. */ -void lok_doc_view_send_content_control_event(LOKDocView* pDocView, const gchar* pArguments); +LOK_DOC_VIEW_DLLPUBLIC void lok_doc_view_send_content_control_event(LOKDocView* pDocView, const gchar* pArguments); G_END_DECLS diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h index 5bbb722b5b18..2ceeab052e33 100644 --- a/include/LibreOfficeKit/LibreOfficeKitInit.h +++ b/include/LibreOfficeKit/LibreOfficeKitInit.h @@ -54,6 +54,8 @@ #define SEPARATOR '\\' #define UNOPATH "\\..\\URE\\bin" + #undef DELETE + #endif #ifdef __cplusplus diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx index ab9418607cb7..9578974aaa99 100644 --- a/include/avmedia/mediaitem.hxx +++ b/include/avmedia/mediaitem.hxx @@ -32,6 +32,7 @@ namespace com::sun::star::embed { class XStorage; } namespace com::sun::star::frame { class XModel; } namespace com::sun::star::io { class XInputStream; } namespace com::sun::star::io { class XStream; } +namespace com::sun::star::text { struct GraphicCrop; } class Graphic; enum class AVMediaSetMask @@ -47,11 +48,12 @@ enum class AVMediaSetMask URL = 0x080, MIME_TYPE = 0x100, GRAPHIC = 0x200, - ALL = 0x3ff, + CROP = 0x400, + ALL = 0x7ff, }; namespace o3tl { - template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x3ff> {}; + template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x7ff> {}; } @@ -119,6 +121,8 @@ public: OUString getMimeType() const; bool setGraphic(const Graphic& rGraphic); const Graphic & getGraphic() const; + bool setCrop(const css::text::GraphicCrop& rCrop); + const css::text::GraphicCrop& getCrop() const; const OUString& getTempURL() const; const OUString& getReferer() const; diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index c53ddff68373..5908c01e46e1 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -86,6 +86,7 @@ public: explicit inline Any(rtl::OUStringConcat<T1, T2> && value); template<typename T1, typename T2> explicit Any(rtl::OUStringConcat<T1, T2> const &) = delete; + template <std::size_t N> explicit inline Any(const rtl::OUStringLiteral<N>& value); #endif /** Copy constructor: Sets value of the given any. diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 28d45f1ec21d..2a27e432ae77 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -84,6 +84,8 @@ template<typename T1, typename T2> Any::Any(rtl::OUStringConcat<T1, T2> && value): Any(rtl::OUString(std::move(value))) {} +template <std::size_t N> +Any::Any(const rtl::OUStringLiteral<N>& value): Any(rtl::OUString(value)) {} #endif inline Any::Any( const Any & rAny ) diff --git a/include/comphelper/SelectionMultiplex.hxx b/include/comphelper/SelectionMultiplex.hxx index 00ba7f955b09..328a96e9370a 100644 --- a/include/comphelper/SelectionMultiplex.hxx +++ b/include/comphelper/SelectionMultiplex.hxx @@ -81,6 +81,8 @@ namespace comphelper void unlock(); /// get the lock count sal_Int32 locked() const { return m_nLockCount; } + + void dispose(); }; diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index 66784e8e4892..4cfdb70a09d3 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -102,6 +102,9 @@ COMPHELPER_DLLPUBLIC const LanguageTag& getLanguageTag(); /// If the language name should be used for this LOK instance. COMPHELPER_DLLPUBLIC bool isAllowlistedLanguage(const OUString& lang); +/// Update the current LOK's timezone. +COMPHELPER_DLLPUBLIC void setTimezone(bool isSet, const OUString& rTimezone); + // Status indicator handling. Even if in theory there could be several status indicators active at // the same time, in practice there is only one at a time, so we don't handle any identification of // status indicator in this API. diff --git a/include/docmodel/dllapi.h b/include/docmodel/dllapi.h new file mode 100644 index 000000000000..f90b7cc4c08e --- /dev/null +++ b/include/docmodel/dllapi.h @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/types.h> + +#if defined(DOCMODEL_DLLIMPLEMENTATION) +#define DOCMODEL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define DOCMODEL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define DOCMODEL_DLLPRIVATE SAL_DLLPRIVATE + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/theme/ThemeColor.hxx b/include/docmodel/theme/ThemeColor.hxx new file mode 100644 index 000000000000..2069594713d8 --- /dev/null +++ b/include/docmodel/theme/ThemeColor.hxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <docmodel/dllapi.h> +#include <vector> +#include <docmodel/theme/ThemeColorType.hxx> +#include <tools/color.hxx> + +namespace model +{ +/** Color transfomation type */ +enum class TransformationType +{ + Undefined, + Red, + RedMod, + RedOff, + Green, + GreenMod, + GreenOff, + Blue, + BlueMod, + BlueOff, + Alpha, + AlphaMod, + AlphaOff, + Hue, + HueMod, + HueOff, + Sat, + SatMod, + SatOff, + Lum, + LumMod, + LumOff, + Shade, + Tint, + Gray, + Comp, + Inv, + Gamma, + InvGamma +}; + +/** Definition of a color transformation. + * + * This just defines how a color should be transformed (changed). The + * type defines what kind of transformation should occur and the value + * defines by how much. + */ +struct DOCMODEL_DLLPUBLIC Transformation +{ + TransformationType meType = TransformationType::Undefined; + sal_Int16 mnValue = 0; /// percentage value -10000 to +10000 + + bool operator==(const Transformation& rTransformation) const + { + return meType == rTransformation.meType && mnValue == rTransformation.mnValue; + } +}; + +/** Definition of a theme color + * + * A theme color is defined by the type of theme color and a set of + * transformations that in addition manipulate the resulting color + * (i.e. tints, shades). + */ +class DOCMODEL_DLLPUBLIC ThemeColor +{ + ThemeColorType meType = ThemeColorType::Unknown; + std::vector<Transformation> maTransformations; + +public: + ThemeColor() = default; + + ThemeColorType getType() const { return meType; } + + void setType(ThemeColorType eType) { meType = eType; } + + void clearTransformations() { maTransformations.clear(); } + + void addTransformation(Transformation const& rTransform) + { + maTransformations.push_back(rTransform); + } + + void removeTransformations(TransformationType eType) + { + maTransformations.erase(std::remove_if(maTransformations.begin(), maTransformations.end(), + [eType](Transformation const& rTransform) { + return rTransform.meType == eType; + }), + maTransformations.end()); + } + + std::vector<Transformation> const& getTransformations() const { return maTransformations; } + + /** Applies the defined trasformations to the input color */ + Color applyTransformations(Color const& rColor) const + { + Color aColor(rColor); + + for (auto const& rTransform : maTransformations) + { + switch (rTransform.meType) + { + case TransformationType::Tint: + aColor.ApplyTintOrShade(rTransform.mnValue); + break; + case TransformationType::Shade: + aColor.ApplyTintOrShade(-rTransform.mnValue); + break; + case TransformationType::LumMod: + aColor.ApplyLumModOff(rTransform.mnValue, 0); + break; + case TransformationType::LumOff: + aColor.ApplyLumModOff(10000, rTransform.mnValue); + break; + default: + break; + } + } + return aColor; + } + + bool operator==(const ThemeColor& rThemeColor) const + { + return meType == rThemeColor.meType + && maTransformations.size() == rThemeColor.maTransformations.size() + && std::equal(maTransformations.begin(), maTransformations.end(), + rThemeColor.maTransformations.begin()); + } +}; + +} // end of namespace model + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/theme/ThemeColorType.hxx b/include/docmodel/theme/ThemeColorType.hxx new file mode 100644 index 000000000000..a8ed9a56a6dc --- /dev/null +++ b/include/docmodel/theme/ThemeColorType.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +namespace model +{ +/// Offsets into the color list of a theme. +enum class ThemeColorType : sal_Int32 +{ + Unknown = -1, + Dark1 = 0, + Light1 = 1, + Dark2 = 2, + Light2 = 3, + Accent1 = 4, + Accent2 = 5, + Accent3 = 6, + Accent4 = 7, + Accent5 = 8, + Accent6 = 9, + Hyperlink = 10, + FollowedHyperlink = 11, + LAST = FollowedHyperlink +}; + +constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) +{ + if (nIndex < 0 || nIndex > 11) + return ThemeColorType::Unknown; + return static_cast<ThemeColorType>(nIndex); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/uno/UnoThemeColor.hxx b/include/docmodel/uno/UnoThemeColor.hxx new file mode 100644 index 000000000000..50063ab981dd --- /dev/null +++ b/include/docmodel/uno/UnoThemeColor.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <comphelper/servicehelper.hxx> + +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/util/XThemeColor.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <utility> +#include <docmodel/dllapi.h> +#include <docmodel/theme/ThemeColor.hxx> + +class DOCMODEL_DLLPUBLIC UnoThemeColor final + : public cppu::WeakImplHelper<css::util::XThemeColor, css::lang::XUnoTunnel> +{ +private: + model::ThemeColor maThemeColor; + +public: + UnoThemeColor(model::ThemeColor const& rThemeColor) + : maThemeColor(rThemeColor) + { + } + + model::ThemeColor const& getThemeColor() const { return maThemeColor; } + + // XThemeColor + sal_Int16 SAL_CALL getType() override; + + UNO3_GETIMPLEMENTATION_DECL(UnoThemeColor) +}; + +namespace model::theme +{ +DOCMODEL_DLLPUBLIC css::uno::Reference<css::util::XThemeColor> +createXThemeColor(model::ThemeColor const& rThemeColor); + +DOCMODEL_DLLPUBLIC void +setFromXThemeColor(model::ThemeColor& rThemeColor, + css::uno::Reference<css::util::XThemeColor> const& rxThemeColor); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index 41d2365cc628..800015f26157 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -121,6 +121,7 @@ public: /// data access const basegfx::B2DHomMatrix& getObjectTransformation() const; const basegfx::B2DHomMatrix& getViewTransformation() const; + /// Empty viewport means everything is visible. const basegfx::B2DRange& getViewport() const; double getViewTime() const; const css::uno::Reference<css::drawing::XDrawPage>& getVisualizedPage() const; @@ -130,6 +131,7 @@ public: const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const; /// On-demand prepared Viewport in discrete units for convenience + /// Empty viewport means everything is visible. const basegfx::B2DRange& getDiscreteViewport() const; /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 036463c85079..1a841c32d6a1 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -43,6 +43,7 @@ enum SvxGraphicPosition class EDITENG_DLLPUBLIC SvxBrushItem final : public SfxPoolItem { Color aColor; + Color aFilterColor; sal_Int32 nShadingValue; mutable std::unique_ptr<GraphicObject> xGraphicObject; sal_Int8 nGraphicTransparency; //contains a percentage value which is @@ -90,6 +91,10 @@ public: Color& GetColor() { return aColor; } void SetColor( const Color& rCol) { aColor = rCol; } + const Color& GetFiltColor() const { return aFilterColor; } + Color& GetFiltColor() { return aFilterColor; } + void SetFiltColor( const Color& rCol) { aFilterColor = rCol; } + SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; } sal_Int32 GetShadingValue() const { return nShadingValue; } diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index cd223d2777bc..d4090eb9e7eb 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -22,6 +22,7 @@ #include <svl/poolitem.hxx> #include <tools/color.hxx> #include <editeng/editengdllapi.h> +#include <docmodel/theme/ThemeColor.hxx> #define VERSION_USEAUTOCOLOR 1 @@ -31,12 +32,7 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem { private: Color mColor; - sal_Int16 maThemeIndex; - sal_Int16 maTintShade; - /// Luminance Modulation: 100th percentage, defaults to 100%. - sal_Int16 mnLumMod; - /// Luminance Offset: 100th percentage, defaults to 0%. - sal_Int16 mnLumOff; + model::ThemeColor maThemeColor; public: static SfxPoolItem* CreateDefault(); @@ -63,25 +59,9 @@ public: } void SetValue(const Color& rNewColor); - sal_Int16 GetThemeIndex() const - { - return maThemeIndex; - } - - void SetThemeIndex(sal_Int16 nIndex) - { - maThemeIndex = nIndex; - } + model::ThemeColor& GetThemeColor() { return maThemeColor; } - sal_Int16 GetTintOrShade() const - { - return maTintShade; - } - - void SetTintOrShade(sal_Int16 nTintOrShade) - { - maTintShade = nTintOrShade; - } + const model::ThemeColor& GetThemeColor() const { return maThemeColor; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 560f3be1a83a..55e08f694c1b 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// MyEDITENG, due to exported EditEng + #ifndef INCLUDED_EDITENG_EDITENG_HXX #define INCLUDED_EDITENG_EDITENG_HXX @@ -40,6 +40,7 @@ #include <tools/lineend.hxx> #include <tools/degree.hxx> #include <tools/long.hxx> +#include <basegfx/tuple/b2dtuple.hxx> #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> @@ -402,6 +403,8 @@ public: bool IsFlatMode() const; void SetFlatMode( bool bFlat ); + void SetSingleLine( bool bValue ); + void SetControlWord( EEControlBits nWord ); EEControlBits GetControlWord() const; @@ -414,8 +417,14 @@ public: void QuickDelete( const ESelection& rSel ); void QuickMarkToBeRepainted( sal_Int32 nPara ); - void SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY ); - void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; + void setGlobalScale(double fFontScaleX, double fFontScaleY, double fSpacingScaleX, double fSpacingScaleY); + + void getGlobalSpacingScale(double& rX, double& rY) const; + basegfx::B2DTuple getGlobalSpacingScale() const; + void getGlobalFontScale(double& rX, double& rY) const; + basegfx::B2DTuple getGlobalFontScale() const; + + void setRoundFontSizeToPt(bool bRound) const; void SetEditTextObjectPool( SfxItemPool* pPool ); SfxItemPool* GetEditTextObjectPool() const; diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx index e23007899267..f05ff8acf82f 100644 --- a/include/editeng/editstat.hxx +++ b/include/editeng/editstat.hxx @@ -49,10 +49,11 @@ enum class EEControlBits AUTOPAGESIZE = (AUTOPAGESIZEX | AUTOPAGESIZEY), FORMAT100 = 0x01000000, // Always format to 100% ULSPACESUMMATION = 0x02000000, // MS Compat: sum SA and SB, not maximum value + SINGLELINE = 0x04000000, // One line for all text }; namespace o3tl { - template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x037afff9> {}; + template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x07ffffff> {}; } enum class EVControlBits diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 1a9e2ed8afc9..005b02edf667 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -87,6 +87,16 @@ enum class ScrollRangeCheck PaperWidthTextSize = 2, // VisArea must be within paper width, Text Size }; +enum class LOKSpecialFlags { + NONE = 0x0000, + LayoutRTL = 0x0001, +}; + +namespace o3tl +{ + template<> struct typed_flags<LOKSpecialFlags> : is_typed_flags<LOKSpecialFlags, 0x77> {}; +} + // Helper class that allows to set a callback at the EditView. When // set, Invalidates and repaints are suppressed at the EditView, but // EditViewInvalidate() will be triggered to allow the consumer to @@ -162,6 +172,10 @@ private: EditView( const EditView& ) = delete; EditView& operator=( const EditView& ) = delete; + // counts how many characters take unfolded fields + // bCanOverflow - count field length without trim to the selected pos + sal_Int32 countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPo, bool bCanOverflow) const; + public: EditView( EditEngine* pEng, vcl::Window* pWindow ); ~EditView(); @@ -318,6 +332,10 @@ public: /// Select and return the field at the current cursor position const SvxFieldData* GetFieldAtCursor() const; void SelectFieldAtCursor(); + /// Converts position in paragraph to logical position without unfolding fields + sal_Int32 GetPosNoField(sal_Int32 nPara, sal_Int32 nPos) const; + /// Converts logical position in paragraph to position with unfolded fields + sal_Int32 GetPosWithField(sal_Int32 nPara, sal_Int32 nPos) const; void SetInvalidateMore( sal_uInt16 nPixel ); sal_uInt16 GetInvalidateMore() const; @@ -371,6 +389,8 @@ public: tools::Rectangle GetLOKSpecialVisArea() const; bool HasLOKSpecialPositioning() const; + void SetLOKSpecialFlags(LOKSpecialFlags eFlags); + void SuppressLOKMessages(bool bSet); bool IsSuppressLOKMessages() const; diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h index 1b50ab467229..51fbdeb99f00 100644 --- a/include/editeng/memberids.h +++ b/include/editeng/memberids.h @@ -185,6 +185,7 @@ #define MID_COLOR_TINT_OR_SHADE 5 #define MID_COLOR_LUM_MOD 6 #define MID_COLOR_LUM_OFF 7 +#define MID_COLOR_THEME_REFERENCE 8 #endif diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 87fabb4ee45e..be51c08d7fbf 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -370,9 +370,10 @@ class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const = 0; - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; + virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual ViewShellId GetViewShellId() const = 0; virtual ViewShellDocId GetDocId() const = 0; /// Wrapper around SfxLokHelper::notifyOtherViews(). @@ -924,8 +925,10 @@ public: bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ); bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBulletPos ); - void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); - void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; + void setGlobalScale(double rFontX = 100.0, double rFontY = 100.0, double rSpacingX = 100.0, double rSpacingY = 100.0); + void getGlobalScale(double& rFontX, double& rFontY, double& rSpacingX, double& rSpacingY) const; + void setRoundFontSizeToPt(bool bRound) const; + void EraseVirtualDevice(); bool ShouldCreateBigTextObject() const; diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx index f09afa09d487..d47a2337e247 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -24,6 +24,7 @@ #define UNO_NAME_CHAR_COLOR "CharColor" #define UNO_NAME_CHAR_COLOR_THEME "CharColorTheme" #define UNO_NAME_CHAR_COLOR_TINT_OR_SHADE "CharColorTintOrShade" +#define UNO_NAME_CHAR_COLOR_THEME_REFERENCE "CharColorThemeReference" #define UNO_NAME_CHAR_HEIGHT "CharHeight" #define UNO_NAME_CHAR_POSTURE "CharPosture" #define UNO_NAME_CHAR_SHADOWED "CharShadowed" @@ -32,6 +33,10 @@ #define UNO_NAME_FILLSTYLE "FillStyle" #define UNO_NAME_FILLCOLOR "FillColor" +#define UNO_NAME_FILLCOLOR_THEME "FillColorTheme" +#define UNO_NAME_FILLCOLOR_LUM_MOD "FillColorLumMod" +#define UNO_NAME_FILLCOLOR_LUM_OFF "FillColorLumOff" +#define UNO_NAME_FILLCOLOR_THEME_REFERENCE "FillColorThemeReference" #define UNO_NAME_FILLGRADIENT "FillGradient" #define UNO_NAME_FILLGRADIENTNAME "FillGradientName" #define UNO_NAME_FILLHATCH "FillHatch" @@ -72,6 +77,7 @@ #define UNO_NAME_LINEDASH "LineDash" #define UNO_NAME_LINEWIDTH "LineWidth" #define UNO_NAME_LINECOLOR "LineColor" +#define UNO_NAME_LINECOLOR_THEME_REFERENCE "LineColorThemeReference" #define UNO_NAME_LINEJOINT "LineJoint" #define UNO_NAME_LINESTART "LineStart" #define UNO_NAME_LINEEND "LineEnd" @@ -118,6 +124,7 @@ #define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing" #define UNO_NAME_TEXT_WORDWRAP "TextWordWrap" #define UNO_NAME_TEXT_CHAINNEXTNAME "TextChainNextName" +#define UNO_NAME_TEXT_CLIPVERTOVERFLOW u"TextClipVerticalOverflow" #define UNO_NAME_MEASUREKIND "MeasureKind" #define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition" @@ -331,6 +338,7 @@ #define UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE "CharColorTintOrShade" #define UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD "CharColorLumMod" #define UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF "CharColorLumOff" +#define UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE "CharColorThemeReference" #define UNO_NAME_EDIT_CHAR_TRANSPARENCE "CharTransparence" #define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut" #define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout" diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index bd41ffd16940..65256e12c489 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -91,6 +91,7 @@ struct SfxItemPropertyMapEntry; { u"" UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_TINT_OR_SHADE }, \ { u"" UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD }, \ { u"" UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF }, \ + { u"" UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, EE_CHAR_COLOR, ::cppu::UnoType<css::uno::XInterface>::get(), 0, MID_COLOR_THEME_REFERENCE }, \ { u"CharBackColor", EE_CHAR_BKGCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, \ { u"CharBackTransparent", EE_CHAR_BKGCOLOR, ::cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT }, \ { u"" UNO_NAME_EDIT_CHAR_ESCAPEMENT, EE_CHAR_ESCAPEMENT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_ESC }, \ diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index 6b373ff44e15..e3c44e934a11 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -429,6 +429,11 @@ public: example OOXML. */ bool IsRecalcModeMustAfterImport() const { return (nMode & ScRecalcMode::EMask) <= ScRecalcMode::ONLOAD_ONCE; } + void ClearRecalcModeMustAfterImport() + { + if (IsRecalcModeMustAfterImport() && !IsRecalcModeAlways()) + SetExclusiveRecalcModeNormal(); + } /** Get OpCode of the most outer function */ inline OpCode GetOuterFuncOpCode() const; diff --git a/include/linguistic/translate.hxx b/include/linguistic/translate.hxx new file mode 100644 index 000000000000..985930c74d83 --- /dev/null +++ b/include/linguistic/translate.hxx @@ -0,0 +1,9 @@ +#pragma once +#include <linguistic/lngdllapi.h> +#include <rtl/string.hxx> + +namespace linguistic +{ +LNG_DLLPUBLIC OString Translate(const OString& rTargetLang, const OString& rAPIUrl, + const OString& rAuthKey, const OString& rData); +} // namespace diff --git a/include/oox/drawingml/ThemeFilterBase.hxx b/include/oox/drawingml/ThemeFilterBase.hxx new file mode 100644 index 000000000000..f9bbef1de11e --- /dev/null +++ b/include/oox/drawingml/ThemeFilterBase.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <memory> +#include <oox/dllapi.h> +#include <oox/core/xmlfilterbase.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <rtl/ref.hxx> + +namespace oox::drawingml +{ +class OOX_DLLPUBLIC ThemeFilterBase final : public core::XmlFilterBase +{ +public: + typedef rtl::Reference<ThemeFilterBase> Pointer_t; + + explicit ThemeFilterBase(css::uno::Reference<css::uno::XComponentContext> const& rxContext); + + virtual ~ThemeFilterBase() override; + + /** Has to be implemented by each filter, returns the current theme. */ + virtual const oox::drawingml::Theme* getCurrentTheme() const override; + + void setCurrentTheme(const oox::drawingml::ThemePtr& pTheme); + + /** Has to be implemented by each filter to return the collection of VML shapes. */ + virtual oox::vml::Drawing* getVmlDrawing() override; + + /** Has to be implemented by each filter to return TableStyles. */ + virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override; + + virtual oox::drawingml::chart::ChartConverter* getChartConverter() override; + + virtual oox::ole::VbaProject* implCreateVbaProject() const override; + + virtual bool importDocument() override { return true; } + virtual bool exportDocument() override { return false; } + +private: + virtual OUString SAL_CALL getImplementationName() override; + + oox::drawingml::ThemePtr mpTheme; +}; + +} // namespace oox::drawingml + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx index 01711fe8bfbd..fd7662511a88 100644 --- a/include/oox/drawingml/clrscheme.hxx +++ b/include/oox/drawingml/clrscheme.hxx @@ -30,13 +30,14 @@ #include <sal/types.h> #include <rtl/ustring.hxx> #include <tools/color.hxx> +#include <svx/ColorSets.hxx> namespace oox::drawingml { enum PredefinedClrSchemeId { - //dk1, - //lt1, - dk2 = 0, + dk1 = 0, + lt1, + dk2, lt2, accent1, accent2, @@ -51,8 +52,8 @@ enum PredefinedClrSchemeId { static std::map<PredefinedClrSchemeId, OUString> PredefinedClrNames = { - //{ dk1, "dk1" }, - //{ lt1, "lt1" }, + { dk1, "dk1" }, + { lt1, "lt1" }, { dk2, "dk2" }, { lt2, "lt2" }, { accent1, "accent1" }, @@ -94,6 +95,8 @@ public: const OUString& GetName() const { return maName; } void ToAny(css::uno::Any& rVal) const; + void fill(svx::ColorSet& rColorSet) const; + }; } diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index c0dd8d67a31c..b28c926986ca 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -99,9 +99,9 @@ public: /** Returns the scheme name from the a:schemeClr element for interoperability purposes */ const OUString& getSchemeColorName() const { return msSchemeName; } sal_Int16 getSchemeColorIndex() const; - sal_Int16 getTintOrShade(); - sal_Int16 getLumMod(); - sal_Int16 getLumOff(); + sal_Int16 getTintOrShade() const; + sal_Int16 getLumMod() const; + sal_Int16 getLumOff() const; /** Returns the unaltered list of transformations for interoperability purposes */ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;} diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 4350b8d033a7..48b3aaa3d045 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX #include <memory> +#include <optional> #include <string_view> #include <com/sun/star/awt/Point.hpp> @@ -145,6 +146,8 @@ OOX_DLLPUBLIC const char* GetTextVerticalAdjust( css::drawing::TextVerticalAdjus // Converts a Hatch object to an ooxml pattern. const char* GetHatchPattern( const css::drawing::Hatch& rHatch ); +/// Converts nRotate angle to TextVerticalType string appearing in ooxml +std::optional<OString> GetTextVerticalType(sal_Int32 nRotateAngle); // CT_IndexRange struct IndexRange { diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 6222a4264451..e084f6f0b0fb 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -35,8 +35,12 @@ namespace com::sun::star { namespace drawing { class XDrawPage; } namespace xml::dom { class XDocument; } } +namespace svx { + class Theme; +} -namespace oox::drawingml { +namespace oox::drawingml +{ struct EffectProperties; struct FillProperties; @@ -57,8 +61,9 @@ class TextFont; class OOX_DLLPUBLIC Theme { public: - void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; } - void setThemeName(const OUString& rThemeName) { maThemeName = rThemeName; } + void setThemeName(OUString const& rName) { maThemeName = rName; } + void setFormatSchemeName(OUString const& rName) { maFormatSchemeName = rName; } + void setFontSchemeName(OUString const& rName) { maFontSchemeName = rName; } ClrScheme& getClrScheme() { return maClrScheme; } const ClrScheme& getClrScheme() const { return maClrScheme; } @@ -81,6 +86,10 @@ public: FontScheme& getFontScheme() { return maFontScheme; } const FontScheme& getFontScheme() const { return maFontScheme; } + + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& getSupplementalFontMap() { return maSupplementalFontMap; } + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> const& getSupplementalFontMap() const { return maSupplementalFontMap; } + /** Returns theme font properties by scheme type (major/minor). */ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const; /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */ @@ -98,17 +107,20 @@ public: const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; } void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; } + std::unique_ptr<svx::Theme> createSvxTheme() const; void addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const; private: - OUString maStyleName; OUString maThemeName; + OUString maFontSchemeName; + OUString maFormatSchemeName; ClrScheme maClrScheme; FillStyleList maFillStyleList; FillStyleList maBgFillStyleList; LineStyleList maLineStyleList; EffectStyleList maEffectStyleList; FontScheme maFontScheme; + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> maSupplementalFontMap; Shape maSpDef; Shape maLnDef; Shape maTxDef; diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx index e433c350de80..918a3eb861b9 100644 --- a/include/oox/drawingml/themefragmenthandler.hxx +++ b/include/oox/drawingml/themefragmenthandler.hxx @@ -44,6 +44,7 @@ public: virtual ~ThemeFragmentHandler() override; virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + void onStartElement(const AttributeList& rAttribs) override; private: Theme& mrTheme; diff --git a/include/oox/export/ThemeExport.hxx b/include/oox/export/ThemeExport.hxx new file mode 100644 index 000000000000..02f222cadafe --- /dev/null +++ b/include/oox/export/ThemeExport.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/config.h> +#include <oox/dllapi.h> +#include <oox/core/xmlfilterbase.hxx> +#include <svx/ColorSets.hxx> + +namespace oox +{ +class OOX_DLLPUBLIC ThemeExport +{ +private: + oox::core::XmlFilterBase* mpFilterBase; + +public: + ThemeExport(oox::core::XmlFilterBase* pFilterBase); + + void write(OUString const& rPath, svx::Theme const& rTheme); + +private: + static bool writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme const& rTheme); + static bool writeFontScheme(sax_fastparser::FSHelperPtr pFS, + svx::FontScheme const& rFontScheme); + static bool writeFormatScheme(sax_fastparser::FSHelperPtr pFS); +}; + +} // end namespace oox + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index b15bf9d81aba..7c79896a29b8 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -21,7 +21,9 @@ #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX #include <map> +#include <stack> #include <string_view> +#include <unordered_map> #include <vector> #include <com/sun/star/beans/PropertyState.hpp> @@ -41,6 +43,7 @@ #include <sax/fshelper.hxx> #include <svx/msdffdef.hxx> #include <vcl/checksum.hxx> +#include <vcl/graph.hxx> #include <tools/gen.hxx> #include <vcl/mapmod.hxx> #include <svx/EnhancedCustomShape2d.hxx> @@ -149,6 +152,7 @@ private: static std::map<OUString, OUString> maWdpCache; static sal_Int32 mnDrawingMLCount; static sal_Int32 mnVmlCount; + static std::stack<std::unordered_map<BitmapChecksum, OUString>> maExportGraphics; /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). DocumentType meDocumentType; @@ -200,12 +204,14 @@ protected: void WriteGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); void WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); void WriteCustomGeometryPoint(const css::drawing::EnhancedCustomShapeParameterPair& rParamPair, - const EnhancedCustomShape2d& rCustomShape2d); + const EnhancedCustomShape2d& rCustomShape2d, + const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); bool WriteCustomGeometrySegment( const sal_Int16 eCommand, const sal_Int32 nCount, const css::uno::Sequence<css::drawing::EnhancedCustomShapeParameterPair>& rPairs, sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& rbCurrentValid, - const EnhancedCustomShape2d& rCustomShape2d); + const EnhancedCustomShape2d& rCustomShape2d, + const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); public: DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr ) @@ -230,6 +236,7 @@ public: void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); bool WriteCharColor(const css::uno::Reference<css::beans::XPropertySet>& xPropertySet); + bool WriteSchemeColor(OUString const& rPropertyName, const css::uno::Reference<css::beans::XPropertySet>& xPropertySet); void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); @@ -341,9 +348,11 @@ public: sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName); static void ResetCounters(); - static void ResetMlCounters(); + static void PushExportGraphics(); + static void PopExportGraphics(); + static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; } static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; } diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index efb3de7779cf..8d00f614728d 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -103,6 +103,9 @@ public: /** Returns the string value of the specified attribute. */ OptValue< OUString > getString( sal_Int32 nAttrToken ) const; + /** Returns the string value of the specified attribute, returns an empty string if attribute not present. */ + OUString getStringDefaulted( sal_Int32 nAttrToken ) const; + /** Returns the string value of the specified attribute. All characters in the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const; diff --git a/include/rtl/xmlencode.hxx b/include/rtl/xmlencode.hxx new file mode 100644 index 000000000000..487c4ee94749 --- /dev/null +++ b/include/rtl/xmlencode.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/. + */ + +#ifndef INCLUDED_RTL_XMLENCODE_HXX +#define INCLUDED_RTL_XMLENCODE_HXX + +#include "rtl/ustring.hxx" + +namespace rtl +{ +inline OUString encodeForXml(std::u16string_view rStr) +{ + // encode conforming xml: + sal_Int32 len = rStr.length(); + OUStringBuffer buf; + for (sal_Int32 pos = 0; pos < len; ++pos) + { + sal_Unicode c = rStr[pos]; + switch (c) + { + case '<': + buf.append("<"); + break; + case '>': + buf.append(">"); + break; + case '&': + buf.append("&"); + break; + case '\'': + buf.append("'"); + break; + case '\"': + buf.append("""); + break; + default: + buf.append(c); + break; + } + } + + return buf.makeStringAndClear(); +} + +} /* Namespace */ + +#endif // INCLUDED_RTL_XMLENCODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 452280782067..4ac958d882fc 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -89,7 +89,9 @@ public: void add( sal_Int32 nToken, const char* pValue ); void add( sal_Int32 nToken, const char* pValue, size_t nValueLength ); void add( sal_Int32 nToken, const OString& rValue ); + void add( sal_Int32 nToken, std::u16string_view sValue ); // Converts to UTF-8 void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue ); + void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::u16string_view sValue ); // note: rQName is *namespace-prefixed* void addUnknown( const OUString& rNamespaceURL, const OString& rQName, const OString& value ); void addUnknown( const OString& rName, const OString& value ); diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index 79f0e1a0f30f..2d01066a1453 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -50,6 +50,9 @@ public: ~FastSerializerHelper(); + void startDocument(); + void endDocument(); + /// Start an element. After the first argument there can be a number of (attribute, value) pairs. template<typename... Args> void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, Args &&... args) @@ -156,7 +159,7 @@ private: void pushAttributeValue( sal_Int32 attribute, const char* value ); void pushAttributeValue( sal_Int32 attribute, const OString& value ); - FastSaxSerializer* mpSerializer; + std::unique_ptr<FastSaxSerializer> mpSerializer; }; typedef std::shared_ptr< FastSerializerHelper > FSHelperPtr; diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx index 32522ff63f47..8cc2839229cb 100644 --- a/include/sfx2/AccessibilityIssue.hxx +++ b/include/sfx2/AccessibilityIssue.hxx @@ -23,12 +23,19 @@ enum class AccessibilityIssueID UNSPECIFIED, // TODO: remove - temporary DOCUMENT_TITLE, DOCUMENT_LANGUAGE, + DOCUMENT_BACKGROUND, STYLE_LANGUAGE, NO_ALT_OLE, NO_ALT_GRAPHIC, NO_ALT_SHAPE, TABLE_MERGE_SPLIT, TEXT_FORMATTING, + TABLE_FORMATTING, + HYPERLINK_IS_TEXT, + HYPERLINK_SHORT, + FAKE_FOOTNOTE, + FAKE_CAPTION, + MANUAL_NUMBERING }; class SFX2_DLLPUBLIC AccessibilityIssue @@ -53,6 +60,8 @@ public: AccessibilityIssueCollection() = default; std::vector<std::shared_ptr<AccessibilityIssue>>& getIssues(); + + void clear(); }; } // end sfx namespace diff --git a/include/sfx2/LokControlHandler.hxx b/include/sfx2/LokControlHandler.hxx index cb48e9eb355b..753585ac65c0 100644 --- a/include/sfx2/LokControlHandler.hxx +++ b/include/sfx2/LokControlHandler.hxx @@ -9,9 +9,13 @@ #pragma once +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <sfx2/dllapi.h> +#include <sfx2/lokhelper.hxx> #include <svx/svdouno.hxx> -#include <vcl/window.hxx> +#include <svx/svditer.hxx> +#include <vcl/virdev.hxx> +#include <vcl/DocWindow.hxx> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -19,14 +23,22 @@ #include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/awt/XView.hpp> #include <toolkit/helper/vclunohelper.hxx> +#include <tools/UnitConversion.hxx> + +#include <sal/log.hxx> + +#include <optional> class LokControlHandler { public: static bool postMouseEvent(const SdrPage* pPage, const SdrView* pDrawView, - vcl::Window const& rMainWindow, int nType, Point aPointHmm, + vcl::DocWindow& rMainWindow, int nType, Point aPointHmm, int nCount, int nButtons, int nModifier) { + static std::optional<PointerStyle> eDocPointerStyle; + + o3tl::Length eControlUnitLength = MapToO3tlLength(rMainWindow.GetMapMode().GetMapUnit()); SdrObjListIter aIterator(pPage, SdrIterMode::Flat); while (aIterator.IsMore()) { @@ -34,7 +46,10 @@ public: SdrUnoObj* pUnoObect = dynamic_cast<SdrUnoObj*>(pObject); if (pUnoObect) { - tools::Rectangle aControlRectHMM = pUnoObect->GetLogicRect(); + tools::Rectangle aControlRect = pUnoObect->GetLogicRect(); + tools::Rectangle aControlRectHMM = o3tl::convert( + aControlRect, eControlUnitLength, o3tl::Length::mm100); + if (aControlRectHMM.Contains(aPointHmm)) { css::uno::Reference<css::awt::XControl> xControl @@ -52,6 +67,19 @@ public: VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindowPeer); if (pWindow) { + tools::Rectangle aControlRectPx = o3tl::convert( + aControlRectHMM, o3tl::Length::mm100, o3tl::Length::px); + // used by Control::LogicInvalidate + pWindow->SetPosPixel(aControlRectPx.TopLeft()); + + // when entering into control area save current pointer style + // and set pointer style to arrow + if (!eDocPointerStyle) + { + *eDocPointerStyle = rMainWindow.GetPointer(); + rMainWindow.SetPointer(pWindow->GetPointer()); + } + Point aControlRelativePositionHMM = aPointHmm - aControlRectHMM.TopLeft(); Point aControlRelativePosition = o3tl::convert( aControlRelativePositionHMM, o3tl::Length::mm100, o3tl::Length::px); @@ -59,13 +87,19 @@ public: LokMouseEventData aMouseEventData(nType, aControlRelativePosition, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); - SfxLokHelper::postMouseEventAsync(pWindow, aMouseEventData); return true; } } } } + + // when exiting from control area restore document pointer style + if (eDocPointerStyle) + { + rMainWindow.SetPointer(*eDocPointerStyle); + eDocPointerStyle.reset(); + } return false; } @@ -90,17 +124,27 @@ public: if (!xControlView.is()) return; - tools::Rectangle aObjectRectHMM = pUnoObect->GetLogicRect(); + o3tl::Length eControlUnitLength = MapToO3tlLength(rMainWindow.GetMapMode().GetMapUnit()); + tools::Rectangle aControlRect = pUnoObect->GetLogicRect(); + tools::Rectangle aObjectRectHMM = o3tl::convert( + aControlRect, eControlUnitLength, o3tl::Length::mm100); + tools::Rectangle aControltRectPx = o3tl::convert( + aObjectRectHMM, o3tl::Length::mm100, o3tl::Length::px); + Point aOffsetFromTile(aObjectRectHMM.Left() - rTileRectHMM.Left(), aObjectRectHMM.Top() - rTileRectHMM.Top()); tools::Rectangle aRectangleHMM(aOffsetFromTile, aObjectRectHMM.GetSize()); tools::Rectangle aRectanglePx = o3tl::convert(aRectangleHMM, o3tl::Length::mm100, o3tl::Length::px); - xControlWindow->setPosSize(0, 0, aRectanglePx.GetWidth(), aRectanglePx.GetHeight(), - css::awt::PosSize::POSSIZE); + xControlWindow->setPosSize( + aControltRectPx.Left(), aControltRectPx.Top(), + aRectanglePx.GetWidth(), aRectanglePx.GetHeight(), + css::awt::PosSize::POSSIZE); xControlView->setGraphics(xGraphics); + // required for getting text label rendered with the correct scale + xControlView->setZoom(1,1); xControlView->draw(aRectanglePx.Left() * scaleX, aRectanglePx.Top() * scaleY); } @@ -118,13 +162,15 @@ public: rDevice.Push(vcl::PushFlags::MAPMODE); MapMode aDeviceMapMode(rDevice.GetMapMode()); - const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::mm100); - Fraction scaleX = Fraction(aOutputSize.Width(), aTileRectHMM.GetWidth()) * scale; - Fraction scaleY = Fraction(aOutputSize.Height(), aTileRectHMM.GetHeight()) * scale; + const Fraction scale = conversionFract(o3tl::Length::px, o3tl::Length::twip); + Fraction scaleX = Fraction(aOutputSize.Width(), rTileRect.GetWidth()) * scale; + Fraction scaleY = Fraction(aOutputSize.Height(), rTileRect.GetHeight()) * scale; aDeviceMapMode.SetScaleX(scaleX); aDeviceMapMode.SetScaleY(scaleY); + aDeviceMapMode.SetMapUnit(MapUnit::MapPixel); rDevice.SetMapMode(aDeviceMapMode); + o3tl::Length eControlUnitLength = MapToO3tlLength(rMainWindow.GetMapMode().GetMapUnit()); SdrObjListIter aIterator(pPage, SdrIterMode::Flat); while (aIterator.IsMore()) @@ -133,7 +179,9 @@ public: SdrUnoObj* pUnoObect = dynamic_cast<SdrUnoObj*>(pObject); if (pUnoObect) { - tools::Rectangle aObjectRectHMM = pUnoObect->GetLogicRect(); + tools::Rectangle aControlRect = pUnoObect->GetLogicRect(); + tools::Rectangle aObjectRectHMM = o3tl::convert( + aControlRect, eControlUnitLength, o3tl::Length::mm100); // Check if we intersect with the tile rectangle and we // need to draw the control. diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 40cbd82c7762..8fe39d18d7b2 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -40,6 +40,7 @@ #include <optional> #include <memory> +#include <vcl/abstdlg.hxx> namespace com::sun::star::beans { struct PropertyValue; } @@ -198,6 +199,7 @@ private: virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; + VclPtr<AbstractPasswordToOpenModifyDialog> m_xPasswordDialog; public: SfxDocumentPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); @@ -275,11 +277,28 @@ public: ~CustomPropertiesTimeField(); }; +class DurationDialog_Impl : public weld::GenericDialogController +{ + std::unique_ptr<weld::CheckButton> m_xNegativeCB; + std::unique_ptr<weld::SpinButton> m_xYearNF; + std::unique_ptr<weld::SpinButton> m_xMonthNF; + std::unique_ptr<weld::SpinButton> m_xDayNF; + std::unique_ptr<weld::SpinButton> m_xHourNF; + std::unique_ptr<weld::SpinButton> m_xMinuteNF; + std::unique_ptr<weld::SpinButton> m_xSecondNF; + std::unique_ptr<weld::SpinButton> m_xMSecondNF; + +public: + DurationDialog_Impl(weld::Widget* pParent, const css::util::Duration& rDuration); + css::util::Duration GetDuration() const; +}; + class CustomPropertiesDurationField { css::util::Duration m_aDuration; std::unique_ptr<weld::Entry> m_xEntry; std::unique_ptr<weld::Button> m_xEditButton; + std::shared_ptr<DurationDialog_Impl> m_xDurationDialog; DECL_LINK(ClickHdl, weld::Button&, void); public: @@ -290,6 +309,8 @@ public: const css::util::Duration& GetDuration() const { return m_aDuration; } void set_visible(bool bVisible); + + ~CustomPropertiesDurationField(); }; class CustomPropertiesYesNoButton diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx index 7ed42f6a14dd..0acb44cbfbb1 100644 --- a/include/sfx2/docmacromode.hxx +++ b/include/sfx2/docmacromode.hxx @@ -264,6 +264,8 @@ namespace sfx2 */ static bool storageHasMacros( const css::uno::Reference< css::embed::XStorage >& _rxStorage ); + bool hasMacros() const; + static bool containerHasBasicMacros( const css::uno::Reference< css::script::XLibraryContainer >& xContainer ); /** checks the macro execution mode while loading the document. @@ -291,7 +293,7 @@ namespace sfx2 bool checkMacrosOnLoading( const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction, - bool bHasValidContentSignature = false + bool bHasValidContentSignature, bool bHasMacros ); private: diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index dfde3c7b43c9..5c5afca129c7 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -306,6 +306,11 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent, css::uno::Reference<css::ui::dialogs::XFolderPicker2> SFX2_DLLPUBLIC createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* pPreferredParent); ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, OUString const & aURL, SfxItemSet* pSet, const css::uno::Reference<css::awt::XWindow>& rParent); +ErrCode SetPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, SfxItemSet* pSet, + const OUString& rPasswordToOpen, const OUString& rPasswordToModify, + bool bAllowPasswordReset = false); +bool IsOOXML(const std::shared_ptr<const SfxFilter>& pCurrentFilter); +bool IsMSType(const std::shared_ptr<const SfxFilter>& pCurrentFilter); } #endif diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index 6f59402d0cec..a277d32a808c 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -13,6 +13,10 @@ #include <vector> +namespace rtl +{ +class OStringBuffer; +} namespace tools { class Rectangle; @@ -37,7 +41,8 @@ public: // LOK_CALLBACK_INVALIDATE_TILES // nPart is either part, -1 for all-parts, or INT_MIN if // comphelper::LibreOfficeKit::isPartInInvalidation() is not set - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, + int nMode) = 0; // A message of the given type should be sent, for performance purpose only a notification // is given here, details about the message should be queried from SfxViewShell when necessary. @@ -48,6 +53,10 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; + // There are pending invalidate tiles calls that need to be processed. + // A call to SfxViewShell::flushPendingLOKInvalidateTiles() should be scheduled. + virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; + virtual void dumpState(rtl::OStringBuffer& rState) = 0; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/lokcharthelper.hxx b/include/sfx2/lokcomponenthelpers.hxx index c93c4d2b8459..1ab9a8fc9c91 100644 --- a/include/sfx2/lokcharthelper.hxx +++ b/include/sfx2/lokcomponenthelpers.hxx @@ -14,10 +14,15 @@ #include <tools/gen.hxx> #include <vcl/vclptr.hxx> +namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::frame { class XController; } namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::uno { template<class E> class Sequence; } +namespace rtl { class OUString; } namespace vcl { class Window; } +class SfxInPlaceClient; class SfxViewShell; class VirtualDevice; @@ -60,6 +65,36 @@ public: double fScaleX = 1.0, double fScaleY = 1.0); }; +/// A class for math editing support via LibreOfficeKit. +class SFX2_DLLPUBLIC LokStarMathHelper +{ +public: + LokStarMathHelper(const SfxViewShell* pViewShell); + + vcl::Window* GetGraphicWindow(); + vcl::Window* GetWidgetWindow(); + const SfxViewShell* GetSmViewShell(); + tools::Rectangle GetBoundingBox() const; + + void Dispatch(const rtl::OUString& cmd, const css::uno::Sequence<css::beans::PropertyValue>& rArguments) const; + + bool postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier, + double fPPTScaleX, double fPPTScaleY); + + static void PaintAllInPlaceOnTile(VirtualDevice& rDevice, int nOutputWidth, int nOutputHeight, + int nTilePosX, int nTilePosY, tools::Long nTileWidth, + tools::Long nTileHeight); + +private: + void PaintTile(VirtualDevice& rDevice, const tools::Rectangle& rTileRect); + + const SfxViewShell* mpViewShell; + const SfxInPlaceClient* mpIPClient = nullptr; // not nullptr when the object is valid + css::uno::Reference<css::frame::XFrame> mxFrame; // not empty when the object is valid + VclPtr<vcl::Window> mpGraphicWindow; + VclPtr<vcl::Window> mpWidgetWindow; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 2a40344cd70a..95eb0a9f9f6f 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -13,10 +13,13 @@ #include <vcl/IDialogRenderable.hxx> #include <vcl/ITiledRenderable.hxx> #include <vcl/event.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> #include <sfx2/dllapi.h> #include <sfx2/viewsh.hxx> #include <tools/gen.hxx> #include <cstddef> +#include <rtl/strbuf.hxx> #include <rtl/string.hxx> #include <optional> #include <string_view> @@ -55,6 +58,8 @@ public: static void destroyView(int nId); /// Set a view shell as current one. static void setView(int nId); + /// Set the edit mode for a document with callbacks disabled. + static void setEditMode(int nMode, vcl::ITiledRenderable* pDoc); /// Get view shell with id static SfxViewShell* getViewOfId(int nId); /// Get the currently active view. @@ -84,6 +89,17 @@ public: /// Set the device form factor that should be used for a new view. static void setDeviceFormFactor(std::u16string_view rDeviceFormFactor); + /// Set timezone of the given view. + /// @isSet true to use @rTimezone, even if it's empty. Otherwise, no timezone. + /// @rTimezone the value to set (which could be empty). + static void setDefaultTimezone(bool isSet, const OUString& rTimezone); + /// Get timezone of the given view. See @setDefaultTimezone. + static std::pair<bool, OUString> getDefaultTimezone(); + /// Set the timezone of the given view. + static void setViewTimezone(int nId, bool isSet, const OUString& rTimezone); + /// Get the timezone of the given view. + static std::pair<bool, OUString> getViewTimezone(int nId); + /// Iterate over any view shell, except pThisViewShell, passing it to the f function. template<typename ViewShellType, typename FunctionType> static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType f); @@ -112,6 +128,8 @@ public: static void notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same document - if @bInvalidateAll - first invalidates all parts static void notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); + /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same document with the same part + static void notifyPartSizeChangedAllViews(vcl::ITiledRenderable* pDoc, int nPart); /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed. static void notifyInvalidation(SfxViewShell const* pThisView, tools::Rectangle const *); /// Notifies all views with the given type and payload. @@ -151,6 +169,18 @@ public: /// This value is chosen such that sal_Int32 will not overflow when manipulated. static const tools::Long MaxTwips = 1e9; + /// Helper for diagnosing run-time problems + static void dumpState(rtl::OStringBuffer &rState); + + /// Process the mouse event in the currently active in-place component (if any). + /// Returns true if the event has been processed, and no further processing is necessary. + static bool testInPlaceComponentMouseEventHit(SfxViewShell* pViewShell, int nType, int nX, + int nY, int nCount, int nButtons, int nModifier, + double fScaleX, double fScaleY, + bool bNegativeX = false); + + static VclPtr<vcl::Window> getInPlaceDocWindow(SfxViewShell* pViewShell); + private: static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId); }; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 0bfcddd2ba76..eb95982be025 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -200,6 +200,9 @@ private: SAL_DLLPRIVATE bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet ); + // true if the document had macros (or similar) on load to trigger warning user + SAL_DLLPRIVATE bool GetHadCheckedMacrosOnLoad() const; + protected: SfxObjectShell(SfxObjectCreateMode); SfxObjectShell(SfxModelFlags); // see sfxmodelfactory.hxx @@ -427,6 +430,9 @@ public: void SetMacroCallsSeenWhileLoading(); bool GetMacroCallsSeenWhileLoading() const; + // true if this type of link, from a document, is allowed by the user to be passed to uno:OpenDoc + static bool AllowedLinkProtocolFromDocument(const OUString& rUrl, SfxObjectShell* pObjShell, weld::Window* pDialogParent); + const css::uno::Sequence< css::beans::PropertyValue >& GetModifyPasswordInfo() const; bool SetModifyPasswordInfo( const css::uno::Sequence< css::beans::PropertyValue >& aInfo ); @@ -558,6 +564,7 @@ public: StarBASIC* GetBasic() const; virtual std::set<Color> GetDocColors(); + virtual std::vector<Color> GetThemeColors(); // Accessibility Check virtual sfx::AccessibilityIssueCollection runAccessibilityCheck(); diff --git a/include/sfx2/pageids.hxx b/include/sfx2/pageids.hxx index 9371848b784a..1464ec40c55a 100644 --- a/include/sfx2/pageids.hxx +++ b/include/sfx2/pageids.hxx @@ -57,6 +57,7 @@ #define RID_SVXPAGE_COLORCONFIG (RID_SVX_START + 249) #define RID_SVXPAGE_BASICIDE_OPTIONS (RID_SVX_START + 209) #define RID_SVXPAGE_LANGTOOL_OPTIONS (RID_SVX_START + 210) +#define RID_SVXPAGE_DEEPL_OPTIONS (RID_SVX_START + 211) // Resource-Id's ------------------------------------------------------------ diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx index cbbbf7a4a33d..a3bee5877e89 100644 --- a/include/sfx2/passwd.hxx +++ b/include/sfx2/passwd.hxx @@ -63,6 +63,8 @@ private: std::unique_ptr<weld::Button> m_xOKBtn; + std::shared_ptr<weld::MessageDialog> m_xConfirmFailedDialog; + OUString maMinLenPwdStr; OUString maMinLenPwdStr1; OUString maEmptyPwdStr; @@ -124,7 +126,11 @@ public: void ShowMinLengthText(bool bShow); + void PreRun(); + virtual short run() override; + + ~SfxPasswordDialog(); }; #endif // INCLUDED_SFX2_PASSWD_HXX diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx index ac4950e5a45a..978cd5669d45 100644 --- a/include/sfx2/sfxbasecontroller.hxx +++ b/include/sfx2/sfxbasecontroller.hxx @@ -196,6 +196,10 @@ public: SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const; SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs ); SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); + +protected: + void CopyLokViewCallbackFromFrameCreator(); + private: enum ConnectSfxFrame { diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 39a3ec5bf9d6..8a6023dd7b4f 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -208,6 +208,7 @@ class SvxSearchItem; #define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660) #define SID_UNPACK (SID_SFX_START + 1662) // (SID_SFX_START + 1663) used further down +#define SID_ATTR_TARGETLANG_STR (SID_SFX_START + 1664) // FREE #define SID_OUTPUTSTREAM (SID_SFX_START + 1666) #define SID_IMAGE_ORIENTATION (SID_SFX_START + 1667) @@ -442,15 +443,16 @@ class SvxSearchItem; #define SID_PASTE_ONLY_FORMULA (SID_SFX_START + 803) #define SID_PASTE_ONLY_VALUE (SID_SFX_START + 804) #define SID_PASTE_TEXTIMPORT_DIALOG (SID_SFX_START + 805) -#define SID_PASTE_TRANSPOSED (SID_SFX_START + 812) -#define SID_PASTE_AS_LINK (SID_SFX_START + 813) +#define SID_PASTE_TRANSPOSED (SID_SFX_START + 808) +#define SID_PASTE_AS_LINK (SID_SFX_START + 809) // Used for redaction -#define SID_SHAPE_NAME (SID_SFX_START + 808) - // FREE: SID_SFX_START + 809 -#define SID_GRAPHIC_SIZE_CHECK (SID_SFX_START + 809) -#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 810) -#define SID_ASYNCHRON (SID_SFX_START + 811) +#define SID_SHAPE_NAME (SID_SFX_START + 810) +#define SID_GRAPHIC_SIZE_CHECK (SID_SFX_START + 811) +#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 812) +#define SID_ASYNCHRON (SID_SFX_START + 813) +#define SID_ACCESSIBILITY_CHECK_ONLINE (SID_SFX_START + 814) +#define SID_THEME_DIALOG (SID_SFX_START + 815) // default-ids for configuration #define SID_CONFIG (SID_SFX_START + 904) diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 9aea16754399..451b7964b937 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -80,9 +80,9 @@ public: static SidebarController* GetSidebarControllerForFrame ( const css::uno::Reference<css::frame::XFrame>& rxFrame); - static void registerSidebarForFrame(SidebarController* pController, const css::uno::Reference<css::frame::XController>& xFrame); + void registerSidebarForFrame(const css::uno::Reference<css::frame::XController>& xFrame); - static void unregisterSidebarForFrame(SidebarController* pController, const css::uno::Reference<css::frame::XController>& xFrame); + void unregisterSidebarForFrame(const css::uno::Reference<css::frame::XController>& xFrame); // ui::XContextChangeEventListener virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) override; @@ -172,7 +172,8 @@ public: void SyncUpdate(); - bool hasChartContextCurrently() const; + // Used to avoid wrong context update when an embedded object activation is in progress + bool hasChartOrMathContextCurrently() const; static SidebarController* GetSidebarControllerForView(const SfxViewShell* pViewShell); diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 9bad1f5a8464..b22aefcb34a9 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -46,6 +46,7 @@ public: void SyncUpdate(); auto& GetSidebarController() const { return mpSidebarController; } + rtl::Reference<sfx2::sidebar::SidebarController>& GetOrCreateSidebarController(); using SfxDockingWindow::Close; private: diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index fc06eb9ddbe8..9944b44cbb04 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -21,6 +21,7 @@ #include <sal/config.h> #include <memory> +#include <optional> #include <sfx2/dllapi.h> #include <sal/types.h> #include <com/sun/star/uno/Reference.h> @@ -57,6 +58,8 @@ class Menu; class NotifyEvent; class SfxInPlaceClient; class SfxLokCallbackInterface; +class SfxStoringHelper; +namespace rtl { class OStringBuffer; } namespace vcl { class PrinterController; } namespace com::sun::star::beans { struct PropertyValue; } @@ -68,7 +71,7 @@ namespace com::sun::star::frame { class XModel; } namespace com::sun::star::ui { class XContextMenuInterceptor; } namespace com::sun::star::ui { struct ContextMenuExecuteEvent; } namespace com::sun::star::view { class XRenderable; } - +namespace tools { class Rectangle; } enum class SfxPrinterChangeFlags { @@ -168,10 +171,15 @@ friend class SfxPrinterController; LanguageTag maLOKLocale; LOKDeviceFormFactor maLOKDeviceFormFactor; std::unordered_set<OUString> mvLOKBlockedCommandList; + OUString maLOKTimezone; + bool maLOKIsTimezoneSet; /// Used to set the DocId at construction time. See SetCurrentDocId. static ViewShellDocId mnCurrentDocId; + /// Used for async export + std::shared_ptr<SfxStoringHelper> m_xHelper; + protected: virtual void Activate(bool IsMDIActivate) override; virtual void Deactivate(bool IsMDIActivate) override; @@ -337,23 +345,29 @@ public: /// Set up a more efficient internal callback instead of LibreOfficeKitCallback. void setLibreOfficeKitViewCallback(SfxLokCallbackInterface* pCallback); + SfxLokCallbackInterface* getLibreOfficeKitViewCallback() const; + /// dump view state for diagnostics + void dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState); /// Invokes the registered callback, if there are any. virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; - // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. - virtual void flushPendingLOKInvalidateTiles(); + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) const override; virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; + // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. + virtual void flushPendingLOKInvalidateTiles(); + virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; // Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or // libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should // be generated, the ignore flag should be set. - virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const; + virtual std::optional<OString> getLOKPayload(int nType, int nViewId) const; /// Set if we are doing tiled searching. void setTiledSearching(bool bTiledSearching); /// See lok::Document::getPart(). virtual int getPart() const; + /// See lok::Document::getMode(). + virtual int getEditMode() const; virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; /// See OutlinerViewShell::GetViewShellId(). ViewShellId GetViewShellId() const override; @@ -369,6 +383,8 @@ public: /// Get the DocId used by Mobile LOKit to load multiple documents. ViewShellDocId GetDocId() const override; + /// ILibreOfficeKitNotifier. Emits a LOK_CALLBACK_INVALIDATE_TILES. + virtual void notifyInvalidation(tools::Rectangle const *) const override; /// See OutlinerViewShell::NotifyOtherViews(). void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) override; /// See OutlinerViewShell::NotifyOtherView(). @@ -385,6 +401,21 @@ public: /// Get the LibreOfficeKit language of this view. const LanguageTag& GetLOKLanguageTag() const { return maLOKLanguageTag; } + /// Get the LibreOfficeKit timezone of this view. See @SetLOKTimezone. + std::pair<bool, OUString> GetLOKTimezone() const + { + return { maLOKIsTimezoneSet, maLOKTimezone }; + } + + /// Set the LibreOfficeKit timezone of this view. + /// @isSet true to use @rTimezone, even if it's empty. Otherwise, no timezone. + /// @rTimezone the value to set (which could be empty). + void SetLOKTimezone(bool isSet, const OUString& rTimezone) + { + maLOKIsTimezoneSet = isSet; + maLOKTimezone = rTimezone; + } + /// Set the LibreOfficeKit locale of this view. void SetLOKLocale(const OUString& rBcp47LanguageTag); /// Get the LibreOfficeKit locale of this view. @@ -403,6 +434,8 @@ public: // Blocked Command view settings void setBlockedCommandList(const char* blockedCommandList); bool isBlockedCommand(OUString command); + + void SetStoringHelper(std::shared_ptr<SfxStoringHelper> xHelper) { m_xHelper = xHelper; } }; diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index ef1343a49fc8..a134fc17a076 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -73,7 +73,6 @@ enum class SfxHintId { ScDbAreasChanged, ScAreasChanged, ScTablesChanged, - ScTablesRenamed, ScDrawChanged, ScDocNameChanged, ScAreaLinksChanged, @@ -166,7 +165,6 @@ inline std::basic_ostream<charT, traits> & operator <<( case SfxHintId::ScDbAreasChanged: return stream << "ScDbAreasChanged"; case SfxHintId::ScAreasChanged: return stream << "ScAreasChanged"; case SfxHintId::ScTablesChanged: return stream << "ScTablesChanged"; - case SfxHintId::ScTablesRenamed: return stream << "ScTablesRenamed"; case SfxHintId::ScDrawChanged: return stream << "ScDrawChanged"; case SfxHintId::ScDocNameChanged: return stream << "ScDocNameChanged"; case SfxHintId::ScAreaLinksChanged: return stream << "ScAreaLinksChanged"; diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 5ce13bb1f4c8..cf26d10a0e99 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -145,6 +145,23 @@ public: bool bSrchInParent = true, const SfxPoolItem **ppItem = nullptr ) const; + template <class T> + SfxItemState GetItemState( TypedWhichId<T> nWhich, + bool bSrchInParent = true, + const T **ppItem = nullptr ) const + { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<SfxPoolItem const**>(ppItem)); } + + /// Templatized version of GetItemState() to directly return the correct type. + template<class T> + const T * GetItemIfSet( TypedWhichId<T> nWhich, + bool bSrchInParent = true ) const + { + const SfxPoolItem * pItem = nullptr; + if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) ) + return static_cast<const T*>(pItem); + return nullptr; + } + bool HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = nullptr) const; void DisableItem(sal_uInt16 nWhich); diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index ff270eef5aa6..6880fec2a101 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -53,8 +53,9 @@ public: */ void purge(); + // For unit tests. Note that an "empty" pool may contain some internal items, + // such as SharedString::getEmptyString(). size_t getCount() const; - size_t getCountIgnoreCase() const; }; } diff --git a/include/svtools/deeplcfg.hxx b/include/svtools/deeplcfg.hxx new file mode 100644 index 000000000000..b8e8ca4d7cd4 --- /dev/null +++ b/include/svtools/deeplcfg.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 <unotools/configitem.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <svtools/svtdllapi.h> + +using namespace utl; +using namespace com::sun::star::uno; + +struct DeeplOptions_Impl; + +class SVT_DLLPUBLIC SvxDeeplOptions final : public utl::ConfigItem +{ +public: + SvxDeeplOptions(); + virtual ~SvxDeeplOptions() override; + + virtual void Notify(const css::uno::Sequence<OUString>& _rPropertyNames) override; + static SvxDeeplOptions& Get(); + + const OUString getAPIUrl() const; + void setAPIUrl(const OUString& rVal); + + const OUString& getAuthKey() const; + void setAuthKey(const OUString& rVal); + +private: + std::unique_ptr<DeeplOptions_Impl> pImpl; + void Load(const css::uno::Sequence<OUString>& rPropertyNames); + virtual void ImplCommit() override; + static const Sequence<OUString>& GetPropertyNames(); +}; diff --git a/include/svtools/genericasyncunodialog.hxx b/include/svtools/genericasyncunodialog.hxx new file mode 100644 index 000000000000..937f9778030d --- /dev/null +++ b/include/svtools/genericasyncunodialog.hxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> +#include <sfx2/tabdlg.hxx> +#include <svtools/genericunodialog.hxx> +#include <vcl/svapp.hxx> + +using namespace css::uno; + +namespace svt +{ +typedef cppu::ImplInheritanceHelper<::svt::OGenericUnoDialog, + css::ui::dialogs::XAsynchronousExecutableDialog> + OGenericUnoAsyncDialogBase; + +/** abstract base class for implementing UNO objects representing asynchronous dialogs + */ +template <typename T> class OGenericUnoAsyncDialog : public OGenericUnoAsyncDialogBase +{ + class UnoAsyncDialogEntryGuard + { + public: + UnoAsyncDialogEntryGuard(OGenericUnoAsyncDialog<T>& _rDialog) + : m_aGuard(_rDialog.GetMutex()) + { + } + + private: + ::osl::MutexGuard m_aGuard; + }; + +protected: + std::shared_ptr<T> m_xAsyncDialog; + +protected: + OGenericUnoAsyncDialog(const css::uno::Reference<css::uno::XComponentContext>& _rxContext) + : OGenericUnoAsyncDialogBase(_rxContext) + { + } + +public: + // XAsynchronousExecutableDialog + void SAL_CALL setDialogTitle(const OUString& aTitle) override + { + OGenericUnoDialog::setTitle(aTitle); + } + + virtual void SAL_CALL startExecuteModal( + const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener) override + { + SolarMutexGuard aSolarGuard; + + { + UnoAsyncDialogEntryGuard aGuard(*this); + + if (m_bExecuting) + throw RuntimeException("already executing the dialog (recursive call)", *this); + + if (!m_xAsyncDialog) + { + m_xAsyncDialog = createAsyncDialog(m_xParent); + OSL_ENSURE(m_xAsyncDialog, "OGenericUnoAsyncDialog::startExecuteModal: " + "createAsyncDialog returned nonsense!"); + if (!m_xAsyncDialog) + return; + + // do some initialisations + if (!m_bTitleAmbiguous) + m_xAsyncDialog->set_title(m_sTitle); + } + + m_bExecuting = true; + } + + runAsync(xListener); + } + +protected: + virtual std::shared_ptr<T> + createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& /*rParent*/) + { + return nullptr; + } + + void destroyAsyncDialog() + { + SolarMutexGuard aSolarGuard; + if (m_xAsyncDialog) + m_xAsyncDialog.reset(); + } + + virtual void + runAsync(const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& /*xListener*/) + { + } + + virtual void executedAsyncDialog(std::shared_ptr<T> /*xAsyncDialog*/, + sal_Int32 /*_nExecutionResult*/) + { + } +}; + +} // namespace svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/languagetoolcfg.hxx b/include/svtools/languagetoolcfg.hxx index 7578ad6ba281..24c4de6408aa 100644 --- a/include/svtools/languagetoolcfg.hxx +++ b/include/svtools/languagetoolcfg.hxx @@ -39,6 +39,9 @@ public: const OUString& getBaseURL() const; void setBaseURL(const OUString& rVal); + const OUString& getRestProtocol() const; + void setRestProtocol(const OUString& rVal); + const OUString& getUsername() const; void setUsername(const OUString& rVal); @@ -51,6 +54,9 @@ public: bool getEnabled() const; void setEnabled(bool enabled); + bool getSSLVerification() const; + void setSSLVerification(bool enabled); + private: std::unique_ptr<LanguageToolOptions_Impl> pImpl; void Load(const css::uno::Sequence<OUString>& rPropertyNames); diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index c4aa0ae2b9bc..6cad975d6615 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -11,11 +11,14 @@ #ifndef INCLUDED_SVX_COLORSETS_HXX #define INCLUDED_SVX_COLORSETS_HXX +#include <array> #include <vector> #include <rtl/ustring.hxx> #include <sal/types.h> +#include <sal/log.hxx> #include <svx/svxdllapi.h> +#include <docmodel/theme/ThemeColor.hxx> #include <tools/color.hxx> typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -24,27 +27,25 @@ class SdrPage; namespace svx { -class ColorSet + +class SVXCORE_DLLPUBLIC ColorSet { - OUString maColorSetName; - std::vector<Color> maColors; + OUString maName; + std::array<Color, 12> maColors; + public: - ColorSet(OUString const & aName); + ColorSet(OUString const& rName); - void add(sal_uInt32 nIndex, ::Color aColorData) - { - maColors[nIndex] = aColorData; - } + void add(model::ThemeColorType Type, Color aColorData); const OUString& getName() const { - return maColorSetName; - } - const Color& getColor(sal_uInt32 nIndex) const - { - return maColors[nIndex]; + return maName; } + Color resolveColor(model::ThemeColor const& rThemeColor) const; + Color getColor(model::ThemeColorType eType) const; + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; @@ -61,25 +62,177 @@ public: return maColorSets; } - const ColorSet& getColorSet(sal_uInt32 nIndex) + const ColorSet& getColorSet(sal_uInt32 nIndex) const { return maColorSets[nIndex]; } const ColorSet& getColorSet(std::u16string_view rName); + + void insert(ColorSet const& rColorSet); +}; + +struct SVXCORE_DLLPUBLIC ThemeSupplementalFont +{ + OUString maScript; + OUString maTypeface; +}; + +struct SVXCORE_DLLPUBLIC ThemeFont +{ + OUString maTypeface; + OUString maPanose; + sal_Int16 maPitch; + sal_Int16 maFamily; + sal_Int32 maCharset; + + sal_Int16 getPitchFamily() const + { + return (maPitch & 0x0F) | (maFamily & 0x0F) << 4; + } +}; + +class SVXCORE_DLLPUBLIC FontScheme +{ +private: + OUString maName; + + ThemeFont maMinorLatin; + ThemeFont maMinorAsian; + ThemeFont maMinorComplex; + + ThemeFont maMajorLatin; + ThemeFont maMajorAsian; + ThemeFont maMajorComplex; + + std::vector<ThemeSupplementalFont> maMinorSupplementalFontList; + std::vector<ThemeSupplementalFont> maMajorSupplementalFontList; + +public: + FontScheme() = default; + FontScheme(OUString const& rName) + : maName(rName) + {} + + const OUString& getName() const + { + return maName; + } + + ThemeFont const& getMinorLatin() const + { + return maMinorLatin; + } + void setMinorLatin(ThemeFont const& aMinor) + { + maMinorLatin = aMinor; + } + + ThemeFont const& getMinorAsian() const + { + return maMinorAsian; + } + void setMinorAsian(ThemeFont const& aMinor) + { + maMinorAsian = aMinor; + } + + ThemeFont const& getMinorComplex() const + { + return maMinorComplex; + } + void setMinorComplex(ThemeFont const& aMinor) + { + maMinorComplex = aMinor; + } + + ThemeFont const& getMajorLatin() const + { + return maMajorLatin; + } + void setMajorLatin(ThemeFont const& aMajor) + { + maMajorLatin = aMajor; + } + + ThemeFont const& getMajorAsian() const + { + return maMajorAsian; + } + void setMajorAsian(ThemeFont const& aMajor) + { + maMajorAsian = aMajor; + } + + ThemeFont const& getMajorComplex() const + { + return maMajorComplex; + } + void setMajorComplex(ThemeFont const& aMajor) + { + maMajorComplex = aMajor; + } + + OUString findMinorSupplementalTypeface(std::u16string_view rScript) const + { + for (auto const& rSupplementalFont : maMinorSupplementalFontList) + { + if (rSupplementalFont.maScript == rScript) + return rSupplementalFont.maTypeface; + } + return OUString(); + } + + std::vector<ThemeSupplementalFont> const& getMinorSupplementalFontList() const + { + return maMinorSupplementalFontList; + } + void setMinorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont) + { + maMinorSupplementalFontList = rSupplementalFont; + } + + OUString findMajorSupplementalTypeface(std::u16string_view rScript) const + { + for (auto const& rSupplementalFont : maMajorSupplementalFontList) + { + if (rSupplementalFont.maScript == rScript) + return rSupplementalFont.maTypeface; + } + return OUString(); + } + + std::vector<ThemeSupplementalFont> const& getMajorSupplementalFontList() const + { + return maMajorSupplementalFontList; + } + void setMajorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont) + { + maMajorSupplementalFontList = rSupplementalFont; + } }; /// A named theme has a named color set. class SVXCORE_DLLPUBLIC Theme { +private: OUString maName; std::unique_ptr<ColorSet> mpColorSet; + FontScheme maFontScheme; + public: Theme(OUString const& rName); - ~Theme(); + + void setFontScheme(FontScheme const& rFontScheme) + { + maFontScheme = rFontScheme; + } + + FontScheme const& getFontScheme() const { return maFontScheme; } void SetColorSet(std::unique_ptr<ColorSet> pColorSet); + const ColorSet* GetColorSet() const; ColorSet* GetColorSet(); void SetName(const OUString& rName); @@ -92,6 +245,10 @@ public: static std::unique_ptr<Theme> FromAny(const css::uno::Any& rVal); void UpdateSdrPage(SdrPage* pPage); + + std::vector<Color> GetColors() const; + + Color GetColor(model::ThemeColorType eType) const; }; } // end of namespace svx diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index 0ccc644a8b01..c23a09f9cbc8 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -24,13 +24,31 @@ #include <functional> #include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <svx/svxdllapi.h> -class Color; class SvxColorValueSet; typedef std::pair<Color, OUString> NamedColor; -typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; +namespace svx +{ +/// A color with an optional name and other theming-related properties. +struct SVXCORE_DLLPUBLIC NamedThemedColor +{ + Color m_aColor; + OUString m_aName; + sal_Int16 m_nThemeIndex = -1; + sal_Int16 m_nLumMod = 10000; + sal_Int16 m_nLumOff = 0; + + static NamedThemedColor FromNamedColor(const NamedColor& rNamedColor); + + NamedColor ToNamedColor() const; +}; +} + +typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> ColorSelectFunction; class Palette { diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index 179c2fb4a924..d67623555157 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -74,7 +74,12 @@ public: void SetColorSelectFunction(const ColorSelectFunction& aColorSelectFunction); - static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor); + bool IsThemePaletteSelected() const; + + static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex, + sal_Int16& rLumMod, sal_Int16& rLumOff); + + static void DispatchColorCommand(const OUString& aCommand, const svx::NamedThemedColor& rColor); }; #endif // INCLUDED_SVX_PALETTEMANAGER_HXX diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx index 23b92be6b38b..0dc858d1e67d 100644 --- a/include/svx/colorbox.hxx +++ b/include/svx/colorbox.hxx @@ -21,7 +21,7 @@ class ListBoxColorWrapper public: ListBoxColorWrapper(ColorListBox* pControl); void operator()(const OUString& rCommand, - const NamedColor& rColor); // ColorSelectFunction signature + const svx::NamedThemedColor& rColor); // ColorSelectFunction signature private: ColorListBox* mpControl; }; @@ -36,14 +36,14 @@ private: ListBoxColorWrapper m_aColorWrapper; Color m_aAutoDisplayColor; Color m_aSaveColor; - NamedColor m_aSelectedColor; + svx::NamedThemedColor m_aSelectedColor; sal_uInt16 m_nSlotId; bool m_bShowNoneButton; std::shared_ptr<PaletteManager> m_xPaletteManager; TopLevelParentFunction m_aTopLevelParentFunction; ColorStatus m_aColorStatus; - void Selected(const NamedColor& rNamedColor); + void Selected(const svx::NamedThemedColor& rNamedColor); void createColorWindow(); void LockWidthRequest(); ColorWindow* getColorWindow() const; @@ -60,8 +60,9 @@ public: void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false); - Color const& GetSelectEntryColor() const { return m_aSelectedColor.first; } - NamedColor const& GetSelectedEntry() const { return m_aSelectedColor; } + Color const& GetSelectEntryColor() const { return m_aSelectedColor.m_aColor; } + NamedColor GetSelectedEntry() const { return m_aSelectedColor.ToNamedColor(); } + svx::NamedThemedColor GetSelectedEntryThemedColor() const { return m_aSelectedColor; } void SelectEntry(const NamedColor& rColor); void SelectEntry(const Color& rColor); diff --git a/include/svx/dialog/ThemeColorValueSet.hxx b/include/svx/dialog/ThemeColorValueSet.hxx new file mode 100644 index 000000000000..4b70ed0f56db --- /dev/null +++ b/include/svx/dialog/ThemeColorValueSet.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <sal/config.h> +#include <svtools/valueset.hxx> +#include <svx/ColorSets.hxx> + +namespace svx +{ +class SVX_DLLPUBLIC ThemeColorValueSet final : public ValueSet +{ + std::vector<std::reference_wrapper<const svx::ColorSet>> maColorSets; + +public: + ThemeColorValueSet() + : ValueSet(nullptr) + { + } + + void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + void UserDraw(const UserDrawEvent& rUserDrawEvent) override; + void StyleUpdated() override; + + void insert(svx::ColorSet const& rColorSet); +}; + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dialog/ThemeDialog.hxx b/include/svx/dialog/ThemeDialog.hxx new file mode 100644 index 000000000000..968c54af9e98 --- /dev/null +++ b/include/svx/dialog/ThemeDialog.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <vcl/weld.hxx> +#include <svx/ColorSets.hxx> +#include <svx/svdpage.hxx> +#include <svx/theme/IThemeColorChanger.hxx> +#include <svx/dialog/ThemeColorValueSet.hxx> + +namespace svx +{ +class SVX_DLLPUBLIC ThemeDialog final : public weld::GenericDialogController +{ +private: + svx::Theme* mpTheme; + svx::ColorSets maColorSets; + std::shared_ptr<IThemeColorChanger> mpChanger; + + std::unique_ptr<svx::ThemeColorValueSet> mxValueSetThemeColors; + std::unique_ptr<weld::CustomWeld> mxValueSetThemeColorsWindow; + +public: + ThemeDialog(weld::Window* pParent, svx::Theme* pTheme, + std::shared_ptr<IThemeColorChanger> const& pChanger); + virtual ~ThemeDialog() override; + + DECL_LINK(DoubleClickValueSetHdl, ValueSet*, void); + void DoubleClickHdl(); +}; + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index f03600a74fe0..d3d7f6d8b17d 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -43,6 +43,7 @@ #define RID_SVXPAGE_BKG (RID_SVX_START + 57) #define RID_SVXPAGE_SHADOW (RID_SVX_START + 61) #define RID_SVXPAGE_TRANSPARENCE (RID_SVX_START + 54) +#define RID_SVXPAGE_THEME (RID_SVX_START + 55) #define RID_SVXPAGE_TEXTATTR (RID_SVX_START + 153) #define RID_SVXPAGE_TEXTANIMATION (RID_SVX_START + 184) #define RID_SVXPAGE_TEXTCOLUMNS (RID_SVX_START + 154) diff --git a/include/svx/hlnkitem.hxx b/include/svx/hlnkitem.hxx index 5d6ac5689401..7c6501c7777d 100644 --- a/include/svx/hlnkitem.hxx +++ b/include/svx/hlnkitem.hxx @@ -26,6 +26,7 @@ #include <svx/svxdllapi.h> #include <o3tl/typed_flags_set.hxx> #include <memory> +#include <rtl/ustrbuf.hxx> enum class HyperDialogEvent { NONE = 0x0000, @@ -51,6 +52,7 @@ class SVX_DLLPUBLIC SvxHyperlinkItem final : public SfxPoolItem OUString sURL; OUString sTarget; SvxLinkInsertMode eType; + OUString sReplacementText; OUString sIntName; std::unique_ptr<SvxMacroTableDtor> pMacroTable; @@ -67,7 +69,8 @@ public: const OUString& rTarget, const OUString& rIntName, SvxLinkInsertMode eTyp, HyperDialogEvent nEvents, - SvxMacroTableDtor const *pMacroTbl ); + SvxMacroTableDtor const *pMacroTbl, + const OUString& rReplacementText = OUString()); virtual bool operator==( const SfxPoolItem& ) const override; virtual SvxHyperlinkItem* Clone( SfxItemPool *pPool = nullptr ) const override; @@ -97,6 +100,9 @@ public: void SetMacroEvents (const HyperDialogEvent nEvents) { nMacroEvents = nEvents; } HyperDialogEvent GetMacroEvents() const { return nMacroEvents; } + const OUString& GetReplacementText() const { return sReplacementText; } + void SetReplacementText(const OUString& rReplacementText) { sReplacementText = rReplacementText; } + }; #endif diff --git a/include/svx/sdtfsitm.hxx b/include/svx/sdtfsitm.hxx index d98e431dab68..ccdcb7c4dbe9 100644 --- a/include/svx/sdtfsitm.hxx +++ b/include/svx/sdtfsitm.hxx @@ -35,14 +35,17 @@ class SVXCORE_DLLPUBLIC SdrTextFitToSizeTypeItem final { public: static SfxPoolItem* CreateDefault(); - SdrTextFitToSizeTypeItem( - css::drawing::TextFitToSizeType const eFit = css::drawing::TextFitToSizeType_NONE) - : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE, eFit) {} + SdrTextFitToSizeTypeItem(css::drawing::TextFitToSizeType const eFit = css::drawing::TextFitToSizeType_NONE) + : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE, eFit) + { + } + SdrTextFitToSizeTypeItem(const SdrTextFitToSizeTypeItem& rItem) - : SfxEnumItem(rItem), - m_nMaxScale(rItem.GetMaxScale()) + : SfxEnumItem(rItem) + , m_nMaxScale(rItem.GetMaxScale()) { } + virtual SdrTextFitToSizeTypeItem* Clone(SfxItemPool* pPool=nullptr) const override; bool operator==(const SfxPoolItem& rItem) const override; virtual sal_uInt16 GetValueCount() const override; @@ -55,10 +58,11 @@ public: virtual bool HasBoolValue() const override; virtual bool GetBoolValue() const override; virtual void SetBoolValue(bool bVal) override; - void SetMaxScale(sal_Int16 nMaxScale) { m_nMaxScale = nMaxScale; } - sal_Int16 GetMaxScale() const { return m_nMaxScale; } + + void SetMaxScale(double nMaxScale) { m_nMaxScale = nMaxScale; } + double GetMaxScale() const { return m_nMaxScale; } private: - sal_Int16 m_nMaxScale = 0; + double m_nMaxScale = 0.0; }; #endif diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index ebf12af91006..a368a4c77906 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1118,7 +1118,25 @@ #define RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE NC_("RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE", "Font Name. The current font is not available and will be substituted.") #define RID_SVXSTR_CUSTOM_PAL NC_("RID_SVXSTR_CUSTOM_PAL", "custom") #define RID_SVXSTR_DOC_COLORS NC_("RID_SVXSTR_DOC_COLORS", "Document colors") +#define RID_SVXSTR_THEME_COLORS NC_("RID_SVXSTR_THEME_COLORS", "Theme colors") #define RID_SVXSTR_DOC_COLOR_PREFIX NC_("RID_SVXSTR_DOC_COLOR_PREFIX", "Document Color") +#define RID_SVXSTR_THEME_COLOR1 NC_("RID_SVXSTR_THEME_COLOR1", "Background - Dark 1") +#define RID_SVXSTR_THEME_COLOR2 NC_("RID_SVXSTR_THEME_COLOR2", "Text - Light 1") +#define RID_SVXSTR_THEME_COLOR3 NC_("RID_SVXSTR_THEME_COLOR3", "Background - Dark 2") +#define RID_SVXSTR_THEME_COLOR4 NC_("RID_SVXSTR_THEME_COLOR4", "Text - Light 2") +#define RID_SVXSTR_THEME_COLOR5 NC_("RID_SVXSTR_THEME_COLOR5", "Accent 1") +#define RID_SVXSTR_THEME_COLOR6 NC_("RID_SVXSTR_THEME_COLOR6", "Accent 2") +#define RID_SVXSTR_THEME_COLOR7 NC_("RID_SVXSTR_THEME_COLOR7", "Accent 3") +#define RID_SVXSTR_THEME_COLOR8 NC_("RID_SVXSTR_THEME_COLOR8", "Accent 4") +#define RID_SVXSTR_THEME_COLOR9 NC_("RID_SVXSTR_THEME_COLOR9", "Accent 5") +#define RID_SVXSTR_THEME_COLOR10 NC_("RID_SVXSTR_THEME_COLOR10", "Accent 6") +#define RID_SVXSTR_THEME_COLOR11 NC_("RID_SVXSTR_THEME_COLOR11", "Hyperlink") +#define RID_SVXSTR_THEME_COLOR12 NC_("RID_SVXSTR_THEME_COLOR12", "Followed Hyperlink") +#define RID_SVXSTR_THEME_EFFECT1 NC_("RID_SVXSTR_THEME_EFFECT1", "%1, 80% Lighter") +#define RID_SVXSTR_THEME_EFFECT2 NC_("RID_SVXSTR_THEME_EFFECT2", "%1, 60% Lighter") +#define RID_SVXSTR_THEME_EFFECT3 NC_("RID_SVXSTR_THEME_EFFECT3", "%1, 40% Lighter") +#define RID_SVXSTR_THEME_EFFECT4 NC_("RID_SVXSTR_THEME_EFFECT4", "%1, 25% Darker") +#define RID_SVXSTR_THEME_EFFECT5 NC_("RID_SVXSTR_THEME_EFFECT5", "%1, 50% Darker") #define RID_SVX_EXTRUSION_BAR NC_("RID_SVX_EXTRUSION_BAR", "Extrusion") #define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF", "Apply Extrusion On/Off") diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx index 9332dc65a59f..2bb5068f5661 100644 --- a/include/svx/svddef.hxx +++ b/include/svx/svddef.hxx @@ -138,6 +138,7 @@ class SdrVertShearAllItem; class SdrVertShearOneItem; class SdrYesNoItem; class SfxBoolItem; +class SfxGrabBagItem; class SfxInt16Item; class SfxUInt16Item; class SfxUInt32Item; @@ -231,7 +232,8 @@ constexpr TypedWhichId<SvXMLAttrContainerItem> SDRATTR_XMLATTRIBUTES constexpr TypedWhichId<SdrTextFixedCellHeightItem> SDRATTR_TEXT_USEFIXEDCELLHEIGHT (SDRATTR_MISC_FIRST +23); /* 1121 */ /* 1121 */ /* 1104 */ /* Pool V2 */ constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_WORDWRAP (SDRATTR_MISC_FIRST +24); /* 1122 */ /* 1122 */ /* 1105 */ /* Pool V2 */ constexpr TypedWhichId<SfxStringItem> SDRATTR_TEXT_CHAINNEXTNAME (SDRATTR_MISC_FIRST +25); /* 1123 */ /* 1123 */ /* 1106 */ /* Pool V2 */ -constexpr sal_uInt16 SDRATTR_MISC_LAST (SDRATTR_TEXT_CHAINNEXTNAME); /* 1125 */ /* 1125 */ /* 1108 */ /* Pool V1: 1056 */ +constexpr TypedWhichId<SdrOnOffItem> SDRATTR_TEXT_CLIPVERTOVERFLOW (SDRATTR_MISC_FIRST +26); +constexpr sal_uInt16 SDRATTR_MISC_LAST (SDRATTR_TEXT_CLIPVERTOVERFLOW); /* 1126 */ /* 1125 */ /* 1108 */ /* Pool V1: 1056 */ constexpr sal_uInt16 SDRATTR_EDGE_FIRST (SDRATTR_MISC_LAST + 1); /* 1127 */ /* Pool V4 */ constexpr TypedWhichId<SdrEdgeKindItem> SDRATTR_EDGEKIND (SDRATTR_EDGE_FIRST + 0); /* 1127 */ /* Pool V4 */ @@ -415,7 +417,8 @@ constexpr TypedWhichId<SvxBoxInfoItem> SDRATTR_TABLE_BORDER_INNER (SDRATTR_T constexpr TypedWhichId<SvxLineItem> SDRATTR_TABLE_BORDER_TLBR (SDRATTR_TABLE_FIRST+2); constexpr TypedWhichId<SvxLineItem> SDRATTR_TABLE_BORDER_BLTR (SDRATTR_TABLE_FIRST+3); constexpr TypedWhichId<SvxTextRotateItem> SDRATTR_TABLE_TEXT_ROTATION (SDRATTR_TABLE_FIRST+4); -constexpr sal_uInt16 SDRATTR_TABLE_LAST (SDRATTR_TABLE_TEXT_ROTATION); +constexpr TypedWhichId<SfxGrabBagItem> SDRATTR_TABLE_GRABBAG (SDRATTR_TABLE_FIRST+5); +constexpr sal_uInt16 SDRATTR_TABLE_LAST (SDRATTR_TABLE_GRABBAG); constexpr sal_uInt16 SDRATTR_GLOW_FIRST (SDRATTR_TABLE_LAST+1); constexpr TypedWhichId<SdrMetricItem> SDRATTR_GLOW_RADIUS (SDRATTR_GLOW_FIRST+0); diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index d80ec5a577b9..629ad980e6b3 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -61,6 +61,9 @@ public: void setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType = OUString() ); const OUString& getURL() const; + /// Returns the URL to the temporary extracted media file. + const OUString& getTempURL() const; + void setMediaProperties( const ::avmedia::MediaItem& rState ); const ::avmedia::MediaItem& getMediaProperties() const; diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index ae6ff818bdf6..522bead958e6 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -42,6 +42,7 @@ namespace io { class XInputStream; } namespace svt { class EmbeddedObjectRef; } class SdrOle2ObjImpl; +class SvxOle2Shape; class SVXCORE_DLLPUBLIC SdrOle2Obj : public SdrRectObj { @@ -49,7 +50,7 @@ private: std::unique_ptr<SdrOle2ObjImpl> mpImpl; private: - SVX_DLLPRIVATE void Connect_Impl(); + SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape* pCreator = nullptr); SVX_DLLPRIVATE void Disconnect_Impl(); SVX_DLLPRIVATE void AddListeners_Impl(); SVX_DLLPRIVATE void RemoveListeners_Impl(); @@ -107,7 +108,7 @@ public: // OLE object has got a separate PersistName member now; // !!! use ::SetPersistName( ... ) only, if you know what you do !!! const OUString& GetPersistName() const; - void SetPersistName( const OUString& rPersistName ); + void SetPersistName( const OUString& rPersistName, SvxOle2Shape* pCreator = nullptr ); // One can add an application name to a SdrOle2Obj, which can be queried for // later on (SD needs this for presentation objects). @@ -152,7 +153,7 @@ public: sal_Int64 nAspect ); static bool Unload( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect ); bool Unload(); - void Connect(); + void Connect(SvxOle2Shape* pCreator = nullptr); void Disconnect(); void ObjectLoaded(); @@ -199,4 +200,14 @@ public: void Connect() { GetRealObject(); } }; +class SVXCORE_DLLPUBLIC SdrIFrameLink final : public sfx2::SvBaseLink +{ + SdrOle2Obj* m_pObject; + +public: + explicit SdrIFrameLink(SdrOle2Obj* pObject); + virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( + const OUString& rMimeType, const css::uno::Any & rValue ) override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 18497bcc2494..71ec5b44bf57 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -142,6 +142,8 @@ public: /** The active table has the focus or is currently edited */ const sdr::table::CellRef& getActiveCell() const; + CellRef getCell(const CellPos& rPos) const; + void setActiveCell( const sdr::table::CellPos& rPos ); void getActiveCellPos( sdr::table::CellPos& rPos ) const; sal_Int32 getColumnCount() const; @@ -256,6 +258,13 @@ public: /// Next time layouting would be done, skip it (to layout at the end of multiple actions). void SetSkipChangeLayout(bool bSkipChangeLayout); + /** Tries to get table height if rows with sizes less then the minimum size were expanded + + (i.e. Table height layouted without fitting to an area) + Helper for OOXML import + */ + sal_Int32 getHeightWithoutFitting(); + virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus ) override; virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index d192552d16ad..4c086dc67497 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -253,6 +253,7 @@ private: void ImpAutoFitText( SdrOutliner& rOutliner ) const; void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting ) const; SVX_DLLPRIVATE SdrObjectUniquePtr ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const; + void autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size& rShapeSize) const; SVX_DLLPRIVATE void ImpRegisterLink(); SVX_DLLPRIVATE void ImpDeregisterLink(); SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const; @@ -380,7 +381,9 @@ public: // FitToSize and Fontwork are not taken into account in GetTextSize()! virtual const Size& GetTextSize() const; void FitFrameToTextSize(); - sal_uInt16 GetFontScaleY() const; + + double GetFontScale() const; + double GetSpacingScale() const; // Simultaneously sets the text into the Outliner (possibly // the one of the EditOutliner) and sets the PaperSize. diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 557846fe01d8..7dfceb7242b4 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -189,6 +189,7 @@ protected: bool mbHideChart : 1; bool mbHideDraw : 1; // hide draw objects other than form controls bool mbHideFormControl : 1; // hide form controls only + bool mbPaintTextEdit : 1; // if should paint currently edited text public: // Interface for PagePaintingAllowed flag @@ -499,6 +500,9 @@ public: // #i38135# // Sets the timer for Object animations and restarts. void SetAnimationTimer(sal_uInt32 nTime); + + /// @see vcl::ITiledRenderable::setPaintTextEdit(). + void SetPaintTextEdit(bool bPaint) { mbPaintTextEdit = bPaint; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 9cd52877bf63..e19f5121d5de 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -67,6 +67,7 @@ class SdrAngleItem; #define MID_HLINK_TARGET 0x71 #define MID_HLINK_TYPE 0x72 #define MID_HLINK_TEXT 0x73 +#define MID_HLINK_REPLACEMENTTEXT 0x74 #define MID_VIEWLAYOUT_COLUMNS 0x77 #define MID_VIEWLAYOUT_BOOKMODE 0x78 @@ -430,6 +431,10 @@ class SdrAngleItem; #define SID_ATTR_TEXTCOLUMNS_NUMBER ( SID_SVX_START + 340 ) #define SID_ATTR_TEXTCOLUMNS_SPACING ( SID_SVX_START + 341 ) +#define SID_ATTR_COLOR_THEME_INDEX ( SID_SVX_START + 342 ) +#define SID_ATTR_COLOR_LUM_MOD ( SID_SVX_START + 343 ) +#define SID_ATTR_COLOR_LUM_OFF ( SID_SVX_START + 344 ) + #define SID_SB_CONNECTIONPOOLING ( SID_SVX_START + 348 ) #define SID_SB_DBREGISTEROPTIONS ( SID_SVX_START + 349 ) #define SID_BMPMASK ( SID_SVX_START + 350 ) @@ -566,7 +571,7 @@ class SdrAngleItem; #define SID_FM_FILECONTROL ( SID_SVX_START + 605 ) //( SID_SVX_START + 606 ) is used by SID_DRAWTBX_REDACTED_EXPORT #define SID_FM_NAVIGATIONBAR ( SID_SVX_START + 607 ) -//FREE +#define SID_FM_TRANSLATE ( SID_SVX_START + 608 ) //FREE #define SID_FM_DELETEROWS ( SID_SVX_START + 610 ) //FREE diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 8347e3b9df1e..194db28a51f0 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -200,7 +200,7 @@ friend class SfxStyleControllerItem_Impl; SfxStyleFamily GetActFamily() const; }; -typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; +typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> ColorSelectFunction; class SVXCORE_DLLPUBLIC SvxColorToolBoxControl final : public cppu::ImplInheritanceHelper< svt::PopupWindowController, css::frame::XSubToolbarController > diff --git a/include/svx/theme/IThemeColorChanger.hxx b/include/svx/theme/IThemeColorChanger.hxx new file mode 100644 index 000000000000..5f90f273ee37 --- /dev/null +++ b/include/svx/theme/IThemeColorChanger.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 + +#include <svx/svxdllapi.h> +#include <svx/ColorSets.hxx> + +namespace svx +{ +class SVX_DLLPUBLIC IThemeColorChanger +{ +public: + virtual ~IThemeColorChanger() = default; + virtual void apply(svx::ColorSet const& rColorSet) = 0; +}; + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/unodraw/SvxTableShape.hxx b/include/svx/unodraw/SvxTableShape.hxx new file mode 100644 index 000000000000..518d3ac2c06a --- /dev/null +++ b/include/svx/unodraw/SvxTableShape.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <svx/unoshape.hxx> + +class SVXCORE_DLLPUBLIC SvxTableShape : public SvxShape +{ +protected: + // override these for special property handling in subcasses. Return true if property is handled + virtual bool setPropertyValueImpl(const OUString& rName, + const SfxItemPropertyMapEntry* pProperty, + const css::uno::Any& rValue) override; + virtual bool getPropertyValueImpl(const OUString& rName, + const SfxItemPropertyMapEntry* pProperty, + css::uno::Any& rValue) override; + + virtual void lock() override; + virtual void unlock() override; + +public: + explicit SvxTableShape(SdrObject* pObj); + virtual ~SvxTableShape() noexcept override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 3d3d5bea3a9b..144eee3780b9 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -606,6 +606,8 @@ public: bool createObject( const SvGlobalName &aClassName ); void createLink( const OUString& aLinkURL ); + + virtual OUString GetAndClearInitialFrameURL(); }; @@ -843,6 +845,8 @@ private: // override these for special property handling in subcasses. Return true if property is handled virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override; virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override; + bool getPropertyStateImpl(const SfxItemPropertyMapEntry* pProperty, + css::beans::PropertyState& rState) override; OUString referer_; }; diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx index ebc79e5ebee5..99d305644282 100644 --- a/include/svx/unoshprp.hxx +++ b/include/svx/unoshprp.hxx @@ -236,6 +236,7 @@ #define LINE_PROPERTIES_DEFAULTS\ { u"" UNO_NAME_LINECAP, XATTR_LINECAP, ::cppu::UnoType<css::drawing::LineCap>::get(), 0, 0}, \ { u"" UNO_NAME_LINECOLOR, XATTR_LINECOLOR, ::cppu::UnoType<sal_Int32>::get() , 0, 0}, \ + { u"" UNO_NAME_LINECOLOR_THEME_REFERENCE, XATTR_LINECOLOR, ::cppu::UnoType<css::uno::XInterface>::get() , 0, MID_COLOR_THEME_REFERENCE}, \ { u"" UNO_NAME_LINEENDCENTER, XATTR_LINEENDCENTER, cppu::UnoType<bool>::get() , 0, 0}, \ { u"" UNO_NAME_LINEENDWIDTH, XATTR_LINEENDWIDTH, ::cppu::UnoType<sal_Int32>::get() , 0, 0, PropertyMoreFlags::METRIC_ITEM}, \ { u"" UNO_NAME_LINEJOINT, XATTR_LINEJOINT, ::cppu::UnoType<css::drawing::LineJoint>::get(), 0, 0}, \ @@ -289,6 +290,10 @@ { u"" UNO_NAME_FILLTRANSPARENCEGRADIENT, XATTR_FILLFLOATTRANSPARENCE, ::cppu::UnoType<css::awt::Gradient>::get(), 0, MID_FILLGRADIENT}, \ { u"" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME, XATTR_FILLFLOATTRANSPARENCE, ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \ { u"" UNO_NAME_FILLCOLOR_2, XATTR_SECONDARYFILLCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \ + { u"" UNO_NAME_FILLCOLOR_THEME, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX}, \ + { u"" UNO_NAME_FILLCOLOR_LUM_MOD, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD}, \ + { u"" UNO_NAME_FILLCOLOR_LUM_OFF, XATTR_FILLCOLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF}, \ + { u"" UNO_NAME_FILLCOLOR_THEME_REFERENCE, XATTR_FILLCOLOR, ::cppu::UnoType<css::uno::XInterface>::get(), 0, MID_COLOR_THEME_REFERENCE}, \ { u"" UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP , ::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, #define EDGERADIUS_PROPERTIES \ @@ -320,6 +325,7 @@ { u"" UNO_NAME_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), 0, 0},\ { u"" UNO_NAME_TEXT_WORDWRAP, SDRATTR_TEXT_WORDWRAP, cppu::UnoType<bool>::get(), 0, 0}, \ { u"" UNO_NAME_TEXT_CHAINNEXTNAME, SDRATTR_TEXT_CHAINNEXTNAME, ::cppu::UnoType<OUString>::get(), 0, 0}, \ + { u"" UNO_NAME_TEXT_CLIPVERTOVERFLOW, SDRATTR_TEXT_CLIPVERTOVERFLOW, cppu::UnoType<bool>::get(), 0, 0}, \ { u"TextColumns", OWN_ATTR_TEXTCOLUMNS, cppu::UnoType<css::text::XTextColumns>::get(), 0, 0 }, \ SVX_UNOEDIT_CHAR_PROPERTIES, \ SVX_UNOEDIT_PARA_PROPERTIES, @@ -356,7 +362,7 @@ { u"" UNO_NAME_MISC_OBJ_SIZEPROTECT, SDRATTR_OBJSIZEPROTECT , cppu::UnoType<bool>::get(), 0, 0},\ { u"UINameSingular", OWN_ATTR_UINAME_SINGULAR , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \ { u"UINamePlural", OWN_ATTR_UINAME_PLURAL , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \ - { u"TextFitToSizeScale", OWN_ATTR_TEXTFITTOSIZESCALE, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \ + { u"TextFitToSizeScale", OWN_ATTR_TEXTFITTOSIZESCALE, ::cppu::UnoType<double>::get(), 0, 0}, \ /* #i68101# */ \ { u"" UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , ::cppu::UnoType<OUString>::get(), 0, 0}, \ { u"" UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , ::cppu::UnoType<OUString>::get(), 0, 0}, \ diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx index 9f35416b56ae..e3241016211e 100644 --- a/include/svx/xcolit.hxx +++ b/include/svx/xcolit.hxx @@ -21,17 +21,18 @@ #define INCLUDED_SVX_XCOLIT_HXX #include <tools/color.hxx> -#include <svx/svxdllapi.h> +#include <editeng/colritem.hxx> +#include <docmodel/theme/ThemeColor.hxx> +#include <svx/svxdllapi.h> #include <svx/xit.hxx> class XColorList; - - class SVXCORE_DLLPUBLIC XColorItem : public NameOrIndex { Color aColor; + model::ThemeColor maThemeColor; public: static SfxPoolItem* CreateDefault(); @@ -50,6 +51,10 @@ public: const Color& GetColorValue() const; void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); } + + model::ThemeColor& GetThemeColor() { return maThemeColor; } + const model::ThemeColor& GetThemeColor() const { return maThemeColor; } + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/test/lokcallback.hxx b/include/test/lokcallback.hxx index a3f383bcec5e..1908838a6cdf 100644 --- a/include/test/lokcallback.hxx +++ b/include/test/lokcallback.hxx @@ -34,11 +34,14 @@ public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) override; - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, - int nPart) override; + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, + int nMode) override; virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; + virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; + virtual void dumpState(rtl::OStringBuffer&) override{}; + virtual void Invoke() override; private: diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index a4f0ef30d8ba..e37638fa674c 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -62,6 +62,10 @@ protected: */ int getXPathPosition(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, std::string_view rChildName); /** + * Get the number of the nodes returned by the rXPath. + */ + int countXPathNodes(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); + /** * Assert that rXPath exists, and returns exactly one node. */ void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx index 82b30fe2676b..07e31409c0e9 100644 --- a/include/tools/urlobj.hxx +++ b/include/tools/urlobj.hxx @@ -915,6 +915,11 @@ public: void changeScheme(INetProtocol eTargetScheme); + // INetProtocol::Macro, INetProtocol::Uno, INetProtocol::Slot, + // vnd.sun.star.script, etc. All the types of URLs which shouldn't + // be accepted from an outside controlled source + bool IsExoticProtocol() const; + private: // General Structure: diff --git a/include/unotools/mediadescriptor.hxx b/include/unotools/mediadescriptor.hxx index 1e4b3c064d1c..9b9a5632ae77 100644 --- a/include/unotools/mediadescriptor.hxx +++ b/include/unotools/mediadescriptor.hxx @@ -86,6 +86,7 @@ class UNOTOOLS_DLLPUBLIC MediaDescriptor : public comphelper::SequenceAsHashMap static constexpr OUStringLiteral PROP_REFERRER = u"Referer"; static constexpr OUStringLiteral PROP_REPLACEABLE = u"Replaceable"; static constexpr OUStringLiteral PROP_SALVAGEDFILE = u"SalvagedFile"; + static constexpr OUStringLiteral PROP_SILENT = u"Silent"; static constexpr OUStringLiteral PROP_STATUSINDICATOR = u"StatusIndicator"; static constexpr OUStringLiteral PROP_STREAM = u"Stream"; static constexpr OUStringLiteral PROP_STREAMFOROUTPUT = u"StreamForOutput"; diff --git a/include/vbahelper/vbacollectionimpl.hxx b/include/vbahelper/vbacollectionimpl.hxx index c6a0b85aee75..201fbd01faa6 100644 --- a/include/vbahelper/vbacollectionimpl.hxx +++ b/include/vbahelper/vbacollectionimpl.hxx @@ -293,19 +293,28 @@ public: virtual css::uno::Any SAL_CALL Item(const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/) override { - if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING ) + OUString aStringSheet; + if (Index1.getValueTypeClass() == css::uno::TypeClass_DOUBLE) + { + // This is needed for ContentControls, where the unique integer ID + // can be passed as float to simulate a "by name" lookup. + double fIndex = 0; + Index1 >>= fIndex; + aStringSheet = OUString::number(fIndex); + } + else if (Index1.getValueTypeClass() != css::uno::TypeClass_STRING) { sal_Int32 nIndex = 0; - if ( !( Index1 >>= nIndex ) ) { throw css::lang::IndexOutOfBoundsException( "Couldn't convert index to Int32" ); } + return getItemByIntIndex( nIndex ); } - OUString aStringSheet; + else + Index1 >>= aStringSheet; - Index1 >>= aStringSheet; return getItemByStringIndex( aStringSheet ); } diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index fd4549cf99a8..bf8998755baa 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <basic/sbxmeth.hxx> #include <rtl/ustring.hxx> #include <sal/types.h> #include <tools/color.hxx> @@ -134,6 +135,9 @@ namespace ooo::vba VBAHELPER_DLLPUBLIC bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); + VBAHELPER_DLLPUBLIC bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, + SbxArray* pParameters); + class VBAHELPER_DLLPUBLIC Millimeter { //Factor to translate between points and hundredths of millimeters: diff --git a/include/vcl/DocWindow.hxx b/include/vcl/DocWindow.hxx new file mode 100644 index 000000000000..3153a0a6f4d3 --- /dev/null +++ b/include/vcl/DocWindow.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_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/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx index bb5480f1bf4f..d280aad3f006 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -13,11 +13,12 @@ #include <config_options.h> #include <vcl/dllapi.h> - #include <rtl/ustring.hxx> #include <vector> +namespace tools { class Rectangle; } + class SfxItemSet; namespace vcl @@ -38,6 +39,9 @@ public: const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0; virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0; + + /// Emits a LOK_CALLBACK_INVALIDATE_TILES. + virtual void notifyInvalidation(tools::Rectangle const *) const = 0; }; } // namespace vcl diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 3c0a4cacabe0..87975268c375 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -71,6 +71,14 @@ public: 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 @@ -119,6 +127,19 @@ public: 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. */ @@ -343,6 +364,19 @@ public: * 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(const OUString& /*rCommand*/) { return false; } + + /// Returns a json mapping of the possible values for the given command. + virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, const OString& /*rCommand*/) + { + } }; } // namespace vcl diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 52212f482253..1958fd728cc8 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -99,6 +99,8 @@ 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 diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx index a6797cc734bb..c59d7e4d0d2b 100644 --- a/include/vcl/ctrl.hxx +++ b/include/vcl/ctrl.hxx @@ -229,9 +229,8 @@ public: vcl::Font GetUnzoomedControlPointFont() const; void SetShowAccelerator (bool val); - void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override; - void LogicMouseButtonUp(const MouseEvent& rMouseEvent) override; - void LogicMouseMove(const MouseEvent& rMouseEvent) override; + /// Notify the LOK client about an invalidated area. + virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) override; }; #endif // INCLUDED_VCL_CTRL_HXX diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index e37555b36777..196608ee53a9 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -63,6 +63,7 @@ public: } 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(); } diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index c5f1766f60c0..305c7f3f9d2f 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -33,6 +33,7 @@ #include <vcl/pdf/PDFFillMode.hxx> #include <vcl/pdf/PDFFindFlags.hxx> #include <vcl/pdf/PDFErrorType.hxx> +#include <vcl/pdf/PDFFormFieldType.hxx> class SvMemoryStream; @@ -55,9 +56,12 @@ public: virtual const OUString& getLastError() const = 0; - virtual std::unique_ptr<PDFiumDocument> openDocument(const void* pData, int nSize) = 0; + virtual std::unique_ptr<PDFiumDocument> openDocument(const void* pData, int nSize, + const OString& rPassword) + = 0; virtual PDFErrorType getLastErrorCode() = 0; - virtual std::unique_ptr<PDFiumBitmap> createBitmap(int nWidth, int nHeight, int nAlpha) = 0; + /// createBitmap can reduce requested size to possible value + virtual std::unique_ptr<PDFiumBitmap> createBitmap(int& nWidth, int& nHeight, int nAlpha) = 0; }; class PDFiumPage; @@ -98,6 +102,11 @@ public: 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 getFormFieldValue(PDFiumDocument* pDoc) = 0; }; class PDFiumTextPage; @@ -187,6 +196,8 @@ public: virtual bool hasTransparency() = 0; virtual bool hasLinks() = 0; + + virtual void onAfterLoadPage(PDFiumDocument* pDoc) = 0; }; /// Represents one digital signature, as exposed by PDFium. diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx index aa0e8c67ea66..fbe0be89cdc6 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -576,6 +576,8 @@ public: //@{ /// 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. @@ -595,6 +597,8 @@ public: bool updateObject(sal_Int32 n) override; /// See vcl::PDFObjectContainer::writeBuffer(). bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) override; + void checkAndEnableStreamEncryption(sal_Int32 /*nObject*/) override {} + void disableStreamEncryption() override {} }; /// The trailer singleton is at the end of the doc. diff --git a/include/vcl/filter/pdfobjectcontainer.hxx b/include/vcl/filter/pdfobjectcontainer.hxx index ca4898737e10..f6614f09ea3d 100644 --- a/include/vcl/filter/pdfobjectcontainer.hxx +++ b/include/vcl/filter/pdfobjectcontainer.hxx @@ -28,6 +28,10 @@ public: // Write pBuffer to the end of the output. virtual bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) = 0; + virtual void checkAndEnableStreamEncryption(sal_Int32 nObject) = 0; + + virtual void disableStreamEncryption() = 0; + protected: ~PDFObjectContainer() noexcept = default; }; diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx index 2049d1e12a6f..4aa81ea1be30 100644 --- a/include/vcl/formatter.hxx +++ b/include/vcl/formatter.hxx @@ -117,6 +117,7 @@ protected: 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; @@ -181,7 +182,7 @@ public: 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; } + 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; } diff --git a/include/vcl/htmltransferable.hxx b/include/vcl/htmltransferable.hxx new file mode 100644 index 000000000000..2576c7e31bb4 --- /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/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index 6e388a6a3f79..9bccad3f1865 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -72,6 +72,16 @@ public: { rArea.m_aCommandHdl.Call(rCmd); } + + static void enter_page(weld::Notebook& rNotebook, const OString& rPage) + { + rNotebook.m_aEnterPageHdl.Call(rPage); + } + + static void leave_page(weld::Notebook& rNotebook, const OString& rPage) + { + rNotebook.m_aLeavePageHdl.Call(rPage); + } }; namespace jsdialog diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx index e68f176ffe32..fa54beefdb4f 100644 --- a/include/vcl/keycodes.hxx +++ b/include/vcl/keycodes.hxx @@ -154,6 +154,7 @@ 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_CAPSLOCK = css::awt::Key::CAPSLOCK; constexpr sal_uInt16 KEY_NUMLOCK = css::awt::Key::NUMLOCK; diff --git a/include/vcl/lok.hxx b/include/vcl/lok.hxx index 108f46def8aa..31a4cf1ec494 100644 --- a/include/vcl/lok.hxx +++ b/include/vcl/lok.hxx @@ -12,6 +12,7 @@ #include <sal/config.h> #include <vcl/dllapi.h> +#include <rtl/strbuf.hxx> #include <LibreOfficeKit/LibreOfficeKitTypes.h> namespace vcl::lok @@ -24,6 +25,8 @@ 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); + +void VCL_DLLPUBLIC dumpState(rtl::OStringBuffer& rState); } #endif // INCLUDE_VCL_LOK_HXX diff --git a/include/vcl/pdf/PDFFormFieldType.hxx b/include/vcl/pdf/PDFFormFieldType.hxx new file mode 100644 index 000000000000..96be9bffc188 --- /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/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 822b6870c89c..8bbf263a50cd 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ 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 @@ -193,6 +197,11 @@ public: Signature }; + enum FormatType + { + Text, Number, Time, Date + }; + enum ErrorCode { // transparent object occurred and was draw opaque because @@ -215,7 +224,7 @@ public: Error_Signature_Failed, }; - struct UNLESS_MERGELIBS(VCL_DLLPUBLIC) AnyWidget + struct VCL_DLLPUBLIC AnyWidget { WidgetType Type; // primitive RTTI public: @@ -286,7 +295,7 @@ public: ,TabOrder( rSource.TabOrder ) { } - AnyWidget& operator=( const AnyWidget& ); // never implemented + AnyWidget& operator=( const AnyWidget& ) = delete; // never implemented }; struct PushButtonWidget final : public AnyWidget @@ -329,7 +338,7 @@ public: } }; - struct CheckBoxWidget final : public AnyWidget + struct VCL_DLLPUBLIC CheckBoxWidget final : public AnyWidget { bool Checked; OUString OnValue; // the value of the checkbox if it is selected @@ -373,19 +382,26 @@ public: // in the group }; - struct EditWidget final : public AnyWidget + 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 ) + MaxLen( 0 ), + Format( FormatType::Text ) {} virtual std::shared_ptr<AnyWidget> Clone() const override @@ -394,7 +410,7 @@ public: } }; - struct ListBoxWidget final : public AnyWidget + struct VCL_DLLPUBLIC ListBoxWidget final : public AnyWidget { bool DropDown; bool MultiSelect; @@ -1202,8 +1218,6 @@ The following structure describes the permissions used in PDF security static OString GetDateTime(); }; -VCL_DLLPUBLIC void escapeStringXML( const OUString& rStr, OUString &rValue); - } #endif // INCLUDED_VCL_PDFWRITER_HXX diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 4762d1d64d57..440a5f4849d3 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -58,8 +58,12 @@ class DataChangedEvent; class Accelerator; class Help; class OutputDevice; -namespace vcl { class Window; } -namespace vcl { class KeyCode; } +namespace vcl { + class KeyCode; + class ILibreOfficeKitNotifier; + class Window; +} + class NotifyEvent; class KeyEvent; class MouseEvent; @@ -1330,7 +1334,7 @@ public: static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage, - bool bMobile = false); + const ILibreOfficeKitNotifier* pNotifier = nullptr); static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow); @@ -1342,6 +1346,8 @@ public: const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override; virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; + virtual void notifyInvalidation(tools::Rectangle const *) const override; + private: DECL_DLLPRIVATE_STATIC_LINK( Application, PostEventHandler, void*, void ); diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index 0fdf8a0e469c..38b81e438a65 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -198,7 +198,7 @@ class VCL_DLLPUBLIC SvTreeListBox Link<SvTreeListBox*,void> aSelectHdl; Link<SvTreeListBox*,void> aDeselectHdl; Link<const CommandEvent&, bool> aPopupMenuHdl; - Link<const HelpEvent&, bool> aTooltipHdl; + Link<SvTreeListEntry*, OUString> aTooltipHdl; Link<svtree_render_args, void> aCustomRenderHdl; Link<svtree_measure_args, Size> aCustomMeasureHdl; @@ -395,6 +395,8 @@ public: SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *); const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const; + OUString GetEntryTooltip(SvTreeListEntry* pEntry) const { return aTooltipHdl.Call(pEntry); } + bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); } bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); } void EndEditing( bool bCancel = false ); @@ -409,7 +411,7 @@ public: void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;} void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;} void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; } - void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { aTooltipHdl = rLink; } + void 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; } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index b45a97e1c5eb..5fdaa414df4b 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -220,6 +220,8 @@ public: 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()); @@ -459,6 +461,8 @@ public: class VCL_DLLPUBLIC Notebook : virtual public Widget { + friend class ::LOKTrigger; + protected: Link<const OString&, bool> m_aLeavePageHdl; Link<const OString&, void> m_aEnterPageHdl; @@ -553,6 +557,8 @@ public: // render the widget to an output device virtual VclPtr<VirtualDevice> screenshot() = 0; + + virtual const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() = 0; }; class VCL_DLLPUBLIC WaitObject @@ -1432,6 +1438,7 @@ public: 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; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 747b328d5505..14594b672f26 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1017,7 +1017,7 @@ public: void ReleaseMouse(); bool IsMouseCaptured() const; - void SetPointer( PointerStyle ); + virtual void SetPointer( PointerStyle ); PointerStyle GetPointer() const; void EnableChildPointerOverwrite( bool bOverwrite ); void SetPointerPosPixel( const Point& rPos ); @@ -1119,13 +1119,6 @@ public: /// Dumps itself and potentially its children to a property tree, to be written easily to JSON. virtual void DumpAsPropertyTree(tools::JsonWriter&); - /// Same as MouseButtonDown(), but coordinates are in logic unit. used for LOK - virtual void LogicMouseButtonDown(const MouseEvent&) {}; - /// Same as MouseButtonUp(), but coordinates are in logic unit. used for LOK - virtual void LogicMouseButtonUp(const MouseEvent&) {}; - /// Same as MouseMove(), but coordinates are in logic unit. used for LOK - virtual void LogicMouseMove(const MouseEvent&) {}; - /** @name Accessibility */ ///@{ @@ -1461,6 +1454,7 @@ public: 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); diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx index 89c2e6174335..c4f9a2f788fc 100644 --- a/include/xmloff/odffields.hxx +++ b/include/xmloff/odffields.hxx @@ -25,7 +25,6 @@ #define ODF_FORMCHECKBOX u"vnd.oasis.opendocument.field.FORMCHECKBOX" #define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText" -#define ODF_FORMCHECKBOX_NAME "Checkbox_Name" #define ODF_FORMCHECKBOX_RESULT "Checkbox_Checked" #define ODF_FORMDROPDOWN u"vnd.oasis.opendocument.field.FORMDROPDOWN" diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx index 37c0d7a9f330..986bbd007d8a 100644 --- a/include/xmloff/txtprmap.hxx +++ b/include/xmloff/txtprmap.hxx @@ -202,7 +202,7 @@ #define CTF_FILLSTYLE (XML_TEXT_CTF_START + 173) #define CTF_FILLCOLOR (XML_TEXT_CTF_START + 174) #define CTF_PAGENUMBEROFFSET (XML_TEXT_CTF_START + 175) - +#define CTF_THEME_COLOR (XML_TEXT_CTF_START + 176) enum class TextPropMap { TEXT = 0, diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index b0e9003b0261..888f57053dc8 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -287,6 +287,7 @@ namespace xmloff::token { XML_AUTHOR_NAME, XML_AUTO, XML_AUTO_COMPLETE, + XML_AUTO_CREATE_NEW_FRAME, XML_AUTO_GROW_HEIGHT, XML_AUTO_GROW_WIDTH, XML_AUTO_RELOAD, @@ -605,6 +606,7 @@ namespace xmloff::token { XML_DATA_STREAM_SOURCE, XML_DATA_STYLE, XML_DATA_STYLE_NAME, + XML_DATA_TABLE, XML_DATA_TYPE, XML_DATABASE_DISPLAY, XML_DATABASE_NAME, @@ -1217,6 +1219,7 @@ namespace xmloff::token { XML_LIST_STYLE, XML_LIST_STYLE_NAME, XML_LN, + XML_LOCK, XML_LOCKED, XML_LOG, XML_LOGARITHMIC, @@ -1450,6 +1453,7 @@ namespace xmloff::token { XML_OUTLINE_STYLE, XML_OUTSET, XML_OUTSIDE, + XML_OVERFLOW_BEHAVIOR, XML_OVERLAP, XML_OVERLAY, XML_P, @@ -1744,12 +1748,16 @@ namespace xmloff::token { XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME, XML_SHOW_CHANGES_BY_RANGES, XML_SHOW_CHANGES_BY_RANGES_LIST, + XML_SHOW_HORIZONTAL_BORDER, + XML_SHOW_KEYS, XML_SHOW_LOGO, XML_SHOW_REJECTED_CHANGES, XML_SHOW_SHAPE, XML_SHOW_TEXT, XML_SHOW_UNIT, XML_SHOW_VALUE, + XML_SHOW_VERTICAL_BORDER, + XML_SHOW_OUTLINE, XML_SHOWS, XML_SIDE_BY_SIDE, XML_SILVER, @@ -3415,7 +3423,7 @@ namespace xmloff::token { XML_RFC_LANGUAGE_TAG, XML_RFC_LANGUAGE_TAG_ASIAN, XML_RFC_LANGUAGE_TAG_COMPLEX, - // Chart data table properties + // (Obsolete) Chart data table properties XML_DATA_TABLE_SHOW_HORZ_BORDER, XML_DATA_TABLE_SHOW_VERT_BORDER, XML_DATA_TABLE_SHOW_OUTLINE, @@ -3467,6 +3475,21 @@ namespace xmloff::token { XML_LINKED_STYLE_NAME, + XML_THEME, + XML_CHAR_COLOR_THEME_REFERENCE, + XML_FILL_COLOR_THEME_REFERENCE, + XML_DK1, + XML_LT1, + XML_DK2, + XML_LT2, + XML_ACCENT1, + XML_ACCENT2, + XML_ACCENT3, + XML_ACCENT4, + XML_ACCENT5, + XML_ACCENT6, + XML_HLINK, + XML_FOLHLINK, XML_CONTENT_CONTROL, XML_SHOWING_PLACE_HOLDER, @@ -3476,6 +3499,9 @@ namespace xmloff::token { XML_PICTURE, XML_DATE_FORMAT, XML_DATE_RFC_LANGUAGE_TAG, + XML_PLAIN_TEXT, + XML_ALIAS, + XML_TAG, XML_TOKEN_END }; diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx index 625e3a5b9c68..4dbf2081db1b 100644 --- a/include/xmloff/xmltypes.hxx +++ b/include/xmloff/xmltypes.hxx @@ -153,6 +153,7 @@ #define XML_TYPE_NEG_PERCENT16 0x00002023 // (100-x) #define XML_TYPE_DOUBLE_PERCENT 0x00002024 // 50% (source is a double from 0.0 to 1.0) #define XML_TYPE_HEX 0x00002025 // 00544F1B +#define XML_TYPE_PERCENT100 0x00002026 // 100th percent // special basic types #define XML_TYPE_RECTANGLE_LEFT 0x00000100 // the Left member of an awt::Rectangle as a measure @@ -276,6 +277,7 @@ #define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112) #define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113) #define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114) +#define XML_TYPE_TEXT_OVERFLOW_BEHAVIOR (XML_TEXT_TYPES_START + 115) #define XML_TYPE_CHAR_SCRIPT (XML_TEXT_TYPES_START + 116) #define XML_TYPE_CHAR_RFC_LANGUAGE_TAG (XML_TEXT_TYPES_START + 117) @@ -293,6 +295,7 @@ #define XML_TYPE_GRAPHIC (XML_TEXT_TYPES_START + 127) #define XML_SW_TYPE_PRESPAGE_BACKSIZE (XML_TEXT_TYPES_START + 128) #define XML_SW_TYPE_RTLGUTTER (XML_TEXT_TYPES_START + 129) +#define XML_TYPE_THEME_COLOR (XML_TEXT_TYPES_START + 130) #endif // INCLUDED_XMLOFF_XMLTYPES_HXX |