diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-11-16 10:29:29 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-11-16 10:29:29 +0000 |
commit | 4b13bfd7982ae90ee57014c3859a3d41d6dcd3f1 (patch) | |
tree | dd7a93470839705afa82cca913a6d2d555c3f2e4 /svx/source/inc | |
parent | 2b038d37b0f28d0405f79eaff4603387aba65fa5 (diff) |
INTEGRATION: CWS eforms2 (1.2.86); FILE MERGED
2004/11/03 08:00:19 fs 1.2.86.6: #i10000# made ControlData public to compile in unxsols4
2004/08/07 14:13:12 dvo 1.2.86.5: #i31958# fix unxlngi5.pro build
2004/08/06 11:09:40 fs 1.2.86.4: #i31958# controls whose colors cannot be colored indicate their invalidity with a red text underline now
2004/08/06 10:28:31 fs 1.2.86.3: preparations for dynamic border colors also for 3D borders
2004/08/06 08:27:52 fs 1.2.86.2: #i31958# now also caring for the HelpText of invalid controls
2004/08/05 10:26:46 fs 1.2.86.1: #i31958# indicate the validity of a control/model's value with a red border
Diffstat (limited to 'svx/source/inc')
-rw-r--r-- | svx/source/inc/fmcontrolbordermanager.hxx | 128 |
1 files changed, 105 insertions, 23 deletions
diff --git a/svx/source/inc/fmcontrolbordermanager.hxx b/svx/source/inc/fmcontrolbordermanager.hxx index f386d127235c..256ebcbe0578 100644 --- a/svx/source/inc/fmcontrolbordermanager.hxx +++ b/svx/source/inc/fmcontrolbordermanager.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fmcontrolbordermanager.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: obo $ $Date: 2004-07-05 15:51:54 $ + * last change: $Author: obo $ $Date: 2004-11-16 11:29:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,12 @@ #define SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX /** === begin UNO includes === **/ +#ifndef _COM_SUN_STAR_AWT_VISUALEFFECT_HPP_ +#include <com/sun/star/awt/VisualEffect.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_ +#include <com/sun/star/awt/FontUnderline.hpp> +#endif #ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ #include <com/sun/star/awt/XControl.hpp> #endif @@ -71,6 +77,16 @@ #endif /** === end UNO includes === **/ +#ifndef _COMPHELPER_STLTYPES_HXX_ +#include <comphelper/stl_types.hxx> +#endif + +#include <set> + +namespace com { namespace sun { namespace star { namespace form { namespace validation { + class XValidatableFormComponent; +} } } } } + //........................................................................ namespace svxform { @@ -81,7 +97,58 @@ namespace svxform #define CONTROL_STATUS_NONE 0x00 #define CONTROL_STATUS_FOCUSED 0x01 #define CONTROL_STATUS_MOUSE_HOVER 0x02 - #define CONTROL_STATUS_BOTH 0x03 + #define CONTROL_STATUS_INVALID 0x04 + + //==================================================================== + //= BorderDescriptor + //==================================================================== + struct BorderDescriptor + { + sal_Int16 nBorderType; + sal_Int32 nBorderColor; + + BorderDescriptor() + :nBorderType( ::com::sun::star::awt::VisualEffect::FLAT ) + ,nBorderColor( 0x00000000 ) + { + } + }; + + //==================================================================== + //= UnderlineDescriptor + //==================================================================== + struct UnderlineDescriptor + { + sal_Int16 nUnderlineType; + sal_Int32 nUnderlineColor; + + UnderlineDescriptor() + :nUnderlineType( ::com::sun::star::awt::FontUnderline::NONE ) + ,nUnderlineColor( 0x00000000 ) + { + } + + UnderlineDescriptor( sal_Int16 _nUnderlineType, sal_Int32 _nUnderlineColor ) + :nUnderlineType( _nUnderlineType ) + ,nUnderlineColor( _nUnderlineColor ) + { + } + }; + + //==================================================================== + //= ControlData + //==================================================================== + struct ControlData : public BorderDescriptor, UnderlineDescriptor + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl; + ::rtl::OUString sOriginalHelpText; + + ControlData() : BorderDescriptor() { } + ControlData( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ) + :xControl( _rxControl ) + { + } + }; //==================================================================== //= ControlBorderManager @@ -96,26 +163,26 @@ namespace svxform class ControlBorderManager { private: - struct ControlData + struct ControlDataCompare : public ::std::binary_function< ControlData, ControlData, bool > { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl; - sal_Int32 nOriginalColor; - - ControlData() : nOriginalColor( 0x00000000 ) { } - inline void clear() - { - xControl.clear(); - nOriginalColor = 0x00000000; - } + bool operator()( const ControlData& _rLHS, const ControlData& _rRHS ) const + { + return _rLHS.xControl.get() < _rRHS.xControl.get(); + } }; + typedef ::std::set< ControlData, ControlDataCompare > ControlBag; + + // ---------------- + // attributes ControlData m_aFocusControl; ControlData m_aMouseHoverControl; + ControlBag m_aInvalidControls; sal_Int32 m_nFocusColor; sal_Int32 m_nMouseHoveColor; - sal_Int32 m_nCombinedColor; - bool m_bEnabled; + sal_Int32 m_nInvalidColor; + bool m_bDynamicBorderColors; public: ControlBorderManager(); @@ -127,6 +194,11 @@ namespace svxform void mouseEntered( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); void mouseExited( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); + void validityChanged( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidatableFormComponent >& _rxValidatable + ) SAL_THROW(()); + /// enables dynamic border color for the controls void enableDynamicBorderColor( ); /// disables dynamic border color for the controls @@ -150,13 +222,10 @@ namespace svxform the control which gained the status @param _rControlData the control's status data, as a reference to our respective member - @param _rOppositeStatusData - the data for the opponent status. This is needed to properly determine the original color */ void controlStatusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl, - ControlData& _rControlData, - const ControlData& _rOppositeStatusData + ControlData& _rControlData ) SAL_THROW(()); /** called when a control lost one of the two possible stati (focused, and hovered with the mouse) @@ -189,14 +258,27 @@ namespace svxform @param _rxPeer the peer of the control, to be passed herein for optimization the caller usually needs it, anyway). Must not be <NULL/> - @param _nFallbackColor - the color to use when the control has the status CONTROL_STATUS_NONE + @param _rFallback + the color/type to use when the control has the status CONTROL_STATUS_NONE */ - void updateControlColor( + void updateBorderStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _rxPeer, - sal_Int32 _nFallbackColor + const BorderDescriptor& _rFallback ) SAL_THROW(()); + + /** 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 + + @param _rxControl + the control to examine. Must not be <NULL/>, and have a non-<NULL/> peer + */ + void determineOriginalBorderStyle( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + BorderDescriptor& _rData + ) const; }; //........................................................................ |