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 _VCLCANVAS_CANVASFONT_HXX 25 #define _VCLCANVAS_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/geometry/Matrix2D.hpp> 34 #include <com/sun/star/rendering/FontRequest.hpp> 35 #include <com/sun/star/rendering/XCanvasFont.hpp> 36 #include <com/sun/star/rendering/XGraphicDevice.hpp> 37 38 #include <vcl/font.hxx> 39 40 #include <canvas/vclwrapper.hxx> 41 42 #include "spritecanvas.hxx" 43 #include "impltools.hxx" 44 45 #include <boost/utility.hpp> 46 47 48 /* Definition of CanvasFont class */ 49 50 namespace vclcanvas 51 { 52 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCanvasFont, 53 ::com::sun::star::lang::XServiceInfo > CanvasFont_Base; 54 55 class CanvasFont : public ::comphelper::OBaseMutex, 56 public CanvasFont_Base, 57 private ::boost::noncopyable 58 { 59 public: 60 typedef ::comphelper::ImplementationReference< 61 CanvasFont, 62 ::com::sun::star::rendering::XCanvasFont > Reference; 63 64 CanvasFont( const ::com::sun::star::rendering::FontRequest& fontRequest, 65 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties, 66 const ::com::sun::star::geometry::Matrix2D& rFontMatrix, 67 ::com::sun::star::rendering::XGraphicDevice& rDevice, 68 const OutDevProviderSharedPtr& rOutDevProvider ); 69 70 /// Dispose all internal references 71 virtual void SAL_CALL disposing(); 72 73 // XCanvasFont 74 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); 75 virtual ::com::sun::star::rendering::FontRequest SAL_CALL getFontRequest( ) throw (::com::sun::star::uno::RuntimeException); 76 virtual ::com::sun::star::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (::com::sun::star::uno::RuntimeException); 77 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (::com::sun::star::uno::RuntimeException); 78 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (::com::sun::star::uno::RuntimeException); 79 80 // XServiceInfo 81 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 82 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); 83 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); 84 85 ::Font getVCLFont() const; 86 87 private: 88 ::canvas::vcltools::VCLObject<Font> maFont; 89 ::com::sun::star::rendering::FontRequest maFontRequest; 90 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice> mpRefDevice; 91 OutDevProviderSharedPtr mpOutDevProvider; 92 }; 93 94 } 95 96 #endif /* _VCLCANVAS_CANVASFONT_HXX */ 97