diff options
author | Noel Grandin <noel@peralex.com> | 2016-07-05 09:02:53 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-07-05 08:24:18 +0000 |
commit | add9a35ba687f8c55a6ebba3a56e50c779321984 (patch) | |
tree | cfa69a38a554109ec1056a84885cd738d768c4bf | |
parent | 6916368748d7f161673e2a5e5bd9b39b69fdad56 (diff) |
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>
-rw-r--r-- | compilerplugins/clang/mergeclasses.results | 1 | ||||
-rw-r--r-- | filter/Library_icg.mk | 1 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/actimpr.cxx | 140 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/cgm.hxx | 5 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/class7.cxx | 2 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/outact.cxx | 166 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/outact.hxx | 111 |
7 files changed, 184 insertions, 242 deletions
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 7f80026d8d24..8c938a6afbe2 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -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 diff --git a/filter/Library_icg.mk b/filter/Library_icg.mk index 51e360cb1b50..a84ae9a73bf4 100644 --- a/filter/Library_icg.mk +++ b/filter/Library_icg.mk @@ -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: diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx index f7d053bd8dca..1ad3c3089f5f 100644 --- a/filter/source/graphicfilter/icgm/actimpr.cxx +++ b/filter/source/graphicfilter/icgm/actimpr.cxx @@ -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: */ diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index 50d6e62775c9..e9651d1fa01c 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -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; diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx index 4042243fcd30..a18c5fd30272 100644 --- a/filter/source/graphicfilter/icgm/class7.cxx +++ b/filter/source/graphicfilter/icgm/class7.cxx @@ -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; diff --git a/filter/source/graphicfilter/icgm/outact.cxx b/filter/source/graphicfilter/icgm/outact.cxx deleted file mode 100644 index 028ed60463a4..000000000000 --- a/filter/source/graphicfilter/icgm/outact.cxx +++ /dev/null @@ -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: */ diff --git a/filter/source/graphicfilter/icgm/outact.hxx b/filter/source/graphicfilter/icgm/outact.hxx index 0f80cb0524e9..a94a4991c872 100644 --- a/filter/source/graphicfilter/icgm/outact.hxx +++ b/filter/source/graphicfilter/icgm/outact.hxx @@ -36,56 +36,23 @@ class CGM; class CGMBitmapDescriptor; -class CGMOutAct -{ -protected: - sal_uInt16 mnCurrentPage; // defaulted to zero - sal_uInt32 mnGroupActCount; // grouping - sal_uInt32 mnGroupLevel; - sal_uInt32* mpGroupLevel; +class CGMImpressOutAct +{ + sal_uInt16 mnCurrentPage; // defaulted to zero - sal_uInt16 mnIndex; // figure - sal_uInt8* mpFlags; - Point* mpPoints; - tools::PolyPolygon maPolyPolygon; - css::awt::Gradient* mpGradient; + sal_uInt32 mnGroupActCount; // grouping + sal_uInt32 mnGroupLevel; + sal_uInt32* mpGroupLevel; - CGM* mpCGM; + sal_uInt16 mnIndex; // figure + sal_uInt8* mpFlags; + Point* mpPoints; + tools::PolyPolygon maPolyPolygon; + css::awt::Gradient* mpGradient; -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(){} ; -}; + CGM* mpCGM; -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 ); }; |