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