13#include <unordered_map>
19#include <boost/property_tree/ptree.hpp>
20#include <boost/variant.hpp>
21#include <boost/container/flat_map.hpp>
23#include <osl/thread.h>
25#include <rtl/strbuf.hxx>
27#include <LibreOfficeKit/LibreOfficeKit.h>
28#include <LibreOfficeKit/LibreOfficeKitEnums.h>
29#include <com/sun/star/beans/PropertyValue.hpp>
30#include <com/sun/star/lang/XComponent.hpp>
70 +
", " + OString::number(
m_nPart) +
", " + OString::number(
m_nMode);
101 virtual void Invoke()
override;
103 void queue(
const int type,
const OString& data);
114 void addViewStates(
int viewId);
115 void removeViewStates(
int viewId);
120 virtual void libreOfficeKitViewCallback(
int nType,
const OString& pPayload)
override;
121 virtual void libreOfficeKitViewCallbackWithViewId(
int nType,
const OString& pPayload,
int nViewId)
override;
122 virtual void libreOfficeKitViewInvalidateTilesCallback(
const tools::Rectangle* pRect,
int nPart,
int nMode)
override;
123 virtual void libreOfficeKitViewUpdatedCallback(
int nType)
override;
124 virtual void libreOfficeKitViewUpdatedCallbackPerViewId(
int nType,
int nViewId,
int nSourceViewId)
override;
125 virtual void libreOfficeKitViewAddPendingInvalidateTiles()
override;
126 virtual void dumpState(rtl::OStringBuffer &rState)
override;
132 : PayloadString(payload)
137 : PayloadString(payload)
138 , PayloadObject(viewId)
152 const OString& getPayload()
const;
158 boost::property_tree::ptree& setJson(
const std::string& payload);
160 void setJson(
const boost::property_tree::ptree& rTree);
162 const boost::property_tree::ptree& getJson()
const;
164 int getViewId()
const;
168 return PayloadString.isEmpty() && PayloadObject.which() == 0;
172 PayloadString.clear();
173 PayloadObject = boost::blank();
177 bool validate()
const;
180 bool isCached()
const {
return PayloadObject.which() != 0; }
186 mutable boost::variant<boost::blank, RectangleAndPart, boost::property_tree::ptree, int>
PayloadObject;
193 bool removeAll(
int type);
194 bool removeAll(
int type,
const std::function<
bool (
const CallbackData&)>& rTestFunc);
195 bool processInvalidateTilesEvent(
int type,
CallbackData& aCallbackData);
196 bool processWindowEvent(
int type,
CallbackData& aCallbackData);
197 queue_type2::iterator
toQueue2(queue_type1::iterator);
198 queue_type2::reverse_iterator
toQueue2(queue_type1::reverse_iterator);
200 void enqueueUpdatedTypes();
201 void enqueueUpdatedType(
int type,
const SfxViewShell* sourceViewShell,
int viewId );
209 std::unordered_map<int, std::unordered_map<int, OString>>
m_viewStates;
217 void setUpdatedType(
int nType,
bool value );
218 void setUpdatedTypePerViewId(
int nType,
int nViewId,
int nSourceViewId,
bool value );
219 void resetUpdatedType(
int nType);
220 void resetUpdatedTypePerViewId(
int nType,
int nViewId );
240 virtual void Invoke()
override;
275 return (mOptionalFeatures & feature) != 0;
278 void dumpState(rtl::OStringBuffer &aState);
InteractionHandler is an interface that provides the user with various dialogs / error messages.
static const tools::Long MaxTwips
CallbackFlushHandler * mHandler
One instance of this per view, handles flushing callbacks.
LibreOfficeKitDocument * m_pDocument
queue_type2::reverse_iterator toQueue2(queue_type1::reverse_iterator)
std::vector< int > queue_type1
std::unordered_map< OString, OString > m_lastStateChange
std::unordered_map< int, std::unordered_map< int, OString > > m_viewStates
std::map< int, OString > m_states
std::vector< bool > m_updatedTypes
bool callbacksDisabled() const
Returns true iff callbacks are disabled.
queue_type2::iterator toQueue2(queue_type1::iterator)
std::vector< CallbackData > queue_type2
boost::container::flat_map< int, std::vector< PerViewIdData > > m_updatedTypesPerViewId
void disableCallbacks()
Disables callbacks on this handler.
LibreOfficeKitCallback m_pCallback
std::recursive_mutex m_mutex
queue_type1 m_queue1
we frequently want to scan the queue, and mostly when we do so, we only care about the element type s...
void setViewId(int viewId)
void enableCallbacks()
Enables callbacks on this handler.
TimeoutIdle m_TimeoutIdle
#define DESKTOP_DLLPUBLIC
std::unique_ptr< sal_Int32[]> pData
void set(css::uno::UnoInterfaceReference const &value)
DESKTOP_DLLPUBLIC OUString extractParameter(OUString &aOptions, std::u16string_view rName)
Helper function to extract the value from parameters delimited by comma, like: Name1=Value1,...
DESKTOP_DLLPUBLIC std::vector< com::sun::star::beans::PropertyValue > jsonToPropertyValuesVector(const char *pJSON)
Helper function to convert JSON to a vector of PropertyValues.
void dumpState(rtl::OStringBuffer &rState)
CallbackData(OString payload)
CallbackData(OString payload, int viewId)
CallbackData(const tools::Rectangle *pRect, int viewId)
bool isCached() const
Returns true iff there is cached data.
CallbackData(const tools::Rectangle *pRect, int part, int mode)
boost::variant< boost::blank, RectangleAndPart, boost::property_tree::ptree, int > PayloadObject
The parsed payload cache. Update validate() when changing this.
std::map< size_t, std::shared_ptr< CallbackFlushHandler > > mpCallbackFlushHandlers
std::set< OUString > maFontsMissing
std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass
css::uno::Reference< css::lang::XComponent > mxComponent
std::map< OString, rtl::Reference< LOKInteractionHandler > > mInteractionMap
int64_t mOptionalFeatures
OUString maLastExceptionMsg
LibreOfficeKitCallback mpCallback
std::shared_ptr< LibreOfficeKitClass > m_pOfficeClass
bool hasOptionalFeature(LibreOfficeKitOptionalFeatures const feature)
Represents an invalidated rectangle inside a given document part.
tools::Rectangle m_aRectangle
static constexpr tools::Rectangle emptyAllRectangle
static tools::Rectangle SanitizedRectangle(tools::Long nLeft, tools::Long nTop, tools::Long nWidth, tools::Long nHeight)
Makes sure a rectangle is valid (apparently some code does not like negative coordinates for example)...
RectangleAndPart(const tools::Rectangle *pRect, int nPart, int nMode)
static RectangleAndPart Create(const OString &rPayload)
bool isInfinite() const
Infinite Rectangle is both sides are equal or longer than SfxLokHelper::MaxTwips.
bool isEmpty() const
Empty Rectangle is when it has zero dimensions.