31 uno::Reference< container::XIndexAccess > mxIndexAccess;
35 explicit CellsEnumWrapper(
const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
38 virtual sal_Bool SAL_CALL hasMoreElements( )
override
40 return ( nIndex < mxIndexAccess->getCount() );
43 virtual uno::Any SAL_CALL nextElement( )
override
45 if( nIndex < mxIndexAccess->getCount() )
47 return mxIndexAccess->getByIndex( nIndex++ );
49 throw container::NoSuchElementException();
53 class CellCollectionHelper :
public ::cppu::WeakImplHelper< container::XIndexAccess,
54 container::XEnumerationAccess >
57 uno::Reference< XHelperInterface >
mxParent;
58 uno::Reference< uno::XComponentContext >
mxContext;
59 uno::Reference< css::text::XTextTable > mxTextTable;
67 CellCollectionHelper(
const css::uno::Reference< ov::XHelperInterface >& xParent,
const css::uno::Reference< css::uno::XComponentContext > & xContext,
const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ): mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
71 virtual sal_Int32 SAL_CALL getCount( )
override
73 return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
75 virtual uno::Any SAL_CALL getByIndex( sal_Int32
Index )
override
78 throw css::lang::IndexOutOfBoundsException();
80 for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
82 for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
84 if( Index == ( ( row - mnTop ) * ( mnRight - mnLeft + 1 ) + ( col - mnLeft ) ) )
85 return uno::Any( uno::Reference< word::XCell >(
new SwVbaCell( mxParent, mxContext, mxTextTable, col, row ) ) );
88 throw css::lang::IndexOutOfBoundsException();
91 virtual uno::Type SAL_CALL getElementType( )
override
95 virtual sal_Bool SAL_CALL hasElements( )
override
100 virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( )
override
102 return new CellsEnumWrapper(
this );
108 SwVbaCells::SwVbaCells(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext > & xContext,
const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) :
SwVbaCells_BASE( xParent, xContext,
uno::
Reference<
container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnTop( nTop ), mnBottom( nBottom )
114 uno::Reference< word::XCell > xCell(
m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
115 return xCell->getWidth();
120 sal_Int32 nIndex = 0;
121 while( nIndex < m_xIndexAccess->
getCount() )
123 uno::Reference< word::XCell > xCell(
m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
124 xCell->setWidth( _width );
131 return xRow->getHeight();
136 for( sal_Int32 row = mnTop; row <=
mnBottom; row++ )
139 xRow->setHeight( _height );
146 return xRow->getHeightRule();
151 for( sal_Int32 row = mnTop; row <=
mnBottom; row++ )
154 xRow->setHeightRule( _heightrule );
160 sal_Int32 nIndex = 0;
161 while( nIndex < m_xIndexAccess->
getCount() )
163 uno::Reference< word::XCell > xCell(
m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
164 xCell->SetWidth( width, rulestyle );
170 for( sal_Int32 row = mnTop; row <=
mnBottom; row++ )
173 xRow->SetHeight( height, heightrule );
184 uno::Reference< container::XEnumeration >
187 uno::Reference< container::XEnumerationAccess > xEnumAccess(
m_xIndexAccess, uno::UNO_QUERY_THROW );
188 return xEnumAccess->createEnumeration();
203 uno::Sequence<OUString>
206 static uno::Sequence< OUString >
const sNames
virtual void SAL_CALL setHeightRule(::sal_Int32 _heightrule) override
virtual ::sal_Int32 SAL_CALL getHeightRule() override
virtual css::uno::Any createCollectionObject(const css::uno::Any &aSource) override
virtual ::sal_Int32 SAL_CALL getWidth() override
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
WeakReference< XInterface > mxParent
::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE
exports com.sun.star. container
virtual void SAL_CALL SetHeight(float height, sal_Int32 heightrule) override
SwVbaCells(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::text::XTextTable > &xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom)
virtual OUString getServiceImplName() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual void SAL_CALL setHeight(const css::uno::Any &_height) override
virtual css::uno::Any SAL_CALL getHeight() override
css::uno::Type const & get()
virtual void SAL_CALL setWidth(::sal_Int32 _width) override
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL SetWidth(float width, sal_Int32 rulestyle) override
virtual ::sal_Int32 SAL_CALL getCount() override