1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
25 #define _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
26 
27 #include <tools/debug.hxx>
28 #include <tools/string.hxx>
29 #include <tools/stack.hxx>
30 
31 #include <com/sun/star/uno/Reference.h>
32 #include <com/sun/star/uno/RuntimeException.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/registry/XRegistryKey.hpp>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <cppuhelper/implbase3.hxx>
38 #ifndef __com_sun_star_awt_Rectangle_hpp_
39 #include <com/sun/star/awt/Rectangle.hpp>
40 #endif
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
43 #include <com/sun/star/lang/XInitialization.hpp>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
46 
47 // -----------------------------------------------------------------------------
48 
49 #define NMSP_IO			com::sun::star::io
50 #define NMSP_UNO		com::sun::star::uno
51 #define NMSP_BEANS		com::sun::star::beans
52 #define NMSP_LANG		com::sun::star::lang
53 #define NMSP_UTIL		com::sun::star::util
54 #define NMSP_SAX		com::sun::star::xml::sax
55 #define NMSP_LOGGING	NMSP_UTIL::logging
56 
57 
58 #define REF( _def_Obj )			NMSP_UNO::Reference< _def_Obj >
59 #define SEQ( _def_Obj )			NMSP_UNO::Sequence< _def_Obj >
60 #define B2UCONST( _def_pChar )	(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
61 
62 // ---------------------------
63 // - EnhancedCustomShapeEngine -
64 // ---------------------------
65 //
66 
67 class SdrObject;
68 class SdrObjCustomShape;
69 class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3
70 <
71 	com::sun::star::lang::XInitialization,
72 	com::sun::star::lang::XServiceInfo,
73 	com::sun::star::drawing::XCustomShapeEngine
74 >
75 {
76 	REF( NMSP_LANG::XMultiServiceFactory )		mxFact;
77 	REF( com::sun::star::drawing::XShape )		mxShape;
78 	sal_Bool									mbForceGroupWithText;
79 
80 	SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape );
81 
82 public:
83 							EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
84 	virtual 				~EnhancedCustomShapeEngine();
85 
86 	// XInterface
87 	virtual void SAL_CALL	acquire() throw();
88 	virtual void SAL_CALL	release() throw();
89 
90 	// XInitialization
91 	virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments )
92 		throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException );
93 
94 	// XServiceInfo
95 	virtual rtl::OUString SAL_CALL getImplementationName()
96 		throw ( NMSP_UNO::RuntimeException );
97 	virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName )
98 		throw ( NMSP_UNO::RuntimeException );
99 	virtual SEQ( rtl::OUString ) SAL_CALL getSupportedServiceNames()
100 		throw ( NMSP_UNO::RuntimeException );
101 
102 	// XCustomShapeEngine
103 	virtual REF( com::sun::star::drawing::XShape ) SAL_CALL render()
104 		throw ( NMSP_UNO::RuntimeException );
105 	virtual com::sun::star::awt::Rectangle SAL_CALL getTextBounds()
106 		throw ( NMSP_UNO::RuntimeException );
107 	virtual com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry()
108 		throw ( NMSP_UNO::RuntimeException );
109 	virtual SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL getInteraction()
110 		throw ( NMSP_UNO::RuntimeException );
111 };
112 
113 rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
114 	throw ( NMSP_UNO::RuntimeException );
115 sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& rServiceName )
116 	throw( NMSP_UNO::RuntimeException );
117 SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
118 	throw( NMSP_UNO::RuntimeException );
119 
120 #endif
121