1b3f79822SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file 5b3f79822SAndrew Rist * distributed with this work for additional information 6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the 8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance 9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing, 14b3f79822SAndrew Rist * software distributed under the License is distributed on an 15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the 17b3f79822SAndrew Rist * specific language governing permissions and limitations 18b3f79822SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20b3f79822SAndrew Rist *************************************************************/ 21b3f79822SAndrew Rist 22b3f79822SAndrew Rist 23cdf0e10cSrcweir #include "vbavalidation.hxx" 24*f4553f15SPedro Giffuni #include "vbaformatcondition.hxx" //#i108860 25cdf0e10cSrcweir #include <com/sun/star/sheet/XSheetCondition.hpp> 26cdf0e10cSrcweir #include <com/sun/star/sheet/ValidationType.hpp> 27cdf0e10cSrcweir #include <com/sun/star/sheet/ValidationAlertStyle.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 29cdf0e10cSrcweir #include <ooo/vba/excel/XlDVType.hpp> 30cdf0e10cSrcweir #include <ooo/vba/excel/XlFormatConditionOperator.hpp> 31cdf0e10cSrcweir #include <ooo/vba/excel/XlDVAlertStyle.hpp> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "unonames.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir using namespace ::ooo::vba; 36cdf0e10cSrcweir using namespace ::com::sun::star; 37cdf0e10cSrcweir 38cdf0e10cSrcweir const static rtl::OUString VALIDATION( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VALIDAT ) ); 39cdf0e10cSrcweir const static rtl::OUString IGNOREBLANK( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_IGNOREBL ) ); 40cdf0e10cSrcweir const static rtl::OUString SHOWINPUT( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWINP ) ); 41cdf0e10cSrcweir const static rtl::OUString SHOWERROR( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWERR ) ); 42cdf0e10cSrcweir const static rtl::OUString ERRORTITLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRTITLE ) ); 43cdf0e10cSrcweir const static rtl::OUString INPUTTITLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INPTITLE ) ); 44cdf0e10cSrcweir const static rtl::OUString INPUTMESS( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INPMESS ) ); 45cdf0e10cSrcweir const static rtl::OUString ERRORMESS( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRMESS ) ); 46cdf0e10cSrcweir const static rtl::OUString STYPE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_TYPE ) ); 47cdf0e10cSrcweir const static rtl::OUString SHOWLIST( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWLIST ) ); 48cdf0e10cSrcweir const static rtl::OUString ALERTSTYLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRALSTY ) ); 49cdf0e10cSrcweir 50cdf0e10cSrcweir void 51cdf0e10cSrcweir lcl_setValidationProps( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< beans::XPropertySet >& xProps ) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xRangeProps( xRange, uno::UNO_QUERY_THROW ); 54cdf0e10cSrcweir xRangeProps->setPropertyValue( VALIDATION , uno::makeAny( xProps ) ); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir uno::Reference< beans::XPropertySet > 58cdf0e10cSrcweir lcl_getValidationProps( const uno::Reference< table::XCellRange >& xRange ) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xRange, uno::UNO_QUERY_THROW ); 61cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xValProps; 62cdf0e10cSrcweir xValProps.set( xProps->getPropertyValue( VALIDATION ), uno::UNO_QUERY_THROW ); 63cdf0e10cSrcweir return xValProps; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir ::sal_Bool SAL_CALL 67cdf0e10cSrcweir ScVbaValidation::getIgnoreBlank() throw (uno::RuntimeException) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 70cdf0e10cSrcweir sal_Bool bBlank = sal_False; 71cdf0e10cSrcweir xProps->getPropertyValue( IGNOREBLANK ) >>= bBlank; 72cdf0e10cSrcweir return bBlank; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir void SAL_CALL 76cdf0e10cSrcweir ScVbaValidation::setIgnoreBlank( ::sal_Bool _ignoreblank ) throw (uno::RuntimeException) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 79cdf0e10cSrcweir xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( _ignoreblank ) ); 80cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir ::sal_Bool SAL_CALL 84cdf0e10cSrcweir ScVbaValidation::getInCellDropdown() throw (uno::RuntimeException) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 87cdf0e10cSrcweir sal_Int32 nShowList = 0; 88cdf0e10cSrcweir xProps->getPropertyValue( SHOWLIST ) >>= nShowList; 89cdf0e10cSrcweir return ( nShowList ? sal_True : sal_False ); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir void SAL_CALL 93cdf0e10cSrcweir ScVbaValidation::setInCellDropdown( ::sal_Bool _incelldropdown ) throw (uno::RuntimeException) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir sal_Int32 nDropDown = sal_False; 96cdf0e10cSrcweir if ( _incelldropdown ) 97cdf0e10cSrcweir nDropDown = 1; 98cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps(m_xRange) ); 99cdf0e10cSrcweir xProps->setPropertyValue( SHOWLIST, uno::makeAny( nDropDown ) ); 100cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir ::sal_Bool SAL_CALL 104cdf0e10cSrcweir ScVbaValidation::getShowInput() throw (uno::RuntimeException) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 107cdf0e10cSrcweir sal_Bool bShowInput = sal_False; 108cdf0e10cSrcweir xProps->getPropertyValue( SHOWINPUT ) >>= bShowInput; 109cdf0e10cSrcweir return bShowInput; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir void SAL_CALL 113cdf0e10cSrcweir ScVbaValidation:: setShowInput( ::sal_Bool _showinput ) throw (uno::RuntimeException) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps(m_xRange) ); 116cdf0e10cSrcweir xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( _showinput ) ); 117cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir ::sal_Bool SAL_CALL 121cdf0e10cSrcweir ScVbaValidation::getShowError() throw (uno::RuntimeException) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 124cdf0e10cSrcweir sal_Bool bShowError = sal_False; 125cdf0e10cSrcweir xProps->getPropertyValue( SHOWERROR ) >>= bShowError; 126cdf0e10cSrcweir return bShowError; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir void SAL_CALL 130cdf0e10cSrcweir ScVbaValidation::setShowError( ::sal_Bool _showerror ) throw (uno::RuntimeException) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 133cdf0e10cSrcweir xProps->setPropertyValue( SHOWERROR, uno::makeAny( _showerror ) ); 134cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir ::rtl::OUString SAL_CALL 138cdf0e10cSrcweir ScVbaValidation::getErrorTitle() throw (uno::RuntimeException) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 141cdf0e10cSrcweir rtl::OUString sErrorTitle; 142cdf0e10cSrcweir xProps->getPropertyValue( ERRORTITLE ) >>= sErrorTitle; 143cdf0e10cSrcweir return sErrorTitle; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir void 147cdf0e10cSrcweir ScVbaValidation::setErrorTitle( const rtl::OUString& _errormessage ) throw (uno::RuntimeException) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 150cdf0e10cSrcweir xProps->setPropertyValue( ERRORTITLE, uno::makeAny( _errormessage ) ); 151cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 152cdf0e10cSrcweir } 153cdf0e10cSrcweir 154cdf0e10cSrcweir ::rtl::OUString SAL_CALL 155cdf0e10cSrcweir ScVbaValidation::getInputMessage() throw (uno::RuntimeException) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 158cdf0e10cSrcweir rtl::OUString sMsg; 159cdf0e10cSrcweir xProps->getPropertyValue( INPUTMESS ) >>= sMsg; 160cdf0e10cSrcweir return sMsg; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir void SAL_CALL 164cdf0e10cSrcweir ScVbaValidation::setInputMessage( const ::rtl::OUString& _inputmessage ) throw (uno::RuntimeException) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 167cdf0e10cSrcweir xProps->setPropertyValue( INPUTMESS, uno::makeAny( _inputmessage ) ); 168cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir ::rtl::OUString SAL_CALL 172cdf0e10cSrcweir ScVbaValidation::getInputTitle() throw (uno::RuntimeException) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 175cdf0e10cSrcweir rtl::OUString sString; 176cdf0e10cSrcweir xProps->getPropertyValue( INPUTTITLE ) >>= sString; 177cdf0e10cSrcweir return sString; 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir void SAL_CALL 181cdf0e10cSrcweir ScVbaValidation::setInputTitle( const ::rtl::OUString& _inputtitle ) throw (uno::RuntimeException) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 184cdf0e10cSrcweir xProps->setPropertyValue( INPUTTITLE, uno::makeAny( _inputtitle ) ); 185cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir 188cdf0e10cSrcweir ::rtl::OUString SAL_CALL 189cdf0e10cSrcweir ScVbaValidation::getErrorMessage() throw (uno::RuntimeException) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange ); 192cdf0e10cSrcweir rtl::OUString sString; 193cdf0e10cSrcweir xProps->getPropertyValue( ERRORMESS ) >>= sString; 194cdf0e10cSrcweir return sString; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir void SAL_CALL 198cdf0e10cSrcweir ScVbaValidation::setErrorMessage( const ::rtl::OUString& _errormessage ) throw (uno::RuntimeException) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 201cdf0e10cSrcweir xProps->setPropertyValue( ERRORMESS, uno::makeAny( _errormessage ) ); 202cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir 206cdf0e10cSrcweir void SAL_CALL 207cdf0e10cSrcweir ScVbaValidation::Delete( ) throw (uno::RuntimeException) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir rtl::OUString sBlank; 210cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 211cdf0e10cSrcweir uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW ); 212cdf0e10cSrcweir xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( sal_True ) ); 213cdf0e10cSrcweir xProps->setPropertyValue( SHOWINPUT, uno::makeAny( sal_True ) ); 214cdf0e10cSrcweir xProps->setPropertyValue( SHOWERROR, uno::makeAny( sal_True ) ); 215cdf0e10cSrcweir xProps->setPropertyValue( ERRORTITLE, uno::makeAny( sBlank ) ); 216cdf0e10cSrcweir xProps->setPropertyValue( INPUTMESS, uno::makeAny( sBlank) ); 217cdf0e10cSrcweir xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( sheet::ValidationAlertStyle_STOP) ); 218cdf0e10cSrcweir xProps->setPropertyValue( STYPE, uno::makeAny( sheet::ValidationType_ANY ) ); 219cdf0e10cSrcweir xCond->setFormula1( sBlank ); 220cdf0e10cSrcweir xCond->setFormula2( sBlank ); 221cdf0e10cSrcweir xCond->setOperator( sheet::ConditionOperator_NONE ); 222cdf0e10cSrcweir 223cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir void SAL_CALL 226*f4553f15SPedro Giffuni ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& Operator, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); 229cdf0e10cSrcweir uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW ); 230cdf0e10cSrcweir 231cdf0e10cSrcweir sheet::ValidationType nValType = sheet::ValidationType_ANY; 232cdf0e10cSrcweir xProps->getPropertyValue( STYPE ) >>= nValType; 233cdf0e10cSrcweir if ( nValType != sheet::ValidationType_ANY ) 234cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "validation object already exists" ) ), uno::Reference< uno::XInterface >() ); 235cdf0e10cSrcweir sal_Int32 nType = -1; 236cdf0e10cSrcweir if ( !Type.hasValue() || !( Type >>= nType ) ) 237cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "missing required param" ) ), uno::Reference< uno::XInterface >() ); 238cdf0e10cSrcweir 239cdf0e10cSrcweir Delete(); // set up defaults 240cdf0e10cSrcweir rtl::OUString sFormula1; 241cdf0e10cSrcweir Formula1 >>= sFormula1; 242cdf0e10cSrcweir rtl::OUString sFormula2; 243cdf0e10cSrcweir Formula2 >>= sFormula2; 244cdf0e10cSrcweir switch ( nType ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir case excel::XlDVType::xlValidateList: 247cdf0e10cSrcweir { 248cdf0e10cSrcweir // for validate list 249cdf0e10cSrcweir // at least formula1 is required 250cdf0e10cSrcweir if ( !Formula1.hasValue() ) 251cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "missing param" ) ), uno::Reference< uno::XInterface >() ); 252cdf0e10cSrcweir nValType = sheet::ValidationType_LIST; 253cdf0e10cSrcweir xProps->setPropertyValue( STYPE, uno::makeAny(nValType )); 254cdf0e10cSrcweir // #TODO validate required params 255cdf0e10cSrcweir // #TODO need to correct the ';' delimited formula on get/set 256cdf0e10cSrcweir break; 257cdf0e10cSrcweir } 258cdf0e10cSrcweir case excel::XlDVType::xlValidateWholeNumber: 259cdf0e10cSrcweir nValType = sheet::ValidationType_WHOLE; 260cdf0e10cSrcweir xProps->setPropertyValue( STYPE, uno::makeAny(nValType )); 261cdf0e10cSrcweir break; 262cdf0e10cSrcweir default: 263cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unsupported operation..." ) ), uno::Reference< uno::XInterface >() ); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir 266cdf0e10cSrcweir sheet::ValidationAlertStyle eStyle = sheet::ValidationAlertStyle_STOP; 267cdf0e10cSrcweir sal_Int32 nVbaAlertStyle = excel::XlDVAlertStyle::xlValidAlertStop; 268cdf0e10cSrcweir if ( AlertStyle.hasValue() && ( AlertStyle >>= nVbaAlertStyle ) ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir switch( nVbaAlertStyle ) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir case excel::XlDVAlertStyle::xlValidAlertStop: 273cdf0e10cSrcweir // yes I know it's already defaulted but safer to assume 274cdf0e10cSrcweir // someone propbably could change the code above 275cdf0e10cSrcweir eStyle = sheet::ValidationAlertStyle_STOP; 276cdf0e10cSrcweir break; 277cdf0e10cSrcweir case excel::XlDVAlertStyle::xlValidAlertWarning: 278cdf0e10cSrcweir eStyle = sheet::ValidationAlertStyle_WARNING; 279cdf0e10cSrcweir break; 280cdf0e10cSrcweir case excel::XlDVAlertStyle::xlValidAlertInformation: 281cdf0e10cSrcweir eStyle = sheet::ValidationAlertStyle_INFO; 282cdf0e10cSrcweir break; 283cdf0e10cSrcweir default: 284cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bad param..." ) ), uno::Reference< uno::XInterface >() ); 285cdf0e10cSrcweir 286cdf0e10cSrcweir } 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( eStyle ) ); 290cdf0e10cSrcweir 291*f4553f15SPedro Giffuni //#i108860: fix the defect that validation cannot work when the input should be limited between a lower bound and an upper bound 292*f4553f15SPedro Giffuni if ( Operator.hasValue() ) 293*f4553f15SPedro Giffuni { 294*f4553f15SPedro Giffuni css::sheet::ConditionOperator conOperator = ScVbaFormatCondition::retrieveAPIOperator( Operator ); 295*f4553f15SPedro Giffuni xCond->setOperator( conOperator ); 296*f4553f15SPedro Giffuni } //#ii108860 297*f4553f15SPedro Giffuni 298cdf0e10cSrcweir if ( sFormula1.getLength() ) 299cdf0e10cSrcweir xCond->setFormula1( sFormula1 ); 300cdf0e10cSrcweir if ( sFormula2.getLength() ) 301cdf0e10cSrcweir xCond->setFormula2( sFormula2 ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir lcl_setValidationProps( m_xRange, xProps ); 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir ::rtl::OUString SAL_CALL 307cdf0e10cSrcweir ScVbaValidation::getFormula1() throw (uno::RuntimeException) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir uno::Reference< sheet::XSheetCondition > xCond( lcl_getValidationProps( m_xRange ), uno::UNO_QUERY_THROW ); 310cdf0e10cSrcweir return xCond->getFormula1(); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir ::rtl::OUString SAL_CALL 314cdf0e10cSrcweir ScVbaValidation::getFormula2() throw (uno::RuntimeException) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir uno::Reference< sheet::XSheetCondition > xCond( lcl_getValidationProps( m_xRange ), uno::UNO_QUERY_THROW ); 317cdf0e10cSrcweir return xCond->getFormula2(); 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir rtl::OUString& 321cdf0e10cSrcweir ScVbaValidation::getServiceImplName() 322cdf0e10cSrcweir { 323cdf0e10cSrcweir static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaValidation") ); 324cdf0e10cSrcweir return sImplName; 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir uno::Sequence< rtl::OUString > 328cdf0e10cSrcweir ScVbaValidation::getServiceNames() 329cdf0e10cSrcweir { 330cdf0e10cSrcweir static uno::Sequence< rtl::OUString > aServiceNames; 331cdf0e10cSrcweir if ( aServiceNames.getLength() == 0 ) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir aServiceNames.realloc( 1 ); 334cdf0e10cSrcweir aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Validation" ) ); 335cdf0e10cSrcweir } 336cdf0e10cSrcweir return aServiceNames; 337cdf0e10cSrcweir } 338