1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef TOOLKIT_FORMATTED_CONTROL_HXX 25*b1cdbd2cSJim Jagielski #define TOOLKIT_FORMATTED_CONTROL_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <toolkit/controls/unocontrols.hxx> 28*b1cdbd2cSJim Jagielski #include <toolkit/controls/unocontrolmodel.hxx> 29*b1cdbd2cSJim Jagielski #include <toolkit/helper/servicenames.hxx> 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #include <com/sun/star/util/XNumberFormatter.hpp> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski //........................................................................ 34*b1cdbd2cSJim Jagielski namespace toolkit 35*b1cdbd2cSJim Jagielski { 36*b1cdbd2cSJim Jagielski //........................................................................ 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski // =================================================================== 39*b1cdbd2cSJim Jagielski // = UnoControlFormattedFieldModel 40*b1cdbd2cSJim Jagielski // =================================================================== 41*b1cdbd2cSJim Jagielski class UnoControlFormattedFieldModel : public UnoControlModel 42*b1cdbd2cSJim Jagielski { 43*b1cdbd2cSJim Jagielski protected: 44*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 45*b1cdbd2cSJim Jagielski ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 46*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any m_aCachedFormat; 47*b1cdbd2cSJim Jagielski bool m_bRevokedAsClient; 48*b1cdbd2cSJim Jagielski bool m_bSettingValueAndText; 49*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > 50*b1cdbd2cSJim Jagielski m_xCachedFormatter; 51*b1cdbd2cSJim Jagielski 52*b1cdbd2cSJim Jagielski protected: 53*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL convertFastPropertyValue( 54*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any& rConvertedValue, 55*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any& rOldValue, 56*b1cdbd2cSJim Jagielski sal_Int32 nPropId, 57*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Any& rValue 58*b1cdbd2cSJim Jagielski ) throw (::com::sun::star::lang::IllegalArgumentException); 59*b1cdbd2cSJim Jagielski 60*b1cdbd2cSJim Jagielski void SAL_CALL setFastPropertyValue_NoBroadcast( 61*b1cdbd2cSJim Jagielski sal_Int32 nHandle, 62*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Any& rValue 63*b1cdbd2cSJim Jagielski ) throw (::com::sun::star::uno::Exception); 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski public: 66*b1cdbd2cSJim Jagielski UnoControlFormattedFieldModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); UnoControlFormattedFieldModel(const UnoControlFormattedFieldModel & rModel)67*b1cdbd2cSJim Jagielski UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel ) 68*b1cdbd2cSJim Jagielski :UnoControlModel( rModel ) 69*b1cdbd2cSJim Jagielski { 70*b1cdbd2cSJim Jagielski } 71*b1cdbd2cSJim Jagielski Clone() const72*b1cdbd2cSJim Jagielski UnoControlModel* Clone() const { return new UnoControlFormattedFieldModel( *this ); } 73*b1cdbd2cSJim Jagielski 74*b1cdbd2cSJim Jagielski // ::com::sun::star::io::XPersistObject 75*b1cdbd2cSJim Jagielski ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 76*b1cdbd2cSJim Jagielski 77*b1cdbd2cSJim Jagielski // ::com::sun::star::beans::XMultiPropertySet 78*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim Jagielski // ::com::sun::star::lang::XServiceInfo 82*b1cdbd2cSJim Jagielski DECLIMPL_SERVICEINFO_DERIVED( UnoControlFormattedFieldModel, UnoControlModel, szServiceName2_UnoControlFormattedFieldModel ) 83*b1cdbd2cSJim Jagielski 84*b1cdbd2cSJim Jagielski protected: 85*b1cdbd2cSJim Jagielski ~UnoControlFormattedFieldModel(); 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski // XComponent 88*b1cdbd2cSJim Jagielski void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 89*b1cdbd2cSJim Jagielski 90*b1cdbd2cSJim Jagielski // XPropertySet 91*b1cdbd2cSJim Jagielski void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski // UnoControlModel 94*b1cdbd2cSJim Jagielski virtual void ImplNormalizePropertySequence( 95*b1cdbd2cSJim Jagielski const sal_Int32 _nCount, /// the number of entries in the arrays 96*b1cdbd2cSJim Jagielski sal_Int32* _pHandles, /// the handles of the properties to set 97*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Any* _pValues, /// the values of the properties to set 98*b1cdbd2cSJim Jagielski sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted 99*b1cdbd2cSJim Jagielski ) const SAL_THROW(()); 100*b1cdbd2cSJim Jagielski private: 101*b1cdbd2cSJim Jagielski void impl_updateTextFromValue_nothrow(); 102*b1cdbd2cSJim Jagielski void impl_updateCachedFormatter_nothrow(); 103*b1cdbd2cSJim Jagielski void impl_updateCachedFormatKey_nothrow(); 104*b1cdbd2cSJim Jagielski }; 105*b1cdbd2cSJim Jagielski 106*b1cdbd2cSJim Jagielski // =================================================================== 107*b1cdbd2cSJim Jagielski // = UnoFormattedFieldControl 108*b1cdbd2cSJim Jagielski // =================================================================== 109*b1cdbd2cSJim Jagielski class UnoFormattedFieldControl : public UnoSpinFieldControl 110*b1cdbd2cSJim Jagielski { 111*b1cdbd2cSJim Jagielski public: 112*b1cdbd2cSJim Jagielski UnoFormattedFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 113*b1cdbd2cSJim Jagielski ::rtl::OUString GetComponentServiceName(); 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski // ::com::sun::star::awt::XTextListener 116*b1cdbd2cSJim Jagielski void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); 117*b1cdbd2cSJim Jagielski 118*b1cdbd2cSJim Jagielski // ::com::sun::star::lang::XServiceInfo 119*b1cdbd2cSJim Jagielski DECLIMPL_SERVICEINFO_DERIVED( UnoFormattedFieldControl, UnoEditControl, szServiceName2_UnoControlFormattedField ) 120*b1cdbd2cSJim Jagielski }; 121*b1cdbd2cSJim Jagielski 122*b1cdbd2cSJim Jagielski //........................................................................ 123*b1cdbd2cSJim Jagielski } // namespace toolkit 124*b1cdbd2cSJim Jagielski //........................................................................ 125*b1cdbd2cSJim Jagielski 126*b1cdbd2cSJim Jagielski #endif // TOOLKIT_FORMATTED_CONTROL_HXX 127