diff options
author | Bryan Quigley <gquigs@gmail.com> | 2015-12-02 16:01:13 -0500 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-12-04 08:15:38 +0000 |
commit | 2ac0bd278d739382d8e534f5bbae34e55757a844 (patch) | |
tree | bc54483cc90e54feda677a2f30dce7665c68f549 /filter | |
parent | 5c2f78cd15563389496979e50a38980b65b7f12b (diff) |
tdf#92925 Remove PBM, PGM, and PPM Export
Remove export for all the netpbm formats.
Import still works but these filetypes don't preserve good quality
anyway.
Change-Id: If4b47f749275a9d3d663f61872f448e01112f6b5
Reviewed-on: https://gerrit.libreoffice.org/20361
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'filter')
14 files changed, 0 insertions, 936 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index a2a3cd187017..ae1a8715a4dc 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -776,10 +776,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f draw_html_Export \ draw_jpg_Export \ draw_met_Export \ - draw_pbm_Export \ - draw_pgm_Export \ draw_png_Export \ - draw_ppm_Export \ draw_svg_Export \ draw_svm_Export \ draw_tif_Export \ @@ -820,10 +817,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic impress_html_Export \ impress_jpg_Export \ impress_met_Export \ - impress_pbm_Export \ - impress_pgm_Export \ impress_png_Export \ - impress_ppm_Export \ impress_svg_Export \ impress_svm_Export \ impress_tif_Export \ @@ -896,18 +890,15 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter jpg_Import \ met_Export \ met_Import \ - pbm_Export \ pbm_Import \ pcd_Import_Base \ pcd_Import_Base4 \ pcd_Import_Base16 \ pct_Import \ pcx_Import \ - pgm_Export \ pgm_Import \ png_Export \ png_Import \ - ppm_Export \ ppm_Import \ psd_Import \ ras_Import \ diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk index 1bbe38157880..e72efd6cddee 100644 --- a/filter/Library_gie.mk +++ b/filter/Library_gie.mk @@ -41,9 +41,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\ filter/source/graphicfilter/egif/egif \ filter/source/graphicfilter/etiff/etiff \ filter/source/graphicfilter/eos2met/eos2met \ - filter/source/graphicfilter/epbm/epbm \ - filter/source/graphicfilter/epgm/epgm \ - filter/source/graphicfilter/eppm/eppm \ filter/source/graphicfilter/eps/eps \ filter/source/graphicfilter/egif/giflzwc \ filter/source/graphicfilter/itiff/ccidecom \ diff --git a/filter/source/config/fragments/filters/draw_pbm_Export.xcu b/filter/source/config/fragments/filters/draw_pbm_Export.xcu deleted file mode 100644 index 582211b3c6bf..000000000000 --- a/filter/source/config/fragments/filters/draw_pbm_Export.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="draw_pbm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PBM - Portable Bitmap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>pbm_Portable_Bitmap</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/draw_pgm_Export.xcu b/filter/source/config/fragments/filters/draw_pgm_Export.xcu deleted file mode 100644 index 5fc5021f07c8..000000000000 --- a/filter/source/config/fragments/filters/draw_pgm_Export.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="draw_pgm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PGM - Portable Graymap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>pgm_Portable_Graymap</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/draw_ppm_Export.xcu b/filter/source/config/fragments/filters/draw_ppm_Export.xcu deleted file mode 100644 index 5b861b6c803e..000000000000 --- a/filter/source/config/fragments/filters/draw_ppm_Export.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="draw_ppm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PPM - Portable Pixelmap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>ppm_Portable_Pixelmap</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/impress_pbm_Export.xcu b/filter/source/config/fragments/filters/impress_pbm_Export.xcu deleted file mode 100644 index a28d261a8759..000000000000 --- a/filter/source/config/fragments/filters/impress_pbm_Export.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="impress_pbm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PBM - Portable Bitmap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop> - <prop oor:name="TemplateName"/> - <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> - </node> diff --git a/filter/source/config/fragments/filters/impress_pgm_Export.xcu b/filter/source/config/fragments/filters/impress_pgm_Export.xcu deleted file mode 100644 index c50a9ec717bb..000000000000 --- a/filter/source/config/fragments/filters/impress_pgm_Export.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="impress_pgm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PGM - Portable Graymap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop> - <prop oor:name="TemplateName"/> - <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> - </node> diff --git a/filter/source/config/fragments/filters/impress_ppm_Export.xcu b/filter/source/config/fragments/filters/impress_ppm_Export.xcu deleted file mode 100644 index afdf59e3fc01..000000000000 --- a/filter/source/config/fragments/filters/impress_ppm_Export.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="impress_ppm_Export" oor:op="replace"> - <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value></value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PPM - Portable Pixelmap</value> - </prop> - <prop oor:name="FileFormatVersion"><value>0</value></prop> - <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop> - <prop oor:name="TemplateName"/> - <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> - </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/pbm_Export.xcu deleted file mode 100644 index e0d3039d6b73..000000000000 --- a/filter/source/config/fragments/internalgraphicfilters/pbm_Export.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="pbm_Export" oor:op="replace" > - <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop> - <prop oor:name="FormatName"><value>epb</value></prop> - <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PBM - Portable Bitmap</value> - </prop> - <prop oor:name="Flags"><value>EXPORT</value></prop> - </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/pgm_Export.xcu deleted file mode 100644 index 1e4a6cedfc75..000000000000 --- a/filter/source/config/fragments/internalgraphicfilters/pgm_Export.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="pgm_Export" oor:op="replace" > - <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop> - <prop oor:name="FormatName"><value>epg</value></prop> - <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PGM - Portable Graymap</value> - </prop> - <prop oor:name="Flags"><value>EXPORT</value></prop> - </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/ppm_Export.xcu deleted file mode 100644 index 67e487e1bf9a..000000000000 --- a/filter/source/config/fragments/internalgraphicfilters/ppm_Export.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="ppm_Export" oor:op="replace" > - <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop> - <prop oor:name="FormatName"><value>epp</value></prop> - <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> - <prop oor:name="UIName"> - <value xml:lang="en-US">PPM - Portable Pixelmap</value> - </prop> - <prop oor:name="Flags"><value>EXPORT</value></prop> - </node> diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx deleted file mode 100644 index 90cc26ec6d2c..000000000000 --- a/filter/source/graphicfilter/epbm/epbm.cxx +++ /dev/null @@ -1,205 +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 <vcl/svapp.hxx> -#include <vcl/graph.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/msgbox.hxx> -#include <svl/solar.hrc> -#include <vcl/fltcall.hxx> -#include <vcl/FilterConfigItem.hxx> - -//============================ PBMWriter ================================== - -class PBMWriter { - -private: - - SvStream& m_rOStm; // the output PBM file - - bool mbStatus; - sal_Int32 mnMode; // 0 -> raw, 1-> ascii - BitmapReadAccess* mpAcc; - sal_uLong mnWidth, mnHeight; // size in pixel - - bool ImplWriteHeader(); - void ImplWriteBody(); - void ImplWriteNumber( sal_Int32 ); - - css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator; - -public: - explicit PBMWriter(SvStream &rPBM); - ~PBMWriter(); - - bool WritePBM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ); -}; - -//=================== Methods of PBMWriter ============================== - -PBMWriter::PBMWriter(SvStream &rPBM) - : m_rOStm(rPBM) - , mbStatus(true) - , mnMode(0) - , mpAcc(nullptr) - , mnWidth(0) - , mnHeight(0) -{ -} - - - -PBMWriter::~PBMWriter() -{ -} - - - -bool PBMWriter::WritePBM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - if ( pFilterConfigItem ) - { - mnMode = pFilterConfigItem->ReadInt32( "FileFormat", 0 ); - - xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - { - OUString aMsg; - xStatusIndicator->start( aMsg, 100 ); - } - } - - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - Bitmap aBmp = aBmpEx.GetBitmap(); - aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); - - SvStreamEndian aOStmOldModus = m_rOStm.GetEndian(); - m_rOStm.SetEndian( SvStreamEndian::BIG ); - - mpAcc = aBmp.AcquireReadAccess(); - if( mpAcc ) - { - if ( ImplWriteHeader() ) - ImplWriteBody(); - - Bitmap::ReleaseAccess( mpAcc ); - } - else - mbStatus = false; - - m_rOStm.SetEndian( aOStmOldModus ); - - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); - - return mbStatus; -} - - - -bool PBMWriter::ImplWriteHeader() -{ - mnWidth = mpAcc->Width(); - mnHeight = mpAcc->Height(); - if ( mnWidth && mnHeight ) - { - if ( mnMode == 0 ) - m_rOStm.WriteCharPtr( "P4\x0a" ); - else - m_rOStm.WriteCharPtr( "P1\x0a" ); - - ImplWriteNumber( mnWidth ); - m_rOStm.WriteUChar( 32 ); - ImplWriteNumber( mnHeight ); - m_rOStm.WriteUChar( 10 ); - } - else mbStatus = false; - return mbStatus; -} - - - -void PBMWriter::ImplWriteBody() -{ - if ( mnMode == 0 ) - { - sal_uInt8 nBYTE = 0; - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - sal_uLong x; - for ( x = 0; x < mnWidth; x++ ) - { - nBYTE <<= 1; - if (!(mpAcc->GetPixelIndex( y, x ) & 1 ) ) - nBYTE++; - if ( ( x & 7 ) == 7 ) - m_rOStm.WriteUChar( nBYTE ); - } - if ( ( x & 7 ) != 0 ) - m_rOStm.WriteUChar( nBYTE << ( ( x ^ 7 ) + 1 ) ); - } - } - else - { - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - int nxCount = 70; - for ( sal_uLong x = 0; x < mnWidth; x++ ) - { - if (!( --nxCount ) ) - { - nxCount = 69; - m_rOStm.WriteUChar( 10 ); - } - m_rOStm.WriteUChar( ( mpAcc->GetPixelIndex( y, x ) ^ 1 ) + '0' ) ; - } - m_rOStm.WriteUChar( 10 ); - } - } -} - - -// A decimal number in ascii format is written in the stream. - -void PBMWriter::ImplWriteNumber(sal_Int32 nNumber) -{ - const OString aNum(OString::number(nNumber)); - m_rOStm.WriteCharPtr( aNum.getStr() ); -} - - - - -// - exported function - - - - -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL -epbGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - PBMWriter aPBMWriter(rStream); - - return aPBMWriter.WritePBM( rGraphic, pFilterConfigItem ); -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx deleted file mode 100644 index 144ac025c1c7..000000000000 --- a/filter/source/graphicfilter/epgm/epgm.cxx +++ /dev/null @@ -1,224 +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 <vcl/svapp.hxx> -#include <vcl/graph.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/msgbox.hxx> -#include <svl/solar.hrc> -#include <vcl/fltcall.hxx> -#include <vcl/FilterConfigItem.hxx> - -//============================ PGMWriter ================================== - -class PGMWriter { - -private: - - SvStream& m_rOStm; // the output PGM file - - bool mbStatus; - sal_uInt32 mnMode; - BitmapReadAccess* mpAcc; - sal_uLong mnWidth, mnHeight; // image size in pixeln - - bool ImplWriteHeader(); - void ImplWriteBody(); - void ImplWriteNumber( sal_Int32 ); - - css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator; - -public: - explicit PGMWriter(SvStream &rStream); - ~PGMWriter(); - - bool WritePGM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ); -}; - -//=================== Methoden von PGMWriter ============================== -PGMWriter::PGMWriter(SvStream &rStream) - : m_rOStm(rStream) - , mbStatus(true) - , mnMode(0) - , mpAcc(nullptr) - , mnWidth(0) - , mnHeight(0) -{ -} - -PGMWriter::~PGMWriter() -{ -} - -bool PGMWriter::WritePGM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - if ( pFilterConfigItem ) - { - mnMode = pFilterConfigItem->ReadInt32( "FileFormat", 0 ); - - xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - { - OUString aMsg; - xStatusIndicator->start( aMsg, 100 ); - } - } - - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - Bitmap aBmp = aBmpEx.GetBitmap(); - aBmp.Convert( BMP_CONVERSION_8BIT_GREYS ); - - SvStreamEndian aOStmOldModus = m_rOStm.GetEndian(); - m_rOStm.SetEndian( SvStreamEndian::BIG ); - - mpAcc = aBmp.AcquireReadAccess(); - if( mpAcc ) - { - if ( ImplWriteHeader() ) - { - ImplWriteBody(); - } - Bitmap::ReleaseAccess( mpAcc ); - } - else - mbStatus = false; - - m_rOStm.SetEndian( aOStmOldModus ); - - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); - - return mbStatus; -} - - - -bool PGMWriter::ImplWriteHeader() -{ - mnWidth = mpAcc->Width(); - mnHeight = mpAcc->Height(); - if ( mnWidth && mnHeight ) - { - if ( mnMode == 0 ) - m_rOStm.WriteCharPtr( "P5\x0a" ); - else - m_rOStm.WriteCharPtr( "P2\x0a" ); - - ImplWriteNumber( mnWidth ); - m_rOStm.WriteUChar( 32 ); - ImplWriteNumber( mnHeight ); - m_rOStm.WriteUChar( 32 ); - ImplWriteNumber( 255 ); // max. gray value - m_rOStm.WriteUChar( 10 ); - } - else - mbStatus = false; - - return mbStatus; -} - - - -void PGMWriter::ImplWriteBody() -{ - if ( mnMode == 0 ) - { - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - for ( sal_uLong x = 0; x < mnWidth; x++ ) - { - m_rOStm.WriteUChar( mpAcc->GetPixelIndex( y, x ) ); - } - } - } - else - { - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - int nCount = 70; - for ( sal_uLong x = 0; x < mnWidth; x++ ) - { - sal_uInt8 nDat, nNumb; - if ( nCount < 0 ) - { - nCount = 69; - m_rOStm.WriteUChar( 10 ); - } - nDat = mpAcc->GetPixelIndex( y, x ); - nNumb = nDat / 100; - if ( nNumb ) - { - m_rOStm.WriteUChar( nNumb + '0' ); - nDat -= ( nNumb * 100 ); - nNumb = nDat / 10; - m_rOStm.WriteUChar( nNumb + '0' ); - nDat -= ( nNumb * 10 ); - m_rOStm.WriteUChar( nDat + '0' ); - nCount -= 4; - } - else - { - nNumb = nDat / 10; - if ( nNumb ) - { - m_rOStm.WriteUChar( nNumb + '0' ); - nDat -= ( nNumb * 10 ); - m_rOStm.WriteUChar( nDat + '0' ); - nCount -= 3; - } - else - { - m_rOStm.WriteUChar( nDat + '0' ); - nCount -= 2; - } - } - m_rOStm.WriteUChar( ' ' ); - } - m_rOStm.WriteUChar( 10 ); - } - } -} - - -// write a decimal number in ascii format into the stream -void PGMWriter::ImplWriteNumber(sal_Int32 nNumber) -{ - const OString aNum(OString::number(nNumber)); - m_rOStm.WriteCharPtr( aNum.getStr() ); -} - - - - -// - exported function - - - -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL -epgGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - PGMWriter aPGMWriter(rStream); - - return aPGMWriter.WritePGM( rGraphic, pFilterConfigItem ); -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx deleted file mode 100644 index 5e9cb90dc7ee..000000000000 --- a/filter/source/graphicfilter/eppm/eppm.cxx +++ /dev/null @@ -1,234 +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 <vcl/svapp.hxx> -#include <vcl/graph.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/msgbox.hxx> -#include <svl/solar.hrc> -#include <vcl/fltcall.hxx> -#include <vcl/FilterConfigItem.hxx> - -//============================ PPMWriter ================================== - -class PPMWriter { - -private: - - SvStream& m_rOStm; // Die auszugebende PPM-Datei - - bool mbStatus; - sal_Int32 mnMode; - BitmapReadAccess* mpAcc; - sal_uLong mnWidth, mnHeight; // Bildausmass in Pixeln - - bool ImplWriteHeader(); - void ImplWriteBody(); - void ImplWriteNumber( sal_Int32 ); - - css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator; - -public: - explicit PPMWriter(SvStream &rStrm); - ~PPMWriter(); - - bool WritePPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ); -}; - -//=================== Methods of PPMWriter ============================== -PPMWriter::PPMWriter(SvStream &rStrm) - : m_rOStm(rStrm) - , mbStatus(true) - , mnMode(0) - , mpAcc(nullptr) - , mnWidth(0) - , mnHeight(0) -{ -} - -PPMWriter::~PPMWriter() -{ -} - - - -bool PPMWriter::WritePPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - if ( pFilterConfigItem ) - { - mnMode = pFilterConfigItem->ReadInt32( "FileFormat", 0 ); - - xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - { - OUString aMsg; - xStatusIndicator->start( aMsg, 100 ); - } - } - - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - Bitmap aBmp = aBmpEx.GetBitmap(); - aBmp.Convert( BMP_CONVERSION_24BIT ); - - SvStreamEndian aOStmOldModus = m_rOStm.GetEndian(); - m_rOStm.SetEndian( SvStreamEndian::BIG ); - - mpAcc = aBmp.AcquireReadAccess(); - if( mpAcc ) - { - if ( ImplWriteHeader() ) - { - ImplWriteBody(); - } - Bitmap::ReleaseAccess( mpAcc ); - } - else - mbStatus = false; - - m_rOStm.SetEndian( aOStmOldModus ); - - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); - - return mbStatus; -} - - - -bool PPMWriter::ImplWriteHeader() -{ - mnWidth = mpAcc->Width(); - mnHeight = mpAcc->Height(); - if ( mnWidth && mnHeight ) - { - if ( mnMode == 0 ) - m_rOStm.WriteCharPtr( "P6\x0a" ); - else - m_rOStm.WriteCharPtr( "P3\x0a" ); - - ImplWriteNumber( mnWidth ); - m_rOStm.WriteUChar( 32 ); - ImplWriteNumber( mnHeight ); - m_rOStm.WriteUChar( 32 ); - ImplWriteNumber( 255 ); // max. col. - m_rOStm.WriteUChar( 10 ); - } - else - mbStatus = false; - - return mbStatus; -} - - - -void PPMWriter::ImplWriteBody() -{ - if ( mnMode == 0 ) - { - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - for ( sal_uLong x = 0; x < mnWidth; x++ ) - { - const BitmapColor& rColor = mpAcc->GetPixel( y, x ); - m_rOStm.WriteUChar( rColor.GetRed() ); - m_rOStm.WriteUChar( rColor.GetGreen() ); - m_rOStm.WriteUChar( rColor.GetBlue() ); - } - } - } - else - { - for ( sal_uLong y = 0; y < mnHeight; y++ ) - { - int nCount = 70; - for ( sal_uLong x = 0; x < mnWidth; x++ ) - { - sal_uInt8 i, nDat[3], nNumb; - if ( nCount < 0 ) - { - nCount = 69; - m_rOStm.WriteUChar( 10 ); - } - nDat[0] = mpAcc->GetPixel( y, x ).GetRed(); - nDat[1] = mpAcc->GetPixel( y, x ).GetGreen(); - nDat[2] = mpAcc->GetPixel( y, x ).GetBlue(); - for ( i = 0; i < 3; i++ ) - { - nNumb = nDat[ i ] / 100; - if ( nNumb ) - { - m_rOStm.WriteUChar( nNumb + '0' ); - nDat[ i ] -= ( nNumb * 100 ); - nNumb = nDat[ i ] / 10; - m_rOStm.WriteUChar( nNumb + '0' ); - nDat[ i ] -= ( nNumb * 10 ); - m_rOStm.WriteUChar( nDat[ i ] + '0' ); - nCount -= 4; - } - else - { - nNumb = nDat[ i ] / 10; - if ( nNumb ) - { - m_rOStm.WriteUChar( nNumb + '0' ); - nDat[ i ] -= ( nNumb * 10 ); - m_rOStm.WriteUChar( nDat[ i ] + '0' ); - nCount -= 3; - } - else - { - m_rOStm.WriteUChar( nDat[ i ] + '0' ); - nCount -= 2; - } - } - m_rOStm.WriteUChar( ' ' ); - } - } - m_rOStm.WriteUChar( 10 ); - } - } -} - - -// a decimal number in ASCII format is being written into the stream - -void PPMWriter::ImplWriteNumber(sal_Int32 nNumber) -{ - const OString aNum(OString::number(nNumber)); - m_rOStm.WriteCharPtr( aNum.getStr() ); -} - - - - -// - exported function - - - -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL -eppGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) -{ - PPMWriter aPPMWriter(rStream); - return aPPMWriter.WritePPM( rGraphic, pFilterConfigItem ); -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |