LibreOffice Module forms (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
frm::RichTextControlImpl Class Reference

#include <richtextimplcontrol.hxx>

Inheritance diagram for frm::RichTextControlImpl:
[legend]
Collaboration diagram for frm::RichTextControlImpl:
[legend]

Classes

struct  GrantAccess
 

Public Member Functions

EditViewgetView (const GrantAccess &) const
 
RichTextEnginegetEngine (const GrantAccess &) const
 
vcl::WindowgetViewport (const GrantAccess &) const
 
 RichTextControlImpl (Control *_pAntiImpl, RichTextEngine *_pEngine, ITextAttributeListener *_pTextAttrListener, ITextSelectionListener *_pSelectionListener)
 
virtual ~RichTextControlImpl ()
 
void updateAllAttributes ()
 updates the cache with the state of all attribute values from the given set, notifies the listener if the state changed More...
 
void updateAttribute (AttributeId _nAttribute)
 updates the cache with the state of the attribute given by which id, notifies the listener if the state changed More...
 
void enableAttributeNotification (AttributeId _nAttributeId, ITextAttributeListener *_pListener)
 enables the callback for a particular attribute More...
 
void disableAttributeNotification (AttributeId _nAttributeId)
 disables the change notifications for a particular attribute More...
 
bool executeAttribute (const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, AttributeId _nAttribute, const SfxPoolItem *_pArgument, SvtScriptType _nForScriptType)
 executes a toggle of the given attribute More...
 
AttributeState getAttributeState (AttributeId _nAttributeId) const
 retrieves the state of the given attribute from the cache More...
 
void normalizeScriptDependentAttribute (SvxScriptSetItem &_rScriptSetItem)
 normalizes the given item so that the state of script dependent attributes is correct considering the current script type More...
 
SvtScriptType getSelectedScriptType () const
 
void layoutWindow ()
 re-arranges the view and the scrollbars More...
 
void notifyStyleChanged ()
 to be called when the style of our window changed More...
 
void notifyZoomChanged ()
 to be called when the zoom of our window changed More...
 
void notifyInitShow ()
 to be called when the StateChangedType::InitShow event arrives More...
 
void SetBackgroundColor ()
 
void SetBackgroundColor (const Color &_rColor)
 
void SetReadOnly (bool _bReadOnly)
 
bool IsReadOnly () const
 
void SetHideInactiveSelection (bool _bHide)
 
bool GetHideInactiveSelection () const
 
void Draw (OutputDevice *_pDev, const Point &_rPos, const Size &_rSize)
 draws the control onto a given output device More...
 
bool HandleCommand (const CommandEvent &_rEvent)
 handles command events arrived at the anti-impl control More...
 
virtual void EditEngineStatusChanged (const EditStatus &_rStatus)=0
 

Private Types

typedef ::std::map< AttributeId, AttributeStateStateCache
 
typedef ::std::map< AttributeId, ::rtl::Reference< AttributeHandler > > AttributeHandlerPool
 
typedef ::std::map< AttributeId, ITextAttributeListener * > AttributeListenerPool
 

Private Member Functions

void implUpdateAttribute (const AttributeHandlerPool::const_iterator &_pHandler)
 
void implCheckUpdateCache (AttributeId _nAttribute, const AttributeState &_rState)
 
void updateScrollbars ()
 
bool windowHasAutomaticLineBreak ()
 
void ensureScrollbars ()
 hides or shows our scrollbars, according to the current WinBits of the window More...
 
void ensureLineBreakSetting ()
 ensures that our "automatic line break" setting matches the current WinBits of the window More...
 
bool hasVScrollBar () const
 
bool hasHScrollBar () const
 
virtual void EditEngineStatusChanged (const EditStatus &_rStatus) override
 
 DECL_LINK (OnInvalidateAllAttributes, LinkParamNone *, void)
 
 DECL_LINK (OnHScroll, weld::Scrollbar &, void)
 
 DECL_LINK (OnVScroll, weld::Scrollbar &, void)
 

Private Attributes

StateCache m_aLastKnownStates
 
AttributeHandlerPool m_aAttributeHandlers
 
AttributeListenerPool m_aAttributeListeners
 
ESelection m_aLastKnownSelection
 
VclPtr< Controlm_pAntiImpl
 
VclPtr< RichTextViewPortm_pViewport
 
VclPtr< ScrollAdaptorm_pHScroll
 
VclPtr< ScrollAdaptorm_pVScroll
 
RichTextEnginem_pEngine
 
std::unique_ptr< EditViewm_pView
 
ITextAttributeListenerm_pTextAttrListener
 
ITextSelectionListenerm_pSelectionListener
 
bool m_bHasEverBeenShown
 

Additional Inherited Members

- Protected Member Functions inherited from frm::IEngineStatusListener
 ~IEngineStatusListener ()
 

Detailed Description

Definition at line 42 of file richtextimplcontrol.hxx.

Member Typedef Documentation

◆ AttributeHandlerPool

Definition at line 45 of file richtextimplcontrol.hxx.

◆ AttributeListenerPool

Definition at line 46 of file richtextimplcontrol.hxx.

◆ StateCache

Definition at line 44 of file richtextimplcontrol.hxx.

Constructor & Destructor Documentation

◆ RichTextControlImpl()

frm::RichTextControlImpl::RichTextControlImpl ( Control _pAntiImpl,
RichTextEngine _pEngine,
ITextAttributeListener _pTextAttrListener,
ITextSelectionListener _pSelectionListener 
)

◆ ~RichTextControlImpl()

frm::RichTextControlImpl::~RichTextControlImpl ( )
virtual

Member Function Documentation

◆ DECL_LINK() [1/3]

frm::RichTextControlImpl::DECL_LINK ( OnHScroll  ,
weld::Scrollbar ,
void   
)
private

◆ DECL_LINK() [2/3]

frm::RichTextControlImpl::DECL_LINK ( OnInvalidateAllAttributes  ,
LinkParamNone ,
void   
)
private

◆ DECL_LINK() [3/3]

frm::RichTextControlImpl::DECL_LINK ( OnVScroll  ,
weld::Scrollbar ,
void   
)
private

◆ disableAttributeNotification()

void frm::RichTextControlImpl::disableAttributeNotification ( AttributeId  _nAttributeId)

disables the change notifications for a particular attribute

Definition at line 201 of file richtextimplcontrol.cxx.

References m_aAttributeHandlers, and m_aAttributeListeners.

◆ Draw()

void frm::RichTextControlImpl::Draw ( OutputDevice _pDev,
const Point _rPos,
const Size _rSize 
)

◆ EditEngineStatusChanged()

void frm::RichTextControlImpl::EditEngineStatusChanged ( const EditStatus _rStatus)
overrideprivatevirtual

◆ enableAttributeNotification()

void frm::RichTextControlImpl::enableAttributeNotification ( AttributeId  _nAttributeId,
ITextAttributeListener _pListener 
)

◆ ensureLineBreakSetting()

void frm::RichTextControlImpl::ensureLineBreakSetting ( )
private

ensures that our "automatic line break" setting matches the current WinBits of the window

Definition at line 357 of file richtextimplcontrol.cxx.

References EMPTY_PAPER_SIZE, layoutWindow(), m_pEngine, EditEngine::SetPaperSize(), and windowHasAutomaticLineBreak().

Referenced by notifyStyleChanged().

◆ ensureScrollbars()

void frm::RichTextControlImpl::ensureScrollbars ( )
private

◆ executeAttribute()

bool frm::RichTextControlImpl::executeAttribute ( const SfxItemSet _rCurrentAttribs,
SfxItemSet _rNewAttribs,
AttributeId  _nAttribute,
const SfxPoolItem _pArgument,
SvtScriptType  _nForScriptType 
)

executes a toggle of the given attribute

Definition at line 165 of file richtextimplcontrol.cxx.

References m_aAttributeHandlers.

◆ getAttributeState()

AttributeState frm::RichTextControlImpl::getAttributeState ( AttributeId  _nAttributeId) const

retrieves the state of the given attribute from the cache

Definition at line 153 of file richtextimplcontrol.cxx.

References frm::eIndetermined, and m_aLastKnownStates.

◆ getEngine()

RichTextEngine * frm::RichTextControlImpl::getEngine ( const GrantAccess ) const
inline

Definition at line 67 of file richtextimplcontrol.hxx.

References m_pEngine.

◆ GetHideInactiveSelection()

bool frm::RichTextControlImpl::GetHideInactiveSelection ( ) const

Definition at line 630 of file richtextimplcontrol.cxx.

References m_pViewport.

◆ getSelectedScriptType()

SvtScriptType frm::RichTextControlImpl::getSelectedScriptType ( ) const

◆ getView()

EditView * frm::RichTextControlImpl::getView ( const GrantAccess ) const
inline

Definition at line 66 of file richtextimplcontrol.hxx.

References m_pView.

◆ getViewport()

vcl::Window * frm::RichTextControlImpl::getViewport ( const GrantAccess ) const
inline

Definition at line 68 of file richtextimplcontrol.hxx.

References m_pViewport.

◆ HandleCommand()

bool frm::RichTextControlImpl::HandleCommand ( const CommandEvent _rEvent)

handles command events arrived at the anti-impl control

Definition at line 536 of file richtextimplcontrol.cxx.

References CommandEvent::GetCommand(), m_pAntiImpl, m_pHScroll, and m_pVScroll.

◆ hasHScrollBar()

bool frm::RichTextControlImpl::hasHScrollBar ( ) const
inlineprivate

Definition at line 168 of file richtextimplcontrol.hxx.

References m_pHScroll.

Referenced by ensureScrollbars().

◆ hasVScrollBar()

bool frm::RichTextControlImpl::hasVScrollBar ( ) const
inlineprivate

Definition at line 167 of file richtextimplcontrol.hxx.

References m_pVScroll.

Referenced by ensureScrollbars().

◆ implCheckUpdateCache()

void frm::RichTextControlImpl::implCheckUpdateCache ( AttributeId  _nAttribute,
const AttributeState _rState 
)
private

◆ implUpdateAttribute()

void frm::RichTextControlImpl::implUpdateAttribute ( const AttributeHandlerPool::const_iterator &  _pHandler)
private

◆ IsReadOnly()

bool frm::RichTextControlImpl::IsReadOnly ( ) const

Definition at line 519 of file richtextimplcontrol.cxx.

References m_pView.

◆ layoutWindow()

void frm::RichTextControlImpl::layoutWindow ( )

◆ normalizeScriptDependentAttribute()

void frm::RichTextControlImpl::normalizeScriptDependentAttribute ( SvxScriptSetItem _rScriptSetItem)

normalizes the given item so that the state of script dependent attributes is correct considering the current script type

There are some attributes which are script dependent, e.g. the CharPosture. This means that in real, there are 3 attributes for this, one for every possible script type (latin, asian, complex). However, to the out world, we behave as if there is only one attribute: E.g., if the outer world asks for the state of the "CharPosture" attribute, we return the state of either CharPostureLatin, CharPostureAsian, or CharPostureComplex, depending on the script type of the current selection. (In real, it may be more complex since the current selection may contain more than one script type.)

This method normalizes a script dependent attribute, so that it's state takes into account the currently selected script type.

Definition at line 215 of file richtextimplcontrol.cxx.

References SfxPoolItem::CloneSetWhich(), SvxScriptSetItem::GetItemOfScript(), getSelectedScriptType(), and m_pView.

Referenced by implUpdateAttribute().

◆ notifyInitShow()

void frm::RichTextControlImpl::notifyInitShow ( )

to be called when the StateChangedType::InitShow event arrives

Definition at line 474 of file richtextimplcontrol.cxx.

References layoutWindow(), and m_bHasEverBeenShown.

◆ notifyStyleChanged()

void frm::RichTextControlImpl::notifyStyleChanged ( )

to be called when the style of our window changed

Definition at line 484 of file richtextimplcontrol.cxx.

References ensureLineBreakSetting(), and ensureScrollbars().

◆ notifyZoomChanged()

void frm::RichTextControlImpl::notifyZoomChanged ( )

to be called when the zoom of our window changed

Definition at line 491 of file richtextimplcontrol.cxx.

References layoutWindow(), m_pAntiImpl, m_pViewport, MapMode::SetScaleX(), and MapMode::SetScaleY().

◆ SetBackgroundColor() [1/2]

void frm::RichTextControlImpl::SetBackgroundColor ( )

Definition at line 610 of file richtextimplcontrol.cxx.

References Application::GetSettings(), and SetBackgroundColor().

Referenced by SetBackgroundColor().

◆ SetBackgroundColor() [2/2]

void frm::RichTextControlImpl::SetBackgroundColor ( const Color _rColor)

Definition at line 616 of file richtextimplcontrol.cxx.

References m_pAntiImpl, and m_pViewport.

◆ SetHideInactiveSelection()

void frm::RichTextControlImpl::SetHideInactiveSelection ( bool  _bHide)

Definition at line 624 of file richtextimplcontrol.cxx.

References m_pViewport.

◆ SetReadOnly()

void frm::RichTextControlImpl::SetReadOnly ( bool  _bReadOnly)

Definition at line 513 of file richtextimplcontrol.cxx.

References m_pView.

◆ updateAllAttributes()

void frm::RichTextControlImpl::updateAllAttributes ( )

updates the cache with the state of all attribute values from the given set, notifies the listener if the state changed

Definition at line 130 of file richtextimplcontrol.cxx.

References implUpdateAttribute(), m_aAttributeHandlers, m_aLastKnownSelection, m_pSelectionListener, m_pView, and frm::ITextSelectionListener::onSelectionChanged().

◆ updateAttribute()

void frm::RichTextControlImpl::updateAttribute ( AttributeId  _nAttribute)

updates the cache with the state of the attribute given by which id, notifies the listener if the state changed

Definition at line 122 of file richtextimplcontrol.cxx.

References implUpdateAttribute(), and m_aAttributeHandlers.

Referenced by enableAttributeNotification().

◆ updateScrollbars()

void frm::RichTextControlImpl::updateScrollbars ( )
private

◆ windowHasAutomaticLineBreak()

bool frm::RichTextControlImpl::windowHasAutomaticLineBreak ( )
private

Member Data Documentation

◆ m_aAttributeHandlers

AttributeHandlerPool frm::RichTextControlImpl::m_aAttributeHandlers
private

◆ m_aAttributeListeners

AttributeListenerPool frm::RichTextControlImpl::m_aAttributeListeners
private

◆ m_aLastKnownSelection

ESelection frm::RichTextControlImpl::m_aLastKnownSelection
private

Definition at line 52 of file richtextimplcontrol.hxx.

Referenced by updateAllAttributes().

◆ m_aLastKnownStates

StateCache frm::RichTextControlImpl::m_aLastKnownStates
private

Definition at line 48 of file richtextimplcontrol.hxx.

Referenced by getAttributeState(), and implCheckUpdateCache().

◆ m_bHasEverBeenShown

bool frm::RichTextControlImpl::m_bHasEverBeenShown
private

Definition at line 62 of file richtextimplcontrol.hxx.

Referenced by layoutWindow(), and notifyInitShow().

◆ m_pAntiImpl

VclPtr<Control> frm::RichTextControlImpl::m_pAntiImpl
private

◆ m_pEngine

RichTextEngine* frm::RichTextControlImpl::m_pEngine
private

◆ m_pHScroll

VclPtr<ScrollAdaptor> frm::RichTextControlImpl::m_pHScroll
private

◆ m_pSelectionListener

ITextSelectionListener* frm::RichTextControlImpl::m_pSelectionListener
private

Definition at line 61 of file richtextimplcontrol.hxx.

Referenced by updateAllAttributes().

◆ m_pTextAttrListener

ITextAttributeListener* frm::RichTextControlImpl::m_pTextAttrListener
private

Definition at line 60 of file richtextimplcontrol.hxx.

Referenced by implCheckUpdateCache().

◆ m_pView

std::unique_ptr<EditView> frm::RichTextControlImpl::m_pView
private

◆ m_pViewport

VclPtr<RichTextViewPort> frm::RichTextControlImpl::m_pViewport
private

◆ m_pVScroll

VclPtr<ScrollAdaptor> frm::RichTextControlImpl::m_pVScroll
private

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