/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_DESKTOP_INC_LIB_INIT_HXX #define INCLUDED_DESKTOP_INC_LIB_INIT_HXX #include #include #include #include #include #include #include #include #include #include class LOKInteractionHandler; namespace desktop { class DESKTOP_DLLPUBLIC CallbackFlushHandler : public Idle { public: explicit CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData); virtual ~CallbackFlushHandler() override; virtual void Invoke() override; static void callback(const int type, const char* payload, void* data); void queue(const int type, const char* data); /// When enabled events are queued but callback not invoked. void setEventLatch(const bool bEventLatch) { m_bEventLatch = bEventLatch; } bool isEventLatchOn() const { return m_bEventLatch; } void setPartTilePainting(const bool bPartPainting) { m_bPartTilePainting = bPartPainting; } bool isPartTilePainting() const { return m_bPartTilePainting; } void addViewStates(int viewId); void removeViewStates(int viewId); typedef std::vector> queue_type; private: void removeAll(const std::function& rTestFunc); queue_type m_queue; std::map m_states; std::unordered_map> m_viewStates; LibreOfficeKitDocument* m_pDocument; LibreOfficeKitCallback m_pCallback; void *m_pData; bool m_bPartTilePainting; bool m_bEventLatch; std::mutex m_mutex; }; struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument { css::uno::Reference mxComponent; std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass; std::map> mpCallbackFlushHandlers; explicit LibLODocument_Impl(const css::uno::Reference &xComponent); ~LibLODocument_Impl(); }; struct DESKTOP_DLLPUBLIC LibLibreOffice_Impl : public _LibreOfficeKit { OUString maLastExceptionMsg; std::shared_ptr< LibreOfficeKitClass > m_pOfficeClass; oslThread maThread; LibreOfficeKitCallback mpCallback; void *mpCallbackData; int64_t mOptionalFeatures; std::map> mInteractionMap; LibLibreOffice_Impl(); ~LibLibreOffice_Impl(); bool hasOptionalFeature(LibreOfficeKitOptionalFeatures const feature) { return (mOptionalFeatures & feature) != 0; } }; /// Helper function to extract the value from parameters delimited by /// comma, like: Name1=Value1,Name2=Value2,Name3=Value3. /// @param rOptions When extracted, the Param=Value is removed from it. DESKTOP_DLLPUBLIC OUString extractParameter(OUString& aOptions, const OUString& rName); } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */