bump product version to 4.1.6.2
[LibreOffice.git] / forms / source / component / FormattedField.hxx
bloba21313838d07040b03c649c110e428d38fe84a49
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _FORMS_FORMATTEDFIELD_HXX_
21 #define _FORMS_FORMATTEDFIELD_HXX_
23 #include "EditBase.hxx"
24 #include <tools/link.hxx>
25 #include <comphelper/propmultiplex.hxx>
26 #include <cppuhelper/implbase1.hxx>
27 #include "errorbroadcaster.hxx"
29 //.........................................................................
30 namespace frm
33 //==================================================================
34 //= OFormattedModel
35 //==================================================================
37 class OFormattedModel
38 :public OEditBaseModel
39 ,public OErrorBroadcaster
41 // das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das
42 // ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded)
43 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> m_xOriginalFormatter;
44 ::com::sun::star::util::Date m_aNullDate;
45 ::com::sun::star::uno::Any m_aSaveValue;
47 sal_Int32 m_nFieldType;
48 sal_Int16 m_nKeyType;
49 sal_Bool m_bOriginalNumeric : 1,
50 m_bNumeric : 1; // analog fuer TreatAsNumeric-Property
52 protected:
53 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcDefaultFormatsSupplier() const;
54 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormFormatsSupplier() const;
55 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormatsSupplier() const;
57 DECLARE_DEFAULT_LEAF_XTOR( OFormattedModel );
59 friend class OFormattedFieldWrapper;
61 protected:
62 // XInterface
63 DECLARE_UNO3_AGG_DEFAULTS( OFormattedModel, OEditBaseModel );
65 // XTypeProvider
66 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
68 // XAggregation
69 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
71 // OComponentHelper
72 virtual void SAL_CALL disposing();
74 // XServiceInfo
75 IMPLEMENTATION_NAME(OFormattedModel);
76 virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
78 // XPersistObject
79 virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
80 virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
81 virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
83 // XPropertySet
84 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
85 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
86 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
87 throw(::com::sun::star::lang::IllegalArgumentException);
88 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
90 // XLoadListener
91 virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw ( ::com::sun::star::uno::RuntimeException);
93 // XPropertyState
94 void setPropertyToDefaultByHandle(sal_Int32 nHandle);
95 ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
97 void SAL_CALL setPropertyToDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
98 ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
100 // OControlModel's property handling
101 virtual void describeFixedProperties(
102 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
103 ) const;
104 virtual void describeAggregateProperties(
105 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
106 ) const;
108 // XPropertyChangeListener
109 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
111 // prevent method hiding
112 using OEditBaseModel::disposing;
113 using OEditBaseModel::getFastPropertyValue;
115 protected:
116 virtual sal_uInt16 getPersistenceFlags() const;
117 // as we have an own version handling for persistence
119 // OBoundControlModel overridables
120 virtual ::com::sun::star::uno::Any
121 translateDbColumnToControlValue( );
122 virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
124 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
125 getSupportedBindingTypes();
126 virtual ::com::sun::star::uno::Any
127 translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
128 virtual ::com::sun::star::uno::Any
129 translateControlValueToExternalValue( ) const;
130 virtual void onConnectedExternalValue( );
132 virtual ::com::sun::star::uno::Any
133 getDefaultForReset() const;
134 virtual void resetNoBroadcast();
136 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
137 virtual void onDisconnectedDbColumn();
139 private:
140 DECLARE_XCLONEABLE();
142 void implConstruct();
144 void updateFormatterNullDate();
147 //==================================================================
148 //= OFormattedControl
149 //==================================================================
150 typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE;
151 class OFormattedControl : public OBoundControl
152 ,public OFormattedControl_BASE
154 sal_uInt32 m_nKeyEvent;
156 public:
157 OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
158 virtual ~OFormattedControl();
160 DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl);
161 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
163 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
165 // ::com::sun::star::lang::XServiceInfo
166 IMPLEMENTATION_NAME(OFormattedControl);
167 virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
169 // ::com::sun::star::lang::XEventListener
170 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
172 // ::com::sun::star::awt::XKeyListener
173 virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
174 virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
176 // ::com::sun::star::awt::XControl
177 virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw ( ::com::sun::star::uno::RuntimeException);
179 // disambiguation
180 using OBoundControl::disposing;
182 private:
183 DECL_LINK( OnKeyPressed, void* );
186 //.........................................................................
188 //.........................................................................
190 #endif // _FORMS_FORMATTEDFIELD_HXX_
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */