Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "vbasheetobject.hxx"
21 : #include <com/sun/star/awt/TextAlign.hpp>
22 : #include <com/sun/star/container/XIndexContainer.hpp>
23 : #include <com/sun/star/drawing/XControlShape.hpp>
24 : #include <com/sun/star/script/ScriptEventDescriptor.hpp>
25 : #include <com/sun/star/script/XEventAttacherManager.hpp>
26 : #include <com/sun/star/style/VerticalAlignment.hpp>
27 : #include <ooo/vba/excel/Constants.hpp>
28 : #include <ooo/vba/excel/XlOrientation.hpp>
29 : #include <ooo/vba/excel/XlPlacement.hpp>
30 : #include <rtl/ustrbuf.hxx>
31 : #include <filter/msfilter/msvbahelper.hxx>
32 : #include <svx/unoshape.hxx>
33 : #include "vbafont.hxx"
34 : #include "drwlayer.hxx"
35 :
36 : using ::rtl::OUString;
37 : using namespace ::com::sun::star;
38 : using namespace ::ooo::vba;
39 :
40 : // ============================================================================
41 :
42 0 : ScVbaButtonCharacters::ScVbaButtonCharacters(
43 : const uno::Reference< XHelperInterface >& rxParent,
44 : const uno::Reference< uno::XComponentContext >& rxContext,
45 : const uno::Reference< beans::XPropertySet >& rxPropSet,
46 : const ScVbaPalette& rPalette,
47 : const uno::Any& rStart,
48 : const uno::Any& rLength ) throw (uno::RuntimeException) :
49 : ScVbaButtonCharacters_BASE( rxParent, rxContext ),
50 : maPalette( rPalette ),
51 0 : mxPropSet( rxPropSet, uno::UNO_SET_THROW )
52 : {
53 : // extract optional start parameter (missing or invalid -> from beginning)
54 0 : if( !(rStart >>= mnStart) || (mnStart < 1) )
55 0 : mnStart = 1;
56 0 : --mnStart; // VBA is 1-based, rtl string is 0-based
57 :
58 : // extract optional length parameter (missing or invalid -> to end)
59 0 : if( !(rLength >>= mnLength) || (mnLength < 1) )
60 0 : mnLength = SAL_MAX_INT32;
61 0 : }
62 :
63 0 : ScVbaButtonCharacters::~ScVbaButtonCharacters()
64 : {
65 0 : }
66 :
67 : // XCharacters attributes
68 :
69 0 : OUString SAL_CALL ScVbaButtonCharacters::getCaption() throw (uno::RuntimeException)
70 : {
71 : // ignore invalid mnStart and/or mnLength members
72 0 : OUString aString = getFullString();
73 0 : sal_Int32 nStart = ::std::min( mnStart, aString.getLength() );
74 0 : sal_Int32 nLength = ::std::min( mnLength, aString.getLength() - nStart );
75 0 : return aString.copy( nStart, nLength );
76 : }
77 :
78 0 : void SAL_CALL ScVbaButtonCharacters::setCaption( const OUString& rCaption ) throw (uno::RuntimeException)
79 : {
80 : /* Replace the covered text with the passed text, ignore invalid mnStart
81 : and/or mnLength members. This operation does not affect the mnLength
82 : parameter. If the inserted text is longer than mnLength, the additional
83 : characters are not covered by this object. If the inserted text is
84 : shorter than mnLength, other uncovered characters from the original
85 : string will be covered now, thus may be changed with subsequent
86 : operations. */
87 0 : OUString aString = getFullString();
88 0 : sal_Int32 nStart = ::std::min( mnStart, aString.getLength() );
89 0 : sal_Int32 nLength = ::std::min( mnLength, aString.getLength() - nStart );
90 0 : setFullString( aString.replaceAt( nStart, nLength, rCaption ) );
91 0 : }
92 :
93 0 : sal_Int32 SAL_CALL ScVbaButtonCharacters::getCount() throw (uno::RuntimeException)
94 : {
95 : // always return the total length of the caption
96 0 : return getFullString().getLength();
97 : }
98 :
99 0 : OUString SAL_CALL ScVbaButtonCharacters::getText() throw (uno::RuntimeException)
100 : {
101 : // Text attribute same as Caption attribute?
102 0 : return getCaption();
103 : }
104 :
105 0 : void SAL_CALL ScVbaButtonCharacters::setText( const OUString& rText ) throw (uno::RuntimeException)
106 : {
107 : // Text attribute same as Caption attribute?
108 0 : setCaption( rText );
109 0 : }
110 :
111 0 : uno::Reference< excel::XFont > SAL_CALL ScVbaButtonCharacters::getFont() throw (uno::RuntimeException)
112 : {
113 0 : return new ScVbaFont( this, mxContext, maPalette, mxPropSet, 0, true );
114 : }
115 :
116 0 : void SAL_CALL ScVbaButtonCharacters::setFont( const uno::Reference< excel::XFont >& /*rxFont*/ ) throw (uno::RuntimeException)
117 : {
118 : // TODO
119 0 : }
120 :
121 : // XCharacters methods
122 :
123 0 : void SAL_CALL ScVbaButtonCharacters::Insert( const OUString& rString ) throw (uno::RuntimeException)
124 : {
125 : /* The Insert() operation is in fact "replace covered characters", at
126 : least for buttons... It seems there is no easy way to really insert a
127 : substring. This operation does not affect the mnLength parameter. */
128 0 : setCaption( rString );
129 0 : }
130 :
131 0 : void SAL_CALL ScVbaButtonCharacters::Delete() throw (uno::RuntimeException)
132 : {
133 : /* The Delete() operation is nothing else than "replace with empty string".
134 : This does not affect the mnLength parameter, multiple calls of Delete()
135 : will remove characters as long as there are some more covered by this
136 : object. */
137 0 : setCaption( OUString() );
138 0 : }
139 :
140 : // XHelperInterface
141 :
142 0 : VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaButtonCharacters, "ooo.vba.excel.Characters" )
143 :
144 : // private
145 :
146 0 : OUString ScVbaButtonCharacters::getFullString() const throw (uno::RuntimeException)
147 : {
148 0 : return mxPropSet->getPropertyValue( "Label" ).get< OUString >();
149 : }
150 :
151 0 : void ScVbaButtonCharacters::setFullString( const OUString& rString ) throw (uno::RuntimeException)
152 : {
153 0 : mxPropSet->setPropertyValue( "Label", uno::Any( rString ) );
154 0 : }
155 :
156 : // ============================================================================
157 :
158 0 : ScVbaSheetObjectBase::ScVbaSheetObjectBase(
159 : const uno::Reference< XHelperInterface >& rxParent,
160 : const uno::Reference< uno::XComponentContext >& rxContext,
161 : const uno::Reference< frame::XModel >& rxModel,
162 : const uno::Reference< drawing::XShape >& rxShape ) throw (uno::RuntimeException) :
163 : ScVbaSheetObject_BASE( rxParent, rxContext ),
164 : maPalette( rxModel ),
165 : mxModel( rxModel, uno::UNO_SET_THROW ),
166 : mxShape( rxShape, uno::UNO_SET_THROW ),
167 0 : mxShapeProps( rxShape, uno::UNO_QUERY_THROW )
168 : {
169 0 : }
170 :
171 : // XSheetObject attributes
172 :
173 0 : double SAL_CALL ScVbaSheetObjectBase::getLeft() throw (uno::RuntimeException)
174 : {
175 0 : return HmmToPoints( mxShape->getPosition().X );
176 : }
177 :
178 0 : void SAL_CALL ScVbaSheetObjectBase::setLeft( double fLeft ) throw (uno::RuntimeException)
179 : {
180 0 : if( fLeft < 0.0 )
181 0 : throw uno::RuntimeException();
182 0 : mxShape->setPosition( awt::Point( PointsToHmm( fLeft ), mxShape->getPosition().Y ) );
183 0 : }
184 :
185 0 : double SAL_CALL ScVbaSheetObjectBase::getTop() throw (uno::RuntimeException)
186 : {
187 0 : return HmmToPoints( mxShape->getPosition().Y );
188 : }
189 :
190 0 : void SAL_CALL ScVbaSheetObjectBase::setTop( double fTop ) throw (uno::RuntimeException)
191 : {
192 0 : if( fTop < 0.0 )
193 0 : throw uno::RuntimeException();
194 0 : mxShape->setPosition( awt::Point( mxShape->getPosition().X, PointsToHmm( fTop ) ) );
195 0 : }
196 :
197 0 : double SAL_CALL ScVbaSheetObjectBase::getWidth() throw (uno::RuntimeException)
198 : {
199 0 : return HmmToPoints( mxShape->getSize().Width );
200 : }
201 :
202 0 : void SAL_CALL ScVbaSheetObjectBase::setWidth( double fWidth ) throw (uno::RuntimeException)
203 : {
204 0 : if( fWidth <= 0.0 )
205 0 : throw uno::RuntimeException();
206 0 : mxShape->setSize( awt::Size( PointsToHmm( fWidth ), mxShape->getSize().Height ) );
207 0 : }
208 :
209 0 : double SAL_CALL ScVbaSheetObjectBase::getHeight() throw (uno::RuntimeException)
210 : {
211 0 : return HmmToPoints( mxShape->getSize().Height );
212 : }
213 :
214 0 : void SAL_CALL ScVbaSheetObjectBase::setHeight( double fHeight ) throw (uno::RuntimeException)
215 : {
216 0 : if( fHeight <= 0.0 )
217 0 : throw uno::RuntimeException();
218 0 : mxShape->setSize( awt::Size( mxShape->getSize().Width, PointsToHmm( fHeight ) ) );
219 0 : }
220 :
221 0 : OUString SAL_CALL ScVbaSheetObjectBase::getName() throw (uno::RuntimeException)
222 : {
223 0 : return mxShapeProps->getPropertyValue( "Name" ).get< OUString >();
224 : }
225 :
226 0 : void SAL_CALL ScVbaSheetObjectBase::setName( const OUString& rName ) throw (uno::RuntimeException)
227 : {
228 0 : mxShapeProps->setPropertyValue( "Name", uno::Any( rName ) );
229 0 : }
230 :
231 0 : sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement() throw (uno::RuntimeException)
232 : {
233 0 : sal_Int32 nRet = excel::XlPlacement::xlMoveAndSize;
234 : #if 0 // TODO: not working at the moment.
235 : SvxShape* pShape = SvxShape::getImplementation( mxShape );
236 : if(pShape)
237 : {
238 : SdrObject* pObj = pShape->GetSdrObject();
239 : if (pObj)
240 : {
241 : ScAnchorType eType = ScDrawLayer::GetAnchor(pObj);
242 : if (eType == SCA_PAGE)
243 : nRet = excel::XlPlacement::xlFreeFloating;
244 : }
245 : }
246 : #endif
247 0 : return nRet;
248 : }
249 :
250 0 : void SAL_CALL ScVbaSheetObjectBase::setPlacement( sal_Int32 /*nPlacement*/ ) throw (uno::RuntimeException)
251 : {
252 : #if 0 // TODO: not working at the moment.
253 : SvxShape* pShape = SvxShape::getImplementation( mxShape );
254 : if(pShape)
255 : {
256 : SdrObject* pObj = pShape->GetSdrObject();
257 : if (pObj)
258 : {
259 : ScAnchorType eType = SCA_CELL;
260 : if ( nPlacement == excel::XlPlacement::xlFreeFloating )
261 : eType = SCA_PAGE;
262 :
263 : // xlMove is not supported, treated as SCA_CELL (xlMoveAndSize)
264 :
265 : ScDrawLayer::SetAnchor(pObj, eType);
266 : }
267 : }
268 : #endif
269 0 : }
270 :
271 0 : sal_Bool SAL_CALL ScVbaSheetObjectBase::getPrintObject() throw (uno::RuntimeException)
272 : {
273 : // not supported
274 0 : return sal_True;
275 : }
276 :
277 0 : void SAL_CALL ScVbaSheetObjectBase::setPrintObject( sal_Bool /*bPrintObject*/ ) throw (uno::RuntimeException)
278 : {
279 : // not supported
280 0 : }
281 :
282 : // private
283 :
284 0 : void ScVbaSheetObjectBase::setDefaultProperties( sal_Int32 nIndex ) throw (uno::RuntimeException)
285 : {
286 0 : OUString aName = ::rtl::OUStringBuffer( implGetBaseName() ).append( sal_Unicode( ' ' ) ).append( nIndex + 1 ).makeStringAndClear();
287 0 : setName( aName );
288 0 : implSetDefaultProperties();
289 0 : }
290 :
291 0 : void ScVbaSheetObjectBase::implSetDefaultProperties() throw (uno::RuntimeException)
292 : {
293 0 : }
294 :
295 : // ============================================================================
296 :
297 0 : ScVbaControlObjectBase::ScVbaControlObjectBase(
298 : const uno::Reference< XHelperInterface >& rxParent,
299 : const uno::Reference< uno::XComponentContext >& rxContext,
300 : const uno::Reference< frame::XModel >& rxModel,
301 : const uno::Reference< container::XIndexContainer >& rxFormIC,
302 : const uno::Reference< drawing::XControlShape >& rxControlShape,
303 : ListenerType eListenerType ) throw (uno::RuntimeException) :
304 : ScVbaControlObject_BASE( rxParent, rxContext, rxModel, uno::Reference< drawing::XShape >( rxControlShape, uno::UNO_QUERY_THROW ) ),
305 : mxFormIC( rxFormIC, uno::UNO_SET_THROW ),
306 0 : mxControlProps( rxControlShape->getControl(), uno::UNO_QUERY_THROW )
307 : {
308 : // set listener and event name to be used for OnAction attribute
309 0 : switch( eListenerType )
310 : {
311 : case LISTENER_ACTION:
312 0 : maListenerType = "XActionListener";
313 0 : maEventMethod = "actionPerformed";
314 0 : break;
315 : case LISTENER_MOUSE:
316 0 : maListenerType = "XMouseListener";
317 0 : maEventMethod = "mouseReleased";
318 0 : break;
319 : case LISTENER_TEXT:
320 0 : maListenerType = "XTextListener";
321 0 : maEventMethod = "textChanged";
322 0 : break;
323 : case LISTENER_VALUE:
324 0 : maListenerType = "XAdjustmentListener";
325 0 : maEventMethod = "adjustmentValueChanged";
326 0 : break;
327 : case LISTENER_CHANGE:
328 0 : maListenerType = "XChangeListener";
329 0 : maEventMethod = "changed";
330 0 : break;
331 : // no default, to let the compiler complain about missing case
332 : }
333 0 : }
334 :
335 : // XSheetObject attributes
336 :
337 0 : OUString SAL_CALL ScVbaControlObjectBase::getName() throw (uno::RuntimeException)
338 : {
339 0 : return mxControlProps->getPropertyValue( "Name" ).get< OUString >();
340 : }
341 :
342 0 : void SAL_CALL ScVbaControlObjectBase::setName( const OUString& rName ) throw (uno::RuntimeException)
343 : {
344 0 : mxControlProps->setPropertyValue( "Name", uno::Any( rName ) );
345 0 : }
346 :
347 0 : OUString SAL_CALL ScVbaControlObjectBase::getOnAction() throw (uno::RuntimeException)
348 : {
349 0 : uno::Reference< script::XEventAttacherManager > xEventMgr( mxFormIC, uno::UNO_QUERY_THROW );
350 0 : sal_Int32 nIndex = getModelIndexInForm();
351 0 : uno::Sequence< script::ScriptEventDescriptor > aEvents = xEventMgr->getScriptEvents( nIndex );
352 0 : if( aEvents.hasElements() )
353 : {
354 0 : const script::ScriptEventDescriptor* pEvent = aEvents.getConstArray();
355 0 : const script::ScriptEventDescriptor* pEventEnd = pEvent + aEvents.getLength();
356 0 : const OUString aScriptType = "Script";
357 0 : for( ; pEvent < pEventEnd; ++pEvent )
358 0 : if( (pEvent->ListenerType == maListenerType) && (pEvent->EventMethod == maEventMethod) && (pEvent->ScriptType == aScriptType) )
359 0 : return extractMacroName( pEvent->ScriptCode );
360 : }
361 0 : return OUString();
362 : }
363 :
364 0 : void SAL_CALL ScVbaControlObjectBase::setOnAction( const OUString& rMacroName ) throw (uno::RuntimeException)
365 : {
366 0 : uno::Reference< script::XEventAttacherManager > xEventMgr( mxFormIC, uno::UNO_QUERY_THROW );
367 0 : sal_Int32 nIndex = getModelIndexInForm();
368 :
369 : // first, remove a registered event (try/catch just in case implementation throws)
370 0 : try { xEventMgr->revokeScriptEvent( nIndex, maListenerType, maEventMethod, OUString() ); } catch( uno::Exception& ) {}
371 :
372 : // if a macro name has been passed, try to attach it to the event
373 0 : if( !rMacroName.isEmpty() )
374 : {
375 0 : MacroResolvedInfo aResolvedMacro = resolveVBAMacro( getSfxObjShell( mxModel ), rMacroName );
376 0 : if( !aResolvedMacro.mbFound )
377 0 : throw uno::RuntimeException();
378 0 : script::ScriptEventDescriptor aDescriptor;
379 0 : aDescriptor.ListenerType = maListenerType;
380 0 : aDescriptor.EventMethod = maEventMethod;
381 0 : aDescriptor.ScriptType = "Script";
382 0 : aDescriptor.ScriptCode = makeMacroURL( aResolvedMacro.msResolvedMacro );
383 0 : xEventMgr->registerScriptEvent( nIndex, aDescriptor );
384 0 : }
385 0 : }
386 :
387 0 : sal_Bool SAL_CALL ScVbaControlObjectBase::getPrintObject() throw (uno::RuntimeException)
388 : {
389 0 : return mxControlProps->getPropertyValue( "Printable" ).get< sal_Bool >();
390 : }
391 :
392 0 : void SAL_CALL ScVbaControlObjectBase::setPrintObject( sal_Bool bPrintObject ) throw (uno::RuntimeException)
393 : {
394 0 : mxControlProps->setPropertyValue( "Printable", uno::Any( bPrintObject ) );
395 0 : }
396 :
397 : // XControlObject attributes
398 :
399 0 : sal_Bool SAL_CALL ScVbaControlObjectBase::getAutoSize() throw (uno::RuntimeException)
400 : {
401 : // not supported
402 0 : return false;
403 : }
404 :
405 0 : void SAL_CALL ScVbaControlObjectBase::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
406 : {
407 : // not supported
408 0 : }
409 :
410 : // private
411 :
412 0 : sal_Int32 ScVbaControlObjectBase::getModelIndexInForm() const throw (uno::RuntimeException)
413 : {
414 0 : for( sal_Int32 nIndex = 0, nCount = mxFormIC->getCount(); nIndex < nCount; ++nIndex )
415 : {
416 0 : uno::Reference< beans::XPropertySet > xProps( mxFormIC->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
417 0 : if( mxControlProps.get() == xProps.get() )
418 0 : return nIndex;
419 0 : }
420 0 : throw uno::RuntimeException();
421 : }
422 :
423 : // ============================================================================
424 :
425 0 : ScVbaButton::ScVbaButton(
426 : const uno::Reference< XHelperInterface >& rxParent,
427 : const uno::Reference< uno::XComponentContext >& rxContext,
428 : const uno::Reference< frame::XModel >& rxModel,
429 : const uno::Reference< container::XIndexContainer >& rxFormIC,
430 : const uno::Reference< drawing::XControlShape >& rxControlShape ) throw (uno::RuntimeException) :
431 0 : ScVbaButton_BASE( rxParent, rxContext, rxModel, rxFormIC, rxControlShape, LISTENER_ACTION )
432 : {
433 0 : }
434 :
435 : // XButton attributes
436 :
437 0 : OUString SAL_CALL ScVbaButton::getCaption() throw (uno::RuntimeException)
438 : {
439 0 : return mxControlProps->getPropertyValue( "Label" ).get< OUString >();
440 : }
441 :
442 0 : void SAL_CALL ScVbaButton::setCaption( const OUString& rCaption ) throw (uno::RuntimeException)
443 : {
444 0 : mxControlProps->setPropertyValue( "Label", uno::Any( rCaption ) );
445 0 : }
446 :
447 0 : uno::Reference< excel::XFont > SAL_CALL ScVbaButton::getFont() throw (uno::RuntimeException)
448 : {
449 0 : return new ScVbaFont( this, mxContext, maPalette, mxControlProps, 0, true );
450 : }
451 :
452 0 : void SAL_CALL ScVbaButton::setFont( const uno::Reference< excel::XFont >& /*rxFont*/ ) throw (uno::RuntimeException)
453 : {
454 : // TODO
455 0 : }
456 :
457 0 : sal_Int32 SAL_CALL ScVbaButton::getHorizontalAlignment() throw (uno::RuntimeException)
458 : {
459 0 : switch( mxControlProps->getPropertyValue( "Align" ).get< sal_Int16 >() )
460 : {
461 0 : case awt::TextAlign::LEFT: return excel::Constants::xlLeft;
462 0 : case awt::TextAlign::RIGHT: return excel::Constants::xlRight;
463 0 : case awt::TextAlign::CENTER: return excel::Constants::xlCenter;
464 : }
465 0 : return excel::Constants::xlCenter;
466 : }
467 :
468 0 : void SAL_CALL ScVbaButton::setHorizontalAlignment( sal_Int32 nAlign ) throw (uno::RuntimeException)
469 : {
470 0 : sal_Int32 nAwtAlign = awt::TextAlign::CENTER;
471 0 : switch( nAlign )
472 : {
473 0 : case excel::Constants::xlLeft: nAwtAlign = awt::TextAlign::LEFT; break;
474 0 : case excel::Constants::xlRight: nAwtAlign = awt::TextAlign::RIGHT; break;
475 0 : case excel::Constants::xlCenter: nAwtAlign = awt::TextAlign::CENTER; break;
476 : }
477 : // form controls expect short value
478 0 : mxControlProps->setPropertyValue( "Align", uno::Any( static_cast< sal_Int16 >( nAwtAlign ) ) );
479 0 : }
480 :
481 0 : sal_Int32 SAL_CALL ScVbaButton::getVerticalAlignment() throw (uno::RuntimeException)
482 : {
483 0 : switch( mxControlProps->getPropertyValue( "VerticalAlign" ).get< style::VerticalAlignment >() )
484 : {
485 0 : case style::VerticalAlignment_TOP: return excel::Constants::xlTop;
486 0 : case style::VerticalAlignment_BOTTOM: return excel::Constants::xlBottom;
487 0 : case style::VerticalAlignment_MIDDLE: return excel::Constants::xlCenter;
488 : default:;
489 : }
490 0 : return excel::Constants::xlCenter;
491 : }
492 :
493 0 : void SAL_CALL ScVbaButton::setVerticalAlignment( sal_Int32 nAlign ) throw (uno::RuntimeException)
494 : {
495 0 : style::VerticalAlignment eAwtAlign = style::VerticalAlignment_MIDDLE;
496 0 : switch( nAlign )
497 : {
498 0 : case excel::Constants::xlTop: eAwtAlign = style::VerticalAlignment_TOP; break;
499 0 : case excel::Constants::xlBottom: eAwtAlign = style::VerticalAlignment_BOTTOM; break;
500 0 : case excel::Constants::xlCenter: eAwtAlign = style::VerticalAlignment_MIDDLE; break;
501 : }
502 0 : mxControlProps->setPropertyValue( "VerticalAlign", uno::Any( eAwtAlign ) );
503 0 : }
504 :
505 0 : sal_Int32 SAL_CALL ScVbaButton::getOrientation() throw (uno::RuntimeException)
506 : {
507 : // not supported
508 0 : return excel::XlOrientation::xlHorizontal;
509 : }
510 :
511 0 : void SAL_CALL ScVbaButton::setOrientation( sal_Int32 /*nOrientation*/ ) throw (uno::RuntimeException)
512 : {
513 : // not supported
514 0 : }
515 :
516 : // XButton methods
517 :
518 0 : uno::Reference< excel::XCharacters > SAL_CALL ScVbaButton::Characters( const uno::Any& rStart, const uno::Any& rLength ) throw (uno::RuntimeException)
519 : {
520 0 : return new ScVbaButtonCharacters( this, mxContext, mxControlProps, maPalette, rStart, rLength );
521 : }
522 :
523 : // XHelperInterface
524 :
525 0 : VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaButton, "ooo.vba.excel.Button" )
526 :
527 : // private
528 :
529 0 : OUString ScVbaButton::implGetBaseName() const
530 : {
531 0 : return OUString( "Button" );
532 : }
533 :
534 0 : void ScVbaButton::implSetDefaultProperties() throw (uno::RuntimeException)
535 : {
536 0 : setCaption( getName() );
537 0 : }
538 :
539 : // ============================================================================
540 :
541 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|