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>
This commit is contained in:
Bryan Quigley
2015-12-02 16:01:13 -05:00
committed by Noel Grandin
parent 5c2f78cd15
commit 2ac0bd278d
17 changed files with 0 additions and 985 deletions

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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: */

View File

@@ -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: */

View File

@@ -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: */

View File

@@ -48,9 +48,6 @@
#define FORMAT_PNG 2
#define FORMAT_BMP 3
#define FORMAT_GIF 4
#define FORMAT_PBM 5
#define FORMAT_PGM 6
#define FORMAT_PPM 7
#define FORMAT_TIF 10
#define FORMAT_WMF 12
#define FORMAT_EMF 13
@@ -80,12 +77,6 @@ static sal_Int16 GetFilterFormat(const OUString& rExt)
nFormat = FORMAT_BMP;
else if ( rExt == "GIF" )
nFormat = FORMAT_GIF;
else if ( rExt == "PBM" )
nFormat = FORMAT_PBM;
else if ( rExt == "PGM" )
nFormat = FORMAT_PGM;
else if ( rExt == "PPM" )
nFormat = FORMAT_PPM;
else if ( rExt == "TIF" )
nFormat = FORMAT_TIF;
else if ( rExt == "WMF" )
@@ -278,17 +269,6 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateC
}
break;
case FORMAT_PBM :
case FORMAT_PGM :
case FORMAT_PPM :
{
sal_Int32 nFormat = 0;
if ( mpRbText->IsChecked() )
nFormat++;
pFilterOptions->WriteInt32("FileFormat", nFormat);
}
break;
case FORMAT_EPS :
{
sal_Int32 nCheck = 0;
@@ -815,17 +795,6 @@ void ExportDialog::createFilterOptions()
mpCbSaveTransparency->Check(mpFilterOptionsItem->ReadInt32("Translucent", 1) != 0);
}
break;
case FORMAT_PBM :
case FORMAT_PGM :
case FORMAT_PPM :
{
// RB Binary / Text
mpEncoding->Show();
sal_Int32 nFormat = mpFilterOptionsItem->ReadInt32("FileFormat", 1);
mpRbBinary->Check( nFormat == 0 );
mpRbText->Check( nFormat != 0 );
}
break;
case FORMAT_EPS :
{
mpEPSGrid->Show();

View File

@@ -247,11 +247,8 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
"psd","1","ipd",
"pcx","1","ipx",
"pbm","1","ipb",
"pbm","2","epb",
"pgm","1","ipb",
"pgm","2","epg",
"ppm","1","ipb",
"ppm","2","epp",
"ras","1","ira",
"ras","2","era",
"svm","1","SVMETAFILE",

View File

@@ -1824,9 +1824,6 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLO
extern "C" bool egiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool emeGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool epbGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool epgGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool eppGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool epsGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
@@ -2120,12 +2117,6 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("egiGraphicExport"));
else if (tmpFilterName == "eme")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("emeGraphicExport"));
else if (tmpFilterName == "epb")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("epbGraphicExport"));
else if (tmpFilterName == "epg")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("epgGraphicExport"));
else if (tmpFilterName == "epp")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("eppGraphicExport"));
else if (tmpFilterName == "eps")
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("epsGraphicExport"));
else if (tmpFilterName == "eti")
@@ -2137,12 +2128,6 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
pFunc = egiGraphicExport;
else if (aFilterName == "eme")
pFunc = emeGraphicExport;
else if (aFilterName == "epb")
pFunc = epbGraphicExport;
else if (aFilterName == "epg")
pFunc = epgGraphicExport;
else if (aFilterName == "epp")
pFunc = eppGraphicExport;
else if (aFilterName == "eps")
pFunc = epsGraphicExport;
else if (aFilterName == "eti")