1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
29 #define _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
30 
31 #include <tools/debug.hxx>
32 #include <tools/string.hxx>
33 #include <tools/stack.hxx>
34 
35 #include <com/sun/star/uno/Reference.h>
36 #include <com/sun/star/uno/RuntimeException.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/lang/XComponent.hpp>
39 #include <com/sun/star/registry/XRegistryKey.hpp>
40 #include <com/sun/star/lang/XComponent.hpp>
41 #include <cppuhelper/implbase3.hxx>
42 #ifndef __com_sun_star_awt_Rectangle_hpp_
43 #include <com/sun/star/awt/Rectangle.hpp>
44 #endif
45 #include <com/sun/star/beans/PropertyValue.hpp>
46 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
47 #include <com/sun/star/lang/XInitialization.hpp>
48 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
50 
51 // -----------------------------------------------------------------------------
52 
53 #define NMSP_IO			com::sun::star::io
54 #define NMSP_UNO		com::sun::star::uno
55 #define NMSP_BEANS      com::sun::star::beans
56 #define NMSP_LANG		com::sun::star::lang
57 #define NMSP_UTIL		com::sun::star::util
58 #define NMSP_SAX		com::sun::star::xml::sax
59 #define NMSP_LOGGING	NMSP_UTIL::logging
60 
61 
62 #define REF( _def_Obj )         NMSP_UNO::Reference< _def_Obj >
63 #define SEQ( _def_Obj )         NMSP_UNO::Sequence< _def_Obj >
64 #define B2UCONST( _def_pChar )  (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
65 
66 // ---------------------------
67 // - EnhancedCustomShapeEngine -
68 // ---------------------------
69 //
70 
71 class SdrObject;
72 class SdrObjCustomShape;
73 class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3
74 <
75 	com::sun::star::lang::XInitialization,
76 	com::sun::star::lang::XServiceInfo,
77 	com::sun::star::drawing::XCustomShapeEngine
78 >
79 {
80 	REF( NMSP_LANG::XMultiServiceFactory )		mxFact;
81 	REF( com::sun::star::drawing::XShape )		mxShape;
82 	sal_Bool									mbForceGroupWithText;
83 
84 	SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape );
85 
86 public:
87 							EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
88 	virtual 				~EnhancedCustomShapeEngine();
89 
90 	// XInterface
91     virtual void SAL_CALL	acquire() throw();
92     virtual void SAL_CALL	release() throw();
93 
94 	// XInitialization
95     virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments )
96 		throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException );
97 
98 	// XServiceInfo
99     virtual rtl::OUString SAL_CALL getImplementationName()
100 		throw ( NMSP_UNO::RuntimeException );
101     virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName )
102 		throw ( NMSP_UNO::RuntimeException );
103     virtual SEQ( rtl::OUString ) SAL_CALL getSupportedServiceNames()
104 		throw ( NMSP_UNO::RuntimeException );
105 
106 	// XCustomShapeEngine
107 	virtual REF( com::sun::star::drawing::XShape ) SAL_CALL render()
108 		throw ( NMSP_UNO::RuntimeException );
109 	virtual com::sun::star::awt::Rectangle SAL_CALL getTextBounds()
110 		throw ( NMSP_UNO::RuntimeException );
111 	virtual com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry()
112 		throw ( NMSP_UNO::RuntimeException );
113 	virtual SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL getInteraction()
114 		throw ( NMSP_UNO::RuntimeException );
115 };
116 
117 rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
118 	throw ( NMSP_UNO::RuntimeException );
119 sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& rServiceName )
120 	throw( NMSP_UNO::RuntimeException );
121 SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
122 	throw( NMSP_UNO::RuntimeException );
123 
124 #endif
125