tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / dbaccess / source / ui / inc / defaultobjectnamecheck.hxx
blobc75528940e15a2ada5adcf09755b35d6831a7e7a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include "objectnamecheck.hxx"
24 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
25 #include <com/sun/star/sdbc/XConnection.hpp>
26 #include <com/sun/star/sdb/tools/XConnectionTools.hpp>
28 #include <memory>
30 namespace dbaui
33 // HierarchicalNameCheck
34 /** class implementing the IObjectNameCheck interface, and checking given object names
35 against a hierarchical name container
37 class HierarchicalNameCheck :public IObjectNameCheck
39 private:
40 css::uno::Reference< css::container::XHierarchicalNameAccess > mxHierarchicalNames;
41 OUString msRelativeRoot;
43 public:
44 /** constructs a HierarchicalNameCheck instance
45 @param _rxNames
46 the hierarchical container of named objects, against which given names should be
47 checked
48 @param _rRelativeRoot
49 the root in the hierarchy against which given names should be checked
50 @throws css::lang::IllegalArgumentException
51 if the given container is <NULL/>
53 HierarchicalNameCheck(
54 const css::uno::Reference< css::container::XHierarchicalNameAccess >& _rxNames,
55 const OUString& _rRelativeRoot
58 virtual ~HierarchicalNameCheck() override;
60 HierarchicalNameCheck(const HierarchicalNameCheck&) = delete;
61 const HierarchicalNameCheck& operator=(const HierarchicalNameCheck&) = delete;
63 // IObjectNameCheck overridables
64 virtual bool isNameValid(
65 const OUString& _rObjectName,
66 ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
67 ) const override;
70 // DynamicTableOrQueryNameCheck
71 /** class implementing the IObjectNameCheck interface, and checking a given name
72 for being valid as either a query or a table name.
74 The class can be parametrized to act as either table name or query name validator.
76 For databases which support queries in queries, the name check is implicitly extended
77 to both queries and tables, no matter which category is checked. This prevents, for
78 such databases, that users can create a query with the name of an existing table,
79 or vice versa.
81 @seealso dbtools::DatabaseMetaData::supportsSubqueriesInFrom
82 @seealso css::sdb::tools::XObjectNames::checkNameForCreate
84 class DynamicTableOrQueryNameCheck :public IObjectNameCheck
86 private:
87 sal_Int32 mnCommandType;
88 css::uno::Reference< css::sdb::tools::XObjectNames > mxObjectNames;
90 public:
91 /** constructs a DynamicTableOrQueryNameCheck instance
92 @param _rxSdbLevelConnection
93 a connection supporting the css.sdb.Connection service, in other word, it
94 does expose the XTablesSupplier and XQueriesSupplier interfaces.
95 @param _nCommandType
96 specifies whether table names or query names should be checked. Only valid values
97 are CommandType::TABLE and CommandType::QUERY.
98 @throws css::lang::IllegalArgumentException
99 if the given connection is <NULL/>, or the given command type is neither
100 CommandType::TABLE nor CommandType::QUERY.
102 DynamicTableOrQueryNameCheck(
103 const css::uno::Reference< css::sdbc::XConnection >& _rxSdbLevelConnection,
104 sal_Int32 _nCommandType
107 virtual ~DynamicTableOrQueryNameCheck() override;
109 DynamicTableOrQueryNameCheck(const DynamicTableOrQueryNameCheck&) = delete;
110 const DynamicTableOrQueryNameCheck& operator=(const DynamicTableOrQueryNameCheck&) = delete;
112 // IObjectNameCheck overridables
113 virtual bool isNameValid(
114 const OUString& _rObjectName,
115 ::dbtools::SQLExceptionInfo& _out_rErrorToDisplay
116 ) const override;
119 } // namespace dbaui
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */