1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SVX_UNOPAGE_HXX
20 #define INCLUDED_SVX_UNOPAGE_HXX
22 #include <com/sun/star/lang/XComponent.hpp>
23 #include <cppuhelper/interfacecontainer.hxx>
24 #include <com/sun/star/lang/XTypeProvider.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/drawing/XDrawPage.hpp>
28 #include <com/sun/star/drawing/XShapes2.hpp>
29 #include <com/sun/star/drawing/XShapeGrouper.hpp>
30 #include <com/sun/star/drawing/XShapeCombiner.hpp>
31 #include <com/sun/star/drawing/XShapeBinder.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <cppuhelper/weak.hxx>
34 #include <cppuhelper/weakagg.hxx>
35 #include <svl/lstner.hxx>
36 #include <editeng/mutxhelp.hxx>
37 #include <svx/svxdllapi.h>
39 #include <cppuhelper/implbase6.hxx>
40 #include <comphelper/servicehelper.hxx>
42 #include <svx/unoprov.hxx>
51 class SvxShapeConnector
;
52 enum class SdrInventor
: sal_uInt32
;
55 * Macros to convert Twips<->100tel mm
57 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
58 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
60 class SVX_DLLPUBLIC SvxDrawPage
: public ::cppu::WeakAggImplHelper6
< css::drawing::XDrawPage
,
61 css::drawing::XShapeGrouper
,
62 css::drawing::XShapes2
,
63 css::lang::XServiceInfo
,
64 css::lang::XUnoTunnel
,
65 css::lang::XComponent
>,
66 protected SvxMutexHelper
69 cppu::OBroadcastHelper mrBHelper
;
75 void SelectObjectsInView( const css::uno::Reference
< css::drawing::XShapes
>& aShapes
, SdrPageView
* pPageView
) throw ();
76 void SelectObjectInView( const css::uno::Reference
< css::drawing::XShape
>& xShape
, SdrPageView
* pPageView
) throw();
78 virtual void disposing() throw();
81 SvxDrawPage( SdrPage
* pPage
) throw();
82 virtual ~SvxDrawPage() throw() override
;
85 SdrPage
* GetSdrPage() const { return mpPage
; }
86 void ChangeModel( SdrModel
* pNewModel
);
88 // Creation of a SdrObject and insertion into the SdrPage
89 SdrObject
*CreateSdrObject( const css::uno::Reference
< css::drawing::XShape
>& xShape
, bool bBeginning
= false ) throw();
91 // Determine Type and Inventor
92 static void GetTypeAndInventor( sal_uInt16
& rType
, SdrInventor
& rInventor
, const OUString
& aName
) throw();
94 // Creating a SdrObject using it's Description.
95 // Can be used by derived classes to support their owen Shapes (e.g. Controls).
96 /// @throws css::uno::RuntimeException
97 virtual SdrObject
*CreateSdrObject_( const css::uno::Reference
< css::drawing::XShape
>& xShape
);
99 /// @throws css::uno::RuntimeException
100 static SvxShape
* CreateShapeByTypeAndInventor( sal_uInt16 nType
, SdrInventor nInventor
, SdrObject
*pObj
, SvxDrawPage
*pPage
= nullptr, OUString
const & referer
= OUString() );
102 // The following method is called if a SvxShape object is to be created.
103 // Derived classes can create a derivation or an SvxShape aggregating object.
104 /// @throws css::uno::RuntimeException
105 virtual css::uno::Reference
< css::drawing::XShape
> CreateShape( SdrObject
*pObj
) const;
107 UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage
)
110 virtual void SAL_CALL
release() throw() override
;
113 virtual void SAL_CALL
add( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
114 virtual void SAL_CALL
remove( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
117 virtual void SAL_CALL
addTop( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
118 virtual void SAL_CALL
addBottom( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
121 virtual css::uno::Type SAL_CALL
getElementType() override
;
122 virtual sal_Bool SAL_CALL
hasElements() override
;
125 virtual sal_Int32 SAL_CALL
getCount() override
;
126 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
129 virtual css::uno::Reference
< css::drawing::XShapeGroup
> SAL_CALL
group( const css::uno::Reference
< css::drawing::XShapes
>& xShapes
) override
;
130 virtual void SAL_CALL
ungroup( const css::uno::Reference
< css::drawing::XShapeGroup
>& aGroup
) override
;
133 virtual OUString SAL_CALL
getImplementationName() override
;
134 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
135 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
138 virtual void SAL_CALL
dispose() override
;
139 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
140 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */