LibreOffice Module forms (master) 1
EditBase.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <FormComponent.hxx>
23
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
31
32#define PF_SPECIAL_FLAGS 0xFF00
33
34
35namespace frm
36{
37
39{
41
42protected:
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
48// [properties]
49
50 sal_Int16 getLastReadVersion() const { return m_nLastReadVersion; }
51
52public:
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
59 );
60
62 const OEditBaseModel* _pOriginal,
63 const css::uno::Reference< css::uno::XComponentContext>& _rxFactory
64 );
65
66 virtual ~OEditBaseModel() override;
67
68 // XPersistObject
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;
71
72 // XPropertySet
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;
78
79 // XPropertyState
80 virtual css::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const override;
81
82protected:
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);
87
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
91};
92
93
94}
95
96/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: EditBase.cxx:291
virtual sal_uInt16 getPersistenceFlags() const
Definition: EditBase.cxx:153
sal_Int16 getLastReadVersion() const
Definition: EditBase.hxx:50
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
Definition: EditBase.cxx:159
css::uno::Any m_aDefault
Definition: EditBase.hxx:44
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: EditBase.cxx:268
OUString m_aDefaultText
Definition: EditBase.hxx:45
virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
Definition: EditBase.cxx:356
virtual ~OEditBaseModel() override
Definition: EditBase.cxx:79
OEditBaseModel(const OEditBaseModel *_pOriginal, const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: EditBase.cxx:325
void defaultCommonEditProperties()
Definition: EditBase.cxx:217
void readCommonEditProperties(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream)
Definition: EditBase.cxx:224
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
Definition: EditBase.cxx:85
OEditBaseModel(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory, const OUString &_rUnoControlModelTypeName, const OUString &_rDefault, const bool _bSupportExternalBinding, const bool _bSupportsValidation)
sal_Int16 m_nLastReadVersion
Definition: EditBase.hxx:40
void writeCommonEditProperties(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream)
Definition: EditBase.cxx:244
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
unsigned char sal_Bool