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 : #include "vbacell.hxx"
20 : #include <vbahelper/vbahelper.hxx>
21 : #include <tools/diagnose_ex.h>
22 : #include "vbatable.hxx"
23 : #include <com/sun/star/table/XCellRange.hpp>
24 : #include <com/sun/star/view/XSelectionSupplier.hpp>
25 : #include <rtl/ustrbuf.hxx>
26 : #include "wordvbahelper.hxx"
27 : #include "vbatablehelper.hxx"
28 : #include "vbarow.hxx"
29 :
30 : using namespace ::ooo::vba;
31 : using namespace ::com::sun::star;
32 :
33 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 ) :
34 0 : SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
35 : {
36 0 : }
37 :
38 0 : SwVbaCell::~SwVbaCell()
39 : {
40 0 : }
41 :
42 0 : ::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
43 : {
44 0 : SwVbaTableHelper aTableHelper( mxTextTable );
45 0 : return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
46 : }
47 :
48 0 : void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
49 : {
50 0 : SwVbaTableHelper aTableHelper( mxTextTable );
51 0 : aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
52 0 : }
53 :
54 0 : uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
55 : {
56 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
57 0 : return xRow->getHeight();
58 : }
59 :
60 0 : void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
61 : {
62 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
63 0 : xRow->setHeight( _height );
64 0 : }
65 :
66 0 : ::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
67 : {
68 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
69 0 : return xRow->getHeightRule();
70 : }
71 :
72 0 : void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
73 : {
74 0 : uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
75 0 : xRow->setHeightRule( _heightrule );
76 0 : }
77 :
78 0 : void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 /*rulestyle*/ ) throw (css::uno::RuntimeException)
79 : {
80 : // FIXME: handle the argument: rulestyle
81 0 : setWidth( static_cast<sal_Int32>(width) );
82 0 : }
83 :
84 0 : void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
85 : {
86 : // FIXME: handle the argument: heightrule
87 0 : setHeightRule( heightrule );
88 0 : setHeight( uno::makeAny( height ) );
89 0 : }
90 :
91 : rtl::OUString
92 0 : SwVbaCell::getServiceImplName()
93 : {
94 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaCell"));
95 : }
96 :
97 : uno::Sequence< rtl::OUString >
98 0 : SwVbaCell::getServiceNames()
99 : {
100 0 : static uno::Sequence< rtl::OUString > aServiceNames;
101 0 : if ( aServiceNames.getLength() == 0 )
102 : {
103 0 : aServiceNames.realloc( 1 );
104 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
105 : }
106 0 : return aServiceNames;
107 : }
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|