LibreOffice Module sw (master)  1
vbacell.cxx
Go to the documentation of this file.
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 "vbatablehelper.hxx"
21 #include "vbarow.hxx"
22 
23 using namespace ::ooo::vba;
24 using namespace ::com::sun::star;
25 
26 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 ) :
27  SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
28 {
29 }
30 
32 {
33 }
34 
35 ::sal_Int32 SAL_CALL SwVbaCell::getWidth()
36 {
37  SwVbaTableHelper aTableHelper( mxTextTable );
38  return aTableHelper.GetColWidth( mnColumn, mnRow );
39 }
40 
41 void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width )
42 {
43  SwVbaTableHelper aTableHelper( mxTextTable );
44  aTableHelper.SetColWidth( _width, mnColumn, mnRow, true );
45 }
46 
48 {
49  uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
50  return xRow->getHeight();
51 }
52 
53 void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height )
54 {
55  uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
56  xRow->setHeight( _height );
57 }
58 
59 ::sal_Int32 SAL_CALL SwVbaCell::getHeightRule()
60 {
61  uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
62  return xRow->getHeightRule();
63 }
64 
65 void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule )
66 {
67  uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
68  xRow->setHeightRule( _heightrule );
69 }
70 
71 void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 /*rulestyle*/ )
72 {
73  // FIXME: handle the argument: rulestyle
74  setWidth( static_cast<sal_Int32>(width) );
75 }
76 
77 void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule )
78 {
79  // FIXME: handle the argument: heightrule
80  setHeightRule( heightrule );
81  setHeight( uno::makeAny( height ) );
82 }
83 
84 OUString
86 {
87  return "SwVbaCell";
88 }
89 
90 uno::Sequence< OUString >
92 {
93  static uno::Sequence< OUString > const aServiceNames
94  {
95  "ooo.vba.word.Cell"
96  };
97  return aServiceNames;
98 }
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbacell.cxx:91
virtual void SAL_CALL SetWidth(float width, sal_Int32 rulestyle) override
Definition: vbacell.cxx:71
virtual ~SwVbaCell() override
Definition: vbacell.cxx:31
virtual css::uno::Any SAL_CALL getHeight() override
Definition: vbacell.cxx:47
static sal_Int32 GetColWidth(SwTabCols &rCols, sal_Int32 nNum)
Sequence< OUString > aServiceNames
virtual void SAL_CALL setHeight(const css::uno::Any &_height) override
Definition: vbacell.cxx:53
virtual void SAL_CALL SetHeight(float height, sal_Int32 heightrule) override
Definition: vbacell.cxx:77
void SetColWidth(sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow=0, bool bCurRowOnly=false)
uno::Reference< sdbc::XRow > xRow
virtual OUString getServiceImplName() override
Definition: vbacell.cxx:85
sal_Int32 mnRow
Definition: vbacell.hxx:33
virtual ::sal_Int32 SAL_CALL getHeightRule() override
Definition: vbacell.cxx:59
virtual void SAL_CALL setHeightRule(::sal_Int32 _heightrule) override
Definition: vbacell.cxx:65
SwVbaCell(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::text::XTextTable > &xTextTable, sal_Int32 nColumn, sal_Int32 nRow)
Definition: vbacell.cxx:26
sal_Int32 mnColumn
Definition: vbacell.hxx:32
css::uno::Reference< css::text::XTextTable > mxTextTable
Definition: vbacell.hxx:31
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
virtual void SAL_CALL setWidth(::sal_Int32 _width) override
Definition: vbacell.cxx:41
sal_Int32 mnRow
virtual ::sal_Int32 SAL_CALL getWidth() override
Definition: vbacell.cxx:35