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 INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
21 #define INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/sdb/XColumn.hpp>
25 #include <com/sun/star/sdb/XColumnUpdate.hpp>
26 #include <com/sun/star/sdbc/XRowSet.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/util/XNumberFormatter.hpp>
29 #include <connectivity/dbtoolsdllapi.hxx>
34 struct FormattedColumnValue_Data
;
36 //= FormattedColumnValue
38 /** a class which helps retrieving and setting the value of a database column
41 class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue
44 /** constructs an instance
46 The format key for the string value exchange is taken from the given column object.
47 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
48 Otherwise, a default format matching the column type is determined.
50 The locale of this fallback format is the current system locale.
52 The number formats supplier is determined from the given <code>RowSet</code>, by
53 examining its <code>ActiveConnection</code>.
56 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxContext
,
57 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSet
>& _rxRowSet
,
58 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxColumn
61 /** constructs an instance
63 The format key for the string value exchange is taken from the given column object.
64 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
65 Otherwise, a default format matching the column type is determined.
67 The locale of this fallback format is the current system locale.
70 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>& i_rNumberFormatter
,
71 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& i_rColumn
74 // note that all methods of this class need to be virtual, since it's
75 // used in a load-on-demand context in module SVX
77 virtual ~FormattedColumnValue();
81 // access to the details of the formatting we determined
82 sal_Int32
getFormatKey() const;
83 sal_Int32
getFieldType() const;
84 sal_Int16
getKeyType() const;
85 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
>&
87 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumnUpdate
>&
88 getColumnUpdate() const;
90 bool setFormattedValue( const OUString
& _rFormattedStringValue
) const;
91 OUString
getFormattedValue() const;
94 FormattedColumnValue(const FormattedColumnValue
&) SAL_DELETED_FUNCTION
;
95 FormattedColumnValue
& operator=(const FormattedColumnValue
&) SAL_DELETED_FUNCTION
;
96 std::unique_ptr
< FormattedColumnValue_Data
> m_pData
;
100 } // namespace dbtools
103 #endif // INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */