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 "vbaborders.hxx" 28 29 #include <cppuhelper/implbase3.hxx> 30 #include <ooo/vba/excel/XlBordersIndex.hpp> 31 #include <ooo/vba/excel/XlBorderWeight.hpp> 32 #include <ooo/vba/excel/XlLineStyle.hpp> 33 #include <ooo/vba/excel/XlColorIndex.hpp> 34 #include <com/sun/star/beans/XPropertySet.hpp> 35 #include <com/sun/star/table/TableBorder.hpp> 36 #include <com/sun/star/table/XColumnRowRange.hpp> 37 38 #include "vbapalette.hxx" 39 40 using namespace ::com::sun::star; 41 using namespace ::ooo::vba; 42 using namespace ::ooo::vba::excel; 43 44 45 typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base; 46 typedef InheritedHelperInterfaceImpl1<excel::XBorder > ScVbaBorder_Base; 47 48 // #TODO sort these indexes to match the order in which Excel iterates over the 49 // borders, the enumeration will match the order in this list 50 static const sal_Int16 supportedIndexTable[] = { XlBordersIndex::xlEdgeLeft, XlBordersIndex::xlEdgeTop, XlBordersIndex::xlEdgeBottom, XlBordersIndex::xlEdgeRight, XlBordersIndex::xlDiagonalDown, XlBordersIndex::xlDiagonalUp, XlBordersIndex::xlInsideVertical, XlBordersIndex::xlInsideHorizontal }; 51 52 const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") ); 53 54 // Equiv widths in in 1/100 mm 55 const static sal_Int32 OOLineThin = 35; 56 const static sal_Int32 OOLineMedium = 88; 57 const static sal_Int32 OOLineThick = 141; 58 const static sal_Int32 OOLineHairline = 2; 59 60 class ScVbaBorder : public ScVbaBorder_Base 61 { 62 private: 63 uno::Reference< beans::XPropertySet > m_xProps; 64 sal_Int32 m_LineType; 65 ScVbaPalette m_Palette; 66 bool setBorderLine( table::BorderLine& rBorderLine ) 67 { 68 table::TableBorder aTableBorder; 69 m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; 70 71 switch ( m_LineType ) 72 { 73 case XlBordersIndex::xlEdgeLeft: 74 aTableBorder.IsLeftLineValid = sal_True; 75 aTableBorder.LeftLine= rBorderLine; 76 break; 77 case XlBordersIndex::xlEdgeTop: 78 aTableBorder.IsTopLineValid = sal_True; 79 aTableBorder.TopLine = rBorderLine; 80 break; 81 82 case XlBordersIndex::xlEdgeBottom: 83 aTableBorder.IsBottomLineValid = sal_True; 84 aTableBorder.BottomLine = rBorderLine; 85 break; 86 case XlBordersIndex::xlEdgeRight: 87 aTableBorder.IsRightLineValid = sal_True; 88 aTableBorder.RightLine = rBorderLine; 89 break; 90 case XlBordersIndex::xlInsideVertical: 91 aTableBorder.IsVerticalLineValid = sal_True; 92 aTableBorder.VerticalLine = rBorderLine; 93 break; 94 case XlBordersIndex::xlInsideHorizontal: 95 aTableBorder.IsHorizontalLineValid = sal_True; 96 aTableBorder.HorizontalLine = rBorderLine; 97 break; 98 case XlBordersIndex::xlDiagonalDown: 99 case XlBordersIndex::xlDiagonalUp: 100 // #TODO have to ignore at the momement, would be 101 // nice to investigate what we can do here 102 break; 103 default: 104 return false; 105 } 106 m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) ); 107 return true; 108 } 109 110 bool getBorderLine( table::BorderLine& rBorderLine ) 111 { 112 table::TableBorder aTableBorder; 113 m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; 114 switch ( m_LineType ) 115 { 116 case XlBordersIndex::xlEdgeLeft: 117 if ( aTableBorder.IsLeftLineValid ) 118 rBorderLine = aTableBorder.LeftLine; 119 break; 120 case XlBordersIndex::xlEdgeTop: 121 if ( aTableBorder.IsTopLineValid ) 122 rBorderLine = aTableBorder.TopLine; 123 break; 124 125 case XlBordersIndex::xlEdgeBottom: 126 if ( aTableBorder.IsBottomLineValid ) 127 rBorderLine = aTableBorder.BottomLine; 128 break; 129 case XlBordersIndex::xlEdgeRight: 130 if ( aTableBorder.IsRightLineValid ) 131 rBorderLine = aTableBorder.RightLine; 132 break; 133 case XlBordersIndex::xlInsideVertical: 134 if ( aTableBorder.IsVerticalLineValid ) 135 rBorderLine = aTableBorder.VerticalLine; 136 break; 137 case XlBordersIndex::xlInsideHorizontal: 138 if ( aTableBorder.IsHorizontalLineValid ) 139 rBorderLine = aTableBorder.HorizontalLine; 140 break; 141 142 case XlBordersIndex::xlDiagonalDown: 143 case XlBordersIndex::xlDiagonalUp: 144 // #TODO have to ignore at the momement, would be 145 // nice to investigate what we can do here 146 break; 147 default: 148 return false; 149 } 150 return true; 151 } 152 ScVbaBorder(); // no impl 153 protected: 154 virtual rtl::OUString& getServiceImplName() 155 { 156 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaBorder") ); 157 return sImplName; 158 } 159 virtual css::uno::Sequence<rtl::OUString> getServiceNames() 160 { 161 static uno::Sequence< rtl::OUString > aServiceNames; 162 if ( aServiceNames.getLength() == 0 ) 163 { 164 aServiceNames.realloc( 1 ); 165 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Border" ) ); 166 } 167 return aServiceNames; 168 } 169 public: 170 ScVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, ScVbaPalette& rPalette) : ScVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {} 171 172 // XBorder 173 uno::Any SAL_CALL getColor() throw (uno::RuntimeException) 174 { 175 table::BorderLine aBorderLine; 176 if ( getBorderLine( aBorderLine ) ) 177 return uno::makeAny( OORGBToXLRGB( aBorderLine.Color ) ); 178 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No Implementation available" ) ), uno::Reference< uno::XInterface >() ); 179 } 180 void SAL_CALL setColor( const uno::Any& _color ) throw (uno::RuntimeException) 181 { 182 sal_Int32 nColor = 0; 183 _color >>= nColor; 184 table::BorderLine aBorderLine; 185 if ( getBorderLine( aBorderLine ) ) 186 { 187 aBorderLine.Color = XLRGBToOORGB( nColor ); 188 setBorderLine( aBorderLine ); 189 } 190 else 191 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No Implementation available" ) ), uno::Reference< uno::XInterface >() ); 192 } 193 194 uno::Any SAL_CALL getColorIndex() throw (uno::RuntimeException) 195 { 196 sal_Int32 nColor = 0; 197 XLRGBToOORGB( getColor() ) >>= nColor; 198 uno::Reference< container::XIndexAccess > xIndex = m_Palette.getPalette(); 199 sal_Int32 nElems = xIndex->getCount(); 200 sal_Int32 nIndex = -1; 201 for ( sal_Int32 count=0; count<nElems; ++count ) 202 { 203 sal_Int32 nPaletteColor = 0; 204 xIndex->getByIndex( count ) >>= nPaletteColor; 205 if ( nPaletteColor == nColor ) 206 { 207 nIndex = count + 1; 208 break; 209 } 210 } 211 return uno::makeAny(nIndex); 212 } 213 214 void SAL_CALL setColorIndex( const uno::Any& _colorindex ) throw (uno::RuntimeException) 215 { 216 sal_Int32 nColor = 0; 217 _colorindex >>= nColor; 218 if ( !nColor || nColor == XlColorIndex::xlColorIndexAutomatic ) 219 nColor = 1; 220 setColor( OORGBToXLRGB( m_Palette.getPalette()->getByIndex( --nColor ) ) ); 221 } 222 uno::Any SAL_CALL getWeight() throw (uno::RuntimeException) 223 { 224 table::BorderLine aBorderLine; 225 if ( getBorderLine( aBorderLine ) ) 226 { 227 switch ( aBorderLine.OuterLineWidth ) 228 { 229 case 0: // Thin = default OO thickness 230 case OOLineThin: 231 return uno::makeAny( XlBorderWeight::xlThin ); 232 case OOLineMedium: 233 return uno::makeAny( XlBorderWeight::xlMedium ); 234 case OOLineThick: 235 return uno::makeAny( XlBorderWeight::xlThick ); 236 case OOLineHairline: 237 return uno::makeAny( XlBorderWeight::xlHairline ); 238 default: 239 break; 240 } 241 } 242 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); 243 } 244 void SAL_CALL setWeight( const uno::Any& _weight ) throw (uno::RuntimeException) 245 { 246 sal_Int32 nWeight = 0; 247 _weight >>= nWeight; 248 table::BorderLine aBorderLine; 249 if ( getBorderLine( aBorderLine ) ) 250 { 251 switch ( nWeight ) 252 { 253 case XlBorderWeight::xlThin: 254 aBorderLine.OuterLineWidth = OOLineThin; 255 break; 256 case XlBorderWeight::xlMedium: 257 aBorderLine.OuterLineWidth = OOLineMedium; 258 break; 259 case XlBorderWeight::xlThick: 260 aBorderLine.OuterLineWidth = OOLineThick; 261 break; 262 case XlBorderWeight::xlHairline: 263 aBorderLine.OuterLineWidth = OOLineHairline; 264 break; 265 default: 266 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() ); 267 } 268 setBorderLine( aBorderLine ); 269 } 270 else 271 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); 272 } 273 274 uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException) 275 { 276 // always return xlContinuous; 277 return uno::makeAny( XlLineStyle::xlContinuous ); 278 } 279 void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException) 280 { 281 // Urk no choice but to silently ignore we don't support this attribute 282 // #TODO would be nice to support the excel line styles 283 sal_Int32 nLineStyle = 0; 284 _linestyle >>= nLineStyle; 285 table::BorderLine aBorderLine; 286 if ( getBorderLine( aBorderLine ) ) 287 { 288 switch ( nLineStyle ) 289 { 290 case XlLineStyle::xlContinuous: 291 case XlLineStyle::xlDash: 292 case XlLineStyle::xlDashDot: 293 case XlLineStyle::xlDashDotDot: 294 case XlLineStyle::xlDot: 295 case XlLineStyle::xlDouble: 296 case XlLineStyle::xlLineStyleNone: 297 case XlLineStyle::xlSlantDashDot: 298 break; 299 default: 300 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() ); 301 } 302 setBorderLine( aBorderLine ); 303 } 304 else 305 throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); 306 } 307 }; 308 309 class RangeBorders : public RangeBorders_Base 310 { 311 private: 312 uno::Reference< table::XCellRange > m_xRange; 313 uno::Reference< uno::XComponentContext > m_xContext; 314 ScVbaPalette m_Palette; 315 sal_Int32 getTableIndex( sal_Int32 nConst ) 316 { 317 // hokay return position of the index in the table 318 sal_Int32 nIndexes = getCount(); 319 sal_Int32 realIndex = 0; 320 const sal_Int16* pTableEntry = supportedIndexTable; 321 for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry ) 322 { 323 if ( *pTableEntry == nConst ) 324 return realIndex; 325 } 326 return getCount(); // error condition 327 } 328 public: 329 RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, ScVbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette ) 330 { 331 } 332 // XIndexAccess 333 virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) 334 { 335 return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] ); 336 } 337 virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 338 { 339 340 sal_Int32 nIndex = getTableIndex( Index ); 341 if ( nIndex >= 0 && nIndex < getCount() ) 342 { 343 uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW ); 344 return uno::makeAny( uno::Reference< excel::XBorder >( new ScVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) ); 345 } 346 throw lang::IndexOutOfBoundsException(); 347 } 348 virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) 349 { 350 return excel::XBorder::static_type(0); 351 } 352 virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) 353 { 354 return sal_True; 355 } 356 }; 357 358 uno::Reference< container::XIndexAccess > 359 rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, ScVbaPalette& rPalette ) 360 { 361 return new RangeBorders( xRange, xContext, rPalette ); 362 } 363 364 class RangeBorderEnumWrapper : public EnumerationHelper_BASE 365 { 366 uno::Reference<container::XIndexAccess > m_xIndexAccess; 367 sal_Int32 nIndex; 368 public: 369 RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} 370 virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) 371 { 372 return ( nIndex < m_xIndexAccess->getCount() ); 373 } 374 375 virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 376 { 377 if ( nIndex < m_xIndexAccess->getCount() ) 378 return m_xIndexAccess->getByIndex( nIndex++ ); 379 throw container::NoSuchElementException(); 380 } 381 }; 382 383 ScVbaBorders::ScVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, ScVbaPalette& rPalette ): ScVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ), bRangeIsSingleCell( false ) 384 { 385 uno::Reference< table::XColumnRowRange > xColumnRowRange(xRange, uno::UNO_QUERY_THROW ); 386 if ( xColumnRowRange->getRows()->getCount() == 1 && xColumnRowRange->getColumns()->getCount() == 1 ) 387 bRangeIsSingleCell = true; 388 m_xProps.set( xRange, uno::UNO_QUERY_THROW ); 389 } 390 391 uno::Reference< container::XEnumeration > 392 ScVbaBorders::createEnumeration() throw (uno::RuntimeException) 393 { 394 return new RangeBorderEnumWrapper( m_xIndexAccess ); 395 } 396 397 uno::Any 398 ScVbaBorders::createCollectionObject( const css::uno::Any& aSource ) 399 { 400 return aSource; // its already a Border object 401 } 402 403 uno::Type 404 ScVbaBorders::getElementType() throw (uno::RuntimeException) 405 { 406 return excel::XBorders::static_type(0); 407 } 408 409 uno::Any 410 ScVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) 411 { 412 return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) ); 413 } 414 415 416 uno::Any SAL_CALL ScVbaBorders::getColor() throw (uno::RuntimeException) 417 { 418 sal_Int32 count = getCount(); 419 uno::Any color; 420 for( sal_Int32 i = 0; i < count ; i++ ) 421 { 422 if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] ) 423 { 424 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 425 if( color.hasValue() ) 426 { 427 if( color != xBorder->getColor() ) 428 return uno::makeAny( uno::Reference< uno::XInterface >() ); 429 } 430 else 431 color = xBorder->getColor(); 432 } 433 } 434 return color; 435 } 436 void SAL_CALL ScVbaBorders::setColor( const uno::Any& _color ) throw (uno::RuntimeException) 437 { 438 sal_Int32 count = getCount(); 439 for( sal_Int32 i = 0; i < count ; i++ ) 440 { 441 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 442 xBorder->setColor( _color ); 443 } 444 } 445 uno::Any SAL_CALL ScVbaBorders::getColorIndex() throw (uno::RuntimeException) 446 { 447 sal_Int32 count = getCount(); 448 uno::Any nColorIndex; 449 for( sal_Int32 i = 0; i < count ; i++ ) 450 { 451 if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] ) 452 { 453 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 454 if( nColorIndex.hasValue() ) 455 { 456 if( nColorIndex != xBorder->getColorIndex() ) 457 return uno::makeAny( uno::Reference< uno::XInterface >() ); 458 } 459 else 460 nColorIndex = xBorder->getColorIndex(); 461 } 462 } 463 return nColorIndex; 464 } 465 void SAL_CALL ScVbaBorders::setColorIndex( const uno::Any& _colorindex ) throw (uno::RuntimeException) 466 { 467 sal_Int32 count = getCount(); 468 for( sal_Int32 i = 0; i < count ; i++ ) 469 { 470 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 471 xBorder->setColorIndex( _colorindex ); 472 } 473 } 474 475 bool 476 lcl_areAllLineWidthsSame( const table::TableBorder& maTableBorder, bool bIsCell ) 477 { 478 479 bool bRes = false; 480 if (bIsCell) 481 { 482 bRes = ((maTableBorder.TopLine.OuterLineWidth == maTableBorder.BottomLine.OuterLineWidth) && 483 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.LeftLine.OuterLineWidth) && 484 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.RightLine.OuterLineWidth)); 485 } 486 else 487 { 488 bRes = ((maTableBorder.TopLine.OuterLineWidth == maTableBorder.BottomLine.OuterLineWidth) && 489 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.LeftLine.OuterLineWidth) && 490 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.HorizontalLine.OuterLineWidth) && 491 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.VerticalLine.OuterLineWidth) && 492 (maTableBorder.TopLine.OuterLineWidth == maTableBorder.RightLine.OuterLineWidth)); 493 } 494 return bRes; 495 } 496 497 uno::Any SAL_CALL ScVbaBorders::getLineStyle() throw (uno::RuntimeException) 498 { 499 table::TableBorder maTableBorder; 500 m_xProps->getPropertyValue( sTableBorder ) >>= maTableBorder; 501 502 sal_Int32 aLinestyle = XlLineStyle::xlLineStyleNone; 503 504 if ( lcl_areAllLineWidthsSame( maTableBorder, bRangeIsSingleCell )) 505 { 506 if (maTableBorder.TopLine.LineDistance != 0) 507 { 508 aLinestyle = XlLineStyle::xlDouble; 509 } 510 else if ( maTableBorder.TopLine.OuterLineWidth != 0 ) 511 { 512 aLinestyle = XlLineStyle::xlContinuous; 513 } 514 } 515 return uno::makeAny( aLinestyle ); 516 } 517 void SAL_CALL ScVbaBorders::setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException) 518 { 519 sal_Int32 count = getCount(); 520 for( sal_Int32 i = 0; i < count ; i++ ) 521 { 522 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 523 xBorder->setLineStyle( _linestyle ); 524 } 525 } 526 uno::Any SAL_CALL ScVbaBorders::getWeight() throw (uno::RuntimeException) 527 { 528 sal_Int32 count = getCount(); 529 uno::Any weight; 530 for( sal_Int32 i = 0; i < count ; i++ ) 531 { 532 if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] ) 533 { 534 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 535 if( weight.hasValue() ) 536 { 537 if( weight != xBorder->getWeight() ) 538 return uno::makeAny( uno::Reference< uno::XInterface >() ); 539 } 540 else 541 weight = xBorder->getWeight(); 542 } 543 } 544 return weight; 545 } 546 void SAL_CALL ScVbaBorders::setWeight( const uno::Any& _weight ) throw (uno::RuntimeException) 547 { 548 sal_Int32 count = getCount(); 549 for( sal_Int32 i = 0; i < count ; i++ ) 550 { 551 uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW ); 552 xBorder->setWeight( _weight ); 553 } 554 } 555 556 557 rtl::OUString& 558 ScVbaBorders::getServiceImplName() 559 { 560 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaBorders") ); 561 return sImplName; 562 } 563 564 uno::Sequence< rtl::OUString > 565 ScVbaBorders::getServiceNames() 566 { 567 static uno::Sequence< rtl::OUString > aServiceNames; 568 if ( aServiceNames.getLength() == 0 ) 569 { 570 aServiceNames.realloc( 1 ); 571 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Borders" ) ); 572 } 573 return aServiceNames; 574 } 575