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 EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
21 : #define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
22 :
23 : #include "eformshelper.hxx"
24 : #include "xsddatatypes.hxx"
25 :
26 : #include <com/sun/star/xsd/XDataType.hpp>
27 : #include <com/sun/star/beans/XPropertySet.hpp>
28 : #include <rtl/ref.hxx>
29 :
30 :
31 : namespace pcr
32 : {
33 :
34 :
35 : class XSDDataType;
36 :
37 : //= XSDValidationHelper
38 :
39 0 : class XSDValidationHelper : public EFormsHelper
40 : {
41 : private:
42 : bool m_bInspectingFormattedField;
43 : public:
44 0 : bool isInspectingFormattedField() const { return m_bInspectingFormattedField; }
45 :
46 : public:
47 : XSDValidationHelper(
48 : ::osl::Mutex& _rMutex,
49 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee,
50 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument
51 : );
52 :
53 : /** retrieves the names of all XForms models in the document the control lives in
54 : */
55 : void getAvailableDataTypeNames( ::std::vector< OUString >& /* [out] */ _rNames ) const SAL_THROW(());
56 :
57 : /** retrieves a particular data type given by name
58 : */
59 : ::rtl::Reference< XSDDataType >
60 : getDataTypeByName( const OUString& _rName ) const SAL_THROW(());
61 :
62 : /** retrieves the DataType instance which the control model is currently validated against
63 :
64 : If there is a binding set at our control model, which at the same time acts as validator,
65 : and if this validator is bound to an XDataType, then this data type is retrieved here.
66 : */
67 : ::rtl::Reference< XSDDataType >
68 : getValidatingDataType( ) const SAL_THROW(());
69 :
70 : /** retrieves the name of the data type which the control model is currently validated against
71 :
72 : @seealso getValidatingDataType
73 : */
74 : OUString
75 : getValidatingDataTypeName( ) const SAL_THROW(());
76 :
77 : /** binds the validator to a new data type
78 :
79 : To be called with an active binding only.
80 : */
81 : void setValidatingDataTypeByName( const OUString& _rName ) const SAL_THROW(());
82 :
83 : /** removes the data type given by name from the data type repository
84 : */
85 : bool removeDataTypeFromRepository( const OUString& _rName ) const SAL_THROW(());
86 :
87 : /** creates a new data type, which is a clone of an existing data type
88 : */
89 : bool cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const OUString& _rNewName ) const SAL_THROW(());
90 :
91 : /** retrieves the name of the basic data type which has the given class
92 : */
93 : OUString
94 : getBasicTypeNameForClass( sal_Int16 _eClass ) const SAL_THROW(());
95 :
96 : /** copy a data type from one model to another
97 :
98 : If a data type with the given name already exists in the target model, then nothing
99 : happens. In particular, the facets of the data type are not copied.
100 : */
101 : void copyDataType( const OUString& _rFromModel, const OUString& _rToModel,
102 : const OUString& _rDataTypeName ) const SAL_THROW(());
103 :
104 : /** finds (and sets) a default format for the formatted field we're inspecting,
105 : according to the current data type the control value is evaluated against
106 : */
107 : void findDefaultFormatForIntrospectee() SAL_THROW(());
108 :
109 : private:
110 : /** retrieves the data type repository associated with the current model
111 : */
112 : ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository >
113 : getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception));
114 :
115 : /** retrieves the data type repository associated with any model
116 : */
117 : ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository >
118 : getDataTypeRepository( const OUString& _rModelName ) const SAL_THROW((::com::sun::star::uno::Exception));
119 :
120 : /** retrieves the data type object for the given name
121 : */
122 : ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >
123 : getDataType( const OUString& _rName ) const
124 : SAL_THROW((::com::sun::star::uno::Exception));
125 :
126 : /** retrieves the name of the basic data type which has the given class, in the given repository
127 : */
128 : OUString
129 : getBasicTypeNameForClass(
130 : sal_Int16 _nClass,
131 : ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > _rxRepository
132 : ) const SAL_THROW(());
133 : };
134 :
135 :
136 : } // namespace pcr
137 :
138 :
139 : #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|