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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
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"
32 #include <comphelper/propertycontainer.hxx>
33 #include <comphelper/proparrhlp.hxx>
34 #include <comphelper/uno3.hxx>
35 #include <cppuhelper/implbase2.hxx>
40 // OCommandDefinition - a database "document" which describes a query
41 class OCommandDefinition_Impl
: public OComponentDefinition_Impl
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
;
54 class OCommandDefinition
: public OComponentDefinition
55 ,public OCommandDefinition_Base
56 ,public OCommandDefinition_PROP
59 virtual ~OCommandDefinition();
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
66 inline const OCommandDefinition_Impl
& getCommandDefinition() const { return dynamic_cast< const OCommandDefinition_Impl
& >( *m_pImpl
.get() ); }
67 inline OCommandDefinition_Impl
& getCommandDefinition() { return dynamic_cast< OCommandDefinition_Impl
& >( *m_pImpl
.get() ); }
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
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
;
83 // ::com::sun::star::uno::XInterface
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
;
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
>&);
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
;
99 // overrides to resolve ambiguity
100 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 { OComponentDefinition::setPropertyValue(p1
, p2
); }
102 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 { return OComponentDefinition::getPropertyValue(p1
); }
104 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 { OComponentDefinition::addPropertyChangeListener(p1
, p2
); }
106 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 { OComponentDefinition::removePropertyChangeListener(p1
, p2
); }
108 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 { OComponentDefinition::addVetoableChangeListener(p1
, p2
); }
110 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 { OComponentDefinition::removeVetoableChangeListener(p1
, p2
); }
112 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 { return OComponentDefinition::getIdentifier(); }
114 virtual OUString SAL_CALL
getContentType() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
115 { return OComponentDefinition::getContentType(); }
116 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 { OComponentDefinition::addContentEventListener(p1
); }
118 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 { OComponentDefinition::removeContentEventListener(p1
); }
120 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
121 { OComponentDefinition::dispose(); }
122 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 { OComponentDefinition::addEventListener(p1
); }
124 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 { OComponentDefinition::removeEventListener(p1
); }
127 // XQueryDefinition properties
128 virtual OUString
getName() throw( ::com::sun::star::uno::RuntimeException
);
129 virtual OUString
getCommand() throw( ::com::sun::star::uno::RuntimeException
);
130 virtual void setCommand(const OUString
&) throw( ::com::sun::star::uno::RuntimeException
);
131 virtual bool getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException
);
132 virtual void setEscapeProcessing(bool) throw( ::com::sun::star::uno::RuntimeException
);
133 virtual OUString
getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException
);
134 virtual void setUpdateTableName(const OUString
&) throw( ::com::sun::star::uno::RuntimeException
);
135 virtual OUString
getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException
);
136 virtual void setUpdateCatalogName(const OUString
&) throw( ::com::sun::star::uno::RuntimeException
);
137 virtual OUString
getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException
);
138 virtual void setUpdateSchemaName(const OUString
&) throw( ::com::sun::star::uno::RuntimeException
);
140 // OPropertySetHelper
141 DECLARE_PROPERTYCONTAINER_DEFAULTS( );
145 void registerProperties();
148 } // namespace dbaccess
150 #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */