LibreOffice Module dbaccess (master) 1
querydescriptor.hxx
Go to the documentation of this file.
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#pragma once
21
24#include <osl/mutex.hxx>
25
26#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28
29#include <apitools.hxx>
30#include <column.hxx>
31#include <datasettings.hxx>
32#include <commandbase.hxx>
34#include <comphelper/uno3.hxx>
35
36namespace dbaccess
37{
38
39// OQueryDescriptor_Base - a query descriptor (as the name suggests :)
41 css::sdbcx::XColumnsSupplier,
42 css::lang::XServiceInfo > OQueryDescriptor_BASE;
43
46 ,public OCommandBase
47 ,public IColumnFactory
49{
50private:
51 bool m_bColumnsOutOfDate : 1; // the columns have to be rebuild on the next getColumns ?
52 ::osl::Mutex& m_rMutex;
53
54protected:
55 std::unique_ptr<OColumns> m_pColumns; // our column descriptions
57 virtual ~OQueryDescriptor_Base();
58
59 void setColumnsOutOfDate( bool _bOutOfDate = true );
60
61 sal_Int32 getColumnCount() const { return m_pColumns ? m_pColumns->getCount() : 0; }
62 void clearColumns( );
63
64 void implAppendColumn( const OUString& _rName, OColumn* _pColumn );
65
66public:
67 OQueryDescriptor_Base(::osl::Mutex& _rMutex,::cppu::OWeakObject& _rMySelf);
72
73// css::sdbcx::XColumnsSupplier
74 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
75
76// css::lang::XServiceInfo
77 virtual OUString SAL_CALL getImplementationName( ) override;
78 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
80
81protected:
82
83// IColumnFactory
84 virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
85 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
86 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
87 virtual void columnDropped(const OUString& _sName) override;
88
93 virtual void rebuildColumns( );
94
95 void disposeColumns();
96
97 // IRefreshableColumns overridables
98 virtual void refreshColumns() override;
99};
100
102 ,public ::cppu::OWeakObject
104 ,public ::comphelper::OPropertyArrayUsageHelper< OQueryDescriptor_Base >
105 ,public ODataSettings
106{
108 void operator =(const OQueryDescriptor&) = delete;
109 // helper
110 void registerProperties();
111protected:
112 // OPropertyArrayUsageHelper
113 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
114
115 // OPropertySetHelper
116 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
117
118 virtual ~OQueryDescriptor() override;
119public:
121 explicit OQueryDescriptor(const OQueryDescriptor_Base& _rSource);
122
123 virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
124 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
125
126// css::uno::XInterface
128
129 // css::beans::XPropertySet
130 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
131
132};
133} // namespace dbaccess
134
135/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OQueryDescriptor_Base(::osl::Mutex &_rMutex,::cppu::OWeakObject &_rMySelf)
virtual void refreshColumns() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void setColumnsOutOfDate(bool _bOutOfDate=true)
virtual rtl::Reference< OColumn > createColumn(const OUString &_rName) const override
creates an OColumn object which should represent the column with a given name
virtual void rebuildColumns()
rebuild our columns set
void implAppendColumn(const OUString &_rName, OColumn *_pColumn)
virtual void columnAppended(const css::uno::Reference< css::beans::XPropertySet > &_rxSourceDescriptor) override
notifies that a column, created from a column descriptor, has been appended
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override
creates a column descriptor object.
virtual OUString SAL_CALL getImplementationName() override
virtual void columnDropped(const OUString &_sName) override
notifies that a column with a given name has been dropped
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
std::unique_ptr< OColumns > m_pColumns
void operator=(const OQueryDescriptor &)=delete
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
OQueryDescriptor(const OQueryDescriptor &)=delete
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual ~OQueryDescriptor() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
::cppu::ImplHelper2< css::sdbcx::XColumnsSupplier, css::lang::XServiceInfo > OQueryDescriptor_BASE
unsigned char sal_Bool
#define DECLARE_XINTERFACE()