cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / include / svx / unoapi.hxx
blob6ee2d2cb27c470eab04bf1b264ee79362549d9d3
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 #ifndef INCLUDED_SVX_UNOAPI_HXX
21 #define INCLUDED_SVX_UNOAPI_HXX
23 #include <com/sun/star/drawing/XShape.hpp>
24 #include <com/sun/star/drawing/XDrawPage.hpp>
25 #include <rtl/ref.hxx>
26 #include <sal/types.h>
27 #include <svx/svxdllapi.h>
28 #include <tools/fldunit.hxx>
29 #include <tools/mapunit.hxx>
31 class SvxShape;
32 class SdrObject;
33 class SdrPage;
34 class SvxNumBulletItem;
35 class SfxItemPool;
36 enum class SdrInventor : sal_uInt32;
37 enum class SdrObjKind : sal_uInt16;
39 /**
40 * Creates a StarOffice API wrapper with the given type and inventor
41 * Deprecated: This will be replaced with a function returning XShape.
43 * @throws css::uno::RuntimeException
45 SVXCORE_DLLPUBLIC rtl::Reference<SvxShape> CreateSvxShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, OUString const & referer);
47 /** Returns a StarOffice API wrapper for the given SdrObject */
48 SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept;
50 /** Returns a StarOffice API wrapper for the given SdrPage */
51 SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XDrawPage > GetXDrawPageForSdrPage( SdrPage* pPage ) noexcept;
53 /** Returns the SdrPage from the given StarOffice API wrapper */
54 SVXCORE_DLLPUBLIC SdrPage* GetSdrPageFromXDrawPage( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ) noexcept ;
56 // helper that returns true if the given XShape is member of the given
57 // XDrawPage or it's MasterPage (aka associated)
58 SVXCORE_DLLPUBLIC bool IsXShapeAssociatedWithXDrawPage(
59 const css::uno::Reference<css::drawing::XShape>& rxShape,
60 const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage) noexcept;
62 /**
63 * Maps the vcl MapUnit enum to an API constant MeasureUnit.
64 * Returns false if conversion is not supported.
66 SVXCORE_DLLPUBLIC bool SvxMapUnitToMeasureUnit( const MapUnit nVcl, short& eApi ) noexcept;
68 /**
69 * Maps the API constant MeasureUnit to a vcl MapUnit enum.
70 * Returns false if conversion is not supported.
72 SVXCORE_DLLPUBLIC bool SvxMeasureUnitToFieldUnit( const short eApi, FieldUnit& nVcl ) noexcept;
74 /**
75 * Maps the vcl MapUnit enum to an API constant MeasureUnit.
76 * Returns false if conversion is not supported.
78 SVXCORE_DLLPUBLIC bool SvxFieldUnitToMeasureUnit( const FieldUnit nVcl, short& eApi ) noexcept;
80 /**
81 * If the given name is a predefined name for the current language it is replaced by
82 * the corresponding API name.
84 * @throws std::exception
86 [[nodiscard]] SVXCORE_DLLPUBLIC OUString
87 SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInternalName);
89 /**
90 * If the given name is a predefined API name it is replaced by the predefined name
91 * for the current language.
93 * @throws std::exception
95 [[nodiscard]] OUString
96 SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& rApiName);
98 #endif // INCLUDED_SVX_UNOAPI_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */