LibreOffice Module desktop (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
desktop::CallbackFlushHandler Class Referencefinal

One instance of this per view, handles flushing callbacks. More...

#include <init.hxx>

Inheritance diagram for desktop::CallbackFlushHandler:
[legend]
Collaboration diagram for desktop::CallbackFlushHandler:
[legend]

Classes

struct  CallbackData
 
struct  PerViewIdData
 
class  TimeoutIdle
 

Public Member Functions

 CallbackFlushHandler (LibreOfficeKitDocument *pDocument, LibreOfficeKitCallback pCallback, void *pData)
 
virtual ~CallbackFlushHandler () override
 
virtual void Invoke () override
 
void queue (const int type, const OString &data)
 
void disableCallbacks ()
 Disables callbacks on this handler. More...
 
void enableCallbacks ()
 Enables callbacks on this handler. More...
 
bool callbacksDisabled () const
 Returns true iff callbacks are disabled. More...
 
void addViewStates (int viewId)
 
void removeViewStates (int viewId)
 
void setViewId (int viewId)
 
virtual void libreOfficeKitViewCallback (int nType, const OString &pPayload) override
 
virtual void libreOfficeKitViewCallbackWithViewId (int nType, const OString &pPayload, int nViewId) 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 &rState) override
 
- Public Member Functions inherited from Idle
 Idle (const char *pDebugName)
 
virtual void Start (bool bStartTimer=true) override
 
- Public Member Functions inherited from Timer
 Timer (const char *pDebugName)
 
 Timer (const Timer &rTimer)
 
virtual ~Timer () override
 
Timeroperator= (const Timer &rTimer)
 
virtual void Invoke () override
 
void Invoke (Timer *arg)
 
void SetInvokeHandler (const Link< Timer *, void > &rLink)
 
void ClearInvokeHandler ()
 
void SetTimeout (sal_uInt64 nTimeoutMs)
 
sal_uInt64 GetTimeout () const
 
virtual void Start (bool bStartTimer=true) override
 
- Public Member Functions inherited from Task
 Task (const char *pDebugName)
 
 Task (const Task &rTask)
 
virtual ~Task () COVERITY_NOEXCEPT_FALSE
 
Taskoperator= (const Task &rTask)
 
void SetPriority (TaskPriority ePriority)
 
TaskPriority GetPriority () const
 
const char * GetDebugName () const
 
virtual void Invoke ()=0
 
virtual void Start (bool bStartTimer=true)
 
void Stop ()
 
bool IsActive () const
 
void SetStatic ()
 
bool IsStatic () const
 
- Public Member Functions inherited from SfxLokCallbackInterface
virtual ~SfxLokCallbackInterface ()
 
virtual void libreOfficeKitViewCallback (int nType, const rtl::OString &pPayload)=0
 
virtual void libreOfficeKitViewCallbackWithViewId (int nType, const rtl::OString &pPayload, int nViewId)=0
 
virtual void libreOfficeKitViewInvalidateTilesCallback (const tools::Rectangle *pRect, int nPart, int nMode)=0
 
virtual void libreOfficeKitViewUpdatedCallback (int nType)=0
 
virtual void libreOfficeKitViewUpdatedCallbackPerViewId (int nType, int nViewId, int nSourceViewId)=0
 
virtual void libreOfficeKitViewAddPendingInvalidateTiles ()=0
 
virtual void dumpState (rtl::OStringBuffer &rState)=0
 

Private Types

typedef std::vector< intqueue_type1
 
typedef std::vector< CallbackDataqueue_type2
 

Private Member Functions

void startTimer ()
 
bool removeAll (int type)
 
bool removeAll (int type, const std::function< bool(const CallbackData &)> &rTestFunc)
 
bool processInvalidateTilesEvent (int type, CallbackData &aCallbackData)
 
bool processWindowEvent (int type, CallbackData &aCallbackData)
 
queue_type2::iterator toQueue2 (queue_type1::iterator)
 
queue_type2::reverse_iterator toQueue2 (queue_type1::reverse_iterator)
 
void queue (const int type, CallbackData &data)
 
void enqueueUpdatedTypes ()
 
void enqueueUpdatedType (int type, const SfxViewShell *sourceViewShell, int viewId)
 
void setUpdatedType (int nType, bool value)
 
void setUpdatedTypePerViewId (int nType, int nViewId, int nSourceViewId, bool value)
 
void resetUpdatedType (int nType)
 
void resetUpdatedTypePerViewId (int nType, int nViewId)
 

Private Attributes

queue_type1 m_queue1
 we frequently want to scan the queue, and mostly when we do so, we only care about the element type so we split the queue in 2 to make the scanning cache friendly. More...
 
queue_type2 m_queue2
 
std::map< int, OString > m_states
 
std::unordered_map< OString, OString > m_lastStateChange
 
std::unordered_map< int, std::unordered_map< int, OString > > m_viewStates
 
std::vector< bool > m_updatedTypes
 
boost::container::flat_map< int, std::vector< PerViewIdData > > m_updatedTypesPerViewId
 
LibreOfficeKitDocument * m_pDocument
 
int m_viewId = -1
 
LibreOfficeKitCallback m_pCallback
 
void * m_pData
 
int m_nDisableCallbacks
 
std::recursive_mutex m_mutex
 
TimeoutIdle m_TimeoutIdle
 

Additional Inherited Members

- Protected Member Functions inherited from Idle
virtual sal_uInt64 UpdateMinPeriod (sal_uInt64 nTimeNow) const override
 
 Idle (bool bAuto, const char *pDebugName)
 
- Protected Member Functions inherited from Timer
virtual void SetDeletionFlags () override
 
virtual sal_uInt64 UpdateMinPeriod (sal_uInt64 nTimeNow) const override
 
 Timer (bool bAuto, const char *pDebugName)
 
- Protected Member Functions inherited from Task
const ImplSchedulerDataGetSchedulerData () const
 
virtual void SetDeletionFlags ()
 
virtual sal_uInt64 UpdateMinPeriod (sal_uInt64 nTimeNow) const=0
 
- Static Protected Member Functions inherited from Task
static void StartTimer (sal_uInt64 nMS)
 

Detailed Description

One instance of this per view, handles flushing callbacks.

Definition at line 96 of file init.hxx.

Member Typedef Documentation

◆ queue_type1

typedef std::vector<int> desktop::CallbackFlushHandler::queue_type1
private

Definition at line 189 of file init.hxx.

◆ queue_type2

Definition at line 190 of file init.hxx.

Constructor & Destructor Documentation

◆ CallbackFlushHandler()

CallbackFlushHandler::CallbackFlushHandler ( LibreOfficeKitDocument *  pDocument,
LibreOfficeKitCallback  pCallback,
void *  pData 
)
explicit

Definition at line 1540 of file init.cxx.

References m_states, pData, and Task::SetPriority().

◆ ~CallbackFlushHandler()

CallbackFlushHandler::~CallbackFlushHandler ( )
overridevirtual

Definition at line 1568 of file init.cxx.

References Task::Stop().

Member Function Documentation

◆ addViewStates()

void CallbackFlushHandler::addViewStates ( int  viewId)

Definition at line 2506 of file init.cxx.

References m_viewStates, and result.

◆ callbacksDisabled()

bool desktop::CallbackFlushHandler::callbacksDisabled ( ) const
inline

Returns true iff callbacks are disabled.

Definition at line 112 of file init.hxx.

Referenced by queue().

◆ disableCallbacks()

void desktop::CallbackFlushHandler::disableCallbacks ( )
inline

Disables callbacks on this handler.

Must match with identical count of enableCallbacks. Used during painting and changing views.

Definition at line 107 of file init.hxx.

◆ dumpState()

void CallbackFlushHandler::dumpState ( rtl::OStringBuffer &  rState)
overridevirtual

Implements SfxLokCallbackInterface.

Definition at line 1665 of file init.cxx.

References i, m_nDisableCallbacks, m_states, and m_viewId.

◆ enableCallbacks()

void desktop::CallbackFlushHandler::enableCallbacks ( )
inline

Enables callbacks on this handler.

Must match with identical count of disableCallbacks. Used during painting and changing views.

Definition at line 110 of file init.hxx.

◆ enqueueUpdatedType()

void CallbackFlushHandler::enqueueUpdatedType ( int  type,
const SfxViewShell sourceViewShell,
int  viewId 
)
private

◆ enqueueUpdatedTypes()

void CallbackFlushHandler::enqueueUpdatedTypes ( )
private

◆ Invoke()

void CallbackFlushHandler::Invoke ( )
overridevirtual

◆ libreOfficeKitViewAddPendingInvalidateTiles()

void CallbackFlushHandler::libreOfficeKitViewAddPendingInvalidateTiles ( )
overridevirtual

Implements SfxLokCallbackInterface.

Definition at line 1682 of file init.cxx.

References startTimer().

◆ libreOfficeKitViewCallback()

void CallbackFlushHandler::libreOfficeKitViewCallback ( int  nType,
const OString &  pPayload 
)
overridevirtual

Definition at line 1631 of file init.cxx.

References nType, and queue().

◆ libreOfficeKitViewCallbackWithViewId()

void CallbackFlushHandler::libreOfficeKitViewCallbackWithViewId ( int  nType,
const OString &  pPayload,
int  nViewId 
)
overridevirtual

Definition at line 1637 of file init.cxx.

References nType, and queue().

◆ libreOfficeKitViewInvalidateTilesCallback()

void CallbackFlushHandler::libreOfficeKitViewInvalidateTilesCallback ( const tools::Rectangle pRect,
int  nPart,
int  nMode 
)
overridevirtual

Implements SfxLokCallbackInterface.

Definition at line 1643 of file init.cxx.

References queue().

◆ libreOfficeKitViewUpdatedCallback()

void CallbackFlushHandler::libreOfficeKitViewUpdatedCallback ( int  nType)
overridevirtual

Implements SfxLokCallbackInterface.

Definition at line 1649 of file init.cxx.

References isUpdatedType(), lock(), m_mutex, nType, SAL_INFO, and setUpdatedType().

◆ libreOfficeKitViewUpdatedCallbackPerViewId()

void CallbackFlushHandler::libreOfficeKitViewUpdatedCallbackPerViewId ( int  nType,
int  nViewId,
int  nSourceViewId 
)
overridevirtual

◆ processInvalidateTilesEvent()

bool CallbackFlushHandler::processInvalidateTilesEvent ( int  type,
CallbackData aCallbackData 
)
private

◆ processWindowEvent()

bool CallbackFlushHandler::processWindowEvent ( int  type,
CallbackData aCallbackData 
)
private

◆ queue() [1/2]

void CallbackFlushHandler::queue ( const int  type,
CallbackData data 
)
private

◆ queue() [2/2]

void CallbackFlushHandler::queue ( const int  type,
const OString &  data 
)

◆ removeAll() [1/2]

bool CallbackFlushHandler::removeAll ( int  type)
private

Definition at line 2468 of file init.cxx.

References m_queue1, m_queue2, toQueue2(), and type.

Referenced by processInvalidateTilesEvent(), processWindowEvent(), and queue().

◆ removeAll() [2/2]

bool CallbackFlushHandler::removeAll ( int  type,
const std::function< bool(const CallbackData &)> &  rTestFunc 
)
private

Definition at line 2484 of file init.cxx.

References m_queue1, m_queue2, toQueue2(), and type.

◆ removeViewStates()

void CallbackFlushHandler::removeViewStates ( int  viewId)

Definition at line 2515 of file init.cxx.

References m_viewStates.

◆ resetUpdatedType()

void CallbackFlushHandler::resetUpdatedType ( int  nType)
private

Definition at line 1595 of file init.cxx.

References nType, and setUpdatedType().

Referenced by queue().

◆ resetUpdatedTypePerViewId()

void CallbackFlushHandler::resetUpdatedTypePerViewId ( int  nType,
int  nViewId 
)
private

◆ setUpdatedType()

void CallbackFlushHandler::setUpdatedType ( int  nType,
bool  value 
)
private

◆ setUpdatedTypePerViewId()

void CallbackFlushHandler::setUpdatedTypePerViewId ( int  nType,
int  nViewId,
int  nSourceViewId,
bool  value 
)
private

◆ setViewId()

void desktop::CallbackFlushHandler::setViewId ( int  viewId)
inline

Definition at line 117 of file init.hxx.

◆ startTimer()

void CallbackFlushHandler::startTimer ( )
private

◆ toQueue2() [1/2]

queue_type2::iterator desktop::CallbackFlushHandler::toQueue2 ( queue_type1::iterator  )
private

◆ toQueue2() [2/2]

queue_type2::reverse_iterator desktop::CallbackFlushHandler::toQueue2 ( queue_type1::reverse_iterator  )
private

Member Data Documentation

◆ m_lastStateChange

std::unordered_map<OString, OString> desktop::CallbackFlushHandler::m_lastStateChange
private

Definition at line 208 of file init.hxx.

Referenced by Invoke().

◆ m_mutex

std::recursive_mutex desktop::CallbackFlushHandler::m_mutex
private

◆ m_nDisableCallbacks

int desktop::CallbackFlushHandler::m_nDisableCallbacks
private

Definition at line 234 of file init.hxx.

Referenced by dumpState().

◆ m_pCallback

LibreOfficeKitCallback desktop::CallbackFlushHandler::m_pCallback
private

Definition at line 232 of file init.hxx.

Referenced by Invoke().

◆ m_pData

void* desktop::CallbackFlushHandler::m_pData
private

Definition at line 233 of file init.hxx.

Referenced by Invoke().

◆ m_pDocument

LibreOfficeKitDocument* desktop::CallbackFlushHandler::m_pDocument
private

Definition at line 230 of file init.hxx.

Referenced by queue().

◆ m_queue1

queue_type1 desktop::CallbackFlushHandler::m_queue1
private

we frequently want to scan the queue, and mostly when we do so, we only care about the element type so we split the queue in 2 to make the scanning cache friendly.

Definition at line 205 of file init.hxx.

Referenced by enqueueUpdatedType(), Invoke(), processInvalidateTilesEvent(), processWindowEvent(), queue(), and removeAll().

◆ m_queue2

queue_type2 desktop::CallbackFlushHandler::m_queue2
private

Definition at line 206 of file init.hxx.

Referenced by enqueueUpdatedType(), Invoke(), processWindowEvent(), queue(), and removeAll().

◆ m_states

std::map<int, OString> desktop::CallbackFlushHandler::m_states
private

Definition at line 207 of file init.hxx.

Referenced by CallbackFlushHandler(), dumpState(), and Invoke().

◆ m_TimeoutIdle

TimeoutIdle desktop::CallbackFlushHandler::m_TimeoutIdle
private

Definition at line 244 of file init.hxx.

Referenced by Invoke(), and startTimer().

◆ m_updatedTypes

std::vector<bool> desktop::CallbackFlushHandler::m_updatedTypes
private

Definition at line 221 of file init.hxx.

Referenced by enqueueUpdatedTypes(), and setUpdatedType().

◆ m_updatedTypesPerViewId

boost::container::flat_map<int, std::vector<PerViewIdData> > desktop::CallbackFlushHandler::m_updatedTypesPerViewId
private

◆ m_viewId

int desktop::CallbackFlushHandler::m_viewId = -1
private

Definition at line 231 of file init.hxx.

Referenced by dumpState(), enqueueUpdatedTypes(), and Invoke().

◆ m_viewStates

std::unordered_map<int, std::unordered_map<int, OString> > desktop::CallbackFlushHandler::m_viewStates
private

Definition at line 209 of file init.hxx.

Referenced by addViewStates(), Invoke(), and removeViewStates().


The documentation for this class was generated from the following files: