diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-01-02 22:07:41 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-03-04 15:29:05 +0100 |
commit | 95951c4b9d83952b6b8f8c0969b801d70091cb52 (patch) | |
tree | 3d921c19044e6521f0a8898bfe61c2c2d3e93596 /vcl | |
parent | 1d830d9f26d69ee6c2ed839c5b2c5d54fb797055 (diff) |
Make LO buildable again after the GraphicFilter move.
Conflicts:
cui/source/dialogs/SpellDialog.cxx
editeng/source/items/frmitems.cxx
filter/qa/cppunit/filters-pict-test.cxx
sd/source/filter/grf/sdgrffilter.cxx
sd/source/ui/app/sddll.cxx
svgio/source/svgreader/svgimagenode.cxx
svtools/Library_svt.mk
svtools/Module_svtools.mk
svtools/Package_inc.mk
svtools/source/filter/exportdialog.cxx
svx/source/core/graphichelper.cxx
svx/source/dialog/compressgraphicdialog.cxx
sw/source/ui/shells/grfshex.cxx
sw/source/ui/uiview/view2.cxx
sw/source/ui/utlui/glbltree.cxx
test/source/bootstrapfixture.cxx
tubes/source/contacts.cxx
vcl/Library_vcl.mk
vcl/qa/cppunit/graphicfilter/filters-test.cxx
vcl/source/filter/FilterConfigCache.cxx
vcl/source/filter/graphicfilter.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx
Change-Id: I3455a7294b136400f32163626d5a7a7f2bfa898c
Diffstat (limited to 'vcl')
21 files changed, 250 insertions, 273 deletions
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk index f2669fbb1fbf..0908c71ef980 100644 --- a/vcl/CppunitTest_vcl_filters_test.mk +++ b/vcl/CppunitTest_vcl_filters_test.mk @@ -25,13 +25,19 @@ # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable # instead of those above. -$(eval $(call gb_CppunitTest_CppunitTest,svtools_filters_test)) +$(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test)) -$(eval $(call gb_CppunitTest_add_exception_objects,svtools_filters_test, \ - svtools/qa/cppunit/filters-test \ +$(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \ + vcl/qa/cppunit/graphicfilter/filters-test \ )) -$(eval $(call gb_CppunitTest_use_libraries,svtools_filters_test, \ +ifeq ($(DISABLE_CVE_TESTS),TRUE) +$(eval $(call gb_CppunitTest_add_defs,vcl_filters_test,\ + -DDISABLE_CVE_TESTS \ +)) +endif + +$(eval $(call gb_CppunitTest_use_libraries,vcl_filters_test, \ comphelper \ cppu \ cppuhelper \ @@ -44,17 +50,17 @@ $(eval $(call gb_CppunitTest_use_libraries,svtools_filters_test, \ $(gb_STDLIBS) \ )) -$(eval $(call gb_CppunitTest_use_api,svtools_filters_test,\ +$(eval $(call gb_CppunitTest_use_api,vcl_filters_test,\ udkapi \ offapi \ )) -$(eval $(call gb_CppunitTest_use_ure,svtools_filters_test)) +$(eval $(call gb_CppunitTest_use_ure,vcl_filters_test)) -$(eval $(call gb_CppunitTest_use_components,svtools_filters_test,\ +$(eval $(call gb_CppunitTest_use_components,vcl_filters_test,\ configmgr/source/configmgr \ )) -$(eval $(call gb_CppunitTest_use_configuration,svtools_filters_test)) +$(eval $(call gb_CppunitTest_use_configuration,vcl_filters_test)) # vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 53f9d4ae807f..e10df96f9834 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -70,6 +70,10 @@ $(eval $(call gb_Library_use_api,vcl,\ udkapi \ )) +$(eval $(call gb_Library_use_externals,vcl,\ + jpeg \ +)) + $(eval $(call gb_Library_use_libraries,vcl,\ tl \ utl \ @@ -148,6 +152,25 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/spinfld \ vcl/source/control/tabctrl \ vcl/source/control/throbber \ + vcl/source/filter/FilterConfigCache \ + vcl/source/filter/FilterConfigItem \ + vcl/source/filter/graphicfilter \ + vcl/source/filter/graphicfilter2 \ + vcl/source/filter/sgfbram \ + vcl/source/filter/sgvmain \ + vcl/source/filter/sgvspln \ + vcl/source/filter/sgvtext \ + vcl/source/filter/igif/decode \ + vcl/source/filter/igif/gifread \ + vcl/source/filter/ixbm/xbmread \ + vcl/source/filter/ixpm/xpmread \ + vcl/source/filter/jpeg/jpeg \ + vcl/source/filter/wmf/emfwr \ + vcl/source/filter/wmf/enhwmf \ + vcl/source/filter/wmf/winmtf \ + vcl/source/filter/wmf/winwmf \ + vcl/source/filter/wmf/wmf \ + vcl/source/filter/wmf/wmfwr \ vcl/source/fontsubset/cff \ vcl/source/fontsubset/fontsubset \ vcl/source/fontsubset/gsub \ @@ -277,6 +300,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/wrkwin \ )) +$(eval $(call gb_Library_add_cobjects,vcl,\ + vcl/source/filter/jpeg/jpegc \ +)) + # optional parts ## handle Graphite diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 8789813084f5..cc57850552e1 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -89,4 +89,8 @@ $(eval $(call gb_Module_add_targets,vcl,\ )) endif +$(eval $(call gb_Module_add_check_targets,vcl,\ + CppunitTest_vcl_filters_test \ +)) + # vim: set noet sw=4 ts=4: diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk index 18d6ff98d2ff..fddd6ebc387c 100644 --- a/vcl/Package_inc.mk +++ b/vcl/Package_inc.mk @@ -27,6 +27,7 @@ #************************************************************************* $(eval $(call gb_Package_Package,vcl_inc,$(SRCDIR)/vcl/inc)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/FilterConfigItem.hxx,vcl/FilterConfigItem.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/abstdlg.hxx,vcl/abstdlg.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/accel.hxx,vcl/accel.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/alpha.hxx,vcl/alpha.hxx)) @@ -73,6 +74,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/gfxlink.hxx,vcl/gfxlink.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/gradient.hxx,vcl/gradient.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/graph.h,vcl/graph.h)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/graph.hxx,vcl/graph.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/graphicfilter.hxx,vcl/graphicfilter.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/graphictools.hxx,vcl/graphictools.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/group.hxx,vcl/group.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/hatch.hxx,vcl/hatch.hxx)) @@ -167,6 +169,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/virdev.hxx,vcl/virdev.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/waitobj.hxx,vcl/waitobj.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/wall.hxx,vcl/wall.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/window.hxx,vcl/window.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/wmf.hxx,vcl/wmf.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/wrkwin.hxx,vcl/wrkwin.hxx)) # vim: set noet sw=4 ts=4: diff --git a/vcl/inc/vcl/FilterConfigItem.hxx b/vcl/inc/vcl/FilterConfigItem.hxx index ea235a3a518b..3d800d56ba09 100644 --- a/vcl/inc/vcl/FilterConfigItem.hxx +++ b/vcl/inc/vcl/FilterConfigItem.hxx @@ -30,7 +30,8 @@ #ifndef _FILTER_CONFIG_ITEM_HXX_ #define _FILTER_CONFIG_ITEM_HXX_ -#include "svtools/svtdllapi.h" +#include <vcl/dllapi.h> + #include <tools/string.hxx> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/uno/Any.h> @@ -40,54 +41,54 @@ #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> -class SVT_DLLPUBLIC FilterConfigItem +class VCL_DLLPUBLIC FilterConfigItem { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xUpdatableView; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet; - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFilterData; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xUpdatableView; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFilterData; - sal_Bool bModified; + sal_Bool bModified; - SVT_DLLPRIVATE sal_Bool ImplGetPropertyValue( ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet, - const ::rtl::OUString& rPropName, - sal_Bool bTestPropertyAvailability ); + sal_Bool ImplGetPropertyValue( ::com::sun::star::uno::Any& rAny, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet, + const rtl::OUString& rPropName, + sal_Bool bTestPropertyAvailability ); - SVT_DLLPRIVATE void ImpInitTree( const String& rTree ); + void ImpInitTree( const String& rTree ); - SVT_DLLPRIVATE static ::com::sun::star::beans::PropertyValue* GetPropertyValue( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, - const ::rtl::OUString& rName ); - SVT_DLLPRIVATE static sal_Bool WritePropertyValue( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, - const ::com::sun::star::beans::PropertyValue& rPropValue ); + static ::com::sun::star::beans::PropertyValue* GetPropertyValue( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, + const rtl::OUString& rName ); + static sal_Bool WritePropertyValue( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rPropSeq, + const ::com::sun::star::beans::PropertyValue& rPropValue ); - public : +public : - FilterConfigItem( const ::rtl::OUString& rSubTree ); - FilterConfigItem( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); - FilterConfigItem( const ::rtl::OUString& rSubTree, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); - ~FilterConfigItem(); + FilterConfigItem( const rtl::OUString& rSubTree ); + FilterConfigItem( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); + FilterConfigItem( const rtl::OUString& rSubTree, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); + ~FilterConfigItem(); - // all read methods are trying to return values in following order: - // 1. FilterData PropertySequence - // 2. configuration - // 3. given default - sal_Bool ReadBool( const ::rtl::OUString& rKey, sal_Bool bDefault ); - sal_Int32 ReadInt32( const ::rtl::OUString& rKey, sal_Int32 nDefault ); - ::rtl::OUString - ReadString( const ::rtl::OUString& rKey, const ::rtl::OUString& rDefault ); + // all read methods are trying to return values in following order: + // 1. FilterData PropertySequence + // 2. configuration + // 3. given default + sal_Bool ReadBool( const rtl::OUString& rKey, sal_Bool bDefault ); + sal_Int32 ReadInt32( const rtl::OUString& rKey, sal_Int32 nDefault ); + rtl::OUString + ReadString( const rtl::OUString& rKey, const rtl::OUString& rDefault ); - // try to store to configuration - // and always stores into the FilterData sequence - void WriteBool( const ::rtl::OUString& rKey, sal_Bool bValue ); - void WriteInt32( const ::rtl::OUString& rKey, sal_Int32 nValue ); + // try to store to configuration + // and always stores into the FilterData sequence + void WriteBool( const rtl::OUString& rKey, sal_Bool bValue ); + void WriteInt32( const rtl::OUString& rKey, sal_Int32 nValue ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetFilterData() const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetFilterData() const; - // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence - ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > GetStatusIndicator() const; + // GetStatusIndicator is returning the "StatusIndicator" property of the FilterData sequence + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > GetStatusIndicator() const; }; #endif // _FILTER_CONFIG_ITEM_HXX_ diff --git a/vcl/inc/vcl/graphicfilter.hxx b/vcl/inc/vcl/graphicfilter.hxx index 526ef933753d..921408b26fb1 100644 --- a/vcl/inc/vcl/graphicfilter.hxx +++ b/vcl/inc/vcl/graphicfilter.hxx @@ -29,29 +29,19 @@ #ifndef _FILTER_HXX #define _FILTER_HXX -#include <svtools/fltcall.hxx> -#include "svtools/svtdllapi.h" -#include <tools/stream.hxx> -#include <vcl/graph.hxx> #include <tools/gen.hxx> +#include <tools/stream.hxx> #include <tools/urlobj.hxx> +#include <vcl/dllapi.h> #include <vcl/field.hxx> +#include <vcl/graph.hxx> + #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> +class FilterConfigCache; struct WMF_EXTERNALHEADER; -// ----------------------- -// - GraphicFilter-Types - -// ----------------------- - -struct ImplDirEntryHelper -{ - static sal_Bool Exists( const INetURLObject& rObj ); - static void Kill( const String& rStr ); -}; - -class Window; -class Graphic; +struct ConvertData; #define OPT_FILTERSECTION "Graphic" @@ -143,7 +133,7 @@ class Graphic; // - GraphicDescriptor - // --------------------- -class SVT_DLLPUBLIC GraphicDescriptor +class VCL_DLLPUBLIC GraphicDescriptor { SvStream* pFileStm; @@ -235,10 +225,7 @@ public: static String GetImportFormatShortName( sal_uInt16 nFormat ); }; -// ----------------- -// - GraphicFilter - -// ----------------- - +/** Information about errors during the GraphicFilter operation. */ struct FilterErrorEx { sal_uLong nFilterError; @@ -251,11 +238,8 @@ struct FilterErrorEx FilterErrorEx() : nFilterError( 0UL ), nStreamError( 0UL ) {} }; -// ----------------------------------------------------------------------------- - -struct ConvertData; -class FilterConfigCache; -class SVT_DLLPUBLIC GraphicFilter +/** Class to import and export graphic formats. */ +class VCL_DLLPUBLIC GraphicFilter { friend class SvFilterOptionsDialog; @@ -307,6 +291,7 @@ public: sal_uInt16 GetExportFormatNumber( const String& rFormatName ); sal_uInt16 GetExportFormatNumberForMediaType( const String& rShortName ); sal_uInt16 GetExportFormatNumberForShortName( const String& rShortName ); + String GetExportInternalFilterName( sal_uInt16 nFormat ); sal_uInt16 GetExportFormatNumberForTypeName( const String& rType ); String GetExportFormatName( sal_uInt16 nFormat ); String GetExportFormatTypeName( sal_uInt16 nFormat ); @@ -316,10 +301,6 @@ public: String GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry = 0 ); sal_Bool IsExportPixelFormat( sal_uInt16 nFormat ); - sal_Bool HasExportDialog( sal_uInt16 nFormat ); - sal_Bool DoExportDialog( Window* pWindow, sal_uInt16 nFormat ); - sal_Bool DoExportDialog( Window* pWindow, sal_uInt16 nFormat, FieldUnit eFieldUnit ); - sal_uInt16 ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath, sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL ); @@ -353,8 +334,6 @@ public: com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData, WMF_EXTERNALHEADER *pExtHeader = NULL ); - sal_Bool Setup( sal_uInt16 nFormat ); - void Abort() { bAbort = sal_True; } const FilterErrorEx& GetLastError() const; @@ -368,13 +347,6 @@ public: sal_uInt16* pDeterminedFormat = NULL ); }; -// ------------------------------------ -// - Windows Metafile Lesen/Schreiben - -// ------------------------------------ - -SVT_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); - #endif //_FILTER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/wmf.hxx b/vcl/inc/vcl/wmf.hxx index 986ccfb0d785..9bbdddb2908b 100644 --- a/vcl/inc/vcl/wmf.hxx +++ b/vcl/inc/vcl/wmf.hxx @@ -29,8 +29,11 @@ #ifndef _WMF_HXX #define _WMF_HXX -#include "svtools/svtdllapi.h" -#include <svtools/fltcall.hxx> +#include <vcl/dllapi.h> + +class FilterConfigItem; +class GDIMetaFile; +class SvStream; struct WMF_EXTERNALHEADER { @@ -63,13 +66,13 @@ struct WMF_EXTERNALHEADER sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem = NULL, WMF_EXTERNALHEADER *pExtHeader = NULL ); -SVT_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); +VCL_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); -SVT_DLLPUBLIC sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL, sal_Bool bPlaceable = sal_True ); +VCL_DLLPUBLIC sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL, sal_Bool bPlaceable = sal_True ); sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); +VCL_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); #endif diff --git a/vcl/qa/cppunit/graphicfilter/data/bmp/pass/CVE-2008-5870-1.bmp b/vcl/qa/cppunit/graphicfilter/data/bmp/pass/CVE-2008-5870-1.bmp deleted file mode 100644 index d223dde288b5..000000000000 --- a/vcl/qa/cppunit/graphicfilter/data/bmp/pass/CVE-2008-5870-1.bmp +++ /dev/null @@ -1 +0,0 @@ -.GxK؝'se2~.G1-#1Y!ʢ/DV
\ No newline at end of file diff --git a/vcl/qa/cppunit/graphicfilter/data/bmp/pass/EDB-22680-1.bmp b/vcl/qa/cppunit/graphicfilter/data/bmp/pass/EDB-22680-1.bmp Binary files differdeleted file mode 100644 index 88b11ad57845..000000000000 --- a/vcl/qa/cppunit/graphicfilter/data/bmp/pass/EDB-22680-1.bmp +++ /dev/null diff --git a/vcl/qa/cppunit/graphicfilter/data/gif/pass/EDB-19333-1.gif b/vcl/qa/cppunit/graphicfilter/data/gif/pass/EDB-19333-1.gif deleted file mode 100644 index 53d2ca01e854..000000000000 --- a/vcl/qa/cppunit/graphicfilter/data/gif/pass/EDB-19333-1.gif +++ /dev/null @@ -1 +0,0 @@ -&t};'[ek2ΐ~m1L-ha[^.!7/&VOʻBB^u2k]YnyG)ʿjkB:d#|u\#L@E
\ No newline at end of file diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 483a72bcc313..7dbcfb7a7c45 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -33,18 +33,18 @@ #include <osl/file.hxx> #include <osl/process.h> -#include <svtools/filter.hxx> +#include <vcl/graphicfilter.hxx> using namespace ::com::sun::star; /* Implementation of Filters test */ -class SvtoolsFiltersTest +class VclFiltersTest : public test::FiltersTest , public test::BootstrapFixture { public: - SvtoolsFiltersTest() : BootstrapFixture(true, false) {} + VclFiltersTest() : BootstrapFixture(true, false) {} virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &); @@ -53,12 +53,12 @@ public: */ void testCVEs(); - CPPUNIT_TEST_SUITE(SvtoolsFiltersTest); + CPPUNIT_TEST_SUITE(VclFiltersTest); CPPUNIT_TEST(testCVEs); CPPUNIT_TEST_SUITE_END(); }; -bool SvtoolsFiltersTest::load(const rtl::OUString &, +bool VclFiltersTest::load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &) { GraphicFilter aGraphicFilter(false); @@ -67,34 +67,40 @@ bool SvtoolsFiltersTest::load(const rtl::OUString &, return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0; } -void SvtoolsFiltersTest::testCVEs() +void VclFiltersTest::testCVEs() { +#ifndef DISABLE_CVE_TESTS testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/wmf/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/wmf/"), rtl::OUString()); testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/emf/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/emf/"), rtl::OUString()); testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/sgv/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/sgv/"), rtl::OUString()); testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/png/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/png/"), rtl::OUString()); testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/jpg/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/jpg/"), rtl::OUString()); testDir(rtl::OUString(), - getURLFromSrc("/svtools/qa/cppunit/data/gif/"), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/gif/"), rtl::OUString()); + + testDir(rtl::OUString(), + getURLFromSrc("/vcl/qa/cppunit/graphicfilter/data/bmp/"), + rtl::OUString()); +#endif } -CPPUNIT_TEST_SUITE_REGISTRATION(SvtoolsFiltersTest); +CPPUNIT_TEST_SUITE_REGISTRATION(VclFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index da5b879e6568..a8b881834f18 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -27,17 +27,21 @@ ************************************************************************/ #include "FilterConfigCache.hxx" -#include <svtools/filter.hxx> + +#include <vcl/graphicfilter.hxx> #include <com/sun/star/uno/Any.h> #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> using namespace ::com::sun::star::lang ; // XMultiServiceFactory using namespace ::com::sun::star::container ; // XNameAccess using namespace ::com::sun::star::uno ; // Reference using namespace ::com::sun::star::beans ; // PropertyValue +using namespace ::com::sun::star::configuration ; using ::rtl::OUString; const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = @@ -68,7 +72,7 @@ sal_Int32 FilterConfigCache::nIndUserData = -1; sal_Int32 FilterConfigCache::nIndFileFormatVersion = -1; sal_Int32 FilterConfigCache::nIndTemplateName = -1; -sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry ) +sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const rtl::OUString& rUserDataEntry ) { bIsPixelFormat = bIsInternalFilter = sal_False; sFilterName = String( rUserDataEntry ); diff --git a/vcl/source/filter/FilterConfigCache.hxx b/vcl/source/filter/FilterConfigCache.hxx index 66e55c28c6d3..c6a4b3d163ca 100644 --- a/vcl/source/filter/FilterConfigCache.hxx +++ b/vcl/source/filter/FilterConfigCache.hxx @@ -41,102 +41,101 @@ #define INCLUDED_VECTOR #endif +/** Cache to keep list of graphic filters + the filters themselves. */ class FilterConfigCache { - struct FilterConfigCacheEntry - { - ::rtl::OUString sInternalFilterName; - ::rtl::OUString sType; - ::com::sun::star::uno::Sequence< ::rtl::OUString > lExtensionList; - ::rtl::OUString sUIName; - ::rtl::OUString sDocumentService; - ::rtl::OUString sFilterService; - ::rtl::OUString sTemplateName; - - ::rtl::OUString sMediaType; - ::rtl::OUString sFilterType; - - sal_Int32 nFlags; - sal_Int32 nFileFormatVersion; - - // user data - String sFilterName; - sal_Bool bHasDialog : 1; - sal_Bool bIsInternalFilter : 1; - sal_Bool bIsPixelFormat : 1; - - sal_Bool CreateFilterName( const ::rtl::OUString& rUserDataEntry ); - String GetShortName( ); - - static const char* InternalPixelFilterNameList[]; - static const char* InternalVectorFilterNameList[]; - static const char* ExternalPixelFilterNameList[]; - }; - - typedef std::vector< FilterConfigCacheEntry > CacheVector; - - - CacheVector aImport; - CacheVector aExport; - sal_Bool bUseConfig; - - static sal_Bool bInitialized; - static sal_Int32 nIndType; - static sal_Int32 nIndUIName; - static sal_Int32 nIndDocumentService; - static sal_Int32 nIndFilterService; - static sal_Int32 nIndFlags; - static sal_Int32 nIndUserData; - static sal_Int32 nIndFileFormatVersion; - static sal_Int32 nIndTemplateName; - - static const char* InternalFilterListForSvxLight[]; - - void ImplInit(); - void ImplInitSmart(); - - public : - - sal_uInt16 GetImportFormatCount() const + struct FilterConfigCacheEntry + { + rtl::OUString sInternalFilterName; + rtl::OUString sType; + ::com::sun::star::uno::Sequence< rtl::OUString > lExtensionList; + rtl::OUString sUIName; + rtl::OUString sDocumentService; + rtl::OUString sFilterService; + rtl::OUString sTemplateName; + + rtl::OUString sMediaType; + rtl::OUString sFilterType; + + sal_Int32 nFlags; + sal_Int32 nFileFormatVersion; + + // user data + String sFilterName; + sal_Bool bHasDialog : 1; + sal_Bool bIsInternalFilter : 1; + sal_Bool bIsPixelFormat : 1; + + sal_Bool CreateFilterName( const rtl::OUString& rUserDataEntry ); + String GetShortName( ); + + static const char* InternalPixelFilterNameList[]; + static const char* InternalVectorFilterNameList[]; + static const char* ExternalPixelFilterNameList[]; + }; + + typedef std::vector< FilterConfigCacheEntry > CacheVector; + + CacheVector aImport; + CacheVector aExport; + sal_Bool bUseConfig; + + static sal_Bool bInitialized; + static sal_Int32 nIndType; + static sal_Int32 nIndUIName; + static sal_Int32 nIndDocumentService; + static sal_Int32 nIndFilterService; + static sal_Int32 nIndFlags; + static sal_Int32 nIndUserData; + static sal_Int32 nIndFileFormatVersion; + static sal_Int32 nIndTemplateName; + + static const char* InternalFilterListForSvxLight[]; + + void ImplInit(); + void ImplInitSmart(); + +public: + + sal_uInt16 GetImportFormatCount() const { return sal::static_int_cast< sal_uInt16 >(aImport.size()); }; - sal_uInt16 GetImportFormatNumber( const String& rFormatName ); - sal_uInt16 GetImportFormatNumberForMediaType( const String& rMediaType ); - sal_uInt16 GetImportFormatNumberForShortName( const String& rShortName ); - sal_uInt16 GetImportFormatNumberForTypeName( const String& rType ); - String GetImportFilterName( sal_uInt16 nFormat ); - String GetImportFormatName( sal_uInt16 nFormat ); - String GetImportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0); - String GetImportFormatMediaType( sal_uInt16 nFormat ); - String GetImportFormatShortName( sal_uInt16 nFormat ); - String GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ); - String GetImportFilterType( sal_uInt16 nFormat ); - String GetImportFilterTypeName( sal_uInt16 nFormat ); - - sal_Bool IsImportInternalFilter( sal_uInt16 nFormat ); - sal_Bool IsImportPixelFormat( sal_uInt16 nFormat ); - - sal_uInt16 GetExportFormatCount() const + sal_uInt16 GetImportFormatNumber( const String& rFormatName ); + sal_uInt16 GetImportFormatNumberForMediaType( const String& rMediaType ); + sal_uInt16 GetImportFormatNumberForShortName( const String& rShortName ); + sal_uInt16 GetImportFormatNumberForTypeName( const String& rType ); + String GetImportFilterName( sal_uInt16 nFormat ); + String GetImportFormatName( sal_uInt16 nFormat ); + String GetImportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0); + String GetImportFormatMediaType( sal_uInt16 nFormat ); + String GetImportFormatShortName( sal_uInt16 nFormat ); + String GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ); + String GetImportFilterType( sal_uInt16 nFormat ); + String GetImportFilterTypeName( sal_uInt16 nFormat ); + + sal_Bool IsImportInternalFilter( sal_uInt16 nFormat ); + sal_Bool IsImportPixelFormat( sal_uInt16 nFormat ); + + sal_uInt16 GetExportFormatCount() const { return sal::static_int_cast< sal_uInt16 >(aExport.size()); }; - sal_uInt16 GetExportFormatNumber( const String& rFormatName ); - sal_uInt16 GetExportFormatNumberForMediaType( const String& rMediaType ); - sal_uInt16 GetExportFormatNumberForShortName( const String& rShortName ); - sal_uInt16 GetExportFormatNumberForTypeName( const String& rType ); - String GetExportFilterName( sal_uInt16 nFormat ); - String GetExportFormatName( sal_uInt16 nFormat ); - String GetExportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0 ); - String GetExportFormatMediaType( sal_uInt16 nFormat ); - String GetExportFormatShortName( sal_uInt16 nFormat ); - String GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ); - String GetExportFilterTypeName( sal_uInt16 nFormat ); - String GetExportInternalFilterName( sal_uInt16 nFormat ); - - sal_Bool IsExportInternalFilter( sal_uInt16 nFormat ); - sal_Bool IsExportPixelFormat( sal_uInt16 nFormat ); - sal_Bool IsExportDialog( sal_uInt16 nFormat ); - - FilterConfigCache( sal_Bool bUseConfig ); - ~FilterConfigCache(); - + sal_uInt16 GetExportFormatNumber( const String& rFormatName ); + sal_uInt16 GetExportFormatNumberForMediaType( const String& rMediaType ); + sal_uInt16 GetExportFormatNumberForShortName( const String& rShortName ); + sal_uInt16 GetExportFormatNumberForTypeName( const String& rType ); + String GetExportFilterName( sal_uInt16 nFormat ); + String GetExportFormatName( sal_uInt16 nFormat ); + String GetExportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0 ); + String GetExportFormatMediaType( sal_uInt16 nFormat ); + String GetExportFormatShortName( sal_uInt16 nFormat ); + String GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ); + String GetExportFilterTypeName( sal_uInt16 nFormat ); + String GetExportInternalFilterName( sal_uInt16 nFormat ); + + sal_Bool IsExportInternalFilter( sal_uInt16 nFormat ); + sal_Bool IsExportPixelFormat( sal_uInt16 nFormat ); + sal_Bool IsExportDialog( sal_uInt16 nFormat ); + + FilterConfigCache( sal_Bool bUseConfig ); + ~FilterConfigCache(); }; #endif // _FILTER_CONFIG_CACHE_HXX_ diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 275bcebdebbf..1637cc793e57 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include <svtools/FilterConfigItem.hxx> +#include <vcl/FilterConfigItem.hxx> #include <unotools/configmgr.hxx> #include <comphelper/processfactory.hxx> diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0d7f1e1c298f..4ff2166b2666 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -39,17 +39,14 @@ #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> #include <osl/file.hxx> -#include <svtools/filter.hxx> -#include "FilterConfigCache.hxx" -#include <svtools/FilterConfigItem.hxx> -#include <svtools/fltcall.hxx> -#include <svtools/wmf.hxx> -#include "gifread.hxx" -#include "jpeg.hxx" -#include "xbmread.hxx" -#include "xpmread.hxx" +#include <vcl/graphicfilter.hxx> +#include <vcl/FilterConfigItem.hxx> +#include <vcl/wmf.hxx> +#include "igif/gifread.hxx" +#include "jpeg/jpeg.hxx" +#include "ixbm/xbmread.hxx" +#include "ixpm/xpmread.hxx" #include <svl/solar.hrc> -#include <svtools/svtools.hrc> #include "sgffilt.hxx" #include "osl/module.hxx" #include <com/sun/star/uno/Reference.h> @@ -71,7 +68,7 @@ #include <rtl/logfile.hxx> #include <vector> -#include "SvFilterOptionsDialog.hxx" +#include "FilterConfigCache.hxx" #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF @@ -117,7 +114,7 @@ public: ~ImpFilterOutputStream() {} }; -sal_Bool ImplDirEntryHelper::Exists( const INetURLObject& rObj ) +static sal_Bool DirEntryExists( const INetURLObject& rObj ) { sal_Bool bExists = sal_False; @@ -145,7 +142,7 @@ sal_Bool ImplDirEntryHelper::Exists( const INetURLObject& rObj ) // ----------------------------------------------------------------------------- -void ImplDirEntryHelper::Kill( const String& rMainUrl ) +static void KillDirEntry( const String& rMainUrl ) { try { @@ -1213,6 +1210,13 @@ sal_uInt16 GraphicFilter::GetExportFormatNumberForShortName( const String& rShor // ------------------------------------------------------------------------ +String GraphicFilter::GetExportInternalFilterName( sal_uInt16 nFormat ) +{ + return pConfig->GetExportInternalFilterName( nFormat ); +} + +// ------------------------------------------------------------------------ + sal_uInt16 GraphicFilter::GetExportFormatNumberForTypeName( const String& rType ) { return pConfig->GetExportFormatNumberForTypeName( rType ); @@ -1717,7 +1721,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLO RTL_LOGFILE_CONTEXT( aLog, "GraphicFilter::ExportGraphic() (thb)" ); sal_uInt16 nRetValue = GRFILTER_FORMATERROR; DBG_ASSERT( rPath.GetProtocol() != INET_PROT_NOT_VALID, "GraphicFilter::ExportGraphic() : ProtType == INET_PROT_NOT_VALID" ); - sal_Bool bAlreadyExists = ImplDirEntryHelper::Exists( rPath ); + sal_Bool bAlreadyExists = DirEntryExists( rPath ); String aMainUrl( rPath.GetMainURL( INetURLObject::NO_DECODE ) ); SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aMainUrl, STREAM_WRITE | STREAM_TRUNC ); @@ -1727,7 +1731,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLO delete pStream; if( ( GRFILTER_OK != nRetValue ) && !bAlreadyExists ) - ImplDirEntryHelper::Kill( aMainUrl ); + KillDirEntry( aMainUrl ); } return nRetValue; } @@ -2077,55 +2081,6 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& // ------------------------------------------------------------------------ -sal_Bool GraphicFilter::Setup( sal_uInt16 ) -{ - return sal_False; -} - -// ------------------------------------------------------------------------ - -sal_Bool GraphicFilter::HasExportDialog( sal_uInt16 nFormat ) -{ - return pConfig->IsExportDialog( nFormat ); -} - -// ------------------------------------------------------------------------ - -sal_Bool GraphicFilter::DoExportDialog( Window* pWindow, sal_uInt16 nFormat ) -{ - return DoExportDialog( pWindow, nFormat, FUNIT_MM ); -} - -sal_Bool GraphicFilter::DoExportDialog( Window*, sal_uInt16 nFormat, FieldUnit ) -{ - sal_Bool bRet = sal_False; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - xSMgr( ::comphelper::getProcessServiceFactory() ); - - uno::Reference< com::sun::star::uno::XInterface > xFilterOptionsDialog - ( xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.SvFilterOptionsDialog" )) ), - com::sun::star::uno::UNO_QUERY ); - if ( xFilterOptionsDialog.is() ) - { - com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XExecutableDialog > xExecutableDialog - ( xFilterOptionsDialog, ::com::sun::star::uno::UNO_QUERY ); - com::sun::star::uno::Reference< com::sun::star::beans::XPropertyAccess > xPropertyAccess - ( xFilterOptionsDialog, ::com::sun::star::uno::UNO_QUERY ); - if ( xExecutableDialog.is() && xPropertyAccess.is() ) - { - com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aMediaDescriptor( 1 ); - aMediaDescriptor[ 0 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); - rtl::OUString aStr( pConfig->GetExportInternalFilterName( nFormat ) ); - aMediaDescriptor[ 0 ].Value <<= aStr; - xPropertyAccess->setPropertyValues( aMediaDescriptor ); - bRet = xExecutableDialog->execute() == com::sun::star::ui::dialogs::ExecutableDialogResults::OK; - } - } - return bRet; -} - -// ------------------------------------------------------------------------ - const FilterErrorEx& GraphicFilter::GetLastError() const { return *pErrorEx; diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index d229dcb62a6d..5084014865b2 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -31,8 +31,7 @@ #include <stdio.h> #include <tools/stream.hxx> #include <vcl/outdev.hxx> -#include <svtools/filter.hxx> -#include "FilterConfigCache.hxx" +#include <vcl/graphicfilter.hxx> #include <unotools/ucbstreamhelper.hxx> #define DATA_SIZE 640 diff --git a/vcl/source/filter/jpeg/jpeg.cxx b/vcl/source/filter/jpeg/jpeg.cxx index 59f7d4ec69cb..a07e60c377b2 100644 --- a/vcl/source/filter/jpeg/jpeg.cxx +++ b/vcl/source/filter/jpeg/jpeg.cxx @@ -33,15 +33,15 @@ extern "C" { #include "stdio.h" #include "jpeg.h" - #include "jpeglib.h" - #include "jerror.h" + #include <jpeglib.h> + #include <jerror.h> } #define _JPEGPRIVATE #include <vcl/bmpacc.hxx> #include "jpeg.hxx" -#include <svtools/FilterConfigItem.hxx> -#include <svtools/filter.hxx> +#include <vcl/FilterConfigItem.hxx> +#include <vcl/graphicfilter.hxx> // ----------- // - Defines - diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx index 4e8aea6bce48..6d45276cec50 100644 --- a/vcl/source/filter/sgvmain.cxx +++ b/vcl/source/filter/sgvmain.cxx @@ -31,7 +31,7 @@ #include <osl/endian.h> #include <vcl/graph.hxx> #include <tools/poly.hxx> -#include <svtools/filter.hxx> +#include <vcl/graphicfilter.hxx> #include "sgffilt.hxx" #include "sgfbram.hxx" #include "sgvmain.hxx" diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx index b87ec912279f..7f9c26081181 100644 --- a/vcl/source/filter/sgvtext.cxx +++ b/vcl/source/filter/sgvtext.cxx @@ -30,7 +30,7 @@ #include <rtl/math.h> #include <comphelper/string.hxx> #include <tools/config.hxx> -#include <svtools/filter.hxx> +#include <vcl/graphicfilter.hxx> #include "sgffilt.hxx" #include "sgfbram.hxx" #include "sgvmain.hxx" diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 5b3d085b34d9..8f5bff1595fe 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -30,7 +30,7 @@ #include "winmtf.hxx" #include <boost/scoped_array.hpp> #include <vcl/gdimtf.hxx> -#include <svtools/wmf.hxx> +#include <vcl/wmf.hxx> #include <rtl/crc.h> #include <rtl/tencinfo.h> #include <osl/endian.h> diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index 823efe00a303..130411f39247 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -30,7 +30,7 @@ #include "winmtf.hxx" #include "emfwr.hxx" #include "wmfwr.hxx" -#include <svtools/wmf.hxx> +#include <vcl/wmf.hxx> #include <comphelper/scopeguard.hxx> // ----------------------------------------------------------------------------- |