1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #include "vbaspinbutton.hxx" 24 #include <vector> 25 26 using namespace com::sun::star; 27 using namespace ooo::vba; 28 29 30 const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); 31 const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ); 32 const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ); 33 const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") ); 34 35 ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) 36 { 37 } 38 39 // Attributes 40 uno::Any SAL_CALL 41 ScVbaSpinButton::getValue() throw (css::uno::RuntimeException) 42 { 43 return m_xProps->getPropertyValue( SPINVALUE ); 44 } 45 46 void SAL_CALL 47 ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) 48 { 49 m_xProps->setPropertyValue( SPINVALUE, _value ); 50 } 51 52 ::sal_Int32 SAL_CALL 53 ScVbaSpinButton::getMax() throw (uno::RuntimeException) 54 { 55 sal_Int32 nMax = 0; 56 m_xProps->getPropertyValue( SPINMAX ) >>= nMax; 57 return nMax; 58 } 59 60 void SAL_CALL 61 ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) 62 { 63 m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); 64 } 65 66 ::sal_Int32 SAL_CALL 67 ScVbaSpinButton::getMin() throw (uno::RuntimeException) 68 { 69 sal_Int32 nVal = 0; 70 m_xProps->getPropertyValue( SPINMIN ) >>= nVal; 71 return nVal; 72 } 73 74 void SAL_CALL 75 ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) 76 { 77 m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); 78 } 79 80 rtl::OUString& 81 ScVbaSpinButton::getServiceImplName() 82 { 83 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") ); 84 return sImplName; 85 } 86 87 uno::Sequence< rtl::OUString > 88 ScVbaSpinButton::getServiceNames() 89 { 90 static uno::Sequence< rtl::OUString > aServiceNames; 91 if ( aServiceNames.getLength() == 0 ) 92 { 93 aServiceNames.realloc( 1 ); 94 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); 95 } 96 return aServiceNames; 97 } 98