1*e6ed5fbcSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*e6ed5fbcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e6ed5fbcSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e6ed5fbcSAndrew Rist * distributed with this work for additional information 6*e6ed5fbcSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e6ed5fbcSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e6ed5fbcSAndrew Rist * "License"); you may not use this file except in compliance 9*e6ed5fbcSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*e6ed5fbcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*e6ed5fbcSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e6ed5fbcSAndrew Rist * software distributed under the License is distributed on an 15*e6ed5fbcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e6ed5fbcSAndrew Rist * KIND, either express or implied. See the License for the 17*e6ed5fbcSAndrew Rist * specific language governing permissions and limitations 18*e6ed5fbcSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*e6ed5fbcSAndrew Rist *************************************************************/ 21*e6ed5fbcSAndrew Rist 22*e6ed5fbcSAndrew Rist 23cdf0e10cSrcweir #include "vbascrollbar.hxx" 24cdf0e10cSrcweir #include <vector> 25cdf0e10cSrcweir 26cdf0e10cSrcweir using namespace com::sun::star; 27cdf0e10cSrcweir using namespace ooo::vba; 28cdf0e10cSrcweir 29cdf0e10cSrcweir 30cdf0e10cSrcweir const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ); 31cdf0e10cSrcweir const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ); 32cdf0e10cSrcweir const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); 33cdf0e10cSrcweir const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ); 34cdf0e10cSrcweir const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ); 35cdf0e10cSrcweir const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") ); 36cdf0e10cSrcweir 37cdf0e10cSrcweir ScVbaScrollBar::ScVbaScrollBar( 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 ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) 38cdf0e10cSrcweir { 39cdf0e10cSrcweir } 40cdf0e10cSrcweir 41cdf0e10cSrcweir // Attributes 42cdf0e10cSrcweir uno::Any SAL_CALL 43cdf0e10cSrcweir ScVbaScrollBar::getValue() throw (css::uno::RuntimeException) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir return m_xProps->getPropertyValue( SCROLLVALUE ); 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir void SAL_CALL 49cdf0e10cSrcweir ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir m_xProps->setPropertyValue( SCROLLVALUE, _value ); 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir ::sal_Int32 SAL_CALL 55cdf0e10cSrcweir ScVbaScrollBar::getMax() throw (uno::RuntimeException) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir sal_Int32 nMax = 0; 58cdf0e10cSrcweir m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax; 59cdf0e10cSrcweir return nMax; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir void SAL_CALL 63cdf0e10cSrcweir ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) 64cdf0e10cSrcweir { 65cdf0e10cSrcweir m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir ::sal_Int32 SAL_CALL 69cdf0e10cSrcweir ScVbaScrollBar::getMin() throw (uno::RuntimeException) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir sal_Int32 nVal = 0; 72cdf0e10cSrcweir m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal; 73cdf0e10cSrcweir return nVal; 74cdf0e10cSrcweir } 75cdf0e10cSrcweir 76cdf0e10cSrcweir void SAL_CALL 77cdf0e10cSrcweir ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir void SAL_CALL 83cdf0e10cSrcweir ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) ); 86cdf0e10cSrcweir } 87cdf0e10cSrcweir 88cdf0e10cSrcweir ::sal_Int32 SAL_CALL 89cdf0e10cSrcweir ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir sal_Int32 nVal = 0; 92cdf0e10cSrcweir m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal; 93cdf0e10cSrcweir return nVal; 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir ::sal_Int32 SAL_CALL 97cdf0e10cSrcweir ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir sal_Int32 nSmallChange = 0; 100cdf0e10cSrcweir m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange; 101cdf0e10cSrcweir return nSmallChange; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir void SAL_CALL 105cdf0e10cSrcweir ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) ); 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110cdf0e10cSrcweir rtl::OUString& 111cdf0e10cSrcweir ScVbaScrollBar::getServiceImplName() 112cdf0e10cSrcweir { 113cdf0e10cSrcweir static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") ); 114cdf0e10cSrcweir return sImplName; 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir uno::Sequence< rtl::OUString > 118cdf0e10cSrcweir ScVbaScrollBar::getServiceNames() 119cdf0e10cSrcweir { 120cdf0e10cSrcweir static uno::Sequence< rtl::OUString > aServiceNames; 121cdf0e10cSrcweir if ( aServiceNames.getLength() == 0 ) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir aServiceNames.realloc( 1 ); 124cdf0e10cSrcweir aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); 125cdf0e10cSrcweir } 126cdf0e10cSrcweir return aServiceNames; 127cdf0e10cSrcweir } 128