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_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
22 
23 #include <comphelper/propertycontainer.hxx>
24 #include <com/sun/star/lang/XUnoTunnel.hpp>
25 #include <comphelper/stl_types.hxx>
26 #include <connectivity/dbtoolsdllapi.hxx>
27 
28 namespace connectivity
29 {
30     namespace sdbcx
31     {
32 
33         // = ODescriptor
34 
35         typedef ::comphelper::OPropertyContainer ODescriptor_PBASE;
36         class OOO_DLLPUBLIC_DBTOOLS ODescriptor
37                     :public ODescriptor_PBASE
38                     ,public css::lang::XUnoTunnel
39         {
40         protected:
41             OUString         m_Name;
42 
43             /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
44 
45                 This method just calls describeProperties, and flags all properties as READONLY if and
46                 only if we do *not* act as descriptor, but as final object.
47 
48                 @seealso    isNew
49             */
50             ::cppu::IPropertyArrayHelper*   doCreateArrayHelper() const;
51 
52         private:
53             comphelper::UStringMixEqual m_aCase;
54             bool                        m_bNew;
55 
56         public:
57             ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew = false);
58 
59             virtual ~ODescriptor() override;
60 
isNew() const61             bool     isNew()  const         { return m_bNew;    }
62             void     setNew(bool _bNew);
63 
isCaseSensitive() const64             bool     isCaseSensitive() const { return m_aCase.isCaseSensitive(); }
65 
66             virtual void construct();
67 
68             // XInterface
69             virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
70             /// @throws css::uno::RuntimeException
71             virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  );
72 
73             // css::lang::XUnoTunnel
74             virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
75             static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
76 
77             // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag
78             static bool isNew( const css::uno::Reference< css::uno::XInterface >& _rxDescriptor );
79         };
80     }
81 
82 }
83 #endif // INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
86