1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX 25*b1cdbd2cSJim Jagielski #define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include "eformshelper.hxx" 28*b1cdbd2cSJim Jagielski #include "xsddatatypes.hxx" 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski /** === begin UNO includes === **/ 31*b1cdbd2cSJim Jagielski #include <com/sun/star/xsd/XDataType.hpp> 32*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/XPropertySet.hpp> 33*b1cdbd2cSJim Jagielski /** === end UNO includes === **/ 34*b1cdbd2cSJim Jagielski #include <rtl/ref.hxx> 35*b1cdbd2cSJim Jagielski 36*b1cdbd2cSJim Jagielski //........................................................................ 37*b1cdbd2cSJim Jagielski namespace pcr 38*b1cdbd2cSJim Jagielski { 39*b1cdbd2cSJim Jagielski //........................................................................ 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski class XSDDataType; 42*b1cdbd2cSJim Jagielski //==================================================================== 43*b1cdbd2cSJim Jagielski //= XSDValidationHelper 44*b1cdbd2cSJim Jagielski //==================================================================== 45*b1cdbd2cSJim Jagielski class XSDValidationHelper : public EFormsHelper 46*b1cdbd2cSJim Jagielski { 47*b1cdbd2cSJim Jagielski private: 48*b1cdbd2cSJim Jagielski bool m_bInspectingFormattedField; 49*b1cdbd2cSJim Jagielski public: isInspectingFormattedField() const50*b1cdbd2cSJim Jagielski bool isInspectingFormattedField() const { return m_bInspectingFormattedField; } 51*b1cdbd2cSJim Jagielski 52*b1cdbd2cSJim Jagielski public: 53*b1cdbd2cSJim Jagielski XSDValidationHelper( 54*b1cdbd2cSJim Jagielski ::osl::Mutex& _rMutex, 55*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee, 56*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument 57*b1cdbd2cSJim Jagielski ); 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski /** retrieves the names of all XForms models in the document the control lives in 60*b1cdbd2cSJim Jagielski */ 61*b1cdbd2cSJim Jagielski void getAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(()); 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski /** retrieves a particular data type given by name 64*b1cdbd2cSJim Jagielski */ 65*b1cdbd2cSJim Jagielski ::rtl::Reference< XSDDataType > 66*b1cdbd2cSJim Jagielski getDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()); 67*b1cdbd2cSJim Jagielski 68*b1cdbd2cSJim Jagielski /** retrieves the DataType instance which the control model is currently validated against 69*b1cdbd2cSJim Jagielski 70*b1cdbd2cSJim Jagielski If there is a binding set at our control model, which at the same time acts as validator, 71*b1cdbd2cSJim Jagielski and if this validator is bound to an XDataType, then this data type is retrieved here. 72*b1cdbd2cSJim Jagielski */ 73*b1cdbd2cSJim Jagielski ::rtl::Reference< XSDDataType > 74*b1cdbd2cSJim Jagielski getValidatingDataType( ) const SAL_THROW(()); 75*b1cdbd2cSJim Jagielski 76*b1cdbd2cSJim Jagielski /** retrieves the name of the data type which the control model is currently validated against 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski @seealso getValidatingDataType 79*b1cdbd2cSJim Jagielski */ 80*b1cdbd2cSJim Jagielski ::rtl::OUString 81*b1cdbd2cSJim Jagielski getValidatingDataTypeName( ) const SAL_THROW(()); 82*b1cdbd2cSJim Jagielski 83*b1cdbd2cSJim Jagielski /** binds the validator to a new data type 84*b1cdbd2cSJim Jagielski 85*b1cdbd2cSJim Jagielski To be called with an active binding only. 86*b1cdbd2cSJim Jagielski */ 87*b1cdbd2cSJim Jagielski void setValidatingDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()); 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim Jagielski /** removes the data type given by name from the data type repository 90*b1cdbd2cSJim Jagielski */ 91*b1cdbd2cSJim Jagielski bool removeDataTypeFromRepository( const ::rtl::OUString& _rName ) const SAL_THROW(()); 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski /** creates a new data type, which is a clone of an existing data type 94*b1cdbd2cSJim Jagielski */ 95*b1cdbd2cSJim Jagielski bool cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const ::rtl::OUString& _rNewName ) const SAL_THROW(()); 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski /** retrieves the name of the basic data type which has the given class 98*b1cdbd2cSJim Jagielski */ 99*b1cdbd2cSJim Jagielski ::rtl::OUString 100*b1cdbd2cSJim Jagielski getBasicTypeNameForClass( sal_Int16 _eClass ) const SAL_THROW(()); 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski /** copy a data type from one model to another 103*b1cdbd2cSJim Jagielski 104*b1cdbd2cSJim Jagielski If a data type with the given name already exists in the target model, then nothing 105*b1cdbd2cSJim Jagielski happens. In particular, the facets of the data type are not copied. 106*b1cdbd2cSJim Jagielski */ 107*b1cdbd2cSJim Jagielski void copyDataType( const ::rtl::OUString& _rFromModel, const ::rtl::OUString& _rToModel, 108*b1cdbd2cSJim Jagielski const ::rtl::OUString& _rDataTypeName ) const SAL_THROW(()); 109*b1cdbd2cSJim Jagielski 110*b1cdbd2cSJim Jagielski /** finds (and sets) a default format for the formatted field we're inspecting, 111*b1cdbd2cSJim Jagielski according to the current data type the control value is evaluated against 112*b1cdbd2cSJim Jagielski */ 113*b1cdbd2cSJim Jagielski void findDefaultFormatForIntrospectee() SAL_THROW(()); 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski private: 116*b1cdbd2cSJim Jagielski /** retrieves the data type repository associated with the current model 117*b1cdbd2cSJim Jagielski */ 118*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > 119*b1cdbd2cSJim Jagielski getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception)); 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski /** retrieves the data type repository associated with any model 122*b1cdbd2cSJim Jagielski */ 123*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > 124*b1cdbd2cSJim Jagielski getDataTypeRepository( const ::rtl::OUString& _rModelName ) const SAL_THROW((::com::sun::star::uno::Exception)); 125*b1cdbd2cSJim Jagielski 126*b1cdbd2cSJim Jagielski /** retrieves the data type object for the given name 127*b1cdbd2cSJim Jagielski */ 128*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType > 129*b1cdbd2cSJim Jagielski getDataType( const ::rtl::OUString& _rName ) const 130*b1cdbd2cSJim Jagielski SAL_THROW((::com::sun::star::uno::Exception)); 131*b1cdbd2cSJim Jagielski 132*b1cdbd2cSJim Jagielski /** retrieves the name of the basic data type which has the given class, in the given repository 133*b1cdbd2cSJim Jagielski */ 134*b1cdbd2cSJim Jagielski ::rtl::OUString 135*b1cdbd2cSJim Jagielski getBasicTypeNameForClass( 136*b1cdbd2cSJim Jagielski sal_Int16 _nClass, 137*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > _rxRepository 138*b1cdbd2cSJim Jagielski ) const SAL_THROW(()); 139*b1cdbd2cSJim Jagielski }; 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski //........................................................................ 142*b1cdbd2cSJim Jagielski } // namespace pcr 143*b1cdbd2cSJim Jagielski //........................................................................ 144*b1cdbd2cSJim Jagielski 145*b1cdbd2cSJim Jagielski #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX 146*b1cdbd2cSJim Jagielski 147