Line data Source code
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 "EnhancedCustomShapeHandle.hxx"
21 : #include "svx/EnhancedCustomShape2d.hxx"
22 : #include "svx/unoapi.hxx"
23 :
24 :
25 :
26 130 : EnhancedCustomShapeHandle::EnhancedCustomShapeHandle( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xCustomShape, sal_uInt32 nIndex ) :
27 : mnIndex ( nIndex ),
28 130 : mxCustomShape ( xCustomShape )
29 : {
30 130 : }
31 :
32 :
33 :
34 260 : EnhancedCustomShapeHandle::~EnhancedCustomShapeHandle()
35 : {
36 260 : }
37 :
38 :
39 :
40 400 : void SAL_CALL EnhancedCustomShapeHandle::acquire() throw()
41 : {
42 400 : OWeakObject::acquire();
43 400 : }
44 :
45 :
46 :
47 400 : void SAL_CALL EnhancedCustomShapeHandle::release() throw()
48 : {
49 400 : OWeakObject::release();
50 400 : }
51 :
52 : // XCustomShapeHandle
53 130 : com::sun::star::awt::Point SAL_CALL EnhancedCustomShapeHandle::getPosition()
54 : throw ( com::sun::star::uno::RuntimeException, std::exception )
55 : {
56 130 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
57 130 : if ( !pSdrObjCustomShape )
58 0 : throw com::sun::star::uno::RuntimeException();
59 :
60 130 : Point aPosition;
61 130 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
62 130 : if ( !aCustomShape2d.GetHandlePosition( mnIndex, aPosition ) )
63 0 : throw com::sun::star::uno::RuntimeException();
64 130 : return com::sun::star::awt::Point( aPosition.X(), aPosition.Y() );
65 : }
66 :
67 0 : void SAL_CALL EnhancedCustomShapeHandle::setControllerPosition( const com::sun::star::awt::Point& aPnt )
68 : throw ( com::sun::star::uno::RuntimeException, std::exception )
69 : {
70 0 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
71 0 : if ( !pSdrObjCustomShape )
72 0 : throw com::sun::star::uno::RuntimeException();
73 :
74 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
75 0 : if ( !aCustomShape2d.SetHandleControllerPosition( mnIndex, aPnt ) )
76 0 : throw com::sun::star::uno::RuntimeException();
77 0 : }
78 :
79 : // XInitialization
80 0 : 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 )
82 : {
83 594 : }
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|