tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / vba / vbaoleobject.cxx
blobbfd981ba792228dc2c8f333af5c4a0fd210e5583
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
25 #include "vbaoleobject.hxx"
27 using namespace com::sun::star;
28 using namespace ooo::vba;
30 ScVbaOLEObject::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 )
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(u"ooo.vba.ControlProvider"_ustr, mxContext ), uno::UNO_QUERY_THROW );
42 m_xControl.set( xControlProvider->createControl( xControlShape, xModel ) );
45 uno::Reference< uno::XInterface > SAL_CALL
46 ScVbaOLEObject::getObject()
48 return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
51 sal_Bool SAL_CALL
52 ScVbaOLEObject::getEnabled()
54 return m_xControl->getEnabled();
57 void SAL_CALL
58 ScVbaOLEObject::setEnabled( sal_Bool _enabled )
60 m_xControl->setEnabled( _enabled );
63 sal_Bool SAL_CALL
64 ScVbaOLEObject::getVisible()
66 return m_xControl->getVisible();
69 void SAL_CALL
70 ScVbaOLEObject::setVisible( sal_Bool _visible )
72 m_xControl->setVisible( _visible );
75 double SAL_CALL
76 ScVbaOLEObject::getLeft()
78 return m_xControl->getLeft();
81 void SAL_CALL
82 ScVbaOLEObject::setLeft( double _left )
84 m_xControl->setLeft( _left );
88 double SAL_CALL
89 ScVbaOLEObject::getTop()
91 return m_xControl->getTop();
94 void SAL_CALL
95 ScVbaOLEObject::setTop( double _top )
97 m_xControl->setTop( _top );
100 double SAL_CALL
101 ScVbaOLEObject::getHeight()
103 return m_xControl->getHeight();
106 void SAL_CALL
107 ScVbaOLEObject::setHeight( double _height )
109 m_xControl->setHeight( _height );
112 double SAL_CALL
113 ScVbaOLEObject::getWidth()
115 return m_xControl->getWidth();
118 void SAL_CALL
119 ScVbaOLEObject::setWidth( double _width )
121 m_xControl->setWidth( _width );
124 OUString SAL_CALL ScVbaOLEObject::getLinkedCell()
126 return m_xControl->getControlSource();
129 void SAL_CALL ScVbaOLEObject::setLinkedCell( const OUString& _linkedcell )
131 m_xControl->setControlSource( _linkedcell );
134 OUString
135 ScVbaOLEObject::getServiceImplName()
137 return u"ScVbaOLEObject"_ustr;
140 uno::Sequence< OUString >
141 ScVbaOLEObject::getServiceNames()
143 static uno::Sequence< OUString > const aServiceNames
145 u"ooo.vba.excel.OLEObject"_ustr
147 return aServiceNames;
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */