LibreOffice Module sc (master) 1
vbaoleobject.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
20#include <com/sun/star/awt/XControlModel.hpp>
21#include <com/sun/star/container/XChild.hpp>
22#include <com/sun/star/lang/XMultiComponentFactory.hpp>
23#include <ooo/vba/XControlProvider.hpp>
24
25#include "vbaoleobject.hxx"
26
27using namespace com::sun::star;
28using namespace ooo::vba;
29
30ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
31 css::uno::Reference< css::drawing::XControlShape > const & xControlShape )
32: OLEObjectImpl_BASE( xParent, xContext )
33{
34 //init m_xWindowPeer
35 uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), css::uno::UNO_SET_THROW );
36 uno::Reference< container::XChild > xChild( xControlModel, uno::UNO_QUERY_THROW );
37 xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
38 xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
39 uno::Reference<frame::XModel> xModel( xChild->getParent(), uno::UNO_QUERY_THROW );
40 uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
41 uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext("ooo.vba.ControlProvider", mxContext ), uno::UNO_QUERY_THROW );
42 m_xControl.set( xControlProvider->createControl( xControlShape, xModel ) );
43}
44
45uno::Reference< uno::XInterface > SAL_CALL
47{
48 return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
49}
50
51sal_Bool SAL_CALL
53{
54 return m_xControl->getEnabled();
55}
56
57void SAL_CALL
59{
60 m_xControl->setEnabled( _enabled );
61}
62
63sal_Bool SAL_CALL
65{
66 return m_xControl->getVisible();
67}
68
69void SAL_CALL
71{
72 m_xControl->setVisible( _visible );
73}
74
75double SAL_CALL
77{
78 return m_xControl->getLeft();
79}
80
81void SAL_CALL
83{
84 m_xControl->setLeft( _left );
85
86}
87
88double SAL_CALL
90{
91 return m_xControl->getTop();
92}
93
94void SAL_CALL
96{
97 m_xControl->setTop( _top );
98}
99
100double SAL_CALL
102{
103 return m_xControl->getHeight();
104}
105
106void SAL_CALL
108{
109 m_xControl->setHeight( _height );
110}
111
112double SAL_CALL
114{
115 return m_xControl->getWidth();
116}
117
118void SAL_CALL
120{
121 m_xControl->setWidth( _width );
122}
123
125{
126 return m_xControl->getControlSource();
127}
128
129void SAL_CALL ScVbaOLEObject::setLinkedCell( const OUString& _linkedcell )
130{
131 m_xControl->setControlSource( _linkedcell );
132}
133
134OUString
136{
137 return "ScVbaOLEObject";
138}
139
140uno::Sequence< OUString >
142{
143 static uno::Sequence< OUString > const aServiceNames
144 {
145 "ooo.vba.excel.OLEObject"
146 };
147 return aServiceNames;
148}
149
150/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual double SAL_CALL getTop() override
virtual OUString getServiceImplName() override
virtual void SAL_CALL setEnabled(sal_Bool _enabled) override
virtual void SAL_CALL setLinkedCell(const OUString &_linkedcell) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() override
virtual void SAL_CALL setHeight(double _height) override
virtual void SAL_CALL setTop(double _top) override
virtual double SAL_CALL getHeight() override
virtual void SAL_CALL setWidth(double _width) override
virtual double SAL_CALL getWidth() override
virtual void SAL_CALL setVisible(sal_Bool _visible) override
virtual sal_Bool SAL_CALL getEnabled() override
virtual void SAL_CALL setLeft(double _left) override
ScVbaOLEObject(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::drawing::XControlShape > const &xControlShape)
virtual sal_Bool SAL_CALL getVisible() override
virtual OUString SAL_CALL getLinkedCell() override
virtual double SAL_CALL getLeft() override
virtual css::uno::Sequence< OUString > getServiceNames() override
css::uno::Reference< ov::msforms::XControl > m_xControl
Sequence< OUString > aServiceNames
Reference< XModel > xModel
unsigned char sal_Bool