summaryrefslogtreecommitdiff
path: root/filter/source/graphicfilter/icgm
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/graphicfilter/icgm')
-rw-r--r--filter/source/graphicfilter/icgm/actimpr.cxx1135
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx412
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.hxx89
-rw-r--r--filter/source/graphicfilter/icgm/bundles.cxx290
-rw-r--r--filter/source/graphicfilter/icgm/bundles.hxx176
-rw-r--r--filter/source/graphicfilter/icgm/cgm.cxx930
-rw-r--r--filter/source/graphicfilter/icgm/cgm.hxx180
-rw-r--r--filter/source/graphicfilter/icgm/cgmres.hrc28
-rw-r--r--filter/source/graphicfilter/icgm/cgmtypes.hxx148
-rw-r--r--filter/source/graphicfilter/icgm/chart.cxx102
-rw-r--r--filter/source/graphicfilter/icgm/chart.hxx216
-rw-r--r--filter/source/graphicfilter/icgm/class0.cxx140
-rw-r--r--filter/source/graphicfilter/icgm/class1.cxx233
-rw-r--r--filter/source/graphicfilter/icgm/class2.cxx229
-rw-r--r--filter/source/graphicfilter/icgm/class3.cxx146
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx863
-rw-r--r--filter/source/graphicfilter/icgm/class5.cxx526
-rw-r--r--filter/source/graphicfilter/icgm/class7.cxx239
-rw-r--r--filter/source/graphicfilter/icgm/classx.cxx265
-rw-r--r--filter/source/graphicfilter/icgm/elements.cxx397
-rw-r--r--filter/source/graphicfilter/icgm/elements.hxx147
-rw-r--r--filter/source/graphicfilter/icgm/exports.map7
-rw-r--r--filter/source/graphicfilter/icgm/main.hxx65
-rw-r--r--filter/source/graphicfilter/icgm/makefile.mk80
-rw-r--r--filter/source/graphicfilter/icgm/outact.cxx202
-rw-r--r--filter/source/graphicfilter/icgm/outact.hxx150
26 files changed, 7395 insertions, 0 deletions
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
new file mode 100644
index 000000000000..cf905f8d5a20
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -0,0 +1,1135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <vcl/bitmapex.hxx>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/drawing/XShapeGrouper.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/TextAdjust.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include "main.hxx"
+#include "outact.hxx"
+
+using namespace ::com::sun::star;
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XModel > & rModel ) :
+ CGMOutAct ( rCGM ),
+ nFinalTextCount ( 0 )
+{
+ sal_Bool bStatRet = sal_False;
+
+ if ( mpCGM->mbStatus )
+ {
+ uno::Reference< drawing::XDrawPagesSupplier > aDrawPageSup( rModel, uno::UNO_QUERY );
+ if( aDrawPageSup.is() )
+ {
+ maXDrawPages = aDrawPageSup->getDrawPages();
+ if ( maXDrawPages.is() )
+ {
+ maXServiceManagerSC = utl::getProcessServiceFactory();
+ if ( maXServiceManagerSC.is() )
+ {
+ uno::Any aAny( rModel->queryInterface( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) ));
+ if( aAny >>= maXMultiServiceFactory )
+ {
+ maXDrawPage = *(uno::Reference< drawing::XDrawPage > *)maXDrawPages->getByIndex( 0 ).getValue();
+ if ( ImplInitPage() )
+ bStatRet = sal_True;
+ }
+ }
+ }
+ }
+ mpCGM->mbStatus = bStatRet;
+ }
+};
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMImpressOutAct::ImplInitPage()
+{
+ sal_Bool bStatRet = sal_False;
+ if( maXDrawPage.is() )
+ {
+ maXShapes = uno::Reference< drawing::XShapes >( maXDrawPage, uno::UNO_QUERY );
+ if ( maXShapes.is() )
+ {
+ bStatRet = sal_True;
+ }
+ }
+ return bStatRet;
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMImpressOutAct::ImplCreateShape( const ::rtl::OUString& rType )
+{
+ uno::Reference< uno::XInterface > xNewShape( maXMultiServiceFactory->createInstance( rType ) );
+ maXShape = uno::Reference< drawing::XShape >( xNewShape, uno::UNO_QUERY );
+ maXPropSet = uno::Reference< beans::XPropertySet >( xNewShape, uno::UNO_QUERY );
+ if ( maXShape.is() && maXPropSet.is() )
+ {
+ maXShapes->add( maXShape );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetOrientation( FloatPoint& rRefPoint, double& rOrientation )
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int32)rRefPoint.X;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
+ aAny <<= (sal_Int32)rRefPoint.Y;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
+ aAny <<= (sal_Int32)( rOrientation * 100.0 );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetLineBundle()
+{
+ uno::Any aAny;
+ drawing::LineStyle eLS;
+
+ sal_uInt32 nLineColor;
+ LineType eLineType;
+ double fLineWidth;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ nLineColor = mpCGM->pElement->pLineBundle->GetColor();
+ else
+ nLineColor = mpCGM->pElement->aLineBundle.GetColor();
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINETYPE )
+ eLineType = mpCGM->pElement->pLineBundle->eLineType;
+ else
+ eLineType = mpCGM->pElement->aLineBundle.eLineType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINEWIDTH )
+ fLineWidth = mpCGM->pElement->pLineBundle->nLineWidth;
+ else
+ fLineWidth = mpCGM->pElement->aLineBundle.nLineWidth;
+
+ aAny <<= (sal_Int32)nLineColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+
+ aAny <<= (sal_Int32)fLineWidth;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+
+ switch( eLineType )
+ {
+ case LT_NONE :
+ eLS = drawing::LineStyle_NONE;
+ break;
+ case LT_DASH :
+ case LT_DOT :
+ case LT_DASHDOT :
+ case LT_DOTDOTSPACE :
+ case LT_LONGDASH :
+ case LT_DASHDASHDOT :
+ eLS = drawing::LineStyle_DASH;
+ break;
+ case LT_SOLID :
+ default:
+ eLS = drawing::LineStyle_SOLID;
+ break;
+ }
+ aAny <<= eLS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
+ if ( eLS == drawing::LineStyle_DASH )
+ {
+ drawing::LineDash aLineDash( drawing::DashStyle_RECTRELATIVE, 1, 50, 3, 33, 100 );
+ aAny <<= aLineDash;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineDash"), aAny );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetFillBundle()
+{
+
+ uno::Any aAny;
+ drawing::LineStyle eLS;
+ drawing::FillStyle eFS;
+
+ sal_uInt32 nEdgeColor = 0;
+ EdgeType eEdgeType;
+ double fEdgeWidth = 0;
+
+ sal_uInt32 nFillColor;
+ FillInteriorStyle eFillStyle;
+ long nPatternIndex;
+ sal_uInt32 nHatchIndex;
+
+ if ( mpCGM->pElement->eEdgeVisibility == EV_ON )
+ {
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGETYPE )
+ eEdgeType = mpCGM->pElement->pEdgeBundle->eEdgeType;
+ else
+ eEdgeType = mpCGM->pElement->aEdgeBundle.eEdgeType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
+ fEdgeWidth = mpCGM->pElement->pEdgeBundle->nEdgeWidth;
+ else
+ fEdgeWidth = mpCGM->pElement->aEdgeBundle.nEdgeWidth;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGECOLOR )
+ nEdgeColor = mpCGM->pElement->pEdgeBundle->GetColor();
+ else
+ nEdgeColor = mpCGM->pElement->aEdgeBundle.GetColor();
+ }
+ else
+ eEdgeType = ET_NONE;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ eFillStyle = mpCGM->pElement->pFillBundle->eFillInteriorStyle;
+ else
+ eFillStyle = mpCGM->pElement->aFillBundle.eFillInteriorStyle;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLCOLOR )
+ nFillColor = mpCGM->pElement->pFillBundle->GetColor();
+ else
+ nFillColor = mpCGM->pElement->aFillBundle.GetColor();
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_HATCHINDEX )
+ nHatchIndex = (sal_uInt32)mpCGM->pElement->pFillBundle->nFillHatchIndex;
+ else
+ nHatchIndex = (sal_uInt32)mpCGM->pElement->aFillBundle.nFillHatchIndex;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_PATTERNINDEX )
+ nPatternIndex = mpCGM->pElement->pFillBundle->nFillPatternIndex;
+ else
+ nPatternIndex = mpCGM->pElement->aFillBundle.nFillPatternIndex;
+
+ aAny <<= (sal_Int32)nFillColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillColor"), aAny );
+
+ switch ( eFillStyle )
+ {
+ case FIS_HATCH :
+ {
+ if ( nHatchIndex == 0 )
+ eFS = drawing::FillStyle_NONE;
+ else
+ eFS = drawing::FillStyle_HATCH;
+ }
+ break;
+ case FIS_PATTERN :
+ case FIS_SOLID :
+ {
+ eFS = drawing::FillStyle_SOLID;
+ }
+ break;
+
+ case FIS_GEOPATTERN :
+ {
+ if ( mpCGM->pElement->eTransparency == T_ON )
+ nFillColor = mpCGM->pElement->nAuxiliaryColor;
+ eFS = drawing::FillStyle_NONE;
+ }
+ break;
+
+ case FIS_INTERPOLATED :
+ case FIS_GRADIENT :
+ {
+ eFS = drawing::FillStyle_GRADIENT;
+ }
+ break;
+
+ case FIS_HOLLOW :
+ case FIS_EMPTY :
+ default:
+ {
+ eFS = drawing::FillStyle_NONE;
+ }
+ }
+
+ if ( mpCGM->mnAct4PostReset & ACT4_GRADIENT_ACTION )
+ eFS = drawing::FillStyle_GRADIENT;
+
+ if ( eFS == drawing::FillStyle_GRADIENT )
+ {
+ aAny <<= *mpGradient;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), aAny );
+ }
+ aAny <<= eFS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
+
+ eLS = drawing::LineStyle_NONE;
+ if ( eFillStyle == FIS_HOLLOW )
+ {
+ eLS = drawing::LineStyle_SOLID;
+ aAny <<= (sal_Int32)nFillColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+ aAny <<= (sal_Int32)0;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+ }
+ else if ( eEdgeType != ET_NONE )
+ {
+ aAny <<= (sal_Int32)nEdgeColor;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
+
+ aAny <<= (sal_Int32)fEdgeWidth;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
+
+ switch( eEdgeType )
+ {
+ case ET_DASH :
+ case ET_DOT :
+ case ET_DASHDOT :
+ case ET_DASHDOTDOT :
+ case ET_DOTDOTSPACE :
+ case ET_LONGDASH :
+ case ET_DASHDASHDOT :
+// {
+// eLS = LineStyle_DASH;
+// aAny.setValue( &eLS, ::getCppuType((const drawing::LineStyle*)0) );
+// maXPropSet->setPropertyValue( L"LineStyle", aAny );
+// drawing::LineDash aLineDash( DashStyle_RECTRELATIVE, 1, 160, 1, 160, 190 );
+// aAny.setValue( &aLineDash, ::getCppuType((const drawing::LineDash*)0) );
+// maXPropSet->setPropertyValue( L"DashStyle", aAny );
+// }
+// break;
+ default: // case ET_SOLID :
+ {
+ eLS = drawing::LineStyle_SOLID;
+ }
+ break;
+ }
+ }
+
+ aAny <<= eLS;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
+
+ if ( eFS == drawing::FillStyle_HATCH )
+ {
+ drawing::Hatch aHatch;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ aHatch.Color = nFillColor;
+ else
+ aHatch.Color = nFillColor;
+ HatchEntry* pHatchEntry = (HatchEntry*)mpCGM->pElement->aHatchTable.Get( nHatchIndex );
+ if ( pHatchEntry )
+ {
+ switch ( pHatchEntry->HatchStyle )
+ {
+ case 0 : aHatch.Style = drawing::HatchStyle_SINGLE; break;
+ case 1 : aHatch.Style = drawing::HatchStyle_DOUBLE; break;
+ case 2 : aHatch.Style = drawing::HatchStyle_TRIPLE; break;
+ }
+ aHatch.Distance = pHatchEntry->HatchDistance;
+ aHatch.Angle = pHatchEntry->HatchAngle;
+ }
+ else
+ {
+ aHatch.Style = drawing::HatchStyle_TRIPLE;
+ aHatch.Distance = 10 * ( nHatchIndex & 0x1f ) | 100;
+ aHatch.Angle = 15 * ( ( nHatchIndex & 0x1f ) - 5 );
+ }
+ aAny <<= aHatch;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillHatch"), aAny );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XPropertySet > & rProperty )
+{
+ uno::Any aAny;
+ TextPrecision eTextPrecision;
+ sal_uInt32 nTextFontIndex;
+ sal_uInt32 nTextColor;
+ double fCharacterExpansion;
+ double fCharacterSpacing;
+
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX )
+ nTextFontIndex = mpCGM->pElement->pTextBundle->nTextFontIndex;
+ else
+ nTextFontIndex = mpCGM->pElement->aTextBundle.nTextFontIndex;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTPRECISION )
+ eTextPrecision = mpCGM->pElement->pTextBundle->eTextPrecision;
+ else
+ eTextPrecision = mpCGM->pElement->aTextBundle.eTextPrecision;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION )
+ fCharacterExpansion = mpCGM->pElement->pTextBundle->nCharacterExpansion;
+ else
+ fCharacterExpansion = mpCGM->pElement->aTextBundle.nCharacterExpansion;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTERSPACING )
+ fCharacterSpacing = mpCGM->pElement->pTextBundle->nCharacterSpacing;
+ else
+ fCharacterSpacing = mpCGM->pElement->aTextBundle.nCharacterSpacing;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ nTextColor = mpCGM->pElement->pTextBundle->GetColor();
+ else
+ nTextColor = mpCGM->pElement->aTextBundle.GetColor();
+
+ aAny <<= (sal_Int32)nTextColor;
+ rProperty->setPropertyValue( rtl::OUString::createFromAscii("CharColor"), aAny );
+
+ sal_uInt32 nFontType = 0;
+ awt::FontDescriptor aFontDescriptor;
+ FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( nTextFontIndex );
+ if ( pFontEntry )
+ {
+ nFontType = pFontEntry->nFontType;
+ aFontDescriptor.Name = String::CreateFromAscii( (char*)pFontEntry->pFontName );
+ }
+ aFontDescriptor.Height = ( sal_Int16 )( ( mpCGM->pElement->nCharacterHeight * (double)1.50 ) );
+ if ( nFontType & 1 )
+ aFontDescriptor.Slant = awt::FontSlant_ITALIC;
+ if ( nFontType & 2 )
+ aFontDescriptor.Weight = awt::FontWeight::BOLD;
+ else
+ aFontDescriptor.Weight = awt::FontWeight::NORMAL;
+
+ if ( mpCGM->pElement->eUnderlineMode != UM_OFF )
+ {
+ aFontDescriptor.Underline = awt::FontUnderline::SINGLE;
+ }
+ aAny <<= aFontDescriptor;
+ rProperty->setPropertyValue( rtl::OUString::createFromAscii("FontDescriptor"), aAny );
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::InsertPage()
+{
+ if ( mnCurrentPage ) // eine seite ist immer vorhanden, deshalb wird die erste Seite ausgelassen
+ {
+ uno::Reference< drawing::XDrawPage > xPage( maXDrawPages->insertNewByIndex( 0xffff ), uno::UNO_QUERY );
+ maXDrawPage = xPage;
+ if ( ImplInitPage() == sal_False )
+ mpCGM->mbStatus = sal_False;
+ }
+ mnCurrentPage++;
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::BeginGroup()
+{
+ if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
+ {
+ mpGroupLevel[ mnGroupLevel ] = maXShapes->getCount();
+ }
+ mnGroupLevel++;
+ mnGroupActCount = mpCGM->mnActCount;
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::EndGroup()
+{
+ if ( mnGroupLevel ) // preserve overflow
+ mnGroupLevel--;
+ if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
+ {
+ sal_uInt32 mnFirstIndex = mpGroupLevel[ mnGroupLevel ];
+ if ( mnFirstIndex == 0xffffffff )
+ mnFirstIndex = 0;
+ sal_uInt32 mnCurrentCount = maXShapes->getCount();
+ if ( ( mnCurrentCount - mnFirstIndex ) > 1 )
+ {
+ uno::Reference< drawing::XShapeGrouper > aXShapeGrouper;
+ uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) )));
+ if( aAny >>= aXShapeGrouper )
+ {
+ uno::Reference< drawing::XShapes > aXShapes;
+// if ( maXServiceManagerSC->createInstance( L"stardiv.one.drawing.ShapeCollection" )->queryInterface( ::getCppuType((const Reference< drawing::XShapes >*)0), aXShapes ) )
+
+ uno::Reference< drawing::XShape > aXShapeCollection( maXServiceManagerSC->createInstance( rtl::OUString::createFromAscii("com.sun.star.drawing.ShapeCollection") ), uno::UNO_QUERY );
+ if ( aXShapeCollection.is() )
+ {
+ aXShapes = uno::Reference< drawing::XShapes >( aXShapeCollection, uno::UNO_QUERY );
+ if( aXShapes.is() )
+ {
+ for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
+ {
+ uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
+ if (aXShape.is() )
+ {
+ aXShapes->add( aXShape );
+ }
+ }
+ }
+ }
+ uno::Reference< drawing::XShapeGroup > aXShapeGroup = aXShapeGrouper->group( aXShapes );
+ }
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::EndGrouping()
+{
+ while ( mnGroupLevel )
+ {
+ EndGroup();
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawRectangle( FloatRect& rFloatRect )
+{
+ if ( mnGroupActCount != ( mpCGM->mnActCount - 1 ) ) // POWERPOINT HACK !!!
+ {
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.RectangleShape") ) )
+ {
+ awt::Size aSize( (long)(rFloatRect.Right - rFloatRect.Left ), (long)(rFloatRect.Bottom-rFloatRect.Top ) );
+ maXShape->setSize( aSize );
+ maXShape->setPosition( awt::Point( (long)rFloatRect.Left, (long)rFloatRect.Top ) );
+ ImplSetFillBundle();
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawEllipse( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
+ {
+ drawing::CircleKind eCircleKind = drawing::CircleKind_FULL;
+ uno::Any aAny( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
+
+ long nXSize = (long)( rSize.X * 2.0 ); // Merkwuerdigkes Verhalten bei einer awt::Size von 0
+ long nYSize = (long)( rSize.Y * 2.0 );
+ if ( nXSize < 1 )
+ nXSize = 1;
+ if ( nYSize < 1 )
+ nYSize = 1;
+ maXShape->setSize( awt::Size( nXSize, nYSize ) );
+ maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
+
+ if ( rOrientation != 0 )
+ {
+ ImplSetOrientation( rCenter, rOrientation );
+ }
+ ImplSetFillBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawEllipticalArc( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation,
+ sal_uInt32 nType, double& fStartAngle, double& fEndAngle )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
+ {
+ uno::Any aAny;
+ drawing::CircleKind eCircleKind;
+
+
+ long nXSize = (long)( rSize.X * 2.0 ); // Merkwuerdigkes Verhalten bei einer awt::Size von 0
+ long nYSize = (long)( rSize.Y * 2.0 );
+ if ( nXSize < 1 )
+ nXSize = 1;
+ if ( nYSize < 1 )
+ nYSize = 1;
+
+ maXShape->setSize( awt::Size ( nXSize, nYSize ) );
+
+ if ( rOrientation != 0 )
+ {
+ fStartAngle += rOrientation;
+ if ( fStartAngle >= 360 )
+ fStartAngle -= 360;
+ fEndAngle += rOrientation;
+ if ( fEndAngle >= 360 )
+ fEndAngle -= 360;
+ }
+ switch( nType )
+ {
+ case 0 : eCircleKind = drawing::CircleKind_SECTION; break;
+ case 1 : eCircleKind = drawing::CircleKind_CUT; break;
+ case 2 : eCircleKind = drawing::CircleKind_ARC; break;
+ default : eCircleKind = drawing::CircleKind_FULL; break;
+ }
+ if ( (long)fStartAngle == (long)fEndAngle )
+ {
+ eCircleKind = drawing::CircleKind_FULL;
+ aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ }
+ else
+ {
+ aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
+ aAny <<= (sal_Int32)( (long)( fStartAngle * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleStartAngle"), aAny );
+ aAny <<= (sal_Int32)( (long)( fEndAngle * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleEndAngle"), aAny );
+ }
+ maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
+ if ( rOrientation != 0 )
+ {
+ ImplSetOrientation( rCenter, rOrientation );
+ }
+ if ( eCircleKind == drawing::CircleKind_ARC )
+ {
+ ImplSetLineBundle();
+ }
+ else
+ {
+ ImplSetFillBundle();
+ if ( nType == 2 )
+ {
+ ImplSetLineBundle();
+ drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+ aAny.setValue( &eFillStyle, ::getCppuType((const drawing::FillStyle*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
+ }
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawBitmap( CGMBitmapDescriptor* pBmpDesc )
+{
+ if ( pBmpDesc->mbStatus && pBmpDesc->mpBitmap )
+ {
+ FloatPoint aOrigin = pBmpDesc->mnOrigin;
+ double fdx = pBmpDesc->mndx;
+ double fdy = pBmpDesc->mndy;
+
+ sal_uInt32 nMirr = BMP_MIRROR_NONE;
+ if ( pBmpDesc->mbVMirror )
+ nMirr |= BMP_MIRROR_VERT;
+ if ( pBmpDesc->mbHMirror )
+ nMirr |= BMP_MIRROR_HORZ;
+ if ( nMirr != BMP_MIRROR_NONE )
+ pBmpDesc->mpBitmap->Mirror( nMirr );
+
+ mpCGM->ImplMapPoint( aOrigin );
+ mpCGM->ImplMapX( fdx );
+ mpCGM->ImplMapY( fdy );
+
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.GraphicObjectShape") ) )
+ {
+ maXShape->setSize( awt::Size( (long)fdx, (long)fdy ) );
+ maXShape->setPosition( awt::Point( (long)aOrigin.X, (long)aOrigin.Y ) );
+
+ if ( pBmpDesc->mnOrientation != 0 )
+ {
+ ImplSetOrientation( aOrigin, pBmpDesc->mnOrientation );
+ }
+
+ uno::Reference< awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap( BitmapEx( *( pBmpDesc->mpBitmap ) ) ) );
+ uno::Any aAny;
+ aAny <<= xBitmap;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("GraphicObjectFillBitmap"), aAny );
+
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolygon( Polygon& rPoly )
+{
+ sal_uInt16 nPoints = rPoly.GetSize();
+
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyPolygonShape") ) )
+ {
+ drawing::PointSequenceSequence aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ for( sal_uInt16 n = 0; n < nPoints; n++ )
+ *pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
+
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
+ ImplSetFillBundle();
+ }
+};
+
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolyLine( Polygon& rPoly )
+{
+ sal_uInt16 nPoints = rPoly.GetSize();
+
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyLineShape") ) )
+ {
+ drawing::PointSequenceSequence aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ for( sal_uInt16 n = 0; n < nPoints; n++ )
+ *pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
+
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
+ ImplSetLineBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolybezier( Polygon& rPolygon )
+{
+ USHORT nPoints = rPolygon.GetSize();
+ if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.OpenBezierShape") ) )
+ {
+ drawing::PolyPolygonBezierCoords aRetval;
+
+ aRetval.Coordinates.realloc( 1 );
+ aRetval.Flags.realloc( 1 );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc( nPoints );
+ pOuterFlags->realloc( nPoints );
+
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+
+ for( USHORT i = 0; i < nPoints; i++ )
+ {
+ *pInnerSequence++ = awt::Point( rPolygon[ i ].X(), rPolygon[ i ].Y() );
+ *pInnerFlags++ = (drawing::PolygonFlags)rPolygon.GetFlags( i );
+ }
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam );
+ ImplSetLineBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawPolyPolygon( PolyPolygon& rPolyPolygon )
+{
+ sal_uInt32 nNumPolys = rPolyPolygon.Count();
+ if ( nNumPolys && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.ClosedBezierShape") ) )
+ {
+ drawing::PolyPolygonBezierCoords aRetval;
+
+ // Polygone innerhalb vrobereiten
+ aRetval.Coordinates.realloc((sal_Int32)nNumPolys);
+ aRetval.Flags.realloc((sal_Int32)nNumPolys);
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
+
+ for( sal_uInt16 a = 0; a < nNumPolys; a++ )
+ {
+ Polygon aPolygon( rPolyPolygon.GetObject( a ) );
+ sal_uInt32 nNumPoints = aPolygon.GetSize();
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)nNumPoints);
+ pOuterFlags->realloc((sal_Int32)nNumPoints);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+
+ for( sal_uInt16 b = 0; b < nNumPoints; b++ )
+ {
+ *pInnerSequence++ = awt::Point( aPolygon.GetPoint( b ).X(), aPolygon.GetPoint( b ).Y() ) ;
+ *pInnerFlags++ = (drawing::PolygonFlags)aPolygon.GetFlags( b );
+ }
+ pOuterSequence++;
+ pOuterFlags++;
+ }
+ uno::Any aParam;
+ aParam <<= aRetval;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam);
+ ImplSetFillBundle();
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawText( awt::Point& rTextPos, awt::Size& rTextSize, char* pString, sal_uInt32 /*nSize*/, FinalFlag eFlag )
+{
+ if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.TextShape") ) )
+ {
+ uno::Any aAny;
+ long nWidth = rTextSize.Width;
+ long nHeight = rTextSize.Height;
+
+ awt::Point aTextPos( rTextPos );
+ switch ( mpCGM->pElement->eTextAlignmentV )
+ {
+ case TAV_HALF :
+ {
+ aTextPos.Y -= static_cast<sal_Int32>( ( mpCGM->pElement->nCharacterHeight * 1.5 ) / 2 );
+ }
+ break;
+
+ case TAV_BASE :
+ case TAV_BOTTOM :
+ case TAV_NORMAL :
+ aTextPos.Y -= static_cast<sal_Int32>( mpCGM->pElement->nCharacterHeight * 1.5 );
+ case TAV_TOP :
+ break;
+ case TAV_CAP:
+ case TAV_CONT:
+ break; // -Wall these two were not here.
+ }
+
+ if ( nWidth < 0 )
+ {
+ nWidth = -nWidth;
+ }
+ else if ( nWidth == 0 )
+ {
+ nWidth = -1;
+ }
+ if ( nHeight < 0 )
+ {
+ nHeight = -nHeight;
+ }
+ else if ( nHeight == 0 )
+ {
+ nHeight = -1;
+ }
+ maXShape->setPosition( aTextPos );
+ maXShape->setSize( awt::Size( nWidth, nHeight ) );
+ double nX = mpCGM->pElement->nCharacterOrientation[ 2 ];
+ double nY = mpCGM->pElement->nCharacterOrientation[ 3 ];
+ double nOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY < 0 )
+ nOrientation = 360 - nOrientation;
+
+ if ( nOrientation )
+ {
+ aAny <<= (sal_Int32)( aTextPos.X );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
+ aAny <<= (sal_Int32)( aTextPos.Y + nHeight );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
+ aAny <<= (sal_Int32)( (sal_Int32)( nOrientation * 100 ) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
+ }
+ if ( nWidth == -1 )
+ {
+ sal_Bool bTrue( sal_True );
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0 ));
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowWidth"), aAny );
+
+ drawing::TextAdjust eTextAdjust;
+ switch ( mpCGM->pElement->eTextAlignmentH )
+ {
+ case TAH_RIGHT :
+ eTextAdjust = drawing::TextAdjust_RIGHT;
+ break;
+ case TAH_LEFT :
+ case TAH_CONT :
+ case TAH_NORMAL :
+ eTextAdjust = drawing::TextAdjust_LEFT;
+ break;
+ case TAH_CENTER :
+ eTextAdjust = drawing::TextAdjust_CENTER;
+ break;
+ }
+ aAny <<= eTextAdjust;
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextHorizontalAdjust"), aAny );
+ }
+ if ( nHeight == -1 )
+ {
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0) );
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowHeight"), aAny );
+ }
+ uno::Reference< text::XText > xText;
+ uno::Any aFirstQuery( maXShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0) ));
+ if( aFirstQuery >>= xText )
+ {
+ String aStr( String::CreateFromAscii( pString ) );
+
+ uno::Reference< text::XTextCursor > aXTextCursor( xText->createTextCursor() );
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ uno::Reference< text::XTextRange > aCursorText;
+ uno::Any aSecondQuery( aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
+ if ( aSecondQuery >>= aCursorText )
+ {
+ uno::Reference< beans::XPropertySet > aCursorPropSet;
+
+ uno::Any aQuery( aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
+ if( aQuery >>= aCursorPropSet )
+ {
+ if ( nWidth != -1 ) // paragraph adjusting in a valid textbox ?
+ {
+ switch ( mpCGM->pElement->eTextAlignmentH )
+ {
+ case TAH_RIGHT :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_RIGHT;
+ break;
+ case TAH_LEFT :
+ case TAH_CONT :
+ case TAH_NORMAL :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_LEFT;
+ break;
+ case TAH_CENTER :
+ aAny <<= (sal_Int16)style::HorizontalAlignment_CENTER;
+ break;
+ }
+ aCursorPropSet->setPropertyValue( rtl::OUString::createFromAscii("ParaAdjust"), aAny );
+ }
+ if ( nWidth > 0 && nHeight > 0 ) // restricted text
+ {
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0));
+ maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextFitToSize"), aAny );
+ }
+ aCursorText->setString( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ ImplSetTextBundle( aCursorPropSet );
+ }
+ }
+ }
+ }
+ if ( eFlag == FF_NOT_FINAL )
+ {
+ nFinalTextCount = maXShapes->getCount();
+ }
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFlag /*eFlag*/ )
+{
+ if ( nFinalTextCount )
+ {
+ uno::Reference< drawing::XShape > aShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( nFinalTextCount - 1 ).getValue();
+ if ( aShape.is() )
+ {
+ uno::Reference< text::XText > xText;
+ uno::Any aFirstQuery( aShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0)) );
+ if( aFirstQuery >>= xText )
+ {
+ String aStr( String::CreateFromAscii( pString ) );
+
+ uno::Reference< text::XTextCursor > aXTextCursor( xText->createTextCursor() );
+ if ( aXTextCursor.is() )
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ uno::Reference< text::XTextRange > aCursorText;
+ uno::Any aSecondQuery(aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
+ if ( aSecondQuery >>= aCursorText )
+ {
+ uno::Reference< beans::XPropertySet > aPropSet;
+ uno::Any aQuery(aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
+ if( aQuery >>= aPropSet )
+ {
+ aCursorText->setString( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ ImplSetTextBundle( aPropSet );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+// nCount != 0 -> Append Text
+sal_uInt32 CGMImpressOutAct::DrawText( TextEntry* /*pTextEntry*/, NodeFrameSet& /*rNodeFrameSet*/, sal_uInt32 /*nObjCount*/ )
+{
+
+return 0;
+
+/*
+ uno::Reference< drawing::XShape > aShape;
+
+ if ( nObjCount )
+ {
+ aShape = (drawing::XShape*) maXShapes->getElementByIndex( nObjCount - 1 )->queryInterface( ::getCppuType((const Reference< drawing::XShape >*)0) );
+ }
+ else
+ {
+ aShape = maXShapes->insertShape( maXShapeFactory->createShape( L"ShapeText", rNodeFrameSet.nSize ), rNodeFrameSet.nTopLeft );
+ }
+ if ( aShape.is() )
+ {
+ uno::Reference< text::XText > xText = (text::XText*)aShape->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
+ if ( xText.is() )
+ {
+ uno::Reference< text::XTextCursor > aXTextCursor = (text::XTextCursor*)xText->createTextCursor()->queryInterface( ::getCppuType((const Reference< text::XTextCursor >*)0) );
+ if ( aXTextCursor.is() )
+ {
+ uno::Any aAny;
+ sal_uInt32 nTextOfs = 0;
+ TextAttribute* pTAttr = pTextEntry->pAttribute;
+ do
+ {
+ if ( pTAttr->nTextAttribSize > 0.3 ) // is text readable
+ {
+ aXTextCursor->gotoEnd( sal_False );
+ char nPushedChar = pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ];
+ pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = 0;
+ UString aStr( StringToOUString( pTextEntry->pText + nTextOfs, CHARSET_SYSTEM ) );
+
+ uno::Reference< text::XText > aCursorText = (text::XText*)aXTextCursor->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
+ if ( aCursorText.is() )
+ {
+ uno::Reference< beans::XPropertySet > aPropSet = (beans::XPropertySet*)aCursorText->queryInterface( ::getCppuType((const Reference< beans::XPropertySet >*)0) );
+ if ( aPropSet.is() )
+ {
+ if ( pTextEntry->nRowOrLineNum )
+ {
+ uno::Reference< XControlCharacterInsertable > aCRef = (XControlCharacterInsertable*)aXTextCursor->queryInterface( ::getCppuType((const Reference< XControlCharacterInsertable >*)0) );
+ if ( aCRef.is() )
+ {
+ aCRef->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK );
+ }
+ }
+ aCursorText->setText( aStr );
+ aXTextCursor->gotoEnd( sal_True );
+ double nSize = mpCGM->mnOutdx;
+ if ( mpCGM->mnOutdx < mpCGM->mnOutdy )
+ nSize = mpCGM->mnOutdy;
+ nSize = ( nSize * (double)pTAttr->nTextAttribSize * (double)1.5 ) / 100;
+
+ aAny <<= (sal_Int32)( (sal_Int32)nSize );
+ aPropSet->setPropertyValue( L"CharHeight", aAny );
+
+ sal_uInt32 nTextColor = pTAttr->nTextColorIndex;
+ if ( nTextColor == 0xff )
+ {
+ nTextColor = ( pTAttr->nTextColorBlue << 16 ) + ( pTAttr->nTextColorGreen << 8 ) + pTAttr->nTextColorRed;
+ }
+ else
+ {
+ nTextColor = mpCGM->pElement->aColorTable[ nTextColor ];
+ }
+
+ sal_uInt32 nFontType = 0;
+
+ if ( pTAttr->nTextFontType == 0xff )
+ {
+ FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( pTAttr->nTextFontFamily );
+ if ( pFontEntry )
+ {
+ nFontType = pFontEntry->nFontType;
+ if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ nTextColor = mpCGM->pElement->pTextBundle->GetColor();
+ else
+ nTextColor = mpCGM->pElement->aTextBundle.GetColor();
+ }
+ FontItalic eFontItalic = ITALIC_NONE;
+ if ( nFontType & 1 )
+ eFontItalic = ITALIC_NORMAL;
+ aAny.setValue( &eFontItalic, ::getCppuType((const FontItalic*)0) );
+ aPropSet->setPropertyValue( L"CharPosture", aAny );
+ }
+ aAny <<= (sal_Int32)( (sal_Int32)nTextColor );
+ aPropSet->setPropertyValue( L"CharColor", aAny );
+
+ awt::FontWeight eFontWeight = WEIGHT_NORMAL;
+ if ( nFontType & 2 )
+ eFontWeight = WEIGHT_BOLD;
+ aAny.setValue( &eFontWeight, ::getCppuType((const awt::FontWeight*)0) );
+ aPropSet->setPropertyValue( L"CharWeight", aAny );
+
+ if ( pTAttr->nTextAttribBits & 0x4000 )
+ {
+ awt::FontUnderline eUnderline = UNDERLINE_SINGLE;
+ aAny.setValue( &eUnderline, ::getCppuType((const awt::FontUnderline*)0) );
+ aPropSet->setPropertyValue( L"CharUnderline", aAny );
+ }
+ }
+ }
+ pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = nPushedChar;
+ }
+ nTextOfs += pTAttr->nTextAttribCount;
+ }
+ while ( ( ( pTAttr = pTAttr->pNextAttribute ) != NULL ) );
+ }
+ }
+ }
+ return ( nObjCount ) ? nObjCount : maXShapes->getCount();
+*/
+}
+
+// ---------------------------------------------------------------
+
+void CGMImpressOutAct::DrawChart()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
new file mode 100644
index 000000000000..102957afbeee
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "main.hxx"
+
+// ---------------------------------------------------------------
+
+CGMBitmap::CGMBitmap( CGM& rCGM ) :
+ mpCGM ( &rCGM ),
+ pCGMBitmapDescriptor ( new CGMBitmapDescriptor )
+{
+ ImplGetBitmap( *pCGMBitmapDescriptor );
+};
+
+// ---------------------------------------------------------------
+
+CGMBitmap::~CGMBitmap()
+{
+ delete pCGMBitmapDescriptor;
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
+{
+ rDesc.mbStatus = sal_True;
+ long nx, ny, nxC, nxCount, nyCount;
+
+ if ( ImplGetDimensions( rDesc ) && rDesc.mpBuf )
+ {
+ if ( ( rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel ) ) != NULL )
+ {
+ if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != NULL )
+ {
+
+ // the picture may either be read from left to right or right to left, from top to bottom ...
+
+ nxCount = rDesc.mnX + 1; // +1 because we are using prefix decreasing
+ nyCount = rDesc.mnY + 1;
+
+ switch ( rDesc.mnDstBitsPerPixel )
+ {
+ case 1 :
+ {
+ if ( rDesc.mnLocalColorPrecision == 1 )
+ ImplSetCurrentPalette( rDesc );
+ else
+ {
+ rDesc.mpAcc->SetPaletteEntryCount( 2 );
+ rDesc.mpAcc->SetPaletteColor( 0, BMCOL( mpCGM->pElement->nBackGroundColor ) );
+ rDesc.mpAcc->SetPaletteColor( 1,
+ ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ ? BMCOL( mpCGM->pElement->pFillBundle->GetColor() )
+ : BMCOL( mpCGM->pElement->aFillBundle.GetColor() ) ) ;
+ }
+ for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ { // this is not fast, but a one bit/pixel format is rarely used
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 3 ) ) >> ( ( nx & 7 ) ^ 7 ) ) ) & 1 );
+ }
+ }
+ }
+ break;
+
+ case 2 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ { // this is not fast, but a two bits/pixel format is rarely used
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 2 ) ) >> ( ( ( nx & 3 ) ^ 3 ) << 1 ) ) ) & 3 );
+ }
+ }
+ }
+ break;
+
+ case 4 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ nxC = nxCount;
+ sal_Int8 nDat;
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ nDat = *pTemp++;
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat >> 4 ) );
+ if ( --nxC )
+ {
+ nx ++;
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat & 15 ) );
+ }
+ else
+ break;
+ }
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ ImplSetCurrentPalette( rDesc );
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( *pTemp++ ) );
+ }
+ }
+ }
+ break;
+
+ case 24 :
+ {
+ {
+ BitmapColor aBitmapColor;
+ for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize )
+ {
+ sal_uInt8* pTemp = rDesc.mpBuf;
+ nxC = nxCount;
+ for ( nx = 0; --nxC; nx++ )
+ {
+ aBitmapColor.SetRed( (sal_Int8)*pTemp++ );
+ aBitmapColor.SetGreen( (sal_Int8)*pTemp++ );
+ aBitmapColor.SetBlue( (sal_Int8)*pTemp++ );
+ rDesc.mpAcc->SetPixel( ny, nx, aBitmapColor );
+ }
+ }
+ }
+ }
+ break;
+ };
+ double nX = rDesc.mnR.X - rDesc.mnQ.X;
+ double nY = rDesc.mnR.Y - rDesc.mnQ.Y;
+
+ rDesc.mndy = sqrt( nX * nX + nY * nY );
+
+ nX = rDesc.mnR.X - rDesc.mnP.X;
+ nY = rDesc.mnR.Y - rDesc.mnP.Y;
+
+ rDesc.mndx = sqrt( nX * nX + nY * nY );
+
+ nX = rDesc.mnR.X - rDesc.mnP.X;
+ nY = rDesc.mnR.Y - rDesc.mnP.Y;
+
+ rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ rDesc.mnOrientation = 360 - rDesc.mnOrientation;
+
+ nX = rDesc.mnQ.X - rDesc.mnR.X;
+ nY = rDesc.mnQ.Y - rDesc.mnR.Y;
+
+ double fAngle = 0.01745329251994 * ( 360 - rDesc.mnOrientation );
+ double fSin = sin(fAngle);
+ double fCos = cos(fAngle);
+ nX = fCos * nX + fSin * nY;
+ nY = -( fSin * nX - fCos * nY );
+
+ fAngle = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ fAngle = 360 - fAngle;
+
+ if ( fAngle > 180 ) // wird das bild nach oben oder unten aufgebaut ?
+ {
+ rDesc.mnOrigin = rDesc.mnP;
+ }
+ else
+ {
+ rDesc.mbVMirror = sal_True;
+ rDesc.mnOrigin = rDesc.mnP;
+ rDesc.mnOrigin.X += rDesc.mnQ.X - rDesc.mnR.X;
+ rDesc.mnOrigin.Y += rDesc.mnQ.Y - rDesc.mnR.Y;
+ }
+ }
+ else
+ rDesc.mbStatus = sal_False;
+ }
+ else
+ rDesc.mbStatus = sal_False;
+ }
+ else
+ rDesc.mbStatus = sal_False;
+
+ if ( rDesc.mpAcc )
+ {
+ rDesc.mpBitmap->ReleaseAccess( rDesc.mpAcc );
+ rDesc.mpAcc = NULL;
+ }
+ if ( rDesc.mbStatus == sal_False )
+ {
+ if ( rDesc.mpBitmap )
+ {
+ delete rDesc.mpBitmap;
+ rDesc.mpBitmap = NULL;
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplSetCurrentPalette( CGMBitmapDescriptor& rDesc )
+{
+ sal_uInt16 nColors = sal::static_int_cast< sal_uInt16 >(
+ 1 << rDesc.mnDstBitsPerPixel);
+ rDesc.mpAcc->SetPaletteEntryCount( nColors );
+ for ( sal_uInt16 i = 0; i < nColors; i++ )
+ {
+ rDesc.mpAcc->SetPaletteColor( i, BMCOL( mpCGM->pElement->aLatestColorTable[ i ] ) );
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& rDesc )
+{
+ mpCGM->ImplGetPoint( rDesc.mnP ); // parallelogram p < - > r
+ mpCGM->ImplGetPoint( rDesc.mnQ ); // |
+ mpCGM->ImplGetPoint( rDesc.mnR ); // q
+ sal_uInt32 nPrecision = mpCGM->pElement->nIntegerPrecision;
+ rDesc.mnX = mpCGM->ImplGetUI( nPrecision );
+ rDesc.mnY = mpCGM->ImplGetUI( nPrecision );
+ rDesc.mnLocalColorPrecision = mpCGM->ImplGetI( nPrecision );
+ rDesc.mnScanSize = 0;
+ switch( rDesc.mnLocalColorPrecision )
+ {
+ case 0x80000001 : // monochrome ( bit = 0->backgroundcolor )
+ case 0 : // bit = 1->fillcolor
+ rDesc.mnDstBitsPerPixel = 1;
+ break;
+ case 1 : // 2 color indexed ( monochrome )
+ case -1 :
+ rDesc.mnDstBitsPerPixel = 1;
+ break;
+ case 2 : // 4 color indexed
+ case -2 :
+ rDesc.mnDstBitsPerPixel = 2;
+ break;
+ case 4 : // 16 color indexed
+ case -4 :
+ rDesc.mnDstBitsPerPixel = 4;
+ break;
+ case 8 : // 256 color indexed
+ case -8 :
+ rDesc.mnDstBitsPerPixel = 8;
+ rDesc.mnScanSize = rDesc.mnX;
+ break;
+ case 16 : // NS
+ case -16 :
+ rDesc.mbStatus = sal_False;
+ break;
+ case 24 : // 24 bit directColor ( 8 bits each component )
+ case -24 :
+ rDesc.mnDstBitsPerPixel = 24;
+ break;
+ case 32 : // NS
+ case -32 :
+ rDesc.mbStatus = sal_False;
+ break;
+
+ }
+ // mnCompressionMode == 0 : CCOMP_RUNLENGTH
+ // == 1 : CCOMP_PACKED ( no compression. each row starts on a 4 byte boundary )
+ if ( ( rDesc.mnCompressionMode = mpCGM->ImplGetUI16() ) != 1 )
+ rDesc.mbStatus = sal_False;
+
+ if ( ( rDesc.mnX || rDesc.mnY ) == 0 )
+ rDesc.mbStatus = sal_False;
+
+ sal_uInt32 nHeaderSize = 2 + 3 * nPrecision + 3 * mpCGM->ImplGetPointSize();
+ rDesc.mnScanSize = ( ( rDesc.mnX * rDesc.mnDstBitsPerPixel + 7 ) >> 3 );
+
+ sal_uInt32 nScanSize;
+ nScanSize = rDesc.mnScanSize;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // try a scansize without dw alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 1 ) & ~1;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // then we'll try word alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 3 ) & ~3;
+ if ( ( nScanSize * rDesc.mnY + nHeaderSize ) != mpCGM->mnElementSize ) // and last we'll try dword alignment
+ {
+ nScanSize = ( rDesc.mnScanSize + 1 ) & ~1; // and LAST BUT NOT LEAST we'll try word alignment without aligning the last line
+ if ( ( nScanSize * ( rDesc.mnY - 1 ) + rDesc.mnScanSize + nHeaderSize ) != mpCGM->mnElementSize )
+ {
+ nScanSize = ( rDesc.mnScanSize + 3 ) & ~3;
+ if ( ( nScanSize * ( rDesc.mnY - 1 ) + rDesc.mnScanSize + nHeaderSize ) != mpCGM->mnElementSize )
+ {
+ mpCGM->mnParaSize = 0; // this format is corrupt
+ rDesc.mbStatus = sal_False;
+ }
+ }
+ }
+ }
+ }
+ rDesc.mnScanSize = nScanSize;
+ if ( rDesc.mbStatus )
+ {
+ rDesc.mpBuf = mpCGM->mpSource + mpCGM->mnParaSize; // mpBuf now points to the first scanline
+ mpCGM->mnParaSize += rDesc.mnScanSize * rDesc.mnY;
+ }
+ return rDesc.mbStatus;
+}
+
+// ---------------------------------------------------------------
+
+void CGMBitmap::ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& rDest )
+{
+ if ( ( rSource.mnR.Y == rDest.mnQ.Y ) && ( rSource.mnR.X == rDest.mnQ.X ) )
+ { // Insert on Bottom
+ if ( mpCGM->mnVDCYmul == -1 )
+ rDest.mnOrigin = rSource.mnOrigin; // neuer origin
+ rDest.mpBitmap->Expand( 0, rSource.mnY );
+ rDest.mpBitmap->CopyPixel( Rectangle( Point( 0, rDest.mnY ), Size( rSource.mnX, rSource.mnY ) ),
+ Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), rSource.mpBitmap );
+ FloatPoint aFloatPoint;
+ aFloatPoint.X = rSource.mnQ.X - rSource.mnR.X;
+ aFloatPoint.Y = rSource.mnQ.Y - rSource.mnR.Y;
+ rDest.mnQ.X += aFloatPoint.X;
+ rDest.mnQ.Y += aFloatPoint.Y;
+ rDest.mnP = rSource.mnP;
+ rDest.mnR = rSource.mnR;
+ }
+ else
+ { // Insert on Top
+ if ( mpCGM->mnVDCYmul == 1 )
+ rDest.mnOrigin = rSource.mnOrigin; // neuer origin
+ rDest.mpBitmap->Expand( 0, rSource.mnY );
+ rDest.mpBitmap->CopyPixel( Rectangle( Point( 0, rDest.mnY ), Size( rSource.mnX, rSource.mnY ) ),
+ Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), rSource.mpBitmap );
+ rDest.mnP = rSource.mnP;
+ rDest.mnR = rSource.mnR;
+ }
+ rDest.mnY += rSource.mnY;
+ rDest.mndy += rSource.mndy;
+};
+
+// ---------------------------------------------------------------
+
+CGMBitmap* CGMBitmap::GetNext()
+{
+ if ( pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus )
+ {
+ CGMBitmap* pCGMTempBitmap = new CGMBitmap( *mpCGM );
+ if ( pCGMTempBitmap )
+ {
+ if ( ( (long)pCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) &&
+ ( ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) &&
+ ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) ||
+ ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) &&
+ ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) )
+ {
+ ImplInsert( *(pCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) );
+ delete pCGMTempBitmap;
+ return NULL;
+ }
+ else // we'll replace the pointers and return the old one
+ {
+ CGMBitmapDescriptor* pTempBD = pCGMBitmapDescriptor;
+ pCGMBitmapDescriptor = pCGMTempBitmap->pCGMBitmapDescriptor;
+ pCGMTempBitmap->pCGMBitmapDescriptor = pTempBD;
+ return pCGMTempBitmap;
+ }
+ }
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+// ---------------------------------------------------------------
+
+CGMBitmapDescriptor* CGMBitmap::GetBitmap()
+{
+ return pCGMBitmapDescriptor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx b/filter/source/graphicfilter/icgm/bitmap.hxx
new file mode 100644
index 000000000000..1ed6d6040802
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_BITMAP_HXX_
+#define CGM_BITMAP_HXX_
+
+#include "cgm.hxx"
+#include <vcl/bmpacc.hxx>
+
+class CGM;
+
+class CGMBitmapDescriptor
+{
+ public:
+ sal_uInt8* mpBuf;
+ Bitmap* mpBitmap;
+ BitmapWriteAccess* mpAcc;
+ sal_Bool mbStatus;
+ sal_Bool mbVMirror;
+ sal_Bool mbHMirror;
+ sal_uInt32 mnDstBitsPerPixel;
+ sal_uInt32 mnScanSize; // bytes per line
+ FloatPoint mnP, mnQ, mnR;
+
+ FloatPoint mnOrigin;
+ double mndx, mndy;
+ double mnOrientation;
+
+ sal_uInt32 mnX, mnY;
+ long mnLocalColorPrecision;
+ sal_uInt32 mnCompressionMode;
+ CGMBitmapDescriptor() :
+ mpBuf ( NULL ),
+ mpBitmap ( NULL ),
+ mpAcc ( NULL ),
+ mbStatus ( sal_False ),
+ mbVMirror ( sal_False ),
+ mbHMirror ( sal_False ) { };
+ ~CGMBitmapDescriptor()
+ {
+ if ( mpAcc )
+ mpBitmap->ReleaseAccess( mpAcc );
+ if ( mpBitmap )
+ delete mpBitmap;
+ };
+};
+
+class CGMBitmap
+{
+ CGM* mpCGM;
+ CGMBitmapDescriptor* pCGMBitmapDescriptor;
+ sal_Bool ImplGetDimensions( CGMBitmapDescriptor& );
+ void ImplSetCurrentPalette( CGMBitmapDescriptor& );
+ void ImplGetBitmap( CGMBitmapDescriptor& );
+ void ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& rDest );
+ public:
+ CGMBitmap( CGM& rCGM );
+ ~CGMBitmap();
+ CGMBitmapDescriptor* GetBitmap();
+ CGMBitmap* GetNext();
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx
new file mode 100644
index 000000000000..c59ab8002967
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bundles.cxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "bundles.hxx"
+
+#include <vcl/salbtype.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+
+Bundle& Bundle::operator=( Bundle& rSource )
+{
+ mnColor = rSource.mnColor;
+ mnBundleIndex = rSource.mnBundleIndex;
+ return *this;
+};
+
+// ---------------------------------------------------------------
+
+void Bundle::SetColor( sal_uInt32 nColor )
+{
+ mnColor = nColor;
+}
+
+sal_uInt32 Bundle::GetColor()
+{
+ return mnColor;
+}
+
+// ---------------------------------------------------------------
+
+LineBundle& LineBundle::operator=( LineBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eLineType = rSource.eLineType;
+ nLineWidth = rSource.nLineWidth;
+ return *this;
+};
+
+MarkerBundle& MarkerBundle::operator=( MarkerBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eMarkerType = rSource.eMarkerType;
+ nMarkerSize = rSource.nMarkerSize;
+ return *this;
+};
+
+EdgeBundle& EdgeBundle::operator=( EdgeBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eEdgeType = rSource.eEdgeType;
+ nEdgeWidth = rSource.nEdgeWidth;
+ return *this;
+};
+
+TextBundle& TextBundle::operator=( TextBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ nTextFontIndex = rSource.nTextFontIndex;
+ eTextPrecision = rSource.eTextPrecision;
+ nCharacterExpansion = rSource.nCharacterExpansion;
+ nCharacterSpacing = rSource.nCharacterSpacing;
+ return *this;
+};
+
+FillBundle& FillBundle::operator=( FillBundle& rSource )
+{
+ SetIndex( rSource.GetIndex() );
+ eFillInteriorStyle = rSource.eFillInteriorStyle;
+ nFillPatternIndex = rSource.nFillPatternIndex;
+ nFillHatchIndex = rSource.nFillHatchIndex;
+ return *this;
+};
+
+// ---------------------------------------------------------------
+
+FontEntry::FontEntry() :
+ pFontName ( NULL ),
+ eCharSetType ( CST_CCOMPLETE ),
+ pCharSetValue ( NULL ),
+ nFontType ( 0 )
+{
+}
+
+FontEntry::~FontEntry()
+{
+ delete pFontName;
+ delete pCharSetValue;
+}
+
+// ---------------------------------------------------------------
+
+CGMFList::CGMFList() :
+ nFontNameCount ( 0 ),
+ nCharSetCount ( 0 ),
+ nFontsAvailable ( 0 )
+{
+ aFontEntryList.Clear();
+}
+
+CGMFList::~CGMFList()
+{
+ ImplDeleteList();
+}
+
+// ---------------------------------------------------------------
+
+CGMFList& CGMFList::operator=( CGMFList& rSource )
+{
+ ImplDeleteList();
+ nFontsAvailable = rSource.nFontsAvailable;
+ nFontNameCount = rSource.nFontNameCount;
+ nCharSetCount = rSource.nCharSetCount;
+ FontEntry* pPtr = (FontEntry*)rSource.aFontEntryList.First();
+ while( pPtr )
+ {
+ FontEntry* pCFontEntry = new FontEntry;
+ if ( pPtr->pFontName )
+ {
+ sal_uInt32 nSize = strlen( (const char*)pPtr->pFontName ) + 1;
+ pCFontEntry->pFontName = new sal_Int8[ nSize ];
+ memcpy( pCFontEntry->pFontName, pPtr->pFontName, nSize );
+ }
+ if ( pPtr->pCharSetValue )
+ {
+ sal_uInt32 nSize = strlen( (const char*)pPtr->pCharSetValue ) + 1;
+ pCFontEntry->pCharSetValue = new sal_Int8[ nSize ];
+ memcpy( pCFontEntry->pCharSetValue, pPtr->pCharSetValue, nSize );
+ }
+ pCFontEntry->eCharSetType = pPtr->eCharSetType;
+ pCFontEntry->nFontType = pPtr->nFontType;
+ aFontEntryList.Insert( pCFontEntry, LIST_APPEND );
+ pPtr = (FontEntry*)rSource.aFontEntryList.Next();
+ }
+ return *this;
+}
+
+// ---------------------------------------------------------------
+
+FontEntry* CGMFList::GetFontEntry( sal_uInt32 nIndex )
+{
+ sal_uInt32 nInd = nIndex;
+ if ( nInd )
+ nInd--;
+ return (FontEntry*)aFontEntryList.GetObject( nInd );
+}
+
+// ---------------------------------------------------------------
+
+static sal_Int8* ImplSearchEntry( sal_Int8* pSource, sal_Int8* pDest, sal_uInt32 nComp, sal_uInt32 nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+void CGMFList::InsertName( sal_uInt8* pSource, sal_uInt32 nSize )
+{
+ FontEntry* pFontEntry;
+ if ( nFontsAvailable == nFontNameCount )
+ {
+ nFontsAvailable++;
+ pFontEntry = new FontEntry;
+ aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+ }
+ else
+ {
+ pFontEntry = (FontEntry*)aFontEntryList.GetObject( nFontNameCount );
+ }
+ nFontNameCount++;
+ sal_Int8* pBuf = new sal_Int8[ nSize ];
+ memcpy( pBuf, pSource, nSize );
+ sal_Int8* pFound = ImplSearchEntry( pBuf, (sal_Int8*)"ITALIC", nSize, 6 );
+ if ( pFound )
+ {
+ pFontEntry->nFontType |= 1;
+ sal_uInt32 nPrev = ( pFound - pBuf );
+ sal_uInt32 nToCopyOfs = 6;
+ if ( nPrev && ( pFound[ -1 ] == '-' || pFound[ -1 ] == ' ' ) )
+ {
+ nPrev--;
+ pFound--;
+ nToCopyOfs++;
+ }
+ sal_uInt32 nToCopy = nSize - nToCopyOfs - nPrev;
+ if ( nToCopy )
+ {
+ memcpy( pFound, pFound + nToCopyOfs, nToCopy );
+ }
+ nSize -= nToCopyOfs;
+ }
+ pFound = ImplSearchEntry( pBuf, (sal_Int8*)"BOLD", nSize, 4 );
+ if ( pFound )
+ {
+ pFontEntry->nFontType |= 2;
+
+ sal_uInt32 nPrev = ( pFound - pBuf );
+ sal_uInt32 nToCopyOfs = 4;
+ if ( nPrev && ( pFound[ -1 ] == '-' || pFound[ -1 ] == ' ' ) )
+ {
+ nPrev--;
+ pFound--;
+ nToCopyOfs++;
+ }
+ sal_uInt32 nToCopy = nSize - nToCopyOfs - nPrev;
+ if ( nToCopy )
+ {
+ memcpy( pFound, pFound + nToCopyOfs, nToCopy );
+ }
+ nSize -= nToCopyOfs;
+ }
+ pFontEntry->pFontName = new sal_Int8[ nSize + 1 ];
+ pFontEntry->pFontName[ nSize ] = 0;
+ memcpy( pFontEntry->pFontName, pBuf, nSize );
+ delete[] pBuf;
+}
+
+//--------------------------------------------------------------------------
+
+void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_uInt32 nSize )
+{
+ FontEntry* pFontEntry;
+ if ( nFontsAvailable == nCharSetCount )
+ {
+ nFontsAvailable++;
+ pFontEntry = new FontEntry;
+ aFontEntryList.Insert( pFontEntry, LIST_APPEND );
+ }
+ else
+ {
+ pFontEntry = (FontEntry*)aFontEntryList.GetObject( nCharSetCount );
+ }
+ nCharSetCount++;
+ pFontEntry->eCharSetType = eCharSetType;
+ pFontEntry->pCharSetValue = new sal_Int8[ nSize + 1 ];
+ pFontEntry->pCharSetValue[ nSize ] = 0;
+ memcpy( pFontEntry->pCharSetValue, pSource , nSize );
+}
+
+// ---------------------------------------------------------------
+
+void CGMFList::ImplDeleteList()
+{
+ FontEntry* pFontEntry = (FontEntry*)aFontEntryList.First();
+ while( pFontEntry )
+ {
+ delete pFontEntry;
+ pFontEntry = (FontEntry*)aFontEntryList.Next();
+ }
+ aFontEntryList.Clear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx b/filter/source/graphicfilter/icgm/bundles.hxx
new file mode 100644
index 000000000000..837726bd88ab
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_BUNDLES_HXX_
+#define CGM_BUNDLES_HXX_
+
+#include <sal/types.h>
+#include "cgmtypes.hxx"
+#include <tools/list.hxx>
+#include <vcl/salbtype.hxx>
+
+// ---------------------------------------------------------------
+
+class CGM;
+
+class Bundle
+{
+
+ long mnBundleIndex;
+ sal_uInt32 mnColor;
+
+public:
+ void SetColor( sal_uInt32 nColor ) ;
+ sal_uInt32 GetColor() ;
+ long GetIndex() const { return mnBundleIndex; } ;
+ void SetIndex( long nBundleIndex ) { mnBundleIndex = nBundleIndex; } ;
+
+ Bundle() {};
+ virtual Bundle* Clone() { return new Bundle( *this ); };
+ Bundle& operator=( Bundle& rBundle );
+
+ virtual ~Bundle() {} ;
+};
+
+// ---------------------------------------------------------------
+
+class LineBundle : public Bundle
+{
+public:
+
+ LineType eLineType;
+ double nLineWidth;
+
+ LineBundle() {};
+ virtual Bundle* Clone() { return new LineBundle( *this ); };
+ LineBundle& operator=( LineBundle& rLineBundle );
+ virtual ~LineBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class MarkerBundle : public Bundle
+{
+public:
+
+ MarkerType eMarkerType;
+ double nMarkerSize;
+
+ MarkerBundle() {};
+ virtual Bundle* Clone() { return new MarkerBundle( *this ); } ;
+ MarkerBundle& operator=( MarkerBundle& rMarkerBundle );
+ virtual ~MarkerBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class EdgeBundle : public Bundle
+{
+public:
+
+ EdgeType eEdgeType;
+ double nEdgeWidth;
+
+ EdgeBundle() {};
+ virtual Bundle* Clone() { return new EdgeBundle( *this ); } ;
+ EdgeBundle& operator=( EdgeBundle& rEdgeBundle );
+ virtual ~EdgeBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class TextBundle : public Bundle
+{
+public:
+
+ sal_uInt32 nTextFontIndex;
+ TextPrecision eTextPrecision;
+ double nCharacterExpansion;
+ double nCharacterSpacing;
+
+ TextBundle() {};
+ virtual Bundle* Clone() { return new TextBundle( *this ); } ;
+ TextBundle& operator=( TextBundle& rTextBundle );
+ virtual ~TextBundle() {};
+};
+
+// ---------------------------------------------------------------
+
+class FillBundle : public Bundle
+{
+public:
+
+ FillInteriorStyle eFillInteriorStyle;
+ long nFillPatternIndex;
+ long nFillHatchIndex;
+
+ FillBundle() {};
+ virtual Bundle* Clone() { return new FillBundle( *this ); } ;
+ FillBundle& operator=( FillBundle& rFillBundle );
+ virtual ~FillBundle() {};
+};
+
+
+// ---------------------------------------------------------------
+
+class FontEntry
+{
+public:
+ sal_Int8* pFontName;
+ CharSetType eCharSetType;
+ sal_Int8* pCharSetValue;
+ sal_uInt32 nFontType; // bit 0 = 1 -> Italic,
+ // bit 1 = 1 -> Bold
+
+ FontEntry();
+ FontEntry* Clone() { return new FontEntry( *this ); } ;
+ ~FontEntry();
+};
+
+// ---------------------------------------------------------------
+
+class CGMFList
+{
+ sal_uInt32 nFontNameCount;
+ sal_uInt32 nCharSetCount;
+ List aFontEntryList;
+ void ImplDeleteList();
+public:
+ sal_uInt32 nFontsAvailable;
+ FontEntry* GetFontEntry( sal_uInt32 );
+ void InsertName( sal_uInt8* pSource, sal_uInt32 nSize );
+ void InsertCharSet( CharSetType, sal_uInt8* pSource, sal_uInt32 nSize );
+ CGMFList();
+ CGMFList& operator=( CGMFList& rFontList );
+ ~CGMFList();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
new file mode 100644
index 000000000000..b51972dc967b
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -0,0 +1,930 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <unotools/ucbstreamhelper.hxx>
+
+#define CGM_BREAK_ACTION 0xffffffff
+#include <osl/endian.h>
+#include <vcl/virdev.hxx>
+#include <vcl/graph.hxx>
+#include <tools/stream.hxx>
+#include <chart.hxx>
+#include <main.hxx>
+#include <elements.hxx>
+#include <outact.hxx>
+
+using namespace ::com::sun::star;
+
+// ---------------------------------------------------------------
+
+void CGM::ImplCGMInit()
+{
+ mbIsFinished = mbPicture = mbMetaFile = mbPictureBody = sal_False;
+
+ mnActCount = 0;
+ mnOutdx = 28000;
+ mnOutdy = 21000;
+
+ mpBuf = NULL;
+ mpChart = NULL;
+ mpBitmapInUse = NULL;
+
+ pCopyOfE = new CGMElements( *this );
+ pElement = new CGMElements( *this );
+}
+
+// ---------------------------------------------------------------
+
+#ifdef CGM_EXPORT_IMPRESS
+
+CGM::CGM( sal_uInt32 nMode, uno::Reference< frame::XModel > & rModel ) :
+ mpGraphic ( NULL ),
+ mpCommentOut ( NULL ),
+ mbStatus ( sal_True ),
+ mpOutAct ( new CGMImpressOutAct( *this, rModel ) ),
+ mnMode ( nMode )
+{
+ mnMode |= CGM_EXPORT_IMPRESS;
+ ImplCGMInit();
+}
+#endif
+
+// ---------------------------------------------------------------
+
+void CGM::ImplComment( sal_uInt32 Level, const char* Description )
+{
+ if ( mpCommentOut )
+ {
+ if ( Level == CGM_DESCRIPTION )
+ {
+ *mpCommentOut << " " << Description << "\n";
+ }
+ else
+ {
+ sal_Int8 nFirst, nSecond, i, nCount = 0;
+ if ( mnActCount < 10000 )
+ nCount++;
+ if ( mnActCount < 1000 )
+ nCount++;
+ if ( mnActCount < 100 )
+ nCount++;
+ if ( mnActCount < 10 )
+ nCount++;
+ for ( i = 0; i <= nCount; i++ )
+ *mpCommentOut << " ";
+ mpCommentOut->WriteNumber( mnActCount );
+
+ switch( Level & 0xff )
+ {
+ case CGM_UNKNOWN_LEVEL :
+ *mpCommentOut << " L?";
+ break;
+ case CGM_UNKNOWN_COMMAND :
+ *mpCommentOut << " UNKNOWN COMMAND";
+ break;
+ case CGM_GDSF_ONLY :
+ *mpCommentOut << " LI";
+ break;
+ default:
+ *mpCommentOut << " L";
+ mpCommentOut->WriteNumber( Level & 0xff );
+ break;
+ }
+ *mpCommentOut << " C";
+ mpCommentOut->WriteNumber( mnElementClass );
+ *mpCommentOut << " ID-0x";
+ nFirst = ( mnElementID > 0x9F ) ? (sal_Int8)( mnElementID >> 4 ) + 'A' - 10: (sal_Int8)( mnElementID >> 4 ) + '0';
+ nSecond = ( ( mnElementID & 15 ) > 9 ) ? (sal_Int8)( mnElementID & 15 ) + 'A' - 10 : (sal_Int8)( mnElementID & 15 ) + '0';
+ *mpCommentOut << nFirst << nSecond;
+ *mpCommentOut << " Size";
+ nCount = 1;
+ if ( mnElementSize < 1000000 )
+ nCount++;
+ if ( mnElementSize < 100000 )
+ nCount++;
+ if ( mnElementSize < 10000 )
+ nCount++;
+ if ( mnElementSize < 1000 )
+ nCount++;
+ if ( mnElementSize < 100 )
+ nCount++;
+ if ( mnElementSize < 10 )
+ nCount++;
+ for ( i = 0; i < nCount; i++ )
+ *mpCommentOut << " ";
+ mpCommentOut->WriteNumber( mnElementSize );
+ *mpCommentOut << " " << Description << "\n";
+ }
+ }
+}
+
+// ---------------------------------------------------------------
+
+CGM::~CGM()
+{
+
+#ifdef CGM_EXPORT_META
+ if ( mpGraphic )
+ {
+ mpGDIMetaFile->Stop();
+ mpGDIMetaFile->SetPrefMapMode( MapMode() );
+ mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) );
+ delete mpVirDev;
+ *mpGraphic = Graphic( *mpGDIMetaFile );
+ }
+#endif
+ sal_Int8* pBuf = (sal_Int8*)maDefRepList.First();
+ while( pBuf )
+ {
+ delete pBuf;
+ pBuf = (sal_Int8*)maDefRepList.Next();
+ }
+ maDefRepList.Clear();
+ delete mpBitmapInUse;
+ delete mpCommentOut;
+ delete mpChart;
+ delete mpOutAct;
+ delete pCopyOfE;
+ delete pElement;
+ delete [] mpBuf;
+};
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::GetBackGroundColor()
+{
+ return ( pElement ) ? pElement->aColorTable[ 0 ] : 0;
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetUI16( sal_uInt32 /*nAlign*/ )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += 2;
+ return ( pSource[ 0 ] << 8 ) + pSource[ 1 ];
+};
+
+// ---------------------------------------------------------------
+
+sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision )
+{
+ return (sal_uInt8)( nSource >> ( ( nPrecision - 1 ) << 3 ) );
+};
+
+// ---------------------------------------------------------------
+
+long CGM::ImplGetI( sal_uInt32 nPrecision )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += nPrecision;
+ switch( nPrecision )
+ {
+ case 1 :
+ {
+ return (char)*pSource;
+ }
+
+ case 2 :
+ {
+ return (sal_Int16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] );
+ }
+
+ case 3 :
+ {
+ return ( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | pSource[ 2 ] << 8 ) >> 8;
+ }
+ case 4:
+ {
+ return (sal_Int32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) );
+ }
+ default:
+ mbStatus = sal_False;
+ return 0;
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision )
+{
+ sal_uInt8* pSource = mpSource + mnParaSize;
+ mnParaSize += nPrecision;
+ switch( nPrecision )
+ {
+ case 1 :
+ return (sal_Int8)*pSource;
+ case 2 :
+ {
+ return (sal_uInt16)( ( pSource[ 0 ] << 8 ) | pSource[ 1 ] );
+ }
+ case 3 :
+ {
+ return ( pSource[ 0 ] << 16 ) | ( pSource[ 1 ] << 8 ) | pSource[ 2 ];
+ }
+ case 4:
+ {
+ return (sal_uInt32)( ( pSource[ 0 ] << 24 ) | ( pSource[ 1 ] << 16 ) | ( pSource[ 2 ] << 8 ) | ( pSource[ 3 ] ) );
+ }
+ default:
+ mbStatus = sal_False;
+ return 0;
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetSwitch4( sal_uInt8* pSource, sal_uInt8* pDest )
+{
+ for ( int i = 0; i < 4; i++ )
+ {
+ pDest[ i ] = pSource[ i ^ 3 ]; // Little Endian <-> Big Endian switch
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetSwitch8( sal_uInt8* pSource, sal_uInt8* pDest )
+{
+ for ( int i = 0; i < 8; i++ )
+ {
+ pDest[ i ] = pSource[ i ^ 7 ]; // Little Endian <-> Big Endian switch
+ }
+}
+
+// ---------------------------------------------------------------
+
+double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize )
+{
+ void* pPtr;
+ sal_uInt8 aBuf[8];
+ sal_Bool bCompatible;
+ double nRetValue;
+ double fDoubleBuf;
+ float fFloatBuf;
+
+#ifdef OSL_BIGENDIAN
+ bCompatible = sal_True;
+#else
+ bCompatible = sal_False;
+#endif
+ if ( bCompatible )
+ pPtr = mpSource + mnParaSize;
+ else
+ {
+ if ( nRealSize == 4 )
+ ImplGetSwitch4( mpSource + mnParaSize, &aBuf[0] );
+ else
+ ImplGetSwitch8( mpSource + mnParaSize, &aBuf[0] );
+ pPtr = &aBuf;
+ }
+ if ( eRealPrecision == RP_FLOAT )
+ {
+ if ( nRealSize == 4 )
+ {
+ memcpy( (void*)&fFloatBuf, pPtr, 4 );
+ nRetValue = (double)fFloatBuf;
+ }
+ else
+ {
+ memcpy( (void*)&fDoubleBuf, pPtr, 8 );
+ nRetValue = fDoubleBuf;
+ }
+ }
+ else // ->RP_FIXED
+ {
+ long nVal;
+ int nSwitch = ( bCompatible ) ? 0 : 1 ;
+ if ( nRealSize == 4 )
+ {
+ sal_uInt16* pShort = (sal_uInt16*)pPtr;
+ nVal = pShort[ nSwitch ];
+ nVal <<= 16;
+ nVal |= pShort[ nSwitch ^ 1 ];
+ nRetValue = (double)nVal;
+ nRetValue /= 65536;
+ }
+ else
+ {
+ long* pLong = (long*)pPtr;
+ nRetValue = (double)abs( pLong[ nSwitch ] );
+ nRetValue *= 65536;
+ nVal = (sal_uInt32)( pLong[ nSwitch ^ 1 ] );
+ nVal >>= 16;
+ nRetValue += (double)nVal;
+ if ( pLong[ nSwitch ] < 0 )
+ {
+ nRetValue -= nRetValue;
+ }
+ nRetValue /= 65536;
+ }
+ }
+ mnParaSize += nRealSize;
+ return nRetValue;
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetPointSize()
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ return pElement->nVDCIntegerPrecision << 1;
+ else
+ return pElement->nVDCRealSize << 1;
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetIX()
+{
+ return ( ( ImplGetI( pElement->nVDCIntegerPrecision ) + mnVDCXadd ) * mnVDCXmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetFX()
+{
+ return ( ( ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ) + mnVDCXadd ) * mnVDCXmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetIY()
+{
+ return ( ( ImplGetI( pElement->nVDCIntegerPrecision ) + mnVDCYadd ) * mnVDCYmul );
+}
+
+// ---------------------------------------------------------------
+
+inline double CGM::ImplGetFY()
+{
+ return ( ( ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize ) + mnVDCYadd ) * mnVDCYmul );
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetPoint( FloatPoint& rFloatPoint, sal_Bool bMap )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatPoint.X = ImplGetIX();
+ rFloatPoint.Y = ImplGetIY();
+ }
+ else // ->floating points
+ {
+ rFloatPoint.X = ImplGetFX();
+ rFloatPoint.Y = ImplGetFY();
+ }
+ if ( bMap )
+ ImplMapPoint( rFloatPoint );
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetRectangle( FloatRect& rFloatRect, sal_Bool bMap )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatRect.Left = ImplGetIX();
+ rFloatRect.Bottom = ImplGetIY();
+ rFloatRect.Right = ImplGetIX();
+ rFloatRect.Top = ImplGetIY();
+ }
+ else // ->floating points
+ {
+ rFloatRect.Left = ImplGetFX();
+ rFloatRect.Bottom = ImplGetFY();
+ rFloatRect.Right = ImplGetFX();
+ rFloatRect.Top = ImplGetFY();
+ }
+ if ( bMap )
+ {
+ ImplMapX( rFloatRect.Left );
+ ImplMapX( rFloatRect.Right );
+ ImplMapY( rFloatRect.Top );
+ ImplMapY( rFloatRect.Bottom );
+ rFloatRect.Justify();
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetRectangleNS( FloatRect& rFloatRect )
+{
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ rFloatRect.Left = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Bottom = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Right = ImplGetI( pElement->nVDCIntegerPrecision );
+ rFloatRect.Top = ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ else // ->floating points
+ {
+ rFloatRect.Left = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Bottom = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Right = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ rFloatRect.Top = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_uInt32 CGM::ImplGetBitmapColor( sal_Bool bDirect )
+{
+ // the background color is always a direct color
+
+ sal_uInt32 nTmp;
+ if ( ( pElement->eColorSelectionMode == CSM_DIRECT ) || bDirect )
+ {
+ sal_uInt32 nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ sal_uInt32 nDiff = pElement->nColorValueExtent[ 3 ] - pElement->nColorValueExtent[ 0 ] + 1;
+
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 0 ] ) << 8 ) / nDiff;
+ nTmp = nColor << 16 & 0xff0000;
+
+ nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ nDiff = pElement->nColorValueExtent[ 4 ] - pElement->nColorValueExtent[ 1 ] + 1;
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 1 ] ) << 8 ) / nDiff;
+ nTmp |= nColor << 8 & 0xff00;
+
+ nColor = ImplGetByte( ImplGetUI( pElement->nColorPrecision ), 1 );
+ nDiff = pElement->nColorValueExtent[ 5 ] - pElement->nColorValueExtent[ 2 ] + 1;
+ if ( !nDiff )
+ nDiff++;
+ nColor = ( ( nColor - pElement->nColorValueExtent[ 2 ] ) << 8 ) / nDiff;
+ nTmp |= (sal_uInt8)nColor;
+ }
+ else
+ {
+ sal_uInt32 nIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ nTmp = pElement->aColorTable[ (sal_uInt8)( nIndex ) ] ;
+ }
+ return nTmp;
+}
+
+// ---------------------------------------------------------------
+
+// call this function each time after the mapmode settings has been changed
+void CGM::ImplSetMapMode()
+{
+ int nAngReverse = 1;
+ mnVDCdx = pElement->aVDCExtent.Right - pElement->aVDCExtent.Left;
+
+ mnVDCXadd = -pElement->aVDCExtent.Left;
+ mnVDCXmul = 1;
+ if ( mnVDCdx < 0 )
+ {
+ nAngReverse ^= 1;
+ mnVDCdx = -mnVDCdx;
+ mnVDCXmul = -1;
+ }
+
+ mnVDCdy = pElement->aVDCExtent.Bottom - pElement->aVDCExtent.Top;
+ mnVDCYadd = -pElement->aVDCExtent.Top;
+ mnVDCYmul = 1;
+ if ( mnVDCdy < 0 )
+ {
+ nAngReverse ^= 1;
+ mnVDCdy = -mnVDCdy;
+ mnVDCYmul = -1;
+ }
+ if ( nAngReverse )
+ mbAngReverse = sal_True;
+ else
+ mbAngReverse = sal_False;
+
+ double fQuo1 = mnVDCdx / mnVDCdy;
+ double fQuo2 = mnOutdx / mnOutdy;
+ if ( fQuo2 < fQuo1 )
+ {
+ mnXFraction = mnOutdx / mnVDCdx;
+ mnYFraction = mnOutdy * ( fQuo2 / fQuo1 ) / mnVDCdy;
+ }
+ else
+ {
+ mnXFraction = mnOutdx * ( fQuo1 / fQuo2 ) / mnVDCdx;
+ mnYFraction = mnOutdy / mnVDCdy;
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapDouble( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= ( mnXFraction + mnYFraction ) / 2;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= ( mnXFraction + mnYFraction ) / 2;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapX( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= mnXFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= mnXFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+
+// ---------------------------------------------------------------
+
+void CGM::ImplMapY( double& nNumb )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ nNumb *= mnYFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+// nNumb *= ( 100 * pElement->nDeviceViewPortScale );
+ nNumb *= mnYFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ nNumb = -nNumb;
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+
+// ---------------------------------------------------------------
+
+// convert a point to the current VC mapmode (1/100TH mm)
+void CGM::ImplMapPoint( FloatPoint& rFloatPoint )
+{
+ if ( pElement->eDeviceViewPortMap == DVPM_FORCED )
+ {
+ // point is 1mm * ScalingFactor
+ switch ( pElement->eDeviceViewPortMode )
+ {
+ case DVPM_FRACTION :
+ {
+ rFloatPoint.X *= mnXFraction;
+ rFloatPoint.Y *= mnYFraction;
+ }
+ break;
+
+ case DVPM_METRIC :
+ {
+ rFloatPoint.X *= mnXFraction;
+ rFloatPoint.Y *= mnYFraction;
+ if ( pElement->nDeviceViewPortScale < 0 )
+ {
+ rFloatPoint.X = -rFloatPoint.X;
+ rFloatPoint.Y = -rFloatPoint.Y;
+ }
+ }
+ break;
+
+ case DVPM_DEVICE :
+ {
+
+ }
+ break;
+
+ default:
+
+ break;
+ }
+ }
+ else
+ {
+
+
+ }
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass()
+{
+#ifdef CGM_USER_BREAKPOINT
+#ifdef WNT
+ if ( mnActCount == CGM_BREAK_ACTION )
+ _asm int 0x3;
+#endif
+#endif
+ switch ( mnElementClass )
+ {
+ case 0 : ImplDoClass0(); break;
+ case 1 : ImplDoClass1(); break;
+ case 2 : ImplDoClass2(); break;
+ case 3 : ImplDoClass3(); break;
+ case 4 :
+ {
+ ImplDoClass4();
+ mnAct4PostReset = 0;
+ }
+ break;
+ case 5 : ImplDoClass5(); break;
+ case 6 : ImplDoClass6(); break;
+ case 7 : ImplDoClass7(); break;
+ case 8 : ImplDoClass8(); break;
+ case 9 : ImplDoClass9(); break;
+ case 15 :ImplDoClass15(); break;
+ default : ComOut( CGM_UNKNOWN_COMMAND, "" ); break;
+ }
+ mnActCount++;
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDefaultReplacement()
+{
+ sal_uInt8* pBuf = (sal_uInt8*)maDefRepList.First();
+ if ( pBuf )
+ {
+ sal_uInt32 nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.First();
+ sal_uInt32 nOldEscape = mnEscape;
+ sal_uInt32 nOldElementClass = mnElementClass;
+ sal_uInt32 nOldElementID = mnElementID;
+ sal_uInt32 nOldElementSize = mnElementSize;
+ sal_uInt8* pOldBuf = mpSource;
+ while( pBuf )
+ {
+ sal_uInt32 nCount = 0;
+ while ( mbStatus && ( nCount < nElementSize ) )
+ {
+ mpSource = pBuf + nCount;
+ mnParaSize = 0;
+ mnEscape = ImplGetUI16();
+ mnElementClass = mnEscape >> 12;
+ mnElementID = ( mnEscape & 0x0fe0 ) >> 5;
+ mnElementSize = mnEscape & 0x1f;
+ if ( mnElementSize == 31 )
+ {
+ mnElementSize = ImplGetUI16();
+ }
+ nCount += mnParaSize;
+ mnParaSize = 0;
+ mpSource = pBuf + nCount;
+ if ( mnElementSize & 1 )
+ nCount++;
+ nCount += mnElementSize;
+ if ( ( mnElementClass != 1 ) || ( mnElementID != 0xc ) ) // rekursion hier nicht moeglich!!
+ ImplDoClass();
+ }
+ nElementSize = (sal_uInt32)(sal_uIntPtr)maDefRepSizeList.Next();
+ pBuf = (sal_uInt8*)maDefRepList.Next();
+ }
+ mnEscape = nOldEscape;
+ mnElementClass = nOldElementClass;
+ mnElementID = nOldElementID;
+ mnParaSize = mnElementSize = nOldElementSize;
+ mpSource = pOldBuf;
+ }
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGM::Write( SvStream& rIStm )
+{
+ if ( !mpBuf )
+ mpBuf = new sal_uInt8[ 0xffff ];
+
+ mnParaSize = 0;
+ mpSource = mpBuf;
+ rIStm.Read( mpSource, 2 );
+ mnEscape = ImplGetUI16();
+ mnElementClass = mnEscape >> 12;
+ mnElementID = ( mnEscape & 0x0fe0 ) >> 5;
+ mnElementSize = mnEscape & 0x1f;
+
+ if ( mnElementSize == 31 )
+ {
+ rIStm.Read( mpSource + mnParaSize, 2 );
+ mnElementSize = ImplGetUI16();
+ }
+ mnParaSize = 0;
+ if ( mnElementSize )
+ rIStm.Read( mpSource + mnParaSize, mnElementSize );
+
+ if ( mnElementSize & 1 )
+ rIStm.SeekRel( 1 );
+ ImplDoClass();
+
+
+#ifdef CGM_USER_BREAKPOINT
+#ifdef WNT
+ if ( !mbStatus || mnParaSize && ( mnElementSize != mnParaSize ) )
+ _asm int 0x3;
+#endif
+#endif
+
+ return mbStatus;
+};
+
+// ---------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rOStm, CGM& /*rCGM*/ )
+{
+
+ return rOStm;
+};
+
+// ---------------------------------------------------------------
+
+
+
+//================== GraphicImport - die exportierte Funktion ================
+
+extern "C" sal_uInt32 __LOADONCALLAPI ImportCGM( String& rFileName, uno::Reference< frame::XModel > & rXModel, sal_uInt32 nMode, void* pProgressBar )
+{
+
+ sal_uInt32 nStatus = 0; // retvalue == 0 -> ERROR
+ // == 0xffrrggbb -> background color in the lower 24 bits
+ sal_Bool bProgressBar = sal_False;
+
+ if( rXModel.is() )
+ {
+ CGM* pCGM= NULL;
+
+ try
+ {
+ pCGM = new CGM( nMode, rXModel );
+ if ( pCGM && pCGM->IsValid() )
+ {
+ if ( nMode & CGM_IMPORT_CGM )
+ {
+ SvStream* pIn = ::utl::UcbStreamHelper::CreateStream( rFileName, STREAM_READ );
+ if ( pIn )
+ {
+ pIn->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ pIn->Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nInSize = pIn->Tell();
+ pIn->Seek( 0 );
+
+#ifdef CGM_EXPORT_IMPRESS
+ uno::Reference< task::XStatusIndicator > aXStatInd;
+ sal_uInt32 nNext = 0;
+ sal_uInt32 nAdd = nInSize / 20;
+ if ( pProgressBar )
+ aXStatInd = *(uno::Reference< task::XStatusIndicator > *)pProgressBar;
+ bProgressBar = aXStatInd.is();
+ if ( bProgressBar )
+ aXStatInd->start( rtl::OUString::createFromAscii("CGM Import"), nInSize );
+#endif
+
+ while ( pCGM->IsValid() && ( pIn->Tell() < nInSize ) && !pCGM->IsFinished() )
+ {
+
+#ifdef CGM_EXPORT_IMPRESS
+
+
+ if ( bProgressBar )
+ {
+ sal_uInt32 nCurrentPos = pIn->Tell();
+ if ( nCurrentPos >= nNext )
+ {
+ aXStatInd->setValue( nCurrentPos );
+ nNext = nCurrentPos + nAdd;
+ }
+ }
+#endif
+
+ if ( pCGM->Write( *pIn ) == sal_False )
+ break;
+ }
+ if ( pCGM->IsValid() )
+ {
+ nStatus = pCGM->GetBackGroundColor() | 0xff000000;
+ }
+#ifdef CGM_EXPORT_IMPRESS
+ if ( bProgressBar )
+ aXStatInd->end();
+#endif
+ delete pIn;
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ nStatus = 0;
+ }
+ delete pCGM;
+ }
+ return nStatus;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
new file mode 100644
index 000000000000..727582d83c62
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_HXX_
+#define CGM_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+
+// ---------------------------------------------------------------
+#undef CGM_USER_BREAKPOINT
+
+#define CGM_IMPORT_CGM 0x00000001
+
+#define CGM_EXPORT_IMPRESS 0x00000100
+#define CGM_EXPORT_META 0x00000200
+//#define CGM_EXPORT_COMMENT 0x00000400
+
+// ---------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+#include <tools/list.hxx>
+#include "cgmtypes.hxx"
+
+// ---------------------------------------------------------------
+
+class List;
+class Bundle;
+class Graphic;
+class SvStream;
+class CGMChart;
+class CGMBitmap;
+class CGMOutAct;
+class CGMElements;
+class BitmapColor;
+class GDIMetaFile;
+class VirtualDevice;
+class CGMBitmapDescriptor;
+
+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
+ double mnOutdy; // auf das gemappt wird
+ double mnVDCXadd;
+ double mnVDCYadd;
+ double mnVDCXmul;
+ double mnVDCYmul;
+ double mnVDCdx;
+ double mnVDCdy;
+ double mnXFraction;
+ double mnYFraction;
+ sal_Bool mbAngReverse; // AngularDirection
+
+ Graphic* mpGraphic; // ifdef CGM_EXPORT_META
+ SvStream* mpCommentOut; // ifdef CGM_EXPORT_COMMENT
+
+ sal_Bool mbStatus;
+ sal_Bool mbMetaFile;
+ sal_Bool mbIsFinished;
+ sal_Bool mbPicture;
+ sal_Bool mbPictureBody;
+ sal_Bool mbFigure;
+ sal_Bool mbFirstOutPut;
+ sal_uInt32 mnAct4PostReset;
+ CGMBitmap* mpBitmapInUse;
+ CGMChart* mpChart; // if sal_True->"SHWSLIDEREC"
+ // otherwise "BEGINPIC" commands
+ // controlls page inserting
+ CGMElements* pElement;
+ CGMElements* pCopyOfE;
+ CGMOutAct* mpOutAct;
+ List maDefRepList;
+ List maDefRepSizeList;
+
+ sal_uInt8* mpSource; // source buffer that is not increased
+ // ( instead use mnParaCount to index )
+ sal_uInt32 mnParaSize; // actual parameter size which has been done so far
+ sal_uInt32 mnActCount; // increased by each action
+ sal_uInt8* mpBuf; // source stream operation -> then this is allocated for
+ // the temp input buffer
+
+ sal_uInt32 mnMode; // source description
+ sal_uInt32 mnEscape; //
+ sal_uInt32 mnElementClass; //
+ sal_uInt32 mnElementID; //
+ sal_uInt32 mnElementSize; // full parameter size for the latest action
+
+ void ImplCGMInit();
+ sal_uInt32 ImplGetUI16( sal_uInt32 nAlign = 0 );
+ sal_uInt8 ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision );
+ long ImplGetI( sal_uInt32 nPrecision );
+ sal_uInt32 ImplGetUI( sal_uInt32 nPrecision );
+ void ImplGetSwitch4( sal_uInt8* pSource, sal_uInt8* pDest );
+ void ImplGetSwitch8( sal_uInt8* pSource, sal_uInt8* pDest );
+ double ImplGetFloat( RealPrecision, sal_uInt32 nRealSize );
+ sal_uInt32 ImplGetBitmapColor( sal_Bool bDirectColor = sal_False );
+ void ImplSetMapMode();
+ void ImplMapDouble( double& );
+ void ImplMapX( double& );
+ void ImplMapY( double& );
+ void ImplMapPoint( FloatPoint& );
+ inline double ImplGetIY();
+ inline double ImplGetFY();
+ inline double ImplGetIX();
+ inline double ImplGetFX();
+ sal_uInt32 ImplGetPointSize();
+ void ImplGetPoint( FloatPoint& rFloatPoint, sal_Bool bMap = sal_False );
+ void ImplGetRectangle( FloatRect&, sal_Bool bMap = sal_False );
+ void ImplGetRectangleNS( FloatRect& );
+ void ImplGetVector( double* );
+ double ImplGetOrientation( FloatPoint& rCenter, FloatPoint& rPoint );
+ void ImplSwitchStartEndAngle( double& rStartAngle, double& rEndAngle );
+ sal_Bool ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rOrientation );
+
+ void ImplDefaultReplacement();
+ void ImplDoClass();
+ void ImplDoClass0();
+ void ImplDoClass1();
+ void ImplDoClass2();
+ void ImplDoClass3();
+ void ImplDoClass4();
+ void ImplDoClass5();
+ void ImplDoClass6();
+ void ImplDoClass7();
+ void ImplDoClass8();
+ void ImplDoClass9();
+ void ImplDoClass15();
+
+ public:
+
+ ~CGM();
+
+ CGM( sal_uInt32 nMode, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel );
+#ifdef CGM_EXPORT_META
+ VirtualDevice* mpVirDev;
+ GDIMetaFile* mpGDIMetaFile;
+#endif
+ void ImplComment( sal_uInt32, const char* );
+ sal_uInt32 GetBackGroundColor();
+ sal_Bool IsValid() { return mbStatus; };
+ sal_Bool IsFinished() { return mbIsFinished; };
+ sal_Bool Write( SvStream& rIStm );
+
+ friend SvStream& operator>>( SvStream& rOStm, CGM& rCGM );
+
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/cgmres.hrc b/filter/source/graphicfilter/icgm/cgmres.hrc
new file mode 100644
index 000000000000..902dfd4522ae
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgmres.hrc
@@ -0,0 +1,28 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define MB_CGM 1
+#define MID_TEST 1
diff --git a/filter/source/graphicfilter/icgm/cgmtypes.hxx b/filter/source/graphicfilter/icgm/cgmtypes.hxx
new file mode 100644
index 000000000000..c7b4e4c6e911
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/cgmtypes.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_TYPES_HXX_
+#define CGM_TYPES_HXX_
+
+struct FloatPoint
+{
+ double X;
+ double Y;
+ FloatPoint(){};
+ FloatPoint( const double& rX, const double& rY ) { X = rX, Y = rY; };
+};
+
+struct FloatRect
+{
+ double Left;
+ double Top;
+ double Right;
+ double Bottom;
+ FloatRect(){};
+ FloatRect( const FloatPoint& rTopLeft, const FloatPoint& rBottomRight )
+ {
+ Left = rTopLeft.X;
+ Top = rTopLeft.Y;
+ Right = rBottomRight.X;
+ Bottom = rBottomRight.Y;
+ }
+ void Justify()
+ {
+ double fTemp;
+ if ( Left > Right )
+ {
+ fTemp = Left;
+ Left = Right;
+ Right = fTemp;
+ }
+ if ( Top > Bottom )
+ {
+ fTemp = Top;
+ Top = Bottom;
+ Bottom = fTemp;
+ }
+ }
+};
+
+struct HatchEntry
+{
+ int HatchStyle;
+ long HatchDistance;
+ long HatchAngle;
+};
+
+#define ASF_LINETYPE 0x00000001UL
+#define ASF_LINEWIDTH 0x00000002UL
+#define ASF_LINECOLOR 0x00000004UL
+#define ASF_MARKERTYPE 0x00000008UL
+#define ASF_MARKERSIZE 0x00000010UL
+#define ASF_MARKERCOLOR 0x00000020UL // NS
+#define ASF_FILLINTERIORSTYLE 0x00000040UL
+#define ASF_HATCHINDEX 0x00000080UL
+#define ASF_PATTERNINDEX 0x00000100UL
+#define ASF_BITMAPINDEX 0x00000200UL // NS
+#define ASF_FILLCOLOR 0x00000400UL
+#define ASF_EDGETYPE 0x00000800UL
+#define ASF_EDGEWIDTH 0x00001000UL
+#define ASF_EDGECOLOR 0x00002000UL
+#define ASF_TEXTFONTINDEX 0x00004000UL
+#define ASF_TEXTPRECISION 0x00008000UL
+#define ASF_CHARACTEREXPANSION 0x00010000UL
+#define ASF_CHARACTERSPACING 0x00020000UL
+#define ASF_TEXTCOLOR 0x00040000UL
+
+#define ACT4_GRADIENT_ACTION 0x00000001UL
+
+enum RealPrecision { RP_FLOAT = 0, RP_FIXED = 1 };
+
+enum ScalingMode { SM_ABSTRACT = 0, SM_METRIC = 1 };
+
+enum VDCType { VDC_INTEGER = 0, VDC_REAL = 1 };
+enum DeviceViewPortMode { DVPM_FRACTION = 0, DVPM_METRIC = 1, DVPM_DEVICE = 2 };
+enum DeviceViewPortMap { DVPM_NOT_FORCED = 0, DVPM_FORCED = 1 };
+enum DeviceViewPortMapH { DVPMH_LEFT = 0, DVPMH_CENTER = 1, CVPMH_RIGHT = 2 };
+enum DeviceViewPortMapV { DVPMV_BOTTOM = 0, DVPMV_CENTER = 1, DVPMV_TOP = 2 };
+
+enum ClipIndicator { CI_OFF = 0, CI_ON = 1 };
+
+enum ColorSelectionMode { CSM_INDEXED = 0, CSM_DIRECT = 1 };
+enum ColorModel { CM_RGB = 0, CM_CYMK = 1 };
+
+enum CharacterCodingA { CCA_BASIC_7 = 0, CCA_BASIC_8 = 1, CCA_EXT_7 = 2, CCA_EXT_8 = 3 };
+enum CharSetType { CST_CBYTE_94 = 0, CST_CBYTE_96 = 1, CST_MULT94 = 2, CST_MULT96 = 3, CST_CCOMPLETE = 4 };
+enum TextPrecision { TPR_STRING = 0, TPR_CHARACTER = 1, TPR_STROKE = 2, TPR_UNDEFINED = 0xffff };
+enum TextPath { TPR_RIGHT = 0, TPR_LEFT = 1, TPR_UP = 2, TPR_DOWN = 3 };
+enum TextAlignmentH { TAH_NORMAL = 0, TAH_LEFT = 1, TAH_CENTER = 2, TAH_RIGHT = 3, TAH_CONT = 4 };
+enum TextAlignmentV { TAV_NORMAL = 0, TAV_TOP = 1, TAV_CAP = 2, TAV_HALF = 3, TAV_BASE = 4, TAV_BOTTOM = 5, TAV_CONT = 6 };
+enum UnderlineMode { UM_OFF = 0, UM_LOW = 1, UM_HIGH = 2, UM_STRIKEOUT = 4, UM_OVERSCORE = 8 };
+enum FinalFlag { FF_NOT_FINAL = 0, FF_FINAL = 1 };
+
+enum LineType { LT_SOLID = 1, LT_DASH = 2, LT_DOT = 3, LT_DASHDOT = 4, LT_DASHDOTDOT = 5, // Standart
+ LT_NONE = -4, LT_DOTDOTSPACE = -3, LT_LONGDASH = -2, LT_DASHDASHDOT = -1 }; // GDSF Styles
+enum SpecMode { SM_ABSOLUTE = 0, SM_SCALED = 1 };
+enum LineCapType { LCT_BUTT = 0, LCT_ROUND = 1, LCT_SQUARE = 2, LCT_TRIANGLE = 3, LCT_ARROW = 4, LCT_NONE = -1 };
+enum LineJoinType { LJT_MITER = 0, LJT_ROUND = 1, LJT_BEVEL = 2, LJT_NONE = -1 };
+
+
+enum EdgeType { ET_SOLID = 1, ET_DASH = 2, ET_DOT = 3, ET_DASHDOT = 4, ET_DASHDOTDOT = 5, // Standart
+ ET_NONE = -4, ET_DOTDOTSPACE = -3, ET_LONGDASH = -2, ET_DASHDASHDOT = -1 }; // GDSF Styles
+enum EdgeVisibility { EV_OFF = 0, EV_ON = 1 };
+
+enum MarkerType { MT_POINT = 1, MT_PLUS = 2, MT_STAR = 3, MT_CIRCLE = 4, MT_CROSS = 5 };
+
+enum Transparency { T_OFF = 0, T_ON = 1 };
+
+enum FillInteriorStyle { FIS_HOLLOW = 0, FIS_SOLID = 1, FIS_PATTERN = 2, FIS_HATCH = 3, FIS_EMPTY = 4, FIS_GEOPATTERN = 5,
+ FIS_INTERPOLATED = 6, FIS_GRADIENT = 7 };
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/chart.cxx b/filter/source/graphicfilter/icgm/chart.cxx
new file mode 100644
index 000000000000..40f8cd75f11f
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/chart.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+
+// ---------------------------------------------------------------
+
+CGMChart::CGMChart( CGM& rCGM ) :
+ mpCGM ( &rCGM )
+{
+ for ( sal_Int8 i = 0; i < 7; i++ )
+ {
+ mDataNode[ i ].nBoxX1 = mDataNode[ i ].nBoxY1 = 0 ;
+ mDataNode[ i ].nBoxX2 = mDataNode[ i ].nBoxY2 = 0 ;
+
+ mDataNode[ i ].nZoneEnum = i;
+ }
+};
+
+// ---------------------------------------------------------------
+
+CGMChart::~CGMChart()
+{
+ // delete the whole textentry structure
+
+ TextEntry* pTextEntry;
+ while( ( pTextEntry = (TextEntry*)maTextEntryList.First() ) != NULL )
+ {
+ DeleteTextEntry( pTextEntry );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMChart::DeleteTextEntry( TextEntry* pTextEntry )
+{
+ if ( pTextEntry )
+ {
+ delete pTextEntry->pText;
+ for ( TextAttribute* pTAttr = pTextEntry->pAttribute; pTAttr != NULL ; )
+ {
+ TextAttribute* pTempTAttr = pTAttr;
+ pTAttr = pTAttr->pNextAttribute;
+ delete pTempTAttr;
+ }
+ delete pTextEntry;
+ maTextEntryList.Remove( pTextEntry );
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGMChart::InsertTextEntry( TextEntry* pTextEntry )
+{
+ maTextEntryList.Insert( pTextEntry );
+};
+
+// ---------------------------------------------------------------
+
+// ---------------------------------------------------------------
+void CGMChart::ResetAnnotation()
+{
+ mDataNode[ 0 ].nZoneEnum = 0;
+}
+
+// ---------------------------------------------------------------
+
+sal_Bool CGMChart::IsAnnotation()
+{
+ return ( mDataNode[ 0 ].nZoneEnum == 0 );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/chart.hxx b/filter/source/graphicfilter/icgm/chart.hxx
new file mode 100644
index 000000000000..fb1a2bf6ce16
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/chart.hxx
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_CHART_HXX_
+#define CGM_CHART_HXX_
+
+#include <tools/list.hxx>
+
+/* FILE TYPE CONSTANTS: */
+#define NOCHART 0 /* Undefined chart. */
+#define XYCHART 1 /* Standard XY chart. */
+#define PIECHART 21 /* Standard pie chart file. */
+#define ORGCHART 26 /* Standard org chart file. */
+#define TTLCHART 31 /* Title chart file. */
+#define BULCHART 32 /* Bullet chart file. */
+#define TABCHART 33 /* Table chart file. */
+#define DRWCHART 41 /* Chart with drawings only.*/
+#define MLTCHART 42 /* Multiple chart file. */
+#define LASTCHART 45 /* The largest chart type. */
+#define SHWFILE 46 /* Slide show file. */
+#define SYMFILE 47 /* Symbol file. */
+/* the following were added although SPC doesn't have a #define */
+/* for them... */
+#define AUTOTTLCHT 95 /* Autobuild TTL CHT */
+#define AUTOBULCHT 96 /* Autobuild BUL CHT */
+#define AUTOTABCHT 97 /* Autobuild TAB CHT */
+
+/* FNC 10/11/93: for the chart stream, ALLCHART was added. */
+/* It is used specifically by PPT in its Template to let */
+/* us know that the template applies to all charts, not to */
+/* one specific chart type. */
+#define ALLCHART 127 /* Applies to all chart types */
+#define ALLCHART_TPL 255 /* Applies to all chart types */
+
+#define IOC_CHTTITLE 1 /* Title for any chart. */
+#define IOC_CHTFOOTNOTE 2 /* ::com::sun::star::text::Footnote for any chart. */
+#define IOC_XYAXIS 3 /* Axis title for XY charts. */
+#define IOC_XYSERIESLEGEND 4 /* Series legend titles for XY charts. */
+#define IOC_PIETITLE 5 /* Title for pie charts. */
+#define IOC_TABLEBODY 6 /* Table chart text element. */
+#define IOC_TITLEBODY 7 /* Title chart text element. */
+#define IOC_BULLETBODY 8 /* Bullet chart text element. */
+#define IOC_XYLEGENDTITLE 9 /* Legend title for XY charts. */
+#define IOC_PIELEGENDTITLE 10 /* Legend title for pie charts. */
+#define IOC_TABLEGENDTITLE 11 /* Legend title for table charts. */
+
+typedef struct TextAttribute
+{
+ sal_uInt16 nTextAttribCount;
+ sal_Int8 nTextColorIndex;
+ sal_Int8 nTextColorRed;
+ sal_Int8 nTextColorGreen;
+ sal_Int8 nTextColorBlue;
+ sal_Int8 nShadowColorIndex;
+ sal_Int8 nShadowColorRed;
+ sal_Int8 nShadowColorGreen;
+ sal_Int8 nShadowColorBlue;
+ float nTextAttribSize;
+ sal_uInt16 nTextAttribBits;
+ sal_Int8 nTextFontType; // font identifiers
+ sal_Int8 nTextCharPage;
+ sal_uInt16 nTextFontFamily;
+ sal_Int8 nTextFontMemberID;
+ sal_Int8 nTextFontVendorID;
+ TextAttribute* pNextAttribute; // zero or pointer to next TextAttribute
+} TextAttribute;
+
+typedef struct TextEntry
+{
+ sal_uInt16 nTypeOfText;
+ sal_uInt16 nRowOrLineNum;
+ sal_uInt16 nColumnNum;
+ sal_uInt16 nZoneSize; // textzone attributes
+ sal_uInt16 nLineType;
+ sal_uInt16 nAttributes;
+ char* pText; // null terminated text
+ TextAttribute* pAttribute;
+} TextEntry;
+
+typedef struct ZoneOption
+{
+ char nOverTitle;
+ char nOverBody;
+ char nOverFoot;
+ char nFStyle_Title;
+ char nFStyle_Body;
+ char nFStyle_Foot;
+ char nFOutc_Title;
+ char nFOutc_Body;
+ char nFOutc_Foot;
+ char nFFillc_Title;
+ char nFFillc_Body;
+ char nFFillc_Foot;
+} ZoneOption;
+
+typedef struct BulletOption
+{
+ char nBType;
+ char nBSize;
+ char nBColor;
+ sal_Int16 nBStart;
+ double nTMargin;
+ double nBSpace;
+ char nCPlace;
+} BulletOption;
+
+typedef struct BulDef
+{
+ char btype;
+ char bsize;
+ char bcolor;
+ char bnumber;
+} BulDef;
+
+typedef struct BulletLines
+{
+ BulDef nBulDef[ 48 ];
+} BulletLines;
+
+typedef struct IntSettings
+{
+ sal_uInt16 nCountry;
+ sal_uInt16 nDateFormat;
+ sal_uInt16 nDateSep;
+ sal_uInt16 nTimeFormat;
+ sal_uInt16 nTimeSep;
+ sal_uInt16 nNumSeps;
+ sal_uInt16 nCurrencyFormat;
+ char nCurrencySymbol[ 5 ];
+} IntSettings;
+
+typedef struct PageOrientDim
+{
+ char nOrientation;
+ char nDimension;
+ float nPageX;
+ float nPageY;
+} PageOrientDim;
+
+typedef struct DataNode
+{
+ sal_Int16 nBoxX1;
+ sal_Int16 nBoxY1;
+ sal_Int16 nBoxX2;
+ sal_Int16 nBoxY2;
+ sal_Int8 nZoneEnum;
+} DataNode;
+
+typedef struct ChartZone
+{
+ sal_Int16 nMinX;
+ sal_Int16 nMinY;
+ sal_Int16 nMaxX;
+ sal_Int16 nMaxY;
+ char nUserDef;
+ char nPad1;
+} ChartZone;
+
+class CGM;
+class CGMImpressOutAct;
+class CGMChart
+{
+ friend class CGM;
+ friend class CGMImpressOutAct;
+
+ protected:
+ CGM* mpCGM;
+ sal_Int8 mnCurrentFileType;
+ List maTextEntryList;
+ DataNode mDataNode[ 7 ];
+ ChartZone mChartZone;
+ PageOrientDim mPageOrientDim;
+ BulletOption mBulletOption;
+ BulletLines mBulletLines;
+ ZoneOption mZoneOption;
+ IntSettings mIntSettings;
+
+ public:
+ CGMChart( CGM& rCGM );
+ ~CGMChart();
+
+ void DeleteTextEntry( TextEntry* );
+ void InsertTextEntry( TextEntry* );
+
+ void ResetAnnotation();
+ sal_Bool IsAnnotation();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class0.cxx b/filter/source/graphicfilter/icgm/class0.cxx
new file mode 100644
index 000000000000..25026c3a1585
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class0.cxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass0()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Begin Metafile" )
+ {
+ ImplSetMapMode();
+ mbMetaFile = sal_True;
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "End MetaFile" )
+ {
+ if ( mpBitmapInUse ) // vorhandene grafik verarbeiten,
+ {
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+ mbIsFinished = sal_True;
+ mbPictureBody = sal_False;
+ mbMetaFile = sal_False;
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Begin Picture" )
+ {
+ ImplDefaultReplacement();
+ ImplSetMapMode();
+ if ( mbPicture )
+ mbStatus = sal_False;
+ else
+ {
+ *pCopyOfE = *pElement;
+ mbPicture = mbFirstOutPut = sal_True;
+ mbFigure = sal_False;
+ mnAct4PostReset = 0;
+ if ( mpChart == NULL ) // normal CGM Files determines "BeginPic"
+ mpOutAct->InsertPage(); // as the next slide
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Begin Picture Body" )
+ mbPictureBody = sal_True;
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, " End Picture" )
+ {
+ if ( mbPicture )
+ {
+ if ( mpBitmapInUse ) // vorhandene grafik verarbeiten,
+ {
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+ mpOutAct->EndFigure(); // eventuelle figuren schliessen
+ mpOutAct->EndGrouping(); // eventuelle gruppierungen noch abschliessen
+ *pElement = *pCopyOfE;
+ mbFigure = mbFirstOutPut = mbPicture = mbPictureBody = sal_False;
+ }
+ else
+ mbStatus = sal_False;
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL2, "Begin Segment" )
+ pElement->bSegmentCount = sal_True;
+ break;
+ case 0x07 : ComOut( CGM_LEVEL2, "End Segment" )
+ pElement->bSegmentCount = sal_True;
+ break;
+ case 0x08 : ComOut( CGM_LEVEL2, "Begin Figure" )
+ mbFigure = sal_True;
+ mpOutAct->BeginFigure();
+ break;
+ case 0x09 : ComOut( CGM_LEVEL2, "End Figure" )
+ mpOutAct->EndFigure();
+ mbFigure = sal_False;
+ break;
+ case 0x0d : ComOut( CGM_LEVEL3, "Begin Protection Region" ) break;
+ case 0x0e : ComOut( CGM_LEVEL3, "End Protection Region" ) break;
+ case 0x0f : ComOut( CGM_LEVEL3, "Begin Compound Line" ) break;
+ case 0x10 : ComOut( CGM_LEVEL3, "End Compound Line" ) break;
+ case 0x11 : ComOut( CGM_LEVEL3, "Begin Compound Text Path" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "End Compound Text Path" ) break;
+ case 0x13 : ComOut( CGM_LEVEL3, "Begin Tile Array" ) break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "End Tile Array" ) break; // NS
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Filter Setup" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Begin Block Text Region" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "End Block Text Region" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Begin Group" )
+ mpOutAct->BeginGroup();
+ break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "End Group" )
+ mpOutAct->EndGroup();
+ break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "Begin Patch" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "Begin Patch" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
new file mode 100644
index 000000000000..110d0b4aee3b
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass1()
+{
+ long nInteger, nI0, nI1;
+ sal_uInt32 nUInteger;
+
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Metafile Version" )
+ pElement->nMetaFileVersion = ImplGetI( pElement->nIntegerPrecision );
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Metafile Description" ) break;
+ case 0x03 : ComOut( CGM_LEVEL1, "VDC Type" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eVDCType = VDC_INTEGER; break;
+ case 1 : pElement->eVDCType = VDC_REAL; break;
+ default: mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Integer Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nIntegerPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Real Precision" )
+ {
+ nUInteger = ImplGetUI16( 4 );
+ nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
+ nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
+ switch( nUInteger )
+ {
+ case 0 :
+ pElement->eRealPrecision = RP_FLOAT;
+ switch ( nI0 )
+ {
+ case 9 :
+ if ( nI1 != 23 )
+ mbStatus = sal_False;
+ pElement->nRealSize = 4;
+ break;
+ case 12 :
+ if ( nI1 != 52 )
+ mbStatus =sal_False;
+ pElement->nRealSize = 8;
+ break;
+ default:
+ mbStatus = sal_False;
+ break;
+ }
+ break;
+ case 1 :
+ pElement->eRealPrecision = RP_FIXED;
+ if ( nI0 != nI1 )
+ mbStatus = sal_False;
+ if ( nI0 == 16 )
+ pElement->nRealSize = 4;
+ else if ( nI0 == 32 )
+ pElement->nRealSize = 8;
+ else
+ mbStatus = sal_False;
+ break;
+ default :
+ mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Index Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nIndexPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nColorPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x08 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Index Precision" )
+ {
+ nInteger = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nInteger )
+ {
+ case 32 :
+ case 24 :
+ case 16 :
+ case 8 : pElement->nColorIndexPrecision = nInteger >> 3; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Maximum Colour Index" )
+ {
+ pElement->nColorMaximumIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ if ( ( pElement->nColorMaximumIndex > 256 /*255*/ ) || ( pElement->nColorMaximumIndex == 0 ) )
+ mbStatus = sal_False;
+ }
+ break;
+ case 0x0a : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Value Extent" )
+ {
+ if ( pElement->eColorModel == CM_RGB )
+ nI1 = 6;
+ else
+ {
+ nI1 = 8;
+ mbStatus = sal_False; // CMYK is not supported
+ }
+ for ( nI0 = 0; nI0 < nI1; nI0++ )
+ {
+ pElement->nColorValueExtent[ nI0 ] = (sal_uInt8)ImplGetUI( pElement->nColorPrecision );
+ }
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL1, "MetaFile Element List" ) break;
+ case 0x0c : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "MetaFile Default Replacement" )
+ {
+ if ( mnElementSize > 1 )
+ {
+ sal_Int8* pBuf = new sal_Int8[ mnElementSize ];
+ if ( pBuf )
+ {
+ memcpy( pBuf, mpSource, mnElementSize );
+ maDefRepList.Insert( pBuf, LIST_APPEND );
+ maDefRepSizeList.Insert( (void*)mnElementSize, LIST_APPEND );
+ }
+ }
+ mnParaSize = mnElementSize;
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Font List" )
+ {
+ while ( mnParaSize < mnElementSize )
+ {
+ sal_uInt32 nSize;
+ nSize = ImplGetUI( 1 );
+ pElement->aFontList.InsertName( mpSource + mnParaSize, nSize );
+ mnParaSize += nSize;
+ }
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Set List" )
+ {
+ while ( mnParaSize < mnElementSize )
+ {
+ sal_uInt32 nCharSetType;
+ sal_uInt32 nSize;
+ nCharSetType = ImplGetUI16();
+ nSize = ImplGetUI( 1 );
+ pElement->aFontList.InsertCharSet( (CharSetType)nCharSetType, mpSource + mnParaSize, nSize );
+ mnParaSize += nSize;
+ }
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Coding Announcer" )
+ pElement->eCharacterCodingA = (CharacterCodingA)ImplGetUI16();
+ break;
+ case 0x10 : ComOut( CGM_LEVEL2, "Name Precision" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL2, "Maximum VDC Extent" ) break; // NS
+ case 0x12 : ComOut( CGM_LEVEL2, "Segment Priority Extent" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Color Model" ) break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "Color Calibration" ) break; // NS
+ case 0x15 : ComOut( CGM_LEVEL3, "Font Properties" ) break; // NS
+ case 0x16 : ComOut( CGM_LEVEL3, "Glyph Mapping" ) break; // NS
+ case 0x17 : ComOut( CGM_LEVEL3, "Symbol Library List" ) break; // NS
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Inquire Function Support" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "End Metafile Defaults Replacement" ) break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "Set Color Value Desc Extent" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class2.cxx b/filter/source/graphicfilter/icgm/class2.cxx
new file mode 100644
index 000000000000..3ea762867acf
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class2.cxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass2()
+{
+ sal_uInt32 nUInteger;
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Scaling Mode" )
+ {
+ if ( mnElementSize ) // HACK (NASA.CGM)
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eScalingMode = SM_ABSTRACT; break;
+ case 1 : pElement->eScalingMode = SM_METRIC; break;
+ default : mbStatus = sal_False; break;
+ }
+ pElement->nScalingFactor = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ ImplSetMapMode();
+ }
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Color Selection Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eColorSelectionMode = CSM_INDEXED; break;
+ case 1 : pElement->eColorSelectionMode = CSM_DIRECT; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Line Width Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eLineWidthSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eLineWidthSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Marker Size Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eMarkerSizeSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eMarkerSizeSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Edge Width Specification Mode" )
+ {
+ nUInteger = ImplGetUI16();
+ switch( nUInteger )
+ {
+ case 0 : pElement->eEdgeWidthSpecMode = SM_ABSOLUTE; break;
+ case 1 : pElement->eEdgeWidthSpecMode = SM_SCALED; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "VDC Extent" )
+ {
+ ImplGetRectangleNS( pElement->aVDCExtent );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1, "Background Color" )
+ pElement->nBackGroundColor = ImplGetBitmapColor( sal_True );
+ break;
+ case 0x08 : ComOut( CGM_LEVEL2, "Device Viewport" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ ImplGetRectangle( pElement->aDeviceViewPort );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL2, "Device Viewport Specification Mode" )
+ {
+ nUInteger = ImplGetUI16( 8 );
+ switch( nUInteger )
+ {
+ case 0 : pElement->eDeviceViewPortMode = DVPM_FRACTION; break;
+ case 1 : pElement->eDeviceViewPortMode = DVPM_METRIC; break;
+ case 2 : pElement->eDeviceViewPortMode = DVPM_DEVICE; break;
+ default : mbStatus = sal_False; break;
+ }
+ pElement->nDeviceViewPortScale = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ ImplSetMapMode();
+ }
+ break;
+ case 0x0a : ComOut( CGM_LEVEL2, "Device Viewport Mapping" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMap = DVPM_NOT_FORCED; break;
+ case 1 : pElement->eDeviceViewPortMap = DVPM_FORCED; break;
+ default : mbStatus = sal_False; break;
+ }
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMapH = DVPMH_LEFT; break;
+ case 1 : pElement->eDeviceViewPortMapH = DVPMH_CENTER; break;
+ case 2 : pElement->eDeviceViewPortMapH = CVPMH_RIGHT; break;
+ default : mbStatus = sal_False; break;
+ }
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eDeviceViewPortMapV = DVPMV_BOTTOM; break;
+ case 1 : pElement->eDeviceViewPortMapV = DVPMV_CENTER; break;
+ case 2 : pElement->eDeviceViewPortMapV = DVPMV_TOP; break;
+ default : mbStatus = sal_False; break;
+ }
+ ImplSetMapMode();
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL2, "Line Representation" )
+ {
+ LineBundle aTempLineBundle;
+ aTempLineBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ aTempLineBundle.nLineWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempLineBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aLineList, aTempLineBundle );
+ }
+ break;
+ case 0x0c : ComOut( CGM_LEVEL2, "Marker Representation" )
+ {
+ MarkerBundle aTempMarkerBundle;
+ aTempMarkerBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ aTempMarkerBundle.nMarkerSize = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempMarkerBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aMarkerList, aTempMarkerBundle );
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL2, "Text Representation" )
+ {
+ TextBundle aTempTextBundle;
+ aTempTextBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ aTempTextBundle.eTextPrecision = (TextPrecision)ImplGetI( pElement->nIndexPrecision );
+ aTempTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempTextBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aTextList, aTempTextBundle );
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL2, "Fill Representation" )
+ {
+ FillBundle aTempFillBundle;
+ aTempFillBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetI( pElement->nIndexPrecision );
+ aTempFillBundle.SetColor( ImplGetBitmapColor() );
+ aTempFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ aTempFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ pElement->InsertBundle( pElement->aFillList, aTempFillBundle );
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL2, "Edge Representation" )
+ {
+ EdgeBundle aTempEdgeBundle;
+ aTempEdgeBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
+ aTempEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ aTempEdgeBundle.nEdgeWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ aTempEdgeBundle.SetColor( ImplGetBitmapColor() );
+ pElement->InsertBundle( pElement->aEdgeList, aTempEdgeBundle );
+ }
+ break;
+ case 0x10 : ComOut( CGM_LEVEL3, "Interior Style Specification Mode" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL3, "Line and Edge Type Definition" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "Hatch Style Definition" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Geometric Pattern Definition" ) break; // NS
+ case 0xff : ComOut( CGM_GDSF_ONLY, "inquire VDC EXTENT" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire Background Color" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "inquire Device Viewport" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "set Font Selection Mode" ) break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "inquire Color Selection Mode" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "inquire Font Selection Mode" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Char Height Spec Mode" )
+ {
+ ImplGetUI16(); // -Wall is this really needed?
+ }
+ break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Background Style" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class3.cxx b/filter/source/graphicfilter/icgm/class3.cxx
new file mode 100644
index 000000000000..d3fd67c812a0
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class3.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass3()
+{
+ sal_uInt32 nUInteger;
+ long nI0, nI1;
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "VDC Integer Precision" )
+ {
+ switch( ImplGetI( pElement->nIntegerPrecision ) )
+ {
+ case 16 : pElement->nVDCIntegerPrecision = 2; break;
+ case 32 : pElement->nVDCIntegerPrecision = 4; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "VDC Real Precision" )
+ {
+ nUInteger = ImplGetUI16();
+ nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
+ nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
+ switch( nUInteger )
+ {
+ case 0 :
+ pElement->eVDCRealPrecision = RP_FLOAT;
+ switch ( nI0 )
+ {
+ case 9 :
+ if ( nI1 != 23 )
+ mbStatus = sal_False;
+ pElement->nVDCRealSize = 4;
+ break;
+ case 12 :
+ if ( nI1 != 52 )
+ mbStatus =sal_False;
+ pElement->nVDCRealSize = 8;
+ break;
+ default:
+ mbStatus = sal_False;
+ break;
+ }
+ break;
+ case 1 :
+ pElement->eVDCRealPrecision = RP_FIXED;
+ if ( nI0 != nI1 )
+ mbStatus = sal_False;
+ if ( nI0 == 16 )
+ pElement->nVDCRealSize = 4;
+ else if ( nI0 == 32 )
+ pElement->nVDCRealSize = 8;
+ else
+ mbStatus = sal_False;
+ break;
+ default :
+ mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Auxiliary Colour" )
+ {
+ pElement->nAuxiliaryColor = ImplGetBitmapColor();
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Transparency" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eTransparency = T_OFF; break;
+ case 1 : pElement->eTransparency = T_ON; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, "Clip Rectangle" )
+ ImplGetRectangle( pElement->aClipRect );
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "Clip Indicator" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eClipIndicator = CI_OFF; break;
+ case 1 : pElement->eClipIndicator = CI_ON; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL2, "Line Clipping Mode" ) break; // NS
+ case 0x08 : ComOut( CGM_LEVEL2, "Marker Clipping Mode" ) break; // NS
+ case 0x09 : ComOut( CGM_LEVEL2, "Edge Clipping Mode" ) break; // NS
+ case 0x0a : ComOut( CGM_LEVEL2, "New Region" )
+ mpOutAct->NewRegion();
+ break;
+ case 0x0b : ComOut( CGM_LEVEL2, "Save Primitive Context" ) break; // NS
+ case 0x0c : ComOut( CGM_LEVEL2, "Restore Primitive Context" ) break; // NS
+ case 0x11 : ComOut( CGM_LEVEL3, "Protection Region Indicator" ) break;
+ case 0x12 : ComOut( CGM_LEVEL3, "Generalized Text Path Mode" ) break; // NS
+ case 0x13 : ComOut( CGM_LEVEL3, "Mitre Limit" )
+ pElement->nMitreLimit = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ break; // NS
+ case 0x14 : ComOut( CGM_LEVEL3, "Transparent Cell Color" ) break; // NS
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Text Path Alignment Modes" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "Pop Transformation Stack" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Push Transformation Stack" ) break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Set Patch ID" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
new file mode 100644
index 000000000000..fbff0e4c219c
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -0,0 +1,863 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+#include <outact.hxx>
+#include <math.h>
+
+using namespace ::com::sun::star;
+
+double CGM::ImplGetOrientation( FloatPoint& rCenter, FloatPoint& rPoint )
+{
+ double fOrientation;
+
+ double nX = rPoint.X - rCenter.X;
+ double nY = rPoint.Y - rCenter.Y;
+
+ fOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ if ( nY > 0 )
+ fOrientation = 360 - fOrientation;
+
+ return fOrientation;
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplSwitchStartEndAngle( double& rStartAngle, double& rEndAngle )
+{
+ double nTemp;
+ nTemp = rStartAngle;
+ rStartAngle = rEndAngle;
+ rEndAngle = nTemp;
+}
+
+// ---------------------------------------------------------------
+
+void CGM::ImplGetVector( double* pVector )
+{
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ for ( sal_uInt32 i = 0; i < 4; i++ )
+ {
+ pVector[ i ] = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ }
+ else
+ {
+ for ( sal_uInt32 i = 0; i < 4; i++ )
+ {
+ pVector[ i ] = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ }
+ pVector[ 0 ] *= mnVDCXmul;
+ pVector[ 2 ] *= mnVDCXmul;
+ pVector[ 1 ] *= mnVDCYmul;
+ pVector[ 3 ] *= mnVDCYmul;
+}
+
+// ---------------------------------------------------------------
+sal_Bool CGM::ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rAngle )
+{
+ FloatPoint aPoint1, aPoint2;
+ double fRot1, fRot2;
+ ImplGetPoint( rCenter, sal_True );
+ ImplGetPoint( aPoint1, sal_True );
+ ImplGetPoint( aPoint2, sal_True );
+ fRot1 = ImplGetOrientation( rCenter, aPoint1 );
+ fRot2 = ImplGetOrientation( rCenter, aPoint2 );
+ rAngle = ImplGetOrientation( rCenter, aPoint1 );
+ aPoint1.X -= rCenter.X;
+ aPoint1.Y -= rCenter.Y;
+ rRadius.X = sqrt( aPoint1.X * aPoint1.X + aPoint1.Y * aPoint1.Y );
+ aPoint2.X -= rCenter.X;
+ aPoint2.Y -= rCenter.Y;
+ rRadius.Y = sqrt( aPoint2.X * aPoint2.X + aPoint2.Y * aPoint2.Y );
+
+ if ( fRot1 > fRot2 )
+ {
+ if ( ( fRot1 - fRot2 ) < 180 )
+ return sal_False;
+ }
+ else
+ {
+ if ( ( fRot2 - fRot1 ) > 180 )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+void CGM::ImplDoClass4()
+{
+ if ( mbFirstOutPut )
+ mpOutAct->FirstOutPut();
+
+ if ( mpBitmapInUse && ( mnElementID != 9 ) ) // vorhandene grafik verarbeiten,
+ { // da jetzt nicht bitmap actions anstehen
+ CGMBitmapDescriptor* pBmpDesc = mpBitmapInUse->GetBitmap();
+ // irgendetwas mit der Bitmap anfangen
+ mpOutAct->DrawBitmap( pBmpDesc );
+ delete mpBitmapInUse;
+ mpBitmapInUse = NULL;
+ }
+
+ if ( ( mpChart == NULL ) || mpChart->IsAnnotation() )
+ {
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "PolyLine" )
+ {
+ sal_uInt32 nPoints = mnElementSize / ImplGetPointSize();
+ Polygon aPolygon( (sal_uInt16)nPoints );
+ for ( sal_uInt16 i = 0; i < nPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), i );
+ }
+ if ( mbFigure )
+ mpOutAct->RegPolyLine( aPolygon );
+ else
+ mpOutAct->DrawPolyLine( aPolygon );
+ }
+ break;
+
+ case 0x02 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Disjoint PolyLine" )
+ {
+ USHORT nPoints = sal::static_int_cast< USHORT >(
+ mnElementSize / ImplGetPointSize());
+ if ( ! ( nPoints & 1 ) )
+ {
+ nPoints >>= 1;
+ FloatPoint aFloatPoint;
+ if ( mbFigure )
+ {
+ Polygon aPolygon( nPoints );
+ for ( sal_uInt16 i = 0; i < nPoints; i++ )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 );
+ }
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ mpOutAct->BeginGroup();
+ Polygon aPolygon( (sal_uInt16)2 );
+ for ( sal_uInt16 i = 0; i < nPoints; i++ )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 0 );
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point( (long)aFloatPoint.X, (long)aFloatPoint.Y ), 1);
+ mpOutAct->DrawPolyLine( aPolygon );
+ }
+ mpOutAct->EndGroup();
+ }
+ }
+ }
+ break;
+
+ case 0x03 : ComOut( CGM_LEVEL1, "PolyMarker" ) break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Text" )
+ {
+ FloatPoint aFloatPoint;
+ sal_uInt32 nType, nSize;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint ( aFloatPoint, sal_True );
+ nType = ImplGetUI16( 4 );
+ nSize = ImplGetUI( 1 );
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ awt::Size aSize;
+ awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ mpOutAct->DrawText( aPoint, aSize,
+ (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x05 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Restricted Text" )
+ {
+ double dx, dy;
+ FloatPoint aFloatPoint;
+ sal_uInt32 nType, nSize;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ dx = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ dy = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ dx = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ dy = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ ImplMapDouble( dx );
+ ImplMapDouble( dy );
+
+ ImplGetPoint ( aFloatPoint, sal_True );
+ nType = ImplGetUI16( 4 );
+ nSize = ImplGetUI( 1 );
+
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ awt::Size aSize((long)dx, (long)dy);
+ mpOutAct->DrawText( aPoint, aSize ,
+ (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x06 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Append Text" )
+ {
+ sal_uInt32 nSize;
+ sal_uInt32 nType = ImplGetUI16( 4 );
+
+ nSize = ImplGetUI( 1 );
+ mpSource[ mnParaSize + nSize ] = 0;
+
+ ComOut( CGM_DESCRIPTION, (char*)mpSource + mnParaSize );
+
+ mpOutAct->AppendText( (char*)mpSource + mnParaSize, nSize, (FinalFlag)nType );
+// mnParaSize += nSize;
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x07 : ComOut( CGM_LEVEL1, "Polygon" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ USHORT nPoints = sal::static_int_cast< USHORT >(
+ mnElementSize / ImplGetPointSize());
+ Polygon aPolygon( nPoints );
+ for ( USHORT i = 0; i < nPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i );
+ }
+ mpOutAct->DrawPolygon( aPolygon );
+ }
+ break;
+
+ case 0x08 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Polygon Set" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ USHORT nPoints = 0;
+ Point* pPoints = new Point[ 0x4000 ];
+
+ PolyPolygon aPolyPolygon;
+ FloatPoint aFloatPoint;
+ sal_uInt32 nEdgeFlag;
+ while ( mnParaSize < mnElementSize )
+ {
+ ImplGetPoint( aFloatPoint, sal_True );
+ nEdgeFlag = ImplGetUI16();
+ pPoints[ nPoints++ ] = Point( (long)aFloatPoint.X, (long)aFloatPoint.Y );
+ if ( ( nEdgeFlag & 2 ) || ( mnParaSize == mnElementSize ) )
+ {
+ Polygon aPolygon( nPoints );
+ for ( USHORT i = 0; i < nPoints; i++ )
+ {
+ aPolygon.SetPoint( pPoints[ i ], i );
+ }
+ aPolyPolygon.Insert( aPolygon, POLYPOLY_APPEND );
+ nPoints = 0;
+ }
+ }
+ delete[] pPoints;
+ mpOutAct->DrawPolyPolygon( aPolyPolygon );
+ }
+ break;
+
+ case 0x09 : ComOut( CGM_LEVEL1, "Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ if ( mpBitmapInUse )
+ {
+ CGMBitmap* pBmpDesc = mpBitmapInUse->GetNext();
+ if ( pBmpDesc ) // eventuell bekommen wir eine bitmap zurück, die nicht
+ { // zur vorherigen paßt -> diese müssen wir dann auch löschen
+ mpOutAct->DrawBitmap( pBmpDesc->GetBitmap() );
+ delete pBmpDesc;
+ }
+ }
+ else
+ {
+ mpBitmapInUse = new CGMBitmap( *this );
+ }
+ }
+ break;
+
+ case 0x0a : ComOut( CGM_LEVEL1, "Generalized Drawing Primitive" )
+ {
+ ImplGetI( pElement->nIntegerPrecision ); //-Wall is this needed
+ ImplGetUI( pElement->nIntegerPrecision ); //-Wall is this needed
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x0b : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Rectangle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ FloatRect aFloatRect;
+ ImplGetRectangle( aFloatRect, sal_True );
+ mpOutAct->DrawRectangle( aFloatRect );
+ }
+ break;
+
+ case 0x0c : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ double fRotation = 0;
+ FloatPoint aCenter, aRadius;
+ ImplGetPoint( aCenter, sal_True );
+ if ( pElement->eVDCType == VDC_REAL )
+ aRadius.X = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+ mpOutAct->DrawEllipse( aCenter, aRadius, fRotation );
+ }
+ break;
+
+ case 0x0d : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point" )
+ {
+ int nSwitch = 0;
+
+ FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+ ImplGetPoint( aStartingPoint, sal_True );
+ ImplGetPoint( aIntermediatePoint, sal_True );
+ ImplGetPoint( aEndingPoint, sal_True );
+
+ double fA = aIntermediatePoint.X - aStartingPoint.X;
+ double fB = aIntermediatePoint.Y - aStartingPoint.Y;
+ double fC = aEndingPoint.X - aStartingPoint.X;
+ double fD = aEndingPoint.Y - aStartingPoint.Y;
+
+ double fE = fA * ( aStartingPoint.X + aIntermediatePoint.X ) + fB * ( aStartingPoint.Y + aIntermediatePoint.Y );
+ double fF = fC * ( aStartingPoint.X + aEndingPoint.X ) + fD * ( aStartingPoint.Y + aEndingPoint.Y );
+
+ double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) );
+
+ aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
+ aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
+
+ if ( fG != 0 )
+ {
+ double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
+ double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
+ double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+
+ if ( fStartAngle > fEndAngle )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ double fRadius = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+
+ if ( mbFigure )
+ {
+ Rectangle aBoundingBox( Point( (long)( aCenterPoint.X - fRadius ), long( aCenterPoint.Y - fRadius ) ),
+ Size( ( static_cast< long >( 2 * fRadius ) ), (long)( 2 * fRadius) ) );
+ Polygon aPolygon( aBoundingBox, Point( (long)aStartingPoint.X, (long)aStartingPoint.Y ) ,Point( (long)aEndingPoint.X, (long)aEndingPoint.Y ), POLY_ARC );
+ if ( nSwitch )
+ mpOutAct->RegPolyLine( aPolygon, sal_True );
+ else
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ fG = 0;
+ FloatPoint aRadius;
+ aRadius.X = aRadius.Y = fRadius;
+ mpOutAct->DrawEllipticalArc( aCenterPoint, aRadius, fG, 2, fStartAngle, fEndAngle );
+ }
+ }
+ }
+ break;
+
+ case 0x0e : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point Close" )
+ {
+ int nSwitch = 0;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
+ ImplGetPoint( aStartingPoint );
+ ImplGetPoint( aIntermediatePoint );
+ ImplGetPoint( aEndingPoint );
+
+ double fA = aIntermediatePoint.X - aStartingPoint.X;
+ double fB = aIntermediatePoint.Y - aStartingPoint.Y;
+ double fC = aEndingPoint.X - aStartingPoint.X;
+ double fD = aEndingPoint.Y - aStartingPoint.Y;
+
+ double fE = fA * ( aStartingPoint.X + aIntermediatePoint.X ) + fB * ( aStartingPoint.Y + aIntermediatePoint.Y );
+ double fF = fC * ( aStartingPoint.X + aEndingPoint.X ) + fD * ( aStartingPoint.Y + aEndingPoint.Y );
+
+ double fG = 2.0 * ( fA * ( aEndingPoint.Y - aIntermediatePoint.Y ) - fB * ( aEndingPoint.X - aIntermediatePoint.X ) );
+
+ aCenterPoint.X = ( fD * fE - fB * fF ) / fG;
+ aCenterPoint.Y = ( fA * fF - fC * fE ) / fG;
+
+ if ( fG != 0 )
+ {
+ double fStartAngle = ImplGetOrientation( aCenterPoint, aStartingPoint );
+ double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
+ double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+
+ if ( fStartAngle > fEndAngle )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
+ {
+ nSwitch ^=1;
+ aIntermediatePoint = aEndingPoint;
+ aEndingPoint = aStartingPoint;
+ aStartingPoint = aIntermediatePoint;
+ fG = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fG;
+ }
+ FloatPoint fRadius;
+ fRadius.Y = fRadius.X = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+
+ double fOrientation = 0;
+ mpOutAct->DrawEllipticalArc( aCenterPoint, fRadius, fOrientation, nType, fStartAngle, fEndAngle );
+ }
+ }
+ break;
+
+ case 0x0f : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc Centre" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint( aCenter, sal_True );
+ ImplGetVector( &vector[ 0 ] );
+
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ aRadius.X = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( mbAngReverse )
+ ImplSwitchStartEndAngle( fStartAngle, fEndAngle );
+
+ if ( mbFigure )
+ {
+ Rectangle aBoundingBox(
+ Point( (long)( aCenter.X - aRadius.X ), long( aCenter.Y - aRadius.X ) ),
+ Size( static_cast< long >( 2 * aRadius.X ), (long)( 2 * aRadius.X ) ) );
+ Polygon aPolygon( aBoundingBox,
+ Point( (long)vector[ 0 ], (long)vector[ 1 ] ),
+ Point( (long)vector[ 2 ], (long)vector[ 3 ] ), POLY_ARC );
+ mpOutAct->RegPolyLine( aPolygon );
+ }
+ else
+ {
+ fOrientation = 0;
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation, 2, fStartAngle, fEndAngle );
+ }
+ mnParaSize = mnElementSize;
+
+ }
+ break;
+
+ case 0x10 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc Centre Close" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetPoint( aCenter, sal_True );
+ ImplGetVector( &vector[ 0 ] );
+ if ( pElement->eVDCType == VDC_REAL )
+ {
+ aRadius.X = (double)ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ else
+ {
+ aRadius.X = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ ImplMapDouble( aRadius.X );
+ aRadius.Y = aRadius.X;
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( mbAngReverse )
+ ImplSwitchStartEndAngle( fStartAngle, fEndAngle );
+
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+ fOrientation = 0;
+
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fStartAngle, fEndAngle );
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x11 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Ellipse" )
+ {
+ double fOrientation;
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ ImplGetEllipse( aCenter, aRadius, fOrientation ) ;
+ mpOutAct->DrawEllipse( aCenter, aRadius, fOrientation ) ;
+ }
+ break;
+
+ case 0x12 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Elliptical Arc" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ sal_Bool bDirection = ImplGetEllipse( aCenter, aRadius, fOrientation );
+ ImplGetVector( &vector[ 0 ] );
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ if ( bDirection )
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ 2, fStartAngle, fEndAngle );
+ else
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ 2, fEndAngle, fStartAngle);
+ }
+ break;
+
+ case 0x13 : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Elliptical Arc Close" )
+ {
+ double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ FloatPoint aCenter, aRadius;
+
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+
+ sal_Bool bDirection = ImplGetEllipse( aCenter, aRadius, fOrientation );
+ ImplGetVector( &vector[ 0 ] );
+
+ fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
+ fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+
+ if ( vector[ 1 ] > 0 )
+ fStartAngle = 360 - fStartAngle;
+ if ( vector[ 3 ] > 0 )
+ fEndAngle = 360 - fEndAngle;
+
+ sal_uInt32 nType = ImplGetUI16();
+ if ( nType == 0 )
+ nType = 0; // is PIE
+ else
+ nType = 1; // is CHORD
+
+ if ( bDirection )
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fStartAngle, fEndAngle );
+ else
+ mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
+ nType, fEndAngle, fStartAngle);
+ }
+ break;
+ case 0x14 : ComOut( CGM_LEVEL2, "Circular Arc Centre Reversed" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x15 : ComOut( CGM_LEVEL2, "Connection Edge" ) // NS
+ {
+// if ( mbFigure )
+// mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x16 : ComOut( CGM_LEVEL3, "Hyperbolic Arc" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x17 : ComOut( CGM_LEVEL3, "Parabolic Arc" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x18 : ComOut( CGM_LEVEL3, "Non Uniform B-Spline" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x19 : ComOut( CGM_LEVEL3, "Non Uniform Rational B-Spline" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1a : ComOut( CGM_LEVEL3, "Polybezier" )
+ {
+ sal_uInt32 nOrder = ImplGetI( pElement->nIntegerPrecision );
+
+ USHORT nNumberOfPoints = sal::static_int_cast< USHORT >(( mnElementSize - pElement->nIntegerPrecision ) / ImplGetPointSize());
+
+ Polygon aPolygon( nNumberOfPoints );
+
+ for ( USHORT i = 0; i < nNumberOfPoints; i++)
+ {
+ FloatPoint aFloatPoint;
+ ImplGetPoint( aFloatPoint, sal_True );
+ aPolygon.SetPoint( Point ( (long)( aFloatPoint.X ), (long)( aFloatPoint.Y ) ), i );
+ }
+ if ( nOrder & 4 )
+ {
+ for ( USHORT i = 0; i < nNumberOfPoints; i++ )
+ {
+ if ( ( i % 3 ) == 0 )
+ aPolygon.SetFlags( i, POLY_NORMAL );
+ else
+ aPolygon.SetFlags( i, POLY_CONTROL );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < nNumberOfPoints; i++ )
+ {
+ switch ( i & 3 )
+ {
+ case 0 :
+ case 3 : aPolygon.SetFlags( i, POLY_NORMAL ); break;
+ default : aPolygon.SetFlags( i, POLY_CONTROL ); break;
+ }
+ }
+ }
+ if ( mbFigure )
+ mpOutAct->RegPolyLine( aPolygon );
+ else
+ mpOutAct->DrawPolybezier( aPolygon );
+ mnParaSize = mnElementSize;
+ }
+ break;
+
+ case 0x1b : ComOut( CGM_LEVEL3, "Polysymbol" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1c : ComOut( CGM_LEVEL3, "Bitonal Tile" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1d : ComOut( CGM_LEVEL3, "Tile" ) // NS
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0x1e : ComOut( CGM_UNKNOWN_LEVEL, "Insert Object" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "Polybezier" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "Sharp Polybezier" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "Polyspline" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "Reounded Rectangle" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "Begin Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "End Cell Array" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "Insert File" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "Block Text" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf7 : ComOut( CGM_GDSF_ONLY, "Variable Width Polyline" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf6 : ComOut( CGM_GDSF_ONLY, "Elliptical Arc 3 Point" )
+ {
+ if ( mbFigure )
+ mpOutAct->CloseRegion();
+ }
+ break;
+ case 0xf1 : ComOut( CGM_GDSF_ONLY, "Hyperlink Definition" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+ }
+ else
+ mnParaSize = mnElementSize;
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class5.cxx b/filter/source/graphicfilter/icgm/class5.cxx
new file mode 100644
index 000000000000..5f12108859f1
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class5.cxx
@@ -0,0 +1,526 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+//#define VCL_NEED_BASETSD
+
+#include <main.hxx>
+#include <outact.hxx>
+
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass5()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Line Bundle Index" )
+ pElement->pLineBundle = (LineBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aLineList, pElement->aLineBundle );
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Line Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_LINETYPE )
+ pElement->pLineBundle->eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x03 : ComOut( CGM_LEVEL1, "Line Width" )
+ {
+ double nWidth;
+ if ( pElement->eLineWidthSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25; // scaling in 1/4 mm
+
+ ( pElement->nAspectSourceFlags & ASF_LINEWIDTH )
+ ? pElement->aLineBundle.nLineWidth = nWidth
+ : pElement->aLineBundle.nLineWidth = nWidth;
+ }
+ break;
+ case 0x04 : ComOut( CGM_LEVEL1, "Line Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_LINECOLOR )
+ pElement->pLineBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aLineBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x05 : ComOut( CGM_LEVEL1, "Marker Bundle Index" )
+ pElement->pMarkerBundle = (MarkerBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aMarkerList, pElement->aMarkerBundle );
+ break;
+ case 0x06 : ComOut( CGM_LEVEL1, "Marker Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_MARKERTYPE )
+ pElement->pMarkerBundle->eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x07 : ComOut( CGM_LEVEL1, "Marker Size" )
+ {
+ double nWidth;
+ if ( pElement->eMarkerSizeSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
+ ( pElement->nAspectSourceFlags & ASF_MARKERSIZE )
+ ? pElement->aMarkerBundle.nMarkerSize = nWidth
+ : pElement->aMarkerBundle.nMarkerSize = nWidth;
+ }
+ break;
+ case 0x08 : ComOut( CGM_LEVEL1, "Marker Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_MARKERCOLOR )
+ pElement->pMarkerBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aMarkerBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x09 : ComOut( CGM_LEVEL1, "Text Bundle Index" )
+ pElement->pTextBundle = (TextBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aTextList, pElement->aTextBundle );
+ break;
+ case 0x0a : ComOut( CGM_LEVEL1, "Text Font Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX )
+ pElement->pTextBundle->nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x0b : ComOut( CGM_LEVEL1, "Text Precision" )
+ {
+ TextBundle* pBundle;
+ if ( pElement->nAspectSourceFlags & ASF_TEXTPRECISION )
+ pBundle = pElement->pTextBundle;
+ else
+ pBundle = &pElement->aTextBundle;
+ switch( ImplGetUI16() )
+ {
+ case 0 : pBundle->eTextPrecision = TPR_STRING; break;
+ case 1 : pBundle->eTextPrecision = TPR_CHARACTER; break;
+ case 2 : pBundle->eTextPrecision = TPR_STROKE; break;
+ default : pBundle->eTextPrecision = TPR_UNDEFINED; break;
+ }
+ }
+ break;
+ case 0x0c : ComOut( CGM_LEVEL1, "Character Expansion Factor" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION )
+ pElement->pTextBundle->nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ else
+ pElement->aTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x0d : ComOut( CGM_LEVEL1, "Character Spacing" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_CHARACTERSPACING )
+ pElement->pTextBundle->nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ else
+ pElement->aTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x0e : ComOut( CGM_LEVEL1, "Text Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
+ pElement->pTextBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aTextBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x0f : ComOut( CGM_LEVEL1, "Character Height" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ pElement->nCharacterHeight = ImplGetI( pElement->nVDCIntegerPrecision );
+ else // ->floating points
+ pElement->nCharacterHeight = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ ImplMapDouble( pElement->nCharacterHeight );
+ pElement->nCharacterHeight /= 18.0;
+ }
+ break;
+ case 0x10 : ComOut( CGM_LEVEL1, "Character Orientation" )
+ {
+ if ( pElement->eVDCType == VDC_INTEGER )
+ {
+ pElement->nCharacterOrientation[0] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[1] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[2] = ImplGetI( pElement->nVDCIntegerPrecision );
+ pElement->nCharacterOrientation[3] = ImplGetI( pElement->nVDCIntegerPrecision );
+ }
+ else // ->floating points
+ {
+ pElement->nCharacterOrientation[0] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[1] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[2] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ pElement->nCharacterOrientation[3] = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ }
+ }
+ break;
+ case 0x11 : ComOut( CGM_LEVEL1, "Text Path" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eTextPath = TPR_RIGHT; break;
+ case 1 : pElement->eTextPath = TPR_LEFT; break;
+ case 2 : pElement->eTextPath = TPR_UP; break;
+ case 3 : pElement->eTextPath = TPR_DOWN; break;
+ default : mbStatus = sal_False; break;
+ }
+ }
+ break;
+ case 0x12 : ComOut( CGM_LEVEL1, "Text Alignment" )
+ {
+ pElement->eTextAlignmentH = (TextAlignmentH)ImplGetUI16();
+ pElement->eTextAlignmentV = (TextAlignmentV)ImplGetUI16( 8 );
+ pElement->nTextAlignmentHCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ pElement->nTextAlignmentVCont = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ }
+ break;
+ case 0x13 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Set Index" )
+ pElement->nCharacterSetIndex = ImplGetI( pElement->nIndexPrecision );
+ break;
+ case 0x14 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Alternate Character Set Index" )
+ pElement->nAlternateCharacterSetIndex = ImplGetI( pElement->nIndexPrecision );
+ break;
+ case 0x15 : ComOut( CGM_LEVEL1, "Fill Bundle Index" )
+ pElement->pFillBundle = (FillBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aFillList, pElement->aFillBundle );
+ break;
+ case 0x16 : ComOut( CGM_LEVEL1, "Fill Interior Style" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
+ pElement->pFillBundle->eFillInteriorStyle = (FillInteriorStyle)ImplGetUI16();
+ else
+ pElement->aFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetUI16();
+ }
+ break;
+ case 0x17 : ComOut( CGM_LEVEL1, "Fill Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_FILLCOLOR )
+ pElement->pFillBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aFillBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x18 : ComOut( CGM_LEVEL1, "Fill Hatch Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_HATCHINDEX )
+ pElement->pFillBundle->nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x19 : ComOut( CGM_LEVEL1, "Fill Pattern Index" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_PATTERNINDEX )
+ pElement->pFillBundle->nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x1a : ComOut( CGM_LEVEL1, "Edge Bundle Index" )
+ pElement->pEdgeBundle = (EdgeBundle*)pElement->GetBundleIndex( ImplGetI( pElement->nIndexPrecision ), pElement->aEdgeList, pElement->aEdgeBundle );
+ break;
+ case 0x1b : ComOut( CGM_LEVEL1, "Edge Type" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_EDGETYPE )
+ pElement->pEdgeBundle->eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ else
+ pElement->aEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
+ }
+ break;
+ case 0x1c : ComOut( CGM_LEVEL1, "Edge Width" )
+ {
+ double nWidth;
+ if ( pElement->eEdgeWidthSpecMode == SM_ABSOLUTE )
+ {
+ if ( pElement->eVDCType == VDC_REAL )
+ nWidth = ImplGetFloat( pElement->eVDCRealPrecision, pElement->nVDCRealSize );
+ else
+ nWidth = (double)ImplGetI( pElement->nVDCIntegerPrecision );
+
+ ImplMapDouble( nWidth );
+ }
+ else
+ nWidth = (sal_uInt32)ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ) * 25;
+ ( pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
+ ? pElement->aEdgeBundle.nEdgeWidth = nWidth
+ : pElement->aEdgeBundle.nEdgeWidth = nWidth;
+ }
+ break;
+ case 0x1d : ComOut( CGM_LEVEL1, "Edge Color" )
+ {
+ if ( pElement->nAspectSourceFlags & ASF_EDGECOLOR )
+ pElement->pEdgeBundle->SetColor( ImplGetBitmapColor() );
+ else
+ pElement->aEdgeBundle.SetColor( ImplGetBitmapColor() );
+ }
+ break;
+ case 0x1e : ComOut( CGM_LEVEL1, "Edge Visibility" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eEdgeVisibility = EV_OFF; break;
+ case 1 : pElement->eEdgeVisibility = EV_ON; break;
+ default : mbStatus = sal_False;
+ }
+ }
+ break;
+ case 0x1f : ComOut( CGM_LEVEL1, "Fill Reference Point" )
+ ImplGetPoint( pElement->aFillRefPoint );
+ break;
+ case 0x20 : ComOut( CGM_LEVEL1, "Pattern Table" ) break;
+ case 0x21 : ComOut( CGM_LEVEL1, "Pattern Size" ) break;
+ case 0x22 : ComOut( CGM_LEVEL1, "Color Table" )
+ {
+ sal_uInt32 nColorStartIndex = ImplGetUI( pElement->nColorIndexPrecision );
+ if ( ( nColorStartIndex > 255 ) ||
+ ( ( ( mnElementSize - pElement->nColorIndexPrecision ) % ( pElement->nColorPrecision * 3 ) ) != 0 ) )
+ {
+ mbStatus = sal_False;
+ }
+ else
+ {
+ sal_uInt32 nColors = ( mnElementSize - pElement->nColorIndexPrecision ) / ( 3 * pElement->nColorPrecision );
+ if ( nColors )
+ {
+ sal_uInt32 nMaxColorIndex = nColorStartIndex + nColors - 1;
+ sal_uInt32 nIndex;
+ if ( nMaxColorIndex > 255 )
+ {
+ mbStatus = sal_False;
+ }
+ else
+ {
+ if ( pElement->nLatestColorMaximumIndex < nMaxColorIndex )
+ pElement->nLatestColorMaximumIndex = nMaxColorIndex;
+
+ for ( nIndex = nColorStartIndex; nIndex <= nMaxColorIndex; nIndex++ )
+ {
+ pElement->aLatestColorTable[ nIndex ] = ImplGetBitmapColor( sal_True );
+ }
+ }
+ pElement->nColorMaximumIndex = pElement->nLatestColorMaximumIndex;
+ for ( nIndex = nColorStartIndex; nIndex <= nMaxColorIndex; nIndex++ )
+ {
+ if ( !pElement->aColorTableEntryIs[ nIndex ] )
+ {
+ pElement->aColorTableEntryIs[ nIndex ] = 1;
+ pElement->aColorTable[ nIndex ] = pElement->aLatestColorTable[ nIndex ];
+ }
+ }
+ }
+ }
+ }
+ break;
+ case 0x23 : ComOut( CGM_LEVEL1, "Aspect Source Flags" )
+ {
+ int nFlags = mnElementSize >> 2;
+ while ( nFlags-- > 0 )
+ {
+ sal_uInt32 nFlag = 0;
+ switch( ImplGetUI16() )
+ {
+ case 0 : nFlag = ASF_LINETYPE; break;
+ case 1 : nFlag = ASF_LINEWIDTH; break;
+ case 2 : nFlag = ASF_LINECOLOR; break;
+ case 3 : nFlag = ASF_MARKERTYPE; break;
+ case 4 : nFlag = ASF_MARKERSIZE; break;
+ case 5 : nFlag = ASF_MARKERCOLOR; break;
+ case 6 : nFlag = ASF_FILLINTERIORSTYLE; break;
+ case 7 : nFlag = ASF_HATCHINDEX; break;
+ case 8 : nFlag = ASF_PATTERNINDEX; break;
+ case 9 : nFlag = ASF_BITMAPINDEX; break;
+ case 10 : nFlag = ASF_FILLCOLOR; break;
+ case 11 : nFlag = ASF_EDGETYPE; break;
+ case 12 : nFlag = ASF_EDGEWIDTH; break;
+ case 13 : nFlag = ASF_EDGECOLOR; break;
+ case 14 : nFlag = ASF_TEXTFONTINDEX; break;
+ case 15 : nFlag = ASF_TEXTPRECISION; break;
+ case 16 : nFlag = ASF_CHARACTEREXPANSION; break;
+ case 17 : nFlag = ASF_CHARACTERSPACING; break;
+ case 18 : nFlag = ASF_TEXTCOLOR; break;
+ default : mbStatus = sal_False; break;
+ }
+ sal_uInt32 nASF = ImplGetUI16();
+ switch ( nASF )
+ {
+ case 0 : pElement->nAspectSourceFlags &= ~nFlag; break; // INDIVIDUAL
+ case 1 : pElement->nAspectSourceFlags |= nFlag; break; // BUNDLED
+ default : mbStatus = sal_False; break;
+ }
+ }
+ }
+ break;
+ case 0x24 : ComOut( CGM_LEVEL2, "Pick Identifier" ) break;
+ case 0x25 : ComOut( CGM_LEVEL3, "Line Cap" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eLineCapType = LCT_BUTT; break;
+ case 1 : pElement->eLineCapType = LCT_ROUND; break;
+ case 2 : pElement->eLineCapType = LCT_SQUARE; break;
+ case 3 : pElement->eLineCapType = LCT_TRIANGLE; break;
+ case 4 : pElement->eLineCapType = LCT_ARROW; break;
+ default : pElement->eLineCapType = LCT_NONE; break;
+ }
+ }
+ break;
+ case 0x26 : ComOut( CGM_LEVEL3, "Line Join" )
+ {
+ switch( ImplGetUI16() )
+ {
+ case 0 : pElement->eLineJoinType = LJT_MITER; break;
+ case 1 : pElement->eLineJoinType = LJT_ROUND; break;
+ case 2 : pElement->eLineJoinType = LJT_BEVEL; break;
+ default : pElement->eLineJoinType = LJT_NONE; break;
+ }
+ }
+ break;
+ case 0x27 : ComOut( CGM_LEVEL3, "Line Type Continuation" ) break; // NS
+ case 0x28 : ComOut( CGM_LEVEL3, "Line Type Initial Offset" ) break; // NS
+ case 0x29 : ComOut( CGM_LEVEL3, "Text Score Type" ) break;
+ case 0x2a : ComOut( CGM_LEVEL3, "Restricted Text Type" ) break;
+ case 0x2b : ComOut( CGM_LEVEL3, "Interpolated interior" ) break;
+ case 0x2c : ComOut( CGM_LEVEL3, "Edge Cap" ) break; // NS
+ case 0x2d : ComOut( CGM_LEVEL3, "Edge Join" ) break;
+ case 0x2e : ComOut( CGM_LEVEL3, "Edge Type Continuation" ) break; // NS
+ case 0x2f : ComOut( CGM_LEVEL3, "Edge Type Initial Offset" ) break; // NS
+ case 0x30 : ComOut( CGM_LEVEL3, "Symbol Library Index" ) break; // NS
+ case 0x31 : ComOut( CGM_LEVEL3, "Symbol Color" ) break; // NS
+ case 0x32 : ComOut( CGM_LEVEL3, "Symbol Size" ) break; // NS
+ case 0x33 : ComOut( CGM_LEVEL3, "Symbol Orientation" ) break; // NS
+ case 0x50 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Margins" ) break;
+ case 0x51 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Expansion" ) break;
+ case 0x52 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Region Anchor" ) break;
+ case 0x53 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Horizontal Alignment" ) break;
+ case 0x54 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Vertical Alignment" ) break;
+ case 0x55 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Line Flow" ) break;
+ case 0x60 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Spacing" ) break;
+ case 0x61 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Indent" ) break;
+ case 0x62 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Tabs" ) break;
+ case 0x63 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Bullets" ) break;
+ case 0x64 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Bullet Level" ) break;
+ case 0x65 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Line Horizontal Alignment" ) break;
+ case 0x66 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Line Vertical Alignment" ) break;
+ case 0x67 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragragh Line Spacing" ) break;
+ case 0x68 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Paragraph Word Wrap" ) break;
+ case 0x70 : ComOut( CGM_UNKNOWN_LEVEL, "Block Text Forward Advance Distance" ) break;
+ case 0x71 : ComOut( CGM_UNKNOWN_LEVEL, "Word Spacing" ) break;
+ case 0x72 : ComOut( CGM_UNKNOWN_LEVEL, "External Leading" ) break;
+ case 0x7a : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Offset" )
+ {
+ long nHorzOffset = ImplGetI( pElement->nIndexPrecision );
+ long nVertOffset = ImplGetI( pElement->nIndexPrecision );
+ sal_uInt32 nType = ImplGetUI16();
+ mpOutAct->SetGradientOffset( nHorzOffset, nVertOffset, nType );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7b : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Edge" )
+ {
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7c : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Angle" )
+ {
+ mpOutAct->SetGradientAngle( ImplGetI( pElement->nIndexPrecision ) );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7d : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Description" )
+ {
+ ImplGetI( pElement->nIndexPrecision ); // -Wall is this needed?
+ sal_uInt32 nNumberOfStages = ImplGetI( pElement->nIndexPrecision );
+ sal_uInt32 i, nColorFrom = 0;
+ sal_uInt32 nColorTo = 0xffffff;
+
+ //FIXME, does this loop actually do anything?
+ for ( i = 0; i < nNumberOfStages; i++ )
+ {
+ ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize ); // -Wall is this needed
+ }
+
+ for ( i = 0; i <= nNumberOfStages; i++ )
+ {
+ sal_uInt32 nPara = mnParaSize + 24;
+ if ( i == 0 )
+ {
+ nColorTo = ImplGetBitmapColor();
+ nColorFrom = nColorTo ^ 0xffffff;
+ }
+ else if ( i == 1 )
+ nColorFrom = ImplGetBitmapColor();
+ mnParaSize = nPara;
+ }
+ if ( nNumberOfStages > 1 )
+ mpOutAct->SetGradientStyle( 0xff, 1 );
+
+ mpOutAct->SetGradientDescriptor( nColorFrom, nColorTo );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0x7e : ComOut( CGM_UNKNOWN_LEVEL, "set Gradient Style" )
+ {
+ sal_uInt32 nStyle = ImplGetUI16( 8 );
+ double fRatio = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
+ mpOutAct->SetGradientStyle( nStyle, fRatio );
+ mnAct4PostReset |= ACT4_GRADIENT_ACTION;
+ }
+ break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "inquire Font metrics" ) break;
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire character widths" ) break;
+ case 0xfd : ComOut( CGM_GDSF_ONLY, "set Text Font" ) break;
+ case 0xfc : ComOut( CGM_GDSF_ONLY, "set current position" ) break;
+ case 0xfb : ComOut( CGM_GDSF_ONLY, "set current position mode" ) break;
+ case 0xfa : ComOut( CGM_GDSF_ONLY, "set character height mode" ) break;
+ case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Transform matrix 2D" ) break;
+ case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Transform matrix 3D" ) break;
+ case 0xf7 : ComOut( CGM_GDSF_ONLY, "pop transformation state" ) break;
+ case 0xf6 : ComOut( CGM_GDSF_ONLY, "clear transformation state" ) break;
+ case 0xf5 : ComOut( CGM_GDSF_ONLY, "set character widths" ) break;
+ case 0xf4 : ComOut( CGM_GDSF_ONLY, "set color name - for Pantone support" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/class7.cxx b/filter/source/graphicfilter/icgm/class7.cxx
new file mode 100644
index 000000000000..cd0605a80655
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/class7.cxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <chart.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass7()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Message" ) break;
+ case 0x02 :
+ {
+ sal_uInt8* pAppData = mpSource + 12;
+ sal_uInt16* pTemp = (sal_uInt16*)mpSource;
+ sal_uInt16 nOpcode = pTemp[ 4 ];
+
+ if ( mpChart || ( nOpcode == 0 ) )
+ {
+ switch ( nOpcode )
+ {
+ case 0x000 : ComOut( CGM_LEVEL1, "AppData - Beginning of File Opcodes" )
+ {
+ if ( mpChart == NULL )
+ mpChart = new CGMChart( *this );
+ mpChart->mnCurrentFileType = pAppData[ 3 ];
+ }
+ break;
+ case 0x001 : ComOut( CGM_LEVEL1, "AppData - End of File Opcodes" ) break;
+ case 0x190 : ComOut( CGM_LEVEL1, "AppData - FDESC" ) break;
+ case 0x192 : ComOut( CGM_LEVEL1, "AppData - FNOTES" ) break;
+ case 0x1F4 : ComOut( CGM_LEVEL1, "AppData - BOGENFILE" ) break;
+ case 0x1F5 : ComOut( CGM_LEVEL1, "AppData - EOGENFILE" ) break;
+ case 0x1F8 : ComOut( CGM_LEVEL1, "AppData - BOCHTGROUP" ) break;
+ case 0x1F9 : ComOut( CGM_LEVEL1, "AppData - EOCHTGROUP" ) break;
+ case 0x1FC : ComOut( CGM_LEVEL1, "AppData - BOCHTDATA" ) break;
+ case 0x1FD : ComOut( CGM_LEVEL1, "AppData - EOCHTDATA" )
+ {
+ mpOutAct->DrawChart();
+ }
+ break;
+ case 0x200 : ComOut( CGM_LEVEL1, "AppData - BOSYMGROUP" ) break;
+ case 0x201 : ComOut( CGM_LEVEL1, "AppData - EOSYMGROUP" ) break;
+ case 0x204 : ComOut( CGM_LEVEL1, "AppData - BEGSYMBOL" ) break;
+ case 0x205 : ComOut( CGM_LEVEL1, "AppData - ENDSYMBOL" ) break;
+ case 0x208 : ComOut( CGM_LEVEL1, "AppData - BOSHWGROUP" ) break;
+ case 0x209 : ComOut( CGM_LEVEL1, "AppData - EOSHWGROUP" ) break;
+ case 0x260 : ComOut( CGM_LEVEL1, "AppData - BEGGROUP" ) break;
+ case 0x262 : ComOut( CGM_LEVEL1, "AppData - ENDGROUP" ) break;
+ case 0x264 : ComOut( CGM_LEVEL1, "AppData - DATANODE" )
+ {
+ mpChart->mDataNode[ 0 ] = *(DataNode*)( pAppData );
+ sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum;
+ if ( nZoneEnum && ( nZoneEnum <= 6 ) )
+ mpChart->mDataNode[ nZoneEnum ] = *(DataNode*)( pAppData );
+ }
+ break;
+ case 0x2BE : ComOut( CGM_LEVEL1, "AppData - SHWSLIDEREC" )
+ {
+ if ( mnMode & CGM_EXPORT_IMPRESS )
+ {
+ if ( pAppData[ 16 ] == 0 ) // a blank template ?
+ {
+ if ( pAppData[ 2 ] == 46 )
+ {
+ // this starts the document -> maybe we could insert a new document
+ }
+ else if ( pAppData[ 2 ] & 0x80 )
+ {
+ // this is a template
+ }
+ else
+ {
+ mpOutAct->InsertPage();
+ }
+ }
+ mpChart->ResetAnnotation();
+ }
+ }
+ break;
+ case 0x2C0 : ComOut( CGM_LEVEL1, "AppData - SHWKEYTABLE" ) break;
+ case 0x2C2 : ComOut( CGM_LEVEL1, "AppData - SHWBUTTONTAB" ) break;
+ case 0x2C4 : ComOut( CGM_LEVEL1, "AppData - SHWGLOBAL" ) break;
+ case 0x2C6 : ComOut( CGM_LEVEL1, "AppData - SHWTITLE" ) break;
+ case 0x2CA : ComOut( CGM_LEVEL1, "AppData - SHWAPP" ) break;
+ case 0x320 : ComOut( CGM_LEVEL1, "AppData - TEXT" )
+ {
+ TextEntry* pTextEntry = new TextEntry;
+ pTextEntry->nTypeOfText = *((sal_uInt16*)( pAppData ) );
+ pTextEntry->nRowOrLineNum = *((sal_uInt16*)( pAppData + 2 ) );
+ pTextEntry->nColumnNum = *((sal_uInt16*)( pAppData + 4 ) );
+ sal_uInt16 nAttributes = *( (sal_uInt16*)( pAppData + 6 ) );
+ pTextEntry->nZoneSize = nAttributes & 0xff;
+ pTextEntry->nLineType = ( nAttributes >> 8 ) & 0xf;
+ nAttributes >>= 12;
+ pTextEntry->nAttributes = nAttributes;
+ pAppData += 8;
+ sal_uInt32 nLen = strlen( (char*)( pAppData ) ) + 1;
+ pTextEntry->pText = new char[ nLen ];
+ memcpy( pTextEntry->pText, pAppData, nLen );
+ pAppData += nLen;
+
+ TextAttribute* pTextOld = 0;
+ for ( sal_uInt16 i = 0; i < nAttributes; i++ )
+ {
+ TextAttribute* pTextAttr = new TextAttribute;
+
+ *pTextAttr = *(TextAttribute*)( pAppData );
+
+ pTextAttr->pNextAttribute = NULL;
+ if ( i == 0 )
+ pTextEntry->pAttribute = pTextAttr;
+ else
+ pTextOld->pNextAttribute = pTextAttr;
+
+ pAppData += sizeof( TextAttribute ) - 4;
+ pTextOld = pTextAttr;
+ }
+ mpChart->InsertTextEntry( pTextEntry );
+ }
+ break;
+ case 0x321 : ComOut( CGM_LEVEL1, "AppData - IOC_TABS" ) break;
+ case 0x322 : ComOut( CGM_LEVEL1, "AppData - CHARTZONE" )
+ {
+ mpChart->mChartZone = *( ChartZone* )( pAppData );
+ }
+ break;
+ case 0x324 : ComOut( CGM_LEVEL1, "AppData - TITLEZONE" ) break;
+ case 0x328 : ComOut( CGM_LEVEL1, "AppData - FOOTNOTEZONE" ) break;
+ case 0x32A : ComOut( CGM_LEVEL1, "AppData - LEGENDZONE" ) break;
+ case 0x330 : ComOut( CGM_LEVEL1, "AppData - PAGEORIENTDIM" )
+ {
+ mpChart->mPageOrientDim = *( PageOrientDim*)( pAppData );
+ }
+ break;
+ case 0x334 : ComOut( CGM_LEVEL1, "AppData - CHTZONEOPTN" )
+ {
+ mpChart->mZoneOption = *( ZoneOption*)( pAppData );
+ }
+ break;
+ case 0x336 : ComOut( CGM_LEVEL1, "AppData - CHTINTL" )
+ {
+ mpChart->mIntSettings = *( IntSettings*)( pAppData );
+ }
+ break;
+ case 0x338 : ComOut( CGM_LEVEL1, "AppData - CHTLINESPC" ) break;
+ case 0x384 : ComOut( CGM_LEVEL1, "AppData - ORGGRIDSTATE" ) break;
+ case 0x386 : ComOut( CGM_LEVEL1, "AppData - ORGSCRSTATE" ) break;
+ case 0x388 : ComOut( CGM_LEVEL1, "AppData - ORGTREESTATE" ) break;
+ case 0x38A : ComOut( CGM_LEVEL1, "AppData - ORGTEXTOPTN" ) break;
+ case 0x38E : ComOut( CGM_LEVEL1, "AppData - ORGBOXOPTN" ) break;
+ case 0x390 : ComOut( CGM_LEVEL1, "AppData - ORGBOXDIM" ) break;
+ case 0x392 : ComOut( CGM_LEVEL1, "AppData - ORGBOX" ) break;
+ case 0x3EA : ComOut( CGM_LEVEL1, "AppData - TTLTEXTOPTN" ) break;
+ case 0x3EE : ComOut( CGM_LEVEL1, "AppData - TTLAUTOBUILD" ) break;
+ case 0x44E : ComOut( CGM_LEVEL1, "AppData - BULTEXTOPTN" ) break;
+ case 0x452 : ComOut( CGM_LEVEL1, "AppData - BULLETOPTN" )
+ {
+ mpChart->mBulletOption = *( BulletOption*)( pAppData );
+ }
+ break;
+ case 0x454 : ComOut( CGM_LEVEL1, "AppData - BULLETLINES" )
+ {
+ mpChart->mBulletLines = *( BulletLines*)( pAppData );
+ }
+ break;
+ case 0x456 : ComOut( CGM_LEVEL1, "AppData - BULAUTOBUILD" ) break;
+ case 0x4B2 : ComOut( CGM_LEVEL1, "AppData - TBLTEXTOPTN" ) break;
+ case 0x4B6 : ComOut( CGM_LEVEL1, "AppData - TBLOPTN" ) break;
+ case 0x4B8 : ComOut( CGM_LEVEL1, "AppData - TBLCOLOPTN" ) break;
+ case 0x4BA : ComOut( CGM_LEVEL1, "AppData - TBLLEGENDOPTN" ) break;
+ case 0x4BC : ComOut( CGM_LEVEL1, "AppData - TBLRANGEOPTN" ) break;
+ case 0x4BE : ComOut( CGM_LEVEL1, "AppData - TBLROWOPTN" ) break;
+ case 0x4C0 : ComOut( CGM_LEVEL1, "AppData - TBLAUTOBUILD" ) break;
+ case 0x518 : ComOut( CGM_LEVEL1, "AppData - PIECHARTOPTN" ) break;
+ case 0x51A : ComOut( CGM_LEVEL1, "AppData - PIELEGENDOPTN" ) break;
+ case 0x51C : ComOut( CGM_LEVEL1, "AppData - PIETEXTOPTN" ) break;
+ case 0x51E : ComOut( CGM_LEVEL1, "AppData - PIEOPTN" ) break;
+ case 0x520 : ComOut( CGM_LEVEL1, "AppData - PIEPCTLABOPTN" ) break;
+ case 0x522 : ComOut( CGM_LEVEL1, "AppData - PIEVALLABOPTN" ) break;
+ case 0x524 : ComOut( CGM_LEVEL1, "AppData - PIESLICE" ) break;
+ case 0x57A : ComOut( CGM_LEVEL1, "AppData - XYAXISOPTN" ) break;
+ case 0x57C : ComOut( CGM_LEVEL1, "AppData - XYGRIDOPTN" ) break;
+ case 0x57D : ComOut( CGM_LEVEL1, "AppData - XYGRIDSHOWFILL" ) break;
+ case 0x57E : ComOut( CGM_LEVEL1, "AppData - XYSERIESOPTN" ) break;
+ case 0x580 : ComOut( CGM_LEVEL1, "AppData - XYSTYLEOPTN" ) break;
+ case 0x582 : ComOut( CGM_LEVEL1, "AppData - XYTABLEOPTN" ) break;
+ case 0x584 : ComOut( CGM_LEVEL1, "AppData - XYTEXTOPTN" ) break;
+ case 0x586 : ComOut( CGM_LEVEL1, "AppData - XYDATAOPTN" ) break;
+ case 0x58A : ComOut( CGM_LEVEL1, "AppData - XYLEGENDOPN" ) break;
+ case 0x58C : ComOut( CGM_LEVEL1, "AppData - XYCALCULATION" ) break;
+ case 0x58E : ComOut( CGM_LEVEL1, "AppData - XYXVALUE" ) break;
+ case 0x590 : ComOut( CGM_LEVEL1, "AppData - XYYVALUE" ) break;
+ case 0x592 : ComOut( CGM_LEVEL1, "AppData - XYXEXTVALUE" ) break;
+ case 0x618 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTCOLRTAB" ) break;
+ case 0x619 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTFONTTAB" ) break;
+ case 0x1fff : ComOut( CGM_LEVEL1, "AppData - 0x1fff" ) break;
+ default : ComOut( CGM_LEVEL1, "UNKNOWN Application Data" ) break;
+ }
+ }
+ mnParaSize = mnElementSize;
+ break;
+ }
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/classx.cxx b/filter/source/graphicfilter/icgm/classx.cxx
new file mode 100644
index 000000000000..79dbd44deda8
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/classx.cxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <main.hxx>
+#include <outact.hxx>
+
+// ---------------------------------------------------------------
+
+#define ImplSetUnderlineMode() \
+ \
+ sal_uInt32 nMode = ImplGetUI16(); \
+ switch ( nMode ) \
+ { \
+ case 1 : pElement->eUnderlineMode = UM_LOW; break; \
+ case 2 : pElement->eUnderlineMode = UM_HIGH; break; \
+ case 4 : pElement->eUnderlineMode = UM_STRIKEOUT; break;\
+ case 8 : pElement->eUnderlineMode = UM_OVERSCORE; break;\
+ default: pElement->eUnderlineMode = UM_OFF; break; \
+ } \
+ pElement->nUnderlineColor = ImplGetBitmapColor();
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass6()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL1, "Escape" )
+ {
+ long nIdentifier = ImplGetI( pElement->nIntegerPrecision );
+ switch ( nIdentifier )
+ {
+ case 0 : ComOut( CGM_DESCRIPTION, "inquire function support" ) break;
+ case -1 : ComOut( CGM_DESCRIPTION, "set underline mode" )
+ {
+ ImplSetUnderlineMode()
+ }
+ break;
+ case -2 : ComOut( CGM_DESCRIPTION, "set script mode" ) break;
+ case -3 : ComOut( CGM_DESCRIPTION, "set shadow mode" ) break;
+ case -6 : ComOut( CGM_DESCRIPTION, "inquire origin offset" ) break;
+ case -8 : ComOut( CGM_DESCRIPTION, "set media size" ) break;
+ case -10 : ComOut( CGM_DESCRIPTION, "set character mode" ) break;
+ case -14 : ComOut( CGM_DESCRIPTION, "resolution mode" ) break;
+ case -17 : ComOut( CGM_DESCRIPTION, "line cap" ) break;
+ case -18 : ComOut( CGM_DESCRIPTION, "line join" ) break;
+ case -19 : ComOut( CGM_DESCRIPTION, "edge join" ) break;
+ case -30 : ComOut( CGM_DESCRIPTION, "media type" ) break;
+ case -31 : ComOut( CGM_DESCRIPTION, "number of copies" ) break;
+ case -32 : ComOut( CGM_DESCRIPTION, "orientation" ) break;
+ case -33 : ComOut( CGM_DESCRIPTION, "device color representation" ) break;
+ case -34 : ComOut( CGM_DESCRIPTION, "device font list" ) break;
+ case -35 : ComOut( CGM_DESCRIPTION, "color reversal mode" ) break;
+ case -36 : ComOut( CGM_DESCRIPTION, "line cap attributes" ) break;
+ case -37 : ComOut( CGM_DESCRIPTION, "begin effect" ) break;
+ case -38 : ComOut( CGM_DESCRIPTION, "end effect" ) break;
+ case -39 : ComOut( CGM_DESCRIPTION, "begin effect definition" ) break;
+ case -40 : ComOut( CGM_DESCRIPTION, "end effect definition" ) break;
+ case -41 : ComOut( CGM_DESCRIPTION, "end style definition" ) break;
+ case -42 : ComOut( CGM_DESCRIPTION, "begin eps data" ) break;
+ case -43 : ComOut( CGM_DESCRIPTION, "eps data" ) break;
+ case -44 : ComOut( CGM_DESCRIPTION, "end eps data" ) break;
+ case -45 : ComOut( CGM_DESCRIPTION, "set background style" ) break;
+ case -46 : ComOut( CGM_DESCRIPTION, "set eps mode" ) break;
+ case -47 : ComOut( CGM_DESCRIPTION, "fill mode" ) break;
+ case -48 : ComOut( CGM_DESCRIPTION, "begin symbol" ) break;
+ case -49 : ComOut( CGM_DESCRIPTION, "end symbol" ) break;
+ case -50 : ComOut( CGM_DESCRIPTION, "begin layer" ) break;
+ case -51 : ComOut( CGM_DESCRIPTION, "end layer" ) break;
+ case -52 : ComOut( CGM_DESCRIPTION, "layer visibility" ) break;
+ case -53 : ComOut( CGM_DESCRIPTION, "inquire foreign data" ) break;
+ case -54 : ComOut( CGM_DESCRIPTION, "set text offset" ) break;
+ case -55 : ComOut( CGM_DESCRIPTION, "begin group" ) break;
+ case -56 : ComOut( CGM_DESCRIPTION, "end group" ) break;
+ case -100 : ComOut( CGM_DESCRIPTION, "begin patch" ) break;
+ case -101 : ComOut( CGM_DESCRIPTION, "end patch" ) break;
+ case -102 : ComOut( CGM_DESCRIPTION, "begin block text region" ) break;
+ case -103 : ComOut( CGM_DESCRIPTION, "end block text region" ) break;
+ case -120 : ComOut( CGM_DESCRIPTION, "region margins" ) break;
+ case -121 : ComOut( CGM_DESCRIPTION, "region expansions" ) break;
+ case -122 : ComOut( CGM_DESCRIPTION, "region anchor" ) break;
+ case -123 : ComOut( CGM_DESCRIPTION, "paragraph horizontal align" ) break;
+ case -124 : ComOut( CGM_DESCRIPTION, "paragraph vertical align" ) break;
+ case -125 : ComOut( CGM_DESCRIPTION, "region line flow" ) break;
+ case -130 : ComOut( CGM_DESCRIPTION, "paragraph spacing" ) break;
+ case -131 : ComOut( CGM_DESCRIPTION, "paragraph identation" ) break;
+ case -132 : ComOut( CGM_DESCRIPTION, "paragraph tabs" ) break;
+ case -133 : ComOut( CGM_DESCRIPTION, "paragraph bullet" ) break;
+ case -134 : ComOut( CGM_DESCRIPTION, "paragraph bulet level" ) break;
+ case -135 : ComOut( CGM_DESCRIPTION, "line horuzontal align" ) break;
+ case -136 : ComOut( CGM_DESCRIPTION, "line vertical align" ) break;
+ case -137 : ComOut( CGM_DESCRIPTION, "line spacing" ) break;
+ case -138 : ComOut( CGM_DESCRIPTION, "word wrap" ) break;
+ case -150 : ComOut( CGM_DESCRIPTION, "forward advance distance" ) break;
+ case -151 : ComOut( CGM_DESCRIPTION, "word spacing" ) break;
+ case -152 : ComOut( CGM_DESCRIPTION, "external leading" ) break;
+ case -160 : ComOut( CGM_DESCRIPTION, "set gradient offset" ) break;
+ case -161 : ComOut( CGM_DESCRIPTION, "set gradient edge" ) break;
+ case -162 : ComOut( CGM_DESCRIPTION, "set gradient angle" ) break;
+ case -163 : ComOut( CGM_DESCRIPTION, "set gradient description" ) break;
+ case -164 : ComOut( CGM_DESCRIPTION, "set gradient style" ) break;
+ case -165 : ComOut( CGM_DESCRIPTION, "set back ground style" ) break;
+ case -170 : ComOut( CGM_DESCRIPTION, "geometric pattern draw style" ) break;
+ case -190 : ComOut( CGM_DESCRIPTION, "set character width" ) break;
+ case -191 : ComOut( CGM_DESCRIPTION, "hyperlink definitions" ) break;
+ case -192 : ComOut( CGM_DESCRIPTION, "set color name for pantone" ) break;
+ case -32746 : ComOut( CGM_DESCRIPTION, "set text font" ) break;
+ case -32747 : ComOut( CGM_DESCRIPTION, "font selection mode" ) break;
+ case -32752 : ComOut( CGM_DESCRIPTION, "connecting edge" ) break;
+ case -32753 : ComOut( CGM_DESCRIPTION, "set drawing mode" ) break;
+ case -32754 : ComOut( CGM_DESCRIPTION, "inquire clip rectangle" ) break;
+ case -32755 : ComOut( CGM_DESCRIPTION, "protection region indicator" ) break;
+ case -32756 : ComOut( CGM_DESCRIPTION, "end protection region" ) break;
+ case -32757 : ComOut( CGM_DESCRIPTION, "begin protection region" ) break;
+ case -32758 : ComOut( CGM_DESCRIPTION, "geometric pattern definition" ) break;
+ case -32759 : ComOut( CGM_DESCRIPTION, "hatch style definition" ) break;
+ case -32760 : ComOut( CGM_DESCRIPTION, "close figure" ) break;
+ case -32761 : ComOut( CGM_DESCRIPTION, "end figure" )
+ {
+ mpOutAct->EndFigure();
+ mbFigure = sal_False;
+ }
+ break;
+ case -32762 : ComOut( CGM_DESCRIPTION, "begin figure" )
+ {
+ mbFigure = sal_True;
+ mpOutAct->BeginFigure();
+ }
+ break;
+ case -32763 : ComOut( CGM_DESCRIPTION, "pop transformatin" ) break;
+ case -32764 : ComOut( CGM_DESCRIPTION, "push transformation" ) break;
+ case -32765 : ComOut( CGM_DESCRIPTION, "copy segment" ) break;
+ case -32766 : ComOut( CGM_DESCRIPTION, "endseg" ) break;
+ case -32767 : ComOut( CGM_DESCRIPTION, "begin segment" ) break;
+ default : ComOut( CGM_DESCRIPTION, "????????????????????????????????" ) break;
+ }
+ mnParaSize = mnElementSize;
+ }
+ break;
+ case 0x02 : ComOut( CGM_LEVEL1, "Get Escape" ) break;
+ case 0x11 : ComOut( CGM_GDSF_ONLY, "Set Underline Mode" )
+ {
+ ImplSetUnderlineMode();
+ }
+ break;
+ case 0x12 : ComOut( CGM_GDSF_ONLY, "Set Script Mode" ) break;
+ case 0x13 : ComOut( CGM_GDSF_ONLY, "Set Shadow Mode" ) break;
+ case 0x18 : ComOut( CGM_GDSF_ONLY, "Set Media Size" ) break;
+ case 0x20 : ComOut( CGM_GDSF_ONLY, "Set Character Mode" ) break;
+ case 0x24 : ComOut( CGM_GDSF_ONLY, "Resolution Mode" ) break;
+ case 0x27 : ComOut( CGM_GDSF_ONLY, "Line Cap" ) break;
+ case 0x28 : ComOut( CGM_GDSF_ONLY, "Line Join" ) break;
+ case 0x29 : ComOut( CGM_GDSF_ONLY, "Edge Join" ) break;
+ case 0x40 : ComOut( CGM_GDSF_ONLY, "Media Type" ) break;
+ case 0x41 : ComOut( CGM_GDSF_ONLY, "Number of Copies" ) break;
+ case 0x42 : ComOut( CGM_GDSF_ONLY, "Origin" ) break;
+ case 0x45 : ComOut( CGM_GDSF_ONLY, "Color Reversal Mode" ) break;
+ case 0x46 : ComOut( CGM_GDSF_ONLY, "Line Cap Attributes" ) break;
+ case 0x49 : ComOut( CGM_GDSF_ONLY, "Begin Effect Definition" ) break;
+ case 0x50 : ComOut( CGM_GDSF_ONLY, "End Effect Definition" ) break;
+ case 0x51 : ComOut( CGM_GDSF_ONLY, "Line End Style Attributes" ) break;
+ case 0x52 : ComOut( CGM_GDSF_ONLY, "Begin Data" ) break;
+ case 0x53 : ComOut( CGM_GDSF_ONLY, "Data" ) break;
+ case 0x54 : ComOut( CGM_GDSF_ONLY, "End Data" ) break;
+ case 0x55 : ComOut( CGM_GDSF_ONLY, "Set Background Style" ) break;
+ case 0x56 : ComOut( CGM_GDSF_ONLY, "Set EPS Mode" ) break;
+ case 0x57 : ComOut( CGM_GDSF_ONLY, "Fill Mode" ) break;
+ case 0x58 : ComOut( CGM_GDSF_ONLY, "Begin Symbol" ) break;
+ case 0x59 : ComOut( CGM_GDSF_ONLY, "End Symbol" ) break;
+ case 0x60 : ComOut( CGM_GDSF_ONLY, "Begin Layer" ) break;
+ case 0x61 : ComOut( CGM_GDSF_ONLY, "End Layer" ) break;
+ case 0x62 : ComOut( CGM_GDSF_ONLY, "Layer Visibility" ) break;
+ case 0x64 : ComOut( CGM_GDSF_ONLY, "Set Text Offset" ) break;
+ case 0xFF : ComOut( CGM_GDSF_ONLY, "Inquire Function Support" ) break;
+ case 0xFE : ComOut( CGM_GDSF_ONLY, "Inquire Origin" ) break;
+ case 0xFD : ComOut( CGM_GDSF_ONLY, "Inquire Foreign Data Mode" ) break;
+ case 0xFC : ComOut( CGM_GDSF_ONLY, "Inquire Text Extent" ) break;
+ case 0xFB : ComOut( CGM_GDSF_ONLY, "Inquire DPI" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass8()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_LEVEL2, "Copy Segment" ) break; // NS
+ case 0x02 : ComOut( CGM_LEVEL2, "Inheritance Filter" ) break; // NS
+ case 0x03 : ComOut( CGM_LEVEL2, "Clip Inheritance" ) break; // NS
+ case 0x04 : ComOut( CGM_LEVEL2, "Segment Transformation" ) break;
+ case 0x05 : ComOut( CGM_LEVEL2, "Segment HighLighting" ) break; // NS
+ case 0x06 : ComOut( CGM_LEVEL2, "Segment Display Priority" ) break; // NS
+ case 0x07 : ComOut( CGM_LEVEL2, "Segment Pick Priority" ) break; // NS
+ case 0xfe : ComOut( CGM_GDSF_ONLY, "INQ Current Position" ) break;
+ case 0xff : ComOut( CGM_GDSF_ONLY, "INQ Inserted Object Extent" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break; // NS
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass9()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_UNKNOWN_LEVEL, "Pixel Array" ) break; // NS
+ case 0x02 : ComOut( CGM_UNKNOWN_LEVEL, "Create Bitmap" ) break; // NS
+ case 0x03 : ComOut( CGM_UNKNOWN_LEVEL, "Delete Bitmap" ) break; // NS
+ case 0x04 : ComOut( CGM_UNKNOWN_LEVEL, "Select Drawing Bitmap" ) break; // NS
+ case 0x05 : ComOut( CGM_UNKNOWN_LEVEL, "Display Bitmap" ) break; // NS
+ case 0x06 : ComOut( CGM_UNKNOWN_LEVEL, "Drawing Mode" ) break;
+ case 0x07 : ComOut( CGM_UNKNOWN_LEVEL, "Mapped Bitmap ForeGrnd Color" ) break; // NS
+ case 0x08 : ComOut( CGM_UNKNOWN_LEVEL, "Fill Bitmap" ) break; // NS
+ case 0x09 : ComOut( CGM_UNKNOWN_LEVEL, "Two Operand BitBlt" ) break; // NS
+ case 0x0a : ComOut( CGM_UNKNOWN_LEVEL, "Three Operand BitBlt" ) break; // NS
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
+
+void CGM::ImplDoClass15()
+{
+ switch ( mnElementID )
+ {
+ case 0x01 : ComOut( CGM_UNKNOWN_LEVEL, "Inquire Error Stack" ) break;
+ case 0x02 : ComOut( CGM_UNKNOWN_LEVEL, "Pop Error Stack" ) break;
+ case 0x03 : ComOut( CGM_UNKNOWN_LEVEL, "Empty Error Stack" ) break;
+ default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
+ }
+};
+
+// ---------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx
new file mode 100644
index 000000000000..4595f3f3e2be
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/elements.cxx
@@ -0,0 +1,397 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include "elements.hxx"
+
+// ---------------------------------------------------------------
+
+
+CGMElements::CGMElements( CGM& rCGM ) :
+ mpCGM ( &rCGM )
+{
+ Init();
+};
+
+// ---------------------------------------------------------------
+
+CGMElements::~CGMElements()
+{
+ DeleteTable( aHatchTable );
+ DeleteAllBundles( aLineList );
+ DeleteAllBundles( aMarkerList );
+ DeleteAllBundles( aEdgeList );
+ DeleteAllBundles( aTextList );
+ DeleteAllBundles( aFillList );
+}
+
+// ---------------------------------------------------------------
+
+CGMElements& CGMElements::operator=( CGMElements& rSource )
+{
+ sal_uInt32 nIndex;
+
+ nVDCIntegerPrecision = rSource.nVDCIntegerPrecision;
+ nIntegerPrecision = rSource.nIntegerPrecision;
+ eRealPrecision = rSource.eRealPrecision;
+ nRealSize = rSource.nRealSize;
+ nIndexPrecision = rSource.nIndexPrecision;
+ nColorPrecision = rSource.nColorPrecision;
+ nColorIndexPrecision = rSource.nColorIndexPrecision;
+
+ nMetaFileVersion = rSource.nMetaFileVersion;
+ eScalingMode = rSource.eScalingMode;
+ nScalingFactor = rSource.nScalingFactor;
+ eVDCType = rSource.eVDCType;
+ eVDCRealPrecision = rSource.eVDCRealPrecision;
+ nVDCRealSize = rSource.nVDCRealSize;
+ aVDCExtent = rSource.aVDCExtent;
+ aVDCExtentMaximum = rSource.aVDCExtentMaximum;
+ eDeviceViewPortMode = rSource.eDeviceViewPortMode;
+ nDeviceViewPortScale = rSource.nDeviceViewPortScale;
+ eDeviceViewPortMap = rSource.eDeviceViewPortMap;
+ eDeviceViewPortMapH = rSource.eDeviceViewPortMapH;
+ eDeviceViewPortMapV = rSource.eDeviceViewPortMapV;
+ aDeviceViewPort = rSource.aDeviceViewPort;
+ nMitreLimit = rSource.nMitreLimit;
+ eClipIndicator = rSource.eClipIndicator;
+ aClipRect = rSource.aClipRect;
+ eColorSelectionMode = rSource.eColorSelectionMode;
+ eColorModel = rSource.eColorModel;
+ nColorMaximumIndex = rSource.nColorMaximumIndex;
+ nLatestColorMaximumIndex = rSource.nLatestColorMaximumIndex;
+
+ for ( nIndex = 1; nIndex < 256; nIndex++ ) // do not overwrite the background color
+ {
+ aColorTableEntryIs[ nIndex ] = rSource.aColorTableEntryIs[ nIndex ];
+ aColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
+ aLatestColorTable[ nIndex ] = rSource.aColorTable[ nIndex ];
+ }
+
+ for ( nIndex = 0; nIndex < 8; nIndex++ )
+ {
+ nColorValueExtent[ nIndex ] = rSource.nColorValueExtent[ nIndex ];
+ }
+ nAspectSourceFlags = rSource.nAspectSourceFlags;
+
+ CopyAllBundles( rSource.aLineList, aLineList );
+ aLineBundle = rSource.aLineBundle;
+ pLineBundle = (LineBundle*)GetBundle( aLineList, rSource.pLineBundle->GetIndex() );
+ eLineWidthSpecMode = rSource.eLineWidthSpecMode;
+ eLineCapType = rSource.eLineCapType;
+ eLineJoinType = rSource.eLineJoinType;
+
+ CopyAllBundles( rSource.aMarkerList, aMarkerList );
+ aMarkerBundle = rSource.aMarkerBundle;
+ pMarkerBundle = (MarkerBundle*)GetBundle( aMarkerList, rSource.pMarkerBundle->GetIndex() );
+ eMarkerSizeSpecMode = rSource.eMarkerSizeSpecMode;
+
+ CopyAllBundles( rSource.aEdgeList, aEdgeList );
+ aEdgeBundle = rSource.aEdgeBundle;
+ pEdgeBundle = (EdgeBundle*)GetBundle( aEdgeList, rSource.pEdgeBundle->GetIndex() );
+ eEdgeVisibility = rSource.eEdgeVisibility;
+ eEdgeWidthSpecMode = rSource.eEdgeWidthSpecMode;
+
+ CopyAllBundles( rSource.aTextList, aTextList );
+ aTextBundle = rSource.aTextBundle;
+ pTextBundle = (TextBundle*)GetBundle( aTextList, rSource.pTextBundle->GetIndex() );
+ nCharacterHeight = rSource.nCharacterHeight;
+ nCharacterOrientation[ 0 ] = rSource.nCharacterOrientation[ 0 ];
+ nCharacterOrientation[ 1 ] = rSource.nCharacterOrientation[ 1 ];
+ nCharacterOrientation[ 2 ] = rSource.nCharacterOrientation[ 2 ];
+ nCharacterOrientation[ 3 ] = rSource.nCharacterOrientation[ 3 ];
+ eUnderlineMode = rSource.eUnderlineMode;
+ nUnderlineColor = rSource.nUnderlineColor;
+ eTextPath = rSource.eTextPath;
+ eTextAlignmentH = rSource.eTextAlignmentH;
+ eTextAlignmentV = rSource.eTextAlignmentV;
+ nTextAlignmentHCont = rSource.nTextAlignmentHCont;
+ nTextAlignmentVCont = rSource.nTextAlignmentVCont;
+ nCharacterSetIndex = rSource.nCharacterSetIndex;
+ nAlternateCharacterSetIndex = rSource.nAlternateCharacterSetIndex;
+ aFontList = rSource.aFontList;
+ eCharacterCodingA = rSource.eCharacterCodingA;
+
+ CopyAllBundles( rSource.aFillList, aFillList );
+ aFillBundle = rSource.aFillBundle;
+ pFillBundle = (FillBundle*)GetBundle( aFillList, rSource.pFillBundle->GetIndex() );
+ aFillRefPoint = rSource.aFillRefPoint;
+ eTransparency = rSource.eTransparency;
+ nAuxiliaryColor = rSource.nAuxiliaryColor;
+
+ DeleteTable( aHatchTable );
+ HatchEntry* pSource = (HatchEntry*)rSource.aHatchTable.First();
+ while ( pSource )
+ {
+ sal_uInt32 nKey = rSource.aHatchTable.GetKey( pSource );
+ aHatchTable.Insert( nKey, new HatchEntry( *pSource ) );
+ pSource = (HatchEntry*)rSource.aHatchTable.Next();
+ }
+ bSegmentCount = rSource.bSegmentCount;
+ return (*this);
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::Init()
+{
+
+ nIntegerPrecision = nIndexPrecision = 2;
+ nRealSize = nVDCRealSize = 4;
+ nColorIndexPrecision = 1;
+ nColorPrecision = 1;
+ nVDCIntegerPrecision = 2;
+ eRealPrecision = eVDCRealPrecision = RP_FIXED; //RP_FLOAT;
+
+ nMetaFileVersion = 1;
+ eScalingMode = SM_ABSTRACT;
+ eVDCType = VDC_INTEGER;
+ aVDCExtent.Left = aVDCExtent.Bottom = 0;
+// aVDCExtent.Right = aVDCExtent.Top = 32767;
+ aVDCExtent.Right = aVDCExtent.Top = 1.0;
+ aVDCExtentMaximum.Left = aVDCExtentMaximum.Bottom = 0;
+// aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 32767;
+ aVDCExtentMaximum.Right = aVDCExtentMaximum.Top = 1.0;
+
+ eDeviceViewPortMode = DVPM_FRACTION;
+ nDeviceViewPortScale = 1;
+ eDeviceViewPortMap = DVPM_FORCED;
+ eDeviceViewPortMapH = DVPMH_LEFT;
+ eDeviceViewPortMapV = DVPMV_BOTTOM;
+ aDeviceViewPort.Left = 0;
+ aDeviceViewPort.Top = 1;
+ aDeviceViewPort.Right = 0;
+ aDeviceViewPort.Bottom = 1;
+
+ nMitreLimit = 32767;
+ eClipIndicator = CI_ON;
+ aClipRect = aVDCExtent;
+
+ eColorSelectionMode = CSM_INDEXED;
+ eColorModel = CM_RGB;
+ nColorMaximumIndex = 63;
+ int i;
+ for ( i = 0; i < 256; aColorTableEntryIs[ i++ ] = 0 ) ;
+ aColorTable[ 0 ] = 0;
+ for ( i = 1; i < 256; aColorTable[ i++ ] = 0xffffff ) ;
+ nLatestColorMaximumIndex = 63;
+ aLatestColorTable[ 0 ] = 0;
+ for ( i = 1; i < 256; aLatestColorTable[ i++ ] = 0xffffff ) ;
+ nColorValueExtent[ 0 ] = nColorValueExtent[ 1 ] = nColorValueExtent[ 2 ] = 0;
+ nColorValueExtent[ 3 ] = nColorValueExtent[ 4 ] = nColorValueExtent[ 5 ] = 255;
+
+ nAspectSourceFlags = 0; // all flags are individual
+
+ eLineWidthSpecMode = SM_SCALED; // line parameter
+ eLineCapType = LCT_NONE;
+ eLineJoinType = LJT_NONE;
+ pLineBundle = &aLineBundle; // line bundle parameter
+ aLineBundle.SetIndex( 1 );
+ aLineBundle.eLineType = LT_SOLID;
+ aLineBundle.nLineWidth = 1;
+ aLineBundle.SetColor( 0xffffff );
+ InsertBundle( aLineList, aLineBundle );
+
+ eMarkerSizeSpecMode = SM_SCALED; // marker parameter
+ pMarkerBundle = &aMarkerBundle; // marker bundle parameter
+ aMarkerBundle.SetIndex( 1 );
+ aMarkerBundle.eMarkerType = MT_STAR;
+ aMarkerBundle.nMarkerSize = 1;
+ aMarkerBundle.SetColor( 0xffffff );
+ InsertBundle( aMarkerList, aMarkerBundle );
+
+ eEdgeVisibility = EV_OFF; // edge parameter
+ eEdgeWidthSpecMode = SM_SCALED;
+ pEdgeBundle = &aEdgeBundle; // edge bundle parameter
+ aEdgeBundle.SetIndex( 1 );
+ aEdgeBundle.eEdgeType = ET_SOLID;
+ aEdgeBundle.nEdgeWidth = 1;
+ aEdgeBundle.SetColor( 0xffffff );
+ InsertBundle( aEdgeList, aEdgeBundle );
+
+ nCharacterHeight = 327; // text parameter
+ nCharacterOrientation[0] = 0;
+ nCharacterOrientation[1] = 1;
+ nCharacterOrientation[2] = 1;
+ nCharacterOrientation[3] = 0;
+ eUnderlineMode = UM_OFF;
+ nUnderlineColor = 0xffffff;
+ eTextPath = TPR_RIGHT;
+ eTextAlignmentH = TAH_NORMAL;
+ eTextAlignmentV = TAV_NORMAL;
+ nCharacterSetIndex = nAlternateCharacterSetIndex = 1;
+ eCharacterCodingA = CCA_BASIC_7;
+ pTextBundle = &aTextBundle; // text bundle parameter
+ aTextBundle.SetIndex( 1 );
+ aTextBundle.nTextFontIndex = 1;
+ aTextBundle.eTextPrecision = TPR_STRING;
+ aTextBundle.nCharacterExpansion = 1;
+ aTextBundle.nCharacterSpacing = 0;
+ aTextBundle.SetColor( 0xffffff );
+ InsertBundle( aTextList, aTextBundle );
+
+ pFillBundle = &aFillBundle; // fill bundle parameter
+ aFillBundle.SetIndex( 1 );
+ aFillBundle.eFillInteriorStyle = FIS_HOLLOW;
+ aFillBundle.nFillHatchIndex = 1;
+ aFillBundle.nFillPatternIndex = 1;
+ aFillBundle.SetColor( 0xffffff );
+ InsertBundle( aFillList, aFillBundle );
+
+ ImplInsertHatch( 0, 0, 0, 0 );
+ ImplInsertHatch( 1, 0, 125, 0 );
+ ImplInsertHatch( 2, 0, 125, 900 );
+ ImplInsertHatch( 3, 0, 125, 450 );
+ ImplInsertHatch( 4, 0, 125, 1350 );
+ ImplInsertHatch( 5, 1, 125, 0 );
+ ImplInsertHatch( 6, 1, 125, 450 );
+ ImplInsertHatch( -1, 0, 75, 0 );
+ ImplInsertHatch( -2, 0, 75, 900 );
+ ImplInsertHatch( -3, 0, 75, 450 );
+ ImplInsertHatch( -4, 0, 75, 1350 );
+ ImplInsertHatch( -5, 1, 75, 0 );
+ ImplInsertHatch( -6, 1, 75, 450 );
+ ImplInsertHatch( -7, 2, 125, 0 );
+ ImplInsertHatch( -8, 2, 125, 900 );
+ ImplInsertHatch( -9, 2, 125, 450 );
+ ImplInsertHatch( -10, 2, 125, 1350 );
+ ImplInsertHatch( -11, 0, 40, 0 );
+ ImplInsertHatch( -12, 0, 40, 900 );
+ ImplInsertHatch( -13, 0, 40, 450 );
+ ImplInsertHatch( -14, 0, 40, 1350 );
+ ImplInsertHatch( -15, 1, 40, 0 );
+ ImplInsertHatch( -16, 1, 40, 900 );
+ ImplInsertHatch( -21, 0, 250, 0 );
+ ImplInsertHatch( -22, 0, 250, 900 );
+ ImplInsertHatch( -23, 0, 250, 450 );
+ ImplInsertHatch( -24, 0, 250, 1350 );
+ ImplInsertHatch( -25, 1, 250, 0 );
+ ImplInsertHatch( -26, 1, 250, 450 );
+
+ eTransparency = T_ON;
+
+ nBackGroundColor = nAuxiliaryColor = 0;
+
+ bSegmentCount = sal_False;
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, long nAngle )
+{
+ HatchEntry* pHatchEntry;
+ pHatchEntry = new HatchEntry;
+ aHatchTable.Insert( (sal_uInt32)nKey, pHatchEntry );
+ pHatchEntry->HatchStyle = nStyle;
+ pHatchEntry->HatchDistance = nDistance;
+ pHatchEntry->HatchAngle = nAngle;
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::DeleteTable( Table& rTable )
+{
+ HatchEntry* pPtr = (HatchEntry*)rTable.First();
+ while ( pPtr )
+ {
+ delete pPtr;
+ pPtr = (HatchEntry*)rTable.Next();
+ }
+ rTable.Clear();
+}
+
+// ---------------------------------------------------------------
+
+void CGMElements::DeleteAllBundles( List& rList )
+{
+ void* pPtr = rList.First();
+ while( pPtr )
+ {
+ delete (Bundle*)pPtr;
+ pPtr = rList.Next();
+ }
+};
+
+
+// ---------------------------------------------------------------
+
+void CGMElements::CopyAllBundles( List& rSource, List& rDest )
+{
+ DeleteAllBundles( rDest );
+ rDest.Clear();
+
+ void* pPtr = rSource.First();
+ while( pPtr )
+ {
+ Bundle* pTempBundle = ( (Bundle*)pPtr)->Clone();
+ rDest.Insert( pTempBundle, LIST_APPEND );
+ pPtr = rSource.Next();
+ }
+};
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::GetBundleIndex( sal_uInt32 nIndex, List& rList, Bundle& rBundle )
+{
+ rBundle.SetIndex( nIndex );
+ Bundle* pBundle = GetBundle( rList, nIndex );
+ if ( !pBundle )
+ pBundle = InsertBundle( rList, rBundle );
+ return pBundle;
+}
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::GetBundle( List& rList, long nIndex )
+{
+ Bundle* pBundle = (Bundle*)rList.First();
+ while( pBundle && ( pBundle->GetIndex() != nIndex ) )
+ {
+ pBundle = (Bundle*)rList.Next();
+ }
+ return pBundle;
+}
+
+// ---------------------------------------------------------------
+
+Bundle* CGMElements::InsertBundle( List& rList, Bundle& rBundle )
+{
+ Bundle* pBundle = GetBundle( rList, rBundle.GetIndex() );
+ if ( pBundle )
+ {
+ rList.Remove( pBundle );
+ delete pBundle;
+ }
+ pBundle = rBundle.Clone();
+ rList.Insert( pBundle, LIST_APPEND );
+ return pBundle;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/elements.hxx b/filter/source/graphicfilter/icgm/elements.hxx
new file mode 100644
index 000000000000..fda5184d6b4c
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/elements.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CGM_ELEMENTS_HXX_
+#define CGM_ELEMENTS_HXX_
+
+#include "main.hxx"
+#include <tools/table.hxx>
+
+#define nBackGroundColor aColorTable[ 0 ]
+
+class CGMElements
+{
+ void ImplInsertHatch( sal_Int32 Key, int Style, long Distance, long Angle );
+ public:
+ CGM* mpCGM;
+ long nMetaFileVersion;
+
+ sal_uInt32 nIntegerPrecision; // maybe 1, 2, 4 Bytes
+ sal_uInt32 nIndexPrecision; // " " "
+ RealPrecision eRealPrecision;
+ sal_uInt32 nRealSize; // maybe 4 or 8 bytes
+ sal_uInt32 nColorPrecision; // " " "
+ sal_uInt32 nColorIndexPrecision;// " " "
+
+ ScalingMode eScalingMode;
+ double nScalingFactor;
+
+ VDCType eVDCType; // Integer / Real
+ sal_uInt32 nVDCIntegerPrecision;
+ RealPrecision eVDCRealPrecision;
+ sal_uInt32 nVDCRealSize;
+ FloatRect aVDCExtent;
+ FloatRect aVDCExtentMaximum;
+
+ DeviceViewPortMode eDeviceViewPortMode;
+ double nDeviceViewPortScale;
+ DeviceViewPortMap eDeviceViewPortMap;
+ DeviceViewPortMapH eDeviceViewPortMapH;
+ DeviceViewPortMapV eDeviceViewPortMapV;
+ FloatRect aDeviceViewPort;
+
+ double nMitreLimit;
+
+ ClipIndicator eClipIndicator;
+ FloatRect aClipRect;
+
+ ColorSelectionMode eColorSelectionMode;
+ ColorModel eColorModel;
+ sal_uInt32 nColorMaximumIndex; // default 63
+ sal_uInt32 nLatestColorMaximumIndex; // default 63
+ sal_Int8 aColorTableEntryIs[ 256 ];
+ sal_uInt32 aColorTable[ 256 ];
+ sal_uInt32 aLatestColorTable[ 256 ];
+ sal_uInt32 nColorValueExtent[ 8 ]; // RGB, CMYK
+
+ // ASPECT SOURCE FLAGS
+ sal_uInt32 nAspectSourceFlags; // bit = 0 -> INDIVIDUAL
+ // 1 -> BUNDLED
+
+ LineBundle* pLineBundle; // Pointer to the current LineBundleIndex
+ LineBundle aLineBundle;
+ List aLineList;
+ SpecMode eLineWidthSpecMode;
+ LineCapType eLineCapType;
+ LineJoinType eLineJoinType;
+
+ MarkerBundle* pMarkerBundle; // Pointer to the current MarkerBundleIndex
+ MarkerBundle aMarkerBundle;
+ List aMarkerList;
+ SpecMode eMarkerSizeSpecMode;
+
+ EdgeBundle* pEdgeBundle; // Pointer to the current EdgeBundleIndex
+ EdgeBundle aEdgeBundle;
+ List aEdgeList;
+ EdgeVisibility eEdgeVisibility;
+ SpecMode eEdgeWidthSpecMode;
+
+ TextBundle* pTextBundle; // Pointer to the current TextBundleIndex
+ TextBundle aTextBundle;
+ List aTextList;
+ double nCharacterHeight;
+ double nCharacterOrientation[ 4 ];
+ UnderlineMode eUnderlineMode;
+ sal_uInt32 nUnderlineColor;
+ TextPath eTextPath;
+ TextAlignmentH eTextAlignmentH;
+ TextAlignmentV eTextAlignmentV;
+ double nTextAlignmentHCont;
+ double nTextAlignmentVCont;
+ long nCharacterSetIndex;
+ long nAlternateCharacterSetIndex;
+ CharacterCodingA eCharacterCodingA;
+ CGMFList aFontList;
+
+ FillBundle* pFillBundle; // Pointer to the current EdgeBundleIndex
+ FillBundle aFillBundle;
+ List aFillList;
+ FloatPoint aFillRefPoint;
+ Table aHatchTable;
+
+ Transparency eTransparency;
+
+ sal_uInt32 nAuxiliaryColor;
+
+ // Delimiter Counts -> which will be increased by each 'begin' operation
+ // and decreased by each 'end' operation
+ sal_Bool bSegmentCount;
+ CGMElements( CGM& rCGM );
+ ~CGMElements();
+ CGMElements& operator=( CGMElements& );
+ void Init();
+ void DeleteTable( Table& );
+ Bundle* GetBundleIndex( sal_uInt32 nIndex, List&, Bundle& );
+ Bundle* GetBundle( List& rList, long nIndex );
+ Bundle* InsertBundle( List&, Bundle& );
+ void DeleteAllBundles( List& );
+ void CopyAllBundles( List& Source, List& Dest );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/exports.map b/filter/source/graphicfilter/icgm/exports.map
new file mode 100644
index 000000000000..cc7f07dd1112
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/exports.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ ImportCGM;
+
+ local:
+ *;
+};
diff --git a/filter/source/graphicfilter/icgm/main.hxx b/filter/source/graphicfilter/icgm/main.hxx
new file mode 100644
index 000000000000..a9d4a0c981e2
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/main.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_MAIN_HXX
+#define CGM_MAIN_HXX
+
+#include "cgm.hxx"
+
+// ---------------------------------------------------------------
+
+#define CGM_LEVEL1 0x0001 // VERSION 1 METAFILE
+#define CGM_LEVEL2 0x0002
+#define CGM_LEVEL3 0x0003
+#define CGM_GDSF_ONLY 0x00F0
+#define CGM_UNKNOWN_LEVEL 0x00F1
+#define CGM_UNKNOWN_COMMAND 0x00F2
+#define CGM_DESCRIPTION 0x00F3
+
+#define CGM_EXTENDED_PRIMITIVES_SET 0x0100 // INDICATES PRIMITIVES WHICH ARE AVAILABLE IN
+ // LEVEL 1 BUT ARE NOT DEFINED IN ISO 7942(GKS)
+#define CGM_DRAWING_PLUS_CONTROL_SET 0x0200 // INDICATES THAT THIS IS AN ADDITIONAL LEVEL 1
+ // ELEMENT
+#define ComOut( Level, Description ) if ( mpCommentOut ) ImplComment( Level, Description );
+
+#define BMCOL( _col ) BitmapColor( (sal_Int8)(_col >> 16 ), (sal_Int8)( _col >> 8 ), (sal_Int8)_col )
+#define ALIGN2( _nElementSize ) { _nElementSize = ( _nElementSize + 1 ) & ~1; }
+#define ALIGN4( _nElementSize ) { _nElementSize = ( _nElementSize + 3 ) & ~3; }
+#define ALIGN8( _nElementSize ) { _nElementSize = ( _nElementSize + 7 ) & ~7; }
+
+#include <vcl/salbtype.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+#include "bundles.hxx"
+#include "bitmap.hxx"
+#include "elements.hxx"
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphicfilter/icgm/makefile.mk b/filter/source/graphicfilter/icgm/makefile.mk
new file mode 100644
index 000000000000..f8dc889086f5
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJNAME=filter
+TARGET=icgm
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+.IF "$(L10N_framework)"==""
+SLOFILES = $(SLO)$/cgm.obj \
+ $(SLO)$/chart.obj \
+ $(SLO)$/class0.obj \
+ $(SLO)$/class1.obj \
+ $(SLO)$/class2.obj \
+ $(SLO)$/class3.obj \
+ $(SLO)$/class4.obj \
+ $(SLO)$/class5.obj \
+ $(SLO)$/class7.obj \
+ $(SLO)$/classx.obj \
+ $(SLO)$/outact.obj \
+ $(SLO)$/actimpr.obj \
+ $(SLO)$/bundles.obj \
+ $(SLO)$/bitmap.obj \
+ $(SLO)$/elements.obj
+# $(SLO)$/svdem.obj
+
+SHL1TARGET = icg$(DLLPOSTFIX)
+SHL1IMPLIB = icgm
+SHL1VERSIONMAP=exports.map
+SHL1DEF = $(MISC)$/$(SHL1TARGET).def
+SHL1LIBS = $(SLB)$/icgm.lib
+
+DEF1NAME=$(SHL1TARGET)
+
+.IF "$(GUI)"=="OS2"
+SHL1OBJS = $(SLO)$/class0.obj
+.ENDIF
+
+SHL1STDLIBS = \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+.ENDIF
+
+# --- Targets --------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/filter/source/graphicfilter/icgm/outact.cxx b/filter/source/graphicfilter/icgm/outact.cxx
new file mode 100644
index 000000000000..61bbb1731993
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/outact.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#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 = (Point*)new sal_Int8[ 0x2000 * sizeof( Point ) ];
+ mpFlags = new BYTE[ 0x2000 ];
+
+ mnIndex = 0;
+ mpGradient = NULL;
+};
+
+// ---------------------------------------------------------------
+
+CGMOutAct::~CGMOutAct()
+{
+ delete[] (sal_Int8*) mpPoints;
+ delete[] mpFlags;
+ delete[] mpGroupLevel;
+
+ if ( mpGradient )
+ 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 )
+ {
+ Polygon aPolygon( mnIndex, mpPoints, mpFlags );
+ maPolyPolygon.Insert( aPolygon );
+ }
+ mnIndex = 0;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::EndFigure()
+{
+ NewRegion();
+ DrawPolyPolygon( maPolyPolygon );
+ maPolyPolygon.Clear();
+ EndGroup();
+ mnIndex = 0;
+}
+
+// ---------------------------------------------------------------
+
+void CGMOutAct::RegPolyLine( Polygon& rPolygon, sal_Bool bReverse )
+{
+ USHORT nPoints = rPolygon.GetSize();
+ if ( nPoints )
+ {
+ if ( bReverse )
+ {
+ for ( USHORT 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 ( USHORT 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
new file mode 100644
index 000000000000..35b1136b76f0
--- /dev/null
+++ b/filter/source/graphicfilter/icgm/outact.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CGM_OUTACT_HXX_
+#define CGM_OUTACT_HXX_
+
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+
+#define CGM_OUTACT_MAX_GROUP_LEVEL 64
+
+#include "cgm.hxx"
+#include <chart.hxx>
+#include <tools/poly.hxx>
+
+typedef struct NodeFrameSet
+{
+ Point nTopLeft;
+ Point nBottomRight;
+ ::com::sun::star::awt::Size nSize;
+} NodeFrameSet;
+
+class CGM;
+class VclGradient;
+class CGMOutAct
+{
+ protected:
+ sal_uInt16 mnCurrentPage; // defaulted to zero
+
+ sal_uInt32 mnGroupActCount; // grouping
+ sal_uInt32 mnGroupLevel;
+ sal_uInt32* mpGroupLevel;
+
+ USHORT mnIndex; // figure
+ BYTE* mpFlags;
+ Point* mpPoints;
+ PolyPolygon maPolyPolygon;
+ ::com::sun::star::awt::Gradient* mpGradient;
+
+ CGM* mpCGM;
+
+ public:
+ CGMOutAct( CGM& rCGM );
+ virtual ~CGMOutAct();
+ virtual void FirstOutPut() { mpCGM->mbFirstOutPut = sal_False; } ;
+ virtual void InsertPage() { mnCurrentPage++; } ;
+ virtual void BeginGroup() {} ;
+ virtual void EndGroup() {};
+ virtual void EndGrouping() {} ;
+ void BeginFigure() ;
+ void CloseRegion() ;
+ void NewRegion() ;
+ void EndFigure() ;
+ void RegPolyLine( Polygon&, sal_Bool bReverse = sal_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( Polygon& ) {} ;
+ virtual void DrawPolyLine( Polygon& ) {} ;
+ virtual void DrawPolybezier( Polygon& ) {} ;
+ virtual void DrawPolyPolygon( PolyPolygon& ) {} ;
+ virtual void DrawText( ::com::sun::star::awt::Point&, ::com::sun::star::awt::Size&, char*, sal_uInt32, FinalFlag ) {} ;
+ virtual void AppendText( char*, sal_uInt32, FinalFlag ) {} ;
+ virtual sal_uInt32 DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) { return 0; } ;
+ virtual void DrawChart(){} ;
+};
+
+class CGMImpressOutAct : public CGMOutAct
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > maXDrawPages;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > maXDrawPage;
+
+// ::com::sun::star::uno::Reference< XServiceRegistry > maXServiceRegistry;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > maXMultiServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > maXServiceManagerSC;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > maXShape;
+ sal_Bool ImplCreateShape( const ::rtl::OUString& rType );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > maXPropSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > maXShapes;
+
+ sal_uInt32 nFinalTextCount;
+
+ sal_Bool ImplInitPage();
+ void ImplSetOrientation( FloatPoint& RefPoint, double& Orientation ) ;
+ void ImplSetLineBundle() ;
+ void ImplSetFillBundle() ;
+ void ImplSetTextBundle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & ) ;
+public:
+ CGMImpressOutAct( CGM&, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & ) ;
+ ~CGMImpressOutAct() {} ;
+ virtual void InsertPage() ;
+ virtual void BeginGroup() ;
+ virtual void EndGroup() ;
+ virtual void EndGrouping() ;
+ virtual void DrawRectangle( FloatRect& ) ;
+ virtual void DrawEllipse( FloatPoint& center, FloatPoint&, double& Orientation ) ;
+ virtual void DrawEllipticalArc( FloatPoint& center, FloatPoint& size, double& orientation,
+ sal_uInt32 etype, double& startangle, double& endangle ) ;
+ virtual void DrawBitmap( CGMBitmapDescriptor* ) ;
+ virtual void DrawPolygon( Polygon& ) ;
+ virtual void DrawPolyLine( Polygon& ) ;
+ virtual void DrawPolybezier( Polygon& ) ;
+ virtual void DrawPolyPolygon( PolyPolygon& ) ;
+ virtual void DrawText( ::com::sun::star::awt::Point& TextRectPos, ::com::sun::star::awt::Size& TextRectSize, char* String, sal_uInt32 StringSize, FinalFlag ) ;
+ virtual void AppendText( char* String, sal_uInt32 StringSize, FinalFlag ) ;
+ virtual sal_uInt32 DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) ;
+ virtual void DrawChart();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */