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/XShapeGrouper.hpp>
29 : #include <com/sun/star/drawing/XShapeCombiner.hpp>
30 : #include <com/sun/star/drawing/XShapeBinder.hpp>
31 : #include <com/sun/star/lang/XUnoTunnel.hpp>
32 : #include <cppuhelper/weak.hxx>
33 : #include <cppuhelper/weakagg.hxx>
34 : #include <svl/lstner.hxx>
35 : #include <editeng/mutxhelp.hxx>
36 : #include <svx/svxdllapi.h>
37 :
38 : #include <cppuhelper/implbase5.hxx>
39 : #include <comphelper/servicehelper.hxx>
40 :
41 : #include <svx/unoprov.hxx>
42 :
43 : class SdrPage;
44 : class SdrModel;
45 : class SdrView;
46 : class SdrPageView;
47 : class SdrObject;
48 : class SvxShape;
49 : class SvxShapeGroup;
50 : class SvxShapeConnector;
51 :
52 : /**
53 : * Macros to convert Twips<->100tel mm
54 : */
55 : #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
56 : #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
57 :
58 : class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
59 : ::com::sun::star::drawing::XShapeGrouper,
60 : ::com::sun::star::lang::XServiceInfo,
61 : ::com::sun::star::lang::XUnoTunnel,
62 : ::com::sun::star::lang::XComponent>,
63 : public SfxListener,
64 : protected SvxMutexHelper
65 : {
66 : protected:
67 : cppu::OBroadcastHelper mrBHelper;
68 :
69 : SdrPage* mpPage;
70 : SdrModel* mpModel;
71 : SdrView* mpView;
72 :
73 : void _SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
74 : void _SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
75 :
76 : virtual void disposing() throw();
77 :
78 : public:
79 : SvxDrawPage( SdrPage* pPage ) throw();
80 : virtual ~SvxDrawPage() throw();
81 :
82 : // Internals
83 0 : SdrPage* GetSdrPage() const { return mpPage; }
84 : void ChangeModel( SdrModel* pNewModel );
85 :
86 : // Creation of a SdrObject and insertion into the SdrPage
87 : SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
88 :
89 : // Determine Type and Inventor
90 : void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw();
91 :
92 : // Creating a SdrObject using it's Description.
93 : // Can be used by derived classes to support their owen Shapes (e.g. Controls).
94 : virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
95 : throw (std::exception);
96 :
97 : static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL, OUString const & referer = OUString() ) throw();
98 :
99 : // The following method is called if a SvxShape object is to be created.
100 : // Derived classes can create a derivation or an SvxShape aggregating object.
101 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const
102 : throw (std::exception);
103 :
104 : UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
105 :
106 : // SfxListener
107 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
108 :
109 : // XInterface
110 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
111 :
112 : // XShapes
113 : 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;
114 : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
115 : throw (::com::sun::star::uno::RuntimeException,
116 : std::exception) SAL_OVERRIDE;
117 :
118 : // XElementAccess
119 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 :
122 : // XIndexAccess
123 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
124 : 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;
125 :
126 : // XShapeGrouper
127 : 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;
128 : 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;
129 :
130 : // XServiceInfo
131 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : // XComponent
136 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 : 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;
138 : 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;
139 : };
140 :
141 : #endif
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|