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 INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
22 :
23 : #include "commandbase.hxx"
24 : #include "apitools.hxx"
25 : #include <com/sun/star/container/XNameAccess.hpp>
26 : #include <com/sun/star/sdbcx/XRename.hpp>
27 : #include <com/sun/star/sdb/XQueryDefinition.hpp>
28 : #include "datasettings.hxx"
29 : #include "ContentHelper.hxx"
30 : #include "ComponentDefinition.hxx"
31 :
32 : #include <comphelper/propertycontainer.hxx>
33 : #include <comphelper/proparrhlp.hxx>
34 : #include <comphelper/uno3.hxx>
35 : #include <cppuhelper/implbase2.hxx>
36 :
37 : namespace dbaccess
38 : {
39 :
40 : // OCommandDefinition - a database "document" which describes a query
41 96 : class OCommandDefinition_Impl : public OComponentDefinition_Impl
42 : ,public OCommandBase
43 : {
44 : public:
45 : };
46 :
47 : typedef ::cppu::ImplHelper2 < ::com::sun::star::sdbcx::XRename,
48 : ::com::sun::star::sdb::XQueryDefinition
49 : > OCommandDefinition_Base;
50 : class OCommandDefinition;
51 : typedef ::comphelper::OPropertyArrayUsageHelper< OCommandDefinition >
52 : OCommandDefinition_PROP;
53 :
54 : class OCommandDefinition : public OComponentDefinition
55 : ,public OCommandDefinition_Base
56 : ,public OCommandDefinition_PROP
57 : {
58 : protected:
59 : virtual ~OCommandDefinition();
60 :
61 : OCommandDefinition(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
62 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParentContainer
63 : ,const TContentPtr& _pImpl
64 : );
65 :
66 : inline const OCommandDefinition_Impl& getCommandDefinition() const { return dynamic_cast< const OCommandDefinition_Impl& >( *m_pImpl.get() ); }
67 41 : inline OCommandDefinition_Impl& getCommandDefinition() { return dynamic_cast< OCommandDefinition_Impl& >( *m_pImpl.get() ); }
68 :
69 : public:
70 :
71 : OCommandDefinition(
72 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer
73 : ,const OUString& _rElementName
74 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
75 : ,const TContentPtr& _pImpl
76 : );
77 :
78 : virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
79 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 : virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
81 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : // ::com::sun::star::uno::XInterface
84 : DECLARE_XINTERFACE( )
85 :
86 : // ::com::sun::star::lang::XServiceInfo
87 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 :
90 : // ::com::sun::star::lang::XServiceInfo - static methods
91 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static() throw( ::com::sun::star::uno::RuntimeException );
92 : static OUString getImplementationName_static() throw( ::com::sun::star::uno::RuntimeException );
93 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
94 : Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
95 :
96 : // XRename
97 : virtual void SAL_CALL rename( const OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 :
99 : // overrides to resolve ambiguity
100 76 : virtual void SAL_CALL setPropertyValue(const OUString& p1, const com::sun::star::uno::Any& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
101 76 : { OComponentDefinition::setPropertyValue(p1, p2); }
102 99 : virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(const OUString& p1) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
103 99 : { return OComponentDefinition::getPropertyValue(p1); }
104 39 : virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
105 39 : { OComponentDefinition::addPropertyChangeListener(p1, p2); }
106 2 : virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
107 2 : { OComponentDefinition::removePropertyChangeListener(p1, p2); }
108 38 : virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
109 38 : { OComponentDefinition::addVetoableChangeListener(p1, p2); }
110 1 : virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
111 1 : { OComponentDefinition::removeVetoableChangeListener(p1, p2); }
112 0 : virtual com::sun::star::uno::Reference<com::sun::star::ucb::XContentIdentifier> SAL_CALL getIdentifier() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
113 0 : { return OComponentDefinition::getIdentifier(); }
114 0 : virtual OUString SAL_CALL getContentType() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
115 0 : { return OComponentDefinition::getContentType(); }
116 0 : virtual void SAL_CALL addContentEventListener(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
117 0 : { OComponentDefinition::addContentEventListener(p1); }
118 0 : virtual void SAL_CALL removeContentEventListener(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
119 0 : { OComponentDefinition::removeContentEventListener(p1); }
120 41 : virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
121 41 : { OComponentDefinition::dispose(); }
122 0 : virtual void SAL_CALL addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
123 0 : { OComponentDefinition::addEventListener(p1); }
124 0 : virtual void SAL_CALL removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
125 0 : { OComponentDefinition::removeEventListener(p1); }
126 :
127 : // XQueryDefinition properties
128 : OUString getName() throw( ::com::sun::star::uno::RuntimeException );
129 : OUString getCommand() throw( ::com::sun::star::uno::RuntimeException );
130 : void setCommand(const OUString&) throw( ::com::sun::star::uno::RuntimeException );
131 : bool getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException );
132 : void setEscapeProcessing(bool) throw( ::com::sun::star::uno::RuntimeException );
133 : OUString getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException );
134 : void setUpdateTableName(const OUString&) throw( ::com::sun::star::uno::RuntimeException );
135 : OUString getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException );
136 : void setUpdateCatalogName(const OUString&) throw( ::com::sun::star::uno::RuntimeException );
137 : OUString getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException );
138 : void setUpdateSchemaName(const OUString&) throw( ::com::sun::star::uno::RuntimeException );
139 :
140 : // OPropertySetHelper
141 : DECLARE_PROPERTYCONTAINER_DEFAULTS( );
142 :
143 : private:
144 : // helper
145 : void registerProperties();
146 : };
147 :
148 : } // namespace dbaccess
149 :
150 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|