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 "vbascrollbar.hxx"
24 #include <vector>
25
26 using namespace com::sun::star;
27 using namespace ooo::vba;
28
29
30 const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") );
31 const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") );
32 const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
33 const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") );
34 const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") );
35 const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") );
36
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)37 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 )
38 {
39 }
40
41 // Attributes
42 uno::Any SAL_CALL
getValue()43 ScVbaScrollBar::getValue() throw (css::uno::RuntimeException)
44 {
45 return m_xProps->getPropertyValue( SCROLLVALUE );
46 }
47
48 void SAL_CALL
setValue(const uno::Any & _value)49 ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
50 {
51 m_xProps->setPropertyValue( SCROLLVALUE, _value );
52 }
53
54 ::sal_Int32 SAL_CALL
getMax()55 ScVbaScrollBar::getMax() throw (uno::RuntimeException)
56 {
57 sal_Int32 nMax = 0;
58 m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax;
59 return nMax;
60 }
61
62 void SAL_CALL
setMax(sal_Int32 nVal)63 ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
64 {
65 m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) );
66 }
67
68 ::sal_Int32 SAL_CALL
getMin()69 ScVbaScrollBar::getMin() throw (uno::RuntimeException)
70 {
71 sal_Int32 nVal = 0;
72 m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal;
73 return nVal;
74 }
75
76 void SAL_CALL
setMin(sal_Int32 nVal)77 ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
78 {
79 m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) );
80 }
81
82 void SAL_CALL
setLargeChange(::sal_Int32 _largechange)83 ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException)
84 {
85 m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) );
86 }
87
88 ::sal_Int32 SAL_CALL
getLargeChange()89 ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException)
90 {
91 sal_Int32 nVal = 0;
92 m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal;
93 return nVal;
94 }
95
96 ::sal_Int32 SAL_CALL
getSmallChange()97 ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException)
98 {
99 sal_Int32 nSmallChange = 0;
100 m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange;
101 return nSmallChange;
102 }
103
104 void SAL_CALL
setSmallChange(::sal_Int32 _smallchange)105 ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException)
106 {
107 m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) );
108 }
109
110 rtl::OUString&
getServiceImplName()111 ScVbaScrollBar::getServiceImplName()
112 {
113 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") );
114 return sImplName;
115 }
116
117 uno::Sequence< rtl::OUString >
getServiceNames()118 ScVbaScrollBar::getServiceNames()
119 {
120 static uno::Sequence< rtl::OUString > aServiceNames;
121 if ( aServiceNames.getLength() == 0 )
122 {
123 aServiceNames.realloc( 1 );
124 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
125 }
126 return aServiceNames;
127 }
128