bump product version to 4.2.0.1
[LibreOffice.git] / include / connectivity / formattedcolumnvalue.hxx
blob2da03f8aa96fa05ca0278512f897ef33470ff520
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
30 #include <boost/noncopyable.hpp>
32 #include <memory>
33 #include <connectivity/dbtoolsdllapi.hxx>
35 //........................................................................
36 namespace dbtools
38 //........................................................................
40 struct FormattedColumnValue_Data;
41 //====================================================================
42 //= FormattedColumnValue
43 //====================================================================
44 /** a class which helps retrieving and setting the value of a database column
45 as formatted string.
47 class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue : public ::boost::noncopyable
49 public:
50 /** constructs an instance
52 The format key for the string value exchange is taken from the given column object.
53 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
54 Otherwise, a default format matching the column type is determined.
56 The locale of this fallback format is the current system locale.
58 The number formats supplier is determined from the given <code>RowSet</code>, by
59 examining its <code>ActiveConnection</code>.
61 FormattedColumnValue(
62 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
63 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
64 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
67 /** constructs an instance
69 The format key for the string value exchange is taken from the given column object.
70 If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
71 Otherwise, a default format matching the column type is determined.
73 The locale of this fallback format is the current system locale.
75 FormattedColumnValue(
76 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter,
77 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn
80 // note that all methods of this class need to be virtual, since it's
81 // used in a load-on-demand context in module SVX
83 virtual ~FormattedColumnValue();
85 virtual void clear();
87 // access to the details of the formatting we determined
88 virtual sal_Int32 getFormatKey() const;
89 virtual sal_Int32 getFieldType() const;
90 virtual sal_Int16 getKeyType() const;
91 virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >&
92 getColumn() const;
93 virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate >&
94 getColumnUpdate() const;
96 virtual bool setFormattedValue( const OUString& _rFormattedStringValue ) const;
97 virtual OUString getFormattedValue() const;
99 private:
100 ::std::auto_ptr< FormattedColumnValue_Data > m_pData;
103 //........................................................................
104 } // namespace dbtools
105 //........................................................................
107 #endif // INCLUDED_CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */