Branch data Line data Source code
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 : : #ifndef SVX_TYPECONVERSION_CLIENT_HXX
21 : : #define SVX_TYPECONVERSION_CLIENT_HXX
22 : :
23 : : #include "svx/dbtoolsclient.hxx"
24 : :
25 : : //........................................................................
26 : : namespace svxform
27 : : {
28 : : //........................................................................
29 : :
30 : : //====================================================================
31 : : //= OTypeConversionClient
32 : : //====================================================================
33 [ + - ][ - + ]: 102 : class OTypeConversionClient : public ODbtoolsClient
34 : : {
35 : : protected:
36 : : mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion >
37 : : m_xTypeConversion;
38 : : virtual bool ensureLoaded() const;
39 : :
40 : : public:
41 : : OTypeConversionClient();
42 : :
43 : : // --------------------------------------------------------
44 : 40 : inline ::com::sun::star::util::Date getStandardDate() const
45 : : {
46 : 40 : ::com::sun::star::util::Date aReturn;
47 [ + - ]: 40 : if ( ensureLoaded() )
48 : 40 : aReturn = m_xTypeConversion->getStandardDate();
49 : 40 : return aReturn;
50 : : }
51 : :
52 : : // --------------------------------------------------------
53 : 0 : inline double getValue(
54 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
55 : : const ::com::sun::star::util::Date& _rNullDate ) const
56 : : {
57 : 0 : double nReturn(0);
58 [ # # ]: 0 : if ( ensureLoaded() )
59 : 0 : nReturn = m_xTypeConversion->getValue( _rxVariant, _rNullDate );
60 : 0 : return nReturn;
61 : : }
62 : :
63 : : // --------------------------------------------------------
64 : 96 : inline ::rtl::OUString getFormattedValue(
65 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
66 : : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
67 : : const ::com::sun::star::util::Date& _rNullDate,
68 : : sal_Int32 _nKey,
69 : : sal_Int16 _nKeyType) const
70 : : {
71 : 96 : ::rtl::OUString sReturn;
72 [ + - ][ + - ]: 96 : if ( ensureLoaded() )
73 [ + - ]: 96 : sReturn = m_xTypeConversion->getFormattedValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType);
74 : 96 : return sReturn;
75 : : }
76 : : };
77 : :
78 : : //........................................................................
79 : : } // namespace svxform
80 : : //........................................................................
81 : :
82 : : #endif // SVX_TYPECONVERSION_CLIENT_HXX
83 : :
84 : :
85 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|