1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_EDIT_HXX_
21 #define _FORMS_EDIT_HXX_
23 #include "EditBase.hxx"
25 #include <tools/link.hxx>
26 #include <cppuhelper/implbase3.hxx>
28 namespace dbtools
{ class FormattedColumnValue
; }
30 //.........................................................................
34 //==================================================================
36 //==================================================================
38 :public OEditBaseModel
40 ::std::auto_ptr
< ::dbtools::FormattedColumnValue
>
42 sal_Bool m_bMaxTextLenModified
: 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate
44 sal_Bool m_bWritingFormattedFake
: 1;
45 // are we writing something which should be interpreted as formatted upon reading?
48 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> _getTypes();
50 DECLARE_DEFAULT_LEAF_XTOR( OEditModel
);
52 void enableFormattedWriteFake() { m_bWritingFormattedFake
= sal_True
; }
53 void disableFormattedWriteFake() { m_bWritingFormattedFake
= sal_False
; }
54 sal_Bool
lastReadWasFormattedFake() const { return (getLastReadVersion() & PF_FAKE_FORMATTED_FIELD
) != 0; }
56 friend InterfaceRef SAL_CALL
OEditModel_CreateInstance(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
57 friend class OFormattedFieldWrapper
;
58 friend class OFormattedModel
; // temporary
61 virtual void SAL_CALL
disposing();
64 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
67 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
);
68 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
);
69 virtual OUString SAL_CALL
getServiceName() throw ( ::com::sun::star::uno::RuntimeException
);
72 using OBoundControlModel::getFastPropertyValue
;
75 virtual void SAL_CALL
reset( ) throw(::com::sun::star::uno::RuntimeException
);
78 IMPLEMENTATION_NAME(OEditModel
);
79 virtual StringSequence SAL_CALL
getSupportedServiceNames() throw();
81 // OControlModel's property handling
82 virtual void describeFixedProperties(
83 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rProps
85 virtual void describeAggregateProperties(
86 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rAggregateProps
90 using OBoundControlModel::disposing
;
93 // OControlModel overridables
94 virtual void writeAggregate( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XObjectOutputStream
>& _rxOutStream
) const;
95 virtual void readAggregate( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XObjectInputStream
>& _rxInStream
);
97 // OBoundControlModel overridables
98 virtual ::com::sun::star::uno::Any
99 translateDbColumnToControlValue( );
100 virtual sal_Bool
commitControlValueToDbColumn( bool _bPostReset
);
102 virtual ::com::sun::star::uno::Any
103 getDefaultForReset() const;
105 virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxForm
);
106 virtual void onDisconnectedDbColumn();
108 virtual sal_Bool
approveDbColumnType( sal_Int32 _nColumnType
);
110 virtual void resetNoBroadcast();
113 virtual sal_uInt16
getPersistenceFlags() const;
115 DECLARE_XCLONEABLE();
118 bool implActsAsRichText( ) const;
121 //==================================================================
123 //==================================================================
124 typedef ::cppu::ImplHelper3
< ::com::sun::star::awt::XFocusListener
,
125 ::com::sun::star::awt::XKeyListener
,
126 ::com::sun::star::form::XChangeBroadcaster
> OEditControl_BASE
;
128 class OEditControl
: public OBoundControl
129 ,public OEditControl_BASE
131 ::cppu::OInterfaceContainerHelper
134 OUString m_aHtmlChangeValue
;
135 sal_uInt32 m_nKeyEvent
;
138 OEditControl(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
139 virtual ~OEditControl();
141 DECLARE_UNO3_AGG_DEFAULTS(OEditControl
, OBoundControl
);
142 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(const ::com::sun::star::uno::Type
& _rType
) throw(::com::sun::star::uno::RuntimeException
);
144 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> _getTypes();
147 virtual void SAL_CALL
disposing();
149 // ::com::sun::star::lang::XEventListener
150 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& _rSource
) throw(::com::sun::star::uno::RuntimeException
);
152 // ::com::sun::star::lang::XServiceInfo
153 IMPLEMENTATION_NAME(OEditControl
);
154 virtual StringSequence SAL_CALL
getSupportedServiceNames() throw();
156 // ::com::sun::star::form::XChangeBroadcaster
157 virtual void SAL_CALL
addChangeListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XChangeListener
>& _rxListener
) throw ( ::com::sun::star::uno::RuntimeException
);
158 virtual void SAL_CALL
removeChangeListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XChangeListener
>& _rxListener
) throw ( ::com::sun::star::uno::RuntimeException
);
160 // ::com::sun::star::awt::XFocusListener
161 virtual void SAL_CALL
focusGained( const ::com::sun::star::awt::FocusEvent
& e
) throw ( ::com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
focusLost( const ::com::sun::star::awt::FocusEvent
& e
) throw ( ::com::sun::star::uno::RuntimeException
);
164 // ::com::sun::star::awt::XKeyListener
165 virtual void SAL_CALL
keyPressed(const ::com::sun::star::awt::KeyEvent
& e
) throw ( ::com::sun::star::uno::RuntimeException
);
166 virtual void SAL_CALL
keyReleased(const ::com::sun::star::awt::KeyEvent
& e
) throw ( ::com::sun::star::uno::RuntimeException
);
169 virtual void SAL_CALL
createPeer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& _rxToolkit
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& _rxParent
) throw ( ::com::sun::star::uno::RuntimeException
);
172 DECL_LINK( OnKeyPressed
, void* );
175 //.........................................................................
177 //.........................................................................
179 #endif // _FORMS_EDIT_HXX_
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */