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 _SVX_UNOWPAGE_HXX
20 : #define _SVX_UNOWPAGE_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 fuer Umrechnung 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 : /***********************************************************************
59 : * *
60 : ***********************************************************************/
61 : class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
62 : ::com::sun::star::drawing::XShapeGrouper,
63 : ::com::sun::star::lang::XServiceInfo,
64 : ::com::sun::star::lang::XUnoTunnel,
65 : ::com::sun::star::lang::XComponent>,
66 : public SfxListener,
67 : protected SvxMutexHelper
68 : {
69 : protected:
70 : cppu::OBroadcastHelper mrBHelper;
71 :
72 : SdrPage* mpPage;
73 : SdrModel* mpModel;
74 : SdrView* mpView;
75 :
76 : void _SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
77 : void _SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
78 :
79 : virtual void disposing() throw();
80 :
81 : public:
82 : SvxDrawPage( SdrPage* pPage ) throw();
83 : virtual ~SvxDrawPage() throw();
84 :
85 : // Internals
86 74 : SdrPage* GetSdrPage() const { return mpPage; }
87 : void ChangeModel( SdrModel* pNewModel );
88 :
89 : // Erzeugen eines SdrObjects und Einfugen in die SdrPage
90 : SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
91 :
92 : // Typ und Inventor bestimmen
93 : void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const ::rtl::OUString& aName ) const throw();
94 :
95 : // Erzeugen eines SdrObjects anhand einer Description. Kann von
96 : // abgeleiteten Klassen dazu benutzt werden, eigene Shapes zu
97 : // unterstuetzen (z.B. Controls)
98 : virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
99 :
100 : static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL ) throw();
101 :
102 : // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
103 : // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
104 : // ein ein SvxShape aggregierenden Objekt anlegen.
105 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw();
106 :
107 : UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
108 :
109 : // SfxListener
110 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
111 :
112 : // XInterface
113 : virtual void SAL_CALL release() throw();
114 :
115 : // XShapes
116 : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
117 : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
118 :
119 : // XElementAccess
120 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
121 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
122 :
123 : // XIndexAccess
124 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
125 : 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);
126 :
127 : // XShapeGrouper
128 : 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);
129 : virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw(::com::sun::star::uno::RuntimeException);
130 :
131 : // XServiceInfo
132 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
133 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
134 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
135 :
136 : // XComponent
137 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
138 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
139 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
140 : };
141 :
142 : #endif
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|