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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
20 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
22 #include <connectivity/CommonTools.hxx>
23 #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
24 #include <com/sun/star/sdb/XParametersSupplier.hpp>
25 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
26 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/script/XTypeConverter.hpp>
29 #include <cppuhelper/implbase5.hxx>
30 #include <connectivity/sqliterator.hxx>
31 #include <connectivity/sqlparse.hxx>
32 #include "apitools.hxx"
33 #include <comphelper/broadcasthelper.hxx>
34 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
40 typedef ::cppu::ImplHelper5
< ::com::sun::star::sdb::XSQLQueryComposer
,
41 ::com::sun::star::sdb::XParametersSupplier
,
42 ::com::sun::star::sdbcx::XTablesSupplier
,
43 ::com::sun::star::sdbcx::XColumnsSupplier
,
44 ::com::sun::star::lang::XServiceInfo
> OQueryComposer_BASE
;
46 class OQueryComposer
: public ::comphelper::OBaseMutex
,
48 public OQueryComposer_BASE
50 ::std::vector
< OUString
> m_aFilters
;
51 ::std::vector
< OUString
> m_aOrders
;
52 OUString m_sOrgFilter
;
54 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XSingleSelectQueryComposer
> m_xComposer
;
55 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XSingleSelectQueryComposer
> m_xComposerHelper
;
58 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
59 virtual ~OQueryComposer();
62 OQueryComposer( const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
);
64 // ::com::sun::star::lang::XTypeProvider
65 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 // ::com::sun::star::uno::XInterface
69 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
70 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
72 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
74 virtual OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
78 virtual OUString SAL_CALL
getQuery( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual void SAL_CALL
setQuery( const OUString
& command
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 virtual OUString SAL_CALL
getComposedQuery( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual OUString SAL_CALL
getFilter( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > SAL_CALL
getStructuredFilter( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual OUString SAL_CALL
getOrder( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 virtual void SAL_CALL
appendFilterByColumn( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& column
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual void SAL_CALL
appendOrderByColumn( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& column
, sal_Bool ascending
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
setFilter( const OUString
& filter
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual void SAL_CALL
setOrder( const OUString
& order
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getTables( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getColumns( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 // XParametersSupplier
93 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
getParameters( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */