bump product version to 5.0.4.1
[LibreOffice.git] / svx / source / customshapes / EnhancedCustomShapeHandle.cxx
blob6085569de9ad1e5719edc982800eb897e58fba51
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 "EnhancedCustomShapeHandle.hxx"
21 #include "svx/EnhancedCustomShape2d.hxx"
22 #include "svx/unoapi.hxx"
26 EnhancedCustomShapeHandle::EnhancedCustomShapeHandle( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xCustomShape, sal_uInt32 nIndex ) :
27 mnIndex ( nIndex ),
28 mxCustomShape ( xCustomShape )
34 EnhancedCustomShapeHandle::~EnhancedCustomShapeHandle()
40 void SAL_CALL EnhancedCustomShapeHandle::acquire() throw()
42 OWeakObject::acquire();
47 void SAL_CALL EnhancedCustomShapeHandle::release() throw()
49 OWeakObject::release();
52 // XCustomShapeHandle
53 com::sun::star::awt::Point SAL_CALL EnhancedCustomShapeHandle::getPosition()
54 throw ( com::sun::star::uno::RuntimeException, std::exception )
56 SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
57 if ( !pSdrObjCustomShape )
58 throw com::sun::star::uno::RuntimeException();
60 Point aPosition;
61 EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
62 if ( !aCustomShape2d.GetHandlePosition( mnIndex, aPosition ) )
63 throw com::sun::star::uno::RuntimeException();
64 return com::sun::star::awt::Point( aPosition.X(), aPosition.Y() );
67 void SAL_CALL EnhancedCustomShapeHandle::setControllerPosition( const com::sun::star::awt::Point& aPnt )
68 throw ( com::sun::star::uno::RuntimeException, std::exception )
70 SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
71 if ( !pSdrObjCustomShape )
72 throw com::sun::star::uno::RuntimeException();
74 EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
75 if ( !aCustomShape2d.SetHandleControllerPosition( mnIndex, aPnt ) )
76 throw com::sun::star::uno::RuntimeException();
79 // XInitialization
80 void SAL_CALL EnhancedCustomShapeHandle::initialize( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& /* aArguments */ )
81 throw ( com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception )
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */