1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #include "vbaspinbutton.hxx" 28 #include <vector> 29 30 using namespace com::sun::star; 31 using namespace ooo::vba; 32 33 34 const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); 35 const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ); 36 const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ); 37 const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") ); 38 39 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 ) 40 { 41 } 42 43 // Attributes 44 uno::Any SAL_CALL 45 ScVbaSpinButton::getValue() throw (css::uno::RuntimeException) 46 { 47 return m_xProps->getPropertyValue( SPINVALUE ); 48 } 49 50 void SAL_CALL 51 ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) 52 { 53 m_xProps->setPropertyValue( SPINVALUE, _value ); 54 } 55 56 ::sal_Int32 SAL_CALL 57 ScVbaSpinButton::getMax() throw (uno::RuntimeException) 58 { 59 sal_Int32 nMax = 0; 60 m_xProps->getPropertyValue( SPINMAX ) >>= nMax; 61 return nMax; 62 } 63 64 void SAL_CALL 65 ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) 66 { 67 m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); 68 } 69 70 ::sal_Int32 SAL_CALL 71 ScVbaSpinButton::getMin() throw (uno::RuntimeException) 72 { 73 sal_Int32 nVal = 0; 74 m_xProps->getPropertyValue( SPINMIN ) >>= nVal; 75 return nVal; 76 } 77 78 void SAL_CALL 79 ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) 80 { 81 m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); 82 } 83 84 rtl::OUString& 85 ScVbaSpinButton::getServiceImplName() 86 { 87 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") ); 88 return sImplName; 89 } 90 91 uno::Sequence< rtl::OUString > 92 ScVbaSpinButton::getServiceNames() 93 { 94 static uno::Sequence< rtl::OUString > aServiceNames; 95 if ( aServiceNames.getLength() == 0 ) 96 { 97 aServiceNames.realloc( 1 ); 98 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); 99 } 100 return aServiceNames; 101 } 102