Move TIFF reader and writer from filter module into VCL
Moving graphicfilter one by one into VCL to get rid of filter_gio module and all the nonsense of dynamic/static library loading in "GraphicFilter". Change-Id: I21ebc0334ee07d36553a88557d33e01d9caec9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108822 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
f1a6d0602e
commit
94d34e53ac
@@ -1,38 +0,0 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,filter_tiff_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_external,filter_tiff_test,boost_headers))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,filter_tiff_test, \
|
||||
filter/qa/cppunit/filters-tiff-test \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,filter_tiff_test, \
|
||||
gie \
|
||||
sal \
|
||||
test \
|
||||
tl \
|
||||
unotest \
|
||||
vcl \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,filter_tiff_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,filter_tiff_test))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,filter_tiff_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_components,filter_tiff_test,\
|
||||
configmgr/source/configmgr \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,filter_tiff_test))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
@@ -50,12 +50,8 @@ $(eval $(call gb_Library_use_libraries,gie,\
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,gie,\
|
||||
filter/source/graphicfilter/egif/egif \
|
||||
filter/source/graphicfilter/etiff/etiff \
|
||||
filter/source/graphicfilter/eps/eps \
|
||||
filter/source/graphicfilter/egif/giflzwc \
|
||||
filter/source/graphicfilter/itiff/ccidecom \
|
||||
filter/source/graphicfilter/itiff/itiff \
|
||||
filter/source/graphicfilter/itiff/lzwdecom \
|
||||
filter/source/graphicfilter/ipict/ipict \
|
||||
filter/source/graphicfilter/ipict/shape \
|
||||
filter/source/graphicfilter/ipcx/ipcx \
|
||||
|
@@ -64,7 +64,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
|
||||
CppunitTest_filter_ppm_test \
|
||||
CppunitTest_filter_psd_test \
|
||||
CppunitTest_filter_ras_test \
|
||||
CppunitTest_filter_tiff_test \
|
||||
CppunitTest_filter_tga_test \
|
||||
CppunitTest_filter_svg \
|
||||
))
|
||||
|
@@ -17,7 +17,7 @@
|
||||
-->
|
||||
<node oor:name="tif_Export" oor:op="replace" >
|
||||
<prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
|
||||
<prop oor:name="FormatName"><value>eti</value></prop>
|
||||
<prop oor:name="FormatName"><value>SVTIFF</value></prop>
|
||||
<prop oor:name="RealFilterName"/>
|
||||
<prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
|
@@ -17,7 +17,7 @@
|
||||
-->
|
||||
<node oor:name="tif_Import" oor:op="replace" >
|
||||
<prop oor:name="Type"><value>tif_Tag_Image_File</value></prop>
|
||||
<prop oor:name="FormatName"><value>iti</value></prop>
|
||||
<prop oor:name="FormatName"><value>SVTIFF</value></prop>
|
||||
<prop oor:name="RealFilterName"><value>TIF - Tag Image File</value></prop>
|
||||
<prop oor:name="UIComponent"/>
|
||||
<prop oor:name="UIName">
|
||||
|
@@ -77,6 +77,7 @@ namespace o3tl
|
||||
#define IMP_XPM "SVIXPM"
|
||||
#define IMP_SVG "SVISVG"
|
||||
#define IMP_PDF "SVIPDF"
|
||||
#define IMP_TIFF "SVTIFF"
|
||||
#define EXP_BMP "SVBMP"
|
||||
#define EXP_SVMETAFILE "SVMETAFILE"
|
||||
#define EXP_WMF "SVWMF"
|
||||
@@ -85,6 +86,8 @@ namespace o3tl
|
||||
#define EXP_SVG "SVESVG"
|
||||
#define EXP_PDF "SVEPDF"
|
||||
#define EXP_PNG "SVEPNG"
|
||||
#define EXP_TIFF "SVTIFF"
|
||||
|
||||
|
||||
#define BMP_SHORTNAME u"BMP"
|
||||
#define GIF_SHORTNAME u"GIF"
|
||||
|
@@ -3900,7 +3900,6 @@ filter/qa/cppunit/filters-ppm-test.cxx
|
||||
filter/qa/cppunit/filters-psd-test.cxx
|
||||
filter/qa/cppunit/filters-ras-test.cxx
|
||||
filter/qa/cppunit/filters-tga-test.cxx
|
||||
filter/qa/cppunit/filters-tiff-test.cxx
|
||||
filter/qa/cppunit/msfilter-test.cxx
|
||||
filter/qa/cppunit/priority-test.cxx
|
||||
filter/qa/cppunit/xslt-test.cxx
|
||||
@@ -3931,7 +3930,6 @@ filter/source/graphicfilter/egif/egif.cxx
|
||||
filter/source/graphicfilter/egif/giflzwc.cxx
|
||||
filter/source/graphicfilter/egif/giflzwc.hxx
|
||||
filter/source/graphicfilter/eps/eps.cxx
|
||||
filter/source/graphicfilter/etiff/etiff.cxx
|
||||
filter/source/graphicfilter/icgm/actimpr.cxx
|
||||
filter/source/graphicfilter/icgm/bitmap.cxx
|
||||
filter/source/graphicfilter/icgm/bitmap.hxx
|
||||
@@ -3979,10 +3977,6 @@ filter/source/graphicfilter/ipict/shape.hxx
|
||||
filter/source/graphicfilter/ipsd/ipsd.cxx
|
||||
filter/source/graphicfilter/iras/iras.cxx
|
||||
filter/source/graphicfilter/itga/itga.cxx
|
||||
filter/source/graphicfilter/itiff/ccidecom.cxx
|
||||
filter/source/graphicfilter/itiff/ccidecom.hxx
|
||||
filter/source/graphicfilter/itiff/itiff.cxx
|
||||
filter/source/graphicfilter/itiff/lzwdecom.cxx
|
||||
filter/source/msfilter/countryid.cxx
|
||||
filter/source/msfilter/dffpropset.cxx
|
||||
filter/source/msfilter/escherex.cxx
|
||||
@@ -14938,12 +14932,17 @@ vcl/source/filter/FilterConfigCache.hxx
|
||||
vcl/source/filter/FilterConfigItem.cxx
|
||||
vcl/source/filter/graphicfilter.cxx
|
||||
vcl/source/filter/graphicfilter2.cxx
|
||||
vcl/source/filter/etiff/etiff.cxx
|
||||
vcl/source/filter/igif/decode.cxx
|
||||
vcl/source/filter/igif/decode.hxx
|
||||
vcl/source/filter/igif/gifread.cxx
|
||||
vcl/source/filter/ixbm/xbmread.cxx
|
||||
vcl/source/filter/ixpm/rgbtable.hxx
|
||||
vcl/source/filter/ixpm/xpmread.cxx
|
||||
vcl/source/filter/itiff/ccidecom.cxx
|
||||
vcl/source/filter/itiff/ccidecom.hxx
|
||||
vcl/source/filter/itiff/itiff.cxx
|
||||
vcl/source/filter/itiff/lzwdecom.cxx
|
||||
vcl/source/filter/jpeg/Exif.cxx
|
||||
vcl/source/filter/jpeg/Exif.hxx
|
||||
vcl/source/filter/jpeg/JpegReader.cxx
|
||||
|
@@ -11,6 +11,12 @@ $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
|
||||
vcl/qa/cppunit/graphicfilter/filters-test \
|
||||
vcl/qa/cppunit/graphicfilter/filters-tiff-test \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
|
||||
$$(INCLUDE) \
|
||||
-I$(SRCDIR)/vcl/inc \
|
||||
))
|
||||
|
||||
ifeq ($(DISABLE_CVE_TESTS),TRUE)
|
||||
|
@@ -423,6 +423,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
|
||||
vcl/source/components/dtranscomp \
|
||||
vcl/source/components/factory \
|
||||
vcl/source/components/fontident \
|
||||
vcl/source/filter/etiff/etiff \
|
||||
vcl/source/filter/FilterConfigCache \
|
||||
vcl/source/filter/FilterConfigItem \
|
||||
vcl/source/filter/graphicfilter \
|
||||
@@ -434,6 +435,9 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
|
||||
vcl/source/filter/igif/gifread \
|
||||
vcl/source/filter/ipdf/pdfread \
|
||||
vcl/source/filter/ipdf/pdfdocument \
|
||||
vcl/source/filter/itiff/ccidecom \
|
||||
vcl/source/filter/itiff/itiff \
|
||||
vcl/source/filter/itiff/lzwdecom \
|
||||
vcl/source/filter/ixbm/xbmread \
|
||||
vcl/source/filter/ixpm/xpmread \
|
||||
vcl/source/filter/jpeg/Exif \
|
||||
|
26
vcl/inc/filter/TiffReader.hxx
Normal file
26
vcl/inc/filter/TiffReader.hxx
Normal file
@@ -0,0 +1,26 @@
|
||||
/* -*- 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 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcl/graph.hxx>
|
||||
|
||||
VCL_DLLPUBLIC bool ImportTiffGraphicImport(SvStream& rStream, Graphic& rGraphic);
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
28
vcl/inc/filter/TiffWriter.hxx
Normal file
28
vcl/inc/filter/TiffWriter.hxx
Normal file
@@ -0,0 +1,28 @@
|
||||
/* -*- 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 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/FilterConfigItem.hxx>
|
||||
|
||||
VCL_DLLPUBLIC bool ExportTiffGraphicImport(SvStream& rStream, Graphic& rGraphic,
|
||||
FilterConfigItem* pFilterConfigItem);
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -256,7 +256,7 @@ void GraphicTest::testUnloadedGraphic()
|
||||
|
||||
void GraphicTest::testUnloadedGraphicLoading()
|
||||
{
|
||||
const OUString aFormats[] = { "png", "gif", "jpg" };
|
||||
const OUString aFormats[] = { "png", "gif", "jpg", "tif" };
|
||||
|
||||
for (OUString const& sFormat : aFormats)
|
||||
{
|
||||
|
@@ -13,32 +13,29 @@
|
||||
#include <tools/stream.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/graphicfilter.hxx>
|
||||
#include <bitmap/BitmapWriteAccess.hxx>
|
||||
#include <graphic/GraphicFormatDetector.hxx>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
SAL_DLLPUBLIC_EXPORT bool SAL_CALL
|
||||
itiGraphicImport(SvStream & rStream, Graphic & rGraphic,
|
||||
FilterConfigItem*);
|
||||
}
|
||||
#include <filter/TiffReader.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
/* Implementation of Filters test */
|
||||
|
||||
class TiffFilterTest
|
||||
: public test::FiltersTest
|
||||
, public test::BootstrapFixture
|
||||
class TiffFilterTest : public test::FiltersTest, public test::BootstrapFixture
|
||||
{
|
||||
public:
|
||||
TiffFilterTest() : BootstrapFixture(true, false) {}
|
||||
TiffFilterTest()
|
||||
: BootstrapFixture(true, false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool load(const OUString &,
|
||||
const OUString &rURL, const OUString &,
|
||||
SfxFilterFlags, SotClipboardFormatId, unsigned int) override;
|
||||
virtual bool load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags,
|
||||
SotClipboardFormatId, unsigned int) override;
|
||||
|
||||
OUString getUrl()
|
||||
{
|
||||
return m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/tiff/");
|
||||
return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/tiff/");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,29 +45,26 @@ public:
|
||||
void testTdf126460();
|
||||
void testTdf115863();
|
||||
void testTdf138818();
|
||||
void testRoundtrip();
|
||||
|
||||
CPPUNIT_TEST_SUITE(TiffFilterTest);
|
||||
CPPUNIT_TEST(testCVEs);
|
||||
CPPUNIT_TEST(testTdf126460);
|
||||
CPPUNIT_TEST(testTdf115863);
|
||||
CPPUNIT_TEST(testTdf138818);
|
||||
CPPUNIT_TEST(testRoundtrip);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
|
||||
bool TiffFilterTest::load(const OUString &,
|
||||
const OUString &rURL, const OUString &,
|
||||
SfxFilterFlags, SotClipboardFormatId, unsigned int)
|
||||
bool TiffFilterTest::load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags,
|
||||
SotClipboardFormatId, unsigned int)
|
||||
{
|
||||
SvFileStream aFileStream(rURL, StreamMode::READ);
|
||||
Graphic aGraphic;
|
||||
return itiGraphicImport(aFileStream, aGraphic, nullptr);
|
||||
return ImportTiffGraphicImport(aFileStream, aGraphic);
|
||||
}
|
||||
|
||||
void TiffFilterTest::testCVEs()
|
||||
{
|
||||
testDir(OUString(),
|
||||
getUrl());
|
||||
}
|
||||
void TiffFilterTest::testCVEs() { testDir(OUString(), getUrl()); }
|
||||
|
||||
void TiffFilterTest::testTdf126460()
|
||||
{
|
||||
@@ -106,7 +100,6 @@ void TiffFilterTest::testTdf115863()
|
||||
Size aSize = aBitmap.GetSizePixel();
|
||||
CPPUNIT_ASSERT_EQUAL(tools::Long(528), aSize.Width());
|
||||
CPPUNIT_ASSERT_EQUAL(tools::Long(618), aSize.Height());
|
||||
|
||||
}
|
||||
|
||||
void TiffFilterTest::testTdf138818()
|
||||
@@ -124,11 +117,48 @@ void TiffFilterTest::testTdf138818()
|
||||
// - Expected: 46428
|
||||
// - Actual : 45951
|
||||
CPPUNIT_ASSERT_EQUAL(sal_uInt32(46428), aGraphic.GetGfxLink().GetDataSize());
|
||||
}
|
||||
|
||||
void TiffFilterTest::testRoundtrip()
|
||||
{
|
||||
Bitmap aBitmap(Size(2, 2), 24);
|
||||
{
|
||||
BitmapScopedWriteAccess pAccess(aBitmap);
|
||||
pAccess->SetPixel(0, 0, COL_WHITE);
|
||||
pAccess->SetPixel(0, 1, COL_BLACK);
|
||||
pAccess->SetPixel(1, 0, COL_LIGHTRED);
|
||||
pAccess->SetPixel(1, 1, COL_LIGHTGREEN);
|
||||
}
|
||||
|
||||
SvMemoryStream aStream;
|
||||
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
|
||||
sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(u"tif");
|
||||
rFilter.ExportGraphic(Graphic(BitmapEx(aBitmap)), "none", aStream, nFilterFormat);
|
||||
aStream.Seek(STREAM_SEEK_TO_BEGIN);
|
||||
|
||||
Graphic aGraphic;
|
||||
ErrCode bResult = rFilter.ImportGraphic(aGraphic, "none", aStream);
|
||||
CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
|
||||
CPPUNIT_ASSERT_EQUAL(GfxLinkType::NativeTif, aGraphic.GetGfxLink().GetType());
|
||||
Bitmap aResultBitmap = aGraphic.GetBitmapEx().GetBitmap();
|
||||
CPPUNIT_ASSERT_EQUAL(Size(2, 2), aResultBitmap.GetSizePixel());
|
||||
|
||||
{
|
||||
Bitmap::ScopedReadAccess pAccess(aResultBitmap);
|
||||
CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0)));
|
||||
CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(pAccess->GetPixel(0, 1)));
|
||||
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(pAccess->GetPixel(1, 0)));
|
||||
CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, Color(pAccess->GetPixel(1, 1)));
|
||||
}
|
||||
|
||||
aStream.Seek(STREAM_SEEK_TO_BEGIN);
|
||||
vcl::GraphicFormatDetector aDetector(aStream, "");
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(true, aDetector.detect());
|
||||
CPPUNIT_ASSERT_EQUAL(true, aDetector.checkTIF());
|
||||
CPPUNIT_ASSERT_EQUAL(OUString(u"TIF"), aDetector.msDetectedFormat);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TiffFilterTest);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -41,8 +41,8 @@ using namespace ::com::sun::star::configuration ;
|
||||
|
||||
const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] =
|
||||
{
|
||||
IMP_BMP, IMP_GIF, IMP_PNG,IMP_JPEG, IMP_XBM, IMP_XPM,
|
||||
EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, nullptr
|
||||
IMP_BMP, IMP_GIF, IMP_PNG, IMP_JPEG, IMP_XBM, IMP_XPM,
|
||||
EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, IMP_TIFF, EXP_TIFF, nullptr
|
||||
};
|
||||
|
||||
const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
|
||||
@@ -54,7 +54,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
|
||||
const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
|
||||
{
|
||||
"egi", "icd", "ipd", "ipx", "ipb", "epb", "epg",
|
||||
"epp", "ira", "era", "itg", "iti", "eti", "exp", nullptr
|
||||
"epp", "ira", "era", "itg", "exp", nullptr
|
||||
};
|
||||
|
||||
void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
|
||||
@@ -244,8 +244,8 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
|
||||
"svm","1","SVMETAFILE",
|
||||
"svm","2","SVMETAFILE",
|
||||
"tga","1","itg",
|
||||
"tif","1","iti",
|
||||
"tif","2","eti",
|
||||
"tif","1","SVTIFF",
|
||||
"tif","2","SVTIFF",
|
||||
"emf","1","SVEMF",
|
||||
"emf","2","SVEMF",
|
||||
"wmf","1","SVWMF",
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <vcl/BitmapReadAccess.hxx>
|
||||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include <com/sun/star/task/XStatusIndicator.hpp>
|
||||
#include <filter/TiffWriter.hxx>
|
||||
|
||||
#define NewSubfileType 254
|
||||
#define ImageWidth 256
|
||||
@@ -576,9 +577,7 @@ void TIFFWriter::EndCompression()
|
||||
pTable.reset();
|
||||
}
|
||||
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT bool
|
||||
etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem )
|
||||
bool ExportTiffGraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem)
|
||||
{
|
||||
TIFFWriter aWriter(rStream);
|
||||
return aWriter.WriteTIFF( rGraphic, pFilterConfigItem );
|
@@ -47,6 +47,8 @@
|
||||
#include "jpeg/jpeg.hxx"
|
||||
#include "ixbm/xbmread.hxx"
|
||||
#include "ixpm/xpmread.hxx"
|
||||
#include <filter/TiffReader.hxx>
|
||||
#include <filter/TiffWriter.hxx>
|
||||
#include <osl/module.hxx>
|
||||
#include <com/sun/star/uno/Reference.h>
|
||||
#include <com/sun/star/awt/Size.hpp>
|
||||
@@ -676,8 +678,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
|
||||
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iraGraphicImport"));
|
||||
else if (maFormatName == "itg")
|
||||
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("itgGraphicImport"));
|
||||
else if (maFormatName == "iti")
|
||||
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("itiGraphicImport"));
|
||||
#else
|
||||
if (maFormatName == "icd")
|
||||
mpfnImport = icdGraphicImport;
|
||||
@@ -699,8 +699,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
|
||||
mpfnImport = iraGraphicImport;
|
||||
else if (maFormatName == "itg")
|
||||
mpfnImport = itgGraphicImport;
|
||||
else if (maFormatName == "iti")
|
||||
mpfnImport = itiGraphicImport;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1333,6 +1331,10 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
|
||||
{
|
||||
eLinkType = GfxLinkType::NativePdf;
|
||||
}
|
||||
else if (aFilterName == IMP_TIFF)
|
||||
{
|
||||
eLinkType = GfxLinkType::NativeTif;
|
||||
}
|
||||
else
|
||||
{
|
||||
nStatus = ERRCODE_GRFILTER_FILTERERROR;
|
||||
@@ -1366,9 +1368,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
|
||||
if (nFormat != GRFILTER_FORMAT_DONTKNOW)
|
||||
aShortName = GetImportFormatShortName(nFormat).toAsciiUpperCase();
|
||||
|
||||
if (aShortName.startsWith(TIF_SHORTNAME))
|
||||
eLinkType = GfxLinkType::NativeTif;
|
||||
else if( aShortName.startsWith(MET_SHORTNAME))
|
||||
if( aShortName.startsWith(MET_SHORTNAME))
|
||||
eLinkType = GfxLinkType::NativeMet;
|
||||
else if( aShortName.startsWith(PCT_SHORTNAME))
|
||||
eLinkType = GfxLinkType::NativePct;
|
||||
@@ -1433,7 +1433,7 @@ void GraphicFilter::preload()
|
||||
sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';');
|
||||
ImpFilterLibCache& rCache = Cache::get();
|
||||
static const std::initializer_list<std::u16string_view> aFilterNames = {
|
||||
u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira", u"itg", u"iti",
|
||||
u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira", u"itg",
|
||||
};
|
||||
|
||||
// Load library for each filter.
|
||||
@@ -1738,6 +1738,13 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
|
||||
else
|
||||
nStatus = ERRCODE_GRFILTER_FILTERERROR;
|
||||
}
|
||||
else if (aFilterName.equalsIgnoreAsciiCase(IMP_TIFF) )
|
||||
{
|
||||
if (!ImportTiffGraphicImport(rIStream, rGraphic))
|
||||
nStatus = ERRCODE_GRFILTER_FILTERERROR;
|
||||
else
|
||||
eLinkType = GfxLinkType::NativeTif;
|
||||
}
|
||||
else
|
||||
nStatus = ERRCODE_GRFILTER_FILTERERROR;
|
||||
}
|
||||
@@ -1863,7 +1870,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObje
|
||||
|
||||
extern "C" bool egiGraphicExport( 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 );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1956,6 +1962,14 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
|
||||
if( rOStm.GetError() )
|
||||
nStatus = ERRCODE_GRFILTER_IOERROR;
|
||||
}
|
||||
if (aFilterName.equalsIgnoreAsciiCase(EXP_TIFF))
|
||||
{
|
||||
if (!ExportTiffGraphicImport(rOStm, aGraphic, &aConfigItem))
|
||||
nStatus = ERRCODE_GRFILTER_FORMATERROR;
|
||||
|
||||
if( rOStm.GetError() )
|
||||
nStatus = ERRCODE_GRFILTER_IOERROR;
|
||||
}
|
||||
else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVMETAFILE ) )
|
||||
{
|
||||
sal_Int32 nVersion = aConfigItem.ReadInt32( "Version", 0 ) ;
|
||||
@@ -2185,8 +2199,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
|
||||
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("egiGraphicExport"));
|
||||
else if (aExternalFilterName == "eps")
|
||||
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("epsGraphicExport"));
|
||||
else if (aExternalFilterName == "eti")
|
||||
pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("etiGraphicExport"));
|
||||
// Execute dialog in DLL
|
||||
#else
|
||||
--nIdx; // Just one iteration
|
||||
@@ -2195,8 +2207,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
|
||||
pFunc = egiGraphicExport;
|
||||
else if (aExternalFilterName == "eps")
|
||||
pFunc = epsGraphicExport;
|
||||
else if (aExternalFilterName == "eti")
|
||||
pFunc = etiGraphicExport;
|
||||
#endif
|
||||
if( pFunc )
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include "lzwdecom.hxx"
|
||||
#include "ccidecom.hxx"
|
||||
|
||||
#include <filter/TiffReader.hxx>
|
||||
|
||||
namespace {
|
||||
|
||||
template< typename T > T BYTESWAP(T nByte) {
|
||||
@@ -1710,11 +1712,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//================== GraphicImport - the exported function ================
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT bool
|
||||
itiGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
|
||||
bool ImportTiffGraphicImport(SvStream & rStream, Graphic & rGraphic)
|
||||
{
|
||||
TIFFReader aTIFFReader;
|
||||
try
|
Reference in New Issue
Block a user