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