[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source svx/source
desktop/source/lib/init.cxx |2 include/LibreOfficeKit/LibreOfficeKitEnums.h | 31 libreofficekit/source/gtk/lokdocview.cxx |2 sfx2/source/view/viewsh.cxx | 836 --- svx/source/accessibility/ChildrenManagerImpl.cxx | 17 5 files changed, 642 insertions(+), 246 deletions(-) New commits: commit 76899152ec3d1924cc72d2b869e197a1e34a0a1a Author: Marco Cecchetti AuthorDate: Tue Oct 10 10:50:50 2023 +0200 Commit: Michael Meeks CommitDate: Tue Oct 24 11:33:43 2023 +0200 lok: a11y: impress: help screen reader to report shape selection Refactored LOKDocumentFocusListener::notifyEvent. Implemented 2 new callbacks: - LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: it says the client if editing in a shape or cell is active or it isn't. - LOK_CALLBACK_A11Y_SELECTION_CHANGED: it says if a shape has been selected/unselected, the name of the shape and text content are sent too for being reported by a screen reader. Change-Id: I644bcc7daeb8772805688a9bccdabd0631ce0a22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158343 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d4b507004a9d..17535c7cb3b2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1819,6 +1819,8 @@ void CallbackFlushHandler::queue(const int type, CallbackData& aCallbackData) case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: +case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: +case LOK_CALLBACK_A11Y_SELECTION_CHANGED: { const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), type); auto pos2 = toQueue2(pos); diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index ce093ff7a276..c17c6e811131 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -1001,7 +1001,32 @@ typedef enum * the user got in from the outer to the inner; row/column span default * value is 1; paragraph is the cell text content. */ -LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67 +LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67, + +/** + * Accessibility event: text editing in a shape or cell has been enabled/disabled + * + * { + * "cell": true/false (editing a cell ?) + * "enabled": true|false + * "selection": a selection description + * "paragraph": focused paragraph + * } + */ +LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE = 68, + +/** + * Accessibility event: a selection (of a shape/graphic, etc.) has changed + * + * { + * "cell": true/false (selected object is a cell ?) + * "action": "create"|"add"|"remove" + * "name": selected object name + * "text": text content if any + * } + */ +LOK_CALLBACK_A11Y_SELECTION_CHANGED = 69 + } LibreOfficeKitCallbackType; @@ -1166,6 +1191,10 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: return "LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED"; +case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: +return "LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE"; +case LOK_CALLBACK_A11Y_SELECTION_CHANGED: +return "LOK_CALLBACK_A11Y_SELECTION_CHANGED"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index c3df48448815..6c7e6dbfc652 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1494,6 +1494,8 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: +case LOK_CALLBACK_A11Y_SELECTION_CHANGED: { // TODO: Implement me break; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index a3b40dd8c7f8..b7023bf1843b 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -249,6 +249,29 @@ typedef std::list> XAccessibleTa namespace { +constexpr +bool isText(sal_Int16 nRole) +{ +return nRole == accessibility::AccessibleRole::DOCUMENT_TEXT; +} + +constexpr +bool isSpreadsheet(sal_Int16 nRole) +{ +return nRole == accessibility::AccessibleRole::DOCUMENT_SPREADSHEET; +} + +constexpr +bool isPresentation(sal_Int16 nRole) +{ +return nRole == accessibility::AccessibleRole::DOCUMENT_PRESENTATION; +} + +constexpr
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit
desktop/source/lib/init.cxx | 111 +- include/LibreOfficeKit/LibreOfficeKit.h |6 - include/LibreOfficeKit/LibreOfficeKit.hxx | 20 ++--- 3 files changed, 48 insertions(+), 89 deletions(-) New commits: commit 3d23034a85a9a07efd146ff488ffb19f73e90353 Author: Caolán McNamara AuthorDate: Fri Sep 29 12:12:10 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Sep 29 15:11:14 2023 +0200 make FunctionBasedURPConnection simpler and leave it to the client how it wants to read/provide the data Change-Id: Ibd4d967b79a699c96d1ea8529544b585a97cc0c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157326 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5ad95cfd1632..3bd6fa10fe68 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2584,10 +2584,10 @@ static char* lo_extractRequest(LibreOfficeKit* pThis, static void lo_trimMemory(LibreOfficeKit* pThis, int nTarget); -static int -lo_startURP(LibreOfficeKit* pThis, void* pReceiveURPFromLOContext, void** pSendURPToLOContext, +static void* +lo_startURP(LibreOfficeKit* pThis, void* pReceiveURPFromLOContext, void* pSendURPToLOContext, int (*fnReceiveURPFromLO)(void* pContext, const signed char* pBuffer, int nLen), -int (**pfnSendURPToLO)(void* pContext, const signed char* pBuffer, int nLen)); +int (*fnSendURPToLO)(void* pContext, signed char* pBuffer, int nLen)); static void lo_stopURP(LibreOfficeKit* pThis, void* pSendURPToLOContext); @@ -3273,39 +3273,39 @@ Reference FunctionBasedURPInstanceProvider::getInstance(const OUStri class FunctionBasedURPConnection : public cppu::WeakImplHelper { public: -explicit FunctionBasedURPConnection(void*, int (*)(void* pContext, const signed char* pBuffer, - int nLen)); +explicit FunctionBasedURPConnection(void*, int (*)(void* pContext, const signed char* pBuffer, int nLen), +void*, int (*)(void* pContext, signed char* pBuffer, int nLen)); ~FunctionBasedURPConnection(); // These overridden member functions use "read" and "write" from the point of view of LO, // i.e. the opposite to how startURP() uses them. -virtual sal_Int32 SAL_CALL read(Sequence& aReadBytes, +virtual sal_Int32 SAL_CALL read(Sequence& rReadBytes, sal_Int32 nBytesToRead) override; virtual void SAL_CALL write(const Sequence& aData) override; virtual void SAL_CALL flush() override; virtual void SAL_CALL close() override; virtual OUString SAL_CALL getDescription() override; void setBridge(Reference); -int addClientURPToBuffer(const signed char* pBuffer, int nLen); void* getContext(); inline static int g_connectionCount = 0; private: -std::shared_ptr> m_pBuffer; void* m_pRecieveFromLOContext; +void* m_pSendURPToLOContext; int (*m_fnReceiveURPFromLO)(void* pContext, const signed char* pBuffer, int nLen); +int (*m_fnSendURPToLO)(void* pContext, signed char* pBuffer, int nLen); Reference m_URPBridge; -std::atomic m_closed = false; -std::condition_variable m_URPInBuffer; -std::mutex m_bufferMutex; }; FunctionBasedURPConnection::FunctionBasedURPConnection( void* pRecieveFromLOContext, -int (*fnRecieveFromLO)(void* pContext, const signed char* pBuffer, int nLen)) -: m_pBuffer(std::make_shared>()) -, m_pRecieveFromLOContext(pRecieveFromLOContext) -, m_fnReceiveURPFromLO(fnRecieveFromLO) +int (*fnReceiveURPFromLO)(void* pContext, const signed char* pBuffer, int nLen), +void* pSendURPToLOContext, +int (*fnSendURPToLO)(void* pContext, signed char* pBuffer, int nLen)) +: m_pRecieveFromLOContext(pRecieveFromLOContext) +, m_pSendURPToLOContext(pSendURPToLOContext) +, m_fnReceiveURPFromLO(fnReceiveURPFromLO) +, m_fnSendURPToLO(fnSendURPToLO) { g_connectionCount++; } @@ -3316,62 +3316,23 @@ FunctionBasedURPConnection::~FunctionBasedURPConnection() xComp->dispose(); // TODO: check this doesn't deadlock } -int sendURPToLO(void* pContext /* FunctionBasedURPConnection* */, const signed char* pBuffer, -int nLen) -{ -return static_cast(pContext)->addClientURPToBuffer(pBuffer, nLen); -} - -int FunctionBasedURPConnection::addClientURPToBuffer(const signed char* pBuffer, int nLen) -{ -{ -std::scoped_lock lock(m_bufferMutex); - -if (m_closed) -{ -// We can't write URP to a closed connection -SAL_WARN("lok.urp", "A client attempted to write URP to a closed " -"FunctionBasedURPConnection... ignoring"); -return 0; -} -m_pBuffer->insert(m_pBuffer->end(), pBuffer, pBuffer + nLen); -
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source
desktop/source/lib/init.cxx |2 include/LibreOfficeKit/LibreOfficeKitEnums.h | 44 +++- libreofficekit/source/gtk/lokdocview.cxx |1 sfx2/source/view/viewsh.cxx | 279 --- 4 files changed, 301 insertions(+), 25 deletions(-) New commits: commit b6be63f1d3971598093acacbacc8698420a3fa17 Author: Marco Cecchetti AuthorDate: Wed Jun 7 14:03:56 2023 +0200 Commit: Marco Cecchetti CommitDate: Wed Aug 9 09:29:59 2023 +0200 lok: a11y: when we are inside a table notify table and current cell info When we get in one or more tables we notify row and column count. When we get out one or more table we notify we are leaving a table. When the fosused cell changes we notify the new row/col index. The paragraph content is notified together with table info, so that client has some opportunity for getting the screen reader to report together content and table info. Change-Id: Ic524259aa1879a70fc3de2467bdee27475352b7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155282 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-by: Marco Cecchetti diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 62107c0f7e57..abf346cbc969 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1805,6 +1805,7 @@ void CallbackFlushHandler::queue(const int type, CallbackData& aCallbackData) case LOK_CALLBACK_A11Y_FOCUS_CHANGED: case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: +case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: { const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), type); @@ -1867,6 +1868,7 @@ void CallbackFlushHandler::queue(const int type, CallbackData& aCallbackData) case LOK_CALLBACK_A11Y_FOCUS_CHANGED: case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: +case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: { if (removeAll(type)) diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index c7e65a63c796..b5c5d5c44d97 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -924,14 +924,17 @@ typedef enum LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR = 61, /** - * Accessibility event: a paragraph get focus. + * Accessibility event: a paragraph got focus. * The payload is a json with the following structure. * * { * "content": "" * "position": N + * "start": N1 + * "end": N2 * } - * where N is the position of the text cursor inside the focused paragraph. + * where N is the position of the text cursor inside the focused paragraph, + * and [N1,N2] is the range of the text selection inside the focused paragraph. */ LOK_CALLBACK_A11Y_FOCUS_CHANGED = 62, @@ -946,7 +949,7 @@ typedef enum LOK_CALLBACK_A11Y_CARET_CHANGED = 63, /** - * Accessibility event: text cursor position has changed. + * Accessibility event: text selection has changed. * * { * "start": N1 @@ -965,7 +968,38 @@ typedef enum * Informs that the document password has been succesfully changed. * The payload contains the the new password and the type. */ -LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66, + +/** + * Accessibility event: a cell got focus. + * The payload is a json with the following structure. + * + * { + * "outCount": + * "inList": [ + * { + * "rowCount": + * "colCount": + * }, + * ... + * { + * "rowCount": + * "colCount": + * } + * ] + * "row": + * "col": + * "rowSpan": + * "colSpan": + * "paragraph": { + * + *} + * } + * where row/column indexes start from 0, inList is the list of tables + * the user got in from the outer to the inner; row/column span default + * value is 1; paragraph is the cell text content. + */ +LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67 } LibreOfficeKitCallbackType; @@ -1128,6 +1162,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_COLOR_PALETTES"; case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; +case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED: +return
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit
desktop/source/lib/init.cxx | 102 +++--- include/LibreOfficeKit/LibreOfficeKit.h | 12 --- include/LibreOfficeKit/LibreOfficeKit.hxx | 28 3 files changed, 25 insertions(+), 117 deletions(-) New commits: commit 5fb42a705b25a19cef8384730630385409e5f2ba Author: Tor Lillqvist AuthorDate: Wed Apr 26 15:39:38 2023 +0300 Commit: Tor Lillqvist CommitDate: Thu Apr 27 12:04:55 2023 +0200 Bin the unused paintTileToCGContext special thing for iOS It was used by "LibreOfficeLight" which died years ago. Change-Id: I71a1315448baa4f1ec7a22b20cb3dd39c88cda78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151081 Tested-by: Tor Lillqvist Reviewed-by: Tor Lillqvist diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 31477dd7588c..949af11504ed 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1125,13 +1125,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight); -#ifdef IOS -static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, - void* rCGContext, - const int nCanvasWidth, const int nCanvasHeight, - const int nTilePosX, const int nTilePosY, - const int nTileWidth, const int nTileHeight); -#endif static void doc_paintPartTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nPart, @@ -1398,9 +1391,6 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference xC m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->getEditMode = doc_getEditMode; m_pDocumentClass->paintTile = doc_paintTile; -#ifdef IOS -m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext; -#endif m_pDocumentClass->paintPartTile = doc_paintPartTile; m_pDocumentClass->getTileMode = doc_getTileMode; m_pDocumentClass->getDocumentSize = doc_getDocumentSize; @@ -2592,41 +2582,6 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl() namespace { -#ifdef IOS -void paintTileToCGContext(ITiledRenderable* pDocument, - void* rCGContext, const Size nCanvasSize, - const int nTilePosX, const int nTilePosY, - const int nTileWidth, const int nTileHeight) -{ -SystemGraphicsData aData; -aData.rCGContext = reinterpret_cast(rCGContext); - -ScopedVclPtrInstance pDevice(aData, Size(1, 1), DeviceFormat::DEFAULT); -pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); -pDevice->SetOutputSizePixel(nCanvasSize); -pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(), -nTilePosX, nTilePosY, nTileWidth, nTileHeight); -} - -void paintTileIOS(LibreOfficeKitDocument* pThis, - unsigned char* pBuffer, - const int nCanvasWidth, const int nCanvasHeight, const double fDPIScale, - const int nTilePosX, const int nTilePosY, - const int nTileWidth, const int nTileHeight) -{ -CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8, -nCanvasWidth * 4, CGColorSpaceCreateDeviceRGB(), - kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little); - -CGContextTranslateCTM(pCGContext, 0, nCanvasHeight); -CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale); - -doc_paintTileToCGContext(pThis, (void*) pCGContext, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); - -CGContextRelease(pCGContext); -} -#endif - void setLanguageAndLocale(OUString const & aLangISO) { SvtSysLocaleOptions aLocalOptions; @@ -3940,8 +3895,31 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, comphelper::ScopeGuard dpiScaleGuard([]() { comphelper::LibreOfficeKit::setDPIScale(1.0); }); #if defined(IOS) -double fDPIScaleX = 1.0; -paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, nTilePosX, nTilePosY, nTileWidth, nTileHeight); +double fDPIScale = 1.0; + +CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8, +nCanvasWidth * 4, CGColorSpaceCreateDeviceRGB(), + kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little); + +CGContextTranslateCTM(pCGContext, 0, nCanvasHeight); +CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale); + +SAL_INFO( "lok.tiledrendering",
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit vcl/source
desktop/source/lib/init.cxx |1 + include/LibreOfficeKit/LibreOfficeKit.h |2 +- vcl/source/app/svapp.cxx|4 ++-- vcl/source/gdi/impgraph.cxx | 11 +-- vcl/source/graphic/Manager.cxx |3 +-- 5 files changed, 14 insertions(+), 7 deletions(-) New commits: commit 8fd1dacbc4fdb586ea9c7bc0f405641eb3058e04 Author: Michael Meeks AuthorDate: Sat Mar 11 15:56:04 2023 + Commit: Michael Meeks CommitDate: Sat Mar 11 21:06:00 2023 + lok: cleanup trimMemory capability, and expand dumpState to caches. Being able to trigger some more aggressive memory saving is useful in for both online and mobile. Signed-off-by: Michael Meeks Change-Id: If740469a59e7e1896e5952dbcd28742446c7559d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148684 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 28849bb4161e..07bb6be18fa0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2567,6 +2567,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() m_pOfficeClass->setOption = lo_setOption; m_pOfficeClass->dumpState = lo_dumpState; m_pOfficeClass->extractRequest = lo_extractRequest; +m_pOfficeClass->trimMemory = lo_trimMemory; gOfficeClass = m_pOfficeClass; } diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 219013f6fb9f..e98ea6f47f42 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -119,7 +119,7 @@ struct _LibreOfficeKitClass /// @see lok::Office::setOption void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* pValue); -/// @see lok::Document::dumpState +/// @see lok::Office::dumpState /// @since LibreOffice 7.5 void (*dumpState) (LibreOfficeKit* pThis, const char* pOptions, char** pState); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index adc98af951ef..5359ac139532 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1887,8 +1887,8 @@ void trimMemory(int nTarget) return; pSVData->dropCaches(); vcl::graphic::Manager::get().dropCache(); -// free up any deeper dirtied thread stacks. -comphelper::ThreadPool::getSharedOptimalPool().shutdown(); +// TODO: ideally - free up any deeper dirtied thread stacks. +// comphelper::ThreadPool::getSharedOptimalPool().shutdown(); } // else for now caches re-fill themselves as/when used. } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 6011e17feb75..3b8029b362de 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1424,6 +1424,9 @@ void ImpGraphic::updateFromLoadedGraphic(const ImpGraphic* pGraphic) void ImpGraphic::dumpState(rtl::OStringBuffer ) { +if (meType == GraphicType::NONE && mnSizeBytes == 0) +return; // uninteresting. + rState.append("\n\t"); if (mbSwapOut) @@ -1433,8 +1436,12 @@ void ImpGraphic::dumpState(rtl::OStringBuffer ) rState.append(static_cast(meType)); rState.append("\tsize:\t"); -rState.append(static_cast(mnSizeBytes/1024)); -rState.append("\tkb\t"); +rState.append(static_cast(mnSizeBytes)); +rState.append("\t"); +rState.append(static_cast(maSwapInfo.maSizePixel.Width())); +rState.append("x"); +rState.append(static_cast(maSwapInfo.maSizePixel.Height())); +rState.append("\t"); rState.append(static_cast(maExPrefSize.Width())); rState.append("x"); rState.append(static_cast(maExPrefSize.Height())); diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx index 80aac3948cc6..d43a617a7272 100644 --- a/vcl/source/graphic/Manager.cxx +++ b/vcl/source/graphic/Manager.cxx @@ -92,7 +92,7 @@ void Manager::loopGraphicsAndSwapOut(std::unique_lock& rGuard, bool continue; sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic); -if (nCurrentGraphicSize > 10) +if (nCurrentGraphicSize > 10 || bDropAll) { if (!pEachImpGraphic->mpContext) { @@ -166,7 +166,6 @@ void Manager::dumpState(rtl::OStringBuffer ) rState.append(static_cast(mnUsedSize/1024)); rState.append("\tkb"); -sal_Int32 i = 0; for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList) { pEachImpGraphic->dumpState(rState);
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit
desktop/source/lib/init.cxx | 23 +-- include/LibreOfficeKit/LibreOfficeKit.h |7 +-- include/LibreOfficeKit/LibreOfficeKit.hxx | 24 ++-- 3 files changed, 48 insertions(+), 6 deletions(-) New commits: commit f8ab2cd237ce862d113e7782ca68513631ba2258 Author: Tor Lillqvist AuthorDate: Tue Feb 28 18:23:06 2023 +0200 Commit: Tor Lillqvist CommitDate: Wed Mar 1 09:12:17 2023 + Improve the LibreOfficeKit Document::paintThumbnail() API No implementation yet. Change-Id: Ie1dc955bc8b589bd336af0545a2270cbe84a8b9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148028 Tested-by: Jenkins Reviewed-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148031 Tested-by: Tor Lillqvist diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 452ae0b60a64..fa2494f9ca18 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1115,7 +1115,12 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight); -static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int x, int y); +static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, + unsigned char* pBuffer, + int bufferWidth, + int bufferHeight, + int width, + const char* pURL); #ifdef IOS static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, void* rCGContext, @@ -4011,8 +4016,14 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, #endif -static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int x, int y) +static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, + unsigned char* pBuffer, + int bufferWidth, + int bufferHeight, + int width, + const char* pURL) { +#if 0 constexpr float zoom = 0.5f; constexpr int pixelWidth = 120; constexpr int pixelHeight = 120; @@ -4022,6 +4033,14 @@ static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* pBu constexpr int offsetYTwips = 15 * 15; doc_paintTile(pThis, pBuffer, pixelWidth, pixelHeight, x-offsetXTwips, y-offsetYTwips, pixelWidthTwips, pixelHeightTwips); +#else +(void) pThis; +(void) pBuffer; +(void) bufferWidth; +(void) bufferHeight; +(void) width; +(void) pURL; +#endif } static void doc_paintPartTile(LibreOfficeKitDocument* pThis, diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 4de2380998b4..09d3e91e8640 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -501,10 +501,13 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::setViewTimezone(). void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const char* timezone); +/// @see lok::Document::paintThumbnail(). void (*paintThumbnail) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, -int x, -int y); +int bufferWidth, +int bufferHeight, +int width, +const char* pURL); #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 17fc518fbe13..04a3b82e6eca 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -886,9 +886,29 @@ public: mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone); } -void paintThumbnail(unsigned char* pBuffer, int x, int y) +/** + * Create a thumbnail of a location in the document. + * + * @param pBuffer Where the thumbnail is painted. Same format as a tile painted + * by paintTile(). + * @param bufferWidth number of pixels in a row of pBuffer. + * @param bufferHeight number of pixels in a column of pBuffer. + * @param width logical width of the rendered rectangle, in TWIPs. + * @param pURL Just the fragment part of a URL, indicating the location in the document + * to render as a thumbnail. As returned by extractRequest(), or null, meaning the start + * of the document. + * + * Note that there is no parameter for the logical height of the + *
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/LibreOfficeKit
desktop/source/lib/init.cxx | 10 ++ include/LibreOfficeKit/LibreOfficeKitInit.h |4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) New commits: commit 9b59231edf524e359ae5bb92517c9f9a98b86030 Author: Tor Lillqvist AuthorDate: Mon Dec 12 17:59:30 2022 +0200 Commit: Tor Lillqvist CommitDate: Fri Feb 24 07:54:12 2023 + Attempt to add ifdefs for WASM (Emscripten) for LOKit-based code Change-Id: I5b2556d1be61fa3a1d7996ce8d61958fbe7984c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144002 Tested-by: Jenkins Reviewed-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147557 Tested-by: Tor Lillqvist diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 399a42159cc3..72fab196c38a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7142,7 +7142,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/, LibreOfficeKitWakeCallback pWakeCallback, void* pData) { -#if defined(IOS) || defined(ANDROID) +#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__) Application::GetSolarMutex().acquire(); #endif @@ -7153,7 +7153,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/, Application::UpdateMainThread(); soffice_main(); } -#if defined(IOS) || defined(ANDROID) +#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__) vcl::lok::unregisterPollCallbacks(); Application::ReleaseSolarMutex(); #endif @@ -7536,6 +7536,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char { #ifdef ANDROID aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program"; +#elif defined __EMSCRIPTEN__ +aAppPath = OUString::fromUtf8("instdir/program"); #else // Fun conversion dance back and forth between URLs and system paths... OUString aAppURL; @@ -7732,8 +7734,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char comphelper::ThreadPool::getSharedOptimalPool().shutdown(); } -// Turn off quick editing on IOS and ANDROID -#if defined IOS || defined ANDROID +// Turn off quick editing on iOS, Android and Emscripten +#if defined IOS || defined ANDROID || defined __EMSCRIPTEN__ if (officecfg::Office::Impress::Misc::TextObject::QuickEditing::get()) { std::shared_ptr batch(comphelper::ConfigurationChanges::create()); diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h index 08feb42c1e18..506f373c5108 100644 --- a/include/LibreOfficeKit/LibreOfficeKitInit.h +++ b/include/LibreOfficeKit/LibreOfficeKitInit.h @@ -259,13 +259,13 @@ typedef int (LokHookPreInit) ( const char *install_path, const char typedef int (LokHookPreInit2) ( const char *install_path, const char *user_profile_url, LibreOfficeKit** kit); -#if defined(IOS) || defined(ANDROID) +#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__) LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path); #endif static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_url ) { -#if !defined(IOS) && !defined(ANDROID) +#if !defined(IOS) && !defined(ANDROID) && !defined(__EMSCRIPTEN__) void *dlhandle; char *imp_lib; LokHookFunction *pSym;