LibreOffice Module svx (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
svxform::ControlBorderManager Class Reference

manages the dynamic border color for form controls More...

#include <fmcontrolbordermanager.hxx>

Collaboration diagram for svxform::ControlBorderManager:
[legend]

Classes

struct  ControlDataCompare
 

Public Member Functions

 ControlBorderManager ()
 
 ~ControlBorderManager ()
 
void focusGained (const css::uno::Reference< css::uno::XInterface > &_rxControl)
 
void focusLost (const css::uno::Reference< css::uno::XInterface > &_rxControl)
 
void mouseEntered (const css::uno::Reference< css::uno::XInterface > &_rxControl)
 
void mouseExited (const css::uno::Reference< css::uno::XInterface > &_rxControl)
 
void validityChanged (const css::uno::Reference< css::awt::XControl > &_rxControl, const css::uno::Reference< css::form::validation::XValidatableFormComponent > &_rxValidatable)
 
void enableDynamicBorderColor ()
 enables dynamic border color for the controls More...
 
void disableDynamicBorderColor ()
 disables dynamic border color for the controls More...
 
void setStatusColor (ControlStatus _nStatus, Color _nColor)
 sets a color to be used for a given status More...
 
void restoreAll ()
 restores all colors of all controls where we possibly changed them More...
 

Private Types

typedef ::std::set< ControlData, ControlDataCompareControlBag
 
typedef ::std::set< css::uno::Reference< css::awt::XVclWindowPeer > > PeerBag
 

Private Member Functions

void controlStatusGained (const css::uno::Reference< css::uno::XInterface > &_rxControl, ControlData &_rControlData)
 called when a control got one of the two possible statuses (focused, and hovered with the mouse) More...
 
void controlStatusLost (const css::uno::Reference< css::uno::XInterface > &_rxControl, ControlData &_rControlData)
 called when a control lost one of the two possible statuses (focused, and hovered with the mouse) More...
 
bool canColorBorder (const css::uno::Reference< css::awt::XVclWindowPeer > &_rxPeer)
 determines whether the border of a given peer can be colored More...
 
ControlStatus getControlStatus (const css::uno::Reference< css::awt::XControl > &_rxControl)
 determines the status of the given control More...
 
Color getControlColorByStatus (ControlStatus _eStatus) const
 retrieves the color associated with a given ControlStatus More...
 
void updateBorderStyle (const css::uno::Reference< css::awt::XControl > &_rxControl, const css::uno::Reference< css::awt::XVclWindowPeer > &_rxPeer, const BorderDescriptor &_rFallback)
 sets the border color for a given control, depending on its status More...
 
void determineOriginalBorderStyle (const css::uno::Reference< css::awt::XControl > &_rxControl, BorderDescriptor &_rData) const
 determines the to-be-remembered original border color and type for a control More...
 

Private Attributes

PeerBag m_aColorableControls
 
PeerBag m_aNonColorableControls
 
ControlData m_aFocusControl
 
ControlData m_aMouseHoverControl
 
ControlBag m_aInvalidControls
 
Color m_nFocusColor
 
Color m_nMouseHoveColor
 
Color m_nInvalidColor
 
bool m_bDynamicBorderColors
 

Detailed Description

manages the dynamic border color for form controls

Used by the <type>FormController</type>, this class manages the dynamic changes in the border color of form controls. For this a set of events have to be forwarded to the manager instance, which then will switch the border color depending on the mouse and focus status of the controls.

Definition at line 100 of file fmcontrolbordermanager.hxx.

Member Typedef Documentation

◆ ControlBag

Definition at line 111 of file fmcontrolbordermanager.hxx.

◆ PeerBag

typedef ::std::set< css::uno::Reference< css::awt::XVclWindowPeer > > svxform::ControlBorderManager::PeerBag
private

Definition at line 112 of file fmcontrolbordermanager.hxx.

Constructor & Destructor Documentation

◆ ControlBorderManager()

svxform::ControlBorderManager::ControlBorderManager ( )

Definition at line 88 of file fmcontrolbordermanager.cxx.

◆ ~ControlBorderManager()

svxform::ControlBorderManager::~ControlBorderManager ( )

Definition at line 97 of file fmcontrolbordermanager.cxx.

Member Function Documentation

◆ canColorBorder()

bool svxform::ControlBorderManager::canColorBorder ( const css::uno::Reference< css::awt::XVclWindowPeer > &  _rxPeer)
private

determines whether the border of a given peer can be colored

Parameters
_rxPeerthe peer to examine. Must not be <NULL>

Definition at line 102 of file fmcontrolbordermanager.cxx.

References FM_PROP_BORDER, m_aColorableControls, and m_aNonColorableControls.

Referenced by controlStatusGained(), controlStatusLost(), and validityChanged().

◆ controlStatusGained()

void svxform::ControlBorderManager::controlStatusGained ( const css::uno::Reference< css::uno::XInterface > &  _rxControl,
ControlData _rControlData 
)
private

called when a control got one of the two possible statuses (focused, and hovered with the mouse)

Parameters
_rxControlthe control which gained the status
_rControlDatathe control's status data, as a reference to our respective member

Definition at line 216 of file fmcontrolbordermanager.cxx.

References canColorBorder(), DBG_ASSERT, determineOriginalBorderStyle(), Exception, TOOLS_WARN_EXCEPTION, updateBorderStyle(), and svxform::ControlData::xControl.

Referenced by focusGained(), and mouseEntered().

◆ controlStatusLost()

void svxform::ControlBorderManager::controlStatusLost ( const css::uno::Reference< css::uno::XInterface > &  _rxControl,
ControlData _rControlData 
)
private

called when a control lost one of the two possible statuses (focused, and hovered with the mouse)

Parameters
_rxControlthe control which lost the status
_rControlDatathe control's status data, as a reference to our respective member

Definition at line 249 of file fmcontrolbordermanager.cxx.

References canColorBorder(), Exception, TOOLS_WARN_EXCEPTION, updateBorderStyle(), and svxform::ControlData::xControl.

Referenced by focusLost(), mouseExited(), and restoreAll().

◆ determineOriginalBorderStyle()

void svxform::ControlBorderManager::determineOriginalBorderStyle ( const css::uno::Reference< css::awt::XControl > &  _rxControl,
BorderDescriptor _rData 
) const
private

determines the to-be-remembered original border color and type for a control

The method also takes into account that the control may currently have an overwritten border style

Parameters
_rxControlthe control to examine. Must not be <NULL>, and have a non-<NULL> peer

Definition at line 189 of file fmcontrolbordermanager.cxx.

References svxform::getBorder(), m_aFocusControl, m_aInvalidControls, m_aMouseHoverControl, and svxform::ControlData::xControl.

Referenced by controlStatusGained(), and validityChanged().

◆ disableDynamicBorderColor()

void svxform::ControlBorderManager::disableDynamicBorderColor ( )

disables dynamic border color for the controls

Definition at line 279 of file fmcontrolbordermanager.cxx.

References m_bDynamicBorderColors, and restoreAll().

◆ enableDynamicBorderColor()

void svxform::ControlBorderManager::enableDynamicBorderColor ( )

enables dynamic border color for the controls

Definition at line 273 of file fmcontrolbordermanager.cxx.

References m_bDynamicBorderColors.

◆ focusGained()

void svxform::ControlBorderManager::focusGained ( const css::uno::Reference< css::uno::XInterface > &  _rxControl)

◆ focusLost()

void svxform::ControlBorderManager::focusLost ( const css::uno::Reference< css::uno::XInterface > &  _rxControl)

◆ getControlColorByStatus()

Color svxform::ControlBorderManager::getControlColorByStatus ( ControlStatus  _eStatus) const
private

retrieves the color associated with a given ControlStatus

Parameters
_eStatusthe status of the control. Must not be <member>ControlStatus::none</member>

Definition at line 154 of file fmcontrolbordermanager.cxx.

References Focused, Invalid, m_nFocusColor, m_nInvalidColor, m_nMouseHoveColor, and MouseHover.

Referenced by updateBorderStyle().

◆ getControlStatus()

ControlStatus svxform::ControlBorderManager::getControlStatus ( const css::uno::Reference< css::awt::XControl > &  _rxControl)
private

determines the status of the given control

Definition at line 137 of file fmcontrolbordermanager.cxx.

References Focused, Invalid, m_aFocusControl, m_aInvalidControls, m_aMouseHoverControl, MouseHover, NONE, and svxform::ControlData::xControl.

Referenced by updateBorderStyle().

◆ mouseEntered()

void svxform::ControlBorderManager::mouseEntered ( const css::uno::Reference< css::uno::XInterface > &  _rxControl)

◆ mouseExited()

void svxform::ControlBorderManager::mouseExited ( const css::uno::Reference< css::uno::XInterface > &  _rxControl)

◆ restoreAll()

void svxform::ControlBorderManager::restoreAll ( )

restores all colors of all controls where we possibly changed them

Definition at line 305 of file fmcontrolbordermanager.cxx.

References Any, controlStatusLost(), FM_PROP_HELPTEXT, m_aFocusControl, m_aInvalidControls, m_aMouseHoverControl, svxform::setUnderline(), updateBorderStyle(), and svxform::ControlData::xControl.

Referenced by disableDynamicBorderColor().

◆ setStatusColor()

void svxform::ControlBorderManager::setStatusColor ( ControlStatus  _nStatus,
Color  _nColor 
)

sets a color to be used for a given status

Parameters
_nStatusthe status which the color should be applied for. Must not be ControlStatus::NONE
_nColorthe color to apply for the given status

Definition at line 286 of file fmcontrolbordermanager.cxx.

References Focused, Invalid, m_nFocusColor, m_nInvalidColor, m_nMouseHoveColor, and MouseHover.

◆ updateBorderStyle()

void svxform::ControlBorderManager::updateBorderStyle ( const css::uno::Reference< css::awt::XControl > &  _rxControl,
const css::uno::Reference< css::awt::XVclWindowPeer > &  _rxPeer,
const BorderDescriptor _rFallback 
)
private

sets the border color for a given control, depending on its status

Parameters
_rxControlthe control to set the border color for. Must not be <NULL>
_rxPeerthe peer of the control, to be passed herein for optimization the caller usually needs it, anyway). Must not be <NULL>
_rFallbackthe color/type to use when the control has the status ControlStatus::NONE

Definition at line 173 of file fmcontrolbordermanager.cxx.

References getControlColorByStatus(), getControlStatus(), svxform::BorderDescriptor::nBorderColor, svxform::BorderDescriptor::nBorderType, NONE, and svxform::setBorder().

Referenced by controlStatusGained(), controlStatusLost(), restoreAll(), and validityChanged().

◆ validityChanged()

void svxform::ControlBorderManager::validityChanged ( const css::uno::Reference< css::awt::XControl > &  _rxControl,
const css::uno::Reference< css::form::validation::XValidatableFormComponent > &  _rxValidatable 
)

Member Data Documentation

◆ m_aColorableControls

PeerBag svxform::ControlBorderManager::m_aColorableControls
private

Definition at line 114 of file fmcontrolbordermanager.hxx.

Referenced by canColorBorder().

◆ m_aFocusControl

ControlData svxform::ControlBorderManager::m_aFocusControl
private

◆ m_aInvalidControls

ControlBag svxform::ControlBorderManager::m_aInvalidControls
private

◆ m_aMouseHoverControl

ControlData svxform::ControlBorderManager::m_aMouseHoverControl
private

◆ m_aNonColorableControls

PeerBag svxform::ControlBorderManager::m_aNonColorableControls
private

Definition at line 115 of file fmcontrolbordermanager.hxx.

Referenced by canColorBorder().

◆ m_bDynamicBorderColors

bool svxform::ControlBorderManager::m_bDynamicBorderColors
private

◆ m_nFocusColor

Color svxform::ControlBorderManager::m_nFocusColor
private

Definition at line 123 of file fmcontrolbordermanager.hxx.

Referenced by getControlColorByStatus(), and setStatusColor().

◆ m_nInvalidColor

Color svxform::ControlBorderManager::m_nInvalidColor
private

◆ m_nMouseHoveColor

Color svxform::ControlBorderManager::m_nMouseHoveColor
private

Definition at line 124 of file fmcontrolbordermanager.hxx.

Referenced by getControlColorByStatus(), and setStatusColor().


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