diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-20 00:21:17 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-20 16:11:57 -0500 |
commit | 7154b092a716d4d0041a8a563294511ec9e5dbc6 (patch) | |
tree | 2e2cbbd319a3ee008b536f584bf7a160f0f8ee01 /vcl/inc | |
parent | 5971a040f974dcdd0b0d8491d720fa7ad74439b4 (diff) |
cosmetic: split PhysicalFontFace class it its own source/header
oudev,2,3,4,5,6 are a dumping ground for a lot of things
chipping at it one class at the time...
organize the #include of the impacted source while at it.
Change-Id: I57bbb1f9e3c6b2ac6b3ca127e5976bf16f3e3cf8
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/PhysicalFontFace.hxx | 87 | ||||
-rw-r--r-- | vcl/inc/generic/genpspgraphics.h | 107 | ||||
-rw-r--r-- | vcl/inc/graphite_layout.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/graphite_serverfont.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/outdev.h | 4 | ||||
-rw-r--r-- | vcl/inc/outfont.hxx | 46 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 11 |
9 files changed, 163 insertions, 101 deletions
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx new file mode 100644 index 000000000000..f457bcd5c7f4 --- /dev/null +++ b/vcl/inc/PhysicalFontFace.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/dllapi.h> + +#include "outfont.hxx" + +class ImplFontEntry; +struct FontMatchStatus; +class FontSelectPattern; +class PhysicalFontFamily; + + +struct FontMatchStatus +{ +public: + int mnFaceMatch; + int mnHeightMatch; + int mnWidthMatch; + const OUString* mpTargetStyleName; +}; + +// - PhysicalFontFace - + +// TODO: no more direct access to members +// TODO: add reference counting +// TODO: get rid of height/width for scalable fonts +// TODO: make cloning cheaper + +// abstract base class for physical font faces +class VCL_PLUGIN_PUBLIC PhysicalFontFace : public ImplDevFontAttributes +{ +public: + // by using an PhysicalFontFace object as a factory for its corresponding + // ImplFontEntry an ImplFontEntry can be extended to cache device and + // font instance specific data + virtual ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const = 0; + + virtual int GetHeight() const { return mnHeight; } + virtual int GetWidth() const { return mnWidth; } + virtual sal_IntPtr GetFontId() const = 0; + int GetFontMagic() const { return mnMagic; } + bool IsScalable() const { return (mnHeight == 0); } + bool CheckMagic( int n ) const { return (n == mnMagic); } + PhysicalFontFace* GetNextFace() const { return mpNext; } + PhysicalFontFace* CreateAlias() const { return Clone(); } + + bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const; + sal_Int32 CompareWithSize( const PhysicalFontFace& ) const; + sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const; + virtual ~PhysicalFontFace() {} + virtual PhysicalFontFace* Clone() const = 0; + +protected: + explicit PhysicalFontFace( const ImplDevFontAttributes&, int nMagic ); + void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } + + long mnWidth; // Width (in pixels) + long mnHeight; // Height (in pixels) + +private: +friend class PhysicalFontFamily; + const int mnMagic; // poor man's RTTI + PhysicalFontFace* mpNext; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index 132b1414c9e8..ea7d381545fc 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -21,12 +21,14 @@ #define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H -#include "fontmanager.hxx" +#include <vcl/vclenum.hxx> -#include "vclpluginapi.h" +#include "fontmanager.hxx" #include "salgdi.hxx" -#include "vcl/vclenum.hxx" -#include <sallayout.hxx> +#include "sallayout.hxx" +#include "vclpluginapi.h" + +class PhysicalFontFace; namespace psp { struct JobData; class PrinterGfx; } @@ -37,18 +39,18 @@ class SalInfoPrinter; class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics { protected: - psp::JobData* m_pJobData; - psp::PrinterGfx* m_pPrinterGfx; + psp::JobData* m_pJobData; + psp::PrinterGfx* m_pPrinterGfx; - ServerFont* m_pServerFont[ MAX_FALLBACK ]; - bool m_bFontVertical; - SalInfoPrinter* m_pInfoPrinter; + ServerFont* m_pServerFont[ MAX_FALLBACK ]; + bool m_bFontVertical; + SalInfoPrinter* m_pInfoPrinter; public: - GenPspGraphics(); - virtual ~GenPspGraphics(); + GenPspGraphics(); + virtual ~GenPspGraphics(); - void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx, - SalInfoPrinter* pInfoPrinter ); + void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx, + SalInfoPrinter* pInfoPrinter ); // helper methods static const void * DoGetEmbedFontData ( psp::fontID aFont, const sal_Ucs* pUnicodes, @@ -57,18 +59,20 @@ public: static void DoFreeEmbedFontData( const void* pData, long nLen ); // helper methods for sharing with X11SalGraphics - static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont, const Ucs2OStrMap** pNonEncoded ); - static void DoGetGlyphWidths( psp::fontID aFont, - bool bVertical, - Int32Vector& rWidths, - Ucs2UIntMap& rUnicodeEnc ); + static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont, + const Ucs2OStrMap** pNonEncoded ); + static void DoGetGlyphWidths( psp::fontID aFont, + bool bVertical, + Int32Vector& rWidths, + Ucs2UIntMap& rUnicodeEnc ); static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& ); - static void AnnounceFonts( PhysicalFontCollection*, const psp::FastPrintFontInfo& ); + static void AnnounceFonts( PhysicalFontCollection*, + const psp::FastPrintFontInfo& ); // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual sal_uInt16 GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); @@ -83,14 +87,16 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ); virtual void SetTextColor( SalColor nSalColor ); - virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ); + virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); virtual const ImplFontCharMap* GetImplFontCharMap() const; - virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; + virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( PhysicalFontCollection* ); // graphics must drop any cached font info - virtual void ClearDevFontCache(); - virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ); + virtual void ClearDevFontCache(); + virtual bool AddTempDevFont( PhysicalFontCollection*, + const OUString& rFileURL, + const OUString& rFontName ); virtual bool CreateFontSubset( const OUString& rToFile, const PhysicalFontFace*, @@ -98,9 +104,9 @@ public: sal_uInt8* pEncoding, sal_Int32* pWidths, int nGlyphs, - FontSubsetInfo& rInfo - ); - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ); + FontSubsetInfo& rInfo ); + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, + const Ucs2OStrMap** ppNonEncoded ); virtual const void* GetEmbedFontData( const PhysicalFontFace*, const sal_Ucs* pUnicodes, sal_Int32* pWidths, @@ -112,7 +118,7 @@ public: Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ); - virtual bool GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& ); + virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -125,20 +131,20 @@ public: virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); - virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( - const basegfx::B2DPolygon&, - double fTransparency, - const basegfx::B2DVector& rLineWidths, - basegfx::B2DLineJoin, - com::sun::star::drawing::LineCap); - virtual bool drawPolyLineBezier( sal_uInt32 nPoints, + virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&, + double fTransparency ); + virtual bool drawPolyLine( const basegfx::B2DPolygon&, + double fTransparency, + const basegfx::B2DVector& rLineWidths, + basegfx::B2DLineJoin, + css::drawing::LineCap); + virtual bool drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); - virtual bool drawPolygonBezier( sal_uInt32 nPoints, + virtual bool drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); - virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, + virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry ); @@ -164,23 +170,26 @@ public: SalColor nMaskColor ); virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); virtual SalColor getPixel( long nX, long nY ); - virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); - virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + virtual void invert( long nX, long nY, long nWidth, long nHeight, + SalInvert nFlags ); + virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, + SalInvert nFlags ); - virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize ); + virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, + void* pPtr, sal_uIntPtr nSize ); virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ); - virtual bool drawTransformedBitmap( - const basegfx::B2DPoint& rNull, - const basegfx::B2DPoint& rX, - const basegfx::B2DPoint& rY, - const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap); - virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); + virtual bool drawTransformedBitmap( const basegfx::B2DPoint& rNull, + const basegfx::B2DPoint& rX, + const basegfx::B2DPoint& rY, + const SalBitmap& rSourceBitmap, + const SalBitmap* pAlphaBitmap); + virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, + sal_uInt8 nTransparency ); virtual SystemGraphicsData GetGraphicsData() const; - virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; + virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; }; #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx index 2d037c498dec..fc6dca1c5d57 100644 --- a/vcl/inc/graphite_layout.hxx +++ b/vcl/inc/graphite_layout.hxx @@ -35,13 +35,16 @@ #include <graphite2/Font.h> #include <graphite2/Segment.h> // Platform -#include <sallayout.hxx> #include <vcl/dllapi.h> + +#include "sallayout.hxx" + // Module // Module type definitions and forward declarations. // SAL/VCL types class ServerFont; +class PhysicalFontFace; // Graphite types namespace grutils { class GrFeatureParser; } diff --git a/vcl/inc/graphite_serverfont.hxx b/vcl/inc/graphite_serverfont.hxx index 3a783bd75474..9f22e4fcdf04 100644 --- a/vcl/inc/graphite_serverfont.hxx +++ b/vcl/inc/graphite_serverfont.hxx @@ -26,6 +26,8 @@ #ifndef _MSC_VER #include <graphite_layout.hxx> +class PhysicalFontFace; + // Modules class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 383bb71a7ca5..9baba35dc988 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -21,10 +21,12 @@ #define INCLUDED_VCL_INC_OUTDEV_H #include <list> -#include <outfont.hxx> #include <set> #include <vector> +#include "outfont.hxx" +#include "PhysicalFontFace.hxx" + class Size; class Font; class VirtualDevice; diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx index 2afa7a2275b7..12adb7cc7837 100644 --- a/vcl/inc/outfont.hxx +++ b/vcl/inc/outfont.hxx @@ -30,6 +30,7 @@ #include <boost/unordered_map.hpp> +class PhysicalFontFace; class PhysicalFontFamily; class ImplGetDevFontList; class ImplGetDevSizeList; @@ -110,51 +111,6 @@ public: // TODO: hide members behind accessor methods bool mbEmbeddable; // true: the font can be embedded }; - -// - PhysicalFontFace - - -// TODO: no more direct access to members -// TODO: add reference counting -// TODO: get rid of height/width for scalable fonts -// TODO: make cloning cheaper - -// abstract base class for physical font faces -class VCL_PLUGIN_PUBLIC PhysicalFontFace : public ImplDevFontAttributes -{ -public: - // by using an PhysicalFontFace object as a factory for its corresponding - // ImplFontEntry an ImplFontEntry can be extended to cache device and - // font instance specific data - virtual ImplFontEntry* CreateFontInstance( FontSelectPattern& ) const = 0; - - virtual int GetHeight() const { return mnHeight; } - virtual int GetWidth() const { return mnWidth; } - virtual sal_IntPtr GetFontId() const = 0; - int GetFontMagic() const { return mnMagic; } - bool IsScalable() const { return (mnHeight == 0); } - bool CheckMagic( int n ) const { return (n == mnMagic); } - PhysicalFontFace* GetNextFace() const { return mpNext; } - PhysicalFontFace* CreateAlias() const { return Clone(); } - - bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const; - sal_Int32 CompareWithSize( const PhysicalFontFace& ) const; - sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const; - virtual ~PhysicalFontFace() {} - virtual PhysicalFontFace* Clone() const = 0; - -protected: - explicit PhysicalFontFace( const ImplDevFontAttributes&, int nMagic ); - void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } - - long mnWidth; // Width (in pixels) - long mnHeight; // Height (in pixels) - -private: -friend class PhysicalFontFamily; - const int mnMagic; // poor man's RTTI - PhysicalFontFace* mpNext; -}; - class FontSelectPatternAttributes : public ImplFontAttributes { public: diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 5fb10ce6bf1e..cf611fe1fb9f 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -47,6 +47,7 @@ extern "C" { #include <vcl/fontcapabilities.hxx> #include "outfont.hxx" +#include "PhysicalFontFace.hxx" #include "salgdi.hxx" #include "quartz/salgdicommon.hxx" diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 561fdd756204..da91204b6b2a 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -46,6 +46,7 @@ class PspSalInfoPrinter; class ServerFont; class ImplLayoutArgs; class ServerFontLayout; +class PhysicalFontFace; namespace basegfx { class B2DTrapezoid; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index bc76b3242d2d..c649cc3cc9ab 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_VCL_INC_WIN_SALGDI_H #define INCLUDED_VCL_INC_WIN_SALGDI_H -#include <sallayout.hxx> -#include <salgdi.hxx> -#include <outfont.hxx> -#include <impfont.hxx> +#include "sallayout.hxx" +#include "salgdi.hxx" +#include "outfont.hxx" +#include "PhysicalFontFace.hxx" +#include "impfont.hxx" #include <vcl/fontcapabilities.hxx> -#include "boost/scoped_ptr.hpp" +#include <boost/scoped_ptr.hpp> #include <boost/unordered_set.hpp> #include <config_graphite.h> |