LibreOffice Module dbaccess (master) 1
querycontainer.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 <rtl/ref.hxx>
25
26#include <com/sun/star/beans/XPropertySet.hpp>
27#include <com/sun/star/container/XContainerListener.hpp>
28#include <com/sun/star/container/XNameContainer.hpp>
29#include <com/sun/star/uno/Sequence.hxx>
30#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
31#include <com/sun/star/sdbcx/XAppend.hpp>
32#include <com/sun/star/sdbcx/XDrop.hpp>
33#include <com/sun/star/sdbc/XConnection.hpp>
34#include <com/sun/star/container/XContainerApproveListener.hpp>
35
37
38namespace dbtools
39{
40 class WarningsContainer;
41}
42
43namespace dbaccess
44{
45
46 typedef ::cppu::ImplHelper5 < css::container::XContainerListener
47 , css::container::XContainerApproveListener
48 , css::sdbcx::XDataDescriptorFactory
49 , css::sdbcx::XAppend
50 , css::sdbcx::XDrop
52
53 // OQueryContainer
56 {
57 private:
59 css::uno::Reference< css::container::XNameContainer >
61 css::uno::Reference< css::sdbc::XConnection >
63 // possible actions on our "aggregate"
64 enum class AggregateAction { NONE, Inserting };
66
69 class OAutoActionReset; // just for the following friend declaration
70 friend class OAutoActionReset;
72 {
74 public:
75 OAutoActionReset(OQueryContainer& _rActor) : m_rActor(_rActor) { }
77 };
78
79 // ODefinitionContainer
80 virtual css::uno::Reference< css::ucb::XContent > createObject( const OUString& _rName) override;
81 virtual bool checkExistence(const OUString& _rName) override;
82
83 // helper
84 virtual void SAL_CALL disposing() override;
85 virtual ~OQueryContainer() override;
86
99 const css::uno::Reference< css::container::XNameContainer >& _rxCommandDefinitions,
100 const css::uno::Reference< css::sdbc::XConnection >& _rxConn,
101 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
103 );
104
105 void init();
106
107 public:
109 const css::uno::Reference< css::container::XNameContainer >& _rxCommandDefinitions,
110 const css::uno::Reference< css::sdbc::XConnection >& _rxConn,
111 const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
113 );
114
116 DECLARE_XTYPEPROVIDER( )
118
119 // css::container::XContainerListener
120 virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
121 virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
122 virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
123
124 // XContainerApproveListener
125 virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveInsertElement( const css::container::ContainerEvent& Event ) override;
126 virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveReplaceElement( const css::container::ContainerEvent& Event ) override;
127 virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveRemoveElement( const css::container::ContainerEvent& Event ) override;
128
129 // css::lang::XEventListener
130 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
131
132 // css::sdbcx::XDataDescriptorFactory
133 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override;
134
135 // css::sdbcx::XAppend
136 virtual void SAL_CALL appendByDescriptor( const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
137
138 // css::sdbcx::XDrop
139 virtual void SAL_CALL dropByName( const OUString& elementName ) override;
140 virtual void SAL_CALL dropByIndex( sal_Int32 index ) override;
141
142 // css::container::XElementAccess
143 virtual sal_Bool SAL_CALL hasElements( ) override;
144 // css::container::XIndexAccess
145 virtual sal_Int32 SAL_CALL getCount( ) override;
146 // css::container::XNameAccess
147 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
148
149 private:
150 // OContentHelper overridables
151 virtual OUString determineContentType() const override;
152
153 // helper
158 css::uno::Reference< css::ucb::XContent > implCreateWrapper(const OUString& _rName);
160 css::uno::Reference< css::ucb::XContent > implCreateWrapper(const css::uno::Reference< css::ucb::XContent >& _rxCommandDesc);
161
162 };
163} // namespace dbaccess
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL hasElements() override
static rtl::Reference< OQueryContainer > create(const css::uno::Reference< css::container::XNameContainer > &_rxCommandDefinitions, const css::uno::Reference< css::sdbc::XConnection > &_rxConn, const css::uno::Reference< css::uno::XComponentContext > &_rxORB, ::dbtools::WarningsContainer *_pWarnings)
css::uno::Reference< css::container::XNameContainer > m_xCommandDefinitions
virtual void SAL_CALL dropByName(const OUString &elementName) override
virtual bool checkExistence(const OUString &_rName) override
quickly checks if there already is an element with a given name.
virtual css::uno::Reference< css::ucb::XContent > createObject(const OUString &_rName) override
create an object from its persistent data within the configuration.
virtual void SAL_CALL appendByDescriptor(const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
css::uno::Reference< css::ucb::XContent > implCreateWrapper(const OUString &_rName)
create a query object wrapping a CommandDefinition given by name.
virtual ~OQueryContainer() override
virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveRemoveElement(const css::container::ContainerEvent &Event) override
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
virtual void SAL_CALL disposing() override
css::uno::Reference< css::sdbc::XConnection > m_xConnection
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveReplaceElement(const css::container::ContainerEvent &Event) override
virtual sal_Int32 SAL_CALL getCount() override
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
virtual void SAL_CALL dropByIndex(sal_Int32 index) override
virtual OUString determineContentType() const override
AggregateAction m_eDoingCurrently
::dbtools::WarningsContainer * m_pWarnings
OQueryContainer(const css::uno::Reference< css::container::XNameContainer > &_rxCommandDefinitions, const css::uno::Reference< css::sdbc::XConnection > &_rxConn, const css::uno::Reference< css::uno::XComponentContext > &_rxORB, ::dbtools::WarningsContainer *_pWarnings)
ctor of the container.
virtual css::uno::Reference< css::util::XVeto > SAL_CALL approveInsertElement(const css::container::ContainerEvent &Event) override
NONE
::cppu::ImplHelper5< css::container::XContainerListener, css::container::XContainerApproveListener, css::sdbcx::XDataDescriptorFactory, css::sdbcx::XAppend, css::sdbcx::XDrop > OQueryContainer_Base
unsigned char sal_Bool
#define DECLARE_XINTERFACE()