merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / propctrlr / xsdvalidationhelper.hxx
blob6eb7d8caae6103221441769990b79079fe3a9233
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
29 #define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
31 #include "eformshelper.hxx"
32 #include "xsddatatypes.hxx"
34 /** === begin UNO includes === **/
35 #include <com/sun/star/xsd/XDataType.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 /** === end UNO includes === **/
38 #include <rtl/ref.hxx>
40 //........................................................................
41 namespace pcr
43 //........................................................................
45 class XSDDataType;
46 //====================================================================
47 //= XSDValidationHelper
48 //====================================================================
49 class XSDValidationHelper : public EFormsHelper
51 private:
52 bool m_bInspectingFormattedField;
53 public:
54 bool isInspectingFormattedField() const { return m_bInspectingFormattedField; }
56 public:
57 XSDValidationHelper(
58 ::osl::Mutex& _rMutex,
59 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee,
60 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument
63 /** retrieves the names of all XForms models in the document the control lives in
65 void getAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(());
67 /** retrieves a particular data type given by name
69 ::rtl::Reference< XSDDataType >
70 getDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(());
72 /** retrieves the DataType instance which the control model is currently validated against
74 If there is a binding set at our control model, which at the same time acts as validator,
75 and if this validator is bound to an XDataType, then this data type is retrieved here.
77 ::rtl::Reference< XSDDataType >
78 getValidatingDataType( ) const SAL_THROW(());
80 /** retrieves the name of the data type which the control model is currently validated against
82 @seealso getValidatingDataType
84 ::rtl::OUString
85 getValidatingDataTypeName( ) const SAL_THROW(());
87 /** binds the validator to a new data type
89 To be called with an active binding only.
91 void setValidatingDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(());
93 /** removes the data type given by name from the data type repository
95 bool removeDataTypeFromRepository( const ::rtl::OUString& _rName ) const SAL_THROW(());
97 /** creates a new data type, which is a clone of an existing data type
99 bool cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const ::rtl::OUString& _rNewName ) const SAL_THROW(());
101 /** retrieves the name of the basic data type which has the given class
103 ::rtl::OUString
104 getBasicTypeNameForClass( sal_Int16 _eClass ) const SAL_THROW(());
106 /** copy a data type from one model to another
108 If a data type with the given name already exists in the target model, then nothing
109 happens. In particular, the facets of the data type are not copied.
111 void copyDataType( const ::rtl::OUString& _rFromModel, const ::rtl::OUString& _rToModel,
112 const ::rtl::OUString& _rDataTypeName ) const SAL_THROW(());
114 /** finds (and sets) a default format for the formatted field we're inspecting,
115 according to the current data type the control value is evaluated against
117 void findDefaultFormatForIntrospectee() SAL_THROW(());
119 private:
120 /** retrieves the data type repository associated with the current model
122 ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository >
123 getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception));
125 /** retrieves the data type repository associated with any model
127 ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository >
128 getDataTypeRepository( const ::rtl::OUString& _rModelName ) const SAL_THROW((::com::sun::star::uno::Exception));
130 /** retrieves the data type object for the given name
132 ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >
133 getDataType( const ::rtl::OUString& _rName ) const
134 SAL_THROW((::com::sun::star::uno::Exception));
136 /** retrieves the name of the basic data type which has the given class, in the given repository
138 ::rtl::OUString
139 getBasicTypeNameForClass(
140 sal_Int16 _nClass,
141 ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > _rxRepository
142 ) const SAL_THROW(());
145 //........................................................................
146 } // namespace pcr
147 //........................................................................
149 #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX