dev/null |binary filter/Configuration_filter.mk | 8 filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu | 30 filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu | 30 filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu | 27 filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu | 27 filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu | 29 filter/source/config/fragments/types/sgv_StarDraw_20.xcu | 29 include/svtools/imagemgr.hxx | 4 include/vcl/graphicfilter.hxx | 8 svtools/inc/bitmaps.hlst | 4 svtools/source/graphic/descriptor.cxx | 2 svtools/source/graphic/descriptor.hxx | 2 svtools/source/misc/imagemgr.cxx | 10 vcl/Library_vcl.mk | 4 vcl/qa/cppunit/graphicfilter/filters-test.cxx | 3 vcl/source/filter/FilterConfigCache.cxx | 4 vcl/source/filter/graphicfilter.cxx | 84 vcl/source/filter/graphicfilter2.cxx | 38 vcl/source/filter/sgf.ini | 136 - vcl/source/filter/sgfbram.cxx | 519 ---- vcl/source/filter/sgfbram.hxx | 142 - vcl/source/filter/sgffilt.hxx | 40 vcl/source/filter/sgvmain.cxx | 947 -------- vcl/source/filter/sgvmain.hxx | 363 --- vcl/source/filter/sgvspln.cxx | 743 ------ vcl/source/filter/sgvspln.hxx | 46 vcl/source/filter/sgvtext.cxx | 1133 ---------- 28 files changed, 5 insertions(+), 4407 deletions(-)
New commits: commit d952c0b42a452c875bd9d78870fa9d925af9220e Author: Thorsten Behrens <[email protected]> Date: Thu Nov 2 14:50:18 2017 +0100 vcl: remove sgf/sgv ancient gfx filters Change-Id: Ib02986e5b3d54d65982836e22ebcb70eb7a0e7b3 Reviewed-on: https://gerrit.libreoffice.org/44216 Tested-by: Jenkins <[email protected]> Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index 7b39020f8e7a..f7c531bccbfe 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -692,8 +692,6 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ ppm_Portable_Pixelmap \ psd_Adobe_Photoshop \ ras_Sun_Rasterfile \ - sgf_StarOffice_Writer_SGF \ - sgv_StarDraw_20 \ svg_Scalable_Vector_Graphics \ svm_StarView_Metafile \ tga_Truevision_TARGA \ @@ -720,8 +718,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f PPM___Portable_Pixelmap \ PSD___Adobe_Photoshop \ RAS___Sun_Rasterfile \ - SGF___StarOffice_Writer_SGF \ - SGV___StarDraw_2_0 \ SVG___Scalable_Vector_Graphics \ SVM___StarView_Metafile \ TGA___Truevision_TARGA \ @@ -826,8 +822,6 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics ppm_Portable_Pixelmap \ psd_Adobe_Photoshop \ ras_Sun_Rasterfile \ - sgf_StarOffice_Writer_SGF \ - sgv_StarDraw_20 \ svg_Scalable_Vector_Graphics \ svm_StarView_Metafile \ tga_Truevision_TARGA \ @@ -864,8 +858,6 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter ppm_Import \ psd_Import \ ras_Import \ - sgf_Import \ - sgv_Import \ svg_Export \ svg_Import \ svm_Export \ diff --git a/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu b/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu deleted file mode 100644 index 739751fb0d1c..000000000000 --- a/filter/source/config/fragments/filters/SGF___StarOffice_Writer_SGF.xcu +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="SGF - StarOffice Writer SGF" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> - <prop oor:name="UIComponent"/> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">SGF - StarWriter Graphics Format</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>sgf_StarOffice_Writer_SGF</value></prop> - <prop oor:name="TemplateName"/> - <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> - </node> diff --git a/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu b/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu deleted file mode 100644 index 547ee4163a32..000000000000 --- a/filter/source/config/fragments/filters/SGV___StarDraw_2_0.xcu +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="SGV - StarDraw 2.0" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> - <prop oor:name="UIComponent"/> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">SGV - StarDraw 2.0</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>sgv_StarDraw_20</value></prop> - <prop oor:name="TemplateName"/> - <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> - </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu deleted file mode 100644 index 242776b0730e..000000000000 --- a/filter/source/config/fragments/internalgraphicfilters/sgf_Import.xcu +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="sgf_Import" oor:op="replace" > - <prop oor:name="Type"><value>sgf_StarOffice_Writer_SGF</value></prop> - <prop oor:name="FormatName"><value>SVSGF</value></prop> - <prop oor:name="RealFilterName"><value>SGF - StarOffice Writer SGF</value></prop> - <prop oor:name="UIComponent"/> - <prop oor:name="UIName"> - <value xml:lang="en-US">SGF - StarWriter Graphics Format</value> - </prop> - <prop oor:name="Flags"><value>IMPORT</value></prop> - </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu deleted file mode 100644 index 63d47ce5cf04..000000000000 --- a/filter/source/config/fragments/internalgraphicfilters/sgv_Import.xcu +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="sgv_Import" oor:op="replace" > - <prop oor:name="Type"><value>sgv_StarDraw_20</value></prop> - <prop oor:name="FormatName"><value>SVSGV</value></prop> - <prop oor:name="RealFilterName"><value>SGV - StarDraw 2.0</value></prop> - <prop oor:name="UIComponent"/> - <prop oor:name="UIName"> - <value xml:lang="en-US">SGV - StarDraw 2.0</value> - </prop> - <prop oor:name="Flags"><value>IMPORT</value></prop> - </node> diff --git a/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu b/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu deleted file mode 100644 index ed2f380c86a8..000000000000 --- a/filter/source/config/fragments/types/sgf_StarOffice_Writer_SGF.xcu +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="sgf_StarOffice_Writer_SGF" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> - <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>sgf</value></prop> - <prop oor:name="MediaType"><value>image/x-sgf</value></prop> - <prop oor:name="Preferred"><value>false</value></prop> - <prop oor:name="PreferredFilter"><value>SGF - StarOffice Writer SGF</value></prop> - <prop oor:name="UIName"> - <value>SGF - StarWriter SGF</value> - </prop> - <prop oor:name="ClipboardFormat"/> - </node> diff --git a/filter/source/config/fragments/types/sgv_StarDraw_20.xcu b/filter/source/config/fragments/types/sgv_StarDraw_20.xcu deleted file mode 100644 index 1c0f3ec37174..000000000000 --- a/filter/source/config/fragments/types/sgv_StarDraw_20.xcu +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> - <node oor:name="sgv_StarDraw_20" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> - <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>sgv</value></prop> - <prop oor:name="MediaType"/> - <prop oor:name="Preferred"><value>false</value></prop> - <prop oor:name="PreferredFilter"><value>SGV - StarDraw 2.0</value></prop> - <prop oor:name="UIName"> - <value>SGV - StarDraw 2.0</value> - </prop> - <prop oor:name="ClipboardFormat"/> - </node> diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx index e76077a35a64..47f3df355799 100644 --- a/include/svtools/imagemgr.hxx +++ b/include/svtools/imagemgr.hxx @@ -57,8 +57,8 @@ enum class SvImageId { DXF = START + 141, MET = START + 142, PNG = START + 143, - SGF = START + 144, - SGV = START + 145, + //retired SGF = START + 144, + //retired SGV = START + 145, SVM = START + 146, GlobalDoc = START + 150, Draw = START + 151, diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index fd6c3db22dc3..2c9ad85b96a0 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -70,8 +70,6 @@ namespace o3tl #define IMP_SVMETAFILE "SVMETAFILE" #define IMP_WMF "SVWMF" #define IMP_EMF "SVEMF" -#define IMP_SVSGF "SVSGF" -#define IMP_SVSGV "SVSGV" #define IMP_GIF "SVIGIF" #define IMP_PNG "SVIPNG" #define IMP_JPEG "SVIJPEG" @@ -124,10 +122,10 @@ enum class GraphicFileFormat DXF = 0x00f1, MET = 0x00f2, PCT = 0x00f3, - SGF = 0x00f4, + // retired SGF = 0x00f4, SVM = 0x00f5, WMF = 0x00f6, - SGV = 0x00f7, + // retired SGV = 0x00f7, EMF = 0x00f8, SVG = 0x00f9 }; @@ -166,10 +164,8 @@ class VCL_DLLPUBLIC GraphicDescriptor final bool ImpDetectDXF( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectMET( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectPCT( SvStream& rStm, bool bExtendedInfo ); - bool ImpDetectSGF( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectSVM( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectWMF( SvStream& rStm, bool bExtendedInfo ); - bool ImpDetectSGV( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectEMF( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectSVG( SvStream& rStm, bool bExtendedInfo ); GraphicDescriptor( const GraphicDescriptor& ) = delete; diff --git a/svtools/inc/bitmaps.hlst b/svtools/inc/bitmaps.hlst index b585e616ebbd..1f31a7f22a62 100644 --- a/svtools/inc/bitmaps.hlst +++ b/svtools/inc/bitmaps.hlst @@ -39,8 +39,6 @@ #define BMP_DXF_SC "res/sx03217.png" #define BMP_MET_SC "res/sx03218.png" #define BMP_PNG_SC "res/sx03219.png" -#define BMP_SGF_SC "res/sx03220.png" -#define BMP_SGV_SC "res/sx03221.png" #define BMP_SVM_SC "res/sx03222.png" #define BMP_GLOBAL_DOC_SC "res/sx03226.png" #define BMP_DRAW_SC "res/sx03227.png" @@ -87,8 +85,6 @@ #define BMP_DXF_LC "res/lx03217.png" #define BMP_MET_LC "res/lx03218.png" #define BMP_PNG_LC "res/lx03219.png" -#define BMP_SGF_LC "res/lx03220.png" -#define BMP_SGV_LC "res/lx03221.png" #define BMP_SVM_LC "res/lx03222.png" #define BMP_GLOBAL_DOC_LC "res/lx03226.png" #define BMP_DRAW_LC "res/lx03227.png" diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 54254afe70b3..f89895826efd 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -128,10 +128,8 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString* pURL ) case GraphicFileFormat::DXF: pMimeType = MIMETYPE_DXF; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::MET: pMimeType = MIMETYPE_MET; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::PCT: pMimeType = MIMETYPE_PCT; cType = graphic::GraphicType::VECTOR; break; - case GraphicFileFormat::SGF: pMimeType = MIMETYPE_SGF; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::SVM: pMimeType = MIMETYPE_SVM; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::WMF: pMimeType = MIMETYPE_WMF; cType = graphic::GraphicType::VECTOR; break; - case GraphicFileFormat::SGV: pMimeType = MIMETYPE_SGV; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::EMF: pMimeType = MIMETYPE_EMF; cType = graphic::GraphicType::VECTOR; break; case GraphicFileFormat::SVG: pMimeType = MIMETYPE_SVG; cType = graphic::GraphicType::VECTOR; break; diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx index d831d17ab8d1..ba585702d205 100644 --- a/svtools/source/graphic/descriptor.hxx +++ b/svtools/source/graphic/descriptor.hxx @@ -45,10 +45,8 @@ #define MIMETYPE_DXF "image/vnd.dxf" #define MIMETYPE_MET "image/x-met" #define MIMETYPE_PCT "image/x-pict" -#define MIMETYPE_SGF "image/x-sgf" #define MIMETYPE_SVM "image/x-svm" #define MIMETYPE_WMF "image/x-wmf" -#define MIMETYPE_SGV "image/x-sgv" #define MIMETYPE_EMF "image/x-emf" #define MIMETYPE_SVG "image/svg+xml" #define MIMETYPE_PDF "application/pdf" diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index ad0522009475..908fb0f2d278 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -126,9 +126,7 @@ static SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { "sds", false, STR_DESCRIPTION_SCHART_DOC, SvImageId::NONE }, { "sdw", false, STR_DESCRIPTION_SWRITER_DOC, SvImageId::Writer }, { "sga", false, nullptr, SvImageId::NONE }, - { "sgf", true, STR_DESCRIPTION_GRAPHIC_DOC, SvImageId::SGF }, { "sgl", false, STR_DESCRIPTION_GLOBALDOC, SvImageId::GlobalDoc }, - { "sgv", true, STR_DESCRIPTION_GRAPHIC_DOC, SvImageId::SGV }, { "shtml", false, STR_DESCRIPTION_HTMLFILE, SvImageId::HTML }, { "sim", false, STR_DESCRIPTION_SIMAGE_DOC, SvImageId::SIM }, { "smf", false, STR_DESCRIPTION_SMATH_DOC, SvImageId::Math }, @@ -547,10 +545,6 @@ static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig ) return Image(BitmapEx(BMP_MET_LC)); case SvImageId::PNG: return Image(BitmapEx(BMP_PNG_LC)); - case SvImageId::SGF: - return Image(BitmapEx(BMP_SGF_LC)); - case SvImageId::SGV: - return Image(BitmapEx(BMP_SGV_LC)); case SvImageId::SVM: return Image(BitmapEx(BMP_SVM_LC)); case SvImageId::GlobalDoc: @@ -651,10 +645,6 @@ static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig ) return Image(BitmapEx(BMP_MET_SC)); case SvImageId::PNG: return Image(BitmapEx(BMP_PNG_SC)); - case SvImageId::SGF: - return Image(BitmapEx(BMP_SGF_SC)); - case SvImageId::SGV: - return Image(BitmapEx(BMP_SGV_SC)); case SvImageId::SVM: return Image(BitmapEx(BMP_SVM_SC)); case SvImageId::GlobalDoc: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 7481e87ed705..eb6fe73f81f4 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -350,10 +350,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/filter/graphicfilter2 \ vcl/source/filter/GraphicNativeTransform \ vcl/source/filter/GraphicNativeMetadata \ - vcl/source/filter/sgfbram \ - vcl/source/filter/sgvmain \ - vcl/source/filter/sgvspln \ - vcl/source/filter/sgvtext \ vcl/source/filter/igif/decode \ vcl/source/filter/igif/gifread \ vcl/source/filter/ipdf/pdfread \ diff --git a/vcl/qa/cppunit/graphicfilter/data/sgv/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/sgv/fail/.gitignore deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/qa/cppunit/graphicfilter/data/sgv/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/sgv/indeterminate/.gitignore deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/qa/cppunit/graphicfilter/data/sgv/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/sgv/pass/.gitignore deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/qa/cppunit/graphicfilter/data/sgv/pass/SaveAsPicture.sgv b/vcl/qa/cppunit/graphicfilter/data/sgv/pass/SaveAsPicture.sgv deleted file mode 100644 index 0fe908e91c98..000000000000 Binary files a/vcl/qa/cppunit/graphicfilter/data/sgv/pass/SaveAsPicture.sgv and /dev/null differ diff --git a/vcl/qa/cppunit/graphicfilter/data/sgv/pass/faxpfeil.sgv b/vcl/qa/cppunit/graphicfilter/data/sgv/pass/faxpfeil.sgv deleted file mode 100644 index c8317c62e152..000000000000 Binary files a/vcl/qa/cppunit/graphicfilter/data/sgv/pass/faxpfeil.sgv and /dev/null differ diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index d6a32f2875d5..b6a36c141e63 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -151,9 +151,6 @@ void VclFiltersTest::testCVEs() m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/emf/")); testDir(OUString(), - m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/sgv/")); - - testDir(OUString(), m_directories.getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/png/")); testDir(OUString(), diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 60a1a0e927cd..bde60c7d3ae6 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -43,7 +43,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameLi const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] = { - IMP_SVMETAFILE, IMP_WMF, IMP_EMF, IMP_SVSGF, IMP_SVSGV, IMP_SVG, IMP_PDF, + IMP_SVMETAFILE, IMP_WMF, IMP_EMF, IMP_SVG, IMP_PDF, EXP_SVMETAFILE, EXP_WMF, EXP_EMF, EXP_SVG, EXP_PDF, nullptr }; @@ -234,8 +234,6 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] = "jpg","2","SVEJPEG", "mov","1","SVMOV", "mov","2","SVMOV", - "sgv","1","SVSGV", - "sgf","1","SVSGF", "met","1","ime", "png","1","SVIPNG", "png","2","SVEPNG", diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index c555ac89aa06..776ef710eee7 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -48,7 +48,6 @@ #include "jpeg/jpeg.hxx" #include "ixbm/xbmread.hxx" #include "ixpm/xpmread.hxx" -#include "sgffilt.hxx" #include <osl/module.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/awt/Size.hpp> @@ -725,27 +724,6 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, return true; } - //--------------------------- SGV ------------------------------------ - if( !bTest || rFormatExtension.startsWith( "SGV" ) ) - { - bSomethingTested = true; - - // just a simple test for the extension - if( rFormatExtension.startsWith( "SGV" ) ) - return true; - } - - //--------------------------- SGF ------------------------------------ - if( !bTest || rFormatExtension.startsWith( "SGF" ) ) - { - bSomethingTested=true; - if( sFirstBytes[ 0 ] == 'J' && sFirstBytes[ 1 ] == 'J' ) - { - rFormatExtension = "SGF"; - return true; - } - } - if(!bTest || rFormatExtension.startsWith( "MOV" )) { if ((sFirstBytes[ 4 ] == 'f' && sFirstBytes[ 5 ] == 't' && sFirstBytes[ 6 ] == 'y' && @@ -1791,68 +1769,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, nStatus = ERRCODE_GRFILTER_FILTERERROR; } } - else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVSGF ) - || aFilterName.equalsIgnoreAsciiCase( IMP_SVSGV ) ) - { - sal_uInt16 nVersion; - unsigned char nTyp = CheckSgfTyp( rIStream, nVersion ); - - switch( nTyp ) - { - case SGF_BITIMAGE: - { - SvMemoryStream aTempStream; - if( aTempStream.GetError() ) - return ERRCODE_GRFILTER_OPENERROR; - - if( !SgfBMapFilter( rIStream, aTempStream ) ) - nStatus = ERRCODE_GRFILTER_FILTERERROR; - else - { - aTempStream.Seek( 0 ); - ReadGraphic( aTempStream, rGraphic ); - - if( aTempStream.GetError() ) - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - } - break; - - case SGF_SIMPVECT: - { - GDIMetaFile aMtf; - if( !SgfVectFilter( rIStream, aMtf ) ) - nStatus = ERRCODE_GRFILTER_FILTERERROR; - else - rGraphic = Graphic( aMtf ); - } - break; - - case SGF_STARDRAW: - { - if( nVersion != SGV_VERSION ) - nStatus = ERRCODE_GRFILTER_VERSIONERROR; - else - { - GDIMetaFile aMtf; - if( !SgfSDrwFilter( rIStream, aMtf, - INetURLObject(aFilterPath) ) ) - { - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - else - rGraphic = Graphic( aMtf ); - } - } - break; - - default: - { - nStatus = ERRCODE_GRFILTER_FORMATERROR; - } - break; - } - } else if (aFilterName == IMP_PDF) { if (!vcl::ImportPDF(rIStream, rGraphic)) diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index ba1d2180ab65..aa4925d81a81 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -70,8 +70,6 @@ bool GraphicDescriptor::Detect( bool bExtendedInfo ) else if ( ImpDetectPCX( rStm, bExtendedInfo ) ) bRet = true; else if ( ImpDetectDXF( rStm, bExtendedInfo ) ) bRet = true; else if ( ImpDetectMET( rStm, bExtendedInfo ) ) bRet = true; - else if ( ImpDetectSGF( rStm, bExtendedInfo ) ) bRet = true; - else if ( ImpDetectSGV( rStm, bExtendedInfo ) ) bRet = true; else if ( ImpDetectSVM( rStm, bExtendedInfo ) ) bRet = true; else if ( ImpDetectWMF( rStm, bExtendedInfo ) ) bRet = true; else if ( ImpDetectEMF( rStm, bExtendedInfo ) ) bRet = true; @@ -955,40 +953,6 @@ bool GraphicDescriptor::ImpDetectPCT( SvStream& rStm, bool ) return bRet; } -bool GraphicDescriptor::ImpDetectSGF( SvStream& rStm, bool ) -{ - bool bRet = false; - if( aPathExt.startsWith( "sgf" ) ) - bRet = true; - else - { - sal_Int32 nStmPos = rStm.Tell(); - - sal_uInt8 nFirst = 0, nSecond = 0; - - rStm.ReadUChar( nFirst ).ReadUChar( nSecond ); - - if( nFirst == 'J' && nSecond == 'J' ) - bRet = true; - - rStm.Seek( nStmPos ); - } - - if( bRet ) - nFormat = GraphicFileFormat::SGF; - - return bRet; -} - -bool GraphicDescriptor::ImpDetectSGV( SvStream&, bool ) -{ - bool bRet = aPathExt.startsWith( "sgv" ); - if (bRet) - nFormat = GraphicFileFormat::SGV; - - return bRet; -} - bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, bool bExtendedInfo ) { sal_uInt32 n32 = 0; @@ -1118,8 +1082,6 @@ OUString GraphicDescriptor::GetImportFormatShortName( GraphicFileFormat nFormat case GraphicFileFormat::DXF : pKeyName = "dxf"; break; case GraphicFileFormat::MET : pKeyName = "met"; break; case GraphicFileFormat::PCT : pKeyName = "pct"; break; - case GraphicFileFormat::SGF : pKeyName = "sgf"; break; - case GraphicFileFormat::SGV : pKeyName = "sgv"; break; case GraphicFileFormat::SVM : pKeyName = "svm"; break; case GraphicFileFormat::WMF : pKeyName = "wmf"; break; case GraphicFileFormat::EMF : pKeyName = "emf"; break; diff --git a/vcl/source/filter/sgf.ini b/vcl/source/filter/sgf.ini deleted file mode 100644 index 2068c5f46e5a..000000000000 --- a/vcl/source/filter/sgf.ini +++ /dev/null @@ -1,136 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -#Family : (Roman,Swiss,Modern,Script,Decora); -#CharSet : (Ansi,IBMPC,Mac,Symbol,System); Default is System -#Attribute: (Bold,Ital,Sans,Serf,Fixd); - -[SGV Fonts for StarView] -#IF-ID Fontname Attribute SV-Fam ChSet Width FontName - 3848=(ITC Zapf Dingbats) Decora () - 5720=(Symbol) Serf Decora Symbol () - 5721=(Symbol) Bold Serf Decora Symbol () - 5723=(Symbol Sans) Sans Decora Symbol () - 5724=(Symbol Sans) Bold Sans Decora Symbol () - 90133=(Dom Casual) Sans Script () - 90326=(Brush) Bold Ital Serf Script () - 90349=(Park Avenue) Ital Serf Script () - 90508=(Uncial) Sans Roman () - 91118=(Antique Olive) Bold Sans Swiss () - 91119=(Antique Olive) Sans Swiss () - 91120=(Antique Olive Compact) Bold Sans Swiss () - 91335=(ITC Benguiat) Bold Serf Roman () - 91336=(ITC Benguiat) Bold Ital Serf Roman () - 91846=(Antique Olive) Ital Sans Roman () -#92500=(CG Times) Serf Roman () -#92501=(CG Times) Ital Serf Roman () -#92504=(CG Times) Bold Serf Roman () -#92505=(CG Times) Bold Ital Serf Roman () -#93950=(Courier) Serf Fixd Modern () -#93951=(Courier) Ital Serf Fixd Modern () -#93952=(Courier) Bold Serf Fixd Modern () -#93953=(Courier) Bold Ital Serf Fixd Modern () -#94021=(Univers) Sans Swiss () -#94022=(Univers) Ital Sans Swiss () -#94023=(Univers) Bold Sans Swiss () -#94024=(Univers) Bold Ital Sans Swiss () -102004=(Avanti) Bold Ital Sans Swiss () -102005=(Avanti) Ital Sans Swiss () -102007=(Booklet) Bold Sans Roman () -102008=(Booklet) Bold Ital Sans Roman () -102009=(Booklet) Ital Sans Roman () -102010=(Centuri) Sans Roman () -102011=(Centuri) Bold Sans Roman () -102012=(Centuri) Bold Ital Sans Roman () -102013=(Centuri) Ital Sans Roman () -102014=(Paltus) Bold Sans Roman () -102015=(Paltus) Sans Roman () -102016=(Paltus) Bold Ital Sans Roman () -102017=(Paltus) Ital Sans Roman () -102018=(Sans) Sans Swiss () -102019=(Sans) Bold Sans Swiss () -102020=(Sans) Bold Ital Sans Swiss () -102021=(Sans) Ital Sans Swiss () -102022=(SansCondensed) Sans Swiss () -102023=(SansCondensed) Bold Sans Swiss () -102024=(SansCondensed) Bold Ital Sans Swiss () -102025=(SansCondensed) Ital Sans Swiss () -102026=(PS-Roman) Sans Roman () -102027=(PS-Roman) Bold Sans Roman () -102028=(PS-Roman) Bold Ital Sans Roman () -102029=(PS-Roman) Ital Sans Roman () -200111=(Chalenge) Sans () -200112=(Chalenge) Bold Sans () -200113=(Chalenge) Ital Sans () -200114=(Chalenge) Bold Ital Sans () -200121=(Office) Sans () -200122=(Office) Bold Sans () -200123=(Office) Ital Sans () -200124=(Office) Bold Ital Sans () -200131=(Milano) Sans () -200132=(Milano) Bold Sans () -200133=(Milano) Ital Sans () -200134=(Milano) Bold Ital Sans () -200141=(Atlantic) Sans Roman () -200142=(Atlantic) Bold Sans Roman () -200143=(Atlantic) Ital Sans Roman () -200144=(Atlantic) Bold Ital Sans Roman () -200151=(Pentagon) Sans () -200152=(Pentagon) Bold Sans () -200153=(Pentagon) Ital Sans () -200154=(Pentagon) Bold Ital Sans () -200161=(Classico) Sans () -200162=(Classico) Bold Sans () -200163=(Classico) Ital Sans () -200164=(Classico) Bold Ital Sans () -200211=(Westcost) Sans () -200212=(Westcost) Bold Sans () -200213=(Westcost) Ital Sans () -200214=(Westcost) Bold Ital Sans () -200221=(Finish) Sans () -200222=(Finish) Bold Sans () -200223=(Finish) Ital Sans () -200224=(Finish) Bold Ital Sans () -200231=(Classic) Sans () -200232=(Classic) Bold Sans () -200233=(Classic) Ital Sans () -200234=(Classic) Bold Ital Sans () -200241=(Hilton) Sans () -200242=(Hilton) Bold Sans () -200243=(Hilton) Ital Sans () -200244=(Hilton) Bold Ital Sans () -200251=(Progress) Sans () -200252=(Progress) Bold Sans () -200253=(Progress) Ital Sans () -200254=(Progress) Bold Ital Sans () -200261=(PrestigeElite) Sans () -200262=(PrestigeElite) Bold Sans () -200263=(PrestigeElite) Ital Sans () -200271=(Ovetti) Bold Sans () -200272=(Ovetti) Sans () -200301=(Cescendo) Sans () -200302=(Funky) Sans Decora () -200303=(Speed) Sans Decora () -200304=(Skyline) Sans Decora () -200305=(Calculator) Sans Decora () -200306=(Xpress) Sans Decora () -200307=(Console) Sans Decora () -200308=(Paisley) Sans () -200309=(Nova) Sans () -200310=(New York) Sans Decora () -200311=(Shanghai) Sans Decora () diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx deleted file mode 100644 index e71fa944afeb..000000000000 --- a/vcl/source/filter/sgfbram.cxx +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <string.h> -#include <osl/endian.h> -#include <tools/stream.hxx> -#include <tools/fract.hxx> -#include <vcl/gdimtf.hxx> -#include <tools/color.hxx> -#include <vcl/virdev.hxx> -#include "sgffilt.hxx" -#include "sgfbram.hxx" -#include <memory> - -SgfHeader::SgfHeader() -{ - memset( this, 0, sizeof( SgfHeader ) ); -} - -SvStream& ReadSgfHeader(SvStream& rIStream, SgfHeader& rHead) -{ -#if !defined NDEBUG - sal_uInt64 const nOldPos(rIStream.Tell()); -#endif - rIStream.ReadUInt16(rHead.Magic); - rIStream.ReadUInt16(rHead.Version); - rIStream.ReadUInt16(rHead.Typ); - rIStream.ReadUInt16(rHead.Xsize); - rIStream.ReadUInt16(rHead.Ysize); - rIStream.ReadInt16(rHead.Xoffs); - rIStream.ReadInt16(rHead.Yoffs); - rIStream.ReadUInt16(rHead.Planes); - rIStream.ReadUInt16(rHead.SwGrCol); - rIStream.ReadBytes(&rHead.Autor, 10); - rIStream.ReadBytes(&rHead.Programm, 10); - rIStream.ReadUInt16(rHead.OfsLo); - rIStream.ReadUInt16(rHead.OfsHi); - assert(rIStream.GetError() || rIStream.Tell() == nOldPos + SgfHeaderSize); - return rIStream; -} - -bool SgfHeader::ChkMagic() -{ return Magic=='J'*256+'J'; } - -sal_uInt32 SgfHeader::GetOffset() -{ return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); } - -SgfEntry::SgfEntry() -{ - memset( this, 0, sizeof( SgfEntry ) ); -} - -SvStream& ReadSgfEntry(SvStream& rIStream, SgfEntry& rEntr) -{ -#if !defined NDEBUG - sal_uInt64 const nOldPos(rIStream.Tell()); -#endif - rIStream.ReadUInt16(rEntr.Typ); - rIStream.ReadUInt16(rEntr.iFrei); - rIStream.ReadUInt16(rEntr.lFreiLo); - rIStream.ReadUInt16(rEntr.lFreiHi); - rIStream.ReadBytes(&rEntr.cFrei, 10); - rIStream.ReadUInt16(rEntr.OfsLo); - rIStream.ReadUInt16(rEntr.OfsHi); - assert(rIStream.GetError() || rIStream.Tell() == nOldPos + SgfEntrySize); - return rIStream; -} - -sal_uInt32 SgfEntry::GetOffset() -{ return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); } - -SvStream& ReadSgfVector(SvStream& rIStream, SgfVector& rVect) -{ -#if !defined NDEBUG - sal_uInt64 const nOldPos(rIStream.Tell()); -#endif - rIStream.ReadUInt16(rVect.Flag); - rIStream.ReadInt16(rVect.x); - rIStream.ReadInt16(rVect.y); - rIStream.ReadUInt16(rVect.OfsLo); - rIStream.ReadUInt16(rVect.OfsHi); - assert(rIStream.GetError() || rIStream.Tell() == nOldPos + SgfVectorSize); - return rIStream; -} - -SvStream& WriteBmpFileHeader(SvStream& rOStream, BmpFileHeader& rHead) -{ -#if !defined NDEBUG - sal_uInt64 const nOldPos(rOStream.Tell()); -#endif - rOStream.WriteUInt16(rHead.Typ); - rOStream.WriteUInt16(rHead.SizeLo); - rOStream.WriteUInt16(rHead.SizeHi); - rOStream.WriteUInt16(rHead.Reserve1); - rOStream.WriteUInt16(rHead.Reserve2); - rOStream.WriteUInt16(rHead.OfsLo); - rOStream.WriteUInt16(rHead.OfsHi); - assert(rOStream.GetError() || rOStream.Tell() == nOldPos + BmpFileHeaderSize); - return rOStream; -} - -void BmpFileHeader::SetSize(sal_uInt32 Size) -{ - SizeLo=sal_uInt16(Size & 0x0000FFFF); - SizeHi=sal_uInt16((Size & 0xFFFF0000)>>16); -} - -void BmpFileHeader::SetOfs(sal_uInt32 Ofs) -{ - OfsLo=sal_uInt16(Ofs & 0x0000FFFF); - OfsHi=sal_uInt16((Ofs & 0xFFFF0000)>>16); -} - -sal_uInt32 BmpFileHeader::GetOfs() -{ - return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); -} - -SvStream& WriteBmpInfoHeader(SvStream& rOStream, BmpInfoHeader& rInfo) -{ -#if !defined NDEBUG - sal_uInt64 const nOldPos(rOStream.Tell()); -#endif - rOStream.WriteUInt32(rInfo.Size); - rOStream.WriteInt32(rInfo.Width); - rOStream.WriteInt32(rInfo.Hight); - rOStream.WriteUInt16(rInfo.Planes); - rOStream.WriteUInt16(rInfo.PixBits); - rOStream.WriteUInt32(rInfo.Compress); - rOStream.WriteUInt32(rInfo.ImgSize); - rOStream.WriteInt32(rInfo.xDpmm); - rOStream.WriteInt32(rInfo.yDpmm); - rOStream.WriteUInt32(rInfo.ColUsed); - rOStream.WriteUInt32(rInfo.ColMust); - assert(rOStream.GetError() || rOStream.Tell() == nOldPos + BmpInfoHeaderSize); - return rOStream; -} - -SvStream& WriteRGBQuad(SvStream& rOStream, const RGBQuad& rQuad) -{ - rOStream.WriteBytes(&rQuad, sizeof(rQuad)); - return rOStream; -} - -class PcxExpand -{ -private: - sal_uInt16 Count; - sal_uInt8 Data; -public: - PcxExpand() - : Count(0) - , Data(0) - {} - sal_uInt8 GetByte(SvStream& rInp); -}; - -sal_uInt8 PcxExpand::GetByte(SvStream& rInp) -{ - if (Count>0) { - Count--; - } else { - rInp.ReadBytes(&Data, 1); - if ((Data & 0xC0) == 0xC0) { - Count=(Data & 0x3F) -1; - rInp.ReadBytes(&Data, 1); - } - } - return Data; -} - -bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader const & rHead) -{ - BmpFileHeader aBmpHead; - BmpInfoHeader aBmpInfo; - sal_uInt16 nWdtInp=(rHead.Xsize+7)/8; // width of input bitmap in bytes - sal_uInt16 nWdtOut; // width of output bitmap in bytes - sal_uInt16 nColors; // color count (1, 16, 256) - sal_uInt16 nColBits; // number of bits per pixel (2, 4, 8) - sal_uInt16 a,b; // helper variables - sal_uInt8 pl1 = 0; // masks for the planes - std::unique_ptr<sal_uInt8[]> pBuf; // buffer for a pixel row - PcxExpand aPcx; - sal_uLong nOfs; - sal_uInt8 cRGB[4]; - - if (rHead.Planes<=1) nColBits=1; else nColBits=4; if (rHead.Typ==4) nColBits=8; - nColors=1<<nColBits; - nWdtOut=((rHead.Xsize*nColBits+31)/32)*4; - aBmpHead.Typ='B'+'M'*256; - aBmpHead.SetOfs(sizeof(aBmpHead)+sizeof(aBmpInfo)+nColors*4); - aBmpHead.SetSize(aBmpHead.GetOfs()+nWdtOut*rHead.Ysize); - aBmpHead.Reserve1=0; - aBmpHead.Reserve2=0; - aBmpInfo.Size=sizeof(aBmpInfo); - aBmpInfo.Width=rHead.Xsize; - aBmpInfo.Hight=rHead.Ysize; - aBmpInfo.Planes=1; - aBmpInfo.PixBits=nColBits; - aBmpInfo.Compress=0; - aBmpInfo.ImgSize=0; - aBmpInfo.xDpmm=0; - aBmpInfo.yDpmm=0; - aBmpInfo.ColUsed=0; - aBmpInfo.ColMust=0; - pBuf.reset(new sal_uInt8[nWdtOut]); - if (!pBuf) return false; // error: no more memory available - WriteBmpFileHeader( rOut, aBmpHead ); - WriteBmpInfoHeader( rOut, aBmpInfo ); - memset(pBuf.get(),0,nWdtOut); // fill buffer with zeroes - - if (nColors==2) - { - - WriteRGBQuad( rOut, RGBQuad(0x00,0x00,0x00) ); // black - WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0xFF) ); // white - nOfs=rOut.Tell(); - for (sal_uInt16 j=0;j<rHead.Ysize;j++) - rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes - for (sal_uInt16 j=0;j<rHead.Ysize;j++) { - for(sal_uInt16 i=0;i<nWdtInp;i++) { - pBuf[i]=aPcx.GetByte(rInp); - } - for(sal_uInt16 i=nWdtInp;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes - rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1)*(sal_uLong)nWdtOut); // write backwards - rOut.WriteBytes(pBuf.get(), nWdtOut); - } - } else if (nColors==16) { - sal_uInt8 pl2= 0; // planes' masks - - WriteRGBQuad( rOut, RGBQuad(0x00,0x00,0x00) ); // black - WriteRGBQuad( rOut, RGBQuad(0x24,0x24,0x24) ); // gray 80% - WriteRGBQuad( rOut, RGBQuad(0x49,0x49,0x49) ); // gray 60% - WriteRGBQuad( rOut, RGBQuad(0x92,0x92,0x92) ); // gray 40% - WriteRGBQuad( rOut, RGBQuad(0x6D,0x6D,0x6D) ); // gray 30% - WriteRGBQuad( rOut, RGBQuad(0xB6,0xB6,0xB6) ); // gray 20% - WriteRGBQuad( rOut, RGBQuad(0xDA,0xDA,0xDA) ); // gray 10% - WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0xFF) ); // white - WriteRGBQuad( rOut, RGBQuad(0x00,0x00,0x00) ); // black - WriteRGBQuad( rOut, RGBQuad(0xFF,0x00,0x00) ); // red - WriteRGBQuad( rOut, RGBQuad(0x00,0x00,0xFF) ); // blue - WriteRGBQuad( rOut, RGBQuad(0xFF,0x00,0xFF) ); // magenta - WriteRGBQuad( rOut, RGBQuad(0x00,0xFF,0x00) ); // green - WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0x00) ); // yellow - WriteRGBQuad( rOut, RGBQuad(0x00,0xFF,0xFF) ); // cyan - WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0xFF) ); // white - - nOfs=rOut.Tell(); - for (sal_uInt16 j=0;j<rHead.Ysize;j++) - rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes - for (sal_uInt16 j=0;j<rHead.Ysize;j++) { - memset(pBuf.get(),0,nWdtOut); - for(sal_uInt16 k=0;k<4;k++) { - if (k==0) { - pl1=0x10; pl2=0x01; - } else { - pl1<<=1; pl2<<=1; - } - for(sal_uInt16 i=0;i<nWdtInp;i++) { - a=i*4; - b=aPcx.GetByte(rInp); - if (b & 0x80) pBuf[a ]|=pl1; - if (b & 0x40) pBuf[a ]|=pl2; - if (b & 0x20) pBuf[a+1]|=pl1; - if (b & 0x10) pBuf[a+1]|=pl2; - if (b & 0x08) pBuf[a+2]|=pl1; - if (b & 0x04) pBuf[a+2]|=pl2; - if (b & 0x02) pBuf[a+3]|=pl1; - if (b & 0x01) pBuf[a+3]|=pl2; - } - } - for(sal_uInt16 i=nWdtInp*4;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes - rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1)*(sal_uLong)nWdtOut); // write backwards - rOut.WriteBytes(pBuf.get(), nWdtOut); - } - } else if (nColors==256) { - - //we're going to loop Ysize * XSize on GetByte, max compression for GetByte is a run of 63 - //if we're less than that (and add a generous amount of wriggle room) then its not going - //to fly - sal_uInt64 nMinBytesPossiblyNeeded = rHead.Xsize; - nMinBytesPossiblyNeeded *= rHead.Ysize / 128; - if (rInp.remainingSize() < nMinBytesPossiblyNeeded) - return false; - - cRGB[3]=0; // fourth palette entry for BMP - for (sal_uInt16 i=0;i<256;i++) { // copy palette - rInp.ReadBytes(cRGB, 3); - pl1=cRGB[0]; // switch red and blue - cRGB[0]=cRGB[2]; - cRGB[2]=pl1; - rOut.WriteBytes(cRGB, 4); - } - - nOfs=rOut.Tell(); - for (sal_uInt16 j=0;j<rHead.Ysize;j++) - rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes - for (sal_uInt16 j=0;j<rHead.Ysize;j++) { - for(sal_uInt16 i=0;i<rHead.Xsize;i++) - pBuf[i]=aPcx.GetByte(rInp); - for(sal_uInt16 i=rHead.Xsize;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes - rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1)*(sal_uLong)nWdtOut); // write backwards - rOut.WriteBytes(pBuf.get(), nWdtOut); - } - } - return true; -} - -bool SgfBMapFilter(SvStream& rInp, SvStream& rOut) -{ - sal_uLong nFileStart; // offset of SgfHeaders. Usually 0. - SgfHeader aHead; - SgfEntry aEntr; - sal_uLong nNext; - bool bRet=false; // return value - - nFileStart=rInp.Tell(); - ReadSgfHeader( rInp, aHead ); - if (!rInp.good()) - return false; - - if (aHead.ChkMagic() && (aHead.Typ==SgfBitImag0 || aHead.Typ==SgfBitImag1 || - aHead.Typ==SgfBitImag2 || aHead.Typ==SgfBitImgMo)) - { - bool bRdFlag = false; // read graphics entry? - nNext = aHead.GetOffset(); - while (nNext && !bRdFlag && !rInp.GetError() && !rOut.GetError()) { - rInp.Seek(nFileStart+nNext); - ReadSgfEntry( rInp, aEntr ); - nNext=aEntr.GetOffset(); - if (aEntr.Typ==aHead.Typ) { - bRdFlag=true; - switch(aEntr.Typ) { - case SgfBitImag0: - case SgfBitImag1: - case SgfBitImag2: - case SgfBitImgMo: bRet=SgfFilterBMap(rInp,rOut,aHead); break; - } - } - } // while(nNext) - } - if (rInp.GetError()) bRet=false; - return bRet; -} - -// for StarDraw embedded SGF vector -long SgfVectXofs=0; -long SgfVectYofs=0; -long SgfVectXmul=0; -long SgfVectYmul=0; -long SgfVectXdiv=0; -long SgfVectYdiv=0; -bool SgfVectScal=false; - -Color Hpgl2SvFarbe( sal_uInt8 nFarb ) -{ - sal_uLong nColor = COL_BLACK; - - switch (nFarb & 0x07) { - case 0: nColor=COL_WHITE; break; - case 1: nColor=COL_YELLOW; break; - case 2: nColor=COL_LIGHTMAGENTA; break; - case 3: nColor=COL_LIGHTRED; break; - case 4: nColor=COL_LIGHTCYAN; break; - case 5: nColor=COL_LIGHTGREEN; break; - case 6: nColor=COL_LIGHTBLUE; break; - case 7: nColor=COL_BLACK; break; - } - Color aColor( nColor ); - return aColor; -} - -bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, GDIMetaFile& rMtf) -{ - ScopedVclPtrInstance< VirtualDevice > aOutDev; - SgfVector aVect; - sal_uInt8 nFarb; - sal_uInt8 nFrb0=7; - sal_uInt8 nLTyp; - sal_uInt8 nOTyp; - bool bEoDt=false; - Point aP0(0,0); - Point aP1(0,0); - sal_uInt16 RecNr=0; - - rMtf.Record(aOutDev.get()); - aOutDev->SetLineColor(Color(COL_BLACK)); - aOutDev->SetFillColor(Color(COL_BLACK)); - - while (!bEoDt && !rInp.GetError()) { - ReadSgfVector( rInp, aVect ); RecNr++; - nFarb=(sal_uInt8) (aVect.Flag & 0x000F); - nLTyp=(sal_uInt8)((aVect.Flag & 0x00F0) >>4); - nOTyp=(sal_uInt8)((aVect.Flag & 0x0F00) >>8); - bEoDt=(aVect.Flag & 0x4000) !=0; - bool bPDwn=(aVect.Flag & 0x8000) !=0; - - long x=aVect.x-rHead.Xoffs; - long y=rHead.Ysize-(aVect.y-rHead.Yoffs); - if (SgfVectScal) { - if (SgfVectXdiv==0) SgfVectXdiv=rHead.Xsize; - if (SgfVectYdiv==0) SgfVectYdiv=rHead.Ysize; - if (SgfVectXdiv==0) SgfVectXdiv=1; - if (SgfVectYdiv==0) SgfVectYdiv=1; - x=SgfVectXofs+ x *SgfVectXmul /SgfVectXdiv; - y=SgfVectYofs+ y *SgfVectXmul /SgfVectYdiv; - } - aP1=Point(x,y); - if (!bEoDt && !rInp.GetError()) { - if (bPDwn && nLTyp<=6) { - switch(nOTyp) { - case 1: if (nFarb!=nFrb0) { - switch(rHead.SwGrCol) { - case SgfVectFarb: aOutDev->SetLineColor(Hpgl2SvFarbe(nFarb)); break; - case SgfVectGray: break; - case SgfVectWdth: break; - } - } - aOutDev->DrawLine(aP0,aP1); break; // line - case 2: break; // circle - case 3: break; // text - case 5: aOutDev->DrawRect(tools::Rectangle(aP0,aP1)); break; // rectangle (solid) - } - } - aP0=aP1; - nFrb0=nFarb; - } - } - rMtf.Stop(); - rMtf.WindStart(); - MapMode aMap( MapUnit::Map10thMM, Point(), - Fraction( 1, 4 ), Fraction( 1, 4 ) ); - rMtf.SetPrefMapMode( aMap ); - rMtf.SetPrefSize( Size( (short)rHead.Xsize, (short)rHead.Ysize ) ); - return true; -} - -bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) -{ - sal_uLong nFileStart; // offset of SgfHeaders. Usually 0. - SgfHeader aHead; - SgfEntry aEntr; - sal_uLong nNext; - bool bRet=false; // return value - - nFileStart=rInp.Tell(); - ReadSgfHeader( rInp, aHead ); - if (aHead.ChkMagic() && aHead.Typ==SGF_SIMPVECT) { - nNext=aHead.GetOffset(); - while (nNext && !rInp.GetError()) { - rInp.Seek(nFileStart+nNext); - ReadSgfEntry( rInp, aEntr ); - nNext=aEntr.GetOffset(); - if (aEntr.Typ==aHead.Typ) { - bRet=SgfFilterVect(rInp,aHead,rMtf); - } - } // while(nNext) - } - return bRet; -} - -/************************************************************************* -|* -|* CheckSgfTyp() -|* -|* Description determine which kind of SGF/SGV it is -|* -*************************************************************************/ -sal_uInt8 CheckSgfTyp(SvStream& rInp, sal_uInt16& nVersion) -{ -#if OSL_DEBUG_LEVEL > 1 // check record size, new Compiler had different alignment! - if (sizeof(SgfHeader)!=SgfHeaderSize || - sizeof(SgfEntry) !=SgfEntrySize || - sizeof(SgfVector)!=SgfVectorSize || - sizeof(BmpFileHeader)!=BmpFileHeaderSize || - sizeof(BmpInfoHeader)!=BmpInfoHeaderSize || - sizeof(RGBQuad )!=RGBQuadSize ) return SGF_DONTKNOW; -#endif - - sal_uLong nPos; - SgfHeader aHead; - nVersion=0; - nPos=rInp.Tell(); - ReadSgfHeader( rInp, aHead ); - rInp.Seek(nPos); - if (aHead.ChkMagic()) { - nVersion=aHead.Version; - switch(aHead.Typ) { - case SgfBitImag0: - case SgfBitImag1: - case SgfBitImag2: - case SgfBitImgMo: return SGF_BITIMAGE; - case SgfSimpVect: return SGF_SIMPVECT; - case SgfPostScrp: return SGF_POSTSCRP; - case SgfStarDraw: return SGF_STARDRAW; - default : return SGF_DONTKNOW; - } - } else { - return SGF_DONTKNOW; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/sgfbram.hxx b/vcl/source/filter/sgfbram.hxx deleted file mode 100644 index f714170f43b6..000000000000 --- a/vcl/source/filter/sgfbram.hxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_SOURCE_FILTER_SGFBRAM_HXX -#define INCLUDED_VCL_SOURCE_FILTER_SGFBRAM_HXX - -#define SgfBitImag0 1 /* Bitmap */ -#define SgfBitImag1 4 /* Bitmap */ -#define SgfBitImag2 5 /* Bitmap */ -#define SgfBitImgMo 6 /* Monochrome bitmap */ -#define SgfSimpVect 2 /* Simple vectorformat */ -#define SgfPostScrp 3 /* Postscript file */ -#define SgfStarDraw 7 /* StarDraw SGV-file */ - -// constants for SgfHeader.SwGrCol -#define SgfVectFarb 4 /* use colours in lines */ -#define SgfVectGray 5 /* use greyscale for lines only for */ -#define SgfVectWdth 6 /* use line widths for lines SimpVector */ - -#define SgfHeaderSize 42 -class SgfHeader -{ -public: - sal_uInt16 Magic; - sal_uInt16 Version; - sal_uInt16 Typ; - sal_uInt16 Xsize; - sal_uInt16 Ysize; - sal_Int16 Xoffs; - sal_Int16 Yoffs; - sal_uInt16 Planes; // Layer - sal_uInt16 SwGrCol; - char Autor[10]; - char Programm[10]; - sal_uInt16 OfsLo,OfsHi; // DWord allignment is necessary (38 mod 4 =2) ! - - sal_uInt32 GetOffset(); - friend SvStream& ReadSgfHeader(SvStream& rIStream, SgfHeader& rHead); - bool ChkMagic(); - SgfHeader(); -}; - -#define SgfEntrySize 22 -class SgfEntry -{ -public: - sal_uInt16 Typ; - sal_uInt16 iFrei; - sal_uInt16 lFreiLo,lFreiHi; - char cFrei[10]; - sal_uInt16 OfsLo,OfsHi; // DWord allignment is necessary (18 mod 4 =2) ! - - sal_uInt32 GetOffset(); - friend SvStream& ReadSgfEntry(SvStream& rIStream, SgfEntry& rEntr); - SgfEntry(); -}; - -#define SgfVectorSize 10 -class SgfVector -{ -public: - sal_uInt16 Flag; - sal_Int16 x; - sal_Int16 y; - sal_uInt16 OfsLo,OfsHi; // DWord allignment is necessary (6 mod 4 =2) ! - - friend SvStream& ReadSgfVector(SvStream& rIStream, SgfVector& rEntr); -}; - -extern long SgfVectXofs; -extern long SgfVectYofs; -extern long SgfVectXmul; -extern long SgfVectYmul; -extern long SgfVectXdiv; -extern long SgfVectYdiv; -extern bool SgfVectScal; - -#define BmpFileHeaderSize 14 -class BmpFileHeader -{ -public: - sal_uInt16 Typ; // = "BM" - sal_uInt16 SizeLo,SizeHi; // filesize in bytes - sal_uInt16 Reserve1; // reserved - sal_uInt16 Reserve2; // reserved - sal_uInt16 OfsLo,OfsHi; // Offset? - - void SetSize(sal_uInt32 Size); - void SetOfs(sal_uInt32 Size); - sal_uInt32 GetOfs(); - friend SvStream& WriteBmpFileHeader(SvStream& rOStream, BmpFileHeader& rHead); -}; - -#define BmpInfoHeaderSize 40 -class BmpInfoHeader -{ -public: - sal_uInt32 Size; // size of BmpInfoHeaders - sal_Int32 Width; // width in Pixel - sal_Int32 Hight; // height in Pixel - sal_uInt16 Planes; // number of planes (always 1) - sal_uInt16 PixBits; // number of bits per pixel (1,4,8 or 24) - sal_uInt32 Compress; // data compression - sal_uInt32 ImgSize; // size of image in bytes. Without compression also 0 is allowed. - sal_Int32 xDpmm; // Dot per Meter (0 is allowed) - sal_Int32 yDpmm; // Dot per Meter (0 is allowed) - sal_uInt32 ColUsed; // number of colours used (0=all - sal_uInt32 ColMust; // number of important colours (0=all) - - friend SvStream& WriteBmpInfoHeader(SvStream& rOStream, BmpInfoHeader& rHead); -}; - -#define RGBQuadSize 4 -class RGBQuad { -private: - sal_uInt8 Red; - sal_uInt8 Grn; - sal_uInt8 Blu; - sal_uInt8 Fil; -public: - RGBQuad(sal_uInt8 R, sal_uInt8 G, sal_uInt8 B) { Red=R; Grn=G; Blu=B; Fil=0; } -}; - -#endif // INCLUDED_VCL_SOURCE_FILTER_SGFBRAM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/sgffilt.hxx b/vcl/source/filter/sgffilt.hxx deleted file mode 100644 index 9256c61770fc..000000000000 --- a/vcl/source/filter/sgffilt.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_SOURCE_FILTER_SGFFILT_HXX -#define INCLUDED_VCL_SOURCE_FILTER_SGFFILT_HXX -#include <tools/urlobj.hxx> - -sal_uInt8 CheckSgfTyp(SvStream& rInp, sal_uInt16& nVersion); -bool SgfBMapFilter(SvStream& rInp, SvStream& rOut); -bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf); -bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, const INetURLObject& aIniPath ); - -// constants for CheckSgfTyp() -#define SGF_BITIMAGE 1 /* Bitmap */ -#define SGF_SIMPVECT 2 /* simple vectorformat */ -#define SGF_POSTSCRP 3 /* Postscript file */ -#define SGF_STARDRAW 7 /* StarDraw SGV file */ -#define SGF_DONTKNOW 255 /* unknown or no SGF/SGV */ - -#define SGV_VERSION 3 /* reject SGV with other version */ - /* 3 matches StarDraw 2.00/2.01 march'93 */ -#endif // INCLUDED_VCL_SOURCE_FILTER_SGFFILT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx deleted file mode 100644 index b26e120874f8..000000000000 --- a/vcl/source/filter/sgvmain.cxx +++ /dev/null @@ -1,947 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <rtl/math.hxx> -#include <osl/endian.h> -#include <vcl/graph.hxx> -#include <tools/poly.hxx> -#include <tools/fract.hxx> -#include <vcl/graphicfilter.hxx> -#include "sgffilt.hxx" -#include "sgfbram.hxx" -#include "sgvmain.hxx" -#include "sgvspln.hxx" -#include <unotools/ucbstreamhelper.hxx> - -// Restrictions: - -// - area patterns are matched to the available ones in Starview. -// - line ends are always rounded in StarView and continue past the end of line. -// - line patterns are matched to the available ones in Starview. -// transparency/opacity is not taken into account -// - no rotated ellipses - -// for font translation -SgfFontLst* pSgfFonts = nullptr; - -// for circle kinds, text and rotated rectangles -void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs) -{ - sal_Int16 dx,dy; - double x1,y1; - dx=P.x-cx; - dy=P.y-cy; - x1=dx*cs-dy*sn; - y1=dy*cs+dx*sn; - P.x=cx+sal_Int16(x1); - P.y=cy+sal_Int16(y1); -} - -void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs) -{ - sal_Int16 dx,dy; - double x1,y1; - dx=(sal_Int16)(P.X()-cx); - dy=(sal_Int16)(P.Y()-cy); - x1=dx*cs-dy*sn; - y1=dy*cs+dx*sn; - P=Point(cx+sal_Int16(x1),cy+sal_Int16(y1)); -} - -sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div) -{ - sal_Int32 Temp; - Temp=sal_Int32(a)*sal_Int32(Mul)/sal_Int32(Div); - return sal_Int16(Temp); -} - -sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div) -{ - sal_uInt32 Temp; - Temp=sal_uInt32(a)*sal_uInt32(Mul)/sal_uInt32(Div); - return sal_uInt16(Temp); -} - -// SgfFilterSDrw - -void DtHdOverSeek(SvStream& rInp) -{ - sal_uLong FPos=rInp.Tell(); - FPos+=(sal_uLong)DtHdSize; - rInp.Seek(FPos); -} - -PageType::PageType() -{ - memset( this, 0, sizeof( PageType ) ); -} - -SvStream& ReadPageType(SvStream& rIStream, PageType& rPage) -{ - sal_uInt64 const nOldPos(rIStream.Tell()); - rIStream.ReadUInt32(rPage.Next); - rIStream.ReadUInt32(rPage.nList); - rIStream.ReadUInt32(rPage.ListEnd); - rIStream.ReadInt16(rPage.Paper.Size.x); - rIStream.ReadInt16(rPage.Paper.Size.y); - rIStream.ReadInt16(rPage.Paper.RandL); - rIStream.ReadInt16(rPage.Paper.RandR); - rIStream.ReadInt16(rPage.Paper.RandO); - rIStream.ReadInt16(rPage.Paper.RandU); - rIStream.ReadUChar(rPage.Paper.PColor); - rIStream.ReadUChar(rPage.Paper.PIntens); - rIStream.ReadCharAsBool(rPage.BorderClip); - rIStream.ReadUChar(rPage.StdPg); - rIStream.ReadInt16(rPage.U.x); - rIStream.ReadInt16(rPage.U.y); - for (int i = 0; i < 20; ++i) - { - rIStream.ReadInt16(rPage.HlpLnH[i]); - } - for (int i = 0; i < 20; ++i) - { - rIStream.ReadInt16(rPage.HlpLnV[i]); - } - rIStream.ReadUChar(rPage.LnAnzH); - rIStream.ReadUChar(rPage.LnAnzV); - for (int i = 0; i < 32; ++i) - { - rIStream.ReadUChar(rPage.PgName[i]); - } - assert(rIStream.GetError() || rIStream.Tell() == nOldPos + PageSize); - (void) nOldPos; - return rIStream; -} - -void ReadObjLineType(SvStream & rInp, ObjLineType & rLine) -{ - // reads 8 bytes - rInp.ReadUChar(rLine.LFarbe); - rInp.ReadUChar(rLine.LBFarbe); - rInp.ReadUChar(rLine.LIntens); - rInp.ReadUChar(rLine.LMuster); - rInp.ReadInt16(rLine.LMSize); - rInp.ReadInt16(rLine.LDicke); -} - -void ReadObjAreaType(SvStream & rInp, ObjAreaType & rArea) -{ - // reads 8 bytes - rInp.ReadUChar(rArea.FFarbe); - rInp.ReadUChar(rArea.FBFarbe); - rInp.ReadUChar(rArea.FIntens); - rInp.ReadUChar(rArea.FDummy1); - rInp.ReadInt16(rArea.FDummy2); - rInp.ReadUInt16(rArea.FMuster); -} - -void ObjkOverSeek(SvStream& rInp, ObjkType const & rObjk) -{ - sal_uLong Siz; - Siz=(sal_uLong)rObjk.MemSize+rObjk.Last; // ObjSize+ObjAnhSize - rInp.Seek(rInp.Tell()+Siz); -} - -SvStream& ReadObjkType(SvStream& rInp, ObjkType& rObjk, bool const isRewind = true) -{ - // fileposition in stream is not changed! - sal_uInt64 const nOldPos = rInp.Tell(); - rInp.ReadUInt32(rObjk.Last); - rInp.ReadUInt32(rObjk.Next); - rInp.ReadUInt16(rObjk.MemSize); - rInp.ReadInt16(rObjk.ObjMin.x); - rInp.ReadInt16(rObjk.ObjMin.y); - rInp.ReadInt16(rObjk.ObjMax.x); - rInp.ReadInt16(rObjk.ObjMax.y); - rInp.ReadUChar(rObjk.Art); - rInp.ReadUChar(rObjk.Layer); - assert(rInp.GetError() || rInp.Tell() == nOldPos + ObjkSize); - if (isRewind) - rInp.Seek(nOldPos); - return rInp; -} -SvStream& ReadStrkType(SvStream& rInp, StrkType& rStrk) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rStrk, false); - rInp.ReadUChar(rStrk.Flags); - rInp.ReadUChar(rStrk.LEnden); - ReadObjLineType(rInp, rStrk.L); - rInp.ReadInt16(rStrk.Pos1.x); - rInp.ReadInt16(rStrk.Pos1.y); - rInp.ReadInt16(rStrk.Pos2.x); - rInp.ReadInt16(rStrk.Pos2.y); - assert(rInp.GetError() || rInp.Tell() == nOldPos + StrkSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadRectType(SvStream& rInp, RectType& rRect) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rRect, false); - rInp.ReadUChar(rRect.Flags); - rInp.ReadUChar(rRect.Reserve); - ReadObjLineType(rInp, rRect.L); - ReadObjAreaType(rInp, rRect.F); - rInp.ReadInt16(rRect.Pos1.x); - rInp.ReadInt16(rRect.Pos1.y); - rInp.ReadInt16(rRect.Pos2.x); - rInp.ReadInt16(rRect.Pos2.y); - rInp.ReadInt16(rRect.Radius); - rInp.ReadUInt16(rRect.RotationAngle); - rInp.ReadUInt16(rRect.Slant); - assert(rInp.GetError() || rInp.Tell() == nOldPos + RectSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadPolyType(SvStream& rInp, PolyType& rPoly) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rPoly, false); - rInp.ReadUChar(rPoly.Flags); - rInp.ReadUChar(rPoly.LEnden); - ReadObjLineType(rInp, rPoly.L); - ReadObjAreaType(rInp, rPoly.F); - rInp.ReadUChar(rPoly.nPoints); - rInp.ReadUChar(rPoly.Reserve); - rInp.ReadUInt32(rPoly.SD_EckP); - assert(rInp.GetError() || rInp.Tell() == nOldPos + PolySize); - (void) nOldPos; - return rInp; -} - -SvStream& ReadSplnType(SvStream& rInp, SplnType& rSpln) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rSpln, false); - rInp.ReadUChar(rSpln.Flags); - rInp.ReadUChar(rSpln.LEnden); - ReadObjLineType(rInp, rSpln.L); - ReadObjAreaType(rInp, rSpln.F); - rInp.ReadUChar(rSpln.nPoints); - rInp.ReadUChar(rSpln.Reserve); - rInp.ReadUInt32(rSpln.SD_EckP); - assert(rInp.GetError() || rInp.Tell() == nOldPos + SplnSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadCircType(SvStream& rInp, CircType& rCirc) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rCirc, false); - rInp.ReadUChar(rCirc.Flags); - rInp.ReadUChar(rCirc.LEnden); - ReadObjLineType(rInp, rCirc.L); - ReadObjAreaType(rInp, rCirc.F); - rInp.ReadInt16(rCirc.Center.x); - rInp.ReadInt16(rCirc.Center.y); - rInp.ReadInt16(rCirc.Radius.x); - rInp.ReadInt16(rCirc.Radius.y); - rInp.ReadUInt16(rCirc.RotationAngle); - rInp.ReadUInt16(rCirc.StartAngle); - rInp.ReadUInt16(rCirc.RelAngle); - assert(rInp.GetError() || rInp.Tell() == nOldPos + CircSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadTextType(SvStream& rInp, TextType& rText) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rText, false); - rInp.ReadUChar(rText.Flags); - rInp.ReadUChar(rText.Reserve); - ReadObjLineType(rInp, rText.T.L); - ReadObjAreaType(rInp, rText.T.F); - rInp.ReadUInt16(rText.T.FontLo); - rInp.ReadUInt16(rText.T.FontHi); - rInp.ReadUInt16(rText.T.Grad); - rInp.ReadUInt16(rText.T.Breite); - rInp.ReadUChar(rText.T.Justify); - rInp.ReadUChar(rText.T.Kapit); - rInp.ReadUInt16(rText.T.Schnitt); - rInp.ReadUInt16(rText.T.LnFeed); - rInp.ReadUInt16(rText.T.Slant); - rInp.ReadUChar(rText.T.ZAbst); - rInp.ReadSChar(rText.T.ChrVPos); - ReadObjLineType(rInp, rText.T.ShdL); - ReadObjAreaType(rInp, rText.T.ShdF); - rInp.ReadInt16(rText.T.ShdVers.x); - rInp.ReadInt16(rText.T.ShdVers.y); - rInp.ReadCharAsBool(rText.T.ShdAbs); - rInp.ReadCharAsBool(rText.T.NoSpc); - ReadObjAreaType(rInp, rText.T.BackF); - rInp.ReadInt16(rText.Pos1.x); - rInp.ReadInt16(rText.Pos1.y); - rInp.ReadInt16(rText.Pos2.x); - rInp.ReadInt16(rText.Pos2.y); - rInp.ReadInt16(rText.TopOfs); - rInp.ReadUInt16(rText.RotationAngle); - rInp.ReadUInt16(rText.BoxSlant); - rInp.ReadUInt16(rText.BufSize); - rInp.ReadUInt16(rText.BufLo); - rInp.ReadUInt16(rText.BufHi); - rInp.ReadUInt16(rText.ExtLo); - rInp.ReadUInt16(rText.ExtHi); - rInp.ReadInt16(rText.FitSize.x); - rInp.ReadInt16(rText.FitSize.y); - rInp.ReadInt16(rText.FitBreit); - assert(rInp.GetError() || rInp.Tell() == nOldPos + TextSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadBmapType(SvStream& rInp, BmapType& rBmap) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rBmap, false); - rInp.ReadUChar(rBmap.Flags); - rInp.ReadUChar(rBmap.Reserve); - ReadObjAreaType(rInp, rBmap.F); - rInp.ReadInt16(rBmap.Pos1.x); - rInp.ReadInt16(rBmap.Pos1.y); - rInp.ReadInt16(rBmap.Pos2.x); - rInp.ReadInt16(rBmap.Pos2.y); - rInp.ReadUInt16(rBmap.RotationAngle); - rInp.ReadUInt16(rBmap.Slant); - for (int i = 0; i < 80; ++i) - { - rInp.ReadUChar(rBmap.Filename[i]); - } - rInp.ReadInt16(rBmap.PixSize.x); - rInp.ReadInt16(rBmap.PixSize.y); - static_assert(sizeof(enum GrafStat) == 4, "enum has unexpected size"); - sal_uInt32 nTemp(0); - rInp.ReadUInt32(nTemp); - rBmap.Format = static_cast<GrafStat>(nTemp); - rInp.ReadUChar(rBmap.nPlanes); - rInp.ReadCharAsBool(rBmap.RawOut); - rInp.ReadCharAsBool(rBmap.InvOut); - rInp.ReadCharAsBool(rBmap.LightOut); - rInp.ReadUChar(rBmap.GrfFlg); - assert(rInp.GetError() || rInp.Tell() == nOldPos + BmapSize); - (void) nOldPos; - return rInp; -} -SvStream& ReadGrupType(SvStream& rInp, GrupType& rGrup) -{ - sal_uInt64 const nOldPos(rInp.Tell()); - ReadObjkType(rInp, rGrup, false); - rInp.ReadUChar(rGrup.Flags); - for (int i = 0; i < 13; ++i) - { - rInp.ReadUChar(rGrup.Name[i]); - } - rInp.ReadUInt16(rGrup.SbLo); - rInp.ReadUInt16(rGrup.SbHi); - rInp.ReadUInt16(rGrup.UpLo); - rInp.ReadUInt16(rGrup.UpHi); - rInp.ReadUInt16(rGrup.ChartSize); - rInp.ReadUInt32(rGrup.ChartPtr); - assert(rInp.GetError() || rInp.Tell() == nOldPos + GrupSize); - (void) nOldPos; - return rInp; -} - -Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts) -{ - sal_uInt16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0; - sal_uInt8 nInt2=100-nInts; - switch(nFrb1 & 0x07) { - case 0: r1=0xFF; g1=0xFF; b1=0xFF; break; - case 1: r1=0xFF; g1=0xFF; break; - case 2: g1=0xFF; b1=0xFF; break; - case 3: g1=0xFF; break; - case 4: r1=0xFF; b1=0xFF; break; - case 5: r1=0xFF; break; - case 6: b1=0xFF; break; - case 7: break; - } - switch(nFrb2 & 0x07) { - case 0: r2=0xFF; g2=0xFF; b2=0xFF; break; - case 1: r2=0xFF; g2=0xFF; break; - case 2: g2=0xFF; b2=0xFF; break; - case 3: g2=0xFF; break; - case 4: r2=0xFF; b2=0xFF; break; - case 5: r2=0xFF; break; - case 6: b2=0xFF; break; - case 7: break; - } - r1=(sal_uInt16)((sal_uInt32)r1*nInts/100+(sal_uInt32)r2*nInt2/100); - g1=(sal_uInt16)((sal_uInt32)g1*nInts/100+(sal_uInt32)g2*nInt2/100); - b1=(sal_uInt16)((sal_uInt32)b1*nInts/100+(sal_uInt32)b2*nInt2/100); - Color aColor( (sal_uInt8)r1, (sal_uInt8)g1, (sal_uInt8)b1 ); - return aColor; -} - -void SetLine(ObjLineType& rLine, OutputDevice& rOut) -{ - if( 0 == ( rLine.LMuster & 0x07 ) ) - rOut.SetLineColor(); - else - rOut.SetLineColor( Sgv2SvFarbe(rLine.LFarbe,rLine.LBFarbe,rLine.LIntens) ); -} - -void SetArea(ObjAreaType& rArea, OutputDevice& rOut) -{ - if( 0 == ( rArea.FMuster & 0x00FF ) ) - rOut.SetFillColor(); - else - rOut.SetFillColor( Sgv2SvFarbe( rArea.FFarbe,rArea.FBFarbe,rArea.FIntens ) ); -} - -void ObjkType::Draw(OutputDevice&, UCHAR *) -{ -} - -void StrkType::Draw(OutputDevice& rOut, UCHAR *) -{ - SetLine(L,rOut); - rOut.DrawLine(Point(Pos1.x,Pos1.y),Point(Pos2.x,Pos2.y)); // !!! -} - -void SgfAreaColorIntens(sal_uInt16 Muster, sal_uInt8 Col1, sal_uInt8 Col2, sal_uInt8 Int, OutputDevice& rOut) -{ - ObjAreaType F; - F.FMuster=Muster; - F.FFarbe=Col2; - F.FBFarbe=Col1; - F.FIntens=Int; - SetArea(F,rOut); -} - -void DrawSlideRect(sal_Int16 x1, sal_Int16 y1, sal_Int16 x2, sal_Int16 y2, ObjAreaType& F, OutputDevice& rOut) -{ - sal_Int16 i,i0,b,b0; - sal_Int16 Int1,Int2; - sal_Int16 Col1,Col2; - // ClipMerk: HgdClipRec; - sal_Int16 cx,cy; - sal_Int16 MaxR; - sal_Int32 dx,dy; - - rOut.SetLineColor(); - if (x1>x2) { i=x1; x1=x2; x2=i; } - if (y1>y2) { i=y1; y1=y2; y2=i; } - Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87; - Int1=100-F.FIntens; Int2=F.FIntens; - if (Int1==Int2) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.DrawRect(tools::Rectangle(x1,y1,x2,y2)); - } else { - b0=Int1; - switch (F.FBFarbe & 0x38) { - case 0x08: { // vertikal - i0=y1; - i=y1; - while (i<=y2) { - b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1)); - if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.DrawRect(tools::Rectangle(x1,i0,x2,i-1)); - i0=i; b0=b; - } - i++; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.DrawRect(tools::Rectangle(x1,i0,x2,y2)); - } break; - case 0x28: { // horizontal - i0=x1; - i=x1; - while (i<=x2) { - b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1)); - if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.DrawRect(tools::Rectangle(i0,y1,i-1,y2)); - i0=i; b0=b; - } - i++; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.DrawRect(tools::Rectangle(i0,y1,x2,y2)); - } break; - - case 0x18: case 0x38: { // circle - vcl::Region ClipMerk=rOut.GetClipRegion(); - double a; - - rOut.SetClipRegion(vcl::Region(tools::Rectangle(x1,y1,x2,y2))); - cx=(x1+x2) /2; - cy=(y1+y2) /2; - dx=x2-x1+1; - dy=y2-y1+1; - a=sqrt((double)(dx*dx+dy*dy)); - MaxR=sal_Int16(a) /2 +1; - b0=Int2; - i0=MaxR; if (MaxR<1) MaxR=1; - i=MaxR; - while (i>=0) { - b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR)); - if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.DrawEllipse(tools::Rectangle(cx-i0,cy-i0,cx+i0,cy+i0)); - i0=i; b0=b; - } - i--; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut); - rOut.DrawEllipse(tools::Rectangle(cx-i0,cy-i0,cx+i0,cy+i0)); - rOut.SetClipRegion(ClipMerk); - } break; // circle - } - } -} - -void RectType::Draw(OutputDevice& rOut, UCHAR *) -{ - if (L.LMuster!=0) L.LMuster=1; // no line separator here, only on or off - SetArea(F,rOut); - if (RotationAngle==0) { - if ((F.FBFarbe & 0x38)==0 || Radius!=0) { - SetLine(L,rOut); - rOut.DrawRect(tools::Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y),Radius,Radius); - } else { - DrawSlideRect(Pos1.x,Pos1.y,Pos2.x,Pos2.y,F,rOut); - if (L.LMuster!=0) { - SetLine(L,rOut); - rOut.SetFillColor(); - rOut.DrawRect(tools::Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y)); - } - } - } else { - Point aPts[4]; - sal_uInt16 i; - double sn,cs; - sn=sin(double(RotationAngle)*3.14159265359/18000); - cs=cos(double(RotationAngle)*3.14159265359/18000); - aPts[0]=Point(Pos1.x,Pos1.y); - aPts[1]=Point(Pos2.x,Pos1.y); - aPts[2]=Point(Pos2.x,Pos2.y); - aPts[3]=Point(Pos1.x,Pos2.y); - for (i=0;i<4;i++) { - RotatePoint(aPts[i],Pos1.x,Pos1.y,sn,cs); - } - SetLine(L,rOut); - tools::Polygon aPoly(4,aPts); - rOut.DrawPolygon(aPoly); - } -} - -void PolyType::Draw(OutputDevice& rOut, UCHAR *) -{ - if ((Flags & PolyClosBit) !=0) SetArea(F,rOut); - SetLine(L,rOut); - tools::Polygon aPoly(nPoints); - sal_uInt16 i; - for(i=0;i<nPoints;i++) aPoly.SetPoint(Point(EckP[i].x,EckP[i].y),i); - if ((Flags & PolyClosBit) !=0) { - rOut.DrawPolygon(aPoly); - } else { - rOut.DrawPolyLine(aPoly); - } -} - -void SplnType::Draw(OutputDevice& rOut, UCHAR *) -{ - if ((Flags & PolyClosBit) !=0) SetArea(F,rOut); - SetLine(L,rOut); - tools::Polygon aPoly(0); - tools::Polygon aSpln(nPoints); - sal_uInt16 i; - for(i=0;i<nPoints;i++) aSpln.SetPoint(Point(EckP[i].x,EckP[i].y),i); - if ((Flags & PolyClosBit) !=0) { - Spline2Poly(aSpln,true,aPoly); - if (aPoly.GetSize()>0) rOut.DrawPolygon(aPoly); - } else { - Spline2Poly(aSpln,false,aPoly); - if (aPoly.GetSize()>0) rOut.DrawPolyLine(aPoly); - } -} - -void DrawSlideCirc(sal_Int16 cx, sal_Int16 cy, sal_Int16 rx, sal_Int16 ry, ObjAreaType& F, OutputDevice& rOut) -{ - sal_Int16 x1=cx-rx; - sal_Int16 y1=cy-ry; - sal_Int16 x2=cx+rx; - sal_Int16 y2=cy+ry; - - sal_Int16 i,i0,b,b0; - sal_Int16 Int1,Int2; - sal_Int16 Col1,Col2; - - rOut.SetLineColor(); - Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87; - Int1=100-F.FIntens; Int2=F.FIntens; - if (Int1==Int2) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.DrawEllipse(tools::Rectangle(x1,y1,x2,y2)); - } else { - b0=Int1; - switch (F.FBFarbe & 0x38) { - case 0x08: { // vertical - vcl::Region ClipMerk=rOut.GetClipRegion(); - i0=y1; - i=y1; - while (i<=y2) { - b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1)); - if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.SetClipRegion(vcl::Region(tools::Rectangle(x1,i0,x2,i-1))); - rOut.DrawEllipse(tools::Rectangle(x1,y1,x2,y2)); - i0=i; b0=b; - } - i++; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.SetClipRegion(vcl::Region(tools::Rectangle(x1,i0,x2,y2))); - rOut.DrawEllipse(tools::Rectangle(x1,y1,x2,y2)); - rOut.SetClipRegion(ClipMerk); - } break; - case 0x28: { // horizontal - vcl::Region ClipMerk=rOut.GetClipRegion(); - i0=x1; - i=x1; - while (i<=x2) { - b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1)); - if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.SetClipRegion(vcl::Region(tools::Rectangle(i0,y1,i-1,y2))); - rOut.DrawEllipse(tools::Rectangle(x1,y1,x2,y2)); - i0=i; b0=b; - } - i++; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); - rOut.SetClipRegion(vcl::Region(tools::Rectangle(i0,y1,x2,y2))); - rOut.DrawEllipse(tools::Rectangle(x1,y1,x2,y2)); - rOut.SetClipRegion(ClipMerk); - } break; - - case 0x18: case 0x38: { // circle - sal_Int16 MaxR; - - if (rx<1) rx=1; - if (ry<1) ry=1; - MaxR=rx; - b0=Int2; - i0=MaxR; - i=MaxR; - while (i>=0) { - b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR)); - if (b!=b0) { - sal_Int32 temp=sal_Int32(i0)*sal_Int32(ry)/sal_Int32(rx); - sal_Int16 j0=sal_Int16(temp); - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); - rOut.DrawEllipse(tools::Rectangle(cx-i0,cy-j0,cx+i0,cy+j0)); - i0=i; b0=b; - } - i--; - } - SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut); - rOut.DrawEllipse(tools::Rectangle(cx-i0,cy-i0,cx+i0,cy+i0)); - } break; // circle - } - } -} - -void CircType::Draw(OutputDevice& rOut, UCHAR *) -{ - tools::Rectangle aRect(Center.x-Radius.x,Center.y-Radius.y,Center.x+Radius.x,Center.y+Radius.y); - - if (L.LMuster!=0) L.LMuster=1; // no line pattern here, only on or off - SetArea(F,rOut); - if ((Flags & 0x03)==CircFull) { - if ((F.FBFarbe & 0x38)==0) { - SetLine(L,rOut); - rOut.DrawEllipse(aRect); - } else { - DrawSlideCirc(Center.x,Center.y,Radius.x,Radius.y,F,rOut); - if (L.LMuster!=0) { - SetLine(L,rOut); - rOut.SetFillColor(); - rOut.DrawEllipse(aRect); - } - } - } else { - PointType a,b; - Point aStrt,aEnde; - double sn,cs; - - a.x=Center.x+Radius.x; a.y=Center.y; b=a; - sn=sin(double(StartAngle)*3.14159265359/18000); - cs=cos(double(StartAngle)*3.14159265359/18000); - RotatePoint(a,Center.x,Center.y,sn,cs); - sn=sin(double(StartAngle+RelAngle)*3.14159265359/18000); - cs=cos(double(StartAngle+RelAngle)*3.14159265359/18000); - RotatePoint(b,Center.x,Center.y,sn,cs); - if (Radius.x!=Radius.y) { - if (Radius.x<1) Radius.x=1; - if (Radius.y<1) Radius.y=1; - a.y = a.y - Center.y; - b.y = b.y - Center.y; - a.y=iMulDiv(a.y,Radius.y,Radius.x); - b.y=iMulDiv(b.y,Radius.y,Radius.x); - a.y = a.y + Center.y; - b.y = b.y + Center.y; - } - aStrt=Point(a.x,a.y); - aEnde=Point(b.x,b.y); - SetLine(L,rOut); - switch (Flags & 0x03) { - case CircArc : rOut.DrawArc(aRect,aEnde,aStrt); break; - case CircSect: - case CircAbsn: rOut.DrawPie(aRect,aEnde,aStrt); break; - } - } -} - -void BmapType::Draw(OutputDevice& rOut, UCHAR *) -{ - //ifstream aInp; - sal_uInt16 nVersion; - OUString aStr( - reinterpret_cast< char const * >(&Filename[ 1 ]), - (sal_Int32)Filename[ 0 ], RTL_TEXTENCODING_UTF8 ); - INetURLObject aFNam( aStr ); - - SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ); - if ( pInp ) - { - unsigned char nSgfTyp = CheckSgfTyp( *pInp,nVersion); - switch(nSgfTyp) { - case SGF_BITIMAGE: { - GraphicFilter aFlt; - Graphic aGrf; - aFlt.ImportGraphic(aGrf,aFNam); - aGrf.Draw(&rOut,Point(Pos1.x,Pos1.y),Size(Pos2.x-Pos1.x,Pos2.y-Pos1.y)); - } break; - case SGF_SIMPVECT: { - GDIMetaFile aMtf; - SgfVectXofs=Pos1.x; - SgfVectYofs=Pos1.y; - SgfVectXmul=Pos2.x-Pos1.x; - SgfVectYmul=Pos2.y-Pos1.y; - SgfVectXdiv=0; - SgfVectYdiv=0; - SgfVectScal=true; - SgfVectFilter(*pInp,aMtf); - SgfVectXofs=0; - SgfVectYofs=0; - SgfVectXmul=0; - SgfVectYmul=0; - SgfVectXdiv=0; - SgfVectYdiv=0; - SgfVectScal=false; - aMtf.Play(&rOut); - } break; - } - delete pInp; - } -} - -sal_uInt32 GrupType::GetSubPtr() -{ - return sal_uInt32(SbLo)+0x00010000*sal_uInt32(SbHi); -} - -void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) -{ - ObjkType aObjk; - sal_uInt16 nGrpCnt=0; - bool bEnd=false; - do { - ReadObjkType( rInp, aObjk ); - if (!rInp.GetError()) { - switch(aObjk.Art) { - case ObjStrk: { StrkType aStrk; ReadStrkType( rInp, aStrk ); if (!rInp.GetError()) aStrk.Draw(rOut, nullptr); } break; - case ObjRect: { RectType aRect; ReadRectType( rInp, aRect ); if (!rInp.GetError()) aRect.Draw(rOut, nullptr); } break; - case ObjCirc: { CircType aCirc; ReadCircType( rInp, aCirc ); if (!rInp.GetError()) aCirc.Draw(rOut, nullptr); } break; - case ObjText: { - TextType aText; - ReadTextType( rInp, aText ); - if (!rInp.GetError()) { - const size_t nRemainingSize = rInp.remainingSize(); - size_t nSize = aText.BufSize; - if (nSize > nRemainingSize) - { - SAL_WARN("vcl", "file is shorter than requested len"); - nSize = nRemainingSize; - } - std::vector<UCHAR> aBuffer(nSize+1); // add one for LookAhead at CK-separation - size_t nReadSize = rInp.ReadBytes(aBuffer.data(), nSize); - aBuffer[nReadSize] = 0; - if (!rInp.GetError() && nReadSize == aText.BufSize) - aText.Draw(rOut, aBuffer.data()); - } - } break; - case ObjBmap: { - BmapType aBmap; - ReadBmapType( rInp, aBmap ); - if (!rInp.GetError()) { - aBmap.Draw(rOut, nullptr); - } - } break; - case ObjPoly: { - PolyType aPoly; - ReadPolyType( rInp, aPoly ); - if (!rInp.GetError()) { - aPoly.EckP=new PointType[aPoly.nPoints]; - for (int i = 0; i < aPoly.nPoints; ++i) - { - rInp.ReadInt16(aPoly.EckP[i].x); - rInp.ReadInt16(aPoly.EckP[i].y); - } - if (!rInp.GetError()) aPoly.Draw(rOut, nullptr); - delete[] aPoly.EckP; - } - } break; - case ObjSpln: { - SplnType aSpln; - ReadSplnType( rInp, aSpln ); - if (!rInp.GetError()) { - aSpln.EckP=new PointType[aSpln.nPoints]; - for (int i = 0; i < aSpln.nPoints; ++i) - { - rInp.ReadInt16(aSpln.EckP[i].x); - rInp.ReadInt16(aSpln.EckP[i].y); - } - if (!rInp.GetError()) aSpln.Draw(rOut, nullptr); - delete[] aSpln.EckP; - } - } break; - case ObjGrup: { - GrupType aGrup; - ReadGrupType( rInp, aGrup ); - if (!rInp.GetError()) { - rInp.Seek(rInp.Tell()+aGrup.Last); // object appendix - if(aGrup.GetSubPtr()!=0) nGrpCnt++; // DrawObjkList(rInp,rOut ); - } - } break; - default: { - aObjk.Draw(rOut, nullptr); // object name on 2. Screen - ObjkOverSeek(rInp,aObjk); // to next object - } - } - } // if rInp - if (!rInp.GetError()) { - if (aObjk.Next==0) { - if (nGrpCnt==0) bEnd=true; - else nGrpCnt--; - } - } else { - bEnd=true; // read error - } - } while (!bEnd); -} - -void SkipObjkList(SvStream& rInp) -{ - ObjkType aObjk; - do - { - ReadObjkType( rInp, aObjk ); - if(aObjk.Art==ObjGrup) { - GrupType aGrup; - ReadGrupType( rInp, aGrup ); - rInp.Seek(rInp.Tell()+aGrup.Last); // object appendix - if(aGrup.GetSubPtr()!=0) SkipObjkList(rInp); - } else { - ObjkOverSeek(rInp,aObjk); // to next object - } - } while (aObjk.Next!=0 && !rInp.GetError()); -} - -bool SgfFilterSDrw( SvStream& rInp, GDIMetaFile& rMtf ) -{ - bool bRet = false; - PageType aPage; - ScopedVclPtrInstance< VirtualDevice > aOutDev; - OutputDevice* pOutDev; - sal_uLong nStdPos; - sal_uLong nCharPos; - sal_uInt16 Num; - - pOutDev=aOutDev.get(); - DtHdOverSeek(rInp); // read dataheader - - nStdPos=rInp.Tell(); - do { // read standard page - ReadPageType( rInp, aPage ); - if (aPage.nList!=0) SkipObjkList(rInp); - } while (aPage.Next!=0 && !rInp.GetError()); - - nCharPos=rInp.Tell(); - ReadPageType( rInp, aPage ); - - rMtf.Record(pOutDev); - Num=aPage.StdPg; - if (Num!=0) { - rInp.Seek(nStdPos); - while(Num>1 && aPage.Next!=0 && !rInp.GetError()) { // search standard page - ReadPageType( rInp, aPage ); - if (aPage.nList!=0) SkipObjkList(rInp); - Num--; - } - ReadPageType( rInp, aPage ); - if(Num==1 && aPage.nList!=0) DrawObjkList( rInp,*pOutDev ); - rInp.Seek(nCharPos); - ReadPageType( rInp, aPage ); - } - if (aPage.nList!=0) DrawObjkList(rInp,*pOutDev ); - - rMtf.Stop(); - rMtf.WindStart(); - MapMode aMap(MapUnit::Map10thMM,Point(),Fraction(1,4),Fraction(1,4)); - rMtf.SetPrefMapMode(aMap); - rMtf.SetPrefSize(Size(aPage.Paper.Size.x, aPage.Paper.Size.y)); - bRet=true; - return bRet; -} - -bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, const INetURLObject& _aIniPath ) -{ - sal_uLong nFileStart; // offset of SgfHeaders. In general 0. - SgfHeader aHead; - SgfEntry aEntr; - sal_uLong nNext; - bool bRet=false; // return value - - INetURLObject aIniPath = _aIniPath; - aIniPath.Append("sgf.ini"); - - pSgfFonts = new SgfFontLst; - - pSgfFonts->AssignFN( aIniPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - nFileStart=rInp.Tell(); - ReadSgfHeader( rInp, aHead ); - if (aHead.ChkMagic() && aHead.Typ==SgfStarDraw && aHead.Version==SGV_VERSION) { - nNext=aHead.GetOffset(); - while (nNext && !rInp.GetError()) { - rInp.Seek(nFileStart+nNext); - ReadSgfEntry( rInp, aEntr ); - nNext=aEntr.GetOffset(); - if (aEntr.Typ==aHead.Typ) { - bRet=SgfFilterSDrw( rInp,rMtf ); - } - } // while(nNext) - } - delete pSgfFonts; - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/sgvmain.hxx b/vcl/source/filter/sgvmain.hxx deleted file mode 100644 index 398674f7f814..000000000000 --- a/vcl/source/filter/sgvmain.hxx +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX -#define INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
