Fix OutputDevice members / stack allocation: filter.

Change-Id: Ib67fd510626809baab774382d37b20462253fc31
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index 780ac5d..c2bb584 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -156,7 +156,7 @@ private:
    sal_uInt32               nWrittenBitmaps;  // number of already written Bitmaps
    sal_uInt32               nActBitmapPercent; // percentage of the next bitmap that's already written

    ::std::unique_ptr< VirtualDevice >  apDummyVDev;
    ScopedVclPtr<VirtualDevice>  apDummyVDev;
    OutputDevice*                       pCompDev;

    com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
@@ -261,6 +261,7 @@ public:
        pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() );
        if( !pCompDev )
        {
            apDummyVDev.disposeAndClear();
            apDummyVDev.reset( new VirtualDevice );
            pCompDev = apDummyVDev.get();
        }
@@ -1850,12 +1851,12 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )

                if( aGDIFont.GetAlign() != ALIGN_BASELINE)
                {
                    VirtualDevice aVDev;
                    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );

                    if( aGDIFont.GetAlign()==ALIGN_TOP )
                        aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent();
                        aPt.Y()+=(long)pVDev->GetFontMetric( aGDIFont ).GetAscent();
                    else
                        aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent();
                        aPt.Y()-=(long)pVDev->GetFontMetric( aGDIFont ).GetDescent();
                }

                METSetMix(eGDIRasterOp);
@@ -1879,11 +1880,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )

                if( aGDIFont.GetAlign() != ALIGN_BASELINE )
                {
                    VirtualDevice aVDev;
                    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
                    if( aGDIFont.GetAlign() == ALIGN_TOP )
                        aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent();
                        aPt.Y()+=(long)pVDev->GetFontMetric(aGDIFont).GetAscent();
                    else
                        aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent();
                        aPt.Y()-=(long)pVDev->GetFontMetric(aGDIFont).GetDescent();
                }

                METSetMix(eGDIRasterOp);
@@ -1922,7 +1923,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
            case META_STRETCHTEXT_ACTION:
            {
                const MetaStretchTextAction*    pA = static_cast<const MetaStretchTextAction*>(pMA);
                VirtualDevice                   aVDev;
                ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
                sal_uInt16                          i;
                sal_Int32                       nNormSize;
                OUString                        aStr;
@@ -1931,14 +1932,14 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
                Point                           aPt( pA->GetPoint() );
                Point                           aPt2;

                aVDev.SetFont( aGDIFont );
                pVDev->SetFont( aGDIFont );

                if( aGDIFont.GetAlign() != ALIGN_BASELINE)
                {
                    if( aGDIFont.GetAlign() == ALIGN_TOP )
                        aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent();
                        aPt.Y()+=(long)pVDev->GetFontMetric().GetAscent();
                    else
                        aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent();
                        aPt.Y()-=(long)pVDev->GetFontMetric().GetDescent();
                }

                METSetMix(eGDIRasterOp);
@@ -1949,7 +1950,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
                METSetChrSet(FindChrSet(aGDIFont));
                aStr = pA->GetText().copy(pA->GetIndex(),pA->GetLen());
                boost::scoped_array<long> pDXAry(new long[aStr.getLength()]);
                nNormSize = aVDev.GetTextArray( aStr, pDXAry.get() );
                nNormSize = pVDev->GetTextArray( aStr, pDXAry.get() );

                for ( i = 0; i < aStr.getLength(); i++ )
                {
@@ -2067,24 +2068,24 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )

            case META_GRADIENT_ACTION:
            {
                VirtualDevice               aVDev;
                ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
                GDIMetaFile                 aTmpMtf;
                const MetaGradientAction*   pA = static_cast<const MetaGradientAction*>(pMA);

                aVDev.SetMapMode( aTargetMapMode );
                aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
                pVDev->SetMapMode( aTargetMapMode );
                pVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
                WriteOrders( &aTmpMtf );
            }
            break;

            case META_HATCH_ACTION:
            {
                VirtualDevice           aVDev;
                ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
                GDIMetaFile             aTmpMtf;
                const MetaHatchAction*  pA = static_cast<const MetaHatchAction*>(pMA);

                aVDev.SetMapMode( aTargetMapMode );
                aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
                pVDev->SetMapMode( aTargetMapMode );
                pVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
                WriteOrders( &aTmpMtf );
            }
            break;
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index e9a7568..33f5fdb 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1699,12 +1699,11 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )

                if ( aSrcFont.GetAlign() != ALIGN_BASELINE )
                {
                    VirtualDevice aVirDev;

                    ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );
                    if (aSrcFont.GetAlign()==ALIGN_TOP)
                        aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
                        aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
                    else
                        aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
                        aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
                }

                SetAttrForText();
@@ -1720,12 +1719,12 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )

                if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
                {
                    VirtualDevice aVirDev;
                    ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );

                    if (aSrcFont.GetAlign()==ALIGN_TOP)
                        aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
                        aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
                    else
                        aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
                        aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
                }
                SetAttrForText();
                OUString aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() );
@@ -1738,16 +1737,16 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
                const MetaStretchTextAction*    pA = static_cast<const MetaStretchTextAction*>(pMA);
                Point                           aPt( pA->GetPoint() );
                OUString                        aStr = pA->GetText().copy( pA->GetIndex(),pA->GetLen() );
                VirtualDevice                   aVirDev;
                ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );
                boost::scoped_array<long>       pDXAry(new long[ aStr.getLength() ]);
                sal_Int32                       nNormSize( aVirDev.GetTextArray( aStr,pDXAry.get() ) );
                sal_Int32                       nNormSize( pVirDev->GetTextArray( aStr,pDXAry.get() ) );

                if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
                {
                    if (aSrcFont.GetAlign()==ALIGN_TOP)
                        aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
                        aPt.Y()+=(long)pVirDev->GetFontMetric(aSrcFont).GetAscent();
                    else
                        aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
                        aPt.Y()-=(long)pVirDev->GetFontMetric(aSrcFont).GetDescent();
                }

                sal_Int32 nLength = aStr.getLength() - 1;
@@ -1774,9 +1773,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
            {
                const MetaBmpAction*    pA = static_cast<const MetaBmpAction*>(pMA);
                const Bitmap            aBmp( pA->GetBitmap() );
                VirtualDevice           aVirDev;
                ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );

                WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
                WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
            }
            break;

@@ -1801,9 +1800,9 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
            {
                const MetaBmpExAction*  pA = static_cast<const MetaBmpExAction*>(pMA);
                const Bitmap            aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
                VirtualDevice           aVirDev;
                ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );

                WriteOpcode_BitsRect( pA->GetPoint(), aVirDev.PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
                WriteOpcode_BitsRect( pA->GetPoint(), pVirDev->PixelToLogic( aBmp.GetSizePixel(), aSrcMapMode ), aBmp );
            }
            break;

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 4a5d8f2..c4f1b7b 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -116,7 +116,7 @@ private:
    SvStream*           mpPS;
    const GDIMetaFile*  pMTF;
    GDIMetaFile*        pAMTF;              // only created if Graphics is not a Metafile
    VirtualDevice       aVDev;
    ScopedVclPtr<VirtualDevice> pVDev;

    double              nBoundingX1;        // this represents the bounding box
    double              nBoundingY1;
@@ -418,9 +418,9 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
    {
        Bitmap aBmp( rGraphic.GetBitmap() );
        pAMTF = new GDIMetaFile();
        VirtualDevice aTmpVDev;
        ScopedVclPtr<VirtualDevice> pTmpVDev(new VirtualDevice());
        pAMTF->Record( &aTmpVDev );
        aTmpVDev.DrawBitmap( Point(), aBmp );
        pTmpVDev->DrawBitmap( Point(), aBmp );
        pAMTF->Stop();
        pAMTF->SetPrefSize( aBmp.GetSizePixel() );
        pMTF = pAMTF;
@@ -940,12 +940,12 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )

            case META_HATCH_ACTION :
            {
                VirtualDevice   l_aVDev;
                ScopedVclPtr<VirtualDevice> l_pVirDev( new VirtualDevice() );
                GDIMetaFile     aTmpMtf;

                l_aVDev.SetMapMode( rVDev.GetMapMode() );
                l_aVDev.AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(),
                                         static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf );
                l_pVirDev->SetMapMode( rVDev.GetMapMode() );
                l_pVirDev->AddHatchActions( static_cast<const MetaHatchAction*>(pMA)->GetPolyPolygon(),
                                            static_cast<const MetaHatchAction*>(pMA)->GetHatch(), aTmpMtf );
                ImplWriteActions( aTmpMtf, rVDev );
            }
            break;
@@ -1608,10 +1608,10 @@ void PSWriter::ImplIntersect( const tools::PolyPolygon& rPolyPoly )

void PSWriter::ImplWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev )
{
    VirtualDevice   l_aVDev;
    ScopedVclPtr<VirtualDevice> l_pVirDev( new VirtualDevice() );
    GDIMetaFile     aTmpMtf;
    l_aVDev.SetMapMode( rVDev.GetMapMode() );
    l_aVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
    l_pVDev->SetMapMode( rVDev.GetMapMode() );
    l_pVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
    ImplWriteActions( aTmpMtf, rVDev );
}

@@ -2141,10 +2141,10 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo
        vcl::Font    aNotRotatedFont( maFont );
        aNotRotatedFont.SetOrientation( 0 );

        VirtualDevice aVirDev( 1 );
        aVirDev.SetMapMode( rVDev.GetMapMode() );
        aVirDev.SetFont( aNotRotatedFont );
        aVirDev.SetTextAlign( eTextAlign );
        ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice() );
        pVirDev->SetMapMode( rVDev.GetMapMode() );
        pVirDev->SetFont( aNotRotatedFont );
        pVirDev->SetTextAlign( eTextAlign );

        sal_Int16 nRotation = maFont.GetOrientation();
        Polygon aPolyDummy( 1 );
@@ -2159,7 +2159,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo
        bool bOldLineColor = bLineColor;
        bLineColor = false;
        std::vector<tools::PolyPolygon> aPolyPolyVec;
        if ( aVirDev.GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) )
        if ( pVirDev->GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, -1, true, nWidth, pDXArry ) )
        {
            // always adjust text position to match baseline alignment
            ImplWriteLine( "pum" );
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index b933574..41b6994 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -125,7 +125,7 @@ static int ImplGetLen( sal_uInt8* pBuf, int nMax )

static void MakeAsMeta(Graphic &rGraphic)
{
    VirtualDevice   aVDev;
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    GDIMetaFile     aMtf;
    Bitmap          aBmp( rGraphic.GetBitmap() );
    Size            aSize = aBmp.GetPrefSize();
@@ -137,9 +137,9 @@ static void MakeAsMeta(Graphic &rGraphic)
        aSize = OutputDevice::LogicToLogic( aSize,
            aBmp.GetPrefMapMode(), MAP_100TH_MM );

    aVDev.EnableOutput( false );
    aMtf.Record( &aVDev );
    aVDev.DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
    pVDev->EnableOutput( false );
    aMtf.Record( pVDev );
    pVDev->DrawBitmap( Point(), aSize, rGraphic.GetBitmap() );
    aMtf.Stop();
    aMtf.WindStart();
    aMtf.SetPrefMapMode( MAP_100TH_MM );
@@ -442,22 +442,22 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
    long nWidth, long nHeight, Graphic &rGraphic)
{
    GDIMetaFile aMtf;
    VirtualDevice   aVDev;
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    vcl::Font       aFont;

    aVDev.EnableOutput( false );
    aMtf.Record( &aVDev );
    aVDev.SetLineColor( Color( COL_RED ) );
    aVDev.SetFillColor();
    pVDev->EnableOutput( false );
    aMtf.Record( pVDev );
    pVDev->SetLineColor( Color( COL_RED ) );
    pVDev->SetFillColor();

    aFont.SetColor( COL_LIGHTRED );
//  aFont.SetSize( Size( 0, 32 ) );

    aVDev.Push( PushFlags::FONT );
    aVDev.SetFont( aFont );
    pVDev->Push( PushFlags::FONT );
    pVDev->SetFont( aFont );

    Rectangle aRect( Point( 1, 1 ), Size( nWidth - 2, nHeight - 2 ) );
    aVDev.DrawRect( aRect );
    pVDev->DrawRect( aRect );

    OUString aString;
    int nLen;
@@ -511,8 +511,8 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
            aString += " LanguageLevel:" + OUString::number( nNumber );
        }
    }
    aVDev.DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE );
    aVDev.Pop();
    pVDev->DrawText( aRect, aString, TEXT_DRAW_CLIP | TEXT_DRAW_MULTILINE );
    pVDev->Pop();
    aMtf.Stop();
    aMtf.WindStart();
    aMtf.SetPrefMapMode( MAP_POINT );
@@ -679,17 +679,17 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
                            }
                            if ( bIsValid )
                            {
                                VirtualDevice   aVDev;
                                ScopedVclPtrInstance<VirtualDevice> pVDev;
                                GDIMetaFile     aMtf;
                                Size            aSize;
                                aVDev.EnableOutput( false );
                                aMtf.Record( &aVDev );
                                pVDev->EnableOutput( false );
                                aMtf.Record( pVDev );
                                aSize = aBitmap.GetPrefSize();
                                if( !aSize.Width() || !aSize.Height() )
                                    aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM );
                                else
                                    aSize = OutputDevice::LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM );
                                aVDev.DrawBitmap( Point(), aSize, aBitmap );
                                pVDev->DrawBitmap( Point(), aSize, aBitmap );
                                aMtf.Stop();
                                aMtf.WindStart();
                                aMtf.SetPrefMapMode( MAP_100TH_MM );
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 22bb0f0..4d51af0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1387,18 +1387,18 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
    // do not create a bitmap in page size, that would explode file sizes (and have no good quality).
    // Better use a MetaFile graphic in page size; thus we have good quality due to vector format and
    // no bit file sizes.
    VirtualDevice aOut;
    ScopedVclPtr<VirtualDevice> pVDev(new VirtualDevice());
    GDIMetaFile aMtf;

    aOut.SetOutputSizePixel(Size(2, 2));
    aOut.EnableOutput(false);
    aOut.SetMapMode(MapMode(MAP_100TH_MM));
    pVDev->SetOutputSizePixel(Size(2, 2));
    pVDev->EnableOutput(false);
    pVDev->SetMapMode(MapMode(MAP_100TH_MM));
    aMtf.Clear();
    aMtf.Record(&aOut);
    aOut.SetLineColor();
    aOut.SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
    aOut.DrawRect(rRect);
    aOut.DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
    aMtf.Record(pVDev);
    pVDev->SetLineColor();
    pVDev->SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
    pVDev->DrawRect(rRect);
    pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
    aMtf.Stop();
    aMtf.WindStart();
    aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c1be035..6ed9b4c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4397,8 +4397,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                                rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) );
                            rOutliner.SetUpdateMode( false );
                            rOutliner.SetText( *pParaObj );
                            VirtualDevice aVirDev( 1 );
                            aVirDev.SetMapMode( MAP_100TH_MM );
                            ScopedVclPtr<VirtualDevice> pVirDev( new VirtualDevice( 1 ) );
                            pVirDev->SetMapMode( MAP_100TH_MM );
                            sal_Int32 i, nParagraphs = rOutliner.GetParagraphCount();
                            if ( nParagraphs )
                            {
@@ -4406,7 +4406,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                                for ( i = 0; i < nParagraphs; i++ )
                                {
                                    OUString aString(rOutliner.GetText(rOutliner.GetParagraph(i)));
                                    bool bIsRTL = aVirDev.GetTextIsRTL(aString, 0, aString.getLength());
                                    bool bIsRTL = pVirDev->GetTextIsRTL(aString, 0, aString.getLength());
                                    if ( bIsRTL )
                                    {
                                        SfxItemSet aSet2( rOutliner.GetParaAttribs( i ) );
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index 2de4b73..bd97906 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -78,10 +78,10 @@ SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont 

void SVGFontExport::implCollectGlyphs()
{
    VirtualDevice                   aVDev;
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    ObjectVector::const_iterator    aIter( maObjects.begin() );

    aVDev.EnableOutput( false );
    pVDev->EnableOutput( false );

    while( aIter != maObjects.end() )
    {
@@ -89,7 +89,7 @@ void SVGFontExport::implCollectGlyphs()
        {
            const GDIMetaFile& rMtf = (*aIter).GetRepresentation();

            aVDev.Push();
            pVDev->Push();

            for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; ++i )
            {
@@ -128,13 +128,13 @@ void SVGFontExport::implCollectGlyphs()
                    break;

                    default:
                        pAction->Execute( &aVDev );
                        pAction->Execute( pVDev );
                    break;
                }

                if( !aText.isEmpty() )
                {
                    GlyphSet& rGlyphSet = implGetGlyphSet( aVDev.GetFont() );
                    GlyphSet& rGlyphSet = implGetGlyphSet( pVDev->GetFont() );
                    ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI(
                        ::vcl::unohelper::CreateBreakIterator() );

@@ -165,7 +165,7 @@ void SVGFontExport::implCollectGlyphs()
                }
            }

            aVDev.Pop();
            pVDev->Pop();
        }

        ++aIter;
@@ -189,14 +189,14 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
                SvXMLElementExport  aExp( mrExport, XML_NAMESPACE_NONE, "defs", true, true );
                OUString     aCurIdStr( aEmbeddedFontStr );
                OUString     aUnitsPerEM( OUString::number( nFontEM ) );
                VirtualDevice       aVDev;
                ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
                vcl::Font           aFont( rFont );

                aFont.SetSize( Size( 0, nFontEM ) );
                aFont.SetAlign( ALIGN_BASELINE );

                aVDev.SetMapMode( MAP_100TH_MM );
                aVDev.SetFont( aFont );
                pVDev->SetMapMode( MAP_100TH_MM );
                pVDev->SetFont( aFont );

                mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", aCurIdStr += OUString::number( ++mnCurFontId ) );
                mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", aUnitsPerEM );
@@ -223,8 +223,8 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "units-per-em", aUnitsPerEM );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-weight", aFontWeight );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "font-style", aFontStyle );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( aVDev.GetFontMetric().GetAscent() ) );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( aVDev.GetFontMetric().GetDescent() ) );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "ascent", OUString::number( pVDev->GetFontMetric().GetAscent() ) );
                    mrExport.AddAttribute( XML_NAMESPACE_NONE, "descent", OUString::number( pVDev->GetFontMetric().GetDescent() ) );

                    {
                        SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, "font-face", true, true );
@@ -245,7 +245,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )

                    while( aIter != rGlyphSet.end() )
                    {
                        implEmbedGlyph( aVDev, *aIter );
                        implEmbedGlyph( *pVDev.get(), *aIter );
                        ++aIter;
                    }
                }