merge CGMOutAct with CGMImpressOutAct

Change-Id: I4d3d59b6c34edef9cd5bfd460f6379e4d1afa460
Reviewed-on: https://gerrit.libreoffice.org/26930
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin
2016-07-05 09:02:53 +02:00
committed by Noel Grandin
parent 6916368748
commit add9a35ba6
7 changed files with 184 additions and 242 deletions

View File

@@ -19,7 +19,6 @@ merge AddressWalker with AddressWalkerWriter
merge B3dTransformationSet with B3dViewport
merge B3dViewport with B3dCamera
merge BibTabPage with BibGeneralPage
merge CGMOutAct with CGMImpressOutAct
merge CSS1Parser with SvxCSS1Parser
merge CffGlobal with CffSubsetterContext
merge DbGridControl with FmGridControl

View File

@@ -49,7 +49,6 @@ $(eval $(call gb_Library_add_exception_objects,icg,\
filter/source/graphicfilter/icgm/class7 \
filter/source/graphicfilter/icgm/classx \
filter/source/graphicfilter/icgm/elements \
filter/source/graphicfilter/icgm/outact \
))
# vim: set noet sw=4 ts=4:

View File

@@ -44,17 +44,28 @@
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/gradient.hxx>
#include "main.hxx"
#include "outact.hxx"
#include <outact.hxx>
using namespace ::com::sun::star;
CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XModel > & rModel ) :
CGMOutAct ( rCGM ),
nFinalTextCount ( 0 )
{
mpCGM = &rCGM;
mnCurrentPage = 0;
mnGroupActCount = mnGroupLevel = 0;
mpGroupLevel = new sal_uInt32[CGM_OUTACT_MAX_GROUP_LEVEL] ();
mpPoints = reinterpret_cast<Point*>(new sal_Int8[ 0x2000 * sizeof( Point ) ]);
mpFlags = new sal_uInt8[ 0x2000 ];
mnIndex = 0;
mpGradient = nullptr;
if ( mpCGM->mbStatus )
{
bool bStatRet = false;
@@ -78,6 +89,14 @@ CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XMod
}
}
CGMImpressOutAct::~CGMImpressOutAct()
{
delete[] reinterpret_cast<sal_Int8*>(mpPoints);
delete[] mpFlags;
delete[] mpGroupLevel;
delete mpGradient;
}
bool CGMImpressOutAct::ImplInitPage()
{
bool bStatRet = false;
@@ -874,8 +893,123 @@ void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFla
}
void CGMImpressOutAct::DrawChart()
void CGMImpressOutAct::BeginFigure()
{
if ( mnIndex )
EndFigure();
BeginGroup();
mnIndex = 0;
}
void CGMImpressOutAct::CloseRegion()
{
if ( mnIndex > 2 )
{
NewRegion();
DrawPolyPolygon( maPolyPolygon );
maPolyPolygon.Clear();
}
}
void CGMImpressOutAct::NewRegion()
{
if ( mnIndex > 2 )
{
tools::Polygon aPolygon( mnIndex, mpPoints, mpFlags );
maPolyPolygon.Insert( aPolygon );
}
mnIndex = 0;
}
void CGMImpressOutAct::EndFigure()
{
NewRegion();
DrawPolyPolygon( maPolyPolygon );
maPolyPolygon.Clear();
EndGroup();
mnIndex = 0;
}
void CGMImpressOutAct::RegPolyLine( tools::Polygon& rPolygon, bool bReverse )
{
sal_uInt16 nPoints = rPolygon.GetSize();
if ( nPoints )
{
if ( bReverse )
{
for ( sal_uInt16 i = 0; i < nPoints; i++ )
{
mpPoints[ mnIndex + i ] = rPolygon.GetPoint( nPoints - i - 1 );
mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( nPoints - i - 1 );
}
}
else
{
for ( sal_uInt16 i = 0; i < nPoints; i++ )
{
mpPoints[ mnIndex + i ] = rPolygon.GetPoint( i );
mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( i );
}
}
mnIndex = mnIndex + nPoints;
}
}
void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 /*nType*/ )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->XOffset = ( (sal_uInt16)nHorzOfs & 0x7f );
mpGradient->YOffset = ( (sal_uInt16)nVertOfs & 0x7f );
}
void CGMImpressOutAct::SetGradientAngle( long nAngle )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->Angle = sal::static_int_cast< sal_Int16 >(nAngle);
}
void CGMImpressOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->StartColor = nColorFrom;
mpGradient->EndColor = nColorTo;
}
void CGMImpressOutAct::SetGradientStyle( sal_uInt32 nStyle, double /*fRatio*/ )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
switch ( nStyle )
{
case 0xff :
{
mpGradient->Style = awt::GradientStyle_AXIAL;
}
break;
case 4 :
{
mpGradient->Style = awt::GradientStyle_RADIAL; // CONICAL
}
break;
case 3 :
{
mpGradient->Style = awt::GradientStyle_RECT;
}
break;
case 2 :
{
mpGradient->Style = awt::GradientStyle_ELLIPTICAL;
}
break;
default :
{
mpGradient->Style = awt::GradientStyle_LINEAR;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -34,7 +34,7 @@ class Graphic;
class SvStream;
class CGMChart;
class CGMBitmap;
class CGMOutAct;
class CGMImpressOutAct;
class CGMElements;
class GDIMetaFile;
class VirtualDevice;
@@ -44,7 +44,6 @@ class CGM
friend class CGMChart;
friend class CGMBitmap;
friend class CGMElements;
friend class CGMOutAct;
friend class CGMImpressOutAct;
double mnOutdx; // Ausgabe Groesse in 1/100TH mm
@@ -75,7 +74,7 @@ class CGM
// controls page inserting
CGMElements* pElement;
CGMElements* pCopyOfE;
CGMOutAct* mpOutAct;
CGMImpressOutAct* mpOutAct;
::std::vector< sal_uInt8 * > maDefRepList;
::std::vector< sal_uInt32 > maDefRepSizeList;

View File

@@ -55,7 +55,7 @@ void CGM::ImplDoClass7()
case 0x1FC : /*AppData - BOCHTDATA */break;
case 0x1FD : /*AppData - EOCHTDATA*/
{
mpOutAct->DrawChart();
// mpOutAct->DrawChart();
}
break;
case 0x200 : /*AppData - BOSYMGROUP */break;

View File

@@ -1,166 +0,0 @@
/* -*- 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 .
*/
#include <outact.hxx>
#include <vcl/gradient.hxx>
using namespace ::com::sun::star;
CGMOutAct::CGMOutAct( CGM& rCGM )
{
mpCGM = &rCGM;
mnCurrentPage = 0;
mnGroupActCount = mnGroupLevel = 0;
mpGroupLevel = new sal_uInt32[CGM_OUTACT_MAX_GROUP_LEVEL] ();
mpPoints = reinterpret_cast<Point*>(new sal_Int8[ 0x2000 * sizeof( Point ) ]);
mpFlags = new sal_uInt8[ 0x2000 ];
mnIndex = 0;
mpGradient = nullptr;
}
CGMOutAct::~CGMOutAct()
{
delete[] reinterpret_cast<sal_Int8*>(mpPoints);
delete[] mpFlags;
delete[] mpGroupLevel;
delete mpGradient;
}
void CGMOutAct::BeginFigure()
{
if ( mnIndex )
EndFigure();
BeginGroup();
mnIndex = 0;
}
void CGMOutAct::CloseRegion()
{
if ( mnIndex > 2 )
{
NewRegion();
DrawPolyPolygon( maPolyPolygon );
maPolyPolygon.Clear();
}
}
void CGMOutAct::NewRegion()
{
if ( mnIndex > 2 )
{
tools::Polygon aPolygon( mnIndex, mpPoints, mpFlags );
maPolyPolygon.Insert( aPolygon );
}
mnIndex = 0;
}
void CGMOutAct::EndFigure()
{
NewRegion();
DrawPolyPolygon( maPolyPolygon );
maPolyPolygon.Clear();
EndGroup();
mnIndex = 0;
}
void CGMOutAct::RegPolyLine( tools::Polygon& rPolygon, bool bReverse )
{
sal_uInt16 nPoints = rPolygon.GetSize();
if ( nPoints )
{
if ( bReverse )
{
for ( sal_uInt16 i = 0; i < nPoints; i++ )
{
mpPoints[ mnIndex + i ] = rPolygon.GetPoint( nPoints - i - 1 );
mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( nPoints - i - 1 );
}
}
else
{
for ( sal_uInt16 i = 0; i < nPoints; i++ )
{
mpPoints[ mnIndex + i ] = rPolygon.GetPoint( i );
mpFlags[ mnIndex + i ] = (sal_Int8)rPolygon.GetFlags( i );
}
}
mnIndex = mnIndex + nPoints;
}
}
void CGMOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 /*nType*/ )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->XOffset = ( (sal_uInt16)nHorzOfs & 0x7f );
mpGradient->YOffset = ( (sal_uInt16)nVertOfs & 0x7f );
}
void CGMOutAct::SetGradientAngle( long nAngle )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->Angle = sal::static_int_cast< sal_Int16 >(nAngle);
}
void CGMOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
mpGradient->StartColor = nColorFrom;
mpGradient->EndColor = nColorTo;
}
void CGMOutAct::SetGradientStyle( sal_uInt32 nStyle, double /*fRatio*/ )
{
if ( !mpGradient )
mpGradient = new awt::Gradient;
switch ( nStyle )
{
case 0xff :
{
mpGradient->Style = awt::GradientStyle_AXIAL;
}
break;
case 4 :
{
mpGradient->Style = awt::GradientStyle_RADIAL; // CONICAL
}
break;
case 3 :
{
mpGradient->Style = awt::GradientStyle_RECT;
}
break;
case 2 :
{
mpGradient->Style = awt::GradientStyle_ELLIPTICAL;
}
break;
default :
{
mpGradient->Style = awt::GradientStyle_LINEAR;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -36,56 +36,23 @@
class CGM;
class CGMBitmapDescriptor;
class CGMOutAct
class CGMImpressOutAct
{
protected:
sal_uInt16 mnCurrentPage; // defaulted to zero
sal_uInt16 mnCurrentPage; // defaulted to zero
sal_uInt32 mnGroupActCount; // grouping
sal_uInt32 mnGroupLevel;
sal_uInt32* mpGroupLevel;
sal_uInt32 mnGroupActCount; // grouping
sal_uInt32 mnGroupLevel;
sal_uInt32* mpGroupLevel;
sal_uInt16 mnIndex; // figure
sal_uInt8* mpFlags;
Point* mpPoints;
tools::PolyPolygon maPolyPolygon;
css::awt::Gradient* mpGradient;
sal_uInt16 mnIndex; // figure
sal_uInt8* mpFlags;
Point* mpPoints;
tools::PolyPolygon maPolyPolygon;
css::awt::Gradient* mpGradient;
CGM* mpCGM;
CGM* mpCGM;
public:
explicit CGMOutAct( CGM& rCGM );
virtual ~CGMOutAct();
void FirstOutPut() { mpCGM->mbFirstOutPut = false; } ;
virtual void InsertPage() { mnCurrentPage++; } ;
virtual void BeginGroup() {} ;
virtual void EndGroup() {};
virtual void EndGrouping() {} ;
void BeginFigure() ;
void CloseRegion() ;
void NewRegion() ;
void EndFigure() ;
void RegPolyLine( tools::Polygon&, bool bReverse = false ) ;
void SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 nType );
void SetGradientAngle( long nAngle );
void SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo );
void SetGradientStyle( sal_uInt32 nStyle, double fRatio );
virtual void DrawRectangle( FloatRect& ) {} ;
virtual void DrawEllipse( FloatPoint&, FloatPoint&, double& ) {} ;
virtual void DrawEllipticalArc( FloatPoint&, FloatPoint&, double&,
sal_uInt32, double&, double&) {} ;
virtual void DrawBitmap( CGMBitmapDescriptor* ) {} ;
virtual void DrawPolygon( tools::Polygon& ) {} ;
virtual void DrawPolyLine( tools::Polygon& ) {} ;
virtual void DrawPolybezier( tools::Polygon& ) {} ;
virtual void DrawPolyPolygon( tools::PolyPolygon& ) {} ;
virtual void DrawText( css::awt::Point&, css::awt::Size&, char*, sal_uInt32, FinalFlag ) {} ;
virtual void AppendText( char*, sal_uInt32, FinalFlag ) {} ;
virtual void DrawChart(){} ;
};
class CGMImpressOutAct : public CGMOutAct
{
css::uno::Reference< css::drawing::XDrawPages > maXDrawPages;
css::uno::Reference< css::drawing::XDrawPage > maXDrawPage;
@@ -99,29 +66,39 @@ class CGMImpressOutAct : public CGMOutAct
bool ImplCreateShape( const OUString& rType );
bool ImplInitPage();
void ImplSetOrientation( FloatPoint& RefPoint, double& Orientation ) ;
void ImplSetLineBundle() ;
void ImplSetFillBundle() ;
void ImplSetTextBundle( const css::uno::Reference< css::beans::XPropertySet > & ) ;
void ImplSetOrientation( FloatPoint& RefPoint, double& Orientation );
void ImplSetLineBundle();
void ImplSetFillBundle();
void ImplSetTextBundle( const css::uno::Reference< css::beans::XPropertySet > & );
public:
CGMImpressOutAct( CGM&, const css::uno::Reference< css::frame::XModel > & ) ;
virtual ~CGMImpressOutAct() {} ;
virtual void InsertPage() override ;
virtual void BeginGroup() override ;
virtual void EndGroup() override ;
virtual void EndGrouping() override ;
virtual void DrawRectangle( FloatRect& ) override ;
virtual void DrawEllipse( FloatPoint& center, FloatPoint&, double& Orientation ) override ;
virtual void DrawEllipticalArc( FloatPoint& center, FloatPoint& size, double& orientation,
sal_uInt32 etype, double& startangle, double& endangle ) override ;
virtual void DrawBitmap( CGMBitmapDescriptor* ) override ;
virtual void DrawPolygon( tools::Polygon& ) override ;
virtual void DrawPolyLine( tools::Polygon& ) override ;
virtual void DrawPolybezier( tools::Polygon& ) override ;
virtual void DrawPolyPolygon( tools::PolyPolygon& ) override ;
virtual void DrawText( css::awt::Point& TextRectPos, css::awt::Size& TextRectSize, char* String, sal_uInt32 StringSize, FinalFlag ) override ;
virtual void AppendText( char* String, sal_uInt32 StringSize, FinalFlag ) override ;
virtual void DrawChart() override;
CGMImpressOutAct( CGM&, const css::uno::Reference< css::frame::XModel > & );
~CGMImpressOutAct();
void InsertPage();
void BeginGroup();
void EndGroup();
void EndGrouping();
void DrawRectangle( FloatRect& );
void DrawEllipse( FloatPoint& center, FloatPoint&, double& Orientation );
void DrawEllipticalArc( FloatPoint& center, FloatPoint& size, double& orientation,
sal_uInt32 etype, double& startangle, double& endangle );
void DrawBitmap( CGMBitmapDescriptor* );
void DrawPolygon( tools::Polygon& );
void DrawPolyLine( tools::Polygon& );
void DrawPolybezier( tools::Polygon& );
void DrawPolyPolygon( tools::PolyPolygon& );
void DrawText( css::awt::Point& TextRectPos, css::awt::Size& TextRectSize, char* String, sal_uInt32 StringSize, FinalFlag );
void AppendText( char* String, sal_uInt32 StringSize, FinalFlag );
void FirstOutPut() { mpCGM->mbFirstOutPut = false; } ;
void BeginFigure();
void CloseRegion();
void NewRegion();
void EndFigure();
void RegPolyLine( tools::Polygon&, bool bReverse = false );
void SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 nType );
void SetGradientAngle( long nAngle );
void SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo );
void SetGradientStyle( sal_uInt32 nStyle, double fRatio );
};