fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / vba / vbaoleobject.cxx
bloba4e79829d507ced41b789753323fb7e7c0b5035f
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/awt/XWindow2.hpp>
22 #include <com/sun/star/view/XControlAccess.hpp>
23 #include <com/sun/star/container/XChild.hpp>
24 #include <com/sun/star/drawing/XShape.hpp>
25 #include <ooo/vba/XControlProvider.hpp>
27 #include "vbaoleobject.hxx"
28 #include <svx/svdobj.hxx>
29 #include "drwlayer.hxx"
30 #include "excelvbahelper.hxx"
31 #include <svtools/bindablecontrolhelper.hxx>
32 using namespace com::sun::star;
33 using namespace ooo::vba;
35 ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
36 css::uno::Reference< css::drawing::XControlShape > xControlShape )
37 : OLEObjectImpl_BASE( xParent, xContext ), m_xControlShape( xControlShape )
39 //init m_xWindowPeer
40 uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), css::uno::UNO_QUERY_THROW );
41 uno::Reference< container::XChild > xChild( xControlModel, uno::UNO_QUERY_THROW );
42 xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
43 xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
44 uno::Reference<frame::XModel> xModel( xChild->getParent(), uno::UNO_QUERY_THROW );
45 uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
46 uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext("ooo.vba.ControlProvider", mxContext ), uno::UNO_QUERY_THROW );
47 m_xControl.set( xControlProvider->createControl( xControlShape, xModel ) );
50 uno::Reference< uno::XInterface > SAL_CALL
51 ScVbaOLEObject::getObject() throw (uno::RuntimeException, std::exception)
53 return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
56 sal_Bool SAL_CALL
57 ScVbaOLEObject::getEnabled() throw (uno::RuntimeException, std::exception)
59 return m_xControl->getEnabled();
62 void SAL_CALL
63 ScVbaOLEObject::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException, std::exception)
65 m_xControl->setEnabled( _enabled );
68 sal_Bool SAL_CALL
69 ScVbaOLEObject::getVisible() throw (uno::RuntimeException, std::exception)
71 OSL_TRACE("OleObject %s returning visible %s", OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), m_xControl->getVisible() ? "true" : "false" );
72 return m_xControl->getVisible();
75 void SAL_CALL
76 ScVbaOLEObject::setVisible( sal_Bool _visible ) throw (uno::RuntimeException, std::exception)
78 OSL_TRACE("OleObject %s set visible %s", OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), _visible ? "true" : "false" );
79 m_xControl->setVisible( _visible );
82 double SAL_CALL
83 ScVbaOLEObject::getLeft() throw (uno::RuntimeException, std::exception)
85 return m_xControl->getLeft();
88 void SAL_CALL
89 ScVbaOLEObject::setLeft( double _left ) throw (uno::RuntimeException, std::exception)
91 m_xControl->setLeft( _left );
95 double SAL_CALL
96 ScVbaOLEObject::getTop() throw (uno::RuntimeException, std::exception)
98 return m_xControl->getTop();
101 void SAL_CALL
102 ScVbaOLEObject::setTop( double _top ) throw (uno::RuntimeException, std::exception)
104 m_xControl->setTop( _top );
107 double SAL_CALL
108 ScVbaOLEObject::getHeight() throw (uno::RuntimeException, std::exception)
110 return m_xControl->getHeight();
113 void SAL_CALL
114 ScVbaOLEObject::setHeight( double _height ) throw (uno::RuntimeException, std::exception)
116 m_xControl->setHeight( _height );
119 double SAL_CALL
120 ScVbaOLEObject::getWidth() throw (uno::RuntimeException, std::exception)
122 return m_xControl->getWidth();
125 void SAL_CALL
126 ScVbaOLEObject::setWidth( double _width ) throw (uno::RuntimeException, std::exception)
128 m_xControl->setWidth( _width );
131 OUString SAL_CALL ScVbaOLEObject::getLinkedCell() throw (uno::RuntimeException, std::exception)
133 return m_xControl->getControlSource();
136 void SAL_CALL ScVbaOLEObject::setLinkedCell( const OUString& _linkedcell ) throw (uno::RuntimeException, std::exception)
138 m_xControl->setControlSource( _linkedcell );
141 OUString
142 ScVbaOLEObject::getServiceImplName()
144 return OUString("ScVbaOLEObject");
147 uno::Sequence< OUString >
148 ScVbaOLEObject::getServiceNames()
150 static uno::Sequence< OUString > aServiceNames;
151 if ( aServiceNames.getLength() == 0 )
153 aServiceNames.realloc( 1 );
154 aServiceNames[ 0 ] = "ooo.vba.excel.OLEObject";
156 return aServiceNames;
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */