1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xsdvalidationhelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
32 #define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
34 #include "eformshelper.hxx"
35 #include "xsddatatypes.hxx"
37 /** === begin UNO includes === **/
38 #include <com/sun/star/xsd/XDataType.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 /** === end UNO includes === **/
41 #include <rtl/ref.hxx>
43 //........................................................................
46 //........................................................................
49 //====================================================================
50 //= XSDValidationHelper
51 //====================================================================
52 class XSDValidationHelper
: public EFormsHelper
55 bool m_bInspectingFormattedField
;
57 bool isInspectingFormattedField() const { return m_bInspectingFormattedField
; }
61 ::osl::Mutex
& _rMutex
,
62 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxIntrospectee
,
63 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& _rxContextDocument
66 /** retrieves the names of all XForms models in the document the control lives in
68 void getAvailableDataTypeNames( ::std::vector
< ::rtl::OUString
>& /* [out] */ _rNames
) const SAL_THROW(());
70 /** retrieves a particular data type given by name
72 ::rtl::Reference
< XSDDataType
>
73 getDataTypeByName( const ::rtl::OUString
& _rName
) const SAL_THROW(());
75 /** retrieves the DataType instance which the control model is currently validated against
77 If there is a binding set at our control model, which at the same time acts as validator,
78 and if this validator is bound to an XDataType, then this data type is retrieved here.
80 ::rtl::Reference
< XSDDataType
>
81 getValidatingDataType( ) const SAL_THROW(());
83 /** retrieves the name of the data type which the control model is currently validated against
85 @seealso getValidatingDataType
88 getValidatingDataTypeName( ) const SAL_THROW(());
90 /** binds the validator to a new data type
92 To be called with an active binding only.
94 void setValidatingDataTypeByName( const ::rtl::OUString
& _rName
) const SAL_THROW(());
96 /** removes the data type given by name from the data type repository
98 bool removeDataTypeFromRepository( const ::rtl::OUString
& _rName
) const SAL_THROW(());
100 /** creates a new data type, which is a clone of an existing data type
102 bool cloneDataType( const ::rtl::Reference
< XSDDataType
>& _pDataType
, const ::rtl::OUString
& _rNewName
) const SAL_THROW(());
104 /** retrieves the name of the basic data type which has the given class
107 getBasicTypeNameForClass( sal_Int16 _eClass
) const SAL_THROW(());
109 /** copy a data type from one model to another
111 If a data type with the given name already exists in the target model, then nothing
112 happens. In particular, the facets of the data type are not copied.
114 void copyDataType( const ::rtl::OUString
& _rFromModel
, const ::rtl::OUString
& _rToModel
,
115 const ::rtl::OUString
& _rDataTypeName
) const SAL_THROW(());
117 /** finds (and sets) a default format for the formatted field we're inspecting,
118 according to the current data type the control value is evaluated against
120 void findDefaultFormatForIntrospectee() SAL_THROW(());
123 /** retrieves the data type repository associated with the current model
125 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
>
126 getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception
));
128 /** retrieves the data type repository associated with any model
130 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
>
131 getDataTypeRepository( const ::rtl::OUString
& _rModelName
) const SAL_THROW((::com::sun::star::uno::Exception
));
133 /** retrieves the data type object for the given name
135 ::com::sun::star::uno::Reference
< ::com::sun::star::xsd::XDataType
>
136 getDataType( const ::rtl::OUString
& _rName
) const
137 SAL_THROW((::com::sun::star::uno::Exception
));
139 /** retrieves the name of the basic data type which has the given class, in the given repository
142 getBasicTypeNameForClass(
144 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
> _rxRepository
145 ) const SAL_THROW(());
148 //........................................................................
150 //........................................................................
152 #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX