1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
30 #define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
32 #include "eformshelper.hxx"
33 #include "xsddatatypes.hxx"
35 /** === begin UNO includes === **/
36 #include <com/sun/star/xsd/XDataType.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 /** === end UNO includes === **/
39 #include <rtl/ref.hxx>
41 //........................................................................
44 //........................................................................
47 //====================================================================
48 //= XSDValidationHelper
49 //====================================================================
50 class XSDValidationHelper
: public EFormsHelper
53 bool m_bInspectingFormattedField
;
55 bool isInspectingFormattedField() const { return m_bInspectingFormattedField
; }
59 ::osl::Mutex
& _rMutex
,
60 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxIntrospectee
,
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& _rxContextDocument
64 /** retrieves the names of all XForms models in the document the control lives in
66 void getAvailableDataTypeNames( ::std::vector
< ::rtl::OUString
>& /* [out] */ _rNames
) const SAL_THROW(());
68 /** retrieves a particular data type given by name
70 ::rtl::Reference
< XSDDataType
>
71 getDataTypeByName( const ::rtl::OUString
& _rName
) const SAL_THROW(());
73 /** retrieves the DataType instance which the control model is currently validated against
75 If there is a binding set at our control model, which at the same time acts as validator,
76 and if this validator is bound to an XDataType, then this data type is retrieved here.
78 ::rtl::Reference
< XSDDataType
>
79 getValidatingDataType( ) const SAL_THROW(());
81 /** retrieves the name of the data type which the control model is currently validated against
83 @seealso getValidatingDataType
86 getValidatingDataTypeName( ) const SAL_THROW(());
88 /** binds the validator to a new data type
90 To be called with an active binding only.
92 void setValidatingDataTypeByName( const ::rtl::OUString
& _rName
) const SAL_THROW(());
94 /** removes the data type given by name from the data type repository
96 bool removeDataTypeFromRepository( const ::rtl::OUString
& _rName
) const SAL_THROW(());
98 /** creates a new data type, which is a clone of an existing data type
100 bool cloneDataType( const ::rtl::Reference
< XSDDataType
>& _pDataType
, const ::rtl::OUString
& _rNewName
) const SAL_THROW(());
102 /** retrieves the name of the basic data type which has the given class
105 getBasicTypeNameForClass( sal_Int16 _eClass
) const SAL_THROW(());
107 /** copy a data type from one model to another
109 If a data type with the given name already exists in the target model, then nothing
110 happens. In particular, the facets of the data type are not copied.
112 void copyDataType( const ::rtl::OUString
& _rFromModel
, const ::rtl::OUString
& _rToModel
,
113 const ::rtl::OUString
& _rDataTypeName
) const SAL_THROW(());
115 /** finds (and sets) a default format for the formatted field we're inspecting,
116 according to the current data type the control value is evaluated against
118 void findDefaultFormatForIntrospectee() SAL_THROW(());
121 /** retrieves the data type repository associated with the current model
123 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
>
124 getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception
));
126 /** retrieves the data type repository associated with any model
128 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
>
129 getDataTypeRepository( const ::rtl::OUString
& _rModelName
) const SAL_THROW((::com::sun::star::uno::Exception
));
131 /** retrieves the data type object for the given name
133 ::com::sun::star::uno::Reference
< ::com::sun::star::xsd::XDataType
>
134 getDataType( const ::rtl::OUString
& _rName
) const
135 SAL_THROW((::com::sun::star::uno::Exception
));
137 /** retrieves the name of the basic data type which has the given class, in the given repository
140 getBasicTypeNameForClass(
142 ::com::sun::star::uno::Reference
< ::com::sun::star::xforms::XDataTypeRepository
> _rxRepository
143 ) const SAL_THROW(());
146 //........................................................................
148 //........................................................................
150 #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */