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 #ifndef INCLUDED_VBAHELPER_VBASHAPE_HXX 20 #define INCLUDED_VBAHELPER_VBASHAPE_HXX 21 22 #include <exception> 23 #include <memory> 24 25 #include <cppuhelper/implbase.hxx> 26 #include <com/sun/star/lang/EventObject.hpp> 27 #include <com/sun/star/lang/IllegalArgumentException.hpp> 28 #include <com/sun/star/lang/XEventListener.hpp> 29 #include <com/sun/star/uno/Any.hxx> 30 #include <com/sun/star/uno/Reference.hxx> 31 #include <com/sun/star/uno/RuntimeException.hpp> 32 #include <com/sun/star/uno/Sequence.hxx> 33 #include <ooo/vba/msforms/XShape.hpp> 34 #include <rtl/ustring.hxx> 35 #include <sal/types.h> 36 #include <vbahelper/vbadllapi.h> 37 #include <vbahelper/vbahelper.hxx> 38 #include <vbahelper/vbahelperinterface.hxx> 39 40 namespace com::sun::star { 41 namespace beans { class XPropertySet; } 42 namespace drawing { class XShape; } 43 namespace drawing { class XShapes; } 44 namespace frame { class XModel; } 45 namespace uno { class XComponentContext; } 46 } 47 48 namespace ooo::vba { 49 class ShapeHelper; 50 class XHelperInterface; 51 namespace msforms { class XFillFormat; } 52 namespace msforms { class XLineFormat; } 53 namespace msforms { class XPictureFormat; } 54 } 55 56 typedef ::cppu::WeakImplHelper< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; 57 58 typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; 59 60 class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE 61 { 62 protected: 63 std::unique_ptr< ov::ShapeHelper > m_pShapeHelper; 64 css::uno::Reference< css::drawing::XShape > m_xShape; 65 css::uno::Reference< css::drawing::XShapes > m_xShapes; 66 css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; 67 sal_Int32 m_nType; 68 css::uno::Reference< css::frame::XModel > m_xModel; 69 void addListeners(); 70 /// @throws css::uno::RuntimeException 71 void removeShapeListener(); 72 /// @throws css::uno::RuntimeException 73 void removeShapesListener(); 74 virtual OUString getServiceImplName() override; 75 virtual css::uno::Sequence<OUString> getServiceNames() override; 76 public: 77 /// @throws css::lang::IllegalArgumentException 78 /// @throws css::uno::RuntimeException 79 ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType ); 80 virtual ~ScVbaShape() override; 81 82 /// @throws css::uno::RuntimeException 83 static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape >& rShape ); 84 85 static sal_Int32 getAutoShapeType( const css::uno::Reference< css::drawing::XShape >& rShape ); 86 87 // Attributes 88 virtual OUString SAL_CALL getName() override; 89 virtual void SAL_CALL setName( const OUString& _name ) override; 90 virtual OUString SAL_CALL getAlternativeText() override; 91 virtual void SAL_CALL setAlternativeText( const OUString& _name ) override; 92 virtual double SAL_CALL getHeight() override; 93 virtual void SAL_CALL setHeight(double _height) override; 94 virtual double SAL_CALL getWidth() override; 95 virtual void SAL_CALL setWidth(double _width) override; 96 virtual double SAL_CALL getLeft() override; 97 virtual void SAL_CALL setLeft( double _left ) override; 98 virtual double SAL_CALL getTop() override; 99 virtual void SAL_CALL setTop( double _top ) override; 100 virtual sal_Bool SAL_CALL getVisible() override; 101 virtual void SAL_CALL setVisible( sal_Bool _visible ) override; 102 virtual sal_Int32 SAL_CALL getZOrderPosition() override; 103 virtual sal_Int32 SAL_CALL getType() override; 104 virtual double SAL_CALL getRotation() override; 105 virtual void SAL_CALL setRotation( double _rotation ) override; 106 virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() override; 107 virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() override; 108 virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() override; 109 virtual sal_Bool SAL_CALL getLockAspectRatio() override; 110 virtual void SAL_CALL setLockAspectRatio( sal_Bool _lockaspectratio ) override; 111 virtual sal_Bool SAL_CALL getLockAnchor() override; 112 virtual void SAL_CALL setLockAnchor( sal_Bool _lockanchor ) override; 113 virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() override; 114 virtual void SAL_CALL setRelativeHorizontalPosition(::sal_Int32 _relativehorizontalposition) override; 115 virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() override; 116 virtual void SAL_CALL setRelativeVerticalPosition(::sal_Int32 _relativeverticalposition) override; 117 118 // Methods 119 virtual css::uno::Any SAL_CALL TextFrame( ) override; 120 virtual css::uno::Any SAL_CALL WrapFormat( ) override; 121 virtual void SAL_CALL Delete() override; 122 virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) override; 123 virtual void SAL_CALL IncrementRotation( double Increment ) override; 124 virtual void SAL_CALL IncrementLeft( double Increment ) override; 125 virtual void SAL_CALL IncrementTop( double Increment ) override; 126 virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) override; 127 virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) override; 128 // Replace?? 129 virtual void SAL_CALL Select( const css::uno::Any& Replace ) override; 130 virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) override; 131 // XEventListener 132 virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override; 133 }; 134 #endif // INCLUDED_VBAHELPER_VBASHAPE_HXX 135 136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 137