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 CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
21 #define CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
23 #include <com/sun/star/sdbc/XRowSet.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/sdb/XColumn.hpp>
26 #include <com/sun/star/sdb/XColumnUpdate.hpp>
27 #include <com/sun/star/util/XNumberFormatter.hpp>
29 #include <boost/noncopyable.hpp>
32 #include "connectivity/dbtoolsdllapi.hxx"
34 namespace comphelper
{ class ComponentContext
; }
36 //........................................................................
39 //........................................................................
41 struct FormattedColumnValue_Data
;
42 //====================================================================
43 //= FormattedColumnValue
44 //====================================================================
45 /** a class which helps retrieving and setting the value of a database column
48 class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue
: public ::boost::noncopyable
51 /** constructs an instance
53 The format key for the string value exchange is taken from the given column object.
54 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
55 Otherwise, a default format matching the column type is determined.
57 The locale of this fallback format is the current system locale.
59 The number formats supplier is determined from the given <code>RowSet</code>, by
60 examining its <code>ActiveConnection</code>.
63 const ::comphelper::ComponentContext
& _rContext
,
64 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSet
>& _rxRowSet
,
65 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxColumn
68 /** constructs an instance
70 The format key for the string value exchange is taken from the given column object.
71 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
72 Otherwise, a default format matching the column type is determined.
74 The locale of this fallback format is the current system locale.
77 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>& i_rNumberFormatter
,
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& i_rColumn
81 // note that all methods of this class need to be virtual, since it's
82 // used in a load-on-demand context in module SVX
84 virtual ~FormattedColumnValue();
88 // access to the details of the formatting we determined
89 virtual sal_Int32
getFormatKey() const;
90 virtual sal_Int32
getFieldType() const;
91 virtual sal_Int16
getKeyType() const;
92 virtual const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
>&
94 virtual const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumnUpdate
>&
95 getColumnUpdate() const;
97 virtual bool setFormattedValue( const OUString
& _rFormattedStringValue
) const;
98 virtual OUString
getFormattedValue() const;
101 ::std::auto_ptr
< FormattedColumnValue_Data
> m_pData
;
104 //........................................................................
105 } // namespace dbtools
106 //........................................................................
108 #endif // CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */