Kaydet (Commit) 630ec711 authored tarafından Bryan Quigley's avatar Bryan Quigley Kaydeden (comit) Noel Grandin

tdf#92925 Remove XPM export

XPM was used to create icons but isn't used much anymore.
Import supoort was tested and still works.

Change-Id: I50b15bc0938c114a432e93781a92e9db38810f49
Reviewed-on: https://gerrit.libreoffice.org/20341Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst a454a9b3
...@@ -784,7 +784,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f ...@@ -784,7 +784,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
draw_svm_Export \ draw_svm_Export \
draw_tif_Export \ draw_tif_Export \
draw_wmf_Export \ draw_wmf_Export \
draw_xpm_Export \
)) ))
# fcfg_impressgraphics # fcfg_impressgraphics
...@@ -829,7 +828,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic ...@@ -829,7 +828,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic
impress_svm_Export \ impress_svm_Export \
impress_tif_Export \ impress_tif_Export \
impress_wmf_Export \ impress_wmf_Export \
impress_xpm_Export \
)) ))
# fcfg_writergraphics # fcfg_writergraphics
...@@ -925,7 +923,6 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter ...@@ -925,7 +923,6 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter
wmf_Export \ wmf_Export \
wmf_Import \ wmf_Import \
xbm_Import \ xbm_Import \
xpm_Export \
xpm_Import \ xpm_Import \
mov_Import \ mov_Import \
)) ))
......
...@@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,gie,\ ...@@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,gie,\
$(eval $(call gb_Library_add_exception_objects,gie,\ $(eval $(call gb_Library_add_exception_objects,gie,\
filter/source/graphicfilter/egif/egif \ filter/source/graphicfilter/egif/egif \
filter/source/graphicfilter/expm/expm \
filter/source/graphicfilter/etiff/etiff \ filter/source/graphicfilter/etiff/etiff \
filter/source/graphicfilter/eos2met/eos2met \ filter/source/graphicfilter/eos2met/eos2met \
filter/source/graphicfilter/epbm/epbm \ filter/source/graphicfilter/epbm/epbm \
......
<!--
* 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_xpm_Export" oor:op="replace">
<prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</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">XPM - X PixMap</value>
</prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>xpm_XPM</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
</node>
<!--
* 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_xpm_Export" oor:op="replace">
<prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</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">XPM - X PixMap</value>
</prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>xpm_XPM</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
</node>
<!--
* 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="xpm_Export" oor:op="replace" >
<prop oor:name="Type"><value>xpm_XPM</value></prop>
<prop oor:name="FormatName"><value>exp</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">XPM - X PixMap</value>
</prop>
<prop oor:name="Flags"><value>EXPORT</value></prop>
</node>
/* -*- 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/graph.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/fltcall.hxx>
//============================ XPMWriter ==================================
class XPMWriter {
private:
SvStream& m_rOStm; // the output XPM file
bool mbStatus;
bool mbTrans;
BitmapReadAccess* mpAcc;
sal_uLong mnWidth, mnHeight; // size in Pixel
sal_uInt16 mnColors;
css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator;
void ImplCallback( sal_uInt16 nPercent );
bool ImplWriteHeader();
void ImplWritePalette();
void ImplWriteColor( sal_uInt16 );
void ImplWriteBody();
void ImplWriteNumber( sal_Int32 );
void ImplWritePixel( sal_uLong ) const;
public:
explicit XPMWriter(SvStream& rOStm);
~XPMWriter();
bool WriteXPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem );
};
//=================== Methoden von XPMWriter ==============================
XPMWriter::XPMWriter(SvStream& rOStm)
: m_rOStm(rOStm)
, mbStatus(true)
, mbTrans(false)
, mpAcc(nullptr)
, mnWidth(0)
, mnHeight(0)
, mnColors(0)
{
}
XPMWriter::~XPMWriter()
{
}
void XPMWriter::ImplCallback( sal_uInt16 nPercent )
{
if ( xStatusIndicator.is() )
{
if ( nPercent <= 100 )
xStatusIndicator->setValue( nPercent );
}
}
bool XPMWriter::WriteXPM( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem)
{
Bitmap aBmp;
if ( pFilterConfigItem )
{
xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
if ( xStatusIndicator.is() )
{
OUString aMsg;
xStatusIndicator->start( aMsg, 100 );
}
}
BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
aBmp = aBmpEx.GetBitmap();
if ( rGraphic.IsTransparent() ) // possibly create transparent color
{
mbTrans = true;
if ( aBmp.GetBitCount() >= 8 ) // if necessary convert image to 8 bit
aBmp.Convert( BMP_CONVERSION_8BIT_TRANS );
else
aBmp.Convert( BMP_CONVERSION_4BIT_TRANS );
aBmp.Replace( aBmpEx.GetMask(), BMP_COL_TRANS );
}
else
{
if ( aBmp.GetBitCount() > 8 ) // if necessary convert image to 8 bit
aBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
}
mpAcc = aBmp.AcquireReadAccess();
if ( mpAcc )
{
SvStreamEndian nOStmOldModus = m_rOStm.GetEndian();
m_rOStm.SetEndian( SvStreamEndian::BIG );
mnColors = mpAcc->GetPaletteEntryCount();
if ( ImplWriteHeader() )
{
ImplWritePalette();
ImplWriteBody();
m_rOStm.WriteCharPtr( "\x22XPMENDEXT\x22\x0a};" );
}
m_rOStm.SetEndian(nOStmOldModus);
Bitmap::ReleaseAccess( mpAcc );
}
else
mbStatus = false;
if ( xStatusIndicator.is() )
xStatusIndicator->end();
return mbStatus;
}
bool XPMWriter::ImplWriteHeader()
{
mnWidth = mpAcc->Width();
mnHeight = mpAcc->Height();
if ( mnWidth && mnHeight && mnColors )
{
m_rOStm.WriteCharPtr( "/* XPM */\x0astatic char * image[] = \x0a{\x0a\x22" );
ImplWriteNumber( mnWidth );
m_rOStm.WriteUChar( 32 );
ImplWriteNumber( mnHeight );
m_rOStm.WriteUChar( 32 );
ImplWriteNumber( mnColors );
m_rOStm.WriteUChar( 32 );
ImplWriteNumber( ( mnColors > 26 ) ? 2 : 1 );
m_rOStm.WriteCharPtr( "\x22,\x0a" );
}
else mbStatus = false;
return mbStatus;
}
void XPMWriter::ImplWritePalette()
{
sal_uInt16 nTransIndex = 0xffff;
if ( mbTrans )
nTransIndex = mpAcc->GetBestPaletteIndex( BMP_COL_TRANS );
for ( sal_uInt16 i = 0; i < mnColors; i++ )
{
m_rOStm.WriteCharPtr( "\x22" );
ImplWritePixel( i );
m_rOStm.WriteUChar( 32 );
if ( nTransIndex != i )
{
ImplWriteColor( i );
m_rOStm.WriteCharPtr( "\x22,\x0a" );
}
else
m_rOStm.WriteCharPtr( "c none\x22,\x0a" );
}
}
void XPMWriter::ImplWriteBody()
{
for ( sal_uLong y = 0; y < mnHeight; y++ )
{
ImplCallback( (sal_uInt16)( ( 100 * y ) / mnHeight ) ); // processing output in percent
m_rOStm.WriteUChar( 0x22 );
for ( sal_uLong x = 0; x < mnWidth; x++ )
{
ImplWritePixel( mpAcc->GetPixelIndex( y, x ) );
}
m_rOStm.WriteCharPtr( "\x22,\x0a" );
}
}
// write a decimal number in ascii format into the stream
void XPMWriter::ImplWriteNumber(sal_Int32 nNumber)
{
const OString aNum(OString::number(nNumber));
m_rOStm.WriteCharPtr( aNum.getStr() );
}
void XPMWriter::ImplWritePixel( sal_uLong nCol ) const
{
if ( mnColors > 26 )
{
sal_uInt8 nDiff = (sal_uInt8) ( nCol / 26 );
m_rOStm.WriteUChar( nDiff + 'A' );
m_rOStm.WriteUChar( nCol - ( nDiff*26 ) + 'A' );
}
else
m_rOStm.WriteUChar( nCol + 'A' );
}
// write a color value in hex format into the stream
void XPMWriter::ImplWriteColor( sal_uInt16 nNumber )
{
sal_uLong nTmp;
sal_uInt8 j;
m_rOStm.WriteCharPtr( "c #" ); // # indicates a following hex value
const BitmapColor& rColor = mpAcc->GetPaletteColor( nNumber );
nTmp = ( rColor.GetRed() << 16 ) | ( rColor.GetGreen() << 8 ) | rColor.GetBlue();
for ( signed char i = 20; i >= 0 ; i-=4 )
{
if ( ( j = (sal_uInt8)( nTmp >> i ) & 0xf ) > 9 )
j += 'A' - 10;
else
j += '0';
m_rOStm.WriteUChar( j );
}
}
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL
expGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem )
{
XPMWriter aXPMWriter(rStream);
return aXPMWriter.WriteXPM( rGraphic, pFilterConfigItem );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#define FORMAT_PGM 6 #define FORMAT_PGM 6
#define FORMAT_PPM 7 #define FORMAT_PPM 7
#define FORMAT_TIF 10 #define FORMAT_TIF 10
#define FORMAT_XPM 11
#define FORMAT_WMF 12 #define FORMAT_WMF 12
#define FORMAT_EMF 13 #define FORMAT_EMF 13
#define FORMAT_EPS 14 #define FORMAT_EPS 14
...@@ -89,8 +88,6 @@ static sal_Int16 GetFilterFormat(const OUString& rExt) ...@@ -89,8 +88,6 @@ static sal_Int16 GetFilterFormat(const OUString& rExt)
nFormat = FORMAT_PPM; nFormat = FORMAT_PPM;
else if ( rExt == "TIF" ) else if ( rExt == "TIF" )
nFormat = FORMAT_TIF; nFormat = FORMAT_TIF;
else if ( rExt == "XPM" )
nFormat = FORMAT_XPM;
else if ( rExt == "WMF" ) else if ( rExt == "WMF" )
nFormat = FORMAT_WMF; nFormat = FORMAT_WMF;
else if ( rExt == "EMF" ) else if ( rExt == "EMF" )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment