Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_UNOWPAGE_HXX
29 : : #define _SVX_UNOWPAGE_HXX
30 : :
31 : : #include <com/sun/star/lang/XComponent.hpp>
32 : : #include <cppuhelper/interfacecontainer.hxx>
33 : : #include <com/sun/star/lang/XTypeProvider.hpp>
34 : : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : : #include <com/sun/star/beans/XPropertySet.hpp>
36 : : #include <com/sun/star/drawing/XDrawPage.hpp>
37 : : #include <com/sun/star/drawing/XShapeGrouper.hpp>
38 : : #include <com/sun/star/drawing/XShapeCombiner.hpp>
39 : : #include <com/sun/star/drawing/XShapeBinder.hpp>
40 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
41 : : #include <cppuhelper/weak.hxx>
42 : : #include <cppuhelper/weakagg.hxx>
43 : : #include <svl/lstner.hxx>
44 : : #include <editeng/mutxhelp.hxx>
45 : : #include "svx/svxdllapi.h"
46 : :
47 : : #include <cppuhelper/implbase5.hxx>
48 : : #include <comphelper/servicehelper.hxx>
49 : :
50 : : #include <svx/unoprov.hxx>
51 : :
52 : : class SdrPage;
53 : : class SdrModel;
54 : : class SdrView;
55 : : class SdrPageView;
56 : : class SdrObject;
57 : : class SvxShape;
58 : : class SvxShapeGroup;
59 : : class SvxShapeConnector;
60 : :
61 : : /***********************************************************************
62 : : * Macros fuer Umrechnung Twips<->100tel mm *
63 : : ***********************************************************************/
64 : : #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
65 : : #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
66 : :
67 : : /***********************************************************************
68 : : * *
69 : : ***********************************************************************/
70 : : class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
71 : : ::com::sun::star::drawing::XShapeGrouper,
72 : : ::com::sun::star::lang::XServiceInfo,
73 : : ::com::sun::star::lang::XUnoTunnel,
74 : : ::com::sun::star::lang::XComponent>,
75 : : public SfxListener,
76 : : protected SvxMutexHelper
77 : : {
78 : : protected:
79 : : cppu::OBroadcastHelper mrBHelper;
80 : :
81 : : SdrPage* mpPage;
82 : : SdrModel* mpModel;
83 : : SdrView* mpView;
84 : :
85 : : void _SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
86 : : void _SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
87 : :
88 : : virtual void disposing() throw();
89 : :
90 : : public:
91 : : SvxDrawPage( SdrPage* pPage ) throw();
92 : : virtual ~SvxDrawPage() throw();
93 : :
94 : : // Internals
95 : 1542 : SdrPage* GetSdrPage() const { return mpPage; }
96 : : void ChangeModel( SdrModel* pNewModel );
97 : :
98 : : // Erzeugen eines SdrObjects und Einfugen in die SdrPage
99 : : SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
100 : :
101 : : // Typ und Inventor bestimmen
102 : : void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const ::rtl::OUString& aName ) const throw();
103 : :
104 : : // Erzeugen eines SdrObjects anhand einer Description. Kann von
105 : : // abgeleiteten Klassen dazu benutzt werden, eigene Shapes zu
106 : : // unterstuetzen (z.B. Controls)
107 : : virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
108 : :
109 : : static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL ) throw();
110 : :
111 : : // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
112 : : // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
113 : : // ein ein SvxShape aggregierenden Objekt anlegen.
114 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw();
115 : :
116 : : UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
117 : :
118 : : // SfxListener
119 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
120 : :
121 : : // XInterface
122 : : virtual void SAL_CALL release() throw();
123 : :
124 : : // XShapes
125 : : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
126 : : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
127 : :
128 : : // XElementAccess
129 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
130 : : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
131 : :
132 : : // XIndexAccess
133 : : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
134 : : 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);
135 : :
136 : : // XShapeGrouper
137 : : 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);
138 : : virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw(::com::sun::star::uno::RuntimeException);
139 : :
140 : : // XServiceInfo
141 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
142 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
143 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
144 : :
145 : : // XComponent
146 : : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
147 : : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
148 : : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
149 : : };
150 : :
151 : : #endif
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|