tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / extensions / source / propctrlr / xsdvalidationhelper.hxx
blob2a77ff584ea00cfd8f072dd6184accc496a41039
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 "eformshelper.hxx"
23 #include "xsddatatypes.hxx"
25 #include <com/sun/star/xsd/XDataType.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <rtl/ref.hxx>
30 namespace pcr
34 class XSDDataType;
36 //= XSDValidationHelper
38 class XSDValidationHelper : public EFormsHelper
40 private:
41 bool m_bInspectingFormattedField;
42 public:
43 bool isInspectingFormattedField() const { return m_bInspectingFormattedField; }
45 public:
46 XSDValidationHelper(
47 ::osl::Mutex& _rMutex,
48 const css::uno::Reference< css::beans::XPropertySet >& _rxIntrospectee,
49 const css::uno::Reference< css::frame::XModel >& _rxContextDocument
52 /** retrieves the names of all XForms models in the document the control lives in
54 void getAvailableDataTypeNames( std::vector< OUString >& /* [out] */ _rNames ) const;
56 /** retrieves a particular data type given by name
58 ::rtl::Reference< XSDDataType >
59 getDataTypeByName( const OUString& _rName ) const;
61 /** retrieves the DataType instance which the control model is currently validated against
63 If there is a binding set at our control model, which at the same time acts as validator,
64 and if this validator is bound to an XDataType, then this data type is retrieved here.
66 ::rtl::Reference< XSDDataType >
67 getValidatingDataType( ) const;
69 /** retrieves the name of the data type which the control model is currently validated against
71 @seealso getValidatingDataType
73 OUString
74 getValidatingDataTypeName( ) const;
76 /** binds the validator to a new data type
78 To be called with an active binding only.
80 void setValidatingDataTypeByName( const OUString& _rName ) const;
82 /** removes the data type given by name from the data type repository
84 bool removeDataTypeFromRepository( const OUString& _rName ) const;
86 /** creates a new data type, which is a clone of an existing data type
88 bool cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const OUString& _rNewName ) const;
90 /** retrieves the name of the basic data type which has the given class
92 OUString
93 getBasicTypeNameForClass( sal_Int16 _eClass ) const;
95 /** copy a data type from one model to another
97 If a data type with the given name already exists in the target model, then nothing
98 happens. In particular, the facets of the data type are not copied.
100 void copyDataType( const OUString& _rFromModel, const OUString& _rToModel,
101 const OUString& _rDataTypeName ) const;
103 /** finds (and sets) a default format for the formatted field we're inspecting,
104 according to the current data type the control value is evaluated against
106 void findDefaultFormatForIntrospectee();
108 private:
109 /** retrieves the data type repository associated with the current model
111 css::uno::Reference< css::xforms::XDataTypeRepository >
112 getDataTypeRepository() const;
114 /** retrieves the data type repository associated with any model
116 css::uno::Reference< css::xforms::XDataTypeRepository >
117 getDataTypeRepository( const OUString& _rModelName ) const;
119 /** retrieves the data type object for the given name
121 css::uno::Reference< css::xsd::XDataType >
122 getDataType( const OUString& _rName ) const;
124 /** retrieves the name of the basic data type which has the given class, in the given repository
126 static OUString
127 getBasicTypeNameForClass(
128 sal_Int16 _nClass,
129 const css::uno::Reference< css::xforms::XDataTypeRepository >& _rxRepository
134 } // namespace pcr
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */