summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-11-11 18:24:14 +0100
committerAndras Timar <atimar@suse.com>2012-11-11 18:24:14 +0100
commit06ec1c089519ef3249464aa09eadf03a8db93a39 (patch)
tree85b2eb6d8ba6ca95e18e1ff82151224cb14106f6 /filter
parent8e0d67bed54633d555a4601a5d79e2d5ba7ab2bb (diff)
parent3f899eae02eaad0b967de749fe09b869ba93ad6d (diff)
Merge branch 'master' into feature/killsdf
Conflicts: Repository.mk RepositoryFixes.mk connectivity/prj/build.lst extensions/prj/build.lst filter/prj/build.lst fpicker/prj/build.lst l10ntools/StaticLibrary_transex.mk saxon/build.xml shell/prj/build.lst solenv/gbuild/AllLangResTarget.mk solenv/gbuild/Configuration.mk solenv/gbuild/UI.mk ucb/source/ucp/webdav/webdavcontent.cxx
Diffstat (limited to 'filter')
-rw-r--r--filter/Configuration_filter.mk189
-rw-r--r--filter/Jar_XSLTFilter.mk42
-rw-r--r--filter/Library_msfilter.mk2
-rw-r--r--filter/Module_filter.mk1
-rw-r--r--filter/Package_inc.mk2
-rw-r--r--filter/inc/filter/msfilter/dffpropset.hxx71
-rw-r--r--filter/inc/filter/msfilter/dffrecordheader.hxx63
-rw-r--r--filter/inc/filter/msfilter/escherex.hxx37
-rw-r--r--filter/inc/filter/msfilter/msdffimp.hxx129
-rw-r--r--filter/prj/build.lst2
-rw-r--r--filter/qa/cppunit/filters-pict-test.cxx7
-rw-r--r--filter/qa/cppunit/filters-tga-test.cxx7
-rw-r--r--filter/qa/cppunit/filters-tiff-test.cxx7
-rw-r--r--filter/source/config/cache/filtercache.cxx2
-rw-r--r--filter/source/config/cache/filterfactory.cxx5
-rw-r--r--filter/source/config/fragments/filters/VisioDocument.xcu2
-rw-r--r--filter/source/config/fragments/types/draw_Visio_Document.xcu4
-rw-r--r--filter/source/config/tools/merge/FCFGMerge.cfg33
-rwxr-xr-xfilter/source/config/tools/merge/pyAltFCFGMerge2
-rw-r--r--filter/source/flash/swfwriter1.cxx59
-rw-r--r--filter/source/graphicfilter/eos2met/eos2met.cxx62
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx55
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx78
-rw-r--r--filter/source/graphicfilter/idxf/dxftblrd.cxx208
-rw-r--r--filter/source/graphicfilter/ipbm/ipbm.cxx2
-rw-r--r--filter/source/graphicfilter/itga/itga.cxx55
-rw-r--r--filter/source/msfilter/dffpropset.cxx1344
-rw-r--r--filter/source/msfilter/dffrecordheader.cxx (renamed from filter/source/xsltfilter/XSLTFilter.jar.component)34
-rw-r--r--filter/source/msfilter/escherex.cxx70
-rw-r--r--filter/source/msfilter/msdffimp.cxx860
-rw-r--r--filter/source/msfilter/viscache.hxx37
-rw-r--r--filter/source/odfflatxml/OdfFlatXml.cxx7
-rw-r--r--filter/source/svg/svgexport.cxx71
-rw-r--r--filter/source/svg/svgfilter.hxx3
-rw-r--r--filter/source/svg/svgreader.cxx2
-rw-r--r--filter/source/svg/svgwriter.cxx179
-rw-r--r--filter/source/svg/svgwriter.hxx51
-rw-r--r--filter/source/svg/tokenmap.cxx27
-rw-r--r--filter/source/t602/t602filter.cxx20
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx16
-rw-r--r--filter/source/xsltdialog/typedetectionexport.hxx11
-rw-r--r--filter/source/xsltdialog/typedetectionimport.cxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hxx5
-rw-r--r--filter/source/xsltdialog/xmlfilterhelpids.hrc3
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx4
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx69
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.cxx20
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.hrc5
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.hxx5
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.src23
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx6
-rw-r--r--filter/source/xsltfilter/LibXSLTTransformer.cxx4
-rw-r--r--filter/source/xsltfilter/LibXSLTTransformer.hxx18
-rw-r--r--filter/source/xsltfilter/Manifest2
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx78
-rw-r--r--filter/source/xsltfilter/com/sun/star/comp/xsltfilter/Base64.java1824
-rw-r--r--filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java386
-rw-r--r--filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java496
-rw-r--r--filter/source/xsltfilter/xsltfilter.component2
59 files changed, 2466 insertions, 4344 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 05c14fc189d3..5b41bdac1b3e 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -929,193 +929,4 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_xslt_filters.xcu,filt
UOF_presentation \
)
-### binfilter ###
-
-ifneq ($(WITH_BINFILTER),NO)
-
-# fcfg_writer_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_bf_types.xcu,filter/source/config/fragments/types,\
- writer_StarWriter_10 \
- writer_StarWriter_20 \
- writer_StarWriter_30 \
- writer_StarWriter_30_VorlageTemplate \
- writer_StarWriter_40 \
- writer_StarWriter_40_VorlageTemplate \
- writer_StarWriter_50 \
- writer_StarWriter_50_VorlageTemplate \
- writer_StarWriter_DOS \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarWriter_1_0 \
- StarWriter_2_0 \
- StarWriter_3_0 \
- StarWriter_3_0_Vorlage_Template \
- StarWriter_4_0 \
- StarWriter_4_0_Vorlage_Template \
- StarWriter_5_0 \
- StarWriter_5_0_Vorlage_Template \
- StarWriter_DOS \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarWriter_3_0_Vorlage_Template_ui \
- StarWriter_4_0_Vorlage_Template_ui \
- StarWriter_5_0_Vorlage_Template_ui \
-)
-
-# fcfg_web_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_web_bf_types.xcu,filter/source/config/fragments/types,\
- writer_StarWriter_30 \
- writer_StarWriter_40 \
- writer_StarWriter_50 \
- writer_web_StarWriterWeb_40_VorlageTemplate \
- writer_web_StarWriterWeb_50_VorlageTemplate \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_web_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarWriter_3_0__StarWriter_Web_ \
- StarWriter_4_0__StarWriter_Web_ \
- StarWriter_5_0__StarWriter_Web_ \
- StarWriter_Web_4_0_Vorlage_Template \
- StarWriter_Web_5_0_Vorlage_Template \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarWriter_Web_4_0_Vorlage_Template_ui \
- StarWriter_Web_5_0_Vorlage_Template_ui \
-)
-
-# fcfg_global_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_global_bf_types.xcu,filter/source/config/fragments/types,\
- writer_StarWriter_30 \
- writer_StarWriter_40 \
- writer_globaldocument_StarWriter_40GlobalDocument \
- writer_StarWriter_50 \
- writer_globaldocument_StarWriter_50GlobalDocument \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_global_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarWriter_3_0__StarWriter_GlobalDocument_ \
- StarWriter_4_0__StarWriter_GlobalDocument_ \
- StarWriter_4_0_GlobalDocument \
- StarWriter_5_0__StarWriter_GlobalDocument_ \
- StarWriter_5_0_GlobalDocument \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarWriter_4_0_GlobalDocument_ui \
- StarWriter_5_0_GlobalDocument_ui \
-)
-
-# fcfg_calc_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_bf_types.xcu,filter/source/config/fragments/types,\
- calc_StarCalc_10 \
- calc_StarCalc_30 \
- calc_StarCalc_30_VorlageTemplate \
- calc_StarCalc_40 \
- calc_StarCalc_40_VorlageTemplate \
- calc_StarCalc_50 \
- calc_StarCalc_50_VorlageTemplate \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarCalc_1_0 \
- StarCalc_3_0 \
- StarCalc_3_0_Vorlage_Template \
- StarCalc_4_0 \
- StarCalc_4_0_Vorlage_Template \
- StarCalc_5_0 \
- StarCalc_5_0_Vorlage_Template \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarCalc_3_0_Vorlage_Template_ui \
- StarCalc_4_0_Vorlage_Template_ui \
- StarCalc_5_0_Vorlage_Template_ui \
-)
-
-# fcfg_draw_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_bf_types.xcu,filter/source/config/fragments/types,\
- draw_StarDraw_30 \
- draw_StarDraw_30_Vorlage \
- draw_StarDraw_50 \
- draw_StarDraw_50_Vorlage \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarDraw_3_0 \
- StarDraw_3_0_Vorlage \
- StarDraw_5_0 \
- StarDraw_5_0_Vorlage \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarDraw_3_0_Vorlage_ui \
- StarDraw_5_0_Vorlage_ui \
-)
-
-# fcfg_impress_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_impress_bf_types.xcu,filter/source/config/fragments/types,\
- draw_StarDraw_30 \
- draw_StarDraw_30_Vorlage \
- draw_StarDraw_50 \
- draw_StarDraw_50_Vorlage \
- impress_StarImpress_40 \
- impress_StarImpress_40_Vorlage \
- impress_StarImpress_50 \
- impress_StarImpress_50_Vorlage \
- impress_StarImpress_50_packed \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarDraw_3_0_Vorlage__StarImpress_ \
- StarDraw_3_0__StarImpress_ \
- StarDraw_5_0_Vorlage__StarImpress_ \
- StarDraw_5_0__StarImpress_ \
- StarImpress_4_0 \
- StarImpress_4_0_Vorlage \
- StarImpress_5_0 \
- StarImpress_5_0_Vorlage \
- StarImpress_5_0__packed_ \
-)
-
-$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
- StarDraw_3_0_Vorlage__StarImpress__ui \
- StarDraw_5_0_Vorlage__StarImpress__ui \
- StarImpress_4_0_Vorlage_ui \
- StarImpress_5_0_Vorlage_ui \
- StarImpress_5_0__packed__ui \
-)
-
-# fcfg_chart_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_chart_bf_types.xcu,filter/source/config/fragments/types,\
- chart_StarChart_30 \
- chart_StarChart_40 \
- chart_StarChart_50 \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_chart_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarChart_3_0 \
- StarChart_4_0 \
- StarChart_5_0 \
-)
-
-# fcfg_math_bf
-$(call filter_Configuration_add_types,fcfg_langpack,fcfg_math_bf_types.xcu,filter/source/config/fragments/types,\
- math_StarMath_20 \
- math_StarMath_30 \
- math_StarMath_40 \
- math_StarMath_50 \
-)
-
-$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_math_bf_filters.xcu,filter/source/config/fragments/filters,\
- StarMath_2_0 \
- StarMath_3_0 \
- StarMath_4_0 \
- StarMath_5_0 \
-)
-
-endif # WITH_BINFILTER
-
# vim: set noet sw=4 ts=4:
diff --git a/filter/Jar_XSLTFilter.mk b/filter/Jar_XSLTFilter.mk
deleted file mode 100644
index 84faeac59386..000000000000
--- a/filter/Jar_XSLTFilter.mk
+++ /dev/null
@@ -1,42 +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 .
-#
-
-$(eval $(call gb_Jar_Jar,XSLTFilter))
-
-$(eval $(call gb_Jar_use_jars,XSLTFilter,\
- ridl \
- unoil \
- jurt \
- juh \
-))
-
-$(eval $(call gb_Jar_use_externals,XSLTFilter,saxon))
-
-$(eval $(call gb_Jar_set_componentfile,XSLTFilter,filter/source/xsltfilter/XSLTFilter.jar,OOO))
-
-$(eval $(call gb_Jar_set_manifest,XSLTFilter,$(SRCDIR)/filter/source/xsltfilter/Manifest))
-
-$(eval $(call gb_Jar_set_packageroot,XSLTFilter,com))
-
-$(eval $(call gb_Jar_add_sourcefiles,XSLTFilter,\
- filter/source/xsltfilter/com/sun/star/comp/xsltfilter/Base64 \
- filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter \
- filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_msfilter.mk b/filter/Library_msfilter.mk
index ea042bba87a1..098d72a9871a 100644
--- a/filter/Library_msfilter.mk
+++ b/filter/Library_msfilter.mk
@@ -56,6 +56,8 @@ $(eval $(call gb_Library_use_libraries,msfilter,\
$(eval $(call gb_Library_add_exception_objects,msfilter,\
filter/source/msfilter/countryid \
+ filter/source/msfilter/dffpropset \
+ filter/source/msfilter/dffrecordheader \
filter/source/msfilter/escherex \
filter/source/msfilter/eschesdo \
filter/source/msfilter/mscodec \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 99bebb5c55d8..463af633763b 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -74,7 +74,6 @@ endif
ifneq ($(SOLAR_JAVA),)
$(eval $(call gb_Module_add_targets,filter,\
- Jar_XSLTFilter \
Jar_XSLTValidate \
))
endif
diff --git a/filter/Package_inc.mk b/filter/Package_inc.mk
index 578fe96207df..f14893df1b61 100644
--- a/filter/Package_inc.mk
+++ b/filter/Package_inc.mk
@@ -20,6 +20,8 @@ $(eval $(call gb_Package_Package,filter_inc,$(SRCDIR)/filter/inc))
$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/msfilterdllapi.h,filter/msfilter/msfilterdllapi.h))
$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/countryid.hxx,filter/msfilter/countryid.hxx))
+$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/dffpropset.hxx,filter/msfilter/dffpropset.hxx))
+$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/dffrecordheader.hxx,filter/msfilter/dffrecordheader.hxx))
$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/escherex.hxx,filter/msfilter/escherex.hxx))
$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/mscodec.hxx,filter/msfilter/mscodec.hxx))
$(eval $(call gb_Package_add_file,filter_inc,inc/filter/msfilter/msdffimp.hxx,filter/msfilter/msdffimp.hxx))
diff --git a/filter/inc/filter/msfilter/dffpropset.hxx b/filter/inc/filter/msfilter/dffpropset.hxx
new file mode 100644
index 000000000000..a11b3822bd3f
--- /dev/null
+++ b/filter/inc/filter/msfilter/dffpropset.hxx
@@ -0,0 +1,71 @@
+/* -*- 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 .
+ */
+#ifndef _DFFPROPSET_HXX
+#define _DFFPROPSET_HXX
+
+#include <tools/solar.h>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <tools/stream.hxx>
+#include <vector>
+
+struct DffPropFlags
+{
+ sal_uInt8 bSet : 1;
+ sal_uInt8 bComplex : 1;
+ sal_uInt8 bBlip : 1;
+ sal_uInt8 bSoftAttr : 1;
+};
+
+struct DffPropSetEntry
+{
+ DffPropFlags aFlags;
+ sal_uInt16 nComplexIndexOrFlagsHAttr;
+ sal_uInt32 nContent;
+};
+
+class MSFILTER_DLLPUBLIC DffPropSet
+{
+ private:
+ DffPropSetEntry* mpPropSetEntries;
+ std::vector< sal_uInt32 > maOffsets;
+
+ void ReadPropSet( SvStream&, bool );
+
+ public:
+ explicit DffPropSet();
+ ~DffPropSet();
+
+ inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
+ sal_Bool IsHardAttribute( sal_uInt32 nId ) const;
+ sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
+ /** Returns a boolean property by its real identifier. */
+ bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
+ /** Returns a string property. */
+ ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
+ void SetPropertyValue( sal_uInt32 nId, sal_uInt32 nValue ) const;
+ sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
+ void InitializePropSet( sal_uInt16 nPropSetType ) const;
+
+ friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
+ friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/inc/filter/msfilter/dffrecordheader.hxx b/filter/inc/filter/msfilter/dffrecordheader.hxx
new file mode 100644
index 000000000000..ca2fcc368c46
--- /dev/null
+++ b/filter/inc/filter/msfilter/dffrecordheader.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 .
+ */
+
+#ifndef _DFFRECORDHEADER_HXX
+#define _DFFRECORDHEADER_HXX
+
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+
+class MSFILTER_DLLPUBLIC DffRecordHeader
+{
+public:
+ sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
+ sal_uInt16 nRecInstance;
+ sal_uInt16 nImpVerInst;
+ sal_uInt16 nRecType;
+ sal_uInt32 nRecLen;
+ sal_uLong nFilePos;
+
+ DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
+ nRecType(0), nRecLen(0), nFilePos(0) {}
+ bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
+ sal_uLong GetRecBegFilePos() const { return nFilePos; }
+ sal_uLong GetRecEndFilePos() const
+ { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
+ bool SeekToEndOfRecord(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToContent(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToBegOfRecord(SvStream& rIn) const
+ {
+ return nFilePos == rIn.Seek(nFilePos);
+ }
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx
index a5b7352ecb5a..5182417333ff 100644
--- a/filter/inc/filter/msfilter/escherex.hxx
+++ b/filter/inc/filter/msfilter/escherex.hxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * 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 .
+ */
#ifndef _SVX_ESCHEREX_HXX
#define _SVX_ESCHEREX_HXX
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index e9e1b148346d..ef1946bdba65 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * 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 .
+ */
#ifndef FLT_MSDFFIMP_HXX
#define FLT_MSDFFIMP_HXX
@@ -53,10 +44,11 @@
#include <vcl/graph.hxx>
#include <svx/msdffdef.hxx>
+#include <filter/msfilter/dffpropset.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
#include <filter/msfilter/msfilterdllapi.h>
-
class Graphic;
class SvStream;
class SdrObject;
@@ -66,91 +58,13 @@ class Polygon;
class PolyPolygon;
class FmFormModel;
class SdrModel;
-class DffRecordHeader;
class SwFlyFrmFmt;
struct SvxMSDffBLIPInfo;
struct SvxMSDffShapeInfo;
struct SvxMSDffShapeOrder;
-class MSFILTER_DLLPUBLIC DffRecordHeader
-{
-public:
- sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
- sal_uInt16 nRecInstance;
- sal_uInt16 nImpVerInst;
- sal_uInt16 nRecType;
- sal_uInt32 nRecLen;
- sal_uLong nFilePos;
-
- DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
- nRecType(0), nRecLen(0), nFilePos(0) {}
- bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
- sal_uLong GetRecBegFilePos() const { return nFilePos; }
- sal_uLong GetRecEndFilePos() const
- { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
- bool SeekToEndOfRecord(SvStream& rIn) const
- {
- sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
- return nPos == rIn.Seek(nPos);
- }
- bool SeekToContent(SvStream& rIn) const
- {
- sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
- return nPos == rIn.Seek(nPos);
- }
- bool SeekToBegOfRecord(SvStream& rIn) const
- {
- return nFilePos == rIn.Seek(nFilePos);
- }
-
- MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
-};
-
-struct DffPropFlags
-{
- sal_uInt8 bSet : 1;
- sal_uInt8 bComplex : 1;
- sal_uInt8 bBlip : 1;
- sal_uInt8 bSoftAttr : 1;
-};
-
class SvxMSDffManager;
-
-class MSFILTER_DLLPUBLIC DffPropSet
-{
-private:
- void InitializeProp(sal_uInt32 nKey, sal_uInt32 nContent,
- DffPropFlags& rFlags, sal_uInt32 nRecordType) const;
-
-protected:
- typedef std::map<sal_uInt32, sal_uInt32> RecordTypesMap;
-
- RecordTypesMap maRecordTypes;
- sal_uInt32 mpContents[ 1024 ];
- DffPropFlags mpFlags[ 1024 ];
-
-public:
- explicit DffPropSet( sal_Bool bInitialize = sal_False )
- {
- if ( bInitialize )
- memset( mpFlags, 0, 0x400 * sizeof( DffPropFlags ) );
- };
-
- inline sal_Bool IsProperty( sal_uInt32 nRecType ) const
- { return ( mpFlags[ nRecType & 0x3ff ].bSet ); };
- sal_Bool IsHardAttribute( sal_uInt32 nId ) const;
- sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
- /** Returns a boolean property by its real identifier. */
- bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
- /** Returns a string property. */
- ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
- sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
- void Merge( DffPropSet& rMasterPropSet ) const;
- void InitializePropSet() const;
- friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
-};
-
class SfxItemSet;
class SdrObject;
struct DffObjData;
@@ -161,6 +75,7 @@ class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
DffPropSet* pDefaultPropSet;
void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
+ void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) const;
void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
SfxItemSet& rSet,
@@ -182,7 +97,7 @@ public:
void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
- void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
};
#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
@@ -394,7 +309,9 @@ struct DffObjData
sal_Bool bClientData : 1;
sal_Bool bChildAnchor : 1;
sal_Bool bOpt : 1;
+ sal_Bool bOpt2 : 1;
sal_Bool bIsAutoText : 1;
+ sal_Bool bRotateTextWithShape : 1;
int nCalledByGroup;
@@ -411,7 +328,9 @@ struct DffObjData
bClientData( sal_False ),
bChildAnchor( sal_False ),
bOpt( sal_False ),
+ bOpt2( sal_False ),
bIsAutoText( sal_False ),
+ bRotateTextWithShape( sal_True ),
nCalledByGroup( nClByGroup ){}
};
@@ -600,6 +519,7 @@ protected :
virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
public:
+ DffPropertyReader* pSecPropSet;
std::map<sal_uInt32,rtl::OString> aEscherBlipCache;
DffRecordManager maShapeRecords;
@@ -685,9 +605,6 @@ public:
sal_uInt32 nLen,
const GDIMetaFile*,
const SotStorageRef & rDest );
- static rtl::OUString ReadDffString( SvStream& rSt,
- DffRecordHeader aStrHd = DffRecordHeader());
- static bool ReadObjText(SvStream& rSt, SdrObject* pObj);
void SetModel(SdrModel* pModel, long nApplicationScale);
SdrModel* GetModel() const { return pSdrModel; }
diff --git a/filter/prj/build.lst b/filter/prj/build.lst
index 9af8fbc62ede..1ed611dfb619 100644
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@ -1,2 +1,2 @@
-fl filter : svtools unotools xmloff cppu tools cppuhelper sal salhelper svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt basegfx package PYTHON:python NULL
+fl filter : svtools unotools xmloff cppu tools cppuhelper sal salhelper svx javaunohelper XPDF:xpdf jvmaccess canvas LIBXSLT:libxslt basegfx package PYTHON:python NULL
fl filter\prj nmake - all fl_prj NULL
diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx
index 69228f34f946..9e5a296e7e16 100644
--- a/filter/qa/cppunit/filters-pict-test.cxx
+++ b/filter/qa/cppunit/filters-pict-test.cxx
@@ -34,7 +34,9 @@ class PictFilterTest
public:
PictFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -47,7 +49,8 @@ public:
};
bool PictFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/filter/qa/cppunit/filters-tga-test.cxx b/filter/qa/cppunit/filters-tga-test.cxx
index c0eba97d41f6..9edcf62b57a7 100644
--- a/filter/qa/cppunit/filters-tga-test.cxx
+++ b/filter/qa/cppunit/filters-tga-test.cxx
@@ -54,7 +54,9 @@ class TgaFilterTest
public:
TgaFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -67,7 +69,8 @@ public:
};
bool TgaFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/filter/qa/cppunit/filters-tiff-test.cxx b/filter/qa/cppunit/filters-tiff-test.cxx
index 942ad1609290..b967393e9ec8 100644
--- a/filter/qa/cppunit/filters-tiff-test.cxx
+++ b/filter/qa/cppunit/filters-tiff-test.cxx
@@ -54,7 +54,9 @@ class TiffFilterTest
public:
TiffFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -67,7 +69,8 @@ public:
};
bool TiffFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 9159f20a19ab..ee0ac397818a 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -2466,7 +2466,7 @@ sal_Bool FilterCache::impl_isModuleInstalled(const ::rtl::OUString& sModule)
{
m_xModuleCfg = css::uno::Reference< css::container::XNameAccess >(
::comphelper::ConfigurationHelper::openConfig(
- m_xSMGR,
+ comphelper::getComponentContext(m_xSMGR),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office/Factories" )),
::comphelper::ConfigurationHelper::E_READONLY),
css::uno::UNO_QUERY_THROW);
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
index fa918f683060..cfba722a43aa 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -24,6 +24,7 @@
#include "versions.hxx"
#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/processfactory.hxx>
#include <comphelper/enumhelper.hxx>
#include <comphelper/configurationhelper.hxx>
#include <rtl/ustrbuf.hxx>
@@ -487,7 +488,7 @@ OUStringList FilterFactory::impl_getListOfInstalledModules() const
try
{
css::uno::Reference< css::container::XNameAccess > xModuleConfig(
- ::comphelper::ConfigurationHelper::openConfig(xSMGR,
+ ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR),
CFGPACKAGE_OOO_MODULES,
::comphelper::ConfigurationHelper::E_READONLY),
css::uno::UNO_QUERY_THROW);
@@ -570,7 +571,7 @@ OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const ::rtl::OUS
try
{
css::uno::Reference< css::container::XNameAccess > xUISortConfig(
- ::comphelper::ConfigurationHelper::openConfig(xSMGR,
+ ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR),
CFGPACKAGE_TD_UISORT,
::comphelper::ConfigurationHelper::E_READONLY),
css::uno::UNO_QUERY_THROW);
diff --git a/filter/source/config/fragments/filters/VisioDocument.xcu b/filter/source/config/fragments/filters/VisioDocument.xcu
index 82b3569bf3dd..15c504b8fa49 100644
--- a/filter/source/config/fragments/filters/VisioDocument.xcu
+++ b/filter/source/config/fragments/filters/VisioDocument.xcu
@@ -21,7 +21,7 @@
<prop oor:name="FilterService"><value>com.sun.star.comp.Draw.VisioImportFilter</value></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="UIName">
- <value xml:lang="x-default">Microsoft Visio 2000-2010</value>
+ <value xml:lang="x-default">Microsoft Visio 2000-2013</value>
</prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>draw_Visio_Document</value></prop>
diff --git a/filter/source/config/fragments/types/draw_Visio_Document.xcu b/filter/source/config/fragments/types/draw_Visio_Document.xcu
index a7234b4e1000..b6c6992a389c 100644
--- a/filter/source/config/fragments/types/draw_Visio_Document.xcu
+++ b/filter/source/config/fragments/types/draw_Visio_Document.xcu
@@ -18,12 +18,12 @@
<node oor:name="draw_Visio_Document" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.Draw.VisioImportFilter</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>vsd vst</value></prop>
+ <prop oor:name="Extensions"><value>vdx vsd vsdm vsdx</value></prop>
<prop oor:name="MediaType"><value>application/vnd.visio</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>Visio Document</value></prop>
<prop oor:name="UIName">
- <value>Microsoft Visio 2000/XP/2003</value>
+ <value>Microsoft Visio</value>
</prop>
<prop oor:name="ClipboardFormat"/>
</node>
diff --git a/filter/source/config/tools/merge/FCFGMerge.cfg b/filter/source/config/tools/merge/FCFGMerge.cfg
index 59d35b8be7bf..4516a777bc57 100644
--- a/filter/source/config/tools/merge/FCFGMerge.cfg
+++ b/filter/source/config/tools/merge/FCFGMerge.cfg
@@ -1,29 +1,20 @@
-#*************************************************************************
#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# This file is part of the LibreOffice project.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# 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/.
#
-# OpenOffice.org - a multi-platform office productivity suite
+# This file incorporates work covered by the following license notice:
#
-# This file is part of OpenOffice.org.
+# 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 .
#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
#************************************************
# Specify the verbose mode of this tool.
diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge
index dfebbecfe21f..b05e37d9b32f 100755
--- a/filter/source/config/tools/merge/pyAltFCFGMerge
+++ b/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -9,7 +9,7 @@
# there is a java which is available for use by all
#_____________________________________________
-import sys, string, os.path, codecs
+import sys, string, os.path, codecs
CFGFILE = os.environ["SOLARVER"] + "/" + os.environ["INPATH_FOR_BUILD"] + "/inc/l10ntools/FCFGMerge.cfg"
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 1352508f5835..cce56ee7c4db 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -1,32 +1,23 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
+ * 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 <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
@@ -39,7 +30,6 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svtools/filter.hxx>
#include <vcl/graphictools.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
#ifndef _ZLIB_H
#ifdef SYSTEM_ZLIB
@@ -1832,19 +1822,6 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
}
break;
- case( META_RENDERGRAPHIC_ACTION ):
- {
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pAction;
- const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
- const Point aPointPixel;
- const Size aSizePixel( mpVDev->LogicToPixel( pA->GetSize() ) );
- const BitmapEx aBmpEx( aRasterizer.Rasterize( aSizePixel ) );
-
- Impl_writeImage( aBmpEx, pA->GetPoint(), pA->GetSize(),
- aPointPixel, aBmpEx.GetSizePixel(), clipRect, 1 == bMap );
- }
- break;
-
case( META_MAPMODE_ACTION ):
{
bMap++;
@@ -2065,8 +2042,8 @@ Reference < XBreakIterator > Writer::Impl_GetBreakIterator()
{
if ( !mxBreakIterator.is() )
{
- Reference< XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- mxBreakIterator.set( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" )) ), UNO_QUERY );
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ mxBreakIterator = BreakIterator::create(xContext);
}
return mxBreakIterator;
}
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index 6849e5408d1a..834a0f462798 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+ * 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 <svtools/fltcall.hxx>
@@ -43,7 +33,6 @@
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
#include <svl/solar.hrc>
@@ -175,7 +164,7 @@ private:
// Callback as the case may be. Sets bStatus to sal_False if the user wants to cancel
void CountActionsAndBitmaps(const GDIMetaFile * pMTF);
- // Counts the bitmaps and actions (nNumberOfActions and nNumberOfBitmaps have to
+ // Counts the bitmaps and actions (nNumberOfActions and nNumberOfBitmaps have to
// be set to 0 at the beginning, since this method is recursive)
void WriteBigEndianShort(sal_uInt16 nWord);
@@ -325,7 +314,6 @@ void METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF)
case META_BMPEX_ACTION:
case META_BMPEXSCALE_ACTION:
case META_BMPEXSCALEPART_ACTION:
- case META_RENDERGRAPHIC_ACTION:
nNumberOfBitmaps++;
break;
}
@@ -799,17 +787,6 @@ void METWriter::WriteImageObjects(const GDIMetaFile * pMTF)
}
}
break;
-
- case( META_RENDERGRAPHIC_ACTION ):
- {
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
- const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
- const BitmapEx aBmpEx( aRasterizer.Rasterize( pCompDev->LogicToPixel( pA->GetSize() ) ) );
-
- METSetMix( eGDIRasterOp );
- WriteImageObject( Graphic( aBmpEx ).GetBitmap() );
- }
- break;
}
if (bStatus==sal_False)
@@ -2332,15 +2309,6 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
WriteOrders( &aTmpMtf );
}
break;
-
- case( META_RENDERGRAPHIC_ACTION ):
- {
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
-
- METSetMix( eGDIRasterOp );
- METBitBlt( pA->GetPoint(), pA->GetSize(), pCompDev->LogicToPixel( pA->GetSize(), pMTF->GetPrefMapMode() ) );
- }
- break;
}
nWrittenActions++;
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index fe1c05c8d20a..f8934c1ae4b9 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+ * 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/metaact.hxx>
#include <svtools/filter.hxx>
@@ -43,8 +33,6 @@
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/gdimtf.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
-
#include <tools/bigint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -224,7 +212,6 @@ void PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF)
case META_BMPEX_ACTION:
case META_BMPEXSCALE_ACTION:
case META_BMPEXSCALEPART_ACTION:
- case META_RENDERGRAPHIC_ACTION:
nNumberOfBitmaps++;
break;
}
@@ -254,7 +241,7 @@ Polygon PictWriter::PolyPolygonToPolygon(const PolyPolygon & rPolyPoly)
nSize2=aPoly2.GetSize();
// At first we look for a point in aPoly1 (referenced by nBestIdx1) and a
- // point in aPoly2 (referenced by nBestid2), which
+ // point in aPoly2 (referenced by nBestid2), which
// Zunaechst werden ein Punkt in aPoly1 (referenziert durch nBestIdx1) und ein
// Punkt in aPoly2 (referenziert durch nBestIdx2) gesucht, die moeglichst dicht
// beieinander liegen. Da dies mit quadratischem Aufwand einher geht, und somit
@@ -2150,18 +2137,6 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
WriteOpcodes( aTmpMtf );
}
break;
-
- case( META_RENDERGRAPHIC_ACTION ):
- {
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
- const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
- VirtualDevice aVirDev;
- const Bitmap aBmp( Graphic( aRasterizer.Rasterize(
- aVirDev.LogicToPixel( pA->GetSize() ) ) ).GetBitmap() );
-
- WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp );
- }
- break;
}
nWrittenActions++;
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index ba9f1a3dfae8..e8e0ab45543f 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
+/*
+ * This file is part of the LibreOffice project.
*
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
+ * 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/.
*
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
+ * 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 <tools/solar.h>
#include <tools/stream.hxx>
@@ -46,7 +36,6 @@
#include <svtools/fltcall.hxx>
#include <svtools/FilterConfigItem.hxx>
#include <vcl/graphictools.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
#include "strings.hrc"
#include <math.h>
@@ -1367,7 +1356,6 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
case META_BMPSCALEPART_ACTION :
case META_BMPEXSCALE_ACTION :
case META_BMPEXSCALEPART_ACTION :
- case META_RENDERGRAPHIC_ACTION :
{
nBitmapCount++;
nBitmapAction = nCurAction;
@@ -1426,23 +1414,6 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
}
}
break;
-
- case( META_RENDERGRAPHIC_ACTION ):
- {
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pMA;
- const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
- const BitmapEx aBmpEx( aRasterizer.Rasterize( rVDev.LogicToPixel( pA->GetSize() ) ) );
- Bitmap aBmp( aBmpEx.GetBitmap() );
-
- if ( mbGrayScale )
- aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
-
- Bitmap aMask( aBmpEx.GetMask() );
- Size aSize( pA->GetSize() );
-
- ImplBmp( &aBmp, &aMask, pA->GetPoint(), aSize.Width(), aSize.Height() );
- }
- break;
}
}
}
@@ -2419,6 +2390,7 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
l_aDashArray.push_back( 2 );
const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5);
SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
+ SvtGraphicStroke::CapType aCapType(SvtGraphicStroke::capButt);
switch(rLineInfo.GetLineJoin())
{
@@ -2437,8 +2409,26 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
aJoinType = SvtGraphicStroke::joinRound;
break;
}
+ switch(rLineInfo.GetLineCap())
+ {
+ default: /* com::sun::star::drawing::LineCap_BUTT */
+ {
+ aCapType = SvtGraphicStroke::capButt;
+ break;
+ }
+ case com::sun::star::drawing::LineCap_ROUND:
+ {
+ aCapType = SvtGraphicStroke::capRound;
+ break;
+ }
+ case com::sun::star::drawing::LineCap_SQUARE:
+ {
+ aCapType = SvtGraphicStroke::capSquare;
+ break;
+ }
+ }
- ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray );
+ ImplWriteLineInfo( fLWidth, fMiterLimit, aCapType, aJoinType, l_aDashArray );
}
//---------------------------------------------------------------------------------
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx b/filter/source/graphicfilter/idxf/dxftblrd.cxx
index 9448cec5b63d..f99de87a6df7 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx
@@ -40,28 +40,42 @@ void DXFLType::Read(DXFGroupReader & rDGR)
{
switch (rDGR.GetG())
{
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 70: nFlags=rDGR.GetI(); break;
- case 3: strncpy( sDescription, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 73:
- if (nDashIndex!=-1) {
- rDGR.SetError();
- return;
- }
- nDashCount=rDGR.GetI();
- if (nDashCount>DXF_MAX_DASH_COUNT)
- nDashCount=DXF_MAX_DASH_COUNT;
- nDashIndex=0;
- break;
- case 40: fPatternLength=rDGR.GetF(); break;
- case 49:
- if (nDashCount==-1) {
- rDGR.SetError();
- return;
- }
- if (nDashIndex<nDashCount)
- fDash[nDashIndex++]=rDGR.GetF();
- break;
+ case 2:
+ strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sName[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 3:
+ strncpy( sDescription, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sDescription[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 70:
+ nFlags=rDGR.GetI();
+ break;
+ case 73:
+ if (nDashIndex!=-1)
+ {
+ rDGR.SetError();
+ return;
+ }
+ nDashCount=rDGR.GetI();
+ if (nDashCount>DXF_MAX_DASH_COUNT)
+ {
+ nDashCount=DXF_MAX_DASH_COUNT;
+ }
+ nDashIndex=0;
+ break;
+ case 40: fPatternLength=rDGR.GetF(); break;
+ case 49:
+ if (nDashCount==-1)
+ {
+ rDGR.SetError();
+ return;
+ }
+ if (nDashIndex<nDashCount)
+ {
+ fDash[nDashIndex++]=rDGR.GetF();
+ }
+ break;
}
}
}
@@ -79,12 +93,24 @@ DXFLayer::DXFLayer()
void DXFLayer::Read(DXFGroupReader & rDGR)
{
- while (rDGR.Read()!=0) {
- switch(rDGR.GetG()) {
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 70: nFlags=rDGR.GetI(); break;
- case 62: nColor=rDGR.GetI(); break;
- case 6: strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ while (rDGR.Read()!=0)
+ {
+ switch(rDGR.GetG())
+ {
+ case 2:
+ strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sName[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 6:
+ strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sLineType[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 70:
+ nFlags=rDGR.GetI();
+ break;
+ case 62:
+ nColor=rDGR.GetI();
+ break;
}
}
}
@@ -107,17 +133,40 @@ DXFStyle::DXFStyle()
void DXFStyle::Read(DXFGroupReader & rDGR)
{
- while (rDGR.Read()!=0) {
- switch(rDGR.GetG()) {
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 70: nFlags=rDGR.GetI(); break;
- case 40: fHeight=rDGR.GetF(); break;
- case 41: fWidthFak=rDGR.GetF(); break;
- case 50: fOblAngle=rDGR.GetF(); break;
- case 71: nTextGenFlags=rDGR.GetI(); break;
- case 42: fLastHeightUsed=rDGR.GetF(); break;
- case 3: strncpy( sPrimFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 4: strncpy( sBigFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ while (rDGR.Read()!=0)
+ {
+ switch(rDGR.GetG())
+ {
+ case 2:
+ strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sName[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 3:
+ strncpy( sPrimFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sPrimFontFile[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 4:
+ strncpy( sBigFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN );
+ sBigFontFile[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 70:
+ nFlags=rDGR.GetI();
+ break;
+ case 40:
+ fHeight=rDGR.GetF();
+ break;
+ case 41:
+ fWidthFak=rDGR.GetF();
+ break;
+ case 42:
+ fLastHeightUsed=rDGR.GetF();
+ break;
+ case 50:
+ fOblAngle=rDGR.GetF();
+ break;
+ case 71:
+ nTextGenFlags=rDGR.GetI();
+ break;
}
}
}
@@ -164,44 +213,49 @@ DXFVPort::DXFVPort()
void DXFVPort::Read(DXFGroupReader & rDGR)
{
- while (rDGR.Read()!=0) {
- switch(rDGR.GetG()) {
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1); break;
- case 70: nFlags=rDGR.GetI(); break;
- case 10: fMinX=rDGR.GetF(); break;
- case 20: fMinY=rDGR.GetF(); break;
- case 11: fMaxX=rDGR.GetF(); break;
- case 21: fMaxY=rDGR.GetF(); break;
- case 12: fCenterX=rDGR.GetF(); break;
- case 22: fCenterY=rDGR.GetF(); break;
- case 13: fSnapBaseX=rDGR.GetF(); break;
- case 23: fSnapBaseY=rDGR.GetF(); break;
- case 14: fSnapSapcingX=rDGR.GetF(); break;
- case 24: fSnapSpacingY=rDGR.GetF(); break;
- case 15: fGridX=rDGR.GetF(); break;
- case 25: fGridY=rDGR.GetF(); break;
- case 16: aDirection.fx=rDGR.GetF(); break;
- case 26: aDirection.fy=rDGR.GetF(); break;
- case 36: aDirection.fz=rDGR.GetF(); break;
- case 17: aTarget.fx=rDGR.GetF(); break;
- case 27: aTarget.fy=rDGR.GetF(); break;
- case 37: aTarget.fz=rDGR.GetF(); break;
- case 40: fHeight=rDGR.GetF(); break;
- case 41: fAspectRatio=rDGR.GetF(); break;
- case 42: fLensLength=rDGR.GetF(); break;
- case 43: fFrontClipPlane=rDGR.GetF(); break;
- case 44: fBackClipPlane=rDGR.GetF(); break;
- case 51: fTwistAngle=rDGR.GetF(); break;
- case 68: nStatus=rDGR.GetI(); break;
- case 69: nID=rDGR.GetI(); break;
- case 71: nMode=rDGR.GetI(); break;
- case 72: nCircleZoomPercent=rDGR.GetI(); break;
- case 73: nFastZoom=rDGR.GetI(); break;
- case 74: nUCSICON=rDGR.GetI(); break;
- case 75: nSnap=rDGR.GetI(); break;
- case 76: nGrid=rDGR.GetI(); break;
- case 77: nSnapStyle=rDGR.GetI(); break;
- case 78: nSnapIsopair=rDGR.GetI(); break;
+ while (rDGR.Read()!=0)
+ {
+ switch(rDGR.GetG())
+ {
+ case 2:
+ strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN);
+ sName[DXF_MAX_STRING_LEN] = 0;
+ break;
+ case 10: fMinX=rDGR.GetF(); break;
+ case 11: fMaxX=rDGR.GetF(); break;
+ case 12: fCenterX=rDGR.GetF(); break;
+ case 13: fSnapBaseX=rDGR.GetF(); break;
+ case 14: fSnapSapcingX=rDGR.GetF(); break;
+ case 15: fGridX=rDGR.GetF(); break;
+ case 16: aDirection.fx=rDGR.GetF(); break;
+ case 17: aTarget.fx=rDGR.GetF(); break;
+ case 20: fMinY=rDGR.GetF(); break;
+ case 21: fMaxY=rDGR.GetF(); break;
+ case 22: fCenterY=rDGR.GetF(); break;
+ case 23: fSnapBaseY=rDGR.GetF(); break;
+ case 24: fSnapSpacingY=rDGR.GetF(); break;
+ case 25: fGridY=rDGR.GetF(); break;
+ case 26: aDirection.fy=rDGR.GetF(); break;
+ case 27: aTarget.fy=rDGR.GetF(); break;
+ case 36: aDirection.fz=rDGR.GetF(); break;
+ case 37: aTarget.fz=rDGR.GetF(); break;
+ case 40: fHeight=rDGR.GetF(); break;
+ case 41: fAspectRatio=rDGR.GetF(); break;
+ case 42: fLensLength=rDGR.GetF(); break;
+ case 43: fFrontClipPlane=rDGR.GetF(); break;
+ case 44: fBackClipPlane=rDGR.GetF(); break;
+ case 51: fTwistAngle=rDGR.GetF(); break;
+ case 68: nStatus=rDGR.GetI(); break;
+ case 69: nID=rDGR.GetI(); break;
+ case 70: nFlags=rDGR.GetI(); break;
+ case 71: nMode=rDGR.GetI(); break;
+ case 72: nCircleZoomPercent=rDGR.GetI(); break;
+ case 73: nFastZoom=rDGR.GetI(); break;
+ case 74: nUCSICON=rDGR.GetI(); break;
+ case 75: nSnap=rDGR.GetI(); break;
+ case 76: nGrid=rDGR.GetI(); break;
+ case 77: nSnapStyle=rDGR.GetI(); break;
+ case 78: nSnapIsopair=rDGR.GetI(); break;
}
}
}
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
index abb28ef99b79..6f5fcce96f04 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -380,7 +380,7 @@ sal_Bool PBMReader::ImplReadBody()
nCount--;
if ( nGrey <= mnMaxVal )
nGrey = 255 * nGrey / mnMaxVal;
- mpAcc->SetPixel( nHeight, nWidth++, (sal_uInt8)nGrey );
+ mpAcc->SetPixel( nHeight, nWidth++, (sal_uInt8)nGrey );
nGrey = 0;
if ( nWidth == mnWidth )
{
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index 7a00af411362..01e18aca87bc 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -182,6 +182,9 @@ sal_Bool TGAReader::ImplReadHeader()
mpFileHeader->nColorMapXOrigin >> mpFileHeader->nColorMapYOrigin >> mpFileHeader->nImageWidth >>
mpFileHeader->nImageHeight >> mpFileHeader->nPixelDepth >> mpFileHeader->nImageDescriptor;
+ if ( !m_rTGA.good())
+ return sal_False;
+
if ( mpFileHeader->nColorMapType > 1 )
return sal_False;
if ( mpFileHeader->nColorMapType == 1 )
@@ -200,6 +203,10 @@ sal_Bool TGAReader::ImplReadHeader()
mpFileFooter->nSignature[0] >> mpFileFooter->nSignature[1] >> mpFileFooter->nSignature[2] >>
mpFileFooter->nSignature[3] >> mpFileFooter->nPadByte >> mpFileFooter->nStringTerminator;
+
+ if ( !m_rTGA.good())
+ return sal_False;
+
// check for sal_True, VISI, ON-X, FILE in the signatures
if ( mpFileFooter->nSignature[ 0 ] == (('T'<<24)|('R'<<16)|('U'<<8)|'E') &&
mpFileFooter->nSignature[ 1 ] == (('V'<<24)|('I'<<16)|('S'<<8)|'I') &&
@@ -211,6 +218,8 @@ sal_Bool TGAReader::ImplReadHeader()
{
m_rTGA.Seek( mpFileFooter->nExtensionFileOffset );
m_rTGA >> mpExtension->nExtensionSize;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( mpExtension->nExtensionSize >= SizeOfTGAExtension )
{
mnTGAVersion = 2;
@@ -228,6 +237,8 @@ sal_Bool TGAReader::ImplReadHeader()
>> mpExtension->nPostageStampOffset >> mpExtension->nScanLineOffset
>> mpExtension->nAttributesType;
+ if ( !m_rTGA.good())
+ return sal_False;
}
}
}
@@ -309,6 +320,8 @@ sal_Bool TGAReader::ImplReadBody()
while ( nYCount < mpFileHeader->nImageHeight )
{
m_rTGA >> nRunCount;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRunCount & 0x80 ) // a run length packet
{
m_rTGA >> nRGB16;
@@ -317,6 +330,8 @@ sal_Bool TGAReader::ImplReadBody()
nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 );
nGreen = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 8 );
nBlue = (sal_uInt8)( mpColorMap[ nRGB16 ] );
+ if ( !m_rTGA.good())
+ return sal_False;
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
@@ -339,11 +354,15 @@ sal_Bool TGAReader::ImplReadBody()
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
m_rTGA >> nRGB16;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRGB16 >= mpFileHeader->nColorMapLength )
return sal_False;
nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 );
nGreen = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 8 );
nBlue = (sal_uInt8)( mpColorMap[ nRGB16 ] );
+ if ( !m_rTGA.good())
+ return sal_False;
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
nX += nXAdd;
nXCount++;
@@ -367,9 +386,13 @@ sal_Bool TGAReader::ImplReadBody()
while ( nYCount < mpFileHeader->nImageHeight )
{
m_rTGA >> nRunCount;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRunCount & 0x80 ) // a run length packet
{
m_rTGA >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nDummy >= mpFileHeader->nColorMapLength )
return sal_False;
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
@@ -395,6 +418,8 @@ sal_Bool TGAReader::ImplReadBody()
{
m_rTGA >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nDummy >= mpFileHeader->nColorMapLength )
return sal_False;
mpAcc->SetPixel( nY, nX, (sal_uInt8)nDummy );
@@ -428,9 +453,13 @@ sal_Bool TGAReader::ImplReadBody()
while ( nYCount < mpFileHeader->nImageHeight )
{
m_rTGA >> nRunCount;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRunCount & 0x80 ) // a run length packet
{
m_rTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
@@ -453,6 +482,8 @@ sal_Bool TGAReader::ImplReadBody()
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
m_rTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
nX += nXAdd;
nXCount++;
@@ -477,9 +508,13 @@ sal_Bool TGAReader::ImplReadBody()
while ( nYCount < mpFileHeader->nImageHeight )
{
m_rTGA >> nRunCount;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRunCount & 0x80 ) // a run length packet
{
m_rTGA >> nBlue >> nGreen >> nRed;
+ if ( !m_rTGA.good())
+ return sal_False;
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
@@ -502,6 +537,8 @@ sal_Bool TGAReader::ImplReadBody()
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
m_rTGA >> nBlue >> nGreen >> nRed;
+ if ( !m_rTGA.good())
+ return sal_False;
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
nX += nXAdd;
nXCount++;
@@ -525,9 +562,13 @@ sal_Bool TGAReader::ImplReadBody()
while ( nYCount < mpFileHeader->nImageHeight )
{
m_rTGA >> nRunCount;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRunCount & 0x80 ) // a run length packet
{
m_rTGA >> nRGB16;
+ if ( !m_rTGA.good())
+ return sal_False;
nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8;
nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8;
nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8;
@@ -553,6 +594,8 @@ sal_Bool TGAReader::ImplReadBody()
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
m_rTGA >> nRGB16;
+ if ( !m_rTGA.good())
+ return sal_False;
nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8;
nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8;
nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8;
@@ -595,6 +638,8 @@ sal_Bool TGAReader::ImplReadBody()
for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
{
m_rTGA >> nRGB16;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nRGB16 >= mpFileHeader->nColorMapLength )
return sal_False;
nRed = (sal_uInt8)( mpColorMap[ nRGB16 ] >> 16 );
@@ -609,6 +654,8 @@ sal_Bool TGAReader::ImplReadBody()
for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
{
m_rTGA >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
if ( nDummy >= mpFileHeader->nColorMapLength )
return sal_False;
mpAcc->SetPixel( nY, nX, (sal_uInt8)nDummy );
@@ -628,6 +675,8 @@ sal_Bool TGAReader::ImplReadBody()
for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
{
m_rTGA >> nBlue >> nGreen >> nRed >> nDummy;
+ if ( !m_rTGA.good())
+ return sal_False;
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
}
}
@@ -638,6 +687,8 @@ sal_Bool TGAReader::ImplReadBody()
for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
{
m_rTGA >> nBlue >> nGreen >> nRed;
+ if ( !m_rTGA.good())
+ return sal_False;
mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) );
}
break;
@@ -647,6 +698,8 @@ sal_Bool TGAReader::ImplReadBody()
for (;nXCount < mpFileHeader->nImageWidth; nXCount++, nX += nXAdd )
{
m_rTGA >> nRGB16;
+ if ( !m_rTGA.good())
+ return sal_False;
nRed = (sal_uInt8)( nRGB16 >> 7 ) & 0xf8;
nGreen = (sal_uInt8)( nRGB16 >> 2 ) & 0xf8;
nBlue = (sal_uInt8)( nRGB16 << 3 ) & 0xf8;
@@ -713,6 +766,8 @@ sal_Bool TGAReader::ImplReadPalette()
{
sal_uInt16 nTemp;
m_rTGA >> nTemp;
+ if ( !m_rTGA.good() )
+ return sal_False;
mpColorMap[ i ] = ( ( nTemp & 0x7c00 ) << 9 ) + ( ( nTemp & 0x01e0 ) << 6 ) +
( ( nTemp & 0x1f ) << 3 );
}
diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx
new file mode 100644
index 000000000000..c3ade4dfc055
--- /dev/null
+++ b/filter/source/msfilter/dffpropset.cxx
@@ -0,0 +1,1344 @@
+/* -*- 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 <filter/msfilter/dffpropset.hxx>
+#include <rtl/ustrbuf.hxx>
+
+static const DffPropSetEntry mso_PropSetDefaults[] = {
+
+// 0
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+
+// 64
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_LockAgainstGrouping
+
+// 128
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0010 }, // DFF_Prop_FitTextToShape
+
+// 192
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_gtextFStrikethrough
+
+//256
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_pictureActive
+
+// 320
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0039 }, // DFF_Prop_fFillOK
+
+// 384
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0xffffff }, // DFF_Prop_fillColor
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x001c }, // DFF_Prop_fNoFillHitTest
+
+// 448
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x001e }, // DFF_Prop_fNoLineDrawDash
+
+// 512
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_fshadowObscured
+
+// 576
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_fPerspective
+
+// 640
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0001 }, // DFF_Prop_fc3DLightFace
+
+// 704
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0016 }, // DFF_Prop_fc3DFillHarsh
+
+// 768
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0 }, // DFF_Prop_fBackground
+
+// 832
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0010 }, // DFF_Prop_fCalloutLengthSpecified
+
+// 896
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { true, false, false, true }, 0, 0x0001 }, // DFF_Prop_fPrint
+
+// 960
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 },
+{ { false, false, false, false }, 0, 0 }
+
+};
+
+DffPropSet::DffPropSet()
+{
+ mpPropSetEntries = reinterpret_cast< DffPropSetEntry* >( new sal_uInt8[ 1024 * sizeof( DffPropSetEntry ) ] );
+}
+
+DffPropSet::~DffPropSet()
+{
+ delete[] reinterpret_cast< sal_uInt8* >( mpPropSetEntries );
+}
+
+void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly )
+{
+ DffRecordHeader aHd;
+ rIn >> aHd;
+
+ if ( !bSetUninitializedOnly )
+ {
+ InitializePropSet( aHd.nRecType );
+ maOffsets.clear();
+ }
+
+ sal_uInt32 nPropCount = aHd.nRecInstance;
+
+ // FilePos der ComplexData merken
+ sal_uInt32 nComplexDataFilePos = rIn.Tell() + ( nPropCount * 6 );
+
+ for( sal_uInt32 nPropNum = 0; nPropNum < nPropCount; nPropNum++ )
+ {
+ sal_uInt16 nTmp;
+ sal_uInt32 nRecType, nContent;
+ rIn >> nTmp
+ >> nContent;
+
+ nRecType = nTmp & 0x3fff;
+
+ if ( nRecType > 0x3ff )
+ break;
+ if ( ( nRecType & 0x3f ) == 0x3f )
+ {
+ if ( bSetUninitializedOnly )
+ {
+ sal_uInt32 nCurrentFlags = mpPropSetEntries[ nRecType ].nContent;
+ sal_uInt32 nMergeFlags = nContent;
+
+ nMergeFlags &= ( nMergeFlags >> 16 ) | 0xffff0000; // clearing low word
+ nMergeFlags &= ( ( nCurrentFlags & 0xffff0000 ) // remove allready hard set
+ | ( nCurrentFlags >> 16 ) ) ^ 0xffffffff; // attributes from mergeflags
+ nCurrentFlags &= ( ( nMergeFlags & 0xffff0000 ) // apply zero master bits
+ | ( nMergeFlags >> 16 ) ) ^ 0xffffffff;
+ nCurrentFlags |= (sal_uInt16)nMergeFlags; // apply filled master bits
+ mpPropSetEntries[ nRecType ].nContent = nCurrentFlags;
+ mpPropSetEntries[ nRecType ].nComplexIndexOrFlagsHAttr |= static_cast< sal_uInt16 >( nContent >> 16 );
+ }
+ else
+ {
+ // clear flags that have to be cleared
+ mpPropSetEntries[ nRecType ].nContent &= ( ( nContent >> 16 ) ^ 0xffffffff );
+ // set flags that have to be set
+ mpPropSetEntries[ nRecType ].nContent |= nContent;
+ mpPropSetEntries[ nRecType ].nComplexIndexOrFlagsHAttr = static_cast< sal_uInt16 >( nContent >> 16 );
+ }
+ }
+ else
+ {
+ bool bSetProperty = !bSetUninitializedOnly || ( !IsProperty( nRecType ) || !IsHardAttribute( nRecType ) );
+
+ DffPropFlags aPropFlag = { 1, 0, 0, 0 };
+ if ( nTmp & 0x4000 )
+ aPropFlag.bBlip = sal_True;
+ if ( nTmp & 0x8000 )
+ aPropFlag.bComplex = sal_True;
+ if ( aPropFlag.bComplex && nContent && ( nComplexDataFilePos < aHd.GetRecEndFilePos() ) )
+ {
+ // normally nContent is the complete size of the complex property,
+ // but this is not always true for IMsoArrays ( what the hell is a IMsoArray ? )
+
+ // I love special threatments :-(
+ if ( ( nRecType == DFF_Prop_pVertices ) || ( nRecType == DFF_Prop_pSegmentInfo )
+ || ( nRecType == DFF_Prop_fillShadeColors ) || ( nRecType == DFF_Prop_lineDashStyle )
+ || ( nRecType == DFF_Prop_pWrapPolygonVertices ) || ( nRecType == DFF_Prop_connectorPoints )
+ || ( nRecType == DFF_Prop_Handles ) || ( nRecType == DFF_Prop_pFormulas )
+ || ( nRecType == DFF_Prop_textRectangles ) )
+ {
+ // now check if the current content size is possible, or 6 bytes too small
+ sal_uInt32 nOldPos = rIn.Tell();
+ sal_Int16 nNumElem, nNumElemReserved, nSize;
+
+ rIn.Seek( nComplexDataFilePos );
+ rIn >> nNumElem >> nNumElemReserved >> nSize;
+ if ( nNumElemReserved >= nNumElem )
+ {
+ // the size of these array elements is nowhere defined,
+ // what if the size is negative ?
+ // ok, we will make it positive and shift it.
+ // for -16 this works
+ if ( nSize < 0 )
+ nSize = ( -nSize ) >> 2;
+ sal_uInt32 nDataSize = (sal_uInt32)( nSize * nNumElem );
+
+ // sometimes the content size is 6 bytes too small (array header information is missing )
+ if ( nDataSize == nContent )
+ nContent += 6;
+
+ // check if array fits into the PropertyContainer
+ if ( ( nComplexDataFilePos + nContent ) > aHd.GetRecEndFilePos() )
+ nContent = 0;
+ }
+ else
+ nContent = 0;
+ rIn.Seek( nOldPos );
+ }
+ if ( nContent )
+ {
+ if ( bSetProperty )
+ {
+ mpPropSetEntries[ nRecType ].nComplexIndexOrFlagsHAttr = static_cast< sal_uInt16 >( maOffsets.size() );
+ maOffsets.push_back( nComplexDataFilePos ); // insert the filepos of this property;
+ }
+ nComplexDataFilePos += nContent; // store filepos, that is used for the next complex property
+ }
+ else // a complex property needs content
+ aPropFlag.bSet = sal_False; // otherwise something is wrong
+ }
+ if ( bSetProperty )
+ {
+ mpPropSetEntries[ nRecType ].nContent = nContent;
+ mpPropSetEntries[ nRecType ].aFlags = aPropFlag;
+ }
+ }
+ }
+ aHd.SeekToEndOfRecord( rIn );
+}
+
+SvStream& operator>>( SvStream& rIn, DffPropSet& rRec )
+{
+ rRec.ReadPropSet( rIn, false );
+ return rIn;
+}
+
+SvStream& operator|=( SvStream& rIn, DffPropSet& rRec )
+{
+ rRec.ReadPropSet( rIn, true );
+ return rIn;
+}
+
+void DffPropSet::InitializePropSet( sal_uInt16 nPropSetType ) const
+{
+ /*
+ cmc:
+ " Boolean properties are grouped in bitfields by property set; note that
+ the Boolean properties in each property set are contiguous. They are saved
+ under the property ID of the last Boolean property in the set, and are
+ placed in the value field in reverse order starting with the last property
+ in the low bit. "
+
+ e.g.
+
+ fEditedWrap
+ fBehindDocument
+ fOnDblClickNotify
+ fIsButton
+ fOneD
+ fHidden
+ fPrint
+
+ are all part of a group and all are by default false except for fPrint,
+ which equates to a default bit sequence for the group of 0000001 -> 0x1
+
+ If at a later stage word sets fBehindDocument away from the default it
+ will be done by having a property named fPrint whose bitsequence will have
+ the fBehindDocument bit set. e.g. a DFF_Prop_fPrint with value 0x200020
+ has set bit 6 on so as to enable fBehindDocument (as well as disabling
+ everything else)
+ */
+ if ( nPropSetType == DFF_msofbtOPT )
+ {
+ memcpy( mpPropSetEntries, mso_PropSetDefaults, 0x400 * sizeof( DffPropSetEntry ) );
+ }
+ else
+ {
+ memset( mpPropSetEntries, 0, 0x400 * sizeof( DffPropSetEntry ) );
+ }
+}
+
+sal_Bool DffPropSet::IsHardAttribute( sal_uInt32 nId ) const
+{
+ sal_Bool bRetValue = sal_True;
+ nId &= 0x3ff;
+ if ( ( nId & 0x3f ) >= 48 ) // is this a flag id
+ bRetValue = ( mpPropSetEntries[ nId ].nComplexIndexOrFlagsHAttr & ( 1 << ( 0xf - ( nId & 0xf ) ) ) ) != 0;
+ else
+ bRetValue = ( mpPropSetEntries[ nId ].aFlags.bSoftAttr == 0 );
+ return bRetValue;
+};
+
+sal_uInt32 DffPropSet::GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault ) const
+{
+ nId &= 0x3ff;
+ return ( mpPropSetEntries[ nId ].aFlags.bSet ) ? mpPropSetEntries[ nId ].nContent : nDefault;
+};
+
+bool DffPropSet::GetPropertyBool( sal_uInt32 nId, bool bDefault ) const
+{
+ sal_uInt32 nBaseId = nId | 31; // base ID to get the sal_uInt32 property value
+ sal_uInt32 nMask = 1 << (nBaseId - nId); // bit mask of the boolean property
+
+ sal_uInt32 nPropValue = GetPropertyValue( nBaseId, bDefault ? nMask : 0 );
+ return (nPropValue & nMask) != 0;
+}
+
+::rtl::OUString DffPropSet::GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const
+{
+ sal_Size nOldPos = rStrm.Tell();
+ ::rtl::OUStringBuffer aBuffer;
+ sal_uInt32 nBufferSize = GetPropertyValue( nId );
+ if( (nBufferSize > 0) && SeekToContent( nId, rStrm ) )
+ {
+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufferSize / 2 );
+ //clip initial size of buffer to something sane in case of silly length
+ //strings. If there really is a silly amount of data available it still
+ //works out ok of course
+ aBuffer.ensureCapacity(std::min(nStrLen,static_cast<sal_Int32>(8192)));
+ for( sal_Int32 nCharIdx = 0; nCharIdx < nStrLen; ++nCharIdx )
+ {
+ sal_uInt16 nChar = 0;
+ rStrm >> nChar;
+ if( nChar > 0 )
+ aBuffer.append( static_cast< sal_Unicode >( nChar ) );
+ else
+ break;
+ }
+ }
+ rStrm.Seek( nOldPos );
+ return aBuffer.makeStringAndClear();
+}
+
+void DffPropSet::SetPropertyValue( sal_uInt32 nId, sal_uInt32 nValue ) const
+{
+ nId &= 0x3ff;
+ mpPropSetEntries[ nId ].aFlags.bSet = true;
+ mpPropSetEntries[ nId ].nContent = nValue;
+};
+
+sal_Bool DffPropSet::SeekToContent( sal_uInt32 nRecType, SvStream& rStrm ) const
+{
+ nRecType &= 0x3ff;
+ if ( mpPropSetEntries[ nRecType ].aFlags.bSet )
+ {
+ if ( mpPropSetEntries[ nRecType ].aFlags.bComplex )
+ {
+ sal_uInt16 nIndex = mpPropSetEntries[ nRecType ].nComplexIndexOrFlagsHAttr;
+ if ( nIndex < maOffsets.size() )
+ {
+ rStrm.Seek( maOffsets[ nIndex ] );
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xsltfilter/XSLTFilter.jar.component b/filter/source/msfilter/dffrecordheader.cxx
index 35d104ab264c..74c2c8566456 100644
--- a/filter/source/xsltfilter/XSLTFilter.jar.component
+++ b/filter/source/msfilter/dffrecordheader.cxx
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+/* -*- 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
@@ -15,11 +15,27 @@
* 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 .
- -->
+ */
-<component loader="com.sun.star.loader.Java2"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="XSLTransformer">
- <service name="com.sun.star.comp.JAXTHelper"/>
- </implementation>
-</component>
+#include <filter/msfilter/dffrecordheader.hxx>
+
+SvStream& operator>>( SvStream& rIn, DffRecordHeader& rRec )
+{
+ rRec.nFilePos = rIn.Tell();
+ sal_uInt16 nTmp(0);
+ rIn >> nTmp;
+ rRec.nImpVerInst = nTmp;
+ rRec.nRecVer = sal::static_int_cast< sal_uInt8 >(nTmp & 0x000F);
+ rRec.nRecInstance = nTmp >> 4;
+ rIn >> rRec.nRecType;
+ rIn >> rRec.nRecLen;
+
+ // preserving overflow, optimally we would check
+ // the record size against the parent header
+ if ( rRec.nRecLen > ( SAL_MAX_UINT32 - rRec.nFilePos ) )
+ rIn.SetError( SVSTREAM_FILEFORMAT_ERROR );
+
+ return rIn;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index fd2ef5288f6b..33314f4c70f8 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * 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 "eschesdo.hxx"
#include <filter/msfilter/escherex.hxx>
@@ -54,6 +45,7 @@
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/BezierPoint.hpp>
@@ -849,6 +841,35 @@ void EscherPropertyContainer::CreateLineProperties(
AddOpt( ESCHER_Prop_lineEndArrowhead, eLineEnd );
nLineFlags |= 0x100010;
}
+
+ // support LineCaps
+ if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, String(RTL_CONSTASCII_USTRINGPARAM("LineCap")), sal_False))
+ {
+ ::com::sun::star::drawing::LineCap aLineCap(com::sun::star::drawing::LineCap_BUTT);
+
+ if(aAny >>= aLineCap)
+ {
+ switch (aLineCap)
+ {
+ default: /* com::sun::star::drawing::LineCap_BUTT */
+ {
+ AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapFlat);
+ break;
+ }
+ case com::sun::star::drawing::LineCap_ROUND:
+ {
+ AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapRound);
+ break;
+ }
+ case com::sun::star::drawing::LineCap_SQUARE:
+ {
+ AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapSquare);
+ break;
+ }
+ }
+ }
+ }
+
if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineStyle" ) ), sal_False ) )
{
@@ -4091,7 +4112,8 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( sal_Bool bFirst )
}
else if ( nGluePointType == com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
{
- SdrObject* pPoly = pCustoShape->DoConvertToPolyObj( sal_True );
+ // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE
+ SdrObject* pPoly = pCustoShape->DoConvertToPolyObj( sal_True /*, true */ );
if ( pPoly && pPoly->ISA( SdrPathObj ) )
{
sal_Int16 a, b, nIndex = 0;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 066c84922569..9081122bb4ce 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+ * 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 <com/sun/star/embed/Aspects.hpp>
@@ -41,6 +31,8 @@
#include <unotools/streamwrap.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/seqstream.hxx>
+#include <comphelper/storagehelper.hxx>
#include <sot/exchange.hxx>
#include <sot/storinfo.hxx>
#include <vcl/cvtgrf.hxx>
@@ -205,319 +197,11 @@ void Impl_OlePres::Write( SvStream & rStm )
rStm.Seek( nEndPos );
}
-//---------------------------------------------------------------------------
-// Hilfs Klassen aus MSDFFDEF.HXX
-//---------------------------------------------------------------------------
-
-SvStream& operator>>( SvStream& rIn, DffRecordHeader& rRec )
-{
- rRec.nFilePos = rIn.Tell();
- sal_uInt16 nTmp(0);
- rIn >> nTmp;
- rRec.nImpVerInst = nTmp;
- rRec.nRecVer = sal::static_int_cast< sal_uInt8 >(nTmp & 0x000F);
- rRec.nRecInstance = nTmp >> 4;
- rIn >> rRec.nRecType;
- rIn >> rRec.nRecLen;
- return rIn;
-}
-
-SvStream& operator>>( SvStream& rIn, DffPropSet& rRec )
-{
- rRec.InitializePropSet();
-
- DffRecordHeader aHd;
- rIn >> aHd;
- sal_uInt32 nPropCount = aHd.nRecInstance;
-
- // remember FilePos of the ComplexData
- sal_uInt32 nComplexDataFilePos = rIn.Tell() + ( nPropCount * 6 );
-
- for( sal_uInt32 nPropNum = 0; nPropNum < nPropCount; nPropNum++ )
- {
- sal_uInt16 nTmp;
- sal_uInt32 nRecType, nContent, nContentEx = 0xffff0000;
- rIn >> nTmp
- >> nContent;
-
- nRecType = nTmp & 0x3fff;
-
- if ( nRecType > 0x3ff )
- break;
- if ( ( nRecType & 0x3f ) == 0x3f )
- { // clear flags that have to be cleared
- rRec.mpContents[ nRecType ] &= ( ( nContent >> 16 ) ^ 0xffffffff );
- // set flags that have to be set
- rRec.mpContents[ nRecType ] |= nContent;
- nContentEx |= ( nContent >> 16 );
- rRec.maRecordTypes[ nRecType ] = nContentEx;
- }
- else
- {
- DffPropFlags aPropFlag = { 1, 0, 0, 0 };
- if ( nTmp & 0x4000 )
- aPropFlag.bBlip = sal_True;
- if ( nTmp & 0x8000 )
- aPropFlag.bComplex = sal_True;
- if ( aPropFlag.bComplex && nContent && ( nComplexDataFilePos < aHd.GetRecEndFilePos() ) )
- {
- // normally nContent is the complete size of the complex property,
- // but this is not always true for IMsoArrays ( what the hell is a IMsoArray ? )
-
- // I love special treatments :-(
- if ( ( nRecType == DFF_Prop_pVertices ) || ( nRecType == DFF_Prop_pSegmentInfo )
- || ( nRecType == DFF_Prop_fillShadeColors ) || ( nRecType == DFF_Prop_lineDashStyle )
- || ( nRecType == DFF_Prop_pWrapPolygonVertices ) || ( nRecType == DFF_Prop_connectorPoints )
- || ( nRecType == DFF_Prop_Handles ) || ( nRecType == DFF_Prop_pFormulas )
- || ( nRecType == DFF_Prop_textRectangles ) )
- {
- // now check if the current content size is possible, or 6 bytes too small
- sal_uInt32 nOldPos = rIn.Tell();
- sal_Int16 nNumElem, nNumElemReserved, nSize;
-
- rIn.Seek( nComplexDataFilePos );
- rIn >> nNumElem >> nNumElemReserved >> nSize;
- if ( nNumElemReserved >= nNumElem )
- {
- // the size of these array elements is nowhere defined,
- // what if the size is negative ?
- // ok, we will make it positive and shift it.
- // for -16 this works
- if ( nSize < 0 )
- nSize = ( -nSize ) >> 2;
- sal_uInt32 nDataSize = (sal_uInt32)( nSize * nNumElem );
-
- // sometimes the content size is 6 bytes too small (array header information is missing )
- if ( nDataSize == nContent )
- nContent += 6;
-
- // check if array fits into the PropertyContainer
- if ( ( nComplexDataFilePos + nContent ) > aHd.GetRecEndFilePos() )
- nContent = 0;
- }
- else
- nContent = 0;
- rIn.Seek( nOldPos );
- }
- if ( nContent )
- {
- nContentEx = nComplexDataFilePos; // insert the filepos of this property;
- nComplexDataFilePos += nContent; // store filepos, that is used for the next complex property
- }
- else // a complex property needs content
- aPropFlag.bSet = sal_False; // otherwise something is wrong
- }
- rRec.mpContents[ nRecType ] = nContent;
- rRec.mpFlags[ nRecType ] = aPropFlag;
- rRec.maRecordTypes[ nRecType ] = nContentEx;
- }
- }
- aHd.SeekToEndOfRecord( rIn );
- return rIn;
-}
-
-void DffPropSet::InitializePropSet() const
-{
- /*
- cmc:
- " Boolean properties are grouped in bitfields by property set; note that
- the Boolean properties in each property set are contiguous. They are saved
- under the property ID of the last Boolean property in the set, and are
- placed in the value field in reverse order starting with the last property
- in the low bit. "
-
- e.g.
-
- fEditedWrap
- fBehindDocument
- fOnDblClickNotify
- fIsButton
- fOneD
- fHidden
- fPrint
-
- are all part of a group and all are by default false except for fPrint,
- which equates to a default bit sequence for the group of 0000001 -> 0x1
-
- If at a later stage word sets fBehindDocument away from the default it
- will be done by having a property named fPrint whose bitsequence will have
- the fBehindDocument bit set. e.g. a DFF_Prop_fPrint with value 0x200020
- has set bit 6 on so as to enable fBehindDocument (as well as disabling
- everything else)
- */
-
- DffPropSet* self = (DffPropSet*) this;
- memset( self->mpFlags, 0, 0x400 * sizeof(DffPropFlags) );
- self->maRecordTypes.clear();
-
- DffPropFlags nFlags = { 1, 0, 0, 1 };
-
- //0x01ff0000;
- InitializeProp( DFF_Prop_LockAgainstGrouping, 0x0000, nFlags, 0xffff0000 );
- //0x001f0010;
- InitializeProp( DFF_Prop_FitTextToShape, 0x0010, nFlags, 0xffff0000 );
- //0xffff0000;
- InitializeProp( DFF_Prop_gtextFStrikethrough, 0x0000, nFlags, 0xffff0000 );
- //0x000f0000;
- InitializeProp( DFF_Prop_pictureActive, 0x0000, nFlags, 0xffff0000 );
- //0x003f0039;
- InitializeProp( DFF_Prop_fFillOK, 0x0039, nFlags, 0xffff0000 );
- //0x001f001c;
- InitializeProp( DFF_Prop_fNoFillHitTest, 0x001c, nFlags, 0xffff0000 );
- //0x001f000e;
- InitializeProp( DFF_Prop_fNoLineDrawDash, 0x001e, nFlags, 0xffff0000 );
- //0x00030000;
- InitializeProp( DFF_Prop_fshadowObscured, 0x0000, nFlags, 0xffff0000 );
- //0x00010000;
- InitializeProp( DFF_Prop_fPerspective, 0x0000, nFlags, 0xffff0000 );
- //0x000f0001;
- InitializeProp( DFF_Prop_fc3DLightFace, 0x0001, nFlags, 0xffff0000 );
- //0x001f0016;
- InitializeProp( DFF_Prop_fc3DFillHarsh, 0x0016, nFlags, 0xffff0000 );
- //0x001f0000;
- InitializeProp( DFF_Prop_fBackground, 0x0000, nFlags, 0xffff0000 );
- //0x00ef0010;
- InitializeProp( DFF_Prop_fCalloutLengthSpecified, 0x0010, nFlags, 0xffff0000 );
- //0x00ef0001;
- InitializeProp( DFF_Prop_fPrint, 0x0001, nFlags, 0xffff0000 );
-
- InitializeProp( DFF_Prop_fillColor, 0xffffff, nFlags, 0xffff0000 );
-}
-
-void DffPropSet::InitializeProp(sal_uInt32 nKey, sal_uInt32 nContent, DffPropFlags& rFlags, sal_uInt32 nRecordType ) const
-{
- DffPropSet* self = (DffPropSet*) this;
- self->mpContents[ nKey ] = nContent;
- self->mpFlags[ nKey ] = rFlags;
- self->maRecordTypes[ nKey ] = nRecordType;
-}
-
-
-void DffPropSet::Merge( DffPropSet& rMaster ) const
-{
- for ( RecordTypesMap::const_iterator it = rMaster.maRecordTypes.begin();
- it != rMaster.maRecordTypes.end(); ++it )
- {
- sal_uInt32 nRecType = it->first;
- if ( ( nRecType & 0x3f ) == 0x3f ) // this is something called FLAGS
- {
- sal_uInt32 nCurrentFlags = mpContents[ nRecType ];
- sal_uInt32 nMergeFlags = rMaster.mpContents[ nRecType ];
- nMergeFlags &= ( nMergeFlags >> 16 ) | 0xffff0000; // clearing low word
- nMergeFlags &= ( ( nCurrentFlags & 0xffff0000 ) // remove already hard set
- | ( nCurrentFlags >> 16 ) ) ^ 0xffffffff; // attributes from mergeflags
- nCurrentFlags &= ( ( nMergeFlags & 0xffff0000 ) // apply zero master bits
- | ( nMergeFlags >> 16 ) ) ^ 0xffffffff;
- nCurrentFlags |= (sal_uInt16)nMergeFlags; // apply filled master bits
- ( (DffPropSet*) this )->mpContents[ nRecType ] = nCurrentFlags;
-
-
- sal_uInt32 nNewContentEx = it->second;
- RecordTypesMap::const_iterator it2 = maRecordTypes.find( nRecType );
- if ( it2 != maRecordTypes.end() )
- nNewContentEx |= it2->second;
- ( (DffPropSet*) this )->maRecordTypes[ nRecType ] = nNewContentEx;
- }
- else
- {
- if ( !IsProperty( nRecType ) || !IsHardAttribute( nRecType ) )
- {
- ( (DffPropSet*) this )->mpContents[ nRecType ] = rMaster.mpContents[ nRecType ];
- DffPropFlags nFlags( rMaster.mpFlags[ nRecType ] );
- nFlags.bSoftAttr = sal_True;
- ( (DffPropSet*) this )->mpFlags[ nRecType ] = nFlags;
- ( (DffPropSet*) this )->maRecordTypes[ nRecType ] = it->second;
- }
- }
- }
-}
-
-sal_Bool DffPropSet::IsHardAttribute( sal_uInt32 nId ) const
-{
- sal_Bool bRetValue = sal_True;
- nId &= 0x3ff;
- if ( ( nId & 0x3f ) >= 48 ) // is this a flag id
- {
- RecordTypesMap::const_iterator it = maRecordTypes.find( nId | 0x3f );
- if ( it != maRecordTypes.end() )
- {
- sal_uInt32 nContentEx = it->second;
- bRetValue = ( nContentEx & ( 1 << ( 0xf - ( nId & 0xf ) ) ) ) != 0;
- }
- }
- else
- bRetValue = ( mpFlags[ nId ].bSoftAttr == 0 );
- return bRetValue;
-};
-
-sal_uInt32 DffPropSet::GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault ) const
-{
- nId &= 0x3ff;
- return ( mpFlags[ nId ].bSet ) ? mpContents[ nId ] : nDefault;
-};
-
-bool DffPropSet::GetPropertyBool( sal_uInt32 nId, bool bDefault ) const
-{
- sal_uInt32 nBaseId = nId | 31; // base ID to get the sal_uInt32 property value
- sal_uInt32 nMask = 1 << (nBaseId - nId); // bit mask of the boolean property
-
- sal_uInt32 nPropValue = GetPropertyValue( nBaseId, bDefault ? nMask : 0 );
- return (nPropValue & nMask) != 0;
-}
-
-::rtl::OUString DffPropSet::GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const
-{
- sal_Size nOldPos = rStrm.Tell();
- ::rtl::OUStringBuffer aBuffer;
- sal_uInt32 nBufferSize = GetPropertyValue( nId );
- if( (nBufferSize > 0) && SeekToContent( nId, rStrm ) )
- {
- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufferSize / 2 );
- //clip initial size of buffer to something sane in case of silly length
- //strings. If there really is a silly amount of data available it still
- //works out ok of course
- aBuffer.ensureCapacity(std::min(nStrLen,static_cast<sal_Int32>(8192)));
- for( sal_Int32 nCharIdx = 0; nCharIdx < nStrLen; ++nCharIdx )
- {
- sal_uInt16 nChar = 0;
- rStrm >> nChar;
- if( nChar > 0 )
- aBuffer.append( static_cast< sal_Unicode >( nChar ) );
- else
- break;
- }
- }
- rStrm.Seek( nOldPos );
- return aBuffer.makeStringAndClear();
-}
-
-sal_Bool DffPropSet::SeekToContent( sal_uInt32 nRecType, SvStream& rStrm ) const
-{
- nRecType &= 0x3ff;
- if ( mpFlags[ nRecType ].bSet )
- {
- if ( mpFlags[ nRecType ].bComplex )
- {
- RecordTypesMap::const_iterator it = maRecordTypes.find( nRecType );
- if ( it != maRecordTypes.end() )
- {
- sal_uInt32 nOffset = it->second;
- if ( nOffset && ( ( nOffset & 0xffff0000 ) != 0xffff0000 ) )
- {
- rStrm.Seek( nOffset );
- return sal_True;
- }
- }
- }
- }
- return sal_False;
-}
-
DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
rManager( rMan ),
pDefaultPropSet( NULL )
{
- InitializePropSet();
+ InitializePropSet( DFF_msofbtOPT );
}
void DffPropertyReader::SetDefaultPropSet( SvStream& rStCtrl, sal_uInt32 nOffsDgg ) const
@@ -555,9 +239,7 @@ void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const
rIn >> aRecHd;
if ( rManager.SeekToRec( rIn, DFF_msofbtOPT, aRecHd.GetRecEndFilePos() ) )
{
- DffPropSet aMasterPropSet;
- rIn >> aMasterPropSet;
- Merge( aMasterPropSet );
+ rIn |= (DffPropertyReader&)*this;
}
}
}
@@ -1217,22 +899,43 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
if ( nLineFlags & 8 )
{
- // Linienattribute
+ // Line Attributes
sal_Int32 nLineWidth = (sal_Int32)GetPropertyValue( DFF_Prop_lineWidth, 9525 );
+ // support LineCap
+ const MSO_LineCap eLineCap((MSO_LineCap)GetPropertyValue(DFF_Prop_lineEndCapStyle, mso_lineEndCapSquare));
+
+ switch(eLineCap)
+ {
+ default: /* case mso_lineEndCapFlat */
+ {
+ // no need to set, it is the default. If this changes, this needs to be activated
+ // rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_BUTT));
+ break;
+ }
+ case mso_lineEndCapRound:
+ {
+ rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_ROUND));
+ break;
+ }
+ case mso_lineEndCapSquare:
+ {
+ rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_SQUARE));
+ break;
+ }
+ }
+
MSO_LineDashing eLineDashing = (MSO_LineDashing)GetPropertyValue( DFF_Prop_lineDashing, mso_lineSolid );
if ( eLineDashing == mso_lineSolid )
rSet.Put(XLineStyleItem( XLINE_SOLID ) );
else
{
-// MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle, mso_lineEndCapSquare );
-
XDashStyle eDash = XDASH_RECT;
sal_uInt16 nDots = 1;
sal_uInt32 nDotLen = nLineWidth / 360;
sal_uInt16 nDashes = 0;
sal_uInt32 nDashLen = ( 8 * nLineWidth ) / 360;
- sal_uInt32 nDistance = ( 3 * nLineWidth ) / 360;;
+ sal_uInt32 nDistance = ( 3 * nLineWidth ) / 360;
switch ( eLineDashing )
{
@@ -1349,24 +1052,6 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
rSet.Put( XLineEndItem( aArrowName, aPolyPoly ) );
rSet.Put( XLineEndCenterItem( bArrowCenter ) );
}
- if ( IsProperty( DFF_Prop_lineEndCapStyle ) )
- {
- MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle );
- const SfxPoolItem* pPoolItem = NULL;
- if ( rSet.GetItemState( XATTR_LINEDASH, sal_False, &pPoolItem ) == SFX_ITEM_SET )
- {
- XDashStyle eNewStyle = XDASH_RECT;
- if ( eLineCap == mso_lineEndCapRound )
- eNewStyle = XDASH_ROUND;
- const XDash& rOldDash = ( (const XLineDashItem*)pPoolItem )->GetDashValue();
- if ( rOldDash.GetDashStyle() != eNewStyle )
- {
- XDash aNew( rOldDash );
- aNew.SetDashStyle( eNewStyle );
- rSet.Put( XLineDashItem( rtl::OUString(), aNew ) );
- }
- }
- }
}
}
else
@@ -2890,91 +2575,65 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const
ApplyAttributes( rIn, rSet, aDffObjTemp );
}
-void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const
+void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const
{
sal_Bool bHasShadow = sal_False;
- for ( RecordTypesMap::const_iterator it = maRecordTypes.begin(); it != maRecordTypes.end(); ++it )
+ if ( IsProperty( DFF_Prop_gtextSize ) )
+ rSet.Put( SvxFontHeightItem( rManager.ScalePt( GetPropertyValue( DFF_Prop_gtextSize ) ), 100, EE_CHAR_FONTHEIGHT ) );
+ sal_uInt32 nFontAttributes = GetPropertyValue( DFF_Prop_gtextFStrikethrough );
+ if ( nFontAttributes & 0x20 )
+ rSet.Put( SvxWeightItem( nFontAttributes & 0x20 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ if ( nFontAttributes & 0x10 )
+ rSet.Put( SvxPostureItem( nFontAttributes & 0x10 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
+ if ( nFontAttributes & 0x08 )
+ rSet.Put( SvxUnderlineItem( nFontAttributes & 0x08 ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
+ if ( nFontAttributes & 0x40 )
+ rSet.Put( SvxShadowedItem( ( nFontAttributes & 0x40 ) != 0, EE_CHAR_SHADOW ) );
+// if ( nFontAttributes & 0x02 )
+// rSet.Put( SvxCaseMapItem( nFontAttributes & 0x02 ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) );
+ if ( nFontAttributes & 0x01 )
+ rSet.Put( SvxCrossedOutItem( nFontAttributes & 0x01 ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
+ if ( IsProperty( DFF_Prop_fillColor ) )
+ rSet.Put( XFillColorItem( String(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ) ) );
+ if ( IsProperty( DFF_Prop_shadowType ) )
{
- sal_uInt32 nRecType = it->first;
- sal_uInt32 nContent = mpContents[ nRecType ];
- switch ( nRecType )
+ MSO_ShadowType eShadowType = static_cast< MSO_ShadowType >( GetPropertyValue( DFF_Prop_shadowType ) );
+ if( eShadowType != mso_shadowOffset )
{
- case DFF_Prop_gtextSize :
- rSet.Put( SvxFontHeightItem( rManager.ScalePt( nContent ), 100, EE_CHAR_FONTHEIGHT ) );
- break;
- // GeoText
- case DFF_Prop_gtextFStrikethrough :
- {
- if ( nContent & 0x20 )
- rSet.Put( SvxWeightItem( nContent ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
- if ( nContent & 0x10 )
- rSet.Put( SvxPostureItem( nContent ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
- if ( nContent & 0x08 )
- rSet.Put( SvxUnderlineItem( nContent ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
- if ( nContent & 0x40 )
- rSet.Put(SvxShadowedItem( nContent != 0, EE_CHAR_SHADOW ) );
- if ( nContent & 0x01 )
- rSet.Put( SvxCrossedOutItem( nContent ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) );
- }
- break;
-
- case DFF_Prop_fillColor :
- rSet.Put( XFillColorItem( rtl::OUString(), rManager.MSO_CLR_ToColor( nContent, DFF_Prop_fillColor ) ) );
- break;
-
- // ShadowStyle
- case DFF_Prop_shadowType :
- {
- MSO_ShadowType eShadowType = (MSO_ShadowType)nContent;
- if( eShadowType != mso_shadowOffset )
- {
- // mso_shadowDouble
- // mso_shadowRich
- // mso_shadowEmbossOrEngrave
- // not possible in LibreOffice, create default shadow with default distance
- rSet.Put( SdrShadowXDistItem( 35 ) ); // 0,35 mm shadow distance
- rSet.Put( SdrShadowYDistItem( 35 ) );
- }
- }
- break;
- case DFF_Prop_shadowColor :
- rSet.Put( SdrShadowColorItem( rtl::OUString(), rManager.MSO_CLR_ToColor( nContent, DFF_Prop_shadowColor ) ) );
- break;
- case DFF_Prop_shadowOpacity :
- rSet.Put( SdrShadowTransparenceItem( (sal_uInt16)( ( 0x10000 - nContent ) / 655 ) ) );
- break;
- case DFF_Prop_shadowOffsetX :
- {
- sal_Int32 nVal = (sal_Int32)nContent;
- rManager.ScaleEmu( nVal );
- if ( nVal )
- rSet.Put( SdrShadowXDistItem( nVal ) );
- }
- break;
- case DFF_Prop_shadowOffsetY :
- {
- sal_Int32 nVal = (sal_Int32)nContent;
- rManager.ScaleEmu( nVal );
- if ( nVal )
- rSet.Put( SdrShadowYDistItem( nVal ) );
- }
- break;
- case DFF_Prop_fshadowObscured :
- {
- bHasShadow = ( nContent & 2 ) != 0;
- if ( bHasShadow )
- {
- if ( !IsProperty( DFF_Prop_shadowOffsetX ) )
- rSet.Put( SdrShadowXDistItem( 35 ) );
- if ( !IsProperty( DFF_Prop_shadowOffsetY ) )
- rSet.Put( SdrShadowYDistItem( 35 ) );
- }
- }
- break;
+ rSet.Put( SdrShadowXDistItem( 35 ) ); // 0,35 mm Schattendistanz
+ rSet.Put( SdrShadowYDistItem( 35 ) );
+ }
+ }
+ if ( IsProperty( DFF_Prop_shadowColor ) )
+ rSet.Put( SdrShadowColorItem( String(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_shadowColor ), DFF_Prop_shadowColor ) ) );
+ if ( IsProperty( DFF_Prop_shadowOpacity ) )
+ rSet.Put( SdrShadowTransparenceItem( (sal_uInt16)( ( 0x10000 - GetPropertyValue( DFF_Prop_shadowOpacity ) ) / 655 ) ) );
+ if ( IsProperty( DFF_Prop_shadowOffsetX ) )
+ {
+ sal_Int32 nVal = static_cast< sal_Int32 >( GetPropertyValue( DFF_Prop_shadowOffsetX ) );
+ rManager.ScaleEmu( nVal );
+ if ( nVal )
+ rSet.Put( SdrShadowXDistItem( nVal ) );
+ }
+ if ( IsProperty( DFF_Prop_shadowOffsetY ) )
+ {
+ sal_Int32 nVal = static_cast< sal_Int32 >( GetPropertyValue( DFF_Prop_shadowOffsetY ) );
+ rManager.ScaleEmu( nVal );
+ if ( nVal )
+ rSet.Put( SdrShadowYDistItem( nVal ) );
+ }
+ if ( IsProperty( DFF_Prop_fshadowObscured ) )
+ {
+ bHasShadow = ( GetPropertyValue( DFF_Prop_fshadowObscured ) & 2 ) != 0;
+ if ( bHasShadow )
+ {
+ if ( !IsProperty( DFF_Prop_shadowOffsetX ) )
+ rSet.Put( SdrShadowXDistItem( 35 ) );
+ if ( !IsProperty( DFF_Prop_shadowOffsetY ) )
+ rSet.Put( SdrShadowYDistItem( 35 ) );
}
}
-
if ( bHasShadow )
{
// #160376# sj: activating shadow only if fill and or linestyle is used
@@ -3018,6 +2677,105 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const
{
ApplyCustomShapeGeometryAttributes( rIn, rSet, rObjData );
ApplyCustomShapeTextAttributes( rSet );
+ if ( rManager.GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL )
+ {
+ if ( mnFix16Angle || ( rObjData.nSpFlags & SP_FFLIPV ) )
+ CheckAndCorrectExcelTextRotation( rIn, rSet, rObjData );
+ }
+ }
+}
+
+void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const
+{
+ sal_Bool bRotateTextWithShape = rObjData.bRotateTextWithShape;
+ if ( rObjData.bOpt2 ) // sj: #158494# is the second property set available ? if then we have to check the xml data of
+ { // the shape, because the textrotation of Excel 2003 and greater versions is stored there
+ // (upright property of the textbox)
+ if ( rManager.pSecPropSet->SeekToContent( DFF_Prop_metroBlob, rIn ) )
+ {
+ sal_uInt32 nLen = rManager.pSecPropSet->GetPropertyValue( DFF_Prop_metroBlob );
+ if ( nLen )
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aXMLDataSeq( nLen );
+ rIn.Read( aXMLDataSeq.getArray(), nLen );
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream
+ ( new ::comphelper::SequenceInputStream( aXMLDataSeq ) );
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if ( xFactory.is() )
+ {
+ ::com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage
+ ( ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
+ OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xFactory, sal_True ) );
+ if ( xStorage.is() )
+ {
+ const rtl::OUString sDRS( RTL_CONSTASCII_USTRINGPARAM ( "drs" ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ xStorageDRS( xStorage->openStorageElement( sDRS, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
+ if ( xStorageDRS.is() )
+ {
+ const rtl::OUString sShapeXML( RTL_CONSTASCII_USTRINGPARAM ( "shapexml.xml" ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xShapeXMLStream( xStorageDRS->openStreamElement( sShapeXML, ::com::sun::star::embed::ElementModes::SEEKABLEREAD ) );
+ if ( xShapeXMLStream.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xShapeXMLInputStream( xShapeXMLStream->getInputStream() );
+ if ( xShapeXMLInputStream.is() )
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+ sal_Int32 nBytesRead = xShapeXMLInputStream->readBytes( aSeq, 0x7fffffff );
+ if ( nBytesRead )
+ { // for only one property I spare to use a XML parser at this point, this
+ // should be enhanced if needed
+
+ bRotateTextWithShape = sal_True; // using the correct xml default
+ const char* pArry = reinterpret_cast< char* >( aSeq.getArray() );
+ const char* pUpright = "upright=";
+ const char* pEnd = pArry + nBytesRead;
+ const char* pPtr = pArry;
+ while( ( pPtr + 12 ) < pEnd )
+ {
+ if ( !memcmp( pUpright, pPtr, 8 ) )
+ {
+ bRotateTextWithShape = ( pPtr[ 9 ] != '1' ) && ( pPtr[ 9 ] != 't' );
+ break;
+ }
+ else
+ pPtr++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ if ( !bRotateTextWithShape )
+ {
+ const com::sun::star::uno::Any* pAny, aAny;
+ SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&)rSet.Get( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
+ const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ pAny = aGeometryItem.GetPropertyValueByName( sTextRotateAngle );
+ double fExtraTextRotateAngle = 0.0;
+ if ( pAny )
+ *pAny >>= fExtraTextRotateAngle;
+
+ if ( rManager.mnFix16Angle )
+ fExtraTextRotateAngle += mnFix16Angle / 100.0;
+ if ( rObjData.nSpFlags & SP_FFLIPV )
+ fExtraTextRotateAngle -= 180.0;
+
+ com::sun::star::beans::PropertyValue aTextRotateAngle;
+ aTextRotateAngle.Name = sTextRotateAngle;
+ aTextRotateAngle.Value <<= fExtraTextRotateAngle;
+ aGeometryItem.SetPropertyValue( aTextRotateAngle );
+ rSet.Put( aGeometryItem );
}
}
@@ -3374,7 +3132,7 @@ sal_Bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, s
bool SvxMSDffManager::SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMaxFilePos, DffRecordHeader* pRecHd, sal_uLong nSkipCount ) const
{
bool bRet = sal_False;
- sal_uLong nFPosMerk = rSt.Tell(); // FilePos merken fuer ggf. spaetere Restauration
+ sal_uLong nFPosMerk = rSt.Tell(); // store FilePos to restore it later if necessary
DffRecordHeader aHd;
do
{
@@ -3405,7 +3163,7 @@ bool SvxMSDffManager::SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMa
}
while ( rSt.good() && rSt.Tell() < nMaxFilePos && !bRet );
if ( !bRet )
- rSt.Seek( nFPosMerk ); // restore FilePos
+ rSt.Seek( nFPosMerk ); // restore original FilePos
return bRet;
}
@@ -3433,7 +3191,7 @@ bool SvxMSDffManager::SeekToRec2( sal_uInt16 nRecId1, sal_uInt16 nRecId2, sal_uL
if ( !bRet )
aHd.SeekToEndOfRecord( rStCtrl );
}
- while ( rStCtrl.GetError() == 0 && rStCtrl.Tell() < nMaxFilePos && !bRet );
+ while ( rStCtrl.good() && rStCtrl.Tell() < nMaxFilePos && !bRet );
if ( !bRet )
rStCtrl.Seek( nFPosMerk ); // restore FilePos
return bRet;
@@ -3697,32 +3455,6 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte
return aColor;
}
-rtl::OUString SvxMSDffManager::ReadDffString(SvStream& rSt, DffRecordHeader aStrHd)
-{
- String aRet;
- if( aStrHd.nRecType == 0x0 && !ReadCommonRecordHeader(aStrHd, rSt) )
- rSt.Seek( aStrHd.nFilePos );
- else if ( aStrHd.nRecType == DFF_PST_TextBytesAtom || aStrHd.nRecType == DFF_PST_TextCharsAtom )
- {
- bool bUniCode=aStrHd.nRecType==DFF_PST_TextCharsAtom;
- sal_uInt32 nBytes = aStrHd.nRecLen;
- aRet = MSDFFReadZString( rSt, nBytes, bUniCode );
- if( !bUniCode )
- {
- for ( xub_StrLen n = 0; n < nBytes; n++ )
- {
- if( aRet.GetChar( n ) == 0x0B )
- aRet.SetChar( n, ' ' ); // Weicher Umbruch
- // TODO: Zeilenumbruch im Absatz via Outliner setzen.
- }
- }
- aStrHd.SeekToEndOfRecord( rSt );
- }
- else
- aStrHd.SeekToBegOfRecord( rSt );
- return aRet;
-}
-
// sj: I just want to set a string for a text object that may contain multiple
// paragraphs. If I now take a look at the follwing code I get the impression that
// our outliner is too complicate to be used properly,
@@ -3786,185 +3518,6 @@ void SvxMSDffManager::ReadObjText( const String& rText, SdrObject* pObj ) const
}
}
-bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj)
-{
- bool bRet=sal_False;
- SdrTextObj* pText = PTR_CAST(SdrTextObj, pObj);
- if( pText )
- {
- DffRecordHeader aTextHd;
- if( !ReadCommonRecordHeader(aTextHd, rSt) )
- rSt.Seek( aTextHd.nFilePos );
- else if ( aTextHd.nRecType==DFF_msofbtClientTextbox || aTextHd.nRecType == 0x1022 )
- {
- bRet=sal_True;
- sal_uLong nRecEnd=aTextHd.GetRecEndFilePos();
- DffRecordHeader aHd;
- String aText;
-
- SdrOutliner& rOutliner=pText->ImpGetDrawOutliner();
- sal_uInt16 nOutlMode = rOutliner.GetMode();
-
- { // apparently a small bug in the EditEngine which causes
- // the paragraph attributes not to be delted on Clear()
- bool bClearParaAttribs = true;
- rOutliner.SetStyleSheet( 0, NULL );
- SfxItemSet aSet(rOutliner.GetEmptyItemSet());
- aSet.Put(SvxColorItem( COL_BLACK ));
- rOutliner.SetParaAttribs(0,aSet);
- pText->SetMergedItemSet(aSet);
-
- bClearParaAttribs = sal_False;
- if( bClearParaAttribs )
- {
- // apparently a small bug in the EditEngine which causes
- // the paragraph attributes not to be delted on Clear()
- rOutliner.SetParaAttribs(0,rOutliner.GetEmptyItemSet());
- }
- }
- rOutliner.Init( OUTLINERMODE_TEXTOBJECT );
-
- ///////////////////////////////////
- // read TextString and MetaChars //
- ///////////////////////////////////
- do
- {
- if( !ReadCommonRecordHeader(aHd, rSt) )
- rSt.Seek( aHd.nFilePos );
- else
- {
- switch (aHd.nRecType)
- {
- default:
- break;
- //case DFF_PST_TextHeaderAtom:
- //case TextSpecInfoAtom
- case DFF_PST_TextBytesAtom:
- case DFF_PST_TextCharsAtom:
- aText = ReadDffString(rSt, aHd);
- break;
- case DFF_PST_TextRulerAtom :
- {
- sal_uInt16 nLen = (sal_uInt16)aHd.nRecLen;
- if(nLen)
- {
- sal_uInt32 nMask;
- sal_uInt16 nVal1, nVal2, nVal3;
- sal_uInt16 nDefaultTab = 2540; // PPT def: 1 Inch //rOutliner.GetDefTab();
- sal_uInt16 nMostrightTab = 0;
- SfxItemSet aSet(rOutliner.GetEmptyItemSet());
- SvxTabStopItem aTabItem(0, 0, SVX_TAB_ADJUST_DEFAULT, EE_PARA_TABS);
-
- rSt >> nMask;
- nLen -= 4;
-
- if(nLen && (nMask & 0x0002))
- {
- // number of indent levels
- rSt >> nVal3;
- nLen -= 2;
- }
-
- // Allg. TAB verstellt auf Wert in nVal3
- if(nLen && (nMask & 0x0001))
- {
- rSt >> nVal3;
- nLen -= 2;
- nDefaultTab = (sal_uInt16)(((sal_uInt32)nVal3 * 1000) / 240);
- }
-
- // Weitere, frei gesetzte TABs
- if(nLen && (nMask & 0x0004))
- {
- rSt >> nVal1;
- nLen -= 2;
-
- // fest gesetzte TABs importieren
- while(nLen && nVal1--)
- {
- rSt >> nVal2;
- rSt >> nVal3;
- nLen -= 4;
-
- sal_uInt16 nNewTabPos = (sal_uInt16)(((sal_uInt32)nVal2 * 1000) / 240);
- if(nNewTabPos > nMostrightTab)
- nMostrightTab = nNewTabPos;
-
- SvxTabStop aTabStop(nNewTabPos);
- aTabItem.Insert(aTabStop);
- }
- }
-
- // evtl. noch default-TABs ergaenzen (immer)
- sal_uInt16 nObjWidth = sal_uInt16(pObj->GetSnapRect().GetWidth() + 1);
- sal_uInt16 nDefaultTabPos = nDefaultTab;
-
- while(nDefaultTabPos <= nObjWidth && nDefaultTabPos <= nMostrightTab)
- nDefaultTabPos =
- nDefaultTabPos + nDefaultTab;
-
- while(nDefaultTabPos <= nObjWidth)
- {
- SvxTabStop aTabStop(nDefaultTabPos);
- aTabItem.Insert(aTabStop);
- nDefaultTabPos =
- nDefaultTabPos + nDefaultTab;
- }
-
- // Falls TABs angelegt wurden, setze diese
- if(aTabItem.Count())
- {
- aSet.Put(aTabItem);
- rOutliner.SetParaAttribs(0, aSet);
- }
- }
- }
- break;
- }
- aHd.SeekToEndOfRecord( rSt );
- }
- }
- while ( rSt.GetError() == 0 && rSt.Tell() < nRecEnd );
-
- ////////////////////////
- // replace SHIFT-Ret //
- ////////////////////////
- if ( aText.Len() )
- {
- aText += ' ';
- aText.SetChar( aText.Len()-1, 0x0D );
- rOutliner.SetText( aText, rOutliner.GetParagraph( 0 ) );
-
- // replace SHIFT-Ret in the Outliner
- if (comphelper::string::getTokenCount(aText, 0x0B) > 1)
- {
- sal_uInt32 nParaCount = rOutliner.GetParagraphCount();
- for(sal_uInt16 a=0;a<nParaCount;a++)
- {
- Paragraph* pActPara = rOutliner.GetParagraph(a);
- String aParaText = rOutliner.GetText(pActPara);
- for(sal_uInt16 b=0;b<aParaText.Len();b++)
- {
- if( aParaText.GetChar( b ) == 0x0B)
- {
- ESelection aSelection(a, b, a, b+1);
- rOutliner.QuickInsertLineBreak(aSelection);
- }
- }
- }
- }
- }
- OutlinerParaObject* pNewText=rOutliner.CreateParaObject();
- rOutliner.Init( nOutlMode );
- pText->NbcSetOutlinerParaObject(pNewText);
- }
- else
- aTextHd.SeekToBegOfRecord(rSt);
-
- }
- return bRet;
-}
-
//static
rtl::OUString SvxMSDffManager::MSDFFReadZString(SvStream& rIn,
sal_uInt32 nLen, bool bUniCode)
@@ -4442,6 +3995,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
return pRet;
DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
+ aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0;
maShapeRecords.Consume( rSt, sal_False );
aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
if ( aObjData.bShapeType )
@@ -4473,10 +4027,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
else
{
- InitializePropSet(); // get the default PropSet
+ InitializePropSet( DFF_msofbtOPT ); // get the default PropSet
( (DffPropertyReader*) this )->mnFix16Angle = 0;
}
+ aObjData.bOpt2 = maShapeRecords.SeekToContent( rSt, DFF_msofbtUDefProp, SEEK_FROM_CURRENT_AND_RESTART );
+ if ( aObjData.bOpt2 )
+ {
+ maShapeRecords.Current()->SeekToBegOfRecord( rSt );
+ pSecPropSet = new DffPropertyReader( *this );
+ pSecPropSet->ReadPropSet( rSt, NULL );
+ }
+
aObjData.bChildAnchor = maShapeRecords.SeekToContent( rSt, DFF_msofbtChildAnchor, SEEK_FROM_CURRENT_AND_RESTART );
if ( aObjData.bChildAnchor )
{
@@ -5756,6 +5318,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
pStData2( pStData2_ ),
nSvxMSDffSettings( 0 ),
nSvxMSDffOLEConvFlags( 0 ),
+ pSecPropSet( NULL ),
mnDefaultColor( mnDefaultColor_),
mbTracing( sal_False )
{
@@ -5800,6 +5363,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const String& rBaseURL )
pStData2( 0 ),
nSvxMSDffSettings( 0 ),
nSvxMSDffOLEConvFlags( 0 ),
+ pSecPropSet( NULL ),
mnDefaultColor( COL_DEFAULT ),
mbTracing( sal_False )
{
@@ -5808,6 +5372,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const String& rBaseURL )
SvxMSDffManager::~SvxMSDffManager()
{
+ delete pSecPropSet;
delete pBLIPInfos;
delete pShapeOrders;
delete pFormModel;
@@ -6009,7 +5574,7 @@ void SvxMSDffManager::GetCtrlData( sal_uInt32 nOffsDgg_ )
if( !bOk )
{
- nPos++;
+ nPos++; // ????????? TODO: trying to get an one-hit wonder, this code code should be rewritten...
if (nPos != rStCtrl.Seek(nPos))
break;
bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength )
@@ -6022,7 +5587,7 @@ void SvxMSDffManager::GetCtrlData( sal_uInt32 nOffsDgg_ )
nPos += DFF_COMMON_RECORD_HEADER_SIZE + nLength;
++nDrawingContainerId;
}
- while( nPos < nMaxStrPos && bOk );
+ while( ( rStCtrl.GetError() == 0 ) && ( nPos < nMaxStrPos ) && bOk );
}
}
@@ -6967,7 +6532,6 @@ sal_Bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen,
break;
}
- String aShort, aFull;
if( pIds->nId )
{
// found!
diff --git a/filter/source/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx
index 3459e6b229bc..0d1049e24d06 100644
--- a/filter/source/msfilter/viscache.hxx
+++ b/filter/source/msfilter/viscache.hxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * 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 <tools/stream.hxx>
#include <vcl/gdimtf.hxx>
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index cad9039a9a53..5db1e551554c 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -185,12 +186,8 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
if (!getDelegate().is())
{
- OUString SAX_WRITER_SERVICE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"));
- Reference< XDocumentHandler > saxWriter(m_rServiceFactory->createInstance(SAX_WRITER_SERVICE),
- UNO_QUERY);
+ Reference< XDocumentHandler > saxWriter( Writer::create(comphelper::getComponentContext(m_rServiceFactory)), UNO_QUERY_THROW );
setDelegate(saxWriter);
- if (!getDelegate().is())
- return sal_False;
}
// get data source interface ...
Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY);
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index a0ff05b6d120..4289a30abb67 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+ * 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 "svgwriter.hxx"
#include "svgfontexport.hxx"
@@ -35,6 +25,7 @@
#include <com/sun/star/util/MeasureUnit.hpp>
#include <com/sun/star/text/textfield/Type.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <rtl/bootstrap.hxx>
#include <svtools/miscopt.hxx>
@@ -51,16 +42,11 @@
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
#include <xmloff/animationexport.hxx>
-
#include <boost/preprocessor/repetition/repeat.hpp>
-
using ::rtl::OUString;
using namespace ::com::sun::star;
-
-
-
// -------------------------------
// - ooo elements and attributes -
// -------------------------------
@@ -639,7 +625,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
{
if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() )
{
- Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
+ Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ), UNO_QUERY );
if( xDocHandler.is() )
{
@@ -714,24 +700,14 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
// -----------------------------------------------------------------------------
-Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
+Reference< XWriter > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
{
- Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
- Reference< XDocumentHandler > xSaxWriter;
+ Reference< XWriter > xSaxWriter;
- if( xMgr.is() && rxOStm.is() )
+ if( rxOStm.is() )
{
- xSaxWriter = Reference< XDocumentHandler >( xMgr->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
-
- if( xSaxWriter.is() )
- {
- Reference< XActiveDataSource > xActiveDataSource( xSaxWriter, UNO_QUERY );
-
- if( xActiveDataSource.is() )
- xActiveDataSource->setOutputStream( rxOStm );
- else
- xSaxWriter = NULL;
- }
+ xSaxWriter = Writer::create( ::comphelper::getProcessComponentContext() );
+ xSaxWriter->setOutputStream( rxOStm );
}
return xSaxWriter;
@@ -1359,7 +1335,7 @@ sal_Bool SVGFilter::implExportTextEmbeddedBitmaps()
// specifying the wanted position, they will result
// misplaced.
pAction->Move( -aPt.X(), -aPt.Y() );
- mpSVGWriter->WriteMetaFile( aTopLeft, aSize, aMtf, SVGWRITER_WRITE_ALL, NULL );
+ mpSVGWriter->WriteMetaFile( aTopLeft, aSize, aMtf, 0xffffffff, NULL );
// We reset to the original values so that when the <use>
// element is created the x, y attributes are correct.
pAction->Move( aPt.X(), aPt.Y() );
@@ -1827,7 +1803,7 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
{
SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
- SVGWRITER_WRITE_ALL,
+ 0xffffffff,
pElementId,
&rxShape,
pEmbeddedBitmapsMtf );
@@ -1987,7 +1963,6 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & r
// We create a set of bitmaps embedded into text shape.
GDIMetaFile aMtf;
- const Point aNullPt;
const Size aSize( pObj->GetCurrentBoundRect().GetSize() );
MetaAction* pAction;
sal_Bool bIsTextShapeStarted = sal_False;
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index c5567dfe7de1..9624614c26f3 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -50,6 +50,7 @@
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
@@ -308,7 +309,7 @@ private:
sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
- Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
+ Reference< XWriter > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
sal_Bool implGetPagePropSet( const Reference< XDrawPage > & rxPage );
sal_Bool implGenerateMetaData();
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 147f3f3b71c9..ecbc844c60b5 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -1168,7 +1168,7 @@ struct AnnotatingVisitor
const ARGBColor& rInheritColor,
const Gradient& rInheritGradient )
{
- std::pair<const char*,const char*> aPaintUri(NULL,NULL);
+ std::pair<const char*,const char*> aPaintUri((const char*)NULL,(const char*)NULL);
std::pair<ARGBColor,bool> aColor(maCurrState.maCurrentColor,
false);
if( strcmp(sValue,"none") == 0 )
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 2e7316b8ebcc..cf1602fdbc0b 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1,31 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+ * 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 "svgfilter.hxx"
#include "svgfontexport.hxx"
@@ -97,6 +87,8 @@ static const char aXMLAttrGradientUnits[] = "gradientUnits";
static const char aXMLAttrPatternUnits[] = "patternUnits";
static const char aXMLAttrOffset[] = "offset";
static const char aXMLAttrStopColor[] = "stop-color";
+static const char aXMLAttrStrokeLinejoin[] = "stroke-linejoin";
+static const char aXMLAttrStrokeLinecap[] = "stroke-linecap";
#define NSPREFIX "ooo:"
@@ -2033,6 +2025,7 @@ PolyPolygon& SVGActionWriter::ImplMap( const PolyPolygon& rPolyPoly, PolyPolygon
aPathData += ::rtl::OUString::valueOf( aPolyPoint.Y() );
sal_Char nCurrentMode = 0;
+ const bool bClose(!bLine || rPoly[0] == rPoly[nSize - 1]);
while( n < nSize )
{
aPathData += aBlank;
@@ -2066,7 +2059,7 @@ PolyPolygon& SVGActionWriter::ImplMap( const PolyPolygon& rPolyPoly, PolyPolygon
}
}
- if( !bLine )
+ if(bClose)
aPathData += B2UCONST( " Z" );
if( i < ( nCount - 1 ) )
@@ -2218,6 +2211,51 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape, sal_Bool
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStrokeWidth, ::rtl::OUString::valueOf( nStrokeWidth ) );
}
+ // support for LineJoin
+ switch(rShape.maLineJoin)
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
+ case basegfx::B2DLINEJOIN_MITER:
+ {
+ // miter is Svg default, so no need to write until the exporter might write styles.
+ // If this happens, activate here
+ // mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinejoin, ::rtl::OUString::createFromAscii("miter"));
+ break;
+ }
+ case basegfx::B2DLINEJOIN_BEVEL:
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinejoin, ::rtl::OUString::createFromAscii("bevel"));
+ break;
+ }
+ case basegfx::B2DLINEJOIN_ROUND:
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinejoin, ::rtl::OUString::createFromAscii("round"));
+ break;
+ }
+ }
+
+ // support for LineCap
+ switch(rShape.maLineCap)
+ {
+ default: /* com::sun::star::drawing::LineCap_BUTT */
+ {
+ // butt is Svg default, so no need to write until the exporter might write styles.
+ // If this happens, activate here
+ // mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinecap, ::rtl::OUString::createFromAscii("butt"));
+ break;
+ }
+ case com::sun::star::drawing::LineCap_ROUND:
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinecap, ::rtl::OUString::createFromAscii("round"));
+ break;
+ }
+ case com::sun::star::drawing::LineCap_SQUARE:
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrStrokeLinecap, ::rtl::OUString::createFromAscii("square"));
+ break;
+ }
+ }
+
if( rShape.maDashArray.size() )
{
const ::rtl::OUString aComma( B2UCONST( "," ) );
@@ -2787,7 +2825,10 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
}
if( bCont )
+ {
+ // #118796# do NOT access pDXArray, it may be zero (!)
nX = aPos.X() + pDX[ nCurPos - 1 ];
+ }
}
}
}
@@ -2901,6 +2942,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const Reference< XShape >* pxShape,
const GDIMetaFile* pTextEmbeddedBitmapMtf )
{
+ // need a counter fo rthe actions written per shape to avoid double ID
+ // generation
+ sal_Int32 nEntryCount(0);
+
if( mnInnerMtfCount )
nWriteFlags |= SVGWRITER_NO_SHAPE_COMMENTS;
@@ -3279,7 +3324,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape.reset( new SVGShapeDescriptor );
if( pElementId )
- mapCurShape->maId = *pElementId;
+ {
+ mapCurShape->maId = *pElementId + B2UCONST("_") + ::rtl::OUString::valueOf(nEntryCount++);
+ }
mapCurShape->maShapePolyPoly = aShapePolyPoly;
mapCurShape->maShapeFillColor = aFill.getFillColor();
@@ -3345,14 +3392,30 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( bSkip )
{
- if( !mapCurShape.get() )
+ Polygon aPoly;
+
+ aStroke.getPath(aPoly);
+
+ if(mapCurShape.get())
{
- Polygon aPoly;
+ if(1 != mapCurShape->maShapePolyPoly.Count()
+ || !mapCurShape->maShapePolyPoly[0].IsEqual(aPoly))
+ {
+ // this path action is not covering the same path than the already existing
+ // fill polypolygon, so write out the fill polygon
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
+ }
+ }
+ if( !mapCurShape.get() )
+ {
mapCurShape.reset( new SVGShapeDescriptor );
if( pElementId )
- mapCurShape->maId = *pElementId;
+ {
+ mapCurShape->maId = *pElementId + B2UCONST("_") + ::rtl::OUString::valueOf(nEntryCount++);
+ }
aStroke.getPath( aPoly );
mapCurShape->maShapePolyPoly = aPoly;
@@ -3364,6 +3427,46 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
aStroke.getDashArray( mapCurShape->maDashArray );
}
+ // support for LineJoin
+ switch(aStroke.getJoinType())
+ {
+ default: /* SvtGraphicStroke::joinMiter, SvtGraphicStroke::joinNone */
+ {
+ mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_MITER;
+ break;
+ }
+ case SvtGraphicStroke::joinRound:
+ {
+ mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_ROUND;
+ break;
+ }
+ case SvtGraphicStroke::joinBevel:
+ {
+ mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_BEVEL;
+ break;
+ }
+ }
+
+ // support for LineCap
+ switch(aStroke.getCapType())
+ {
+ default: /* SvtGraphicStroke::capButt */
+ {
+ mapCurShape->maLineCap = com::sun::star::drawing::LineCap_BUTT;
+ break;
+ }
+ case SvtGraphicStroke::capRound:
+ {
+ mapCurShape->maLineCap = com::sun::star::drawing::LineCap_ROUND;
+ break;
+ }
+ case SvtGraphicStroke::capSquare:
+ {
+ mapCurShape->maLineCap = com::sun::star::drawing::LineCap_SQUARE;
+ break;
+ }
+ }
+
// write open shape in every case
if( mapCurShape.get() )
{
@@ -3682,24 +3785,6 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
break;
- case( META_RENDERGRAPHIC_ACTION ):
- {
- if( nWriteFlags & SVGWRITER_WRITE_FILL )
- {
- // TODO KA: try to embed the native data in case the RenderGraphic
- // contains valid SVG data (MimeType "image/svg+xml")
- // => incorporate 'use' or 'image' element (KA 01/2011)
- const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*) pAction;
- const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic() );
- const Point aPointPixel;
- const Size aSizePixel( mpVDev->LogicToPixel( pA->GetSize() ) );
- const BitmapEx aBmpEx( aRasterizer.Rasterize( aSizePixel ) );
-
- ImplWriteBmp( aBmpEx, pA->GetPoint(), pA->GetSize(), aPointPixel, aBmpEx.GetSizePixel() );
- }
- }
- break;
-
case( META_CLIPREGION_ACTION ):
case( META_ISECTRECTCLIPREGION_ACTION ):
case( META_ISECTREGIONCLIPREGION_ACTION ):
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 7f79f6ffaade..ebffda9a5f10 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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/.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * 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 .
+ */
#ifndef SVGWRITER_HXX
#define SVGWRITER_HXX
@@ -40,7 +31,6 @@
#include <vcl/virdev.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/graphictools.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/nmspmap.hxx>
@@ -98,7 +88,6 @@ using namespace ::com::sun::star::style;
#define SVGWRITER_WRITE_FILL 0x00000001
#define SVGWRITER_WRITE_TEXT 0x00000002
#define SVGWRITER_NO_SHAPE_COMMENTS 0x01000000
-#define SVGWRITER_WRITE_ALL 0xFFFFFFFF
// ----------------------
// - SVGAttributeWriter -
@@ -120,6 +109,9 @@ private:
SvXMLElementExport* mpElemFont;
SvXMLElementExport* mpElemPaint;
+ basegfx::B2DLineJoin maLineJoin;
+ com::sun::star::drawing::LineCap maLineCap;
+
SVGAttributeWriter();
double ImplRound( double fVal, sal_Int32 nDecs = 3 );
@@ -129,8 +121,6 @@ public:
SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFontExport );
virtual ~SVGAttributeWriter();
- ::rtl::OUString GetFontStyle( const Font& rFont );
- ::rtl::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo );
void AddColorAttr( const char* pColorAttrName, const char* pColorOpacityAttrName, const Color& rColor );
void AddGradientDef( const Rectangle& rObjRect,const Gradient& rGradient, ::rtl::OUString& rGradientId );
void AddPaintAttr( const Color& rLineColor, const Color& rFillColor,
@@ -154,12 +144,17 @@ struct SVGShapeDescriptor
::std::auto_ptr< Gradient > mapShapeGradient;
::rtl::OUString maId;
+ basegfx::B2DLineJoin maLineJoin;
+ com::sun::star::drawing::LineCap maLineCap;
+
// -------------------------------------------------------------------------
SVGShapeDescriptor() :
maShapeFillColor( Color( COL_TRANSPARENT ) ),
maShapeLineColor( Color( COL_TRANSPARENT ) ),
- mnStrokeWidth( 0 )
+ mnStrokeWidth( 0 ),
+ maLineJoin(basegfx::B2DLINEJOIN_MITER), // miter is Svg 'stroke-linejoin' default
+ maLineCap(com::sun::star::drawing::LineCap_BUTT) // butt is Svg 'stroke-linecap' default
{
}
};
diff --git a/filter/source/svg/tokenmap.cxx b/filter/source/svg/tokenmap.cxx
index 79107d3400ff..7bf6fd1c885e 100644
--- a/filter/source/svg/tokenmap.cxx
+++ b/filter/source/svg/tokenmap.cxx
@@ -1,20 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * 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/.
*
- * Author:
- * Fridrich Strba <fridrich.strba@bluewin.ch>
- * Thorsten Behrens <tbehrens@novell.com>
+ * This file incorporates work covered by the following license notice:
*
- * Copyright (C) 2008, Novell Inc.
- * Parts copyright 2005 by Sun Microsystems, Inc.
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 3.
- *
- ************************************************************************/
-
+ * 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 "tokenmap.hxx"
#include <string.h>
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index ed582a0659b6..f60a7781e11e 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -535,19 +535,17 @@ void T602ImportFilter::wrtfnt()
void T602ImportFilter::setfnt(fonts fnt,bool mustwrite)
{
- if( fnt == fst.oldfnt &&
- fnt == fst.nowfnt &&
- !mustwrite )
+ if (fnt == fst.oldfnt && fnt == fst.nowfnt && !mustwrite)
fst.nowfnt = standard;
- else
- if (fnt != chngul) fst.nowfnt = fnt;
+ else if (fnt != chngul)
+ fst.nowfnt = fnt;
- if(mustwrite)
- if(fst.oldfnt != fst.nowfnt || fst.olduline != fst.uline) {
- wrtfnt();
- fst.oldfnt = fst.nowfnt;
- fst.olduline = fst.uline;
- }
+ if (mustwrite && (fst.oldfnt != fst.nowfnt || fst.olduline != fst.uline))
+ {
+ wrtfnt();
+ fst.oldfnt = fst.nowfnt;
+ fst.olduline = fst.uline;
+ }
}
unsigned char T602ImportFilter::Readchar602()
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
index 4f4bb1d32acf..f48a62c4fb69 100644
--- a/filter/source/xsltdialog/typedetectionexport.cxx
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <tools/urlobj.hxx>
@@ -36,8 +37,8 @@ using namespace com::sun::star::xml::sax;
using ::rtl::OUString;
-TypeDetectionExporter::TypeDetectionExporter( Reference< XMultiServiceFactory >& xMSF )
-: mxMSF( xMSF )
+TypeDetectionExporter::TypeDetectionExporter( Reference< XComponentContext >& xContext )
+: mxContext( xContext )
{
}
@@ -95,9 +96,8 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML
// set up sax writer and connect to given output stream
- Reference< XDocumentHandler > xHandler( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), UNO_QUERY );
- Reference< XActiveDataSource > xDocSrc( xHandler, UNO_QUERY );
- xDocSrc->setOutputStream( xOS );
+ Reference< XWriter > xHandler = Writer::create( mxContext );
+ xHandler->setOutputStream( xOS );
::comphelper::AttributeList * pAttrList = new ::comphelper::AttributeList;
pAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM( "xmlns:oor" )), sCdataAttribute, OUString( RTL_CONSTASCII_USTRINGPARAM( "http://openoffice.org/2001/registry" )) );
@@ -183,7 +183,7 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML
sValue += sComma;
sValue += sXSLTFilterService;
sValue += sDelim;
- sValue += pFilter->maXSLTTransformerImpl;
+ sValue += OUString::valueOf( pFilter->mbNeedsXSLT2 );
sValue += sDelim;
const application_info_impl* pAppInfo = getApplicationInfo( pFilter->maExportService );
@@ -223,7 +223,7 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML
}
}
-void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+void TypeDetectionExporter::addProperty( Reference< XWriter > xHandler, const OUString& rName, const OUString& rValue )
{
try
{
@@ -253,7 +253,7 @@ void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler,
}
}
-void TypeDetectionExporter::addLocaleProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+void TypeDetectionExporter::addLocaleProperty( Reference< XWriter > xHandler, const OUString& rName, const OUString& rValue )
{
try
{
diff --git a/filter/source/xsltdialog/typedetectionexport.hxx b/filter/source/xsltdialog/typedetectionexport.hxx
index ebd14cc58317..05d702aee494 100644
--- a/filter/source/xsltdialog/typedetectionexport.hxx
+++ b/filter/source/xsltdialog/typedetectionexport.hxx
@@ -20,8 +20,7 @@
#ifndef _TYPEDETECTION_EXPORT_HXX
#define _TYPEDETECTION_EXPORT_HXX
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include "xmlfilterjar.hxx"
@@ -29,15 +28,15 @@
class TypeDetectionExporter
{
public:
- TypeDetectionExporter( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
+ TypeDetectionExporter( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& mxContext );
void doExport(com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xOS, const XMLFilterVector& rFilters );
private:
- void addProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
- void addLocaleProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+ void addProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XWriter > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+ void addLocaleProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XWriter > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
};
#endif
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
index daf6f32d2bba..1740b6d6964f 100644
--- a/filter/source/xsltdialog/typedetectionimport.cxx
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -170,7 +170,7 @@ filter_info_impl* TypeDetectionImporter::createFilterForNode( Node * pNode )
OUString aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) );
//Import/ExportService
- pFilter->maXSLTTransformerImpl = getSubdata( 1, aDelim, aFilterUserData );
+ pFilter->mbNeedsXSLT2 = getSubdata( 1, aDelim, aFilterUserData ).toBoolean();
pFilter->maImportService = getSubdata( 2, aDelim, aFilterUserData );
pFilter->maExportService = getSubdata( 3, aDelim, aFilterUserData );
pFilter->maImportXSLT = getSubdata( 4, aDelim, aFilterUserData );
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx
index 85d0ff1e52e0..40d0bf7d16ba 100644
--- a/filter/source/xsltdialog/xmlfiltercommon.hxx
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -68,7 +68,7 @@ public:
sal_Bool mbReadonly;
- rtl::OUString maXSLTTransformerImpl;
+ sal_Bool mbNeedsXSLT2;
filter_info_impl();
filter_info_impl( const filter_info_impl& rInfo );
@@ -97,7 +97,8 @@ extern const application_info_impl* getApplicationInfo( const rtl::OUString& rSe
extern ResMgr* getXSLTDialogResMgr();
-#define RESID(x) ResId(x, *getXSLTDialogResMgr() )
+#define RESID(x) ResId(x, *getXSLTDialogResMgr())
+#define RESIDSTR(x) RESID(x).toString()
#endif
diff --git a/filter/source/xsltdialog/xmlfilterhelpids.hrc b/filter/source/xsltdialog/xmlfilterhelpids.hrc
index f2d48e315517..d4ea134087b6 100644
--- a/filter/source/xsltdialog/xmlfilterhelpids.hrc
+++ b/filter/source/xsltdialog/xmlfilterhelpids.hrc
@@ -41,8 +41,7 @@
#define HID_XML_FILTER_DOCTYPE "FILTER_HID_XML_FILTER_DOCTYPE"
#define HID_XML_FILTER_DTD "FILTER_HID_XML_FILTER_DTD"
#define HID_XML_FILTER_DTD_BROWSE "FILTER_HID_XML_FILTER_DTD_BROWSE"
-#define HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J "FILTER_HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J"
-#define HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT "FILTER_HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT"
+#define HID_XML_FILTER_NEEDS_XSLT2 "FILTER_HID_XML_FILTER_NEEDS_XSLT2"
#define HID_XML_FILTER_EXPORT_XSLT "FILTER_HID_XML_FILTER_EXPORT_XSLT"
#define HID_XML_FILTER_EXPORT_XSLT_BROWSE "FILTER_HID_XML_FILTER_EXPORT_XSLT_BROWSE"
#define HID_XML_FILTER_IMPORT_XSLT "FILTER_HID_XML_FILTER_IMPORT_XSLT"
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index fac5f89ad8b1..3867924e080f 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/processfactory.hxx>
#include <comphelper/oslfile2streamwrap.hxx>
#include <comphelper/storagehelper.hxx>
#include <unotools/streamwrap.hxx>
@@ -225,7 +226,8 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt
/* osl::File::RC rc = */ aOutputFile.open( osl_File_OpenFlag_Write );
Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
- TypeDetectionExporter aExporter( mxMSF );
+ Reference<XComponentContext> xContext( comphelper::getComponentContext(mxMSF) );
+ TypeDetectionExporter aExporter( xContext );
aExporter.doExport(xOS,rFilters);
}
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 7ecfddecc144..e066786ce44a 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -81,8 +81,8 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog( Window* pParent, ResMgr& rResM
mpFilterListBox->SetSelectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) );
mpFilterListBox->SetDeselectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) );
mpFilterListBox->SetDoubleClickHdl( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) );
- mpFilterListBox->SetAccessibleName(String( RESID( STR_XML_FILTER_LISTBOX )));
- maCtrlFilterList.SetAccessibleName(String( RESID( STR_XML_FILTER_LISTBOX )));
+ mpFilterListBox->SetAccessibleName(RESIDSTR(STR_XML_FILTER_LISTBOX));
+ maCtrlFilterList.SetAccessibleName(RESIDSTR(STR_XML_FILTER_LISTBOX));
mpFilterListBox->SetHelpId( HID_XML_FILTER_LIST );
maPBNew.SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
@@ -196,7 +196,7 @@ void XMLFilterSettingsDialog::ShowWindow()
void XMLFilterSettingsDialog::updateStates()
{
- SvLBoxEntry* pSelectedEntry = mpFilterListBox->FirstSelected();
+ SvTreeListEntry* pSelectedEntry = mpFilterListBox->FirstSelected();
bool bHasSelection = pSelectedEntry != NULL;
@@ -234,14 +234,14 @@ void XMLFilterSettingsDialog::onNew()
filter_info_impl aTempInfo;
// create a unique filter name
- aTempInfo.maFilterName = createUniqueFilterName( String( RESID( STR_DEFAULT_FILTER_NAME ) ) );
+ aTempInfo.maFilterName = createUniqueFilterName(RESIDSTR(STR_DEFAULT_FILTER_NAME));
// init default extension
- String aDefaultExtension( RESID( STR_DEFAULT_EXTENSION ) );
+ String aDefaultExtension(RESIDSTR(STR_DEFAULT_EXTENSION));
aTempInfo.maExtension = aDefaultExtension;
// set default ui name
- aTempInfo.maInterfaceName = createUniqueInterfaceName( String( RESID( STR_DEFAULT_UI_NAME ) ) );
+ aTempInfo.maInterfaceName = createUniqueInterfaceName(RESIDSTR(STR_DEFAULT_UI_NAME));
// set default application
aTempInfo.maDocumentService = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ));
@@ -261,7 +261,7 @@ void XMLFilterSettingsDialog::onNew()
void XMLFilterSettingsDialog::onEdit()
{
// get selected filter entry
- SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ SvTreeListEntry* pEntry = mpFilterListBox->FirstSelected();
if( pEntry )
{
// get its filter info
@@ -791,7 +791,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
void XMLFilterSettingsDialog::onTest()
{
// get the first selected filter
- SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ SvTreeListEntry* pEntry = mpFilterListBox->FirstSelected();
if( pEntry )
{
filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
@@ -805,13 +805,13 @@ void XMLFilterSettingsDialog::onTest()
void XMLFilterSettingsDialog::onDelete()
{
- SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ SvTreeListEntry* pEntry = mpFilterListBox->FirstSelected();
if( pEntry )
{
filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
String aPlaceHolder( RTL_CONSTASCII_USTRINGPARAM("%s") );
- String aMessage(RESID(STR_WARN_DELETE));
+ String aMessage(RESIDSTR(STR_WARN_DELETE));
aMessage.SearchAndReplace( aPlaceHolder, pInfo->maFilterName );
WarningBox aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage );
@@ -901,7 +901,7 @@ void XMLFilterSettingsDialog::onSave()
int nFilters = 0;
- SvLBoxEntry* pEntry = mpFilterListBox->FirstSelected();
+ SvTreeListEntry* pEntry = mpFilterListBox->FirstSelected();
while( pEntry )
{
filter_info_impl* pInfo = (filter_info_impl*)pEntry->GetUserData();
@@ -916,7 +916,7 @@ void XMLFilterSettingsDialog::onSave()
0 );
String aExtensions( RTL_CONSTASCII_USTRINGPARAM("*.jar") );
- String aFilterName( RESID( STR_FILTER_PACKAGE ) );
+ String aFilterName(RESIDSTR(STR_FILTER_PACKAGE));
aFilterName += String( RTL_CONSTASCII_USTRINGPARAM(" (") );
aFilterName += aExtensions;
aFilterName += sal_Unicode(')');
@@ -935,13 +935,13 @@ void XMLFilterSettingsDialog::onSave()
String aMsg;
if( nFilters > 0 )
{
- aMsg = String( RESID( STR_FILTERS_HAVE_BEEN_SAVED ) );
+ aMsg = RESIDSTR(STR_FILTERS_HAVE_BEEN_SAVED);
aMsg.SearchAndReplace( sPlaceholder, String::CreateFromInt32(nFilters) );
aMsg.SearchAndReplace( sPlaceholder, aURL.GetName() );
}
else
{
- aMsg = String( RESID( STR_FILTER_HAS_BEEN_SAVED ) );
+ aMsg = RESIDSTR(STR_FILTER_HAS_BEEN_SAVED);
aMsg.SearchAndReplace( sPlaceholder, (*aFilters.begin())->maFilterName );
aMsg.SearchAndReplace( sPlaceholder, aURL.GetName() );
}
@@ -962,7 +962,7 @@ void XMLFilterSettingsDialog::onOpen()
com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
String aExtensions( RTL_CONSTASCII_USTRINGPARAM("*.jar") );
- String aFilterName( RESID( STR_FILTER_PACKAGE ) );
+ String aFilterName(RESIDSTR(STR_FILTER_PACKAGE));
aFilterName += String( RTL_CONSTASCII_USTRINGPARAM(" (") );
aFilterName += aExtensions;
aFilterName += sal_Unicode(')');
@@ -999,18 +999,18 @@ void XMLFilterSettingsDialog::onOpen()
if( nFilters == 0 )
{
INetURLObject aURLObj( aURL );
- aMsg = String( RESID( STR_NO_FILTERS_FOUND ) );
+ aMsg = RESIDSTR(STR_NO_FILTERS_FOUND);
aMsg.SearchAndReplace( sPlaceholder, aURLObj.GetName() );
}
else if( nFilters == 1 )
{
- aMsg = String( RESID( STR_FILTER_INSTALLED ) );
+ aMsg = RESIDSTR(STR_FILTER_INSTALLED);
aMsg.SearchAndReplace( sPlaceholder, aFilterName );
}
else
{
- aMsg = String( RESID( STR_FILTERS_INSTALLED ) );
+ aMsg = RESIDSTR(STR_FILTERS_INSTALLED);
aMsg.SearchAndReplace( sPlaceholder, String::CreateFromInt32(nFilters) );
}
@@ -1152,7 +1152,7 @@ void XMLFilterSettingsDialog::initFilterList()
continue;
// get filter information from userdata
- pTempFilter->maXSLTTransformerImpl = aUserData[1];
+ pTempFilter->mbNeedsXSLT2 = aUserData[1].toBoolean();
pTempFilter->maImportService = aUserData[2];
pTempFilter->maExportService = aUserData[3];
pTempFilter->maImportXSLT = aUserData[4];
@@ -1243,7 +1243,7 @@ void XMLFilterSettingsDialog::initFilterList()
delete pTempFilter;
}
- SvLBoxEntry* pEntry = mpFilterListBox->GetEntry( 0 );
+ SvTreeListEntry* pEntry = mpFilterListBox->GetEntry( 0 );
if( pEntry )
mpFilterListBox->Select( pEntry );
}
@@ -1359,7 +1359,7 @@ OUString getApplicationUIName( const OUString& rServiceName )
}
else
{
- OUString aRet = String( RESID( STR_UNKNOWN_APPLICATION ) );
+ OUString aRet = RESIDSTR(STR_UNKNOWN_APPLICATION);
if( !rServiceName.isEmpty() )
{
aRet += OUString( RTL_CONSTASCII_USTRINGPARAM( " (" ));
@@ -1403,8 +1403,8 @@ XMLFilterListBox::XMLFilterListBox( SvxPathControl_Impl * pParent )
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
mpHeaderBar->SetEndDragHdl( LINK( this, XMLFilterListBox, HeaderEndDrag_Impl ) );
- String aStr1( RESID( STR_COLUMN_HEADER_NAME ) );
- String aStr2( RESID( STR_COLUMN_HEADER_TYPE ) );
+ OUString aStr1(RESIDSTR(STR_COLUMN_HEADER_NAME));
+ OUString aStr2(RESIDSTR(STR_COLUMN_HEADER_TYPE));
long nTabSize = aBoxSize.Width() / 2;
@@ -1504,7 +1504,7 @@ IMPL_LINK( XMLFilterListBox, HeaderEndDrag_Impl, HeaderBar*, pBar )
/** adds a new filter info entry to the ui filter list */
void XMLFilterListBox::addFilterEntry( const filter_info_impl* pInfo )
{
- const XubString aEntryStr( getEntryString( pInfo ) );
+ const OUString aEntryStr( getEntryString( pInfo ) );
InsertEntryToColumn( aEntryStr, LIST_APPEND, 0xffff, (void*)pInfo );
}
@@ -1516,10 +1516,10 @@ void XMLFilterListBox::changeEntry( const filter_info_impl* pInfo )
sal_uLong nPos;
for( nPos = 0; nPos < nCount; nPos++ )
{
- SvLBoxEntry* pEntry = GetEntry( nPos );
+ SvTreeListEntry* pEntry = GetEntry( nPos );
if( (filter_info_impl*)pEntry->GetUserData() == pInfo )
{
- XubString aEntryText( getEntryString( pInfo ) );
+ OUString aEntryText( getEntryString( pInfo ) );
SetEntryText( aEntryText, pEntry );
break;
}
@@ -1545,20 +1545,20 @@ String XMLFilterListBox::getEntryString( const filter_info_impl* pInfo ) const
{
if( pInfo->maFlags & 2 )
{
- aEntryStr += String( RESID( STR_IMPORT_EXPORT ) );
+ aEntryStr += RESIDSTR(STR_IMPORT_EXPORT);
}
else
{
- aEntryStr += String( RESID( STR_IMPORT_ONLY ) );
+ aEntryStr += RESIDSTR(STR_IMPORT_ONLY);
}
}
else if( pInfo->maFlags & 2 )
{
- aEntryStr += String( RESID( STR_EXPORT_ONLY ) );
+ aEntryStr += RESIDSTR(STR_EXPORT_ONLY);
}
else
{
- aEntryStr += String( RESID( STR_UNDEFINED_FILTER ) );
+ aEntryStr += RESIDSTR(STR_UNDEFINED_FILTER);
}
return aEntryStr;
@@ -1572,7 +1572,8 @@ filter_info_impl::filter_info_impl()
: maFlags(0x00080040),
maFileFormatVersion(0),
mnDocumentIconID(0),
- mbReadonly(sal_False)
+ mbReadonly(sal_False),
+ mbNeedsXSLT2(sal_False)
{
}
@@ -1597,7 +1598,7 @@ filter_info_impl::filter_info_impl( const filter_info_impl& rInfo ) :
maFileFormatVersion( rInfo.maFileFormatVersion ),
mnDocumentIconID( rInfo.mnDocumentIconID ),
mbReadonly( rInfo.mbReadonly ),
- maXSLTTransformerImpl( rInfo.maXSLTTransformerImpl )
+ mbNeedsXSLT2( rInfo.mbNeedsXSLT2 )
{
}
@@ -1621,7 +1622,7 @@ int filter_info_impl::operator==( const filter_info_impl& r ) const
maImportTemplate != r.maImportTemplate ||
maFlags != r.maFlags ||
maFileFormatVersion != r.maFileFormatVersion ||
- maXSLTTransformerImpl != r.maXSLTTransformerImpl
+ mbNeedsXSLT2 != r.mbNeedsXSLT2
)
return false;
@@ -1635,7 +1636,7 @@ Sequence< OUString > filter_info_impl::getFilterUserData() const
Sequence< OUString > aUserData(8);
aUserData[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.documentconversion.XSLTFilter" ) );
- aUserData[1] = maXSLTTransformerImpl;
+ aUserData[1] = OUString::valueOf( mbNeedsXSLT2 );
aUserData[2] = maImportService;
aUserData[3] = maExportService;
aUserData[4] = maImportXSLT;
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
index 37be99048f71..31dce8848a20 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -59,9 +59,8 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co
maEDImportTemplate( this, ResId( ED_XML_IMPORT_TEMPLATE, rResMgr ), INET_PROT_FILE ),
maPBImportTemplate( this, ResId( PB_XML_IMPORT_TEMPLATE_BROWSE, rResMgr ) ),
- maFTTransformationService( this, ResId (FT_XML_TRANSFORM_SERVICE, rResMgr ) ),
- maRBTransformationServiceLibXSLT( this, ResId (RB_XML_TRANSFORM_SERVICE_LIBXSLT, rResMgr ) ),
- maRBTransformationServiceSaxonJ( this, ResId (RB_XML_TRANSFORM_SERVICE_SAXON_J, rResMgr ) ),
+ maFTNeedsXSLT2( this, ResId (FT_XML_NEEDS_XSLT2, rResMgr ) ),
+ maCBNeedsXSLT2( this, ResId (CB_XML_NEEDS_XSLT2, rResMgr ) ),
sHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "http://" ) ),
sSHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "shttp://" ) ),
@@ -91,8 +90,7 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co
maEDExportXSLT.SetHelpId( HID_XML_FILTER_EXPORT_XSLT );
maEDImportXSLT.SetHelpId( HID_XML_FILTER_IMPORT_XSLT );
maEDImportTemplate.SetHelpId( HID_XML_FILTER_IMPORT_TEMPLATE );
- maRBTransformationServiceLibXSLT.SetHelpId( HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT );
- maRBTransformationServiceSaxonJ.SetHelpId( HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J );
+ maCBNeedsXSLT2.SetHelpId( HID_XML_FILTER_NEEDS_XSLT2 );
}
XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT()
@@ -108,10 +106,7 @@ bool XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo )
pInfo->maExportXSLT = GetURL( maEDExportXSLT );
pInfo->maImportXSLT = GetURL( maEDImportXSLT );
pInfo->maImportTemplate = GetURL( maEDImportTemplate );
- pInfo->maXSLTTransformerImpl
- = maRBTransformationServiceSaxonJ.IsChecked() ? OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" ))
- : OUString(RTL_CONSTASCII_USTRINGPARAM( "" ));
+ pInfo->mbNeedsXSLT2 = maCBNeedsXSLT2.IsChecked();
}
return true;
@@ -127,12 +122,7 @@ void XMLFilterTabPageXSLT::SetInfo(const filter_info_impl* pInfo)
SetURL( maEDExportXSLT, pInfo->maExportXSLT );
SetURL( maEDImportXSLT, pInfo->maImportXSLT );
SetURL( maEDImportTemplate, pInfo->maImportTemplate );
- if (pInfo->maXSLTTransformerImpl.equals(OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )))) {
- maRBTransformationServiceSaxonJ.Check();
- } else {
- maRBTransformationServiceLibXSLT.Check();
- }
+ maCBNeedsXSLT2.Check( pInfo->mbNeedsXSLT2 );
}
}
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc
index c86830758062..93c6ed15adf0 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc
@@ -35,8 +35,7 @@
#define FT_XML_IMPORT_TEMPLATE 12
#define ED_XML_IMPORT_TEMPLATE 13
#define PB_XML_IMPORT_TEMPLATE_BROWSE 14
-#define FT_XML_TRANSFORM_SERVICE 15
-#define RB_XML_TRANSFORM_SERVICE_LIBXSLT 16
-#define RB_XML_TRANSFORM_SERVICE_SAXON_J 17
+#define FT_XML_NEEDS_XSLT2 15
+#define CB_XML_NEEDS_XSLT2 16
#endif
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
index a37d017aa71c..cccd97e95e0e 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx
@@ -60,9 +60,8 @@ public:
SvtURLBox maEDImportTemplate;
PushButton maPBImportTemplate;
- FixedText maFTTransformationService;
- RadioButton maRBTransformationServiceLibXSLT;
- RadioButton maRBTransformationServiceSaxonJ;
+ FixedText maFTNeedsXSLT2;
+ CheckBox maCBNeedsXSLT2;
private:
void SetURL( SvtURLBox& rURLBox, const rtl::OUString& rURL );
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.src b/filter/source/xsltdialog/xmlfiltertabpagexslt.src
index f719dd5a1fc4..f8feb42265b6 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.src
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.src
@@ -166,27 +166,18 @@ TabPage RID_XML_FILTER_TABPAGE_XSLT
// XSLT transformation service --------------------------------------------------------
- FixedText FT_XML_TRANSFORM_SERVICE
+ CheckBox CB_XML_NEEDS_XSLT2
{
+ HelpID = HID_XML_FILTER_NEEDS_XSLT2;
Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
- Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ;
- Text [ en-US ] = "XSLT Transformation Service";
- };
-
- RadioButton RB_XML_TRANSFORM_SERVICE_LIBXSLT
- {
- HelpID = HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT;
- Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + EDIT_OFFSET ) ;
- Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ;
- Text[ en-US ] = "~Builtin (LibXSLT)";
+ Size = MAP_APPFONT ( 12, 12 ) ;
};
- RadioButton RB_XML_TRANSFORM_SERVICE_SAXON_J
+ FixedText FT_XML_NEEDS_XSLT2
{
- HelpID = HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J;
- Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 6 * ROW_HEIGHT + 6 * SPACING + EDIT_OFFSET ) ;
- Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ;
- Text[ en-US ] = "~Saxon/J";
+ Pos = MAP_APPFONT ( FIRST_ROW_X + 3 * SPACING , SECOND_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ;
+ Size = MAP_APPFONT ( 2 * FIRST_ROW_WIDTH , 8 ) ; // guess width
+ Text [ en-US ] = "The filter needs XSLT 2.0 processor";
};
};
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 6f265a5f8071..97c61f5915ee 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -36,7 +36,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <comphelper/oslfile2streamwrap.hxx>
#include <vcl/svapp.hxx>
@@ -666,7 +666,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
aSourceData[i ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocType_System" ));
aSourceData[i++].Value <<= sDTDPath;
- Reference< XDocumentHandler > xWriter( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) ), UNO_QUERY );
+ Reference< XWriter > xWriter = Writer::create( comphelper::getComponentContext(mxMSF) );
File aOutputFile( aTempFileURL );
aOutputFile.open( osl_File_OpenFlag_Write );
@@ -676,7 +676,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
xDocSrc->setOutputStream( xOS );
Sequence< OUString > aFilterUserData( mpFilterInfo->getFilterUserData() );
- xImporter->importer( aSourceData, xWriter, aFilterUserData );
+ xImporter->importer( aSourceData, Reference<XDocumentHandler>(xWriter, UNO_QUERY_THROW), aFilterUserData );
}
displayXMLFile( aTempFileURL );
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index aa1411f7b946..5c5b0e0c4296 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -494,9 +494,11 @@ namespace XSLT
}
void
- LibXSLTTransformer::initialize(const Sequence<Any>& params)
+ LibXSLTTransformer::initialize(const Sequence<Any>& args)
throw (RuntimeException)
{
+ Sequence<Any> params;
+ args[0] >>= params;
xmlSubstituteEntitiesDefault(0);
m_parameters.clear();
for (int i = 0; i < params.getLength(); i++)
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx b/filter/source/xsltfilter/LibXSLTTransformer.hxx
index 444cb2f6b9ce..a7c71a611fd5 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.hxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx
@@ -42,7 +42,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
@@ -51,14 +51,12 @@
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/io/XStreamListener.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/xml/xslt/XXSLTTransformer.hpp>
using namespace ::rtl;
using namespace ::cppu;
@@ -66,7 +64,6 @@ using namespace ::osl;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using ::std::list;
using ::std::map;
@@ -90,8 +87,7 @@ namespace XSLT
*
* See Reader below.
*/
- class LibXSLTTransformer : public WeakImplHelper4<XActiveDataSink,
- XActiveDataSource, XActiveDataControl, XInitialization>
+ class LibXSLTTransformer : public WeakImplHelper1<com::sun::star::xml::xslt::XXSLTTransformer>
{
private:
static const char* const PARAM_SOURCE_URL;
@@ -102,7 +98,7 @@ namespace XSLT
static const char* const PARAM_DOCTYPE_PUBLIC;
// the UNO ServiceFactory
- com::sun::star::uno::Reference<XMultiServiceFactory> m_rServiceFactory;
+ com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_rServiceFactory;
com::sun::star::uno::Reference<XInputStream> m_rInputStream;
@@ -129,7 +125,7 @@ namespace XSLT
public:
// ctor...
- LibXSLTTransformer(const com::sun::star::uno::Reference<XMultiServiceFactory> &r);
+ LibXSLTTransformer(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> &r);
// XActiveDataSink
virtual void SAL_CALL
@@ -169,7 +165,7 @@ namespace XSLT
::std::map<const char*, OString> SAL_CALL
getParameters();
- virtual com::sun::star::uno::Reference<XMultiServiceFactory> SAL_CALL
+ virtual com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> SAL_CALL
getServiceFactory() {
return m_rServiceFactory;
}
diff --git a/filter/source/xsltfilter/Manifest b/filter/source/xsltfilter/Manifest
deleted file mode 100644
index 1bd3102908fb..000000000000
--- a/filter/source/xsltfilter/Manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-RegistrationClassName: com.sun.star.comp.xsltfilter.XSLTransformer
-UNO-Type-Path:
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 4bb92b011d55..2ce6aba88f36 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
@@ -65,6 +66,8 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <com/sun/star/xml/xslt/XSLT2Transformer.hpp>
+#include <com/sun/star/xml/xslt/XSLTTransformer.hpp>
#include <xmloff/attrlist.hxx>
@@ -95,14 +98,10 @@ namespace XSLT
* them to an XSLT transformation service. XSLT transformation errors are
* reported to XSLTFilter.
*
- * Currently, two implementations for the XSLT transformation service exist:
- * a java based service (see XSLTransformer.java) and a libxslt based
- * service (LibXSLTTransformer.cxx).
- *
- * The libxslt implementation will be used by default.
- *
- * If the value of the 2nd "UserData" parameter of the filter configuration is
- * not empty, the service name given there will be used.
+ * Currently, our transformation service is libxslt based, so it
+ * only supports XSLT 1.0. There is a possibility to use XSLT 2.0
+ * supporting service from an extension for a specific filter; the
+ * service must support com.sun.star.xml.xslt.XSLT2Transformer.
*/
class XSLTFilter : public WeakImplHelper4<XImportFilter, XExportFilter,
XStreamListener, ExtendedDocumentHandlerAdapter>
@@ -115,7 +114,7 @@ namespace XSLT
// DocumentHandler interface of the css::xml::sax::Writer service
css::uno::Reference<XOutputStream> m_rOutputStream;
- css::uno::Reference<XActiveDataControl> m_tcontrol;
+ css::uno::Reference<xslt::XXSLTTransformer> m_tcontrol;
oslCondition m_cTransformed;
sal_Bool m_bTerminated;
@@ -128,6 +127,8 @@ namespace XSLT
OUString
expandUrl(const OUString&);
+ css::uno::Reference<xslt::XXSLTTransformer> impl_createTransformer(const rtl::OUString& rTransformer, const Sequence<Any>& rArgs);
+
public:
// ctor...
@@ -199,6 +200,43 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
return sExpandedUrl;
}
+ css::uno::Reference<xslt::XXSLTTransformer>
+ XSLTFilter::impl_createTransformer(const rtl::OUString& rTransformer, const Sequence<Any>& rArgs)
+ {
+ css::uno::Reference<xslt::XXSLTTransformer> xTransformer;
+
+ // check if the filter needs XSLT-2.0-capable transformer
+ // COMPATIBILITY: libreoffice 3.5/3.6 used to save the impl.
+ // name of the XSLT 2.0 transformation service there, so check
+ // for that too (it is sufficient to check that there is _a_
+ // service name there)
+ if (rTransformer.toBoolean() || rTransformer.startsWith("com.sun."))
+ {
+ try
+ {
+ xTransformer = xslt::XSLT2Transformer::create(
+ comphelper::getComponentContext(m_rServiceFactory), rArgs);
+ }
+ catch (const Exception&)
+ {
+ // TODO: put a dialog telling about the need to install
+ // xslt2-transformer extension here
+ SAL_WARN("filter.xslt", "could not create XSLT 2.0 transformer");
+ throw;
+ }
+ }
+
+ // instantiation of XSLT 2.0 transformer service failed, or the
+ // filter does not need it
+ if (!xTransformer.is())
+ {
+ xTransformer = xslt::XSLTTransformer::create(
+ comphelper::getComponentContext(m_rServiceFactory), rArgs);
+ }
+
+ return xTransformer;
+ }
+
void
XSLTFilter::started() throw (RuntimeException)
{
@@ -299,11 +337,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
nv.Value <<= OUString(INetURLObject(aURL).getBase());
args[2] <<= nv;
- OUString serviceName("com.sun.star.comp.documentconversion.LibXSLTTransformer");
- if (!msUserData[1].isEmpty())
- serviceName = msUserData[1];
-
- m_tcontrol = css::uno::Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY);
+ m_tcontrol = impl_createTransformer(msUserData[1], args);
OSL_ASSERT(xHandler.is());
OSL_ASSERT(xInputStream.is());
@@ -431,11 +465,9 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
if (!getDelegate().is())
{
// get the document writer
- setDelegate(css::uno::Reference<XExtendedDocumentHandler> (
- m_rServiceFactory->createInstance(
- OUString(
- "com.sun.star.xml.sax.Writer" )),
- UNO_QUERY));
+ setDelegate(css::uno::Reference<XExtendedDocumentHandler>(
+ Writer::create(comphelper::getComponentContext(m_rServiceFactory)),
+ UNO_QUERY_THROW));
}
// create transformer
@@ -460,11 +492,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
nv.Value <<= m_aExportBaseUrl;
args[3] <<= nv;
- OUString serviceName("com.sun.star.comp.documentconversion.LibXSLTTransformer");
- if (!msUserData[1].isEmpty())
- serviceName = msUserData[1];
-
- m_tcontrol = css::uno::Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY);
+ m_tcontrol = impl_createTransformer(msUserData[1], args);
OSL_ASSERT(m_rOutputStream.is());
OSL_ASSERT(m_tcontrol.is());
@@ -537,7 +565,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
// --------------------------------------
#define FILTER_SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter"
#define FILTER_IMPL_NAME "com.sun.star.comp.documentconversion.XSLTFilter"
-#define TRANSFORMER_SERVICE_NAME "com.sun.star.documentconversion.LibXSLTTransformer"
+#define TRANSFORMER_SERVICE_NAME "com.sun.star.xml.xslt.XSLTTransformer"
#define TRANSFORMER_IMPL_NAME "com.sun.star.comp.documentconversion.LibXSLTTransformer"
static css::uno::Reference<XInterface> SAL_CALL
diff --git a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/Base64.java b/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/Base64.java
deleted file mode 100644
index 0d0f331d3200..000000000000
--- a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/Base64.java
+++ /dev/null
@@ -1,1824 +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 .
- */
-
-package com.sun.star.comp.xsltfilter;
-
-/**
- * <p>Encodes and decodes to and from Base64 notation.</p>
- * <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
- *
- * <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
- * several pieces of information to the encoder. In the "higher level" methods such as
- * encodeBytes( bytes, options ) the options parameter can be used to indicate such
- * things as first gzipping the bytes before encoding them, not inserting linefeeds
- * (though that breaks strict Base64 compatibility), and encoding using the URL-safe
- * and Ordered dialects.</p>
- *
- * <p>The constants defined in Base64 can be OR-ed together to combine options, so you
- * might make a call like this:</p>
- *
- * <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DONT_BREAK_LINES );</code>
- *
- * <p>to compress the data before encoding it and then making the output have no newline characters.</p>
- *
- *
- * <p>
- * Change Log:
- * </p>
- * <ul>
- * <li>v2.2.2 - Fixed encodeFileToFile and decodeFileToFile to use the
- * Base64.InputStream class to encode and decode on the fly which uses
- * less memory than encoding/decoding an entire file into memory before writing.</li>
- * <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
- * when using very small files (~&lt; 40 bytes).</li>
- * <li>v2.2 - Added some helper methods for encoding/decoding directly from
- * one file to the next. Also added a main() method to support command line
- * encoding/decoding from one file to the next. Also added these Base64 dialects:
- * <ol>
- * <li>The default is RFC3548 format.</li>
- * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
- * URL and file name friendly format as described in Section 4 of RFC3548.
- * http://www.faqs.org/rfcs/rfc3548.html</li>
- * <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
- * URL and file name friendly format that preserves lexical ordering as described
- * in http://www.faqs.org/qa/rfcc-1940.html</li>
- * </ol>
- * Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
- * for contributing the new Base64 dialects.
- * </li>
- *
- * <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
- * some convenience methods for reading and writing to and from files.</li>
- * <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
- * with other encodings (like EBCDIC).</li>
- * <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
- * encoded data was a single byte.</li>
- * <li>v2.0 - I got rid of methods that used booleans to set options.
- * Now everything is more consolidated and cleaner. The code now detects
- * when data that's being decoded is gzip-compressed and will decompress it
- * automatically. Generally things are cleaner. You'll probably have to
- * change some method calls that you were making to support the new
- * options format (<tt>int</tt>s that you "OR" together).</li>
- * <li>v1.5.1 - Fixed bug when decompressing and decoding to a
- * byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
- * Added the ability to "suspend" encoding in the Output Stream so
- * you can turn on and off the encoding if you need to embed base64
- * data in an otherwise "normal" stream (like an XML file).</li>
- * <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
- * This helps when using GZIP streams.
- * Added the ability to GZip-compress objects before encoding them.</li>
- * <li>v1.4 - Added helper methods to read/write files.</li>
- * <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
- * <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- * where last buffer being read, if not completely full, was not returned.</li>
- * <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
- * <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
- * </ul>
- *
- * <p>
- * I am placing this code in the Public Domain. Do with it as you will.
- * This software comes with no guarantees or warranties but with
- * plenty of well-wishing instead!
- * Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
- * periodically to check for updates or to contribute improvements.
- * </p>
- *
- * @version 2.2.2
- */
-public class Base64
-{
-
-/* ******** P U B L I C F I E L D S ******** */
-
-
- /** No options specified. Value is zero. */
- public final static int NO_OPTIONS = 0;
-
- /** Specify encoding. */
- public final static int ENCODE = 1;
-
-
- /** Specify decoding. */
- public final static int DECODE = 0;
-
-
- /** Specify that data should be gzip-compressed. */
- public final static int GZIP = 2;
-
-
- /** Don't break lines when encoding (violates strict Base64 specification) */
- public final static int DONT_BREAK_LINES = 8;
-
- /**
- * Encode using Base64-like encoding that is URL- and Filename-safe as described
- * in Section 4 of RFC3548:
- * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
- * It is important to note that data encoded this way is <em>not</em> officially valid Base64,
- * or at the very least should not be called Base64 without also specifying that is
- * was encoded using the URL- and Filename-safe dialect.
- */
- public final static int URL_SAFE = 16;
-
-
- /**
- * Encode using the special "ordered" dialect of Base64 described here:
- * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
- */
- public final static int ORDERED = 32;
-
-
-/* ******** P R I V A T E F I E L D S ******** */
-
-
- /** Maximum line length (76) of Base64 output. */
- private final static int MAX_LINE_LENGTH = 76;
-
-
- /** The equals sign (=) as a byte. */
- private final static byte EQUALS_SIGN = (byte)'=';
-
-
- /** The new line character (\n) as a byte. */
- private final static byte NEW_LINE = (byte)'\n';
-
-
- /** Preferred encoding. */
- private final static String PREFERRED_ENCODING = "UTF-8";
-
-
- // I think I end up not using the BAD_ENCODING indicator.
- //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
-
-
-/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
-
- /** The 64 valid Base64 values. */
- //private final static byte[] ALPHABET;
- /* Host platform me be something funny like EBCDIC, so we hardcode these values. */
- private final static byte[] _STANDARD_ALPHABET =
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
- };
-
-
- /**
- * Translates a Base64 value to either its 6-bit reconstruction value
- * or a negative number indicating some other meaning.
- **/
- private final static byte[] _STANDARD_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- 62, // Plus sign at decimal 43
- -9,-9,-9, // Decimal 44 - 46
- 63, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */
-
- /**
- * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
- * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
- * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
- */
- private final static byte[] _URL_SAFE_ALPHABET =
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
- };
-
- /**
- * Used in decoding URL- and Filename-safe dialects of Base64.
- */
- private final static byte[] _URL_SAFE_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- -9, // Plus sign at decimal 43
- -9, // Decimal 44
- 62, // Minus sign at decimal 45
- -9, // Decimal 46
- -9, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9, // Decimal 91 - 94
- 63, // Underscore at decimal 95
- -9, // Decimal 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-
-/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */
-
- /**
- * I don't get the point of this technique, but it is described here:
- * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
- */
- private final static byte[] _ORDERED_ALPHABET =
- {
- (byte)'-',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
- (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'_',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
- };
-
- /**
- * Used in decoding the "ordered" dialect of Base64.
- */
- private final static byte[] _ORDERED_DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- -9, // Plus sign at decimal 43
- -9, // Decimal 44
- 0, // Minus sign at decimal 45
- -9, // Decimal 46
- -9, // Slash at decimal 47
- 1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M'
- 24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z'
- -9,-9,-9,-9, // Decimal 91 - 94
- 37, // Underscore at decimal 95
- -9, // Decimal 96
- 38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm'
- 51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
-
-/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */
-
-
- /**
- * Returns one of the _SOMETHING_ALPHABET byte arrays depending on
- * the options specified.
- * It's possible, though silly, to specify ORDERED and URLSAFE
- * in which case one of them will be picked, though there is
- * no guarantee as to which one will be picked.
- */
- private final static byte[] getAlphabet( int options )
- {
- if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_ALPHABET;
- else if( (options & ORDERED) == ORDERED ) return _ORDERED_ALPHABET;
- else return _STANDARD_ALPHABET;
-
- } // end getAlphabet
-
-
- /**
- * Returns one of the _SOMETHING_DECODABET byte arrays depending on
- * the options specified.
- * It's possible, though silly, to specify ORDERED and URL_SAFE
- * in which case one of them will be picked, though there is
- * no guarantee as to which one will be picked.
- */
- private final static byte[] getDecodabet( int options )
- {
- if( (options & URL_SAFE) == URL_SAFE ) return _URL_SAFE_DECODABET;
- else if( (options & ORDERED) == ORDERED ) return _ORDERED_DECODABET;
- else return _STANDARD_DECODABET;
-
- } // end getAlphabet
-
-
-
- /** Defeats instantiation. */
- private Base64(){}
-
-
- /**
- * Encodes or decodes two files from the command line;
- * <strong>feel free to delete this method (in fact you probably should)
- * if you're embedding this code into a larger program.</strong>
- */
- public final static void main( String[] args )
- {
- if( args.length < 3 ){
- usage("Not enough arguments.");
- } // end if: args.length < 3
- else {
- String flag = args[0];
- String infile = args[1];
- String outfile = args[2];
- if( flag.equals( "-e" ) ){
- Base64.encodeFileToFile( infile, outfile );
- } // end if: encode
- else if( flag.equals( "-d" ) ) {
- Base64.decodeFileToFile( infile, outfile );
- } // end else if: decode
- else {
- usage( "Unknown flag: " + flag );
- } // end else
- } // end else
- } // end main
-
- /**
- * Prints command line usage.
- *
- * @param msg A message to include with usage info.
- */
- private final static void usage( String msg )
- {
- System.err.println( msg );
- System.err.println( "Usage: java Base64 -e|-d inputfile outputfile" );
- } // end usage
-
-
-/* ******** E N C O D I N G M E T H O D S ******** */
-
-
- /**
- * Encodes up to the first three bytes of array <var>threeBytes</var>
- * and returns a four-byte array in Base64 notation.
- * The actual number of significant bytes in your array is
- * given by <var>numSigBytes</var>.
- * The array <var>threeBytes</var> needs only be as big as
- * <var>numSigBytes</var>.
- * Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
- *
- * @param b4 A reusable byte array to reduce array instantiation
- * @param threeBytes the array to convert
- * @param numSigBytes the number of significant bytes in your array
- * @return four byte array in Base64 notation.
- * @since 1.5.1
- */
- private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options )
- {
- encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
- return b4;
- } // end encode3to4
-
-
- /**
- * <p>Encodes up to three bytes of the array <var>source</var>
- * and writes the resulting four Base64 bytes to <var>destination</var>.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * <var>srcOffset</var> and <var>destOffset</var>.
- * This method does not check to make sure your arrays
- * are large enough to accomodate <var>srcOffset</var> + 3 for
- * the <var>source</var> array or <var>destOffset</var> + 4 for
- * the <var>destination</var> array.
- * The actual number of significant bytes in your array is
- * given by <var>numSigBytes</var>.</p>
- * <p>This is the lowest level of the encoding methods with
- * all possible parameters.</p>
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param numSigBytes the number of significant bytes in your array
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the <var>destination</var> array
- * @since 1.3
- */
- private static byte[] encode3to4(
- byte[] source, int srcOffset, int numSigBytes,
- byte[] destination, int destOffset, int options )
- {
- byte[] ALPHABET = getAlphabet( options );
-
- // 1 2 3
- // 01234567890123456789012345678901 Bit position
- // --------000000001111111122222222 Array position from threeBytes
- // --------| || || || | Six bit groups to index ALPHABET
- // >>18 >>12 >> 6 >> 0 Right shift necessary
- // 0x3f 0x3f 0x3f Additional AND
-
- // Create buffer with zero-padding if there are only one or two
- // significant bytes passed in the array.
- // We have to shift left 24 in order to flush out the 1's that appear
- // when Java treats a value as negative that is cast from a byte to an int.
- int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
- | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
- | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
-
- switch( numSigBytes )
- {
- case 3:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
- return destination;
-
- case 2:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- case 1:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = EQUALS_SIGN;
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- default:
- return destination;
- } // end switch
- } // end encode3to4
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return <tt>null</tt>.
- * The object is not GZip-compressed before being encoded.
- *
- * @param serializableObject The object to encode
- * @return The Base64-encoded object
- * @since 1.4
- */
- public static String encodeObject( java.io.Serializable serializableObject )
- {
- return encodeObject( serializableObject, NO_OPTIONS );
- } // end encodeObject
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return <tt>null</tt>.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- * @param serializableObject The object to encode
- * @param options Specified options
- * @return The Base64-encoded object
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeObject( java.io.Serializable serializableObject, int options )
- {
- // Streams
- java.io.ByteArrayOutputStream baos = null;
- java.io.OutputStream b64os = null;
- java.io.ObjectOutputStream oos = null;
- java.util.zip.GZIPOutputStream gzos = null;
-
- // Isolate options
- int gzip = (options & GZIP);
- int dontBreakLines = (options & DONT_BREAK_LINES);
-
- try
- {
- // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | options );
-
- // GZip?
- if( gzip == GZIP )
- {
- gzos = new java.util.zip.GZIPOutputStream( b64os );
- oos = new java.io.ObjectOutputStream( gzos );
- } // end if: gzip
- else
- oos = new java.io.ObjectOutputStream( b64os );
-
- oos.writeObject( serializableObject );
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ oos.close(); } catch( Exception e ){}
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
-
- } // end encode
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source )
- {
- return encodeBytes( source, 0, source.length, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- *
- * @param source The data to convert
- * @param options Specified options
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int options )
- {
- return encodeBytes( source, 0, source.length, options );
- } // end encodeBytes
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, int off, int len )
- {
- return encodeBytes( source, off, len, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * <p>
- * Valid options:<pre>
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
- * <p>
- * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
- *
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @param options Specified options, alphabet type is pulled from this (standard, url-safe, ordered)
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int off, int len, int options )
- {
- // Isolate options
- int dontBreakLines = ( options & DONT_BREAK_LINES );
- int gzip = ( options & GZIP );
-
- // Compress?
- if( gzip == GZIP )
- {
- java.io.ByteArrayOutputStream baos = null;
- java.util.zip.GZIPOutputStream gzos = null;
- Base64.OutputStream b64os = null;
-
-
- try
- {
- // GZip -> Base64 -> ByteArray
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | options );
- gzos = new java.util.zip.GZIPOutputStream( b64os );
-
- gzos.write( source, off, len );
- gzos.close();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
- } // end if: compress
-
- // Else, don't compress. Better not to use streams at all then.
- else
- {
- // Convert option to boolean in way that code likes it.
- boolean breakLines = dontBreakLines == 0;
-
- int len43 = len * 4 / 3;
- byte[] outBuff = new byte[ ( len43 ) // Main 4:3
- + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
- + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
- int d = 0;
- int e = 0;
- int len2 = len - 2;
- int lineLength = 0;
- for( ; d < len2; d+=3, e+=4 )
- {
- encode3to4( source, d+off, 3, outBuff, e, options );
-
- lineLength += 4;
- if( breakLines && lineLength == MAX_LINE_LENGTH )
- {
- outBuff[e+4] = NEW_LINE;
- e++;
- lineLength = 0;
- } // end if: end of line
- } // en dfor: each piece of array
-
- if( d < len )
- {
- encode3to4( source, d+off, len - d, outBuff, e, options );
- e += 4;
- } // end if: some padding needed
-
-
- // Return value according to relevant encoding.
- try
- {
- return new String( outBuff, 0, e, PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( outBuff, 0, e );
- } // end catch
-
- } // end else: don't compress
-
- } // end encodeBytes
-
-
-
-
-
-/* ******** D E C O D I N G M E T H O D S ******** */
-
-
- /**
- * Decodes four bytes from array <var>source</var>
- * and writes the resulting bytes (up to three of them)
- * to <var>destination</var>.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * <var>srcOffset</var> and <var>destOffset</var>.
- * This method does not check to make sure your arrays
- * are large enough to accomodate <var>srcOffset</var> + 4 for
- * the <var>source</var> array or <var>destOffset</var> + 3 for
- * the <var>destination</var> array.
- * This method returns the actual number of bytes that
- * were converted from the Base64 encoding.
- * <p>This is the lowest level of the decoding methods with
- * all possible parameters.</p>
- *
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @param options alphabet type is pulled from this (standard, url-safe, ordered)
- * @return the number of decoded bytes converted
- * @since 1.3
- */
- private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options )
- {
- byte[] DECODABET = getDecodabet( options );
-
- // Example: Dk==
- if( source[ srcOffset + 2] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- return 1;
- }
-
- // Example: DkL=
- else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
- return 2;
- }
-
- // Example: DkLE
- else
- {
- try{
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
- // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
- | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
-
-
- destination[ destOffset ] = (byte)( outBuff >> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
- destination[ destOffset + 2 ] = (byte)( outBuff );
-
- return 3;
- }catch( Exception e){
- System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
- System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
- System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
- System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
- return -1;
- } // end catch
- }
- } // end decodeToBytes
-
-
-
-
- /**
- * Very low-level access to decoding ASCII characters in
- * the form of a byte array. Does not support automatically
- * gunzipping or any other "fancy" features.
- *
- * @param source The Base64 encoded data
- * @param off The offset of where to begin decoding
- * @param len The length of characters to decode
- * @return decoded data
- * @since 1.3
- */
- public static byte[] decode( byte[] source, int off, int len, int options )
- {
- byte[] DECODABET = getDecodabet( options );
-
- int len34 = len * 3 / 4;
- byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
- int outBuffPosn = 0;
-
- byte[] b4 = new byte[4];
- int b4Posn = 0;
- int i = 0;
- byte sbiCrop = 0;
- byte sbiDecode = 0;
- for( i = off; i < off+len; i++ )
- {
- sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
- sbiDecode = DECODABET[ sbiCrop ];
-
- if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
- {
- if( sbiDecode >= EQUALS_SIGN_ENC )
- {
- b4[ b4Posn++ ] = sbiCrop;
- if( b4Posn > 3 )
- {
- outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
- b4Posn = 0;
-
- // If that was the equals sign, break out of 'for' loop
- if( sbiCrop == EQUALS_SIGN )
- break;
- } // end if: quartet built
-
- } // end if: equals sign or better
-
- } // end if: white space, equals sign or better
- else
- {
- System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
- return null;
- } // end else:
- } // each input character
-
- byte[] out = new byte[ outBuffPosn ];
- System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
- return out;
- } // end decode
-
-
-
-
- /**
- * Decodes data from Base64 notation, automatically
- * detecting gzip-compressed data and decompressing it.
- *
- * @param s the string to decode
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s )
- {
- return decode( s, NO_OPTIONS );
- }
-
-
- /**
- * Decodes data from Base64 notation, automatically
- * detecting gzip-compressed data and decompressing it.
- *
- * @param s the string to decode
- * @param options encode options such as URL_SAFE
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s, int options )
- {
- byte[] bytes;
- try
- {
- bytes = s.getBytes( PREFERRED_ENCODING );
- } // end try
- catch( java.io.UnsupportedEncodingException uee )
- {
- bytes = s.getBytes();
- } // end catch
- //</change>
-
- // Decode
- bytes = decode( bytes, 0, bytes.length, options );
-
-
- // Check to see if it's gzip-compressed
- // GZIP Magic Two-Byte Number: 0x8b1f (35615)
- if( bytes != null && bytes.length >= 4 )
- {
-
- int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
- if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
- {
- java.io.ByteArrayInputStream bais = null;
- java.util.zip.GZIPInputStream gzis = null;
- java.io.ByteArrayOutputStream baos = null;
- byte[] buffer = new byte[2048];
- int length = 0;
-
- try
- {
- baos = new java.io.ByteArrayOutputStream();
- bais = new java.io.ByteArrayInputStream( bytes );
- gzis = new java.util.zip.GZIPInputStream( bais );
-
- while( ( length = gzis.read( buffer ) ) >= 0 )
- {
- baos.write(buffer,0,length);
- } // end while: reading input
-
- // No error? Get new bytes.
- bytes = baos.toByteArray();
-
- } // end try
- catch( java.io.IOException e )
- {
- // Just return originally-decoded bytes
- } // end catch
- finally
- {
- try{ baos.close(); } catch( Exception e ){}
- try{ gzis.close(); } catch( Exception e ){}
- try{ bais.close(); } catch( Exception e ){}
- } // end finally
-
- } // end if: gzipped
- } // end if: bytes.length >= 2
-
- return bytes;
- } // end decode
-
-
-
-
- /**
- * Attempts to decode Base64 data and deserialize a Java
- * Object within. Returns <tt>null</tt> if there was an error.
- *
- * @param encodedObject The Base64 data to decode
- * @return The decoded and deserialized object
- * @since 1.5
- */
- public static Object decodeToObject( String encodedObject )
- {
- // Decode and gunzip if necessary
- byte[] objBytes = decode( encodedObject );
-
- java.io.ByteArrayInputStream bais = null;
- java.io.ObjectInputStream ois = null;
- Object obj = null;
-
- try
- {
- bais = new java.io.ByteArrayInputStream( objBytes );
- ois = new java.io.ObjectInputStream( bais );
-
- obj = ois.readObject();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- catch( java.lang.ClassNotFoundException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- finally
- {
- try{ bais.close(); } catch( Exception e ){}
- try{ ois.close(); } catch( Exception e ){}
- } // end finally
-
- return obj;
- } // end decodeObject
-
-
-
- /**
- * Convenience method for encoding data to a file.
- *
- * @param dataToEncode byte array of data to encode in base64 form
- * @param filename Filename for saving encoded data
- * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- *
- * @since 2.1
- */
- public static boolean encodeToFile( byte[] dataToEncode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.ENCODE );
- bos.write( dataToEncode );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
-
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end encodeToFile
-
-
- /**
- * Convenience method for decoding data to a file.
- *
- * @param dataToDecode Base64-encoded data as a string
- * @param filename Filename for saving decoded data
- * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- *
- * @since 2.1
- */
- public static boolean decodeToFile( String dataToDecode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.DECODE );
- bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end decodeToFile
-
-
-
-
- /**
- * Convenience method for reading a base64-encoded
- * file and decoding it.
- *
- * @param filename Filename for reading encoded data
- * @return decoded byte array or null if unsuccessful
- *
- * @since 2.1
- */
- public static byte[] decodeFromFile( String filename )
- {
- byte[] decodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = null;
- int length = 0;
- int numBytes = 0;
-
- // Check for size of file
- if( file.length() > Integer.MAX_VALUE )
- {
- System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
- return null;
- } // end if: file too big for int index
- buffer = new byte[ (int)file.length() ];
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.DECODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- decodedData = new byte[ length ];
- System.arraycopy( buffer, 0, decodedData, 0, length );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error decoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return decodedData;
- } // end decodeFromFile
-
-
-
- /**
- * Convenience method for reading a binary file
- * and base64-encoding it.
- *
- * @param filename Filename for reading binary data
- * @return base64-encoded string or null if unsuccessful
- *
- * @since 2.1
- */
- public static String encodeFromFile( String filename )
- {
- String encodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4),40) ]; // Need max() for math on small files (v2.2.1)
- int length = 0;
- int numBytes = 0;
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.ENCODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error encoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return encodedData;
- } // end encodeFromFile
-
-
-
-
- /**
- * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
- *
- * @param infile Input file
- * @param outfile Output file
- * @return true if the operation is successful
- * @since 2.2
- */
- public static boolean encodeFileToFile( String infile, String outfile )
- {
- boolean success = false;
- java.io.InputStream in = null;
- java.io.OutputStream out = null;
- try{
- in = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( infile ) ),
- Base64.ENCODE );
- out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
- byte[] buffer = new byte[65536]; // 64K
- int read = -1;
- while( ( read = in.read(buffer) ) >= 0 ){
- out.write( buffer,0,read );
- } // end while: through file
- success = true;
- } catch( java.io.IOException exc ){
- exc.printStackTrace();
- } finally{
- try{ in.close(); } catch( Exception exc ){}
- try{ out.close(); } catch( Exception exc ){}
- } // end finally
-
- return success;
- } // end encodeFileToFile
-
-
-
- /**
- * Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
- *
- * @param infile Input file
- * @param outfile Output file
- * @return true if the operation is successful
- * @since 2.2
- */
- public static boolean decodeFileToFile( String infile, String outfile )
- {
- boolean success = false;
- java.io.InputStream in = null;
- java.io.OutputStream out = null;
- try{
- in = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( infile ) ),
- Base64.DECODE );
- out = new java.io.BufferedOutputStream( new java.io.FileOutputStream( outfile ) );
- byte[] buffer = new byte[65536]; // 64K
- int read = -1;
- while( ( read = in.read(buffer) ) >= 0 ){
- out.write( buffer,0,read );
- } // end while: through file
- success = true;
- } catch( java.io.IOException exc ){
- exc.printStackTrace();
- } finally{
- try{ in.close(); } catch( Exception exc ){}
- try{ out.close(); } catch( Exception exc ){}
- } // end finally
-
- return success;
- } // end decodeFileToFile
-
-
- /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.InputStream} will read data from another
- * <tt>java.io.InputStream</tt>, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class InputStream extends java.io.FilterInputStream
- {
- private boolean encode; // Encoding or decoding
- private int position; // Current position in the buffer
- private byte[] buffer; // Small buffer holding converted data
- private int bufferLength; // Length of buffer (3 or 4)
- private int numSigBytes; // Number of meaningful bytes in the buffer
- private int lineLength;
- private boolean breakLines; // Break lines at less than 80 characters
- private int options; // Record options used to create the stream.
- private byte[] alphabet; // Local copies to avoid extra method calls
- private byte[] decodabet; // Local copies to avoid extra method calls
-
-
- /**
- * Constructs a {@link Base64.InputStream} in DECODE mode.
- *
- * @param in the <tt>java.io.InputStream</tt> from which to read data.
- * @since 1.3
- */
- public InputStream( java.io.InputStream in )
- {
- this( in, DECODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.InputStream} in
- * either ENCODE or DECODE mode.
- * <p>
- * Valid options:<pre>
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
- *
- *
- * @param in the <tt>java.io.InputStream</tt> from which to read data.
- * @param options Specified options
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public InputStream( java.io.InputStream in, int options )
- {
- super( in );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 4 : 3;
- this.buffer = new byte[ bufferLength ];
- this.position = -1;
- this.lineLength = 0;
- this.options = options; // Record for later, mostly to determine which alphabet to use
- this.alphabet = getAlphabet(options);
- this.decodabet = getDecodabet(options);
- } // end constructor
-
- /**
- * Reads enough of the input stream to convert
- * to/from Base64 and returns the next byte.
- *
- * @return next byte
- * @since 1.3
- */
- public int read() throws java.io.IOException
- {
- // Do we need to get data?
- if( position < 0 )
- {
- if( encode )
- {
- byte[] b3 = new byte[3];
- int numBinaryBytes = 0;
- for( int i = 0; i < 3; i++ )
- {
- try
- {
- int b = in.read();
-
- // If end of stream, b is -1.
- if( b >= 0 )
- {
- b3[i] = (byte)b;
- numBinaryBytes++;
- } // end if: not end of stream
-
- } // end try: read
- catch( java.io.IOException e )
- {
- // Only a problem if we got no data at all.
- if( i == 0 )
- throw e;
-
- } // end catch
- } // end for: each needed input byte
-
- if( numBinaryBytes > 0 )
- {
- encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
- position = 0;
- numSigBytes = 4;
- } // end if: got data
- else
- {
- return -1;
- } // end else
- } // end if: encoding
-
- // Else decoding
- else
- {
- byte[] b4 = new byte[4];
- int i = 0;
- for( i = 0; i < 4; i++ )
- {
- // Read four "meaningful" bytes:
- int b = 0;
- do{ b = in.read(); }
- while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
-
- if( b < 0 )
- break; // Reads a -1 if end of stream
-
- b4[i] = (byte)b;
- } // end for: each needed input byte
-
- if( i == 4 )
- {
- numSigBytes = decode4to3( b4, 0, buffer, 0, options );
- position = 0;
- } // end if: got four characters
- else if( i == 0 ){
- return -1;
- } // end else if: also padded correctly
- else
- {
- // Must have broken out from above.
- throw new java.io.IOException( "Improperly padded Base64 input." );
- } // end
-
- } // end else: decode
- } // end else: get data
-
- // Got data?
- if( position >= 0 )
- {
- // End of relevant data?
- if( /*!encode &&*/ position >= numSigBytes )
- return -1;
-
- if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- lineLength = 0;
- return '\n';
- } // end if
- else
- {
- lineLength++; // This isn't important when decoding
- // but throwing an extra "if" seems
- // just as wasteful.
-
- int b = buffer[ position++ ];
-
- if( position >= bufferLength )
- position = -1;
-
- return b & 0xFF; // This is how you "cast" a byte that's
- // intended to be unsigned.
- } // end else
- } // end if: position >= 0
-
- // Else error
- else
- {
- // When JDK1.4 is more accepted, use an assertion here.
- throw new java.io.IOException( "Error in Base64 code reading stream." );
- } // end else
- } // end read
-
-
- /**
- * Calls {@link #read()} repeatedly until the end of stream
- * is reached or <var>len</var> bytes are read.
- * Returns number of bytes read into array or -1 if
- * end of stream is encountered.
- *
- * @param dest array to hold values
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @return bytes read into array or -1 if end of stream is encountered.
- * @since 1.3
- */
- public int read( byte[] dest, int off, int len ) throws java.io.IOException
- {
- int i;
- int b;
- for( i = 0; i < len; i++ )
- {
- b = read();
-
- //if( b < 0 && i == 0 )
- // return -1;
-
- if( b >= 0 )
- dest[off + i] = (byte)b;
- else if( i == 0 )
- return -1;
- else
- break; // Out of 'for' loop
- } // end for: each byte read
- return i;
- } // end read
-
- } // end inner class InputStream
-
-
-
-
-
-
- /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.OutputStream} will write data to another
- * <tt>java.io.OutputStream</tt>, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class OutputStream extends java.io.FilterOutputStream
- {
- private boolean encode;
- private int position;
- private byte[] buffer;
- private int bufferLength;
- private int lineLength;
- private boolean breakLines;
- private byte[] b4; // Scratch used in a few places
- private boolean suspendEncoding;
- private int options; // Record for later
- private byte[] alphabet; // Local copies to avoid extra method calls
- private byte[] decodabet; // Local copies to avoid extra method calls
-
- /**
- * Constructs a {@link Base64.OutputStream} in ENCODE mode.
- *
- * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out )
- {
- this( out, ENCODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.OutputStream} in
- * either ENCODE or DECODE mode.
- * <p>
- * Valid options:<pre>
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * <i>Note: Technically, this makes your encoding non-compliant.</i>
- * </pre>
- * <p>
- * Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
- *
- * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
- * @param options Specified options.
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out, int options )
- {
- super( out );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 3 : 4;
- this.buffer = new byte[ bufferLength ];
- this.position = 0;
- this.lineLength = 0;
- this.suspendEncoding = false;
- this.b4 = new byte[4];
- this.options = options;
- this.alphabet = getAlphabet(options);
- this.decodabet = getDecodabet(options);
- } // end constructor
-
-
- /**
- * Writes the byte to the output stream after
- * converting to/from Base64 notation.
- * When encoding, bytes are buffered three
- * at a time before the output stream actually
- * gets a write() call.
- * When decoding, bytes are buffered four
- * at a time.
- *
- * @param theByte the byte to write
- * @since 1.3
- */
- public void write(int theByte) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theByte );
- return;
- } // end if: supsended
-
- // Encode?
- if( encode )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to encode.
- {
- out.write( encode3to4( b4, buffer, bufferLength, options ) );
-
- lineLength += 4;
- if( breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- out.write( NEW_LINE );
- lineLength = 0;
- } // end if: end of line
-
- position = 0;
- } // end if: enough to output
- } // end if: encoding
-
- // Else, Decoding
- else
- {
- // Meaningful Base64 character?
- if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to output.
- {
- int len = Base64.decode4to3( buffer, 0, b4, 0, options );
- out.write( b4, 0, len );
- //out.write( Base64.decode4to3( buffer ) );
- position = 0;
- } // end if: enough to output
- } // end if: meaningful base64 character
- else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC )
- {
- throw new java.io.IOException( "Invalid character in Base64 data." );
- } // end else: not white space either
- } // end else: decoding
- } // end write
-
-
-
- /**
- * Calls {@link #write(int)} repeatedly until <var>len</var>
- * bytes are written.
- *
- * @param theBytes array from which to read bytes
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @since 1.3
- */
- public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theBytes, off, len );
- return;
- } // end if: supsended
-
- for( int i = 0; i < len; i++ )
- {
- write( theBytes[ off + i ] );
- } // end for: each byte written
-
- } // end write
-
-
-
- /**
- * Method added by PHIL. [Thanks, PHIL. -Rob]
- * This pads the buffer without closing the stream.
- */
- public void flushBase64() throws java.io.IOException
- {
- if( position > 0 )
- {
- if( encode )
- {
- out.write( encode3to4( b4, buffer, position, options ) );
- position = 0;
- } // end if: encoding
- else
- {
- throw new java.io.IOException( "Base64 input not properly padded." );
- } // end else: decoding
- } // end if: buffer partially full
-
- } // end flush
-
-
- /**
- * Flushes and closes (I think, in the superclass) the stream.
- *
- * @since 1.3
- */
- public void close() throws java.io.IOException
- {
- // 1. Ensure that pending characters are written
- flushBase64();
-
- // 2. Actually close the stream
- // Base class both flushes and closes.
- super.close();
-
- buffer = null;
- out = null;
- } // end close
-
-
-
- /**
- * Suspends encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void suspendEncoding() throws java.io.IOException
- {
- flushBase64();
- this.suspendEncoding = true;
- } // end suspendEncoding
-
-
- /**
- * Resumes encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void resumeEncoding()
- {
- this.suspendEncoding = false;
- } // end resumeEncoding
-
-
-
- } // end inner class OutputStream
-
-
-} // end class Base64
diff --git a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java b/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java
deleted file mode 100644
index ef6d4eed73a1..000000000000
--- a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTFilterOLEExtracter.java
+++ /dev/null
@@ -1,386 +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 .
- */
-
-package com.sun.star.comp.xsltfilter;
-
-// Standard Java classes
-import java.io.FileWriter;
-import java.util.zip.Inflater;
-import java.util.zip.Deflater;
-
-// StarOffice Interfaces and UNO
-import com.sun.star.bridge.XBridgeFactory;
-import com.sun.star.bridge.XBridge;
-import com.sun.star.connection.XConnector;
-import com.sun.star.connection.XConnection;
-import com.sun.star.container.XNameContainer;
-import com.sun.star.embed.XTransactedObject;
-import com.sun.star.io.XStream;
-import com.sun.star.io.XSeekable;
-import com.sun.star.io.XInputStream;
-import com.sun.star.io.XOutputStream;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XComponent;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.uno.UnoRuntime;
-
-/** This class is an xalan extension class. It provider 2 elements
- * and 2 functions to used in xslt script. With this elements and functions
- * we can convert between oledata between Wordml and OOo flat.
- * To use it, we need a running OOo. There are two ways to get the XMultiServiceFactory.
- * When called by OOo xslt filter, an XMultiServiceFactory will be add to the transformer
- * by setParameter(), then we can get it using getParameter(). Another way is using an
- * XConnection to connect to a running OOo. We connect to a running OOo, we need know the
- * uno url. It can be set in the xslt script. The default uno url is:
- * "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
- * see XSLTXalanOLEExtracter.java
- */
-public class XSLTFilterOLEExtracter {
-
- protected XMultiServiceFactory m_xMSF;
- protected XNameContainer m_Storage;
- protected XStream m_RootStream;
- protected XConnection m_Connection;
- protected String sConnectionString;
- private static final String UNO_URL = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager";
-
- public XSLTFilterOLEExtracter() {
- }
-
- public void init(String unoUrl) {
- if (unoUrl == null || unoUrl.equals("")) {
- unoUrl = UNO_URL;
- }
- debugln("Init with uno url=" + unoUrl);
- if (null == m_xMSF) {
- try {
- m_xMSF = connectAwareGetServiceFactory();
- } catch (Exception ex) {
- System.err.println("Could not connect to the office '" + unoUrl + "'\n" + ex.getMessage());
- }
- }
- }
-
- public void exit() {
- m_Storage = null;
- m_xMSF = null;
- if (null != m_Connection) {
- try {
- m_Connection.close();
- } catch (Exception ex) {
- System.err.println("Could not close connection to the office.\n" + ex.getMessage());
- }
- }
- }
- //If aName = "oledata.mso" then we load the root storage from the given base64 string
- //Otherwise we compress the stream and add it to the root storage under the name of aName
- public void insertByName(String aName, String aBase64) {
- debugln("insertByName(" + aName + " : " + aBase64 + ")");
- if (aName.equals("oledata.mso")) {
- loadRootStorageFromBase64(aBase64);
- } else {
- ensureCreateRootStorage();
- insertSubStorage(aName, aBase64);
- }
- }
- //If aName = "oledata.mso" then we return the base64 encoded string of the root storage
- //Otherwise we return the base64 encoded string of the sub stream under the name of aName
- public String getByName(String aName) {
- if (aName.equals("oledata.mso")) {
- try {
- //get the length and seek to 0
- XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, m_RootStream);
- int oleLength = (int) xSeek.getLength();
- xSeek.seek(0);
- xSeek = null;
- //read all bytes
- XInputStream xInput = m_RootStream.getInputStream();
- byte oledata[][] = new byte[1][oleLength];
- xInput.readBytes(oledata, oleLength);
- //return the base64 encoded string
- return Base64.encodeBytes(oledata[0]);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- } else {
- return getEncodedSubStorage(aName);
- }
- return "";
- }
- //get the sub stream which name = aName, decompress it and return the base64 encoded string
- public String getEncodedSubStorage(String aName) {
- debugln("getByName(" + aName + ")");
- try {
- if (!m_Storage.hasByName(aName)) {
- return "Not Found:" + aName;
- }
- Object oSubStream = m_Storage.getByName(aName);
- if (oSubStream == null) {
- return "Not Found:" + aName;
- }
- XInputStream xSubStream = UnoRuntime.queryInterface(XInputStream.class,
- oSubStream);
- if (xSubStream == null) {
- return "Not Found:" + aName;
- }
- //The first four byte are the length of the uncompressed data
- byte pLength[][] = new byte[1][4];
- XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xSubStream);
- xSeek.seek(0);
- xSeek = null;
- //Get the uncompressed length
- int readbytes = xSubStream.readBytes(pLength, 4);
- if (4 != readbytes) {
- System.out.println("readbytes:" + readbytes);
- return "Can not read the length.";
- }
- int oleLength = (pLength[0][0] << 0) + (pLength[0][1] << 8) + (pLength[0][2] << 16) + (pLength[0][3] << 24);
- byte pContents[][] = new byte[1][oleLength];
- //Read all bytes. The compressed length should less then the uncompressed length
- readbytes = xSubStream.readBytes(pContents, oleLength);
- if (oleLength < readbytes) {
- return "oleLength :" + oleLength + " readbytes: " + readbytes;
- }
-
- // Decompress the bytes
- Inflater decompresser = new Inflater();
- decompresser.setInput(pContents[0], 0, readbytes);
- byte[] result = new byte[oleLength];
- int resultLength = decompresser.inflate(result);
- decompresser.end();
-
- //return the base64 string of the uncompressed data
- return Base64.encodeBytes(result);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return "";
- }
-
- public XStream CreateTempFileStream(XMultiServiceFactory xMSF) {
- // try to get temporary file representation
- XStream xTempFileStream = null;
- try {
- Object oTempFile = xMSF.createInstance("com.sun.star.io.TempFile");
- xTempFileStream = UnoRuntime.queryInterface(XStream.class, oTempFile);
- } catch (Exception e) {
- }
-
- if (xTempFileStream == null) {
- System.out.println("Can't create temporary file!");
- }
-
- return xTempFileStream;
- }
- //decode the base64 string and create an com.sun.star.embed.OLESimpleStorage from it
- public void loadRootStorageFromBase64(String aBase64) {
- try {
- //Decode and write the data to an temp stream
- byte[] oledata = Base64.decode(aBase64);
- m_RootStream = CreateTempFileStream(m_xMSF);
- XOutputStream xOutput = m_RootStream.getOutputStream();
- xOutput.writeBytes(oledata);
- xOutput.flush();
- //Get the input stream and seek to begin
- XInputStream xInput = m_RootStream.getInputStream();
- XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xInput);
- xSeek.seek(0);
- oledata = null;
- xSeek = null;
-
- //create an com.sun.star.embed.OLESimpleStorage from the temp stream
- Object pArgs[] = new Object[1];
- pArgs[0] = xInput;
- Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
- pArgs = null;
-
- m_Storage = UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- //Create a empty OLESimpleStorage if there is not one
- public void ensureCreateRootStorage() {
- if (null == m_RootStream || null == m_Storage) {
- try {
- m_RootStream = CreateTempFileStream(m_xMSF);
-
- Object pArgs[] = new Object[1];
- pArgs[0] = m_RootStream;
- Object oTempStorage = m_xMSF.createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", pArgs);
- pArgs = null;
-
- m_Storage = UnoRuntime.queryInterface(XNameContainer.class, oTempStorage);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- //decode the base64 string and insert the length and the compressed data of it to
- //the root storage as a sub stream under aName
- public void insertSubStorage(String aName, String aBase64) {
- try {
- //decode the base64 string
- byte[] oledata = Base64.decode(aBase64);
- //create a temp stream to write data to
- XStream subStream = CreateTempFileStream(m_xMSF);
- XInputStream xInput = subStream.getInputStream();
- XOutputStream xOutput = subStream.getOutputStream();
- //write the length to the temp stream
- byte oleHead[] = new byte[4];
- oleHead[0] = (byte) ((oledata.length >>> 0) & 0xFF);
- oleHead[1] = (byte) ((oledata.length >>> 8) & 0xFF);
- oleHead[2] = (byte) ((oledata.length >>> 16) & 0xFF);
- oleHead[3] = (byte) ((oledata.length >>> 24) & 0xFF);
- xOutput.writeBytes(oleHead);
-
- // Compress the bytes
- byte[] output = new byte[oledata.length];
- Deflater compresser = new Deflater();
- compresser.setInput(oledata);
- compresser.finish();
- int compressedDataLength = compresser.deflate(output);
- //realloc the data length
- byte[] compressedBytes = new byte[compressedDataLength];
- for (int i = 0; i < compressedDataLength; i++) {
- compressedBytes[i] = output[i];
- }
-
- //write the compressed data to the temp stream
- xOutput.writeBytes(compressedBytes);
- //seek to 0
- XSeekable xSeek = UnoRuntime.queryInterface(XSeekable.class, xInput);
- xSeek.seek(0);
- xSeek = null;
- oledata = null;
-
- //insert the temp stream as a sub stream and use an XTransactedObject to commit it immediately
- XTransactedObject xTransact = UnoRuntime.queryInterface(XTransactedObject.class, m_Storage);
- m_Storage.insertByName(aName, xInput);
- xTransact.commit();
- xTransact = null;
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /** separtates the uno-url into 3 different parts.
- */
- protected static String[] parseUnoUrl(String url) {
- String[] aRet = new String[3];
-
- if (!url.startsWith("uno:")) {
- return null;
- }
-
- int semicolon = url.indexOf(';');
- if (semicolon == -1) {
- return null;
- }
-
- aRet[0] = url.substring(4, semicolon);
- int nextSemicolon = url.indexOf(';', semicolon + 1);
-
- if (semicolon == -1) {
- return null;
- }
- aRet[1] = url.substring(semicolon + 1, nextSemicolon);
-
- aRet[2] = url.substring(nextSemicolon + 1);
- return aRet;
- }
- //connect to running OOo and keep an XConnection object so that we can disconnect from OOo as we wish
- protected XMultiServiceFactory connectAwareGetServiceFactory() throws com.sun.star.uno.Exception,
- com.sun.star.uno.RuntimeException,
- Exception {
-
- // Get component context
- XComponentContext xComponentContext =
- com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
-
- // instantiate connector service
- Object x = xComponentContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.connection.Connector", xComponentContext);
-
- XConnector xConnector = UnoRuntime.queryInterface(XConnector.class, x);
-
- String a[] = parseUnoUrl(sConnectionString);
- if (null == a) {
- throw new com.sun.star.uno.Exception("Couldn't parse uno-url " + sConnectionString);
- }
-
- // connect using the connection string part of the uno-url only.
- m_Connection = xConnector.connect(a[0]);
-
- x = xComponentContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.bridge.BridgeFactory", xComponentContext);
-
- XBridgeFactory xBridgeFactory = UnoRuntime.queryInterface(
- XBridgeFactory.class, x);
-
- // create a nameless bridge with no instance provider
- // using the middle part of the uno-url
- XBridge bridge = xBridgeFactory.createBridge("", a[1], m_Connection, null);
-
- // query for the XComponent interface and add this as event listener
- XComponent xComponent = UnoRuntime.queryInterface(
- XComponent.class, bridge);
-
- // get the remote instance
- x = bridge.getInstance(a[2]);
-
- // Did the remote server export this object ?
- if (null == x) {
- throw new com.sun.star.uno.Exception(
- "Server didn't provide an instance for" + a[2], null);
- }
-
- XMultiServiceFactory xFac = UnoRuntime.queryInterface(XMultiServiceFactory.class, x);
- return xFac;
- }
- protected static boolean DEBUG = false;
- protected static boolean DEBUGCHK = false;
- protected static String debugfile;
-
- protected static void debugln(String s) {
- debug(s + "\n");
- }
-
- protected static void debug(String s) {
- if (!DEBUGCHK) {
- if (System.getProperty("xsltfilter.debug") == null) {
- DEBUGCHK = true;
- return;
- } else {
- debugfile = System.getProperty("xsltfilter.debug");
- DEBUG = true;
- }
- }
- if (!DEBUG) {
- return;
- }
- try {
- FileWriter dbgwriter = new FileWriter(debugfile, true);
- dbgwriter.write(s);
- dbgwriter.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java b/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java
deleted file mode 100644
index 17ef2047353d..000000000000
--- a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java
+++ /dev/null
@@ -1,496 +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 .
- */
-
-package com.sun.star.comp.xsltfilter;
-
-// Standard Java classes
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.lang.ref.WeakReference;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-
-// Imported TraX classes
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-//StarOffice Interfaces and UNO
-import com.sun.star.beans.NamedValue;
-import com.sun.star.comp.loader.FactoryHelper;
-import com.sun.star.io.XActiveDataControl;
-import com.sun.star.io.XActiveDataSink;
-import com.sun.star.io.XActiveDataSource;
-import com.sun.star.io.XInputStream;
-import com.sun.star.io.XOutputStream;
-import com.sun.star.io.XSeekable;
-import com.sun.star.io.XStreamListener;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XServiceName;
-import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-
-//Uno to java Adaptor
-import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
-import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter;
-import javax.xml.transform.Templates;
-
-import net.sf.saxon.FeatureKeys;
-
-/** This outer class provides an inner class to implement the service
- * description and a method to instantiate the
- * component on demand (__getServiceFactory()).
- */
-public class XSLTransformer
- implements XTypeProvider, XServiceName, XServiceInfo, XActiveDataSink,
- XActiveDataSource, XActiveDataControl, XInitialization, URIResolver, EntityResolver {
-
- /**
- * This component provides java based XSL transformations
- * A SAX based interface is not feasible when crossing language bordes
- * since too much time would be wasted by bridging the events between environments
- * example: 190 pages document, 82000 events 8seconds transform 40(!) sec. bridging
- *
- */
- private XInputStream m_xis;
- private XOutputStream m_xos; // private static HashMap templatecache;
- private static final String STATSPROP = "XSLTransformer.statsfile";
- private static PrintStream statsp;
- private String stylesheeturl;
- private String targeturl;
- private String targetbaseurl;
- private String sourceurl;
- private String sourcebaseurl;
- private String pubtype = new String();
- private String systype = new String(); // processing thread
- private Thread t; // listeners
- private ArrayList<XStreamListener> listeners = new ArrayList<XStreamListener>(); //
- private XMultiServiceFactory svcfactory; // cache for transformations by stylesheet
- private static Map<String,WeakReference<Transformation>> xsltReferences = new HashMap<String,WeakReference<Transformation>>();
- // struct for cached stylesheets
- private static class Transformation {
-
- public Templates cachedXSLT;
- public long lastmod;
- }
- // Resolve URIs to an empty source
- public Source resolve(String href, String base) {
- return new StreamSource(new StringReader(""));
- }
-
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, java.io.IOException {
- return new InputSource(new StringReader(""));
- }
- // --- Initialization ---
- public XSLTransformer(XMultiServiceFactory msf) {
- svcfactory = msf;
- }
-
- public void initialize(Object[] values) throws com.sun.star.uno.Exception {
- // some configurable debugging
- String statsfilepath = null;
- if ((statsfilepath = System.getProperty(STATSPROP)) != null) {
- try {
- File statsfile = new File(statsfilepath);
- statsp = new PrintStream(new FileOutputStream(statsfile.getPath(), false));
- } catch (java.lang.Exception e) {
- System.err.println("XSLTransformer: could not open statsfile'" + statsfilepath + "'");
- System.err.println(" " + e.getClass().getName() + ": " + e.getMessage());
- System.err.println(" output disabled");
- }
- }
-
- // reading the values
- NamedValue nv = null;
- debug("The transformation's parameters as 'name = value' pairs:\n");
-
- for (int i = 0; i < values.length; i++) {
- nv = (NamedValue) AnyConverter.toObject(new Type(NamedValue.class), values[i]);
-
- if (nv.Name != null && !nv.Name.equals("")) {
- debug(nv.Name + " = " + nv.Value);
- }
-
- if (nv.Name.equals("StylesheetURL")) {
- stylesheeturl = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("SourceURL")) {
- sourceurl = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("TargetURL")) {
- targeturl = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("SourceBaseURL")) {
- sourcebaseurl = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("TargetBaseURL")) {
- targetbaseurl = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("SystemType")) {
- systype = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- } else if (nv.Name.equals("PublicType")) {
- pubtype = (String) AnyConverter.toObject(
- new Type(String.class), nv.Value);
- }
- }
- }
-
- // --- XActiveDataSink xistream = aStream;
- public void setInputStream(XInputStream aStream) {
- m_xis = aStream;
- }
-
- public com.sun.star.io.XInputStream getInputStream() {
- return m_xis;
- }
-
- // --- XActiveDataSource
- public void setOutputStream(XOutputStream aStream) {
- m_xos = aStream;
- }
-
- public com.sun.star.io.XOutputStream getOutputStream() {
- return m_xos;
- }
-
- // --- XActiveDataControl
- public void addListener(XStreamListener aListener) {
- if (aListener != null && !listeners.contains(aListener)) {
- listeners.add(aListener);
- }
- }
-
- public void removeListener(XStreamListener aListener) {
- if (aListener != null) {
- listeners.remove(aListener);
- }
-
- }
-
- public void start() {
- // notify listeners
- t = new Thread() {
-
- @Override
- public void run() {
-
- // Local variabes used outside try block in finally block
- InputStream is = null;
- Source source = null;
- BufferedOutputStream os = null;
- PrintStream origOut = System.out;
- PrintStream origErr = System.err;
- if (statsp != null) {
- System.setErr(statsp);
- System.setOut(statsp);
- }
- try {
- debug("\n\nStarting transformation...");
-
- // Set up context class loader for SAXParserFactory and
- // TransformerFactory calls below:
- setContextClassLoader(this.getClass().getClassLoader());
-
- for (Iterator<XStreamListener> e = listeners.iterator(); e.hasNext();) {
- XStreamListener l = e.next();
- l.started();
- }
-
- XSeekable xseek = UnoRuntime.queryInterface(XSeekable.class, m_xis);
- if (xseek != null) {
- xseek.seek(0);
- }
-
- is = new BufferedInputStream(
- new XInputStreamToInputStreamAdapter(m_xis));
- //Source xmlsource = new StreamSource(xmlinput);
- SAXParserFactory spf = SAXParserFactory.newInstance();
- spf.setValidating(false);
- spf.setNamespaceAware(true);
- XMLReader xmlReader = spf.newSAXParser().getXMLReader();
- xmlReader.setEntityResolver(XSLTransformer.this);
- source = new SAXSource(xmlReader, new InputSource(is));
-
- // in order to help performance and to remedy a a possible memory
- // leak in xalan, where it seems, that Transformer instances cannot
- // be reclaimed though they are no longer referenced here, we use
- // a cache of weak references (ie. xsltReferences) created for specific
- // style sheet URLs see also #i48384#
-
- Templates xsltTemplate = null;
- Transformer transformer = null;
- Transformation transformation = null;
- // File stylefile = new File(new URI(stylesheeturl));
- long lastmod = 0;
- try {
- URL uStyle = new URL(stylesheeturl);
- URLConnection c = uStyle.openConnection();
- lastmod = c.getLastModified();
- } catch (java.lang.Exception ex) {
- // lastmod will remain at 0;
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
-
- synchronized (xsltReferences) {
- WeakReference<Transformation> ref = null;
- // try to get the xsltTemplate reference from the cache
- if ((ref = xsltReferences.get(stylesheeturl)) == null ||
- (transformation = ref.get()) == null ||
- ref.get().lastmod < lastmod) {
- // we cannot find a valid reference for this stylesheet
- // or the stylsheet was updated
- if (ref != null) {
- xsltReferences.remove(stylesheeturl);
- }
- // create new xsltTemplate for this stylesheet
- TransformerFactory tfactory = TransformerFactory.newInstance();
- debug("TransformerFactory is '" + tfactory.getClass().getName() + "'");
- // some external saxons (Debian, Ubuntu, ...) have this disabled
- // per default
- tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
- xsltTemplate = tfactory.newTemplates(new StreamSource(stylesheeturl));
-
- // store the transformation into the cache
- transformation = new Transformation();
- transformation.lastmod = lastmod;
- transformation.cachedXSLT = xsltTemplate;
- ref = new WeakReference<Transformation>(transformation);
- xsltReferences.put(stylesheeturl, ref);
- }
- }
- xsltTemplate = transformation.cachedXSLT;
- transformer = xsltTemplate.newTransformer();
- transformer.setOutputProperty("encoding", "UTF-8");
- // transformer.setURIResolver(XSLTransformer.this);
-
- // invalid to set 'null' as parameter as 'null' is not a valid Java object
- if (sourceurl != null) {
- transformer.setParameter("sourceURL", sourceurl);
- }
- if (sourcebaseurl != null) {
- transformer.setParameter("sourceBaseURL", sourcebaseurl);
- }
- if (targeturl != null) {
- transformer.setParameter("targetURL", targeturl);
- }
- if (targetbaseurl != null) {
- transformer.setParameter("targetBaseURL", targetbaseurl);
- }
- if (pubtype != null) {
- transformer.setParameter("publicType", pubtype);
- }
- if (systype != null) {
- transformer.setParameter("systemType", systype);
- }
- if (svcfactory != null) {
- transformer.setParameter("XMultiServiceFactory", svcfactory);
- }
- os = new BufferedOutputStream(
- new XOutputStreamToOutputStreamAdapter(m_xos));
- StreamResult sr = new StreamResult(os);
- long tstart = System.currentTimeMillis();
- transformer.transform(source, sr);
- debug("finished transformation in " + (System.currentTimeMillis() - tstart) + "ms");
-
- } catch (java.lang.Throwable ex) {
- // notify any listeners about close
- for (Iterator<XStreamListener> e = listeners.iterator(); e.hasNext();) {
-
- XStreamListener l = e.next();
- l.error(new com.sun.star.uno.Exception(ex.getClass().getName() + ": " + ex.getMessage()));
- }
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- } finally {
- // dereference input buffer
- source = null;
- try {
- if (is != null) {
- is.close();
- }
- } catch (java.lang.Throwable ex) {
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
- try {
- if (os != null) {
- os.close();
- }
- } catch (java.lang.Throwable ex) {
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
- try {
- if (m_xis != null) {
- m_xis.closeInput();
- }
- } catch (java.lang.Throwable ex) {
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
- try {
- if (m_xos != null) {
- m_xos.closeOutput();
- }
- } catch (java.lang.Throwable ex) {
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
-
- // resetting standard input/error streams from logfile to default
- if (statsp != null) {
- System.setErr(origErr);
- System.setOut(origOut);
- }
- // try to release references asap...
- m_xos = null;
- m_xis = null;
- is = null;
- os = null;
- // notify any listeners about close
- if (listeners != null) {
- for (Iterator<XStreamListener> e = listeners.iterator(); e.hasNext();) {
- XStreamListener l = e.next();
- l.closed();
- }
- }
- }
- }
- };
- t.start();
- } /* a statsfile have to be created as precondition to use this function */
-
-
- private static final void debug(String s) {
- if (statsp != null) {
- statsp.println(s);
- }
- }
-
- public void terminate() {
- try {
- debug("terminate called");
- if (t.isAlive()) {
- t.interrupt();
- for (Iterator<XStreamListener> e = listeners.iterator(); e.hasNext();) {
- XStreamListener l = e.next();
- l.terminated();
- }
- }
- } catch (java.lang.Exception ex) {
- if (statsp != null) {
- statsp.println(ex.getClass().getName() + ": " + ex.getMessage());
- ex.printStackTrace(statsp);
- }
- }
- } // --- component management interfaces... ---
- private final static String _serviceName = "com.sun.star.comp.JAXTHelper";
-
- // Implement methods from interface XTypeProvider
- public byte[] getImplementationId() {
- byte[] byteReturn = {};
- byteReturn = new String("" + this.hashCode()).getBytes();
- return (byteReturn);
- }
-
- public com.sun.star.uno.Type[] getTypes() {
- Type[] typeReturn = {};
- try {
- typeReturn = new Type[]{
- new Type(XTypeProvider.class),
- new Type(XServiceName.class),
- new Type(XServiceInfo.class),
- new Type(XActiveDataSource.class),
- new Type(XActiveDataSink.class),
- new Type(XActiveDataControl.class),
- new Type(XInitialization.class)
- };
- } catch (java.lang.Exception exception) {
- }
-
- return (typeReturn);
- }
-
- // --- Implement method from interface XServiceName ---
- public String getServiceName() {
- return (_serviceName);
- }
-
- // --- Implement methods from interface XServiceInfo ---
- public boolean supportsService(String stringServiceName) {
- return (stringServiceName.equals(_serviceName));
- }
-
- public String getImplementationName() {
- return (XSLTransformer.class.getName());
- }
-
- public String[] getSupportedServiceNames() {
- String[] stringSupportedServiceNames = {_serviceName};
- return stringSupportedServiceNames;
- }
-
- // --- component registration methods ---
- public static XSingleServiceFactory __getServiceFactory(
- String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) {
- XSingleServiceFactory xSingleServiceFactory = null;
- if (implName.indexOf("XSLTransformer") != -1) {
- xSingleServiceFactory = FactoryHelper.getServiceFactory(XSLTransformer.class,
- _serviceName, multiFactory, regKey);
- }
- return xSingleServiceFactory;
- }
-}
diff --git a/filter/source/xsltfilter/xsltfilter.component b/filter/source/xsltfilter/xsltfilter.component
index b96a13fe8432..0495ad95ed2b 100644
--- a/filter/source/xsltfilter/xsltfilter.component
+++ b/filter/source/xsltfilter/xsltfilter.component
@@ -23,6 +23,6 @@
<service name="com.sun.star.documentconversion.XSLTFilter"/>
</implementation>
<implementation name="com.sun.star.comp.documentconversion.LibXSLTTransformer">
- <service name="com.sun.star.documentconversion.LibXSLTTransformer"/>
+ <service name="com.sun.star.xml.xslt.XSLTTransformer"/>
</implementation>
</component>