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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_canvas.hxx"
30 
31 #include "null_canvasfont.hxx"
32 #include "null_textlayout.hxx"
33 #include "null_spritecanvas.hxx"
34 
35 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
36 #include <com/sun/star/rendering/PanoseWeight.hpp>
37 
38 using namespace ::com::sun::star;
39 
40 namespace nullcanvas
41 {
42     CanvasFont::CanvasFont( const rendering::FontRequest& 					rFontRequest,
43                             const uno::Sequence< beans::PropertyValue >& 	/*extraFontProperties*/,
44                             const geometry::Matrix2D& 						fontMatrix ) :
45         CanvasFont_Base( m_aMutex ),
46         maFontRequest( rFontRequest ),
47 		maFontMatrix( fontMatrix )
48     {
49     }
50 
51     void SAL_CALL CanvasFont::disposing()
52     {
53         ::osl::MutexGuard aGuard( m_aMutex );
54     }
55 
56     uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout( const rendering::StringContext& aText,
57                                                                                     sal_Int8 						nDirection,
58                                                                                     sal_Int64 						nRandomSeed ) throw (uno::RuntimeException)
59     {
60         ::osl::MutexGuard aGuard( m_aMutex );
61 
62         return new TextLayout( aText, nDirection, nRandomSeed, ImplRef( this ) );
63     }
64 
65     uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes(  ) throw (uno::RuntimeException)
66     {
67         ::osl::MutexGuard aGuard( m_aMutex );
68 
69         // TODO
70         return uno::Sequence< double >();
71     }
72 
73     uno::Sequence< beans::PropertyValue > SAL_CALL CanvasFont::getExtraFontProperties(  ) throw (uno::RuntimeException)
74     {
75         ::osl::MutexGuard aGuard( m_aMutex );
76 
77         // TODO
78         return uno::Sequence< beans::PropertyValue >();
79     }
80 
81     rendering::FontRequest SAL_CALL CanvasFont::getFontRequest(  ) throw (uno::RuntimeException)
82     {
83         ::osl::MutexGuard aGuard( m_aMutex );
84 
85         return maFontRequest;
86     }
87 
88     rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics(  ) throw (uno::RuntimeException)
89     {
90         ::osl::MutexGuard aGuard( m_aMutex );
91 
92         // TODO
93         return rendering::FontMetrics();
94     }
95 
96 #define SERVICE_NAME "com.sun.star.rendering.CanvasFont"
97 #define IMPLEMENTATION_NAME "NullCanvas::CanvasFont"
98 
99     ::rtl::OUString SAL_CALL CanvasFont::getImplementationName() throw( uno::RuntimeException )
100     {
101         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
102     }
103 
104     sal_Bool SAL_CALL CanvasFont::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
105     {
106         return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
107     }
108 
109     uno::Sequence< ::rtl::OUString > SAL_CALL CanvasFont::getSupportedServiceNames()  throw( uno::RuntimeException )
110     {
111         uno::Sequence< ::rtl::OUString > aRet(1);
112         aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
113 
114         return aRet;
115     }
116 
117 	const ::com::sun::star::geometry::Matrix2D& CanvasFont::getFontMatrix() const
118 	{
119 		return maFontMatrix;
120 	}
121 }
122