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 _NULLCANVAS_CANVASFONT_HXX 25 #define _NULLCANVAS_CANVASFONT_HXX 26 27 #include <comphelper/implementationreference.hxx> 28 29 #include <cppuhelper/compbase2.hxx> 30 #include <comphelper/broadcasthelper.hxx> 31 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <com/sun/star/rendering/XCanvas.hpp> 34 #include <com/sun/star/rendering/XCanvasFont.hpp> 35 36 #include <rtl/ref.hxx> 37 38 #include <boost/shared_ptr.hpp> 39 #include <boost/utility.hpp> 40 41 #include "null_usagecounter.hxx" 42 43 44 /* Definition of CanvasFont class */ 45 46 namespace nullcanvas 47 { 48 class SpriteCanvas; 49 50 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCanvasFont, 51 ::com::sun::star::lang::XServiceInfo > CanvasFont_Base; 52 53 class CanvasFont : public ::comphelper::OBaseMutex, 54 public CanvasFont_Base, 55 private UsageCounter< CanvasFont >, 56 private ::boost::noncopyable 57 { 58 public: 59 typedef ::comphelper::ImplementationReference< 60 CanvasFont, 61 ::com::sun::star::rendering::XCanvasFont > ImplRef; 62 63 CanvasFont( const ::com::sun::star::rendering::FontRequest& fontRequest, 64 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties, 65 const ::com::sun::star::geometry::Matrix2D& fontMatrix ); 66 67 /// Dispose all internal references 68 virtual void SAL_CALL disposing(); 69 70 // XCanvasFont 71 virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > SAL_CALL createTextLayout( const ::com::sun::star::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (::com::sun::star::uno::RuntimeException); 72 virtual ::com::sun::star::rendering::FontRequest SAL_CALL getFontRequest( ) throw (::com::sun::star::uno::RuntimeException); 73 virtual ::com::sun::star::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (::com::sun::star::uno::RuntimeException); 74 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (::com::sun::star::uno::RuntimeException); 75 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (::com::sun::star::uno::RuntimeException); 76 77 // XServiceInfo 78 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 79 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); 80 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 81 82 const ::com::sun::star::geometry::Matrix2D& getFontMatrix() const; 83 84 private: 85 ::com::sun::star::rendering::FontRequest maFontRequest; 86 ::com::sun::star::geometry::Matrix2D maFontMatrix; 87 }; 88 89 } 90 91 #endif /* _NULLCANVAS_CANVASFONT_HXX */ 92