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
;
54 * Macros to convert Twips<->100tel mm
56 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
57 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
59 class SVX_DLLPUBLIC SvxDrawPage
: public ::cppu::WeakAggImplHelper6
< ::com::sun::star::drawing::XDrawPage
,
60 ::com::sun::star::drawing::XShapeGrouper
,
61 ::com::sun::star::drawing::XShapes2
,
62 ::com::sun::star::lang::XServiceInfo
,
63 ::com::sun::star::lang::XUnoTunnel
,
64 ::com::sun::star::lang::XComponent
>,
66 protected SvxMutexHelper
69 cppu::OBroadcastHelper mrBHelper
;
75 void _SelectObjectsInView( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
>& aShapes
, SdrPageView
* pPageView
) throw ();
76 void _SelectObjectInView( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
, SdrPageView
* pPageView
) throw();
78 virtual void disposing() throw();
81 SvxDrawPage( SdrPage
* pPage
) throw();
82 virtual ~SvxDrawPage() throw();
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 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
, bool bBeginning
= false ) throw();
91 // Determine Type and Inventor
92 static void GetTypeAndInventor( sal_uInt16
& rType
, sal_uInt32
& 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 virtual SdrObject
*_CreateSdrObject( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
)
97 throw (css::uno::RuntimeException
, std::exception
);
99 static SvxShape
* CreateShapeByTypeAndInventor( sal_uInt16 nType
, sal_uInt32 nInventor
, SdrObject
*pObj
= NULL
, SvxDrawPage
*pPage
= NULL
, OUString
const & referer
= OUString() ) throw (css::uno::RuntimeException
);
101 // The following method is called if a SvxShape object is to be created.
102 // Derived classes can create a derivation or an SvxShape aggregating object.
103 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> _CreateShape( SdrObject
*pObj
) const
104 throw (css::uno::RuntimeException
, std::exception
);
106 UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage
)
109 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
115 virtual void SAL_CALL
add( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
)
117 throw (::com::sun::star::uno::RuntimeException
,
118 std::exception
) SAL_OVERRIDE
;
121 virtual void SAL_CALL
addTop( const ::com::sun::star::uno::Reference
< com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual void SAL_CALL
addBottom( const ::com::sun::star::uno::Reference
< com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw(::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapeGroup
> SAL_CALL
group( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
>& xShapes
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
134 virtual void SAL_CALL
ungroup( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapeGroup
>& aGroup
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
138 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
142 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
144 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */