/src/libreoffice/svx/source/customshapes/EnhancedCustomShapeHandle.cxx
Line | Count | Source |
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/svdoashp.hxx> |
23 | | #include <utility> |
24 | | |
25 | | |
26 | | EnhancedCustomShapeHandle::EnhancedCustomShapeHandle( rtl::Reference< SdrObjCustomShape > xCustomShape, sal_uInt32 nIndex ) : |
27 | 32 | mnIndex ( nIndex ), |
28 | 32 | mxCustomShape (std::move( xCustomShape )) |
29 | 32 | { |
30 | 32 | } |
31 | | |
32 | | |
33 | | EnhancedCustomShapeHandle::~EnhancedCustomShapeHandle() |
34 | 32 | { |
35 | 32 | } |
36 | | |
37 | | |
38 | | void SAL_CALL EnhancedCustomShapeHandle::acquire() noexcept |
39 | 96 | { |
40 | 96 | OWeakObject::acquire(); |
41 | 96 | } |
42 | | |
43 | | |
44 | | void SAL_CALL EnhancedCustomShapeHandle::release() noexcept |
45 | 96 | { |
46 | 96 | OWeakObject::release(); |
47 | 96 | } |
48 | | |
49 | | // XCustomShapeHandle |
50 | | css::awt::Point SAL_CALL EnhancedCustomShapeHandle::getPosition() |
51 | 32 | { |
52 | 32 | if(!mxCustomShape) |
53 | 0 | { |
54 | 0 | throw css::uno::RuntimeException(); |
55 | 0 | } |
56 | | |
57 | 32 | Point aPosition; |
58 | 32 | EnhancedCustomShape2d aCustomShape2d(*mxCustomShape); |
59 | | |
60 | 32 | if(!aCustomShape2d.GetHandlePosition(mnIndex, aPosition)) |
61 | 0 | { |
62 | 0 | throw css::uno::RuntimeException(); |
63 | 0 | } |
64 | | |
65 | 32 | return css::awt::Point( aPosition.X(), aPosition.Y() ); |
66 | 32 | } |
67 | | |
68 | | void SAL_CALL EnhancedCustomShapeHandle::setControllerPosition( const css::awt::Point& aPnt ) |
69 | 0 | { |
70 | 0 | if(!mxCustomShape) |
71 | 0 | { |
72 | 0 | throw css::uno::RuntimeException(); |
73 | 0 | } |
74 | | |
75 | 0 | EnhancedCustomShape2d aCustomShape2d(*mxCustomShape); |
76 | |
|
77 | 0 | if(!aCustomShape2d.SetHandleControllerPosition(mnIndex, aPnt)) |
78 | 0 | { |
79 | 0 | throw css::uno::RuntimeException(); |
80 | 0 | } |
81 | 0 | } |
82 | | |
83 | | // XInitialization |
84 | | void SAL_CALL EnhancedCustomShapeHandle::initialize( const css::uno::Sequence< css::uno::Any >& /* aArguments */ ) |
85 | 0 | { |
86 | 0 | } |
87 | | |
88 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |