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 .
22 #include <FormComponent.hxx>
24 // persistence flags for use with the version id
25 #define PF_HANDLE_COMMON_PROPS 0x8000
26 // Derived classes which use their own persistence methods (read/write) and have an own
27 // version handling therein may want to clear this flag in getPersistenceFlags.
28 // If done so, this class will write a version without a call to writeCommonEditProperties.
29 #define PF_FAKE_FORMATTED_FIELD 0x4000
30 // ... hmmm... a fake, as the name suggests. see OFormattedFieldWrapper
32 #define PF_SPECIAL_FLAGS 0xFF00
38 class OEditBaseModel
: public OBoundControlModel
40 sal_Int16 m_nLastReadVersion
;
43 // [properties] for all EditingFields
44 css::uno::Any m_aDefault
;
45 OUString m_aDefaultText
; // default value
46 bool m_bEmptyIsNull
: 1; // empty string will be interpreted as NULL when committing
47 bool m_bFilterProposal
: 1; // use a list of possible value in filtermode
50 sal_Int16
getLastReadVersion() const { return m_nLastReadVersion
; }
54 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
,
55 const OUString
& _rUnoControlModelTypeName
,
56 const OUString
& _rDefault
,
57 const bool _bSupportExternalBinding
,
58 const bool _bSupportsValidation
62 const OEditBaseModel
* _pOriginal
,
63 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
66 virtual ~OEditBaseModel() override
;
69 virtual void SAL_CALL
write(const css::uno::Reference
< css::io::XObjectOutputStream
>& _rxOutStream
) override
;
70 virtual void SAL_CALL
read(const css::uno::Reference
< css::io::XObjectInputStream
>& _rxInStream
) override
;
73 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
74 virtual sal_Bool SAL_CALL
convertFastPropertyValue(css::uno::Any
& rConvertedValue
, css::uno::Any
& rOldValue
,
75 sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
76 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
77 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
80 virtual css::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const override
;
83 // new properties common to all edit models should be handled with the following two methods
84 void readCommonEditProperties(const css::uno::Reference
< css::io::XObjectInputStream
>& _rxInStream
);
85 void writeCommonEditProperties(const css::uno::Reference
< css::io::XObjectOutputStream
>& _rxOutStream
);
86 void defaultCommonEditProperties();
88 virtual sal_uInt16
getPersistenceFlags() const;
89 // derived classes may use this if they want this base class to write additional version flags
90 // (one of the PF_... constants). After ::read they may ask for that flags with getLastReadVersion
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */