Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2008 by Sun Microsystems, Inc.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "vbacell.hxx"
29 : : #include <vbahelper/vbahelper.hxx>
30 : : #include <tools/diagnose_ex.h>
31 : : #include "vbatable.hxx"
32 : : #include <com/sun/star/table/XCellRange.hpp>
33 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
34 : : #include <rtl/ustrbuf.hxx>
35 : : #include "wordvbahelper.hxx"
36 : : #include "vbatablehelper.hxx"
37 : : #include "vbarow.hxx"
38 : :
39 : : using namespace ::ooo::vba;
40 : : using namespace ::com::sun::star;
41 : :
42 : 0 : SwVbaCell::SwVbaCell( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( uno::RuntimeException ) :
43 : 0 : SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
44 : : {
45 : 0 : }
46 : :
47 : 0 : SwVbaCell::~SwVbaCell()
48 : : {
49 [ # # ]: 0 : }
50 : :
51 : 0 : ::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
52 : : {
53 [ # # ]: 0 : SwVbaTableHelper aTableHelper( mxTextTable );
54 [ # # ][ # # ]: 0 : return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
55 : : }
56 : :
57 : 0 : void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
58 : : {
59 [ # # ]: 0 : SwVbaTableHelper aTableHelper( mxTextTable );
60 [ # # ][ # # ]: 0 : aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
61 : 0 : }
62 : :
63 : 0 : uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
64 : : {
65 [ # # ][ # # ]: 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
[ # # ][ # # ]
66 [ # # ][ # # ]: 0 : return xRow->getHeight();
67 : : }
68 : :
69 : 0 : void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
70 : : {
71 [ # # ][ # # ]: 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
[ # # ][ # # ]
72 [ # # ][ # # ]: 0 : xRow->setHeight( _height );
73 : 0 : }
74 : :
75 : 0 : ::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
76 : : {
77 [ # # ][ # # ]: 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
[ # # ][ # # ]
78 [ # # ][ # # ]: 0 : return xRow->getHeightRule();
79 : : }
80 : :
81 : 0 : void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
82 : : {
83 [ # # ][ # # ]: 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
[ # # ][ # # ]
84 [ # # ][ # # ]: 0 : xRow->setHeightRule( _heightrule );
85 : 0 : }
86 : :
87 : 0 : void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 /*rulestyle*/ ) throw (css::uno::RuntimeException)
88 : : {
89 : : // FIXME: handle the argument: rulestyle
90 : 0 : setWidth( static_cast<sal_Int32>(width) );
91 : 0 : }
92 : :
93 : 0 : void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
94 : : {
95 : : // FIXME: handle the argument: heightrule
96 : 0 : setHeightRule( heightrule );
97 [ # # ]: 0 : setHeight( uno::makeAny( height ) );
98 : 0 : }
99 : :
100 : : rtl::OUString
101 : 0 : SwVbaCell::getServiceImplName()
102 : : {
103 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaCell"));
104 : : }
105 : :
106 : : uno::Sequence< rtl::OUString >
107 : 0 : SwVbaCell::getServiceNames()
108 : : {
109 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
110 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
111 : : {
112 : 0 : aServiceNames.realloc( 1 );
113 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
114 : : }
115 : 0 : return aServiceNames;
116 : : }
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|