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