2015-09-09 15:08:26 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
2015-09-24 07:39:16 +02:00
|
|
|
|
|
|
|
#ifndef INCLUDED_DESKTOP_INC_LIB_INIT_HXX
|
|
|
|
#define INCLUDED_DESKTOP_INC_LIB_INIT_HXX
|
|
|
|
|
2016-04-19 21:26:42 -04:00
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#include <osl/thread.h>
|
|
|
|
#include <vcl/idle.hxx>
|
2015-09-09 15:08:26 +03:00
|
|
|
#include <LibreOfficeKit/LibreOfficeKit.h>
|
2016-01-26 15:35:42 +01:00
|
|
|
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
|
2015-09-09 15:08:26 +03:00
|
|
|
#include <com/sun/star/frame/XStorable.hpp>
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
2016-04-19 21:26:42 -04:00
|
|
|
|
2015-11-25 16:50:22 +01:00
|
|
|
#include <desktop/dllapi.h>
|
2015-09-09 15:08:26 +03:00
|
|
|
|
2016-01-25 12:29:16 +01:00
|
|
|
class LOKInteractionHandler;
|
|
|
|
|
2015-09-09 15:08:26 +03:00
|
|
|
namespace desktop {
|
2016-04-19 21:26:42 -04:00
|
|
|
|
2016-06-09 12:17:18 +02:00
|
|
|
class DESKTOP_DLLPUBLIC CallbackFlushHandler : public Idle
|
2016-04-19 21:26:42 -04:00
|
|
|
{
|
|
|
|
public:
|
2016-06-16 15:55:43 +02:00
|
|
|
explicit CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData);
|
2016-06-09 12:17:18 +02:00
|
|
|
virtual ~CallbackFlushHandler();
|
|
|
|
virtual void Invoke() override;
|
|
|
|
static void callback(const int type, const char* payload, void* data);
|
|
|
|
void queue(const int type, const char* data);
|
|
|
|
void setPartTilePainting(const bool bPartPainting);
|
|
|
|
bool isPartTilePainting() const;
|
2016-05-06 08:16:00 -04:00
|
|
|
|
2016-04-19 21:26:42 -04:00
|
|
|
private:
|
2016-06-09 12:17:18 +02:00
|
|
|
void flush();
|
|
|
|
void removeAllButLast(const int type, const bool identical);
|
2016-04-30 14:29:37 -04:00
|
|
|
|
2016-04-30 12:48:52 -04:00
|
|
|
std::vector<std::pair<int, std::string>> m_queue;
|
2016-04-19 21:26:42 -04:00
|
|
|
std::map<int, std::string> m_states;
|
2016-06-16 15:55:43 +02:00
|
|
|
LibreOfficeKitDocument* m_pDocument;
|
2016-04-19 21:26:42 -04:00
|
|
|
LibreOfficeKitCallback m_pCallback;
|
|
|
|
void *m_pData;
|
2016-05-06 08:16:00 -04:00
|
|
|
bool m_bPartTilePainting;
|
2016-04-19 21:26:42 -04:00
|
|
|
std::mutex m_mutex;
|
|
|
|
};
|
|
|
|
|
2015-09-09 15:08:26 +03:00
|
|
|
struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument
|
|
|
|
{
|
2015-09-23 07:48:10 +02:00
|
|
|
css::uno::Reference<css::lang::XComponent> mxComponent;
|
2015-09-17 09:21:43 +01:00
|
|
|
std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
|
2016-06-09 14:17:57 +02:00
|
|
|
std::map<size_t, std::shared_ptr<CallbackFlushHandler>> mpCallbackFlushHandlers;
|
2015-09-09 15:08:26 +03:00
|
|
|
|
2015-09-23 07:48:10 +02:00
|
|
|
explicit LibLODocument_Impl(const css::uno::Reference <css::lang::XComponent> &xComponent);
|
2015-09-09 15:08:26 +03:00
|
|
|
~LibLODocument_Impl();
|
|
|
|
};
|
2015-09-25 01:06:31 +02:00
|
|
|
|
|
|
|
struct DESKTOP_DLLPUBLIC LibLibreOffice_Impl : public _LibreOfficeKit
|
|
|
|
{
|
|
|
|
OUString maLastExceptionMsg;
|
|
|
|
std::shared_ptr< LibreOfficeKitClass > m_pOfficeClass;
|
|
|
|
oslThread maThread;
|
|
|
|
LibreOfficeKitCallback mpCallback;
|
|
|
|
void *mpCallbackData;
|
2016-01-26 15:35:42 +01:00
|
|
|
int64_t mOptionalFeatures;
|
2016-01-25 12:29:16 +01:00
|
|
|
std::map<OString, rtl::Reference<LOKInteractionHandler>> mInteractionMap;
|
2015-09-25 01:06:31 +02:00
|
|
|
|
|
|
|
LibLibreOffice_Impl();
|
2016-01-25 12:29:16 +01:00
|
|
|
~LibLibreOffice_Impl();
|
2016-01-26 15:35:42 +01:00
|
|
|
|
|
|
|
bool hasOptionalFeature(LibreOfficeKitOptionalFeatures const feature)
|
|
|
|
{
|
|
|
|
return (mOptionalFeatures & feature) != 0;
|
|
|
|
}
|
2015-09-25 01:06:31 +02:00
|
|
|
};
|
2015-09-09 15:08:26 +03:00
|
|
|
}
|
2015-09-23 07:48:10 +02:00
|
|
|
|
2015-09-24 07:39:16 +02:00
|
|
|
#endif
|
|
|
|
|
2015-09-23 07:48:10 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|