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 : #ifndef INCLUDED_SVX_UNOPAGE_HXX
20 : #define INCLUDED_SVX_UNOPAGE_HXX
21 :
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>
38 :
39 : #include <cppuhelper/implbase6.hxx>
40 : #include <comphelper/servicehelper.hxx>
41 :
42 : #include <svx/unoprov.hxx>
43 :
44 : class SdrPage;
45 : class SdrModel;
46 : class SdrView;
47 : class SdrPageView;
48 : class SdrObject;
49 : class SvxShape;
50 : class SvxShapeGroup;
51 : class SvxShapeConnector;
52 :
53 : /**
54 : * Macros to convert Twips<->100tel mm
55 : */
56 : #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
57 : #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
58 :
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>,
65 : public SfxListener,
66 : protected SvxMutexHelper
67 : {
68 : protected:
69 : cppu::OBroadcastHelper mrBHelper;
70 :
71 : SdrPage* mpPage;
72 : SdrModel* mpModel;
73 : SdrView* mpView;
74 :
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();
77 :
78 : virtual void disposing() throw();
79 :
80 : public:
81 : SvxDrawPage( SdrPage* pPage ) throw();
82 : virtual ~SvxDrawPage() throw();
83 :
84 : // Internals
85 9820 : SdrPage* GetSdrPage() const { return mpPage; }
86 : void ChangeModel( SdrModel* pNewModel );
87 :
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();
90 :
91 : // Determine Type and Inventor
92 : static void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) throw();
93 :
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);
98 :
99 : static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL, OUString const & referer = OUString() ) throw (css::uno::RuntimeException);
100 :
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);
105 :
106 : UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
107 :
108 : // SfxListener
109 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
110 :
111 : // XInterface
112 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
113 :
114 : // XShapes
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;
119 :
120 : // XShapes2
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;
123 :
124 : // XElementAccess
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;
127 :
128 : // XIndexAccess
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;
131 :
132 : // XShapeGrouper
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;
135 :
136 : // XServiceInfo
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;
140 :
141 : // XComponent
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;
145 : };
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|