1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #include "vbaborders.hxx" 28*cdf0e10cSrcweir #include <ooo/vba/word/XBorder.hpp> 29*cdf0e10cSrcweir #include <ooo/vba/word/WdBorderType.hpp> 30*cdf0e10cSrcweir #include <ooo/vba/word/WdLineStyle.hpp> 31*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/table/ShadowLocation.hpp> 36*cdf0e10cSrcweir #include "vbapalette.hxx" 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir using namespace ::com::sun::star; 39*cdf0e10cSrcweir using namespace ::ooo::vba; 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base; 43*cdf0e10cSrcweir typedef InheritedHelperInterfaceImpl1<word::XBorder > SwVbaBorder_Base; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir // #TODO sort these indexes to match the order in which Word iterates over the 46*cdf0e10cSrcweir // borders, the enumeration will match the order in this list 47*cdf0e10cSrcweir static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBottom, word::WdBorderType::wdBorderDiagonalDown, word::WdBorderType::wdBorderDiagonalUp, word::WdBorderType::wdBorderHorizontal, word::WdBorderType::wdBorderLeft, word::WdBorderType::wdBorderRight, word::WdBorderType::wdBorderTop, word::WdBorderType::wdBorderVertical }; 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") ); 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir // Equiv widths in in 1/100 mm 52*cdf0e10cSrcweir const static sal_Int32 OOLineThin = 35; 53*cdf0e10cSrcweir const static sal_Int32 OOLineMedium = 88; 54*cdf0e10cSrcweir const static sal_Int32 OOLineThick = 141; 55*cdf0e10cSrcweir const static sal_Int32 OOLineHairline = 2; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class SwVbaBorder : public SwVbaBorder_Base 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir private: 60*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > m_xProps; 61*cdf0e10cSrcweir sal_Int32 m_LineType; 62*cdf0e10cSrcweir VbaPalette m_Palette; 63*cdf0e10cSrcweir bool setBorderLine( table::BorderLine& rBorderLine ) 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir table::TableBorder aTableBorder; 66*cdf0e10cSrcweir m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir switch ( m_LineType ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir case word::WdBorderType::wdBorderLeft: 71*cdf0e10cSrcweir aTableBorder.IsLeftLineValid = sal_True; 72*cdf0e10cSrcweir aTableBorder.LeftLine= rBorderLine; 73*cdf0e10cSrcweir break; 74*cdf0e10cSrcweir case word::WdBorderType::wdBorderTop: 75*cdf0e10cSrcweir aTableBorder.IsTopLineValid = sal_True; 76*cdf0e10cSrcweir aTableBorder.TopLine = rBorderLine; 77*cdf0e10cSrcweir break; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir case word::WdBorderType::wdBorderBottom: 80*cdf0e10cSrcweir aTableBorder.IsBottomLineValid = sal_True; 81*cdf0e10cSrcweir aTableBorder.BottomLine = rBorderLine; 82*cdf0e10cSrcweir break; 83*cdf0e10cSrcweir case word::WdBorderType::wdBorderRight: 84*cdf0e10cSrcweir aTableBorder.IsRightLineValid = sal_True; 85*cdf0e10cSrcweir aTableBorder.RightLine = rBorderLine; 86*cdf0e10cSrcweir break; 87*cdf0e10cSrcweir case word::WdBorderType::wdBorderVertical: 88*cdf0e10cSrcweir aTableBorder.IsVerticalLineValid = sal_True; 89*cdf0e10cSrcweir aTableBorder.VerticalLine = rBorderLine; 90*cdf0e10cSrcweir break; 91*cdf0e10cSrcweir case word::WdBorderType::wdBorderHorizontal: 92*cdf0e10cSrcweir aTableBorder.IsHorizontalLineValid = sal_True; 93*cdf0e10cSrcweir aTableBorder.HorizontalLine = rBorderLine; 94*cdf0e10cSrcweir break; 95*cdf0e10cSrcweir case word::WdBorderType::wdBorderDiagonalDown: 96*cdf0e10cSrcweir case word::WdBorderType::wdBorderDiagonalUp: 97*cdf0e10cSrcweir // #TODO have to ignore at the momement, would be 98*cdf0e10cSrcweir // nice to investigate what we can do here 99*cdf0e10cSrcweir break; 100*cdf0e10cSrcweir default: 101*cdf0e10cSrcweir return false; 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) ); 104*cdf0e10cSrcweir return true; 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir bool getBorderLine( table::BorderLine& rBorderLine ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir table::TableBorder aTableBorder; 110*cdf0e10cSrcweir m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; 111*cdf0e10cSrcweir switch ( m_LineType ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir case word::WdBorderType::wdBorderLeft: 114*cdf0e10cSrcweir if ( aTableBorder.IsLeftLineValid ) 115*cdf0e10cSrcweir rBorderLine = aTableBorder.LeftLine; 116*cdf0e10cSrcweir break; 117*cdf0e10cSrcweir case word::WdBorderType::wdBorderTop: 118*cdf0e10cSrcweir if ( aTableBorder.IsTopLineValid ) 119*cdf0e10cSrcweir rBorderLine = aTableBorder.TopLine; 120*cdf0e10cSrcweir break; 121*cdf0e10cSrcweir case word::WdBorderType::wdBorderBottom: 122*cdf0e10cSrcweir if ( aTableBorder.IsBottomLineValid ) 123*cdf0e10cSrcweir rBorderLine = aTableBorder.BottomLine; 124*cdf0e10cSrcweir break; 125*cdf0e10cSrcweir case word::WdBorderType::wdBorderRight: 126*cdf0e10cSrcweir if ( aTableBorder.IsRightLineValid ) 127*cdf0e10cSrcweir rBorderLine = aTableBorder.RightLine; 128*cdf0e10cSrcweir break; 129*cdf0e10cSrcweir case word::WdBorderType::wdBorderVertical: 130*cdf0e10cSrcweir if ( aTableBorder.IsVerticalLineValid ) 131*cdf0e10cSrcweir rBorderLine = aTableBorder.VerticalLine; 132*cdf0e10cSrcweir break; 133*cdf0e10cSrcweir case word::WdBorderType::wdBorderHorizontal: 134*cdf0e10cSrcweir if ( aTableBorder.IsHorizontalLineValid ) 135*cdf0e10cSrcweir rBorderLine = aTableBorder.HorizontalLine; 136*cdf0e10cSrcweir break; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir case word::WdBorderType::wdBorderDiagonalDown: 139*cdf0e10cSrcweir case word::WdBorderType::wdBorderDiagonalUp: 140*cdf0e10cSrcweir // #TODO have to ignore at the momement, would be 141*cdf0e10cSrcweir // nice to investigate what we can do here 142*cdf0e10cSrcweir break; 143*cdf0e10cSrcweir default: 144*cdf0e10cSrcweir return false; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir return true; 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir SwVbaBorder(); // no impl 149*cdf0e10cSrcweir protected: 150*cdf0e10cSrcweir virtual rtl::OUString& getServiceImplName() 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorder") ); 153*cdf0e10cSrcweir return sImplName; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir virtual css::uno::Sequence<rtl::OUString> getServiceNames() 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir static uno::Sequence< rtl::OUString > aServiceNames; 158*cdf0e10cSrcweir if ( aServiceNames.getLength() == 0 ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir aServiceNames.realloc( 1 ); 161*cdf0e10cSrcweir aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Border" ) ); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir return aServiceNames; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir public: 166*cdf0e10cSrcweir SwVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, VbaPalette& rPalette) : SwVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {} 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir sal_Int32 nLineStyle = word::WdLineStyle::wdLineStyleNone; 171*cdf0e10cSrcweir table::BorderLine aBorderLine; 172*cdf0e10cSrcweir if ( getBorderLine( aBorderLine ) ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir if( aBorderLine.InnerLineWidth !=0 && aBorderLine.OuterLineWidth !=0 ) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir nLineStyle = word::WdLineStyle::wdLineStyleDouble; 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir else if( aBorderLine.InnerLineWidth !=0 || aBorderLine.OuterLineWidth !=0 ) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir nLineStyle = word::WdLineStyle::wdLineStyleSingle; 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir else 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir nLineStyle = word::WdLineStyle::wdLineStyleNone; 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir return uno::makeAny( nLineStyle ); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir // Urk no choice but to silently ignore we don't support this attribute 192*cdf0e10cSrcweir // #TODO would be nice to support the word line styles 193*cdf0e10cSrcweir sal_Int32 nLineStyle = 0; 194*cdf0e10cSrcweir _linestyle >>= nLineStyle; 195*cdf0e10cSrcweir table::BorderLine aBorderLine; 196*cdf0e10cSrcweir if ( getBorderLine( aBorderLine ) ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir switch ( nLineStyle ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleNone: 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir aBorderLine.InnerLineWidth = 0; 203*cdf0e10cSrcweir aBorderLine.OuterLineWidth = 0; 204*cdf0e10cSrcweir break; 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDashDot: 207*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDashDotDot: 208*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDashDotStroked: 209*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDashLargeGap: 210*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDashSmallGap: 211*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDot: 212*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDouble: 213*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleDoubleWavy: 214*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleEmboss3D: 215*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleEngrave3D: 216*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleInset: 217*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleOutset: 218*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleSingle: 219*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleSingleWavy: 220*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThickThinLargeGap: 221*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThickThinMedGap: 222*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThickThinSmallGap: 223*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickLargeGap: 224*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickMedGap: 225*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickSmallGap: 226*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickThinLargeGap: 227*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickThinMedGap: 228*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleThinThickThinSmallGap: 229*cdf0e10cSrcweir case word::WdLineStyle::wdLineStyleTriple: 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir aBorderLine.InnerLineWidth = 0; 232*cdf0e10cSrcweir aBorderLine.OuterLineWidth = OOLineHairline; 233*cdf0e10cSrcweir break; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir default: 236*cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() ); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir setBorderLine( aBorderLine ); 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir else 241*cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir }; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir class RangeBorders : public RangeBorders_Base 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir private: 248*cdf0e10cSrcweir uno::Reference< table::XCellRange > m_xRange; 249*cdf0e10cSrcweir uno::Reference< uno::XComponentContext > m_xContext; 250*cdf0e10cSrcweir VbaPalette m_Palette; 251*cdf0e10cSrcweir sal_Int32 getTableIndex( sal_Int32 nConst ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir // hokay return position of the index in the table 254*cdf0e10cSrcweir sal_Int32 nIndexes = getCount(); 255*cdf0e10cSrcweir sal_Int32 realIndex = 0; 256*cdf0e10cSrcweir const sal_Int16* pTableEntry = supportedIndexTable; 257*cdf0e10cSrcweir for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir if ( *pTableEntry == nConst ) 260*cdf0e10cSrcweir return realIndex; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir return getCount(); // error condition 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir public: 265*cdf0e10cSrcweir RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir // XIndexAccess 269*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir sal_Int32 nIndex = getTableIndex( Index ); 277*cdf0e10cSrcweir if ( nIndex >= 0 && nIndex < getCount() ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW ); 280*cdf0e10cSrcweir return uno::makeAny( uno::Reference< word::XBorder >( new SwVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) ); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir return word::XBorder::static_type(0); 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir return sal_True; 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir }; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir uno::Reference< container::XIndexAccess > 295*cdf0e10cSrcweir rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir return new RangeBorders( xRange, xContext, rPalette ); 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir class RangeBorderEnumWrapper : public EnumerationHelper_BASE 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir uno::Reference<container::XIndexAccess > m_xIndexAccess; 303*cdf0e10cSrcweir sal_Int32 nIndex; 304*cdf0e10cSrcweir public: 305*cdf0e10cSrcweir RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} 306*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir return ( nIndex < m_xIndexAccess->getCount() ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir if ( nIndex < m_xIndexAccess->getCount() ) 314*cdf0e10cSrcweir return m_xIndexAccess->getByIndex( nIndex++ ); 315*cdf0e10cSrcweir throw container::NoSuchElementException(); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir }; 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // for Table borders 320*cdf0e10cSrcweir SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette& rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir m_xProps.set( xRange, uno::UNO_QUERY_THROW ); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir uno::Reference< container::XEnumeration > 326*cdf0e10cSrcweir SwVbaBorders::createEnumeration() throw (uno::RuntimeException) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir return new RangeBorderEnumWrapper( m_xIndexAccess ); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir uno::Any 332*cdf0e10cSrcweir SwVbaBorders::createCollectionObject( const css::uno::Any& aSource ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir return aSource; // its already a Border object 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir uno::Type 338*cdf0e10cSrcweir SwVbaBorders::getElementType() throw (uno::RuntimeException) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir return word::XBorders::static_type(0); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir uno::Any 344*cdf0e10cSrcweir SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) ); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir table::ShadowFormat aShadowFormat; 352*cdf0e10cSrcweir m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat; 353*cdf0e10cSrcweir return ( aShadowFormat.Location != table::ShadowLocation_NONE ); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir rtl::OUString& 362*cdf0e10cSrcweir SwVbaBorders::getServiceImplName() 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorders") ); 365*cdf0e10cSrcweir return sImplName; 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir uno::Sequence< rtl::OUString > 369*cdf0e10cSrcweir SwVbaBorders::getServiceNames() 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir static uno::Sequence< rtl::OUString > aServiceNames; 372*cdf0e10cSrcweir if ( aServiceNames.getLength() == 0 ) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir aServiceNames.realloc( 1 ); 375*cdf0e10cSrcweir aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Borders" ) ); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir return aServiceNames; 378*cdf0e10cSrcweir } 379