summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MathMLDTD/prj/d.lst4
-rw-r--r--UnoControls/prj/build.lst2
-rw-r--r--UnoControls/prj/d.lst12
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx5
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx5
-rw-r--r--accessibility/prj/build.lst2
-rw-r--r--accessibility/prj/d.lst12
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxBase.cxx24
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx11
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx11
-rw-r--r--accessibility/source/extended/AccessibleGridControlBase.cxx22
-rw-r--r--accessibility/source/extended/AccessibleGridControlHeader.cxx11
-rw-r--r--accessibility/source/extended/AccessibleGridControlTableBase.cxx11
-rw-r--r--accessibility/source/helper/accresmgr.cxx4
-rw-r--r--automation/inc/automation/commdefines.hxx20
-rw-r--r--automation/inc/automation/commtypes.hxx11
-rw-r--r--automation/prj/d.lst44
-rw-r--r--automation/source/inc/cmdbasestream.hxx32
-rw-r--r--automation/source/inc/icommstream.hxx14
-rw-r--r--automation/source/inc/rcontrol.hxx16
-rw-r--r--automation/source/inc/svcommstream.hxx14
-rw-r--r--automation/source/miniapp/servres.cxx6
-rw-r--r--automation/source/miniapp/servres.hxx7
-rw-r--r--automation/source/miniapp/testapp.cxx2
-rw-r--r--automation/source/server/XMLParser.cxx12
-rw-r--r--automation/source/server/cmdbasestream.cxx150
-rw-r--r--automation/source/server/recorder.cxx26
-rw-r--r--automation/source/server/retstrm.cxx8
-rw-r--r--automation/source/server/retstrm.hxx16
-rw-r--r--automation/source/server/scmdstrm.cxx24
-rw-r--r--automation/source/server/scmdstrm.hxx4
-rw-r--r--automation/source/server/sta_list.cxx9
-rw-r--r--automation/source/server/statemnt.cxx548
-rw-r--r--automation/source/server/statemnt.hxx18
-rw-r--r--automation/source/server/svcommstream.cxx14
-rw-r--r--automation/source/simplecm/communiio.hxx12
-rw-r--r--automation/source/simplecm/packethandler.cxx4
-rw-r--r--automation/source/simplecm/tcpio.cxx4
-rw-r--r--automation/source/simplecm/tcpio.hxx4
-rw-r--r--automation/source/testtool/cmdstrm.cxx42
-rw-r--r--automation/source/testtool/cmdstrm.hxx10
-rw-r--r--automation/source/testtool/cretstrm.hxx4
-rw-r--r--automation/source/testtool/makefile.mk2
-rw-r--r--automation/source/testtool/objtest.cxx100
-rw-r--r--automation/source/testtool/tcommuni.cxx6
-rw-r--r--automation/source/testtool/testtool.ini1
-rw-r--r--basctl/inc/basidesh.hrc1
-rw-r--r--basctl/sdi/baside.sdi5
-rw-r--r--basctl/source/basicide/baside2.cxx9
-rw-r--r--basctl/source/basicide/baside2.hxx1
-rw-r--r--basctl/source/basicide/baside2b.cxx32
-rw-r--r--basctl/source/basicide/basidesh.src5
-rw-r--r--basctl/source/basicide/iderdll.cxx3
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/source/dlged/dlged.cxx9
-rw-r--r--bean/com/sun/star/comp/beans/HasConnectionException.java2
-rw-r--r--bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c1
-rw-r--r--bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c1
-rw-r--r--bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c9
-rw-r--r--bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c24
-rw-r--r--bean/prj/d.lst8
-rw-r--r--crashrep/prj/d.lst6
-rw-r--r--cui/Library_cui.mk6
-rw-r--r--cui/source/customize/acccfg.cxx2
-rw-r--r--cui/source/customize/macropg.cxx20
-rw-r--r--cui/source/dialogs/about.cxx223
-rw-r--r--cui/source/dialogs/about.hrc7
-rw-r--r--cui/source/dialogs/about.src8
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx92
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx1
-rw-r--r--cui/source/dialogs/hldocntp.cxx2
-rw-r--r--cui/source/dialogs/hlinettp.cxx50
-rw-r--r--cui/source/dialogs/hltpbase.cxx4
-rw-r--r--cui/source/dialogs/hyperdlg.hrc1
-rw-r--r--cui/source/dialogs/hyperdlg.src27
-rw-r--r--cui/source/dialogs/iconcdlg.cxx14
-rw-r--r--cui/source/dialogs/srchxtra.cxx8
-rw-r--r--cui/source/factory/cuiresmgr.cxx7
-rw-r--r--cui/source/factory/dlgfact.cxx1
-rw-r--r--cui/source/inc/about.hxx3
-rw-r--r--cui/source/inc/chardlg.hxx8
-rw-r--r--cui/source/inc/cuigaldlg.hxx28
-rw-r--r--cui/source/inc/cuitabline.hxx59
-rw-r--r--cui/source/inc/hlinettp.hxx9
-rw-r--r--cui/source/inc/hltpbase.hxx2
-rw-r--r--cui/source/inc/page.hxx2
-rw-r--r--cui/source/options/fontsubs.cxx1
-rw-r--r--cui/source/options/fontsubs.hxx1
-rw-r--r--cui/source/options/optchart.cxx4
-rw-r--r--cui/source/options/optgdlg.cxx22
-rw-r--r--cui/source/options/opthtml.cxx74
-rw-r--r--cui/source/options/optinet2.cxx407
-rwxr-xr-xcui/source/options/optinet2.hrc23
-rw-r--r--cui/source/options/optinet2.hxx69
-rw-r--r--cui/source/options/optinet2.src166
-rw-r--r--cui/source/options/optmemory.cxx4
-rw-r--r--cui/source/options/optpath.cxx1
-rw-r--r--cui/source/options/optsave.cxx10
-rw-r--r--cui/source/options/treeopt.cxx4
-rw-r--r--cui/source/options/treeopt.src4
-rw-r--r--cui/source/tabpages/autocdlg.cxx58
-rw-r--r--cui/source/tabpages/chardlg.cxx288
-rw-r--r--cui/source/tabpages/numpages.cxx9
-rw-r--r--cui/source/tabpages/page.cxx17
-rw-r--r--cui/source/tabpages/tpline.cxx23
-rw-r--r--embedserv/prj/build.lst2
-rw-r--r--embedserv/prj/d.lst4
-rw-r--r--embedserv/source/inc/embservconst.h2
-rw-r--r--extensions/source/ole/oleobjw.cxx11
-rw-r--r--extensions/source/ole/oleobjw.hxx4
-rw-r--r--extensions/source/oooimprovement/onlogrotate_job.cxx2
-rw-r--r--extensions/source/plugin/inc/plugin/unx/plugcon.hxx2
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx3
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx4
-rw-r--r--extensions/source/svg/makefile.mk67
-rw-r--r--extensions/source/svg/svgaction.cxx1461
-rw-r--r--extensions/source/svg/svgaction.hxx167
-rw-r--r--extensions/source/svg/svgcom.hxx76
-rw-r--r--extensions/source/svg/svgprinter.cxx331
-rw-r--r--extensions/source/svg/svgprinter.hxx70
-rw-r--r--extensions/source/svg/svguno.cxx101
-rw-r--r--extensions/source/svg/svgwriter.cxx174
-rw-r--r--extensions/source/update/check/Jobs.xcu2
-rw-r--r--extensions/source/update/tools/ztool.cxx6
-rw-r--r--extensions/test/ole/OleClient/clientTest.cxx2
-rw-r--r--extensions/test/ole/OleConverterVar1/convTest.cxx2
-rw-r--r--extensions/test/ole/cppToUno/testcppuno.cxx2
-rw-r--r--forms/Library_frm.mk6
-rw-r--r--forms/qa/unoapi/knownissues.xcl6
-rw-r--r--forms/source/component/Columns.cxx30
-rw-r--r--forms/source/component/DatabaseForm.cxx91
-rw-r--r--forms/source/component/Edit.cxx62
-rw-r--r--forms/source/component/Edit.hxx1
-rw-r--r--forms/source/component/Filter.cxx34
-rw-r--r--forms/source/component/FormattedField.cxx4
-rw-r--r--forms/source/resource/frm_resource.cxx4
-rw-r--r--lingucomponent/prj/d.lst106
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx8
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk4
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx15
-rw-r--r--lingucomponent/source/thesaurus/libnth/makefile.mk3
-rw-r--r--package/inc/EncryptedDataHeader.hxx32
-rw-r--r--package/inc/EncryptionData.hxx52
-rw-r--r--package/inc/PackageConstants.hxx36
-rw-r--r--package/inc/ZipFile.hxx52
-rw-r--r--package/inc/ZipOutputStream.hxx33
-rw-r--r--package/inc/ZipPackage.hxx42
-rw-r--r--package/inc/ZipPackageEntry.hxx (renamed from package/source/zippackage/ZipPackageEntry.hxx)0
-rw-r--r--package/inc/ZipPackageFolder.hxx4
-rw-r--r--package/inc/ZipPackageStream.hxx (renamed from package/source/zippackage/ZipPackageStream.hxx)74
-rw-r--r--package/qa/storages/TestHelper.java16
-rw-r--r--package/source/manifest/Base64Codec.cxx8
-rw-r--r--package/source/manifest/Base64Codec.hxx4
-rw-r--r--package/source/manifest/ManifestDefines.hxx21
-rw-r--r--package/source/manifest/ManifestExport.cxx285
-rw-r--r--package/source/manifest/ManifestImport.cxx169
-rw-r--r--package/source/manifest/ManifestImport.hxx28
-rw-r--r--package/source/manifest/UnoRegister.cxx5
-rw-r--r--package/source/xstor/owriteablestream.cxx188
-rw-r--r--package/source/xstor/xstorage.cxx212
-rw-r--r--package/source/xstor/xstorage.hxx11
-rw-r--r--package/source/zipapi/Deflater.cxx8
-rw-r--r--package/source/zipapi/EntryInputStream.cxx205
-rw-r--r--package/source/zipapi/EntryInputStream.hxx85
-rw-r--r--package/source/zipapi/Inflater.cxx4
-rw-r--r--package/source/zipapi/MemoryByteGrabber.hxx2
-rw-r--r--package/source/zipapi/XFileStream.cxx230
-rw-r--r--package/source/zipapi/XFileStream.hxx95
-rw-r--r--package/source/zipapi/XMemoryStream.cxx55
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx100
-rw-r--r--package/source/zipapi/XUnbufferedStream.hxx17
-rw-r--r--package/source/zipapi/ZipFile.cxx512
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx124
-rw-r--r--package/source/zipapi/blowfishcontext.cxx122
-rw-r--r--package/source/zipapi/blowfishcontext.hxx58
-rw-r--r--package/source/zipapi/makefile.mk2
-rw-r--r--package/source/zipapi/sha1context.cxx97
-rw-r--r--package/source/zipapi/sha1context.hxx (renamed from package/source/zipapi/XMemoryStream.hxx)32
-rw-r--r--package/source/zippackage/ZipPackage.cxx573
-rw-r--r--package/source/zippackage/ZipPackageEntry.cxx24
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx197
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx406
-rw-r--r--package/source/zippackage/zipfileaccess.cxx5
-rw-r--r--setup_native/prj/build.lst1
-rw-r--r--setup_native/prj/d.lst19
-rw-r--r--setup_native/source/mac/ooo/DS_Storebin12556 -> 15364 bytes
-rw-r--r--setup_native/source/mac/ooo/DS_Store_Langpackbin12292 -> 12292 bytes
-rw-r--r--setup_native/source/mac/ooo3_installer.icnsbin56605 -> 42710 bytes
-rw-r--r--setup_native/source/packinfo/packinfo_extensions.txt44
-rwxr-xr-xsetup_native/source/packinfo/packinfo_office.txt108
-rwxr-xr-xsetup_native/source/packinfo/packinfo_office_lang.txt4
-rwxr-xr-xsetup_native/source/packinfo/shellscripts_extensions.txt24
-rw-r--r--setup_native/source/packinfo/spellchecker_selection.txt84
-rw-r--r--setup_native/source/win32/customactions/javafilter/makefile.mk4
-rw-r--r--setup_native/source/win32/customactions/languagepacks/makefile.mk2
-rwxr-xr-xsetup_native/source/win32/customactions/patch/makefile.mk3
-rw-r--r--setup_native/source/win32/customactions/quickstarter/makefile.mk3
-rw-r--r--setup_native/source/win32/customactions/rebase/makefile.mk2
-rw-r--r--setup_native/source/win32/customactions/rebase/rebase.cxx85
-rw-r--r--setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk2
-rw-r--r--setup_native/source/win32/customactions/reg4msdoc/registrar.cxx48
-rw-r--r--setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx36
-rw-r--r--setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx14
-rw-r--r--setup_native/source/win32/customactions/reg64/makefile.mk3
-rw-r--r--setup_native/source/win32/customactions/regactivex/makefile.mk3
-rw-r--r--setup_native/source/win32/customactions/regpatchactivex/makefile.mk10
-rw-r--r--setup_native/source/win32/customactions/relnotes/exports.dxp3
-rw-r--r--setup_native/source/win32/customactions/relnotes/makefile.mk76
-rw-r--r--setup_native/source/win32/customactions/relnotes/relnotes.cxx188
-rw-r--r--setup_native/source/win32/customactions/sellang/makefile.mk20
-rw-r--r--setup_native/source/win32/customactions/shellextensions/makefile.mk4
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx25
-rwxr-xr-xsetup_native/source/win32/customactions/thesaurus/makefile.mk9
-rw-r--r--setup_native/source/win32/customactions/tools/makefile.mk4
-rw-r--r--setup_native/source/win32/msi-encodinglist.txt2
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx4
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx7
-rw-r--r--xmlsecurity/qa/certext/User_35_Root_11.crt64
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx10
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx22
-rw-r--r--xmlsecurity/source/dialogs/dialogs.hrc12
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx4
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx2
-rw-r--r--xmlsecurity/source/dialogs/resourcemanager.cxx3
-rw-r--r--xmlsecurity/source/dialogs/stbcontrl.cxx8
-rw-r--r--xmlsecurity/source/dialogs/warnings.cxx6
-rw-r--r--xmlsecurity/source/framework/buffernode.cxx6
-rw-r--r--xmlsecurity/source/framework/elementcollector.cxx7
-rw-r--r--xmlsecurity/source/framework/elementcollector.hxx1
-rw-r--r--xmlsecurity/source/framework/securityengine.hxx1
-rw-r--r--xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx3
-rw-r--r--xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx3
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx7
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper2.cxx1
-rw-r--r--xmlsecurity/source/xmlsec/diagnose.cxx3
-rw-r--r--xmlsecurity/source/xmlsec/makefile.mk6
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/makefile.mk3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx182
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx84
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx20
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx28
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx161
-rw-r--r--xmlsecurity/source/xmlsec/nss/ciphercontext.cxx276
-rw-r--r--xmlsecurity/source/xmlsec/nss/ciphercontext.hxx89
-rw-r--r--xmlsecurity/source/xmlsec/nss/digestcontext.cxx101
-rw-r--r--xmlsecurity/source/xmlsec/nss/digestcontext.hxx (renamed from extensions/source/svg/svgwriter.hxx)45
-rw-r--r--xmlsecurity/source/xmlsec/nss/makefile.mk27
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx521
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.hxx90
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx244
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx77
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx57
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx365
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx62
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx74
-rw-r--r--xmlsecurity/source/xmlsec/nss/xsec_nss.cxx34
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx96
-rw-r--r--xmlsecurity/source/xmlsec/xsec_xmlsec.cxx4
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt1
-rw-r--r--xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem64
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/serial2
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/openssl.cfg17
-rw-r--r--xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt64
-rw-r--r--xmlsecurity/util/makefile.mk11
-rw-r--r--xmlsecurity/util/xsec_xmlsec.component1
-rw-r--r--xmlsecurity/util/xsec_xmlsec.windows.component3
267 files changed, 6165 insertions, 7952 deletions
diff --git a/MathMLDTD/prj/d.lst b/MathMLDTD/prj/d.lst
index 40d4a6a44f05..b2a942fadf3e 100644
--- a/MathMLDTD/prj/d.lst
+++ b/MathMLDTD/prj/d.lst
@@ -1,2 +1,2 @@
-..\math.dtd %_DEST%\bin%_EXT%\math.dtd
-..\w3c_ipr_software_notice.html %_DEST%\bin%_EXT%\w3c_ipr_software_notice.html
+..\math.dtd %_DEST%\bin\math.dtd
+..\w3c_ipr_software_notice.html %_DEST%\bin\w3c_ipr_software_notice.html
diff --git a/UnoControls/prj/build.lst b/UnoControls/prj/build.lst
index 775cb902f5ca..473776ffbedd 100644
--- a/UnoControls/prj/build.lst
+++ b/UnoControls/prj/build.lst
@@ -1,4 +1,4 @@
-us UnoControls : LIBXSLT:libxslt cppuhelper offuh tools NULL
+us UnoControls : LIBXSLT:libxslt cppuhelper offapi tools NULL
us UnoControls usr1 - all us_mkout NULL
us UnoControls\source\base nmake - all us_base NULL
us UnoControls\source\controls nmake - all us_ctrls NULL
diff --git a/UnoControls/prj/d.lst b/UnoControls/prj/d.lst
index 370fc0c9fc46..4c1de78bd819 100644
--- a/UnoControls/prj/d.lst
+++ b/UnoControls/prj/d.lst
@@ -1,6 +1,6 @@
-..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
-..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
-..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
-..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
-..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
-..\%__SRC%\misc\ctl.component %_DEST%\xml%_EXT%\ctl.component
+..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll
+..\%__SRC%\lib\lib*.so %_DEST%\lib
+..\%__SRC%\lib\*.sl %_DEST%\lib\*.sl
+..\%__SRC%\bin\*.res %_DEST%\bin\*.res
+..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
+..\%__SRC%\misc\ctl.component %_DEST%\xml\ctl.component
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx
index 67f0574ab436..ccf0dc923e8c 100644
--- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx
@@ -353,11 +353,6 @@ protected:
Rectangle getBoundingBoxOnScreen()
throw ( ::com::sun::star::lang::DisposedException );
- /** Creates a new UUID, if rId is empty.
- @attention This method requires locked global mutex to prevent double
- creation of an UUID. */
- static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId );
-
::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; }
void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; }
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
index 383c6410eaeb..6c406b4fa0b5 100644
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
@@ -322,11 +322,6 @@ protected:
Rectangle getBoundingBoxOnScreen()
throw ( ::com::sun::star::lang::DisposedException );
- /** Creates a new UUID, if rId is empty.
- @attention This method requires locked global mutex to prevent double
- creation of an UUID. */
- static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId );
-
::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; }
void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; }
diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst
index 469a59e79351..61692214b37c 100644
--- a/accessibility/prj/build.lst
+++ b/accessibility/prj/build.lst
@@ -1,4 +1,4 @@
-ac accessibility : TRANSLATIONS:translations tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL
+ac accessibility : TRANSLATIONS:translations tools jurt offapi unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL
ac accessibility usr1 - all ac_mkout NULL
ac accessibility\inc nmake - all ac_inc NULL
ac accessibility\bridge\org\openoffice\java\accessibility nmake - w ac_ooja ac_inc NULL
diff --git a/accessibility/prj/d.lst b/accessibility/prj/d.lst
index 662373c7c487..1e47390f93a3 100644
--- a/accessibility/prj/d.lst
+++ b/accessibility/prj/d.lst
@@ -1,8 +1,8 @@
-..\%__SRC%\class\java_uno_accessbridge.jar %_DEST%\bin%_EXT%\java_uno_accessbridge.jar
-..\%__SRC%\class\java_accessibility.jar %_DEST%\bin%_EXT%\java_accessibility.jar
+..\%__SRC%\class\java_uno_accessbridge.jar %_DEST%\bin\java_uno_accessbridge.jar
+..\%__SRC%\class\java_accessibility.jar %_DEST%\bin\java_accessibility.jar
-..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
-..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
-..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
-..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll
+..\%__SRC%\bin\*.res %_DEST%\bin\*.res
+..\%__SRC%\lib\lib*.so %_DEST%\lib
+..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
..\%__SRC%\misc\java_uno_accessbridge.component %_DEST%\xml\java_uno_accessbridge.component
diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
index 24cc3ce52f2a..97baa20e5968 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
@@ -30,8 +30,8 @@
#include "precompiled_accessibility.hxx"
#include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
#include <svtools/accessibletableprovider.hxx>
-#include <rtl/uuid.h>
-//
+#include <comphelper/servicehelper.hxx>
+
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <unotools/accessiblerelationsethelper.hxx>
@@ -344,13 +344,15 @@ void SAL_CALL AccessibleBrowseBoxBase::removeEventListener(
// XTypeProvider --------------------------------------------------------------
+namespace
+{
+ class theAccessibleBrowseBoxBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxBaseImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleBrowseBoxBaseImplementationId::get().getSeq();
}
// XServiceInfo ---------------------------------------------------------------
@@ -508,17 +510,7 @@ void AccessibleBrowseBoxBase::commitEvent(
AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
}
-// -----------------------------------------------------------------------------
-void AccessibleBrowseBoxBase::implCreateUuid( Sequence< sal_Int8 >& rId )
-{
- if( !rId.hasElements() )
- {
- rId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
- }
-}
-// -----------------------------------------------------------------------------
sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole()
throw ( uno::RuntimeException )
{
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
index b40253c2e100..33d50c053792 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
@@ -32,6 +32,7 @@
#include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx"
#include <svtools/accessibletableprovider.hxx>
+#include <comphelper/servicehelper.hxx>
// ============================================================================
@@ -344,13 +345,15 @@ OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationName()
return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderBar" ) );
}
+namespace
+{
+ class theAccessibleBrowseBoxHeaderBarImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxHeaderBarImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleBrowseBoxHeaderBarImplementationId::get().getSeq();
}
// internal virtual methods ---------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
index 825689cf3185..6108672088b0 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
@@ -34,6 +34,7 @@
#include <svtools/accessibletableprovider.hxx>
#include <tools/multisel.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
// ============================================================================
@@ -206,13 +207,15 @@ Sequence< uno::Type > SAL_CALL AccessibleBrowseBoxTableBase::getTypes()
AccessibleBrowseBoxTableImplHelper::getTypes() );
}
+namespace
+{
+ class theAccessibleBrowseBoxTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxTableBaseImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxTableBase::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleBrowseBoxTableBaseImplementationId::get().getSeq();
}
// internal virtual methods ---------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
index bf1fb2cca520..c3af90ec5606 100644
--- a/accessibility/source/extended/AccessibleGridControlBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -30,7 +30,7 @@
#include "precompiled_accessibility.hxx"
#include "accessibility/extended/AccessibleGridControlBase.hxx"
#include <svtools/accessibletable.hxx>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
//
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -280,13 +280,15 @@ void SAL_CALL AccessibleGridControlBase::removeEventListener(
// XTypeProvider --------------------------------------------------------------
+namespace
+{
+ class theAccessibleGridControlBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlBaseImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleGridControlBaseImplementationId::get().getSeq();
}
// XServiceInfo ---------------------------------------------------------------
@@ -409,17 +411,7 @@ void AccessibleGridControlBase::commitEvent(
AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
}
-// -----------------------------------------------------------------------------
-void AccessibleGridControlBase::implCreateUuid( Sequence< sal_Int8 >& rId )
-{
- if( !rId.hasElements() )
- {
- rId.realloc( 16 );
- rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
- }
-}
-// -----------------------------------------------------------------------------
sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
throw ( uno::RuntimeException )
{
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index 464d5842163d..a46a3808f043 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -34,6 +34,7 @@
#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
#include <svtools/accessibletable.hxx>
+#include <comphelper/servicehelper.hxx>
// ============================================================================
@@ -227,13 +228,15 @@ OUString SAL_CALL AccessibleGridControlHeader::getImplementationName()
return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) );
}
+namespace
+{
+ class theAccessibleGridControlHeaderImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlHeaderImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleGridControlHeaderImplementationId::get().getSeq();
}
// internal virtual methods ---------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
index 5dc6032eab7a..6b034b9e554c 100644
--- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
@@ -34,6 +34,7 @@
#include <svtools/accessibletable.hxx>
#include <tools/multisel.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
// ============================================================================
@@ -210,13 +211,15 @@ Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes()
AccessibleGridControlTableImplHelper::getTypes() );
}
+namespace
+{
+ class theAccessibleGridControlTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlTableBaseImplementationId > {};
+}
+
Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getOslGlobalMutex() );
- static Sequence< sal_Int8 > aId;
- implCreateUuid( aId );
- return aId;
+ return theAccessibleGridControlTableBaseImplementationId::get().getSeq();
}
// internal helper methods ----------------------------------------------------
diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx
index c2e5516d6a88..48c0eb1f0ee3 100644
--- a/accessibility/source/helper/accresmgr.cxx
+++ b/accessibility/source/helper/accresmgr.cxx
@@ -56,9 +56,7 @@ void TkResMgr::ensureImplExists()
::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- ByteString sResMgrName( "acc" );
-
- m_pImpl = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale );
+ m_pImpl = SimpleResMgr::Create("acc", aLocale );
if (m_pImpl)
{
diff --git a/automation/inc/automation/commdefines.hxx b/automation/inc/automation/commdefines.hxx
index 15e38a8ff897..24ca05809034 100644
--- a/automation/inc/automation/commdefines.hxx
+++ b/automation/inc/automation/commdefines.hxx
@@ -38,22 +38,22 @@
#include <osl/endian.h>
#ifndef MAKEDWORD
-#define MAKEDWORD(wl, wh) ((comm_DWORD)((wl) & 0xFFFF) | (((comm_DWORD)(wh) & 0xFFFF) << 16))
+#define MAKEDWORD(wl, wh) ((sal_uInt32)((wl) & 0xFFFF) | (((sal_uInt32)(wh) & 0xFFFF) << 16))
#endif
#ifndef LOWORD
-#define LOWORD(d) ((comm_WORD)((comm_DWORD)(d) & 0xFFFF))
+#define LOWORD(d) ((sal_uInt16)((sal_uInt32)(d) & 0xFFFF))
#endif
#ifndef HIWORD
-#define HIWORD(d) ((comm_WORD)(((comm_DWORD)(d) >> 16) & 0xFFFF))
+#define HIWORD(d) ((sal_uInt16)(((sal_uInt32)(d) >> 16) & 0xFFFF))
#endif
#ifndef MAKEWORD
-#define MAKEWORD(bl, bh) ((comm_WORD)((bl) & 0xFF) | (((comm_WORD)(bh) & 0xFF) << 8))
+#define MAKEWORD(bl, bh) ((sal_uInt16)((bl) & 0xFF) | (((sal_uInt16)(bh) & 0xFF) << 8))
#endif
#ifndef LOBYTE
-#define LOBYTE(w) ((comm_BYTE)((comm_WORD)(w) & 0xFF))
+#define LOBYTE(w) ((comm_BYTE)((sal_uInt16)(w) & 0xFF))
#endif
#ifndef HIBYTE
-#define HIBYTE(w) ((comm_BYTE)(((comm_WORD)(w) >> 8) & 0xFF))
+#define HIBYTE(w) ((comm_BYTE)(((sal_uInt16)(w) >> 8) & 0xFF))
#endif
#ifndef MAKEBYTE
#define MAKEBYTE(nl, nh) ((comm_BYTE)(((nl) & 0x0F) | (((nh) & 0x0F) << 4)))
@@ -74,10 +74,10 @@
#ifdef OSL_BIGENDIAN
#ifndef NETWORD
-#define NETWORD(w) (comm_WORD)(w)
+#define NETWORD(w) (sal_uInt16)(w)
#endif
#ifndef NETDWORD
-#define NETDWORD(d) (comm_DWORD)(d)
+#define NETDWORD(d) (sal_uInt32)(d)
#endif
#endif // OSL_BIGENDIAN
@@ -123,8 +123,8 @@ typedef comm_UINT16 CMProtocol;
#define CM_PROTOCOL_BROADCASTER (CMProtocol)0x0002
#define CM_PROTOCOL_USER_START (CMProtocol)0x0100
-typedef comm_USHORT HandshakeType;
-typedef comm_USHORT CommunicationOption;
+typedef comm_UINT16 HandshakeType;
+typedef comm_UINT16 CommunicationOption;
#define CH_NoHeader 0x0000
#define CH_SimpleMultiChannel 0x0001
diff --git a/automation/inc/automation/commtypes.hxx b/automation/inc/automation/commtypes.hxx
index 8d7c976fb125..88bf89c68ec8 100644
--- a/automation/inc/automation/commtypes.hxx
+++ b/automation/inc/automation/commtypes.hxx
@@ -36,13 +36,9 @@
*
************************************************************************/
-/** defines al least types
+/** defines:
comm_BYTE
- comm_WORD;
- comm_DWORD;
comm_BOOL
- comm_ULONG
- comm_USHORT
comm_UINT16
comm_UINT32
comm_UniChar
@@ -60,14 +56,9 @@ typedef sal_Unicode comm_UniChar;
#include <tools/solar.h>
typedef sal_uInt8 comm_BYTE;
typedef sal_Bool comm_BOOL;
-typedef sal_uInt32 comm_ULONG;
-typedef sal_uInt16 comm_USHORT;
typedef sal_uInt16 comm_UINT16;
typedef sal_uInt32 comm_UINT32;
-typedef sal_uInt16 comm_WORD;
-typedef sal_uInt32 comm_DWORD;
-
class String;
#define comm_String String
diff --git a/automation/prj/d.lst b/automation/prj/d.lst
index c83a2284e34b..69f82e4ad6ce 100644
--- a/automation/prj/d.lst
+++ b/automation/prj/d.lst
@@ -1,27 +1,27 @@
-mkdir: %COMMON_DEST%\bin%_EXT%\hid
-mkdir: %_DEST%\inc%_EXT%\automation
+mkdir: %COMMON_DEST%\bin\hid
+mkdir: %_DEST%\inc\automation
-#..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
-..\util\manually_added_ids.hid %COMMON_DEST%\bin%_EXT%\hid\manually_added_ids.hid
-..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
-..\%__SRC%\lib\lib* %_DEST%\lib%_EXT%\*
-..\%__SRC%\lib\ists.lib %_DEST%\lib%_EXT%\ists.lib
-..\%__SRC%\lib\isimplecm.lib %_DEST%\lib%_EXT%\isimplecm.lib
-..\%__SRC%\lib\icommuni.lib %_DEST%\lib%_EXT%\icommuni.lib
+#..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin\hid\*.hid
+..\util\manually_added_ids.hid %COMMON_DEST%\bin\hid\manually_added_ids.hid
+..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll
+..\%__SRC%\lib\lib* %_DEST%\lib\*
+..\%__SRC%\lib\ists.lib %_DEST%\lib\ists.lib
+..\%__SRC%\lib\isimplecm.lib %_DEST%\lib\isimplecm.lib
+..\%__SRC%\lib\icommuni.lib %_DEST%\lib\icommuni.lib
-..\inc\automation\automation.hxx %_DEST%\inc%_EXT%\automation\automation.hxx
-..\inc\automation\commdefines.hxx %_DEST%\inc%_EXT%\automation\commdefines.hxx
-..\inc\automation\commtypes.hxx %_DEST%\inc%_EXT%\automation\commtypes.hxx
-..\inc\automation\communi.hxx %_DEST%\inc%_EXT%\automation\communi.hxx
-..\inc\automation\simplecm.hxx %_DEST%\inc%_EXT%\automation\simplecm.hxx
+..\inc\automation\automation.hxx %_DEST%\inc\automation\automation.hxx
+..\inc\automation\commdefines.hxx %_DEST%\inc\automation\commdefines.hxx
+..\inc\automation\commtypes.hxx %_DEST%\inc\automation\commtypes.hxx
+..\inc\automation\communi.hxx %_DEST%\inc\automation\communi.hxx
+..\inc\automation\simplecm.hxx %_DEST%\inc\automation\simplecm.hxx
-..\%__SRC%\bin\testtool.exe %_DEST%\bin%_EXT%\testtool.bin
-..\%__SRC%\bin\testtool %_DEST%\bin%_EXT%\testtool.bin
-..\%__SRC%\inc\classes %_DEST%\bin%_EXT%\classes
-..\%__SRC%\inc\keycodes %_DEST%\bin%_EXT%\keycodes
-..\%__SRC%\inc\res_type %_DEST%\bin%_EXT%\res_type
+..\%__SRC%\bin\testtool.exe %_DEST%\bin\testtool.bin
+..\%__SRC%\bin\testtool %_DEST%\bin\testtool.bin
+..\%__SRC%\inc\classes %_DEST%\bin\classes
+..\%__SRC%\inc\keycodes %_DEST%\bin\keycodes
+..\%__SRC%\inc\res_type %_DEST%\bin\res_type
-..\%COMMON_OUTDIR%\bin\images_tt.zip %COMMON_DEST%\bin%_EXT%\images_tt.zip
+..\%COMMON_OUTDIR%\bin\images_tt.zip %COMMON_DEST%\bin\images_tt.zip
-..\%__SRC%\bin\testtoolrc %_DEST%\lib%_EXT%\testtoolrc
-..\%__SRC%\bin\testtool.ini %_DEST%\bin%_EXT%\testtool.ini
+..\%__SRC%\bin\testtoolrc %_DEST%\lib\testtoolrc
+..\%__SRC%\bin\testtool.ini %_DEST%\bin\testtool.ini
diff --git a/automation/source/inc/cmdbasestream.hxx b/automation/source/inc/cmdbasestream.hxx
index 71666cebafc3..7011299408ad 100644
--- a/automation/source/inc/cmdbasestream.hxx
+++ b/automation/source/inc/cmdbasestream.hxx
@@ -51,16 +51,16 @@ public:
void GenError( rtl::OString *pUId, comm_String *pString );
- void GenReturn( comm_USHORT nRet, comm_ULONG nNr );
- void GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_ULONG nNr );
- void GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_String *pString );
- void GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_BOOL bBool );
- void GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_ULONG nNr, comm_String *pString, comm_BOOL bBool );
+ void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr );
+ void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr );
+ void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString );
+ void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool );
+ void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool );
- void GenReturn( comm_USHORT nRet, comm_USHORT nMethod, comm_ULONG nNr );
- void GenReturn( comm_USHORT nRet, comm_USHORT nMethod, comm_String *pString );
- void GenReturn( comm_USHORT nRet, comm_USHORT nMethod, comm_BOOL bBool );
- void GenReturn( comm_USHORT nRet, comm_USHORT nMethod, comm_USHORT nNr );
+ void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr );
+ void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString );
+ void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool );
+ void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr );
// MacroRecorder
void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod ); // also used outside MacroRecorder
@@ -68,15 +68,15 @@ public:
void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool );
void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr );
- void Read ( comm_USHORT &nNr );
- void Read ( comm_ULONG &nNr );
- void Read (comm_UniChar* &aString, comm_USHORT &nLenInChars );
+ void Read ( comm_UINT16 &nNr );
+ void Read ( comm_UINT32 &nNr );
+ void Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars );
void Read ( comm_BOOL &bBool );
- comm_USHORT GetNextType();
+ comm_UINT16 GetNextType();
- void Write( comm_USHORT nNr );
- void Write( comm_ULONG nNr );
- void Write( const comm_UniChar* aString, comm_USHORT nLenInChars );
+ void Write( comm_UINT16 nNr );
+ void Write( comm_UINT32 nNr );
+ void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars );
void Write( comm_BOOL bBool );
// Complex Datatypes to be handled system dependent
diff --git a/automation/source/inc/icommstream.hxx b/automation/source/inc/icommstream.hxx
index adc9be16063e..864293b7e38d 100644
--- a/automation/source/inc/icommstream.hxx
+++ b/automation/source/inc/icommstream.hxx
@@ -46,19 +46,19 @@ public:
ICommStream(){}
virtual ~ICommStream(){}
- virtual ICommStream& operator>>( comm_USHORT& rUShort )=0;
- virtual ICommStream& operator>>( comm_ULONG& rULong )=0;
+ virtual ICommStream& operator>>( comm_UINT16& rUShort )=0;
+ virtual ICommStream& operator>>( comm_UINT32& rULong )=0;
virtual ICommStream& operator>>( comm_BOOL& rChar )=0;
- virtual ICommStream& operator<<( comm_USHORT nUShort )=0;
- virtual ICommStream& operator<<( comm_ULONG nULong )=0;
+ virtual ICommStream& operator<<( comm_UINT16 nUShort )=0;
+ virtual ICommStream& operator<<( comm_UINT32 nULong )=0;
virtual ICommStream& operator<<( comm_BOOL nChar )=0;
- virtual comm_ULONG Read( void* pData, comm_ULONG nSize )=0;
- virtual comm_ULONG Write( const void* pData, comm_ULONG nSize )=0;
+ virtual comm_UINT32 Read( void* pData, comm_UINT32 nSize )=0;
+ virtual comm_UINT32 Write( const void* pData, comm_UINT32 nSize )=0;
virtual comm_BOOL IsEof() const=0;
- virtual comm_ULONG SeekRel( long nPos )=0;
+ virtual comm_UINT32 SeekRel( long nPos )=0;
};
diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx
index 13102892da08..14a26feded42 100644
--- a/automation/source/inc/rcontrol.hxx
+++ b/automation/source/inc/rcontrol.hxx
@@ -54,8 +54,8 @@
#define SIReturnError 13
// Typisierung im Stream
-#define BinUSHORT 11
-#define BinULONG 14
+#define BinUINT16 11
+#define BinUINT32 14
#define BinString 12
#define BinBool 13
#define BinSbxValue 15
@@ -443,12 +443,12 @@
// Beschreibt die Parametertypen als Bitfeld Reihenfolge immer!
// wie hier Aufgelistet
#define PARAM_NONE 0x0000
-#define PARAM_USHORT_1 0x0001
-#define PARAM_USHORT_2 0x0002
-#define PARAM_USHORT_3 0x0100 // Nicht in der Reihe!!
-#define PARAM_USHORT_4 0x0200 // Nicht in der Reihe!!
-#define PARAM_ULONG_1 0x0004
-#define PARAM_ULONG_2 0x0008
+#define PARAM_UINT16_1 0x0001
+#define PARAM_UINT16_2 0x0002
+#define PARAM_UINT16_3 0x0100 // Nicht in der Reihe!!
+#define PARAM_UINT16_4 0x0200 // Nicht in der Reihe!!
+#define PARAM_UINT32_1 0x0004
+#define PARAM_UINT32_2 0x0008
#define PARAM_STR_1 0x0010
#define PARAM_STR_2 0x0020
#define PARAM_BOOL_1 0x0040
diff --git a/automation/source/inc/svcommstream.hxx b/automation/source/inc/svcommstream.hxx
index 0cf289147f04..7a122ba4cef2 100644
--- a/automation/source/inc/svcommstream.hxx
+++ b/automation/source/inc/svcommstream.hxx
@@ -41,19 +41,19 @@ public:
SvCommStream( SvStream* pIO );
~SvCommStream();
- ICommStream& operator>>( comm_USHORT& rUShort );
- ICommStream& operator>>( comm_ULONG& rULong );
+ ICommStream& operator>>( comm_UINT16& rUShort );
+ ICommStream& operator>>( comm_UINT32& rULong );
ICommStream& operator>>( comm_BOOL& rChar );
- ICommStream& operator<<( comm_USHORT nUShort );
- ICommStream& operator<<( comm_ULONG nULong );
+ ICommStream& operator<<( comm_UINT16 nUShort );
+ ICommStream& operator<<( comm_UINT32 nULong );
ICommStream& operator<<( comm_BOOL nChar );
- comm_ULONG Read( void* pData, comm_ULONG nSize );
- comm_ULONG Write( const void* pData, comm_ULONG nSize );
+ comm_UINT32 Read( void* pData, comm_UINT32 nSize );
+ comm_UINT32 Write( const void* pData, comm_UINT32 nSize );
comm_BOOL IsEof() const;
- comm_ULONG SeekRel( long nPos );
+ comm_UINT32 SeekRel( long nPos );
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/servres.cxx b/automation/source/miniapp/servres.cxx
index 1bd795fd4041..cedbffec8b5d 100644
--- a/automation/source/miniapp/servres.cxx
+++ b/automation/source/miniapp/servres.cxx
@@ -53,10 +53,4 @@ ModalDialogGROSSER_TEST_DLG::ModalDialogGROSSER_TEST_DLG( Window * pParent, cons
if( bFreeRes ) FreeResource();
}
-MenuMENU_CLIENT::MenuMENU_CLIENT( const ResId & rResId, sal_Bool )
- : MenuBar( rResId )
-{
- // No subresources, automatic free resource
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/servres.hxx b/automation/source/miniapp/servres.hxx
index 72584163c7cd..2b0459585ea2 100644
--- a/automation/source/miniapp/servres.hxx
+++ b/automation/source/miniapp/servres.hxx
@@ -55,11 +55,4 @@ public:
ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, sal_Bool bFreeRes = sal_True );
};
-class MenuMENU_CLIENT : public MenuBar
-{
-protected:
-public:
- MenuMENU_CLIENT( const ResId & rResId, sal_Bool bFreeRes = sal_True );
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx
index 66cbb38365a0..bb44281b088a 100644
--- a/automation/source/miniapp/testapp.cxx
+++ b/automation/source/miniapp/testapp.cxx
@@ -209,7 +209,7 @@ sal_uInt16 MyDispatcher::ExecuteFunction( sal_uInt16 nSID, SfxPoolItem** ppArgs,
case IDM_SYS_DLG: pMainWin->SysDlg(); break;
default:
{
- OSL_TRACE("Dispatcher kennt Funktion nicht %s",ByteString::CreateFromInt64(nSID).GetBuffer());
+ OSL_TRACE("Dispatcher kennt Funktion nicht %s", rtl::OString::valueOf(static_cast<sal_Int64>(nSID)).getStr());
return EXECUTE_NO;
}
diff --git a/automation/source/server/XMLParser.cxx b/automation/source/server/XMLParser.cxx
index d056fba6f97d..55214414127b 100644
--- a/automation/source/server/XMLParser.cxx
+++ b/automation/source/server/XMLParser.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -351,7 +351,7 @@ void SAXParser::startElement( const ::rtl::OUString& aName, const ::com::sun::st
void SAXParser::endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
{
- (void) aName; /* avoid warning about unused parameter */
+ (void) aName; /* avoid warning about unused parameter */
xCurrentNode = xCurrentNode->GetParent();
}
@@ -375,18 +375,18 @@ void SAXParser::characters( const ::rtl::OUString& aChars ) throw (::com::sun::s
void SAXParser::ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
{
- (void) aWhitespaces; /* avoid warning about unused parameter */
+ (void) aWhitespaces; /* avoid warning about unused parameter */
}
void SAXParser::processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
{
- (void) aTarget; /* avoid warning about unused parameter */
- (void) aData; /* avoid warning about unused parameter */
+ (void) aTarget; /* avoid warning about unused parameter */
+ (void) aData; /* avoid warning about unused parameter */
}
void SAXParser::setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
{
- (void) xLocator; /* avoid warning about unused parameter */
+ (void) xLocator; /* avoid warning about unused parameter */
#if OSL_DEBUG_LEVEL > 1
::rtl::OUString aTester;
aTester = xLocator->getPublicId();
diff --git a/automation/source/server/cmdbasestream.cxx b/automation/source/server/cmdbasestream.cxx
index 1144cde41a68..154ca63c37e7 100644
--- a/automation/source/server/cmdbasestream.cxx
+++ b/automation/source/server/cmdbasestream.cxx
@@ -53,132 +53,132 @@ CmdBaseStream::~CmdBaseStream()
void CmdBaseStream::GenError (rtl::OString *pUId, comm_String *pString )
{
- Write(comm_USHORT(SIReturnError));
+ Write(comm_UINT16(SIReturnError));
Write(pUId);
Write(pString);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, comm_ULONG nUId )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT32 nUId )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
Write(nUId);
- Write(comm_USHORT(PARAM_NONE)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_NONE)); // Typ der folgenden Parameter
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, rtl::OString *pUId, comm_ULONG nNr )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- if ( pUId->equals( rtl::OString( "UID_ACTIVE" ) ) )
- Write(comm_ULONG(0));
+ if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
+ Write(comm_UINT32(0));
else
Write(pUId);
- Write(comm_USHORT(PARAM_ULONG_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT32_1)); // Typ der folgenden Parameter
Write(nNr);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, rtl::OString *pUId, comm_String *pString )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- if ( pUId->equals( rtl::OString( "UID_ACTIVE" ) ) )
- Write(comm_ULONG(0));
+ if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
+ Write(comm_UINT32(0));
else
Write(pUId);
- Write(comm_USHORT(PARAM_STR_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_STR_1)); // Typ der folgenden Parameter
Write(pString);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, rtl::OString *pUId, comm_BOOL bBool )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- if ( pUId->equals( rtl::OString( "UID_ACTIVE" ) ) )
- Write(comm_ULONG(0));
+ if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
+ Write(comm_UINT32(0));
else
Write(pUId);
- Write(comm_USHORT(PARAM_BOOL_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_BOOL_1)); // Typ der folgenden Parameter
Write(bBool);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, rtl::OString *pUId, comm_ULONG nNr, comm_String *pString, comm_BOOL bBool )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- if ( pUId->equals( rtl::OString( "UID_ACTIVE" ) ) )
- Write(comm_ULONG(0));
+ if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
+ Write(comm_UINT32(0));
else
Write(pUId);
- Write(comm_USHORT(PARAM_ULONG_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT32_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter
Write(nNr);
Write(pString);
Write(bBool);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, comm_USHORT nMethod, comm_ULONG nNr )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_USHORT(PARAM_ULONG_1)); // Typ der folgenden Parameter
+ Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
+ Write(comm_UINT16(PARAM_UINT32_1)); // Typ der folgenden Parameter
Write(nNr);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, comm_USHORT nMethod, comm_String *pString )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_USHORT(PARAM_STR_1)); // Typ der folgenden Parameter
+ Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
+ Write(comm_UINT16(PARAM_STR_1)); // Typ der folgenden Parameter
Write(pString);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, comm_USHORT nMethod, comm_BOOL bBool )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_USHORT(PARAM_BOOL_1)); // Typ der folgenden Parameter
+ Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
+ Write(comm_UINT16(PARAM_BOOL_1)); // Typ der folgenden Parameter
Write(bBool);
}
-void CmdBaseStream::GenReturn (comm_USHORT nRet, comm_USHORT nMethod, comm_USHORT nNr )
+void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
- Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_USHORT(PARAM_USHORT_1)); // Typ der folgenden Parameter
+ Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
+ Write(comm_UINT16(PARAM_UINT16_1)); // Typ der folgenden Parameter
Write(nNr);
}
// MacroRecorder
-void CmdBaseStream::GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_USHORT nMethod )
+void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
Write(pUId);
- Write(comm_USHORT(PARAM_USHORT_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT16_1)); // Typ der folgenden Parameter
Write(nMethod);
}
-void CmdBaseStream::GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_USHORT nMethod, comm_String *pString )
+void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
Write(pUId);
- Write(comm_USHORT(PARAM_USHORT_1|PARAM_STR_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1)); // Typ der folgenden Parameter
Write(nMethod);
Write(pString);
}
-void CmdBaseStream::GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_USHORT nMethod, comm_String *pString, comm_BOOL bBool )
+void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
Write(pUId);
- Write(comm_USHORT(PARAM_USHORT_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter
Write(nMethod);
Write(pString);
Write(bBool);
@@ -186,41 +186,41 @@ void CmdBaseStream::GenReturn( comm_USHORT nRet, rtl::OString *pUId, comm_USHORT
void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr )
{
- Write(comm_USHORT(SIReturn));
+ Write(comm_UINT16(SIReturn));
Write(nRet);
Write(pUId);
- Write(comm_USHORT(PARAM_USHORT_1|PARAM_ULONG_1)); // Typ der folgenden Parameter
+ Write(comm_UINT16(PARAM_UINT16_1|PARAM_UINT32_1)); // Typ der folgenden Parameter
Write(nMethod);
Write(nNr);
}
-void CmdBaseStream::Read (comm_USHORT &nNr)
+void CmdBaseStream::Read (comm_UINT16 &nNr)
{
- comm_USHORT nId;
+ comm_UINT16 nId;
*pCommStream >> nId;
if (pCommStream->IsEof()) return;
#if OSL_DEBUG_LEVEL > 1
- if (nId != BinUSHORT) OSL_TRACE( "Falscher Typ im Stream: Erwartet USHORT, gefunden :%hu", nId );
+ if (nId != BinUINT16) OSL_TRACE( "Falscher Typ im Stream: Erwartet USHORT, gefunden :%hu", nId );
#endif
*pCommStream >> nNr;
}
-void CmdBaseStream::Read (comm_ULONG &nNr)
+void CmdBaseStream::Read (comm_UINT32 &nNr)
{
- comm_USHORT nId;
+ comm_UINT16 nId;
*pCommStream >> nId;
if (pCommStream->IsEof()) return;
#if OSL_DEBUG_LEVEL > 1
- if (nId != BinULONG) OSL_TRACE( "Falscher Typ im Stream: Erwartet ULONG, gefunden :%hu", nId );
+ if (nId != BinUINT32) OSL_TRACE( "Falscher Typ im Stream: Erwartet ULONG, gefunden :%hu", nId );
#endif
*pCommStream >> nNr;
}
-void CmdBaseStream::Read (comm_UniChar* &aString, comm_USHORT &nLenInChars )
+void CmdBaseStream::Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars )
{
- comm_USHORT nId;
+ comm_UINT16 nId;
*pCommStream >> nId;
#if OSL_DEBUG_LEVEL > 1
if (nId != BinString) OSL_TRACE( "Falscher Typ im Stream: Erwartet String, gefunden :%hu", nId );
@@ -229,10 +229,10 @@ void CmdBaseStream::Read (comm_UniChar* &aString, comm_USHORT &nLenInChars )
*pCommStream >> nLenInChars;
aString = new comm_UniChar [nLenInChars];
- pCommStream->Read( aString, ((comm_ULONG)nLenInChars) * sizeof( comm_UniChar ) );
+ pCommStream->Read( aString, ((comm_UINT32)nLenInChars) * sizeof( comm_UniChar ) );
#ifdef OSL_BIGENDIAN
// we have to change the byteorder
- comm_USHORT n;
+ comm_UINT16 n;
for ( n = 0 ; n < nLenInChars ; n++ )
aString[ n ] = aString[ n ] >> 8 | aString[ n ] << 8;
#endif
@@ -240,7 +240,7 @@ void CmdBaseStream::Read (comm_UniChar* &aString, comm_USHORT &nLenInChars )
void CmdBaseStream::Read (comm_BOOL &bBool)
{
- comm_USHORT nId;
+ comm_UINT16 nId;
*pCommStream >> nId;
#if OSL_DEBUG_LEVEL > 1
if (nId != BinBool) OSL_TRACE( "Falscher Typ im Stream: Erwartet BOOL, gefunden :%hu", nId );
@@ -248,39 +248,39 @@ void CmdBaseStream::Read (comm_BOOL &bBool)
*pCommStream >> bBool;
}
-comm_USHORT CmdBaseStream::GetNextType()
+comm_UINT16 CmdBaseStream::GetNextType()
{
- comm_USHORT nId;
+ comm_UINT16 nId;
*pCommStream >> nId;
pCommStream->SeekRel(-2);
return nId;
}
-void CmdBaseStream::Write( comm_USHORT nNr )
+void CmdBaseStream::Write( comm_UINT16 nNr )
{
- *pCommStream << comm_USHORT( BinUSHORT );
+ *pCommStream << comm_UINT16( BinUINT16 );
*pCommStream << nNr;
}
-void CmdBaseStream::Write( comm_ULONG nNr )
+void CmdBaseStream::Write( comm_UINT32 nNr )
{
- *pCommStream << comm_USHORT( BinULONG );
+ *pCommStream << comm_UINT16( BinUINT32 );
*pCommStream << nNr;
}
-void CmdBaseStream::Write( const comm_UniChar* aString, comm_USHORT nLenInChars )
+void CmdBaseStream::Write( const comm_UniChar* aString, comm_UINT16 nLenInChars )
{
- *pCommStream << comm_USHORT(BinString);
+ *pCommStream << comm_UINT16(BinString);
- comm_USHORT n;
+ comm_UINT16 n;
// remove BiDi and zero-width-markers 0x200B - 0x200F
// remove BiDi and paragraph-markers 0x2028 - 0x202E
comm_UniChar* aNoBiDiString;
aNoBiDiString = new comm_UniChar [nLenInChars];
- comm_USHORT nNewLenInChars = 0;
+ comm_UINT16 nNewLenInChars = 0;
for ( n = 0 ; n < nLenInChars ; n++ )
{
comm_UniChar c = aString[ n ];
@@ -303,10 +303,10 @@ void CmdBaseStream::Write( const comm_UniChar* aString, comm_USHORT nLenInChars
aNewString = new comm_UniChar [nNewLenInChars];
for ( n = 0 ; n < nNewLenInChars ; n++ )
aNewString[ n ] = aNoBiDiString[ n ] >> 8 | aNoBiDiString[ n ] << 8;
- pCommStream->Write( aNewString, ((comm_ULONG)nNewLenInChars) * sizeof( comm_UniChar ) );
+ pCommStream->Write( aNewString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) );
delete [] aNewString;
#else
- pCommStream->Write( aNoBiDiString, ((comm_ULONG)nNewLenInChars) * sizeof( comm_UniChar ) );
+ pCommStream->Write( aNoBiDiString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) );
#endif
delete [] aNoBiDiString;
@@ -314,7 +314,7 @@ void CmdBaseStream::Write( const comm_UniChar* aString, comm_USHORT nLenInChars
void CmdBaseStream::Write( comm_BOOL bBool )
{
- *pCommStream << comm_USHORT( BinBool );
+ *pCommStream << comm_UINT16( BinBool );
*pCommStream << bBool;
}
diff --git a/automation/source/server/recorder.cxx b/automation/source/server/recorder.cxx
index 6ec7ed48cc2e..c74380dff42f 100644
--- a/automation/source/server/recorder.cxx
+++ b/automation/source/server/recorder.cxx
@@ -190,7 +190,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
case VCLEVENT_WINDOW_ACTIVATE:
if ( m_bRecord )
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString(), (comm_USHORT)(M_SetPage|M_RET_NUM_CONTROL), Id2Str( pWin->GetUniqueOrHelpId() ) );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString(), (comm_UINT16)(M_SetPage|M_RET_NUM_CONTROL), Id2Str( pWin->GetUniqueOrHelpId() ) );
bSendData = sal_True;
}
if ( m_bLog )
@@ -210,7 +210,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
{
if ( m_bRecord )
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Check );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Check );
bSendData = sal_True;
}
if ( m_bLog )
@@ -228,7 +228,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
{
case VCLEVENT_BUTTON_CLICK: //VCLEVENT_CHECKBOX_TOGGLE:
{
- comm_USHORT nMethod;
+ comm_UINT16 nMethod;
String aMethod;
switch ( ((TriStateBox*)pWin)->GetState() )
{
@@ -273,7 +273,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
case VCLEVENT_LISTBOX_SELECT:
if ( m_bRecord )
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Select, comm_ULONG( ((ListBox*)pWin)->GetSelectEntryPos() +1 ) );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, comm_UINT32( ((ListBox*)pWin)->GetSelectEntryPos() +1 ) );
bSendData = sal_True;
}
if ( m_bLog )
@@ -308,7 +308,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
Sound::Beep();
else
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Select, (comm_ULONG) nPos+1 );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, (comm_UINT32) nPos+1 );
bSendData = sal_True;
}
}
@@ -341,7 +341,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
case WINDOW_QUERYBOX:
case WINDOW_BUTTONDIALOG:
{
- comm_USHORT nMethod;
+ comm_UINT16 nMethod;
String aMethod;
ButtonDialog* pBD = (ButtonDialog*)pParent;
@@ -372,7 +372,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
if ( nMethod != M_Click )
StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod );
else
- StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod, (comm_ULONG)nCurrentButtonId );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod, (comm_UINT32)nCurrentButtonId );
bSendData = sal_True;
}
if ( m_bLog )
@@ -387,7 +387,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
break;
default:
{
- comm_USHORT nMethod;
+ comm_UINT16 nMethod;
String aMethod;
switch ( pWin->GetType() )
{
@@ -415,7 +415,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
{
if ( !bSendData && pWin->GetUniqueOrHelpId().getLength() )
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Click );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click );
bSendData = sal_True;
}
}
@@ -443,7 +443,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
pEditModify = NULL;
aEditModifyString.Erase();
- comm_USHORT nMethod;
+ comm_UINT16 nMethod;
String aMethod;
switch ( nEventID )
{
@@ -478,7 +478,7 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
case VCLEVENT_BUTTON_CLICK:
if ( m_bRecord )
{
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Click );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click );
bSendData = sal_True;
}
if ( m_bLog )
@@ -502,10 +502,10 @@ IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
{
if ( !pWin->GetUniqueOrHelpId().getLength() /* || pWin->GetUniqueOrHelpId().Matches( 1 ) */ )
// generate direct Button access
- StatementList::pRet->GenReturn( RET_MacroRecorder, Str2Id( pTB->GetItemCommand( pTB->GetCurItemId() ) ), (comm_USHORT)(M_Click) );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, Str2Id( pTB->GetItemCommand( pTB->GetCurItemId() ) ), (comm_UINT16)(M_Click) );
else
// access via Toolbox
- StatementList::pRet->GenReturn( RET_MacroRecorder, pTB->GetUniqueOrHelpId(), (comm_USHORT)(M_Click|M_RET_NUM_CONTROL), Id2Str( pTB->GetHelpId( pTB->GetCurItemId() ) ) );
+ StatementList::pRet->GenReturn( RET_MacroRecorder, pTB->GetUniqueOrHelpId(), (comm_UINT16)(M_Click|M_RET_NUM_CONTROL), Id2Str( pTB->GetHelpId( pTB->GetCurItemId() ) ) );
bSendData = sal_True;
}
}
diff --git a/automation/source/server/retstrm.cxx b/automation/source/server/retstrm.cxx
index 3f5d2d8744ab..df36835c15d0 100644
--- a/automation/source/server/retstrm.cxx
+++ b/automation/source/server/retstrm.cxx
@@ -58,18 +58,18 @@ void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, String aString )
CmdBaseStream::GenReturn ( nRet, &aUId, &aString );
}
-void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_ULONG nNr, String aString, sal_Bool bBool )
+void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool )
{
CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool );
}
// MacroRecorder
-void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString )
+void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString )
{
CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString );
}
-void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString, sal_Bool bBool )
+void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool )
{
CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool );
}
@@ -79,7 +79,7 @@ void RetStream::GenReturn ( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValu
{
Write(sal_uInt16(SIReturn));
Write(nRet);
- Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
+ Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
Write(sal_uInt16(PARAM_SBXVALUE_1)); // Typ der folgenden Parameter
Write(aValue);
}
diff --git a/automation/source/server/retstrm.hxx b/automation/source/server/retstrm.hxx
index 19ee23f66b62..b61911afdae8 100644
--- a/automation/source/server/retstrm.hxx
+++ b/automation/source/server/retstrm.hxx
@@ -44,24 +44,24 @@ public:
void GenError( rtl::OString aUId, String aString );
using CmdBaseStream::GenReturn;
- void GenReturn( comm_USHORT nRet, comm_ULONG nNr ){CmdBaseStream::GenReturn( nRet, nNr );}
- void GenReturn( comm_USHORT nRet, rtl::OString aUId, comm_ULONG nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nNr );}
- void GenReturn( comm_USHORT nRet, rtl::OString aUId, comm_BOOL bBool ){CmdBaseStream::GenReturn( nRet, &aUId, bBool );}
+ void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, nNr );}
+ void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nNr );}
+ void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_BOOL bBool ){CmdBaseStream::GenReturn( nRet, &aUId, bBool );}
// MacroRecorder
void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod );} // also used outside MacroRecorder
void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod, nNr );}
void GenReturn( sal_uInt16 nRet, rtl::OString aUId, String aString );
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_ULONG nNr, String aString, sal_Bool bBool );
+ void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool );
// needed for RemoteCommand and Profiling
void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue );
void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString );
// MacroRecorder
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString );
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString, sal_Bool bBool );
+ void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString );
+ void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool );
void Reset();
SvStream* GetStream();
@@ -69,8 +69,8 @@ public:
using CmdBaseStream::Write;
- void Write( comm_USHORT nNr ){CmdBaseStream::Write( nNr );}
- void Write( comm_ULONG nNr ){CmdBaseStream::Write( nNr );}
+ void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );}
+ void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );}
void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );}
void Write( SbxValue &aValue );
diff --git a/automation/source/server/scmdstrm.cxx b/automation/source/server/scmdstrm.cxx
index 8cd69cbb2aae..65bc818d8b15 100644
--- a/automation/source/server/scmdstrm.cxx
+++ b/automation/source/server/scmdstrm.cxx
@@ -86,24 +86,24 @@ void SCmdStream::Read ( SfxPoolItem *&pItem )
Read( nType );
switch (nType)
{
- case BinUSHORT:
+ case BinUINT16:
{
- comm_USHORT nNr;
+ comm_UINT16 nNr;
Read (nNr );
pItem = new SfxUInt16Item(nId,nNr);
#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "USHORT:" );
+ StatementList::m_pDbgWin->AddText( "UINT16" );
StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
#endif
}
break;
- case BinULONG:
+ case BinUINT32:
{
- comm_ULONG nNr;
+ comm_UINT32 nNr;
Read (nNr );
pItem = new SfxUInt32Item(nId,nNr);
#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "ULONG:" );
+ StatementList::m_pDbgWin->AddText( "UINT32" );
StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
#endif
}
@@ -157,24 +157,24 @@ void SCmdStream::Read ( ::com::sun::star::beans::PropertyValue &rItem )
nType = GetNextType();
switch (nType)
{
- case BinUSHORT:
+ case BinUINT16:
{
- comm_USHORT nNr;
+ comm_UINT16 nNr;
Read (nNr );
rItem.Value <<= nNr;
#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "USHORT:" );
+ StatementList::m_pDbgWin->AddText( "UINT16" );
StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
#endif
}
break;
- case BinULONG:
+ case BinUINT32:
{
- comm_ULONG nNr;
+ comm_UINT32 nNr;
Read (nNr );
rItem.Value <<= nNr;
#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "ULONG:" );
+ StatementList::m_pDbgWin->AddText( "UINT32" );
StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
#endif
}
diff --git a/automation/source/server/scmdstrm.hxx b/automation/source/server/scmdstrm.hxx
index e2725b6f0070..5962e3942459 100644
--- a/automation/source/server/scmdstrm.hxx
+++ b/automation/source/server/scmdstrm.hxx
@@ -47,8 +47,8 @@ public:
~SCmdStream();
using CmdBaseStream::Read;
- void Read ( comm_USHORT &nNr ){CmdBaseStream::Read ( nNr );}
- void Read ( comm_ULONG &nNr ){CmdBaseStream::Read ( nNr );}
+ void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );}
+ void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );}
void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );}
void Read ( String &aString );
void Read ( SfxPoolItem *&pItem );
diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx
index e8be99121ce6..3ff44fa4d409 100644
--- a/automation/source/server/sta_list.cxx
+++ b/automation/source/server/sta_list.cxx
@@ -124,11 +124,10 @@ TTSettings* GetTTSettings()
return pTTSettings;
}
-
-
-
// FIXME: HELPID
-#define IS_WINP_CLOSING(pWin) (pWin->GetHelpId().equals( "TT_Win_is_closing_HID" ) && pWin->GetUniqueId().equals( "TT_Win_is_closing_UID" ))
+#define IS_WINP_CLOSING(pWin) \
+ (pWin->GetHelpId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_HID")) && \
+ pWin->GetUniqueId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_UID")))
StatementList::StatementList()
: nRetryCount(MAX_RETRIES)
@@ -167,7 +166,7 @@ void StatementList::SendProfile( String aText )
if ( pProfiler->IsPartitioning() )
// FIXME: HELPID
- pRet->GenReturn( RET_ProfileInfo, S_ProfileTime, static_cast<comm_ULONG>(pProfiler->GetPartitioningTime()) ); // GetPartitioningTime() sal_uLong != comm_ULONG on 64bit
+ pRet->GenReturn( RET_ProfileInfo, S_ProfileTime, static_cast<comm_UINT32>(pProfiler->GetPartitioningTime()) ); // GetPartitioningTime() sal_uLong != comm_UINT32 on 64bit
}
if ( pProfiler->IsAutoProfiling() )
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 23641de88d47..ed0e1103fe0d 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -191,7 +191,7 @@ void StatementFlow::SendViaSocket()
bSending = sal_True;
if ( pCommLink )
{
- if ( !pCommLink->TransferDataStream( pRet->GetStream() ) ) // tritt ein Fehler auf, so wird sofort gel�scht ...
+ if ( !pCommLink->TransferDataStream( pRet->GetStream() ) ) // tritt ein Fehler auf, so wird sofort gel�scht ...
pCommLink = NULL;
}
else
@@ -220,15 +220,15 @@ sal_Bool StatementFlow::Execute()
if ( !bUseIPC )
{
// bBool1 wurde im CTOR auf sal_False initialisiert
- if ( !bBool1 ) // also erster Durchlauf
+ if ( !bBool1 ) // also erster Durchlauf
{
pRemoteControl->pRetStream = pRet->GetStream();
- bBool1 = sal_True; // wurde im CTOR auf sal_False initialisiert
+ bBool1 = sal_True; // wurde im CTOR auf sal_False initialisiert
nRetryCount = nRetryCount * 4;
}
- if ( pRemoteControl->pRetStream && (nRetryCount--) ) // also solange nicht abgeholt
+ if ( pRemoteControl->pRetStream && (nRetryCount--) ) // also solange nicht abgeholt
{
- return sal_False; // Bitte einmal vom Callstack runter
+ return sal_False; // Bitte einmal vom Callstack runter
}
}
@@ -241,7 +241,7 @@ sal_Bool StatementFlow::Execute()
{
case F_EndCommandBlock:
if ( !bUseIPC )
- { // wird oben abgehandelt
+ { // wird oben abgehandelt
pRet->Reset();
IsError = sal_False;
}
@@ -276,59 +276,59 @@ static short ImpGetRType( Window *pWin )
short nRT = C_NoType;
WindowType eRT = pWin->GetType();
switch( eRT ) {
- case WINDOW_WINDOW: nRT = C_Window ; break;
-
- case WINDOW_TABCONTROL: nRT = C_TabControl ; break;
- case WINDOW_RADIOBUTTON: nRT = C_RadioButton ; break;
- case WINDOW_CHECKBOX: nRT = C_CheckBox ; break;
- case WINDOW_TRISTATEBOX: nRT = C_TriStateBox ; break;
- case WINDOW_EDIT: nRT = C_Edit ; break;
- case WINDOW_MULTILINEEDIT: nRT = C_MultiLineEdit ; break;
- case WINDOW_MULTILISTBOX: nRT = C_MultiListBox ; break;
- case WINDOW_LISTBOX: nRT = C_ListBox ; break;
- case WINDOW_COMBOBOX: nRT = C_ComboBox ; break;
- case WINDOW_PUSHBUTTON: nRT = C_PushButton ; break;
- case WINDOW_SPINFIELD: nRT = C_SpinField ; break;
- case WINDOW_PATTERNFIELD: nRT = C_PatternField ; break;
- case WINDOW_NUMERICFIELD: nRT = C_NumericField ; break;
- case WINDOW_METRICFIELD: nRT = C_MetricField ; break;
- case WINDOW_CURRENCYFIELD: nRT = C_CurrencyField ; break;
- case WINDOW_DATEFIELD: nRT = C_DateField ; break;
- case WINDOW_TIMEFIELD: nRT = C_TimeField ; break;
- case WINDOW_IMAGERADIOBUTTON: nRT = C_ImageRadioButton ; break;
- case WINDOW_NUMERICBOX: nRT = C_NumericBox ; break;
- case WINDOW_METRICBOX: nRT = C_MetricBox ; break;
- case WINDOW_CURRENCYBOX: nRT = C_CurrencyBox ; break;
- case WINDOW_DATEBOX: nRT = C_DateBox ; break;
- case WINDOW_TIMEBOX: nRT = C_TimeBox ; break;
- case WINDOW_IMAGEBUTTON: nRT = C_ImageButton ; break;
- case WINDOW_MENUBUTTON: nRT = C_MenuButton ; break;
- case WINDOW_MOREBUTTON: nRT = C_MoreButton ; break;
-
-
- case WINDOW_TABPAGE: nRT = C_TabPage; break;
- case WINDOW_MODALDIALOG: nRT = C_ModalDlg; break;
- case WINDOW_FLOATINGWINDOW: nRT = C_FloatWin; break;
- case WINDOW_MODELESSDIALOG: nRT = C_ModelessDlg; break;
- case WINDOW_WORKWINDOW: nRT = C_WorkWin; break;
- case WINDOW_DOCKINGWINDOW: nRT = C_DockingWin; break;
-
- case WINDOW_MESSBOX: nRT = C_MessBox; break;
- case WINDOW_INFOBOX: nRT = C_InfoBox; break;
- case WINDOW_WARNINGBOX: nRT = C_WarningBox; break;
- case WINDOW_ERRORBOX: nRT = C_ErrorBox; break;
- case WINDOW_QUERYBOX: nRT = C_QueryBox; break;
- case WINDOW_TABDIALOG: nRT = C_TabDlg; break;
-
- case WINDOW_PATTERNBOX: nRT = C_PatternBox; break;
- case WINDOW_TOOLBOX: nRT = C_ToolBox; break;
- case WINDOW_CONTROL: nRT = C_Control; break;
- case WINDOW_OKBUTTON: nRT = C_OkButton; break;
- case WINDOW_CANCELBUTTON: nRT = C_CancelButton; break;
- case WINDOW_BUTTONDIALOG: nRT = C_ButtonDialog; break;
- case WINDOW_TREELISTBOX: nRT = C_TreeListBox; break;
-
- case WINDOW_DIALOG: nRT = C_Dialog; break;
+ case WINDOW_WINDOW: nRT = C_Window ; break;
+
+ case WINDOW_TABCONTROL: nRT = C_TabControl ; break;
+ case WINDOW_RADIOBUTTON: nRT = C_RadioButton ; break;
+ case WINDOW_CHECKBOX: nRT = C_CheckBox ; break;
+ case WINDOW_TRISTATEBOX: nRT = C_TriStateBox ; break;
+ case WINDOW_EDIT: nRT = C_Edit ; break;
+ case WINDOW_MULTILINEEDIT: nRT = C_MultiLineEdit ; break;
+ case WINDOW_MULTILISTBOX: nRT = C_MultiListBox ; break;
+ case WINDOW_LISTBOX: nRT = C_ListBox ; break;
+ case WINDOW_COMBOBOX: nRT = C_ComboBox ; break;
+ case WINDOW_PUSHBUTTON: nRT = C_PushButton ; break;
+ case WINDOW_SPINFIELD: nRT = C_SpinField ; break;
+ case WINDOW_PATTERNFIELD: nRT = C_PatternField ; break;
+ case WINDOW_NUMERICFIELD: nRT = C_NumericField ; break;
+ case WINDOW_METRICFIELD: nRT = C_MetricField ; break;
+ case WINDOW_CURRENCYFIELD: nRT = C_CurrencyField ; break;
+ case WINDOW_DATEFIELD: nRT = C_DateField ; break;
+ case WINDOW_TIMEFIELD: nRT = C_TimeField ; break;
+ case WINDOW_IMAGERADIOBUTTON: nRT = C_ImageRadioButton ; break;
+ case WINDOW_NUMERICBOX: nRT = C_NumericBox ; break;
+ case WINDOW_METRICBOX: nRT = C_MetricBox ; break;
+ case WINDOW_CURRENCYBOX: nRT = C_CurrencyBox ; break;
+ case WINDOW_DATEBOX: nRT = C_DateBox ; break;
+ case WINDOW_TIMEBOX: nRT = C_TimeBox ; break;
+ case WINDOW_IMAGEBUTTON: nRT = C_ImageButton ; break;
+ case WINDOW_MENUBUTTON: nRT = C_MenuButton ; break;
+ case WINDOW_MOREBUTTON: nRT = C_MoreButton ; break;
+
+
+ case WINDOW_TABPAGE: nRT = C_TabPage; break;
+ case WINDOW_MODALDIALOG: nRT = C_ModalDlg; break;
+ case WINDOW_FLOATINGWINDOW: nRT = C_FloatWin; break;
+ case WINDOW_MODELESSDIALOG: nRT = C_ModelessDlg; break;
+ case WINDOW_WORKWINDOW: nRT = C_WorkWin; break;
+ case WINDOW_DOCKINGWINDOW: nRT = C_DockingWin; break;
+
+ case WINDOW_MESSBOX: nRT = C_MessBox; break;
+ case WINDOW_INFOBOX: nRT = C_InfoBox; break;
+ case WINDOW_WARNINGBOX: nRT = C_WarningBox; break;
+ case WINDOW_ERRORBOX: nRT = C_ErrorBox; break;
+ case WINDOW_QUERYBOX: nRT = C_QueryBox; break;
+ case WINDOW_TABDIALOG: nRT = C_TabDlg; break;
+
+ case WINDOW_PATTERNBOX: nRT = C_PatternBox; break;
+ case WINDOW_TOOLBOX: nRT = C_ToolBox; break;
+ case WINDOW_CONTROL: nRT = C_Control; break;
+ case WINDOW_OKBUTTON: nRT = C_OkButton; break;
+ case WINDOW_CANCELBUTTON: nRT = C_CancelButton; break;
+ case WINDOW_BUTTONDIALOG: nRT = C_ButtonDialog; break;
+ case WINDOW_TREELISTBOX: nRT = C_TreeListBox; break;
+
+ case WINDOW_DIALOG: nRT = C_Dialog; break;
}
return nRT;
}
@@ -640,7 +640,7 @@ sal_Bool StatementSlot::Execute()
}
-/* Neues Verfahren ab 334!
+/* Neues Verfahren ab 334!
Neue Methode zum einstellen, da� Modale Dialoge immer Asynchron aufgerufen werden
und echter Returnwert, ob Slot geklappt hat
und Testen ob Slot �berhaupt durch UI aufgerufen werden kann */
@@ -688,13 +688,13 @@ StatementCommand::StatementCommand( StatementList *pAfterThis, sal_uInt16 Method
m_pDbgWin->AddText( " Methode: " );
m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
+ if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
+ if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
+ if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
+ if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
+ if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
+ if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
+ if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
m_pDbgWin->AddText( "\n" );
@@ -720,28 +720,28 @@ StatementCommand::StatementCommand( SCmdStream *pCmdIn )
pCmdIn->Read( nMethodId );
pCmdIn->Read( nParams );
- if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
- if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
- if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
- if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
- if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1_and_Pointer.nLNr1 );
- if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
- if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
- if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
- if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
+ if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
+ if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
+ if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
+ if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
+ if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1_and_Pointer.nLNr1 );
+ if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
+ if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
+ if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
+ if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
#if OSL_DEBUG_LEVEL > 1
m_pDbgWin->AddText( "Reading Conmmand:" );
m_pDbgWin->AddText( " Methode: " );
m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
+ if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
+ if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
+ if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
+ if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
+ if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
+ if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
+ if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
m_pDbgWin->AddText( "\n" );
@@ -783,7 +783,7 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo
pBase = pBase->GetParent();
}
- { // Klammerung, so da� der String nicht w�hrend der Rekursion bestehen bleibt
+ { // Klammerung, so da� der String nicht w�hrend der Rekursion bestehen bleibt
String aName;
sal_Bool bSkip = sal_False;
@@ -888,7 +888,7 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo
TypeString(pBase->GetType()).Append(aTypeSuffix).AppendAscii(": ").Append(aName), sal_False );
- if ( pBase->GetType() == WINDOW_TOOLBOX ) // Buttons und Controls auf Toolboxen.
+ if ( pBase->GetType() == WINDOW_TOOLBOX ) // Buttons und Controls auf Toolboxen.
{
ToolBox *pTB = ((ToolBox*)pBase);
sal_uInt16 i;
@@ -961,11 +961,11 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo
}
}
- return; // ToolBox ist hier schon komplett abgehandelt.
+ return; // ToolBox ist hier schon komplett abgehandelt.
}
- if ( pBase->GetType() == WINDOW_BUTTONDIALOG // Buttons auf Buttondialogen mit ID
+ if ( pBase->GetType() == WINDOW_BUTTONDIALOG // Buttons auf Buttondialogen mit ID
|| pBase->GetType() == WINDOW_MESSBOX
|| pBase->GetType() == WINDOW_INFOBOX
|| pBase->GetType() == WINDOW_WARNINGBOX
@@ -1006,18 +1006,18 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo
break;
}
- pRet->GenReturn ( RET_WinInfo, aID, (comm_UINT32)pBD->GetPushButton( pBD->GetButtonId(i) )->GetType(), // So da� der Text angezeigt wird!
+ pRet->GenReturn ( RET_WinInfo, aID, (comm_UINT32)pBD->GetPushButton( pBD->GetButtonId(i) )->GetType(), // So da� der Text angezeigt wird!
TypeString(pBD->GetPushButton( pBD->GetButtonId(i) )->GetType()).AppendAscii(": ").Append(aName)
.AppendAscii(" ButtonId = ").AppendAscii( aID.GetBuffer() ), sal_False );
}
- return; // ButtonDialog ist hier schon komplett abgehandelt.
+ return; // ButtonDialog ist hier schon komplett abgehandelt.
}
Menu* pMenu = GetMatchingMenu( pBase );
- if ( pMenu ) // Menus
+ if ( pMenu ) // Menus
{
sal_uInt16 i;
for ( i = 0; i < pMenu->GetItemCount() ; i++ )
@@ -1063,7 +1063,7 @@ void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Boo
}
}
- return; // Menu ist hier schon komplett abgehandelt.
+ return; // Menu ist hier schon komplett abgehandelt.
}
}
}
@@ -1080,8 +1080,8 @@ private:
public:
SysWinContainer( ToolBox *pClient );
~SysWinContainer();
- virtual void Resize();
- virtual void Resizing( Size& rSize );
+ virtual void Resize();
+ virtual void Resizing( Size& rSize );
};
SysWinContainer::SysWinContainer( ToolBox *pClient )
@@ -1142,9 +1142,9 @@ void SysWinContainer::Resizing( Size& rSize )
class DisplayHidWin : public ToolBox
{
- Edit *pEdit;
- Size aMinEditSize;
- sal_uInt16 nLastItemID;
+ Edit *pEdit;
+ Size aMinEditSize;
+ sal_uInt16 nLastItemID;
sal_Bool bIsDraging;
sal_Bool bIsPermanentDraging;
void SetDraging( sal_Bool bNewDraging );
@@ -1172,10 +1172,10 @@ public:
DisplayHidWin();
~DisplayHidWin();
- virtual void Tracking( const TrackingEvent& rTEvt );
- virtual void Click();
- virtual void Select();
- virtual void SetText( const XubString& rStr );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Click();
+ virtual void Select();
+ virtual void SetText( const XubString& rStr );
void SetDisplayText( const String &aNewText ){ pEdit->SetText(aNewText); }
String GetDisplayText() const { return pEdit->GetText(); }
@@ -1208,7 +1208,7 @@ DisplayHidWin::DisplayHidWin()
SetOutStyle( TOOLBOX_STYLE_HANDPOINTER | TOOLBOX_STYLE_FLAT );
pEdit = new Edit( this, WB_CENTER | WB_BORDER );
aMinEditSize = GetItemRect( TT_OUTPUT ).GetSize();
-/**/ aMinEditSize=Size(20,20);
+/**/ aMinEditSize=Size(20,20);
aMinEditSize.Width() *= 12;
pEdit->SetSizePixel( aMinEditSize );
pEdit->Show();
@@ -1363,16 +1363,16 @@ sal_Bool StatementCommand::DisplayHID()
{
// Return sal_True -> reexecute command
- if ( !bBool2 ) // Wird auf sal_False initialisiert
+ if ( !bBool2 ) // Wird auf sal_False initialisiert
{
- bBool2 = sal_True; // Wir sind initialisiert.
- GetTTSettings()->pDisplayInstance = this; // Und haben die Macht (Alle anderen beenden sich)
+ bBool2 = sal_True; // Wir sind initialisiert.
+ GetTTSettings()->pDisplayInstance = this; // Und haben die Macht (Alle anderen beenden sich)
if ( !(nParams & PARAM_UINT32_1) )
{
- if( GetTTSettings()->pDisplayHidWin ) // Nichts ver�ndern
+ if( GetTTSettings()->pDisplayHidWin ) // Nichts ver�ndern
nLNr1_and_Pointer.nLNr1 = GetTTSettings()->pDisplayHidWin->GetConfig();
- else // Beim ersten Aufruf wollen wir alles richtig einstellen
+ else // Beim ersten Aufruf wollen wir alles richtig einstellen
nLNr1_and_Pointer.nLNr1 = DH_MODE_KURZNAME | DH_MODE_LANGNAME;
if( ((nParams & PARAM_BOOL_1) && bBool1) )
@@ -1388,7 +1388,7 @@ sal_Bool StatementCommand::DisplayHID()
if ( GetTTSettings()->pDisplayInstance && GetTTSettings()->pDisplayInstance != this )
{
DBG_WARNING("Mehrere DisplayHID am laufen");
- return sal_False; // Noch eine andere Instanz macht das gleiche!
+ return sal_False; // Noch eine andere Instanz macht das gleiche!
}
if ( !GetTTSettings()->pDisplayHidWin )
@@ -1418,35 +1418,35 @@ sal_Bool StatementCommand::DisplayHID()
{
-#define HIGHLIGHT_WIN( WinPtr ) \
- { \
- Color aLineColMem = WinPtr->GetLineColor(); \
- WinPtr->SetLineColor( Color( COL_WHITE ) ); \
- Color aFillColMem = WinPtr->GetFillColor(); \
- WinPtr->SetFillColor( Color( COL_LIGHTRED ) ); \
- RasterOp aROp = WinPtr->GetRasterOp(); \
- WinPtr->SetRasterOp( ROP_XOR ); \
+#define HIGHLIGHT_WIN( WinPtr ) \
+ { \
+ Color aLineColMem = WinPtr->GetLineColor(); \
+ WinPtr->SetLineColor( Color( COL_WHITE ) ); \
+ Color aFillColMem = WinPtr->GetFillColor(); \
+ WinPtr->SetFillColor( Color( COL_LIGHTRED ) ); \
+ RasterOp aROp = WinPtr->GetRasterOp(); \
+ WinPtr->SetRasterOp( ROP_XOR ); \
Size aSz = WinPtr->PixelToLogic( WinPtr->GetSizePixel() );\
sal_uLong nMaxCornerRadius = WinPtr->PixelToLogic( Point( 80, 0 ) ).X();\
sal_uLong iCorner = std::max ((sal_uLong) 8, (sal_uLong) std::min( nMaxCornerRadius, (sal_uLong) std::min((sal_uLong) (aSz.Width() / 6), (sal_uLong)(aSz.Height() / 6))));\
WinPtr->DrawRect(Rectangle(Point(),aSz), iCorner, iCorner);\
- WinPtr->SetLineColor( aLineColMem ); \
- WinPtr->SetFillColor( aFillColMem ); \
- WinPtr->SetRasterOp( aROp ); \
+ WinPtr->SetLineColor( aLineColMem ); \
+ WinPtr->SetFillColor( aFillColMem ); \
+ WinPtr->SetRasterOp( aROp ); \
}
-#define SET_WIN( WinPtr ) \
- if ( StatementList::WinPtrValid(WinPtr) ) \
- { \
- HIGHLIGHT_WIN ( WinPtr ); \
+#define SET_WIN( WinPtr ) \
+ if ( StatementList::WinPtrValid(WinPtr) ) \
+ { \
+ HIGHLIGHT_WIN ( WinPtr ); \
}
-#define RESET_WIN( WinPtr ) \
- if ( StatementList::WinPtrValid(WinPtr) ) \
- { \
- WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT ); \
- WinPtr->Update(); \
+#define RESET_WIN( WinPtr ) \
+ if ( StatementList::WinPtrValid(WinPtr) ) \
+ { \
+ WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT ); \
+ WinPtr->Update(); \
}
@@ -1493,9 +1493,9 @@ sal_Bool StatementCommand::DisplayHID()
if ( GetTTSettings()->pDisplayHidWin->IsSendData() && GetTTSettings()->Act )
{
if ( !StatementFlow::bSending )
- { // Normalerweise syncronisierung �ber Protokoll. Hier ist das aber asyncron!!!
+ { // Normalerweise syncronisierung �ber Protokoll. Hier ist das aber asyncron!!!
WriteControlData( GetTTSettings()->Act, GetTTSettings()->pDisplayHidWin->GetConfig() );
- new StatementFlow( this, F_EndCommandBlock ); // Kommando zum Senden erzeugen und in que eintragen
+ new StatementFlow( this, F_EndCommandBlock ); // Kommando zum Senden erzeugen und in que eintragen
}
}
}
@@ -1508,9 +1508,9 @@ sal_Bool StatementCommand::DisplayHID()
}
}
- if ( pFirst == this ) // Sollte immer so sein, aber besser isses
- if ( pNext ) // Befehle warten auf Ausf�hrung
- { // An Ende neu einsortieren
+ if ( pFirst == this ) // Sollte immer so sein, aber besser isses
+ if ( pNext ) // Befehle warten auf Ausf�hrung
+ { // An Ende neu einsortieren
Advance();
QueStatement( NULL );
}
@@ -1686,11 +1686,11 @@ IMPL_LINK( TranslateWin, DoRestore, PushButton*, EMPTYARG )
sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
if ( StatementList::WinPtrValid( pTranslateWin ) && pTranslateWin->GetText().CompareTo( sTT_E_NEW ) == COMPARE_EQUAL )
- { // Im ersten schritt nur in der UI zur�ck
+ { // Im ersten schritt nur in der UI zur�ck
pTranslateWin->SetText( sTT_E_OLD );
}
else
- { // Im zweite Schritt auch den eingegebenen Text
+ { // Im zweite Schritt auch den eingegebenen Text
EditTT_E_NEW.SetText( FixedTextTT_FT_OLD.GetText() );
PushButtonTT_PB_RESTORE.Disable();
}
@@ -1817,9 +1817,9 @@ long TranslateWin::VCLEventHook( NotifyEvent& rEvt )
return 0;
}
-#define FDS_ACTION_COLLECT 1
-#define FDS_ACTION_MARK 2
-#define FDS_ACTION_UNMARK 3
+#define FDS_ACTION_COLLECT 1
+#define FDS_ACTION_MARK 2
+#define FDS_ACTION_UNMARK 3
class FindShortcutErrors: public Search
{
@@ -1835,7 +1835,7 @@ public:
FindShortcutErrors::FindShortcutErrors()
: Search( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN )
{
- SetAction( FDS_ACTION_COLLECT ); // Wir fange immer mit sammeln an, ODER??
+ SetAction( FDS_ACTION_COLLECT ); // Wir fange immer mit sammeln an, ODER??
}
void FindShortcutErrors::SetAction( sal_uInt16 nA )
@@ -1876,10 +1876,10 @@ sal_Bool FindShortcutErrors::IsWinOK( Window *pWin )
case FDS_ACTION_MARK:
{
sal_Bool bMissing = sal_False;
- if ( !bHasAccel && aText.Len() ) // should there be an accelarator defined
+ if ( !bHasAccel && aText.Len() ) // should there be an accelarator defined
{
- Window* pChild;
+ Window* pChild;
pChild = pWin->GetWindow( WINDOW_CLIENT );
if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
@@ -1977,7 +1977,7 @@ String TranslateWin::MarkShortcutErrors( Window* pBase, sal_Bool bMark )
FindShortcutErrors aFinder;
if ( bMark )
{
- StatementList::SearchAllWin( pBase, aFinder, sal_True ); // collect Shortcuts first
+ StatementList::SearchAllWin( pBase, aFinder, sal_True ); // collect Shortcuts first
aFinder.SetAction( FDS_ACTION_MARK );
}
else
@@ -2066,7 +2066,7 @@ void StatementCommand::Translate()
aTranslation += TypeString( pParentDialog->GetType() );
}
else
- aTranslation.AppendAscii( "0;" ); // Zahl + leerer String
+ aTranslation.AppendAscii( "0;" ); // Zahl + leerer String
aTranslation += ';';
aTranslation += '\"';
@@ -2119,7 +2119,7 @@ void StatementCommand::Translate()
}
Window* StatementCommand::GetNextOverlap( Window* pBase )
-{ // Findet irgendwelche Overlap-Fenster, die schlie�bar aussehen
+{ // Findet irgendwelche Overlap-Fenster, die schlie�bar aussehen
// Eventuell mu� noch die Auswahl verfeinert werden.
if ( pBase->GetType() != WINDOW_BORDERWINDOW )
@@ -2220,25 +2220,25 @@ sal_Bool StatementCommand::Execute()
#if OSL_DEBUG_LEVEL > 1
-#define REPORT_WIN_CLOSED(pControl, aInfo) \
- _REPORT_WIN_CLOSED(pControl, aInfo) \
+#define REPORT_WIN_CLOSED(pControl, aInfo) \
+ _REPORT_WIN_CLOSED(pControl, aInfo) \
m_pDbgWin->AddText( aInfo.AppendAscii(" \"").Append( pControl->GetText() ).AppendAscii("\" geschlossen, RType = ").Append( TypeString(pControl->GetType()) ).AppendAscii(", UId = ").Append( UIdString( pControl->GetUniqueOrHelpId() ) ) );
#else
-#define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo)
+#define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo)
#endif
-#define REPORT_WIN_CLOSEDc(pControl, aInfo ) \
+#define REPORT_WIN_CLOSEDc(pControl, aInfo ) \
REPORT_WIN_CLOSED(pControl, CUniString(aInfo) )
-#define _REPORT_WIN_CLOSED(pControl, aInfo) \
- if ( aString1.Len() ) \
- aString1 += '\n'; \
- aString1 += aInfo; \
- aString1.AppendAscii(" \""); \
- aString1 += pControl->GetText(); \
+#define _REPORT_WIN_CLOSED(pControl, aInfo) \
+ if ( aString1.Len() ) \
+ aString1 += '\n'; \
+ aString1 += aInfo; \
+ aString1.AppendAscii(" \""); \
+ aString1 += pControl->GetText(); \
aString1.AppendAscii("\" geschlossen, RType = ");\
- aString1 += TypeString(pControl->GetType()); \
- aString1.AppendAscii(", UId = "); \
+ aString1 += TypeString(pControl->GetType()); \
+ aString1.AppendAscii(", UId = "); \
aString1 += UIdString(pControl->GetUniqueOrHelpId());
@@ -2250,7 +2250,7 @@ sal_Bool StatementCommand::Execute()
nLNr1_and_Pointer.nLNr1 = Time().GetTime() + nNr1/10;
bBool1 = sal_True;
}
- if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
+ if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
return sal_False;
break;
case RC_DisplayHid:
@@ -2261,11 +2261,11 @@ sal_Bool StatementCommand::Execute()
{
if ( !bBool1 )
{
- nRetryCount = 150; // das sollte reichen.
- bBool1 = sal_True; // Nur beim ersten mal!
- nNr1 = 1; // Welcher Button ist dran?
- nLNr1_and_Pointer.pWindow = 0; // Speichern des AppWin
- aString1 = UniString(); // Liste der geschlossenen Fenster
+ nRetryCount = 150; // das sollte reichen.
+ bBool1 = sal_True; // Nur beim ersten mal!
+ nNr1 = 1; // Welcher Button ist dran?
+ nLNr1_and_Pointer.pWindow = 0; // Speichern des AppWin
+ aString1 = UniString(); // Liste der geschlossenen Fenster
// So da� nacher auch wieder alles auf Default steht
nUseBindings = 0;
@@ -2287,7 +2287,7 @@ sal_Bool StatementCommand::Execute()
bBool2 = sal_False; // flag for wait when all windows are closed
pControl->GrabFocus();
- if ( pControl->GetType() != WINDOW_DOCKINGWINDOW
+ if ( pControl->GetType() != WINDOW_DOCKINGWINDOW
&& pControl->GetType() != WINDOW_FLOATINGWINDOW
&& pControl->GetType() != WINDOW_MODELESSDIALOG
&& pControl->GetType() != WINDOW_WORKWINDOW
@@ -2298,7 +2298,7 @@ sal_Bool StatementCommand::Execute()
short nRT = ImpGetRType( pControl );
if ( nRT == C_TabControl && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- { // Bei Tabcontrol den zugeh�rigen Tabdialog nehmen
+ { // Bei Tabcontrol den zugeh�rigen Tabdialog nehmen
pControl = pControl->GET_REAL_PARENT();
nRT = ImpGetRType( pControl );
}
@@ -2333,7 +2333,7 @@ sal_Bool StatementCommand::Execute()
SET_WINP_CLOSING(pControl);
pBD->EndDialog(RET_OK);
}
- nNr1 = 10; // Nochmal alle Buttons der Reihe nach
+ nNr1 = 10; // Nochmal alle Buttons der Reihe nach
break;
case 4:
if ( pBD->GetPushButton( BUTTONID_CANCEL ) )
@@ -2400,17 +2400,17 @@ sal_Bool StatementCommand::Execute()
// Eigentlich nur bei TaskWindows! Hoffen wir mal, da� keine anderen DockingWindows dazwischen hauen.
if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
+ nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
nLNr1_and_Pointer.pWindow = pControl;
return sal_False;
}
}
if ( nRetryCount--
- && ( (pControl->GetType() == WINDOW_FLOATINGWINDOW)
- || (pControl->GetType() == WINDOW_MODELESSDIALOG)
- || (pControl->GetType() == WINDOW_WORKWINDOW)
- || (pControl->GetType() == WINDOW_BORDERWINDOW) ) )
+ && ( (pControl->GetType() == WINDOW_FLOATINGWINDOW)
+ || (pControl->GetType() == WINDOW_MODELESSDIALOG)
+ || (pControl->GetType() == WINDOW_WORKWINDOW)
+ || (pControl->GetType() == WINDOW_BORDERWINDOW) ) )
{
// Special handling for last Document; do not close the Frame, only the Document
if ( GetDocWinCount() == 1 && IsDocFrame( pControl ) )
@@ -2429,7 +2429,7 @@ sal_Bool StatementCommand::Execute()
// nur bei TaskWindows!
if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
+ nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
nLNr1_and_Pointer.pWindow = pControl;
return sal_False;
@@ -2445,7 +2445,7 @@ sal_Bool StatementCommand::Execute()
// Eigentlich nur bei TaskWindows!
if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
+ nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en
nLNr1_and_Pointer.pWindow = pControl;
return sal_False;
@@ -2460,7 +2460,7 @@ sal_Bool StatementCommand::Execute()
nLNr1_and_Pointer.nLNr1 = Time().GetTime() + 100; // 100 = 1 Second
bBool2 = sal_True;
}
- if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
+ if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
return sal_False;
else
pRet->GenReturn ( RET_Value, nMethodId, aString1);
@@ -2480,7 +2480,7 @@ sal_Bool StatementCommand::Execute()
pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSFinished) );
else
{
- if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
+ if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit
return sal_False;
pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSTimeout) );
}
@@ -2494,12 +2494,12 @@ sal_Bool StatementCommand::Execute()
switch ( nMethodId )
{
- case RC_AppDelay: // Diese Befehle werden anderswo behandelt
+ case RC_AppDelay: // Diese Befehle werden anderswo behandelt
case RC_DisplayHid:
case RC_ResetApplication:
case RC_WaitSlot:
- case RC_AppAbort: // Sofortiges L�schen aller Befehle
+ case RC_AppAbort: // Sofortiges L�schen aller Befehle
break;
case RC_Assert:
{
@@ -2582,12 +2582,12 @@ sal_Bool StatementCommand::Execute()
nUseBindings = 0;
break;
case RC_Profile:
- // Bei folgenden Parametern passiert folgendes:
- // ein boolean=false Alles Profiling stoppen (Ergebnisse liefern)
- // ein boolean=true, 1-4 ints Einteilung der Zeiten in K�stchen
- // kein! boolean keine ints loggen jeden Befehls
- // kein! boolean 1 int loggen alle int Millisekunden
- // ein String wird in das Logfile �bernommen(sonst passiert nichts)
+ // Bei folgenden Parametern passiert folgendes:
+ // ein boolean=false Alles Profiling stoppen (Ergebnisse liefern)
+ // ein boolean=true, 1-4 ints Einteilung der Zeiten in K�stchen
+ // kein! boolean keine ints loggen jeden Befehls
+ // kein! boolean 1 int loggen alle int Millisekunden
+ // ein String wird in das Logfile �bernommen(sonst passiert nichts)
if( !(nParams & PARAM_BOOL_1) || bBool1 )
{
if ( !pProfiler )
@@ -2597,7 +2597,7 @@ sal_Bool StatementCommand::Execute()
}
if( !(nParams & PARAM_BOOL_1) && (nParams & PARAM_UINT16_1) )
- { // Autoprofiling: Profile nNr
+ { // Autoprofiling: Profile nNr
if ( pProfiler->IsProfilingPerCommand() )
{
pProfiler->StopProfilingPerCommand();
@@ -2608,7 +2608,7 @@ sal_Bool StatementCommand::Execute()
pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
}
else if ( nParams & PARAM_UINT16_1 )
- { // Partitioning initialisieren: Profile true [,nNr][,nNr][,nNr][,nNr]
+ { // Partitioning initialisieren: Profile true [,nNr][,nNr][,nNr][,nNr]
comm_UINT32 nAnzahl=0;
if ( nParams & PARAM_UINT16_1 ) { nAnzahl++; };
if ( nParams & PARAM_UINT16_2 ) { nAnzahl++; };
@@ -2628,13 +2628,13 @@ sal_Bool StatementCommand::Execute()
pProfiler->StartPartitioning();
}
- else if( nParams == PARAM_STR_1 ) // Genau ein String!
- { // Nur einen String ins Profiling aufnehmen
+ else if( nParams == PARAM_STR_1 ) // Genau ein String!
+ { // Nur einen String ins Profiling aufnehmen
aString1 += '\n';
pRet->GenReturn( RET_ProfileInfo, 0, aString1 );
}
else
- { // Normales Profiling je Kommando: profile
+ { // Normales Profiling je Kommando: profile
if ( pProfiler->IsAutoProfiling() )
{
pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
@@ -2646,7 +2646,7 @@ sal_Bool StatementCommand::Execute()
pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
}
}
- else // Profiling wieder ausschalten: Profile false
+ else // Profiling wieder ausschalten: Profile false
if ( pProfiler )
{
if ( pProfiler->IsProfilingPerCommand() )
@@ -2703,8 +2703,8 @@ sal_Bool StatementCommand::Execute()
{
nItemCount = pMenu->GetItemCount();
if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the count
- sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
+ { // jep, we have to adjust the count
+ sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() ; i++ )
{
if ( !pMenu->IsItemEnabled( pMenu->GetItemId( i ) ) )
@@ -2716,7 +2716,7 @@ sal_Bool StatementCommand::Execute()
bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR;
}
}
- if ( bLastWasSeperator ) // Separator at bottom
+ if ( bLastWasSeperator ) // Separator at bottom
nItemCount--;
}
}
@@ -2732,8 +2732,8 @@ sal_Bool StatementCommand::Execute()
{
nPhysicalIndex = nNr1;
if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the position
- sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
+ { // jep, we have to adjust the position
+ sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
sal_uInt16 nVisibleCount = 0;
for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() && nVisibleCount < nNr1 ; i++ )
{
@@ -2771,7 +2771,7 @@ sal_Bool StatementCommand::Execute()
{
sal_uInt16 nLogicalPos = pMenu->GetItemPos(nNr1);
if ( MENU_ITEM_NOTFOUND != nLogicalPos && pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the position
+ { // jep, we have to adjust the position
if ( !pMenu->IsItemEnabled( nNr1 ) )
nLogicalPos = MENU_ITEM_NOTFOUND;
else
@@ -3389,15 +3389,15 @@ StatementControl::StatementControl( SCmdStream *pCmdIn, sal_uInt16 nControlIdTyp
pCmdIn->Read( nMethodId );
pCmdIn->Read( nParams );
- if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
- if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
- if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
- if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
- if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 );
- if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
- if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
- if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
- if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
+ if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
+ if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
+ if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
+ if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
+ if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 );
+ if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
+ if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
+ if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
+ if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
#if OSL_DEBUG_LEVEL > 1
m_pDbgWin->AddText( "Reading Control: UId: " );
@@ -3405,19 +3405,19 @@ StatementControl::StatementControl( SCmdStream *pCmdIn, sal_uInt16 nControlIdTyp
m_pDbgWin->AddText( " Methode: " );
m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
+ if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
+ if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
+ if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
+ if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
+ if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
+ if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
+ if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
m_pDbgWin->AddText( "\n" );
#endif
}
sal_Bool IsDialog(Window *pWin)
-{ // Alles was von SystemWindow abgeleitet ist
+{ // Alles was von SystemWindow abgeleitet ist
if ( !pWin )
return sal_False;
@@ -3613,7 +3613,7 @@ void StatementControl::AnimateMouse( Window *pControl, Point aWohin )
aDiff *= 1000;
aDiff /= nSteps;
- StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
+ StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
// Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
for ( ; nSteps ; nSteps-- )
@@ -3626,7 +3626,7 @@ void StatementControl::AnimateMouse( Window *pControl, Point aWohin )
SafeReschedule();
}
pControl->SetPointerPosPixel(aZiel);
- StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
+ StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
}
@@ -3640,13 +3640,13 @@ sal_Bool StatementControl::MaybeDoTypeKeysDelay( Window *pTestWindow )
Timer aTimer;
aTimer.SetTimeout( nTimeWait );
aTimer.Start();
- StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
+ StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
// Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
while ( aTimer.IsActive() )
{
SafeReschedule( sal_True );
}
- StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
+ StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
if ( !WinPtrValid(pTestWindow ) )
{
ReportError( aUId, GEN_RES_STR1( S_WINDOW_DISAPPEARED, MethodString( nMethodId ) ) );
@@ -3658,7 +3658,7 @@ sal_Bool StatementControl::MaybeDoTypeKeysDelay( Window *pTestWindow )
sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
{
- if( pControl ) // Also auch bei Disabled nicht jedoch bei Invisible
+ if( pControl ) // Also auch bei Disabled nicht jedoch bei Invisible
{
switch( nMethodId )
{
@@ -3670,11 +3670,11 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
break;
case M_GetPosX:
if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
if ( (nParams & PARAM_BOOL_1) && bBool1 )
pControl = pControl->GetWindow( WINDOW_OVERLAP );
@@ -3689,11 +3689,11 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
break;
case M_GetPosY:
if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
if ( (nParams & PARAM_BOOL_1) && bBool1 )
pControl = pControl->GetWindow( WINDOW_OVERLAP );
@@ -3708,11 +3708,11 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
break;
case M_GetSizeX:
if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
if ( (nParams & PARAM_BOOL_1) && bBool1 )
pControl = pControl->GetWindow( WINDOW_OVERLAP );
@@ -3720,11 +3720,11 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
break;
case M_GetSizeY:
if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
if ( (nParams & PARAM_BOOL_1) && bBool1 )
pControl = pControl->GetWindow( WINDOW_OVERLAP );
@@ -3733,11 +3733,11 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
case M_SnapShot:
{
if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows
if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge
if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
+ pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border
if ( (nParams & PARAM_BOOL_1) && bBool1 )
pControl = pControl->GetWindow( WINDOW_OVERLAP );
@@ -3762,7 +3762,7 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
nNr4 = std::min((sal_uInt16)(pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y()),nNr4);
}
if( nParams & PARAM_UINT16_4 )
- { // Zuschneiden
+ { // Zuschneiden
Point aPt(-nNr1,-nNr2);
Size aSz(nNr3,nNr4);
VirtualDevice aVDev( *pControl );
@@ -3808,9 +3808,9 @@ sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
{
- switch( nMethodId ) // Diese k�nnen an jedem Window ausgef�hrt werden
+ switch( nMethodId ) // Diese k�nnen an jedem Window ausgef�hrt werden
{
- case M_Exists: // Oben schon Behandelt. Unterdr�ckt hier nur Fehler
+ case M_Exists: // Oben schon Behandelt. Unterdr�ckt hier nur Fehler
case M_NotExists:
case M_IsEnabled:
case M_IsVisible:
@@ -3831,12 +3831,12 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
break;
case M_TypeKeys:
{
- if( !(nParams & PARAM_UINT16_1) ) // Anzahl wiederholungen
+ if( !(nParams & PARAM_UINT16_1) ) // Anzahl wiederholungen
nNr1 = 1;
- if( !(nParams & PARAM_BOOL_1) ) // Follow Focus
- bBool1 = sal_False; // so bleibt das bisherige Verhalten
+ if( !(nParams & PARAM_BOOL_1) ) // Follow Focus
+ bBool1 = sal_False; // so bleibt das bisherige Verhalten
- if ( !bBool1 ) // Altes Verhalten
+ if ( !bBool1 ) // Altes Verhalten
pControl->GrabFocus();
else // If focus is not inside given control we grab it once.
{
@@ -3848,7 +3848,7 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
// maybe this can get removed since we are using GetPreferredKeyInputWindow()
if ( pControl->GetType() == WINDOW_COMBOBOX )
- { // Bei COMBOBOX an das Edit direkt liefern
+ { // Bei COMBOBOX an das Edit direkt liefern
Window *pTemp = NULL;
for ( sal_uInt16 i = 0 ; i < pControl->GetChildCount() && !pTemp ; i++ )
if ( pControl->GetChild( i )->GetType() == WINDOW_EDIT )
@@ -3867,12 +3867,12 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) )
pControl->GrabFocus();
}
- if ( bBool1 ) // Jedesmal das FocusWindow finden
+ if ( bBool1 ) // Jedesmal das FocusWindow finden
{
Window *pFocus = GetpApp()->GetFocusWindow();
if ( pFocus && pControl->IsWindowOrChild( pFocus, sal_True ) )
pDeliverHere = pFocus;
- else // sonst fallback auf das Basisfenster
+ else // sonst fallback auf das Basisfenster
pDeliverHere = pControl;
}
pDeliverHere = pDeliverHere->GetPreferredKeyInputWindow();
@@ -3914,7 +3914,7 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
aCh += 'a';
break;
case KEYGROUP_MISC:
- { // CR ESC TAB BACK
+ { // CR ESC TAB BACK
ByteString aPrintableMisc("\x0d\x1b\x09\x08 **+-*/.,<>=",16);
if ( nKeyCode-KEY_RETURN < aPrintableMisc.Len()
&& nKeyCode != KEY_INSERT && nKeyCode != KEY_DELETE )
@@ -3943,7 +3943,7 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_NUM + aCh-'0', 0));
else if ( aPrintableMisc.Search(aCh) != STRING_NOTFOUND )
aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_MISC + (sal_uInt16)aPrintableMisc.Search(aCh), 0));
- else // Sollte eigentlich nicht auftreten
+ else // Sollte eigentlich nicht auftreten
aEvent = KeyEvent(aCh, KeyCode());
}
ImplKeyInput( pDeliverHere, aEvent );
@@ -4164,7 +4164,7 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
break;
}
- pControl = pTemp; // So da� wir unten ohne Fehler durchkommen
+ pControl = pTemp; // So da� wir unten ohne Fehler durchkommen
SplitWindow *pSW = (SplitWindow*) pTemp;
switch( nMethodId )
@@ -4275,7 +4275,7 @@ sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
}
if( !(nParams & PARAM_UINT16_1) )
- nNr1 = CONST_ALIGN_RIGHT; // default is right Scrollbar(vertical)
+ nNr1 = CONST_ALIGN_RIGHT; // default is right Scrollbar(vertical)
if ( (nNr1 != CONST_ALIGN_RIGHT) && (nNr1 != CONST_ALIGN_BOTTOM) )
{
@@ -4383,7 +4383,7 @@ sal_Bool StatementControl::Execute()
case M_GetState:
break;
case M_IsEnabled:
- nMethodId = _M_IsEnabled; // Umlabeln, da die Behandlung essentiell anders ist!
+ nMethodId = _M_IsEnabled; // Umlabeln, da die Behandlung essentiell anders ist!
break;
default:
pControl = NULL;
@@ -4398,25 +4398,25 @@ sal_Bool StatementControl::Execute()
case M_NotExists:
Time aT;
sal_uInt16 aSeconds = aT.GetMin()*60+aT.GetSec();
- if ( !bBool2 ) // wurde im Konstruktor auf sal_False gesetzt
+ if ( !bBool2 ) // wurde im Konstruktor auf sal_False gesetzt
{
bBool2 = sal_True;
nNr2 = aSeconds;
if( !(nParams & PARAM_UINT16_1) )
- nNr1 = 0; // defaultm��ig sofort zur�ck
+ nNr1 = 0; // defaultm��ig sofort zur�ck
}
- if ( aSeconds < nNr2 ) // Falls die Stunde umgesprungen ist
+ if ( aSeconds < nNr2 ) // Falls die Stunde umgesprungen ist
aSeconds += 60*60;
if ( !pControl || !pControl->IsVisible() )
pControl = NULL;
if ( ((nMethodId == M_Exists) && pControl) ||
((nMethodId == M_NotExists) && !pControl) )
- { // Wenn Bedingung erf�llt
+ { // Wenn Bedingung erf�llt
pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True );
}
else
- if ( aSeconds <= nNr2 + nNr1 ) // Zeit ist noch nicht abgelaufen
+ if ( aSeconds <= nNr2 + nNr1 ) // Zeit ist noch nicht abgelaufen
return sal_False;
else
pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False );
@@ -4429,7 +4429,7 @@ sal_Bool StatementControl::Execute()
short nRT = 0;
- if( pControl ) // Das Fenster Existiert irgendwo, kann aber auch hidden sein!
+ if( pControl ) // Das Fenster Existiert irgendwo, kann aber auch hidden sein!
{
nRT = ImpGetRType( pControl );
#if OSL_DEBUG_LEVEL > 1
@@ -4479,7 +4479,7 @@ sal_Bool StatementControl::Execute()
// TODO: handle GetFocus for all Methods and Windows like this (remove part below)
// See for impact of changed focus for HandleVisibleControls() (taking Snapshots might be different, possible exclude those methods)
if (( (nRT == C_TreeListBox) && !bBool2 )
- && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
+ && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
&& nMethodId != M_MouseDown
&& nMethodId != M_MouseUp
&& nMethodId != M_MouseMove )
@@ -4520,7 +4520,7 @@ sal_Bool StatementControl::Execute()
|| nRT == C_TreeListBox
)
|| nMethodId == M_OpenContextMenu )
- && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
+ && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
&& nMethodId != M_MouseDown
&& nMethodId != M_MouseUp
&& nMethodId != M_MouseMove )
@@ -4564,7 +4564,7 @@ sal_Bool StatementControl::Execute()
pRet->GenReturn ( RET_Value, aUId, Id2Str( ((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetUniqueOrHelpId() ) );
break;
case M_SetPage :
- { // Wegen lokaler Variablen
+ { // Wegen lokaler Variablen
TabControl *pTControl = ((TabControl*)pControl);
sal_uInt16 nActive = pTControl->GetCurPageId();
sal_uInt16 i,anz;
@@ -4590,7 +4590,7 @@ sal_Bool StatementControl::Execute()
i++;
if ( i >= pTControl->GetPageCount() )
i = 0;
- if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) ) // 3 Mal aufrufen
+ if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) ) // 3 Mal aufrufen
break;
}
if ( !aID.equals( aWantedID ) )
@@ -4785,7 +4785,7 @@ sal_Bool StatementControl::Execute()
if ( bUnselectBeforeSelect )
pLB->SetNoSelection();
pLB->SelectEntryPos( nPos, bBool1 );
- if ( pLB->IsEntryPosSelected( nPos ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
+ if ( pLB->IsEntryPosSelected( nPos ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
}
}
@@ -4798,7 +4798,7 @@ sal_Bool StatementControl::Execute()
if ( bUnselectBeforeSelect )
pLB->SetNoSelection();
pLB->SelectEntryPos( nNr1-1, bBool1 );
- if ( pLB->IsEntryPosSelected( nNr1-1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
+ if ( pLB->IsEntryPosSelected( nNr1-1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), UniString::CreateFromInt32( nNr1 ) ) );
}
}
@@ -5039,10 +5039,10 @@ sal_Bool StatementControl::Execute()
case C_ToolBox:
{
ToolBox *pTB = ((ToolBox*)pControl);
- if ( !aUId.equals( pTB->GetUniqueOrHelpId() ) ) // So we found a Button on the ToolBox
+ if ( !aUId.equals( pTB->GetUniqueOrHelpId() ) ) // So we found a Button on the ToolBox
{
if ( (nParams == PARAM_NONE) || (nParams == PARAM_UINT16_1) )
- { // Wir f�lschen einen Parameter
+ { // Wir f�lschen einen Parameter
nParams |= PARAM_STR_1;
aString1 = Id2Str( aUId );
}
@@ -5113,7 +5113,7 @@ sal_Bool StatementControl::Execute()
case M_Click :
{
FIND_ITEM;
- if ( bItemFound ) // FIND_ITEM Erfolgreich
+ if ( bItemFound ) // FIND_ITEM Erfolgreich
{
Rectangle aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos));
if ( aRect.IsEmpty() )
@@ -5141,7 +5141,7 @@ sal_Bool StatementControl::Execute()
case M_TearOff :
{
FIND_ITEM;
- if ( bItemFound ) // FIND_ITEM Erfolgreich
+ if ( bItemFound ) // FIND_ITEM Erfolgreich
{
Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
AnimateMouse( pControl, aRect.Center() );
@@ -5150,13 +5150,13 @@ sal_Bool StatementControl::Execute()
Window *pWin = NULL;
// Wait for the window to open.
- StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
- { // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
+ StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack
+ { // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
Time aDelay;
while ( !pWin && ( (pWin = GetPopupFloatingWin()) == NULL ) && ( Time() - aDelay ).GetSec() < 15 )
SafeReschedule();
}
- StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
+ StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack
if ( pWin && pWin->GetType() == WINDOW_FLOATINGWINDOW )
{
@@ -5176,7 +5176,7 @@ sal_Bool StatementControl::Execute()
case M_OpenMenu :
{
FIND_ITEM;
- if ( bItemFound ) // FIND_ITEM Erfolgreich
+ if ( bItemFound ) // FIND_ITEM Erfolgreich
{
Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
AnimateMouse( pControl, aRect.Center() );
@@ -5195,7 +5195,7 @@ sal_Bool StatementControl::Execute()
case _M_IsEnabled:
{
FIND_ITEM;
- if ( bItemFound ) // FIND_ITEM Erfolgreich
+ if ( bItemFound ) // FIND_ITEM Erfolgreich
{
pRet->GenReturn ( RET_Value, aUId, pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) );
}
@@ -5204,7 +5204,7 @@ sal_Bool StatementControl::Execute()
case M_GetState :
{
FIND_ITEM;
- if ( bItemFound ) // FIND_ITEM Erfolgreich
+ if ( bItemFound ) // FIND_ITEM Erfolgreich
{
if ( ValueOK( aUId, CUniString("GetState"), nNr1, 4 ) )
switch (nNr1)
@@ -5257,7 +5257,7 @@ sal_Bool StatementControl::Execute()
case M_IsMax:
case M_Minimize:
case M_Maximize:
- case M_Help: // Alles was unten weiterbehandelt werden soll
+ case M_Help: // Alles was unten weiterbehandelt werden soll
goto DockingWin;
default:
ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ToolBox" ) );
@@ -5272,7 +5272,7 @@ sal_Bool StatementControl::Execute()
-#define GET_NTH_ENTRY_LBOX( First, Next, Anzahl) \
+#define GET_NTH_ENTRY_LBOX( First, Next, Anzahl) \
SvLBoxEntry *pThisEntry = ((SvTreeListBox*)pControl)->First(); \
{ \
int niTemp = Anzahl; \
@@ -5971,7 +5971,7 @@ sal_Bool StatementControl::Execute()
else
ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE, MethodString( nMethodId ) ) );
break;
- case M_Help: // Alles was unten weiterbehandelt werden soll
+ case M_Help: // Alles was unten weiterbehandelt werden soll
goto MoreDialog;
default:
@@ -6019,7 +6019,7 @@ sal_Bool StatementControl::Execute()
SET_WINP_CLOSING(pControl);
((FloatingWindow*)pControl)->Close();
break;
- case M_Help: // Alles was unten weiterbehandelt werden soll
+ case M_Help: // Alles was unten weiterbehandelt werden soll
case M_Move:
goto MoreDialog;
default:
@@ -6122,7 +6122,7 @@ sal_Bool StatementControl::Execute()
((WorkWindow*)pControl)->Maximize( sal_False );
((WorkWindow*)pControl)->Restore();
break;
- case M_Help: // Alles was unten weiterbehandelt werden soll
+ case M_Help: // Alles was unten weiterbehandelt werden soll
goto MoreDialog;
default:
ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "WorkWindow" ) );
@@ -6163,7 +6163,7 @@ sal_Bool StatementControl::Execute()
break;
}
if ( bDone )
- break; // break the case here else continue at C_ButtonDialog
+ break; // break the case here else continue at C_ButtonDialog
}
case C_ButtonDialog:
{
@@ -6326,7 +6326,7 @@ sal_Bool StatementControl::Execute()
#if OSL_DEBUG_LEVEL > 1
m_pDbgWin->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
#endif
- QueStatement( this ); // will que at the start of the list
+ QueStatement( this ); // will que at the start of the list
}
else
{
diff --git a/automation/source/server/statemnt.hxx b/automation/source/server/statemnt.hxx
index d7f63a39cd91..d278ae2a7f09 100644
--- a/automation/source/server/statemnt.hxx
+++ b/automation/source/server/statemnt.hxx
@@ -330,14 +330,20 @@ public:
StatementUnoSlot(SCmdStream *pIn);
};
+union munge
+{
+ comm_UINT32 nLNr1;
+ Window *pWindow;
+};
+
class StatementCommand : public StatementList // Befehl ausf�hren (wintree, resetaplication ...)
{
friend class ImplRemoteControl;
protected:
sal_uInt16 nMethodId;
sal_uInt16 nParams;
- comm_USHORT nNr1,nNr2,nNr3,nNr4;
- comm_ULONG nLNr1;
+ comm_UINT16 nNr1,nNr2,nNr3,nNr4;
+ munge nLNr1_and_Pointer;
String aString1,aString2;
sal_Bool bBool1,bBool2;
@@ -372,8 +378,8 @@ protected:
rtl::OString aUId;
sal_uInt16 nMethodId;
sal_uInt16 nParams;
- comm_USHORT nNr1,nNr2,nNr3,nNr4;
- comm_ULONG nLNr1;
+ comm_UINT16 nNr1,nNr2,nNr3,nNr4;
+ comm_UINT32 nLNr1;
String aString1,aString2;
sal_Bool bBool1,bBool2;
sal_Bool ControlOK( Window *pControl, const sal_Char* aBezeichnung );
@@ -396,8 +402,8 @@ class StatementFlow : public StatementList // Kommunikation mit Sequence
sal_uInt16 nArt;
sal_uInt16 nParams;
- comm_USHORT nSNr1;
- comm_ULONG nLNr1;
+ comm_UINT16 nSNr1;
+ comm_UINT32 nLNr1;
String aString1;
sal_Bool bBool1;
diff --git a/automation/source/server/svcommstream.cxx b/automation/source/server/svcommstream.cxx
index c689f9137a3f..c9537d1e79b3 100644
--- a/automation/source/server/svcommstream.cxx
+++ b/automation/source/server/svcommstream.cxx
@@ -34,18 +34,18 @@
SvCommStream::SvCommStream( SvStream* pIO ) { pStream = pIO; }
SvCommStream::~SvCommStream() {}
-ICommStream& SvCommStream::operator>>( comm_USHORT& rUShort ) { *pStream >> rUShort; return *this; }
-ICommStream& SvCommStream::operator>>( comm_ULONG& rULong ) { *pStream >> rULong; return *this; }
+ICommStream& SvCommStream::operator>>( comm_UINT16& rUShort ) { *pStream >> rUShort; return *this; }
+ICommStream& SvCommStream::operator>>( comm_UINT32& rULong ) { *pStream >> rULong; return *this; }
ICommStream& SvCommStream::operator>>( comm_BOOL& rChar ) { *pStream >> rChar; return *this; }
-ICommStream& SvCommStream::operator<<( comm_USHORT nUShort ) { *pStream << nUShort; return *this; }
-ICommStream& SvCommStream::operator<<( comm_ULONG nULong ) { *pStream << nULong; return *this; }
+ICommStream& SvCommStream::operator<<( comm_UINT16 nUShort ) { *pStream << nUShort; return *this; }
+ICommStream& SvCommStream::operator<<( comm_UINT32 nULong ) { *pStream << nULong; return *this; }
ICommStream& SvCommStream::operator<<( comm_BOOL nChar ) { *pStream << nChar; return *this; }
-comm_ULONG SvCommStream::Read( void* pData, comm_ULONG nSize ) { return pStream->Read( pData, nSize ); }
-comm_ULONG SvCommStream::Write( const void* pData, comm_ULONG nSize ) { return pStream->Write( pData, nSize ); }
+comm_UINT32 SvCommStream::Read( void* pData, comm_UINT32 nSize ) { return pStream->Read( pData, nSize ); }
+comm_UINT32 SvCommStream::Write( const void* pData, comm_UINT32 nSize ) { return pStream->Write( pData, nSize ); }
comm_BOOL SvCommStream::IsEof() const { return pStream->IsEof(); }
-comm_ULONG SvCommStream::SeekRel( long nPos ) { return pStream->SeekRel( nPos ); }
+comm_UINT32 SvCommStream::SeekRel( long nPos ) { return pStream->SeekRel( nPos ); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/communiio.hxx b/automation/source/simplecm/communiio.hxx
index 65466a26b271..97b5aa414231 100644
--- a/automation/source/simplecm/communiio.hxx
+++ b/automation/source/simplecm/communiio.hxx
@@ -44,25 +44,25 @@
class ITransmiter
{
protected:
- comm_ULONG nLastSent;
+ comm_UINT32 nLastSent;
public:
ITransmiter() :nLastSent( 0 ){}
virtual ~ITransmiter() {}
- virtual comm_USHORT TransferBytes( const void* pBuffer, comm_UINT32 nLen ) = 0;
+ virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen ) = 0;
- comm_ULONG GetLastSent() const { return nLastSent; }
+ comm_UINT32 GetLastSent() const { return nLastSent; }
};
class IReceiver
{
protected:
- comm_ULONG nLastReceived;
+ comm_UINT32 nLastReceived;
public:
IReceiver() :nLastReceived( 0 ){}
virtual ~IReceiver() {;}
- virtual comm_USHORT ReceiveBytes( void* pBuffer, comm_UINT32 nLen ) = 0;
+ virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen ) = 0;
- comm_ULONG GetLastReceived() const { return nLastReceived; }
+ comm_UINT32 GetLastReceived() const { return nLastReceived; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/packethandler.cxx b/automation/source/simplecm/packethandler.cxx
index 4cd2ad7d3106..aac58043b326 100644
--- a/automation/source/simplecm/packethandler.cxx
+++ b/automation/source/simplecm/packethandler.cxx
@@ -111,8 +111,8 @@ comm_BOOL PacketHandler::ReceiveData( void* &pData, comm_UINT32 &nLen )
if ( bMultiChannel || bForceMultiChannelThisPacket )
{
- comm_ULONG nReadSoFar = 0;
- comm_ULONG nHeaderReadSoFar = 0;
+ comm_UINT32 nReadSoFar = 0;
+ comm_UINT32 nHeaderReadSoFar = 0;
// Pr�fbyte f�r L�ngenangabe
unsigned char nLenCheck = 0;
diff --git a/automation/source/simplecm/tcpio.cxx b/automation/source/simplecm/tcpio.cxx
index e71afb399b84..9c0bc2185704 100644
--- a/automation/source/simplecm/tcpio.cxx
+++ b/automation/source/simplecm/tcpio.cxx
@@ -32,7 +32,7 @@
#include "tcpio.hxx"
/// implement ITransmiter
-comm_USHORT TCPIO::TransferBytes( const void* pBuffer, comm_UINT32 nLen )
+comm_UINT16 TCPIO::TransferBytes( const void* pBuffer, comm_UINT32 nLen )
{
osl::MutexGuard aGuard( aMSocketWriteAccess );
if ( !pStreamSocket )
@@ -48,7 +48,7 @@ comm_USHORT TCPIO::TransferBytes( const void* pBuffer, comm_UINT32 nLen )
/// implement IReceiver
-comm_USHORT TCPIO::ReceiveBytes( void* pBuffer, comm_UINT32 nLen )
+comm_UINT16 TCPIO::ReceiveBytes( void* pBuffer, comm_UINT32 nLen )
{
osl::MutexGuard aGuard( aMSocketReadAccess );
if ( !pStreamSocket )
diff --git a/automation/source/simplecm/tcpio.hxx b/automation/source/simplecm/tcpio.hxx
index 07c3edba7a5b..3240a8156d60 100644
--- a/automation/source/simplecm/tcpio.hxx
+++ b/automation/source/simplecm/tcpio.hxx
@@ -49,10 +49,10 @@ public:
/// implement ITransmiter
- virtual comm_USHORT TransferBytes( const void* pBuffer, comm_UINT32 nLen );
+ virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen );
/// implement IReceiver
- virtual comm_USHORT ReceiveBytes( void* pBuffer, comm_UINT32 nLen );
+ virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen );
// helper
void SetStreamSocket( osl::StreamSocket* pSocket );
diff --git a/automation/source/testtool/cmdstrm.cxx b/automation/source/testtool/cmdstrm.cxx
index 8153b6505373..0e7adc9989ef 100644
--- a/automation/source/testtool/cmdstrm.cxx
+++ b/automation/source/testtool/cmdstrm.cxx
@@ -172,7 +172,7 @@ void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
{
sal_uInt16 nParams = PARAM_NONE;
sal_uInt16 nNr1=0,nNr2=0,nNr3=0,nNr4=0;
- comm_ULONG nLNr1=0;
+ comm_UINT32 nLNr1=0;
String aString1,aString2;
sal_Bool bBool1=sal_False,bBool2=sal_False;
@@ -193,24 +193,24 @@ void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
case SbxINT:
case SbxUINT:
case SbxSINGLE:
- if ( (nParams & PARAM_USHORT_1) == 0 )
+ if ( (nParams & PARAM_UINT16_1) == 0 )
{
- nParams |= PARAM_USHORT_1;
+ nParams |= PARAM_UINT16_1;
nNr1 = rPar->Get( i )->GetUShort();
}
- else if ( (nParams & PARAM_USHORT_2) == 0 )
+ else if ( (nParams & PARAM_UINT16_2) == 0 )
{
- nParams |= PARAM_USHORT_2;
+ nParams |= PARAM_UINT16_2;
nNr2 = rPar->Get( i )->GetUShort();
}
- else if ( (nParams & PARAM_USHORT_3) == 0 )
+ else if ( (nParams & PARAM_UINT16_3) == 0 )
{
- nParams |= PARAM_USHORT_3;
+ nParams |= PARAM_UINT16_3;
nNr3 = rPar->Get( i )->GetUShort();
}
- else if ( (nParams & PARAM_USHORT_4) == 0 )
+ else if ( (nParams & PARAM_UINT16_4) == 0 )
{
- nParams |= PARAM_USHORT_4;
+ nParams |= PARAM_UINT16_4;
nNr4 = rPar->Get( i )->GetUShort();
}
else
@@ -242,11 +242,11 @@ void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
}
else if ( pMember->GetType() == SbxULONG )
{
- if ( nParams & PARAM_ULONG_1 )
+ if ( nParams & PARAM_UINT32_1 )
SbxBase::SetError( SbxERR_WRONG_ARGS );
else
{
- nParams |= PARAM_ULONG_1;
+ nParams |= PARAM_UINT32_1;
nLNr1 = pMember->GetULong();
}
}
@@ -297,11 +297,11 @@ void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
}
}
Write (nParams);
- if( nParams & PARAM_USHORT_1 ) Write( nNr1 );
- if( nParams & PARAM_USHORT_2 ) Write( nNr2 );
- if( nParams & PARAM_USHORT_3 ) Write( nNr3 );
- if( nParams & PARAM_USHORT_4 ) Write( nNr4 );
- if( nParams & PARAM_ULONG_1 ) Write( nLNr1 );
+ if( nParams & PARAM_UINT16_1 ) Write( nNr1 );
+ if( nParams & PARAM_UINT16_2 ) Write( nNr2 );
+ if( nParams & PARAM_UINT16_3 ) Write( nNr3 );
+ if( nParams & PARAM_UINT16_4 ) Write( nNr4 );
+ if( nParams & PARAM_UINT32_1 ) Write( nLNr1 );
if( nParams & PARAM_STR_1 ) Write( aString1, IsKeyString );
if( nParams & PARAM_STR_2 ) Write( aString2, IsKeyString );
if( nParams & PARAM_BOOL_1 ) Write( bBool1 );
@@ -344,7 +344,7 @@ void CmdStream::GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar )
case SbxUINT:
case SbxSINGLE:
if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinUSHORT );
+ Write( (sal_uInt16)BinUINT16 );
Write(rPar->Get( 2*n )->GetUShort());
break;
case SbxLONG:
@@ -353,7 +353,7 @@ void CmdStream::GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar )
case SbxSALUINT64:
case SbxDOUBLE:
if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinULONG );
+ Write( (sal_uInt16)BinUINT32 );
Write(rPar->Get( 2*n )->GetULong());
break;
case SbxSTRING:
@@ -399,7 +399,7 @@ void CmdStream::GenCmdUNOSlot( const String &aURL )
Write( aURL ); // Die UNO URL eben
}
-void CmdStream::GenCmdControl( comm_ULONG nUId, sal_uInt16 nMethodId, SbxArray* rPar )
+void CmdStream::GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar )
{
Write(sal_uInt16(SIControl));
Write(nUId);
@@ -426,7 +426,7 @@ void CmdStream::GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 )
{
Write(sal_uInt16(SIFlow));
Write(nArt);
- Write(sal_uInt16(PARAM_ULONG_1)); // Typ der folgenden Parameter
+ Write(sal_uInt16(PARAM_UINT32_1)); // Typ der folgenden Parameter
Write(nNr1);
}
@@ -443,7 +443,7 @@ SvMemoryStream* CmdStream::GetStream()
return pSammel;
}
-void CmdStream::Reset( comm_ULONG nSequence )
+void CmdStream::Reset( comm_UINT32 nSequence )
{
delete pCommStream;
delete pSammel;
diff --git a/automation/source/testtool/cmdstrm.hxx b/automation/source/testtool/cmdstrm.hxx
index a3997fa480f2..5dac92d4c03f 100644
--- a/automation/source/testtool/cmdstrm.hxx
+++ b/automation/source/testtool/cmdstrm.hxx
@@ -46,14 +46,14 @@ public:
void GenCmdUNOSlot( const String &aURL );
- void GenCmdControl( comm_ULONG nUId, sal_uInt16 nMethodId, SbxArray* rPar );
+ void GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar );
void GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar );
void GenCmdFlow( sal_uInt16 nArt );
void GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 );
- void Reset(comm_ULONG nSequence);
+ void Reset(comm_UINT32 nSequence);
SvMemoryStream* GetStream();
@@ -64,9 +64,9 @@ private:
String WandleKeyEventString( String aKeys ); // Nutzt pKeyCodes. <RETURN> <SHIFT LEFT LEFT>
using CmdBaseStream::Write;
- void Write( comm_USHORT nNr ){CmdBaseStream::Write( nNr );}
- void Write( comm_ULONG nNr ){CmdBaseStream::Write( nNr );}
- void Write( const comm_UniChar* aString, comm_USHORT nLenInChars ){CmdBaseStream::Write( aString, nLenInChars );}
+ void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );}
+ void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );}
+ void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars ){CmdBaseStream::Write( aString, nLenInChars );}
void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );}
// new
void Write( String aString, sal_Bool IsKeyString = sal_False );
diff --git a/automation/source/testtool/cretstrm.hxx b/automation/source/testtool/cretstrm.hxx
index 0315c53828b7..9f1385dae540 100644
--- a/automation/source/testtool/cretstrm.hxx
+++ b/automation/source/testtool/cretstrm.hxx
@@ -43,8 +43,8 @@ public:
~CRetStream();
using CmdBaseStream::Read;
- void Read ( comm_USHORT &nNr ){CmdBaseStream::Read ( nNr );}
- void Read ( comm_ULONG &nNr ){CmdBaseStream::Read ( nNr );}
+ void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );}
+ void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );}
virtual void Read ( rtl::OString* &pId ){CmdBaseStream::Read ( pId );}
void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );}
void Read( String &aString );
diff --git a/automation/source/testtool/makefile.mk b/automation/source/testtool/makefile.mk
index ee885e1429f1..d23069e7821d 100644
--- a/automation/source/testtool/makefile.mk
+++ b/automation/source/testtool/makefile.mk
@@ -93,7 +93,7 @@ $(MISC)$/xfilter.pl : filter.pl
.IF "$(GUI)"=="UNX"
INIFILESUFFIX=rc
BRANDPATH=none
-.ELIF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
+.ELIF "$(GUI)"=="WNT"
INIFILESUFFIX=.ini
BRANDPATH=..
.END
diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx
index 75d0a8338752..1f2be28613c3 100644
--- a/automation/source/testtool/objtest.cxx
+++ b/automation/source/testtool/objtest.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -96,7 +96,7 @@ static CommunicationFactory aComManFac;
#define cMyDelim ' '
#define P_FEHLERLISTE pFehlerListe
-#define KEEP_SEQUENCES 100 // Keep Names of last 100 Calls
+#define KEEP_SEQUENCES 100 // Keep Names of last 100 Calls
ControlDefLoad const Controls::arClasses [] =
@@ -106,7 +106,7 @@ CNames *Controls::pClasses = NULL;
ControlDefLoad const TestToolObj::arR_Cmds [] =
#include "r_cmds.hxx"
CNames *TestToolObj::pRCommands = NULL;
-CErrors *TestToolObj::pFehlerListe = NULL; // Hier werden die Fehler des Testtools gespeichert
+CErrors *TestToolObj::pFehlerListe = NULL; // Hier werden die Fehler des Testtools gespeichert
DBG_NAME( ControlItem )
@@ -348,17 +348,17 @@ TestToolObj::TestToolObj( String aName, MyBasic* pBas ) // Aufruf
pCommunicationManager->SetDataReceivedHdl( LINK( this, TestToolObj, ReturnResultsLink ));
}
-void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die durch den ConfigDialog ge�ndert werden k�nnen
+void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die durch den ConfigDialog ge�ndert werden k�nnen
{
-#define GETSET(aVar, KeyName, Dafault) \
- { \
- ByteString __##aVar##__; \
- __##aVar##__ = aConf.ReadKey(KeyName); \
- if ( !__##aVar##__.Len() ) \
- { \
- __##aVar##__ = Dafault; \
- aConf.WriteKey(KeyName, __##aVar##__); \
- } \
+#define GETSET(aVar, KeyName, Dafault) \
+ { \
+ ByteString __##aVar##__; \
+ __##aVar##__ = aConf.ReadKey(KeyName); \
+ if ( !__##aVar##__.Len() ) \
+ { \
+ __##aVar##__ = Dafault; \
+ aConf.WriteKey(KeyName, __##aVar##__); \
+ } \
aVar = UniString( __##aVar##__, RTL_TEXTENCODING_UTF8 );\
}
@@ -503,7 +503,7 @@ void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die durch den
void TestToolObj::InitTestToolObj()
{
- pImpl->nNumBorders = 0; // F�r Profiling mit k�stchen
+ pImpl->nNumBorders = 0; // F�r Profiling mit k�stchen
pImpl->nMinRemoteCommandDelay = 0;
pImpl->nMaxRemoteCommandDelay = 0;
@@ -573,11 +573,11 @@ void TestToolObj::InitTestToolObj()
MAKE_TT_KEYWORD( "MaybeAddErr", SbxCLASS_METHOD, SbxNULL, ID_MaybeAddErr );
MAKE_TT_KEYWORD( "ClearError", SbxCLASS_METHOD, SbxNULL, ID_ClearError );
MAKE_TT_KEYWORD( "SaveIDs", SbxCLASS_METHOD, SbxBOOL, ID_SaveIDs );
- MAKE_TT_KEYWORD( "AutoExecute", SbxCLASS_PROPERTY, SbxBOOL, ID_AutoExecute ); // Achtung! PROPERTY Also eine Variable
+ MAKE_TT_KEYWORD( "AutoExecute", SbxCLASS_PROPERTY, SbxBOOL, ID_AutoExecute ); // Achtung! PROPERTY Also eine Variable
MAKE_TT_KEYWORD( "Execute", SbxCLASS_METHOD, SbxNULL, ID_Execute );
MAKE_TT_KEYWORD( "StopOnSyntaxError", SbxCLASS_PROPERTY, SbxBOOL, ID_StopOnSyntaxError );
-/* Dialog Handler werden gebraucht, wenn im internen Testtool ein Dialog
+/* Dialog Handler werden gebraucht, wenn im internen Testtool ein Dialog
hochgerissen wird. Nach versenden der Remote-Kommandos wird IdleHandler aktiviert.
Er testet, ob das Reschedule zum WaitForAnswer zur�ckkehrt. Bleibt das aus, so
wird erst der RemoteHandler zur�ckgesetzt und dann die Handler-Sub im Basic
@@ -927,7 +927,7 @@ void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, s
else
#endif
if ( !bUnoName && !bMozillaName )
- { // Bestimmen der ID aus der Hid.Lst
+ { // Bestimmen der ID aus der Hid.Lst
ControlDef WhatName(aLongname,rtl::OString());
if (pUIds->Seek_Entry(&WhatName,&nElement))
aUId = pUIds->GetObject(nElement)->pData->aUId;
@@ -1232,7 +1232,7 @@ void TestToolObj::SendViaSocket()
if ( !pCommunicationManager->IsCommunicationRunning() )
{
- // first try to run basic sub "startTheOffice" see i86540
+ // first try to run basic sub "startTheOffice" see i86540
SbxVariable* pMeth = pImpl->pMyBasic->Find( CUniString( "startTheOffice" ), SbxCLASS_DONTCARE);
if( !pImpl->bIsStart && pMeth && pMeth->ISA(SbxMethod) )
{
@@ -1278,7 +1278,7 @@ void TestToolObj::EndBlock()
{
if (IsBlock)
{
- pImpl->LocalStarttime = Time::GetSystemTicks(); // Setzen der Anfangszeit f�r Performancemessung
+ pImpl->LocalStarttime = Time::GetSystemTicks(); // Setzen der Anfangszeit f�r Performancemessung
In->GenCmdFlow (F_EndCommandBlock);
@@ -1422,7 +1422,7 @@ sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pC
{
pNewDef->Sons(new CNames());
- pNewDef2 = new ControlDef(aName,aUId); // Noch einen machen
+ pNewDef2 = new ControlDef(aName,aUId); // Noch einen machen
if (!pNewDef->SonInsert(pNewDef2)) // Dialog in eigenen Namespace eintragen
{
delete pNewDef2;
@@ -2146,9 +2146,9 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
// Hier wird der Remote UNO Kram gestartet
// Eintrag in die Konfiguration unter
// org.openoffice.Office.Common/Start/Connection
- // socket,host=0,port=12345;iiop;XBla
+ // socket,host=0,port=12345;iiop;XBla
// oder
- // socket,host=0,port=12345;urp;;XBla
+ // socket,host=0,port=12345;urp;;XBla
String aString;
aString.AppendAscii( "socket,host=" );
@@ -2242,7 +2242,7 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
{
switch (rPar->Get( 1 )->GetType())
{
- case SbxLONG: // alles immer als Short �bertragen
+ case SbxLONG: // alles immer als Short �bertragen
case SbxULONG:
case SbxSALINT64:
case SbxSALUINT64:
@@ -2583,7 +2583,7 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
if ( pImpl->nErrorCount )
{
ADD_WARNING_LOG( GEN_RES_STR1( S_ERRORS_DETECTED, String::CreateFromInt32( pImpl->nErrorCount ) ) );
- pImpl->nWarningCount--; // Anpassen, da diese Warnung nicht in die Statistik soll
+ pImpl->nWarningCount--; // Anpassen, da diese Warnung nicht in die Statistik soll
}
else
ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_ERRORS_DETECTED ) );
@@ -2726,7 +2726,7 @@ SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
delete pWhatName;
pWhatName = new ControlDef( aStr.Copy( 0, aStr.Len()-3 ), rtl::OString() );
if ( m_pSIds->Seek_Entry( pWhatName, &nElement ) )
- { // Nach slots suchen
+ { // Nach slots suchen
SbxVariable *pReturn = new SbxVariable;
delete pWhatName;
pWhatName = ( (ControlDef*)m_pSIds->GetObject( nElement ) );
@@ -2791,13 +2791,13 @@ void TestToolObj::CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrL
}
-#define CATCH_LABEL CUniString( "ctch" )
-#define CATCHRES_LABEL CUniString( "ctchres" )
-#define ENDCATCH_LABEL CUniString( "endctch" )
+#define CATCH_LABEL CUniString( "ctch" )
+#define CATCHRES_LABEL CUniString( "ctchres" )
+#define ENDCATCH_LABEL CUniString( "endctch" )
sal_Bool IsAlphaChar( sal_Unicode cChar )
{
- return ( cChar >= 'a' && cChar <= 'z' ) ||
+ return ( cChar >= 'a' && cChar <= 'z' ) ||
( cChar >= 'A' && cChar <= 'Z' );
}
@@ -2867,7 +2867,7 @@ xub_StrLen TestToolObj::PreCompilePart( String &aSource, xub_StrLen nStart, xub_
xub_StrLen nTry2 = 0;
while ( !WasPrecompilerError() && (nTry2 = ImplSearch( aSource, nStart, nEnd, CUniString("try"), nTry+1 )) != STRING_NOTFOUND )
- { // Wir rekursieren erstmal mit dem 2. Try
+ { // Wir rekursieren erstmal mit dem 2. Try
if ( nTry2 < nCatch )
nEnd += PreCompilePart( aSource, nTry2, nEndcatch+8, aCatchLabel, nLabelCount ) - nEndcatch-8;
else
@@ -2890,7 +2890,7 @@ xub_StrLen TestToolObj::PreCompilePart( String &aSource, xub_StrLen nStart, xub_
}
String aReplacement;
- int nTotalLength = -3 -5 -8; // try, catch und endcatch fallen raus
+ int nTotalLength = -3 -5 -8; // try, catch und endcatch fallen raus
aReplacement.AppendAscii( "on error goto " );
aReplacement += aCatchLabel;
@@ -3236,9 +3236,9 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
else
pImpl->pNextReturn->PutULong( nLNr1 );
}
- if( nParams & PARAM_UINT16_1 ) pImpl->pNextReturn->PutUShort( nNr1 );
- if( nParams & PARAM_STR_1 ) pImpl->pNextReturn->PutString( aString1 );
- if( nParams & PARAM_BOOL_1 ) pImpl->pNextReturn->PutBool( bBool1 );
+ if( nParams & PARAM_UINT16_1 ) pImpl->pNextReturn->PutUShort( nNr1 );
+ if( nParams & PARAM_STR_1 ) pImpl->pNextReturn->PutString( aString1 );
+ if( nParams & PARAM_BOOL_1 ) pImpl->pNextReturn->PutBool( bBool1 );
if( nParams & PARAM_SBXVALUE_1 ) // FIXME: allow generic datatype
{
SbxValues aValues( SbxDATE );
@@ -3379,7 +3379,7 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
{
switch ( nUId )
{
- case S_ProfileReset: // nLNr1 = Anzahl Borders
+ case S_ProfileReset: // nLNr1 = Anzahl Borders
{
pImpl->nNumBorders = (sal_uInt16)nLNr1; // Borders are 0 to 4
sal_uInt16 i;
@@ -3394,15 +3394,15 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
}
break;
}
- case S_ProfileBorder1: // nLNr1 = Border1 in ms
- case S_ProfileBorder2: // nLNr1 = Border2 in ms
- case S_ProfileBorder3: // nLNr1 = Border3 in ms
- case S_ProfileBorder4: // nLNr1 = Border4 in ms
+ case S_ProfileBorder1: // nLNr1 = Border1 in ms
+ case S_ProfileBorder2: // nLNr1 = Border2 in ms
+ case S_ProfileBorder3: // nLNr1 = Border3 in ms
+ case S_ProfileBorder4: // nLNr1 = Border4 in ms
{
pImpl->naValBorders[ nUId - S_ProfileBorder1 ] = nLNr1;
break;
}
- case S_ProfileTime: // nLNr1 = remote Zeit des Befehls
+ case S_ProfileTime: // nLNr1 = remote Zeit des Befehls
{
sal_uInt16 i;
for ( i=0 ; i<pImpl->nNumBorders &&
@@ -3430,9 +3430,9 @@ sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
break;
}
- case S_ProfileDump: // Gibt die daten aus.
+ case S_ProfileDump: // Gibt die daten aus.
{
- if ( pImpl->nNumBorders == 0 ) // Also keine alte R�ckmeldung vom Office
+ if ( pImpl->nNumBorders == 0 ) // Also keine alte R�ckmeldung vom Office
break;
DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf"));
SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE );
@@ -3983,11 +3983,11 @@ static ControlDefLoad const arRes_Type [] =
SbTextType TestToolObj::GetSymbolType( const String &rSymbol, sal_Bool bWasControl )
{
- if ( rSymbol.CompareToAscii( "try" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "catch" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "endcatch" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "testcase" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "endcase" ) == COMPARE_EQUAL )
+ if ( rSymbol.CompareToAscii( "try" ) == COMPARE_EQUAL
+ || rSymbol.CompareToAscii( "catch" ) == COMPARE_EQUAL
+ || rSymbol.CompareToAscii( "endcatch" ) == COMPARE_EQUAL
+ || rSymbol.CompareToAscii( "testcase" ) == COMPARE_EQUAL
+ || rSymbol.CompareToAscii( "endcase" ) == COMPARE_EQUAL )
{
return TT_KEYWORD;
}
@@ -4037,7 +4037,7 @@ SbTextType TestToolObj::GetSymbolType( const String &rSymbol, sal_Bool bWasContr
return TT_LOCALCMD;
}
- return SB_SYMBOL; // Alles was hier landet ist vom Typ SB_SYMBOL und bleibt es auch
+ return SB_SYMBOL; // Alles was hier landet ist vom Typ SB_SYMBOL und bleibt es auch
}
@@ -4109,9 +4109,9 @@ SbxVariable* Controls::Find( const String& aStr, SbxClassType aType)
String TTFormat::ms2s( sal_uLong nMilliSeconds )
{
- if ( nMilliSeconds < 100000 ) // 100 Sekunden
+ if ( nMilliSeconds < 100000 ) // 100 Sekunden
return String::CreateFromInt64( nMilliSeconds );
- if ( nMilliSeconds < 100000*60 ) // 100 Minuten
+ if ( nMilliSeconds < 100000*60 ) // 100 Minuten
return String::CreateFromInt32( nMilliSeconds / 1000 ).AppendAscii("Sec");
return String::CreateFromInt32( nMilliSeconds / 1000 / 60 ).AppendAscii("Min");
}
diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx
index f7fc729ff76f..32b97075f77c 100644
--- a/automation/source/testtool/tcommuni.cxx
+++ b/automation/source/testtool/tcommuni.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -84,7 +84,7 @@ sal_Bool CommunicationManagerClientViaSocketTT::RetryConnect()
if ( bSucc )
{
- aFirstRetryCall = Time() + Time( 0, 1 ); // Max eine Minute Zeit
+ aFirstRetryCall = Time() + Time( 0, 1 ); // Max eine Minute Zeit
for ( int i = 10 ; i-- ; )
GetpApp()->Reschedule();
}
@@ -159,7 +159,7 @@ sal_uLong GetTTPortConfig()
#endif
)
{
- aPortToTalk = Application::GetCommandLineParam( i ).Copy(6);
+ aPortToTalk = Application::GetCommandLineParam( i ).Copy(6);
return (sal_uLong)aPortToTalk.ToInt64();
}
}
diff --git a/automation/source/testtool/testtool.ini b/automation/source/testtool/testtool.ini
index ff2e43f5c0f6..7b77654eed58 100644
--- a/automation/source/testtool/testtool.ini
+++ b/automation/source/testtool/testtool.ini
@@ -9,7 +9,6 @@ CurrentProfile=_profile_Default
[OOoProgramDir]
Type=Path
-Current=.
[Crashreporter]
UseProxy=false
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index 17c8fc8144a1..f3a1e641b8bb 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -53,7 +53,6 @@
#define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 )
#define RID_IMGBTN_REMOVEWATCH ( RID_BASICIDE_START + 8 )
-#define RID_IMGBTN_GOTOCALL ( RID_BASICIDE_START + 9 )
#define RID_IMG_INSTALLATION ( RID_BASICIDE_START + 20 )
#define RID_IMG_DOCUMENT ( RID_BASICIDE_START + 22 )
#define RID_IMG_MODLIB ( RID_BASICIDE_START + 24 )
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi
index bc9232c08bfd..f40e239b01bf 100644
--- a/basctl/sdi/baside.sdi
+++ b/basctl/sdi/baside.sdi
@@ -57,6 +57,11 @@ shell BasicIDEShell
StateMethod = GetState;
]
+ SID_SELECTALL
+ [
+ ExecMethod = ExecuteCurrent;
+ ]
+
SID_CUT
[
ExecMethod = ExecuteCurrent;
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 8ae614a24787..294bda74f8fe 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -995,6 +995,15 @@ void ModulWindow::ExecuteCommand( SfxRequest& rReq )
sal_uInt16 nSlot = rReq.GetSlot();
switch ( nSlot )
{
+ case SID_DELETE:
+ {
+ KeyEvent aFakeDelete( 0, KEY_DELETE );
+ GetEditView()->KeyInput( aFakeDelete );
+ break;
+ }
+ case SID_SELECTALL:
+ GetEditView()->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ break;
case SID_BASICRUN:
{
BasicRun();
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index c0a045e6382d..6af6c060411a 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -265,7 +265,6 @@ class StackWindow : public BasicDockingWindow
{
private:
SvTreeListBox aTreeListBox;
- ImageButton aGotoCallButton;
String aStackStr;
protected:
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index ba25596555b8..e6cf7b1b0c0e 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -412,13 +412,13 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
long nLinSz = pModulWindow->GetHScrollBar()->GetLineSize(); (void)nLinSz;
long nThumb = pModulWindow->GetHScrollBar()->GetThumbPos(); (void)nThumb;
#endif
- sal_Bool bDone = sal_False;
sal_Bool bWasModified = pEditEngine->IsModified();
- if ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() )
+ // see if there is an accelerator to be processed first
+ sal_Bool bDone = SfxViewShell::Current()->KeyInput( rKEvt );
+
+ if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) )
{
- if ( ( rKEvt.GetKeyCode().GetCode() == KEY_A) && rKEvt.GetKeyCode().IsMod1() )
- pEditView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
- else if ( ( rKEvt.GetKeyCode().GetCode() == KEY_Y ) && rKEvt.GetKeyCode().IsMod1() )
+ if ( ( rKEvt.GetKeyCode().GetCode() == KEY_Y ) && rKEvt.GetKeyCode().IsMod1() )
bDone = sal_True; // CTRL-Y schlucken, damit kein Vorlagenkatalog
else
{
@@ -443,7 +443,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
}
if ( !bDone )
{
- if ( !SfxViewShell::Current()->KeyInput( rKEvt ) )
Window::KeyInput( rKEvt );
}
else
@@ -1498,7 +1497,6 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
StackWindow::StackWindow( Window* pParent ) :
BasicDockingWindow( pParent ),
aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
- aGotoCallButton( this, IDEResId( RID_IMGBTN_GOTOCALL ) ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
@@ -1513,14 +1511,6 @@ StackWindow::StackWindow( Window* pParent ) :
SetHelpId( HID_BASICIDE_STACKWINDOW );
- aGotoCallButton.SetClickHdl( LINK( this, StackWindow, ButtonHdl ) );
- aGotoCallButton.SetPosPixel( Point( DWBORDER, 2 ) );
- Size aSz( aGotoCallButton.GetModeImage().GetSizePixel() );
- aSz.Width() += 6;
- aSz.Height() += 6;
- aGotoCallButton.SetSizePixel( aSz );
- aGotoCallButton.Hide();
-
// make stack window keyboard accessible
GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
}
@@ -1559,18 +1549,8 @@ void StackWindow::Resize()
-IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, pButton )
+IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, /*pButton*/ )
{
- if ( pButton == &aGotoCallButton )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_GOTOCALL );
- }
- }
return 0;
}
IMPL_LINK_INLINE_END( StackWindow, ButtonHdl, ImageButton *, pButton )
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index 32220753dd32..368bad4244de 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -324,11 +324,6 @@ ImageButton RID_IMGBTN_REMOVEWATCH
};
QuickHelpText [ en-US ] = "Remove Watch" ;
};
-ImageButton RID_IMGBTN_GOTOCALL
-{
- HelpId = HID_BASICIDE_GOTOALL ;
- SmallStyle = TRUE ;
-};
String RID_STR_REMOVEWATCH
{
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
index 55d03bcf16b0..ea882751e178 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -97,9 +97,8 @@ void BasicIDEDLL::Init()
SfxObjectFactory* pFact = &BasicDocShell::Factory();
(void)pFact;
- ByteString aResMgrName( "basctl" );
ResMgr* pMgr = ResMgr::CreateResMgr(
- aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ "basctl", Application::GetSettings().GetUILocale() );
BASIC_MOD() = new BasicIDEModule( pMgr, &BasicDocShell::Factory() );
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index ec8175e173d3..e12c469b8acf 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -33,8 +33,6 @@
#include <ide_pch.hxx>
-#include <svtools/filedlg.hxx>
-
#include <sot/storinfo.hxx>
#include <moduldlg.hrc>
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index be5fdc556c59..110bdb89f2c6 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -1268,15 +1268,6 @@ void DlgEditor::Print( Printer* pPrinter, const String& rTitle ) // not worki
lcl_PrintHeader( pPrinter, rTitle );
Bitmap aDlg;
-#ifdef OS2
- Bitmap* pDlg = new Bitmap;
- SvMemoryStream* pStrm = new SvMemoryStream;
- *pStrm << *pDlg;
- delete pDlg;
- pStrm->Seek(0);
- *pStrm >> aDlg;
- delete pStrm;
-#endif
Size aBmpSz( pPrinter->PixelToLogic( aDlg.GetSizePixel() ) );
double nPaperSzWidth = aPaperSz.Width();
double nPaperSzHeight = aPaperSz.Height();
diff --git a/bean/com/sun/star/comp/beans/HasConnectionException.java b/bean/com/sun/star/comp/beans/HasConnectionException.java
index fcebebf9334f..7c70042e4fad 100644
--- a/bean/com/sun/star/comp/beans/HasConnectionException.java
+++ b/bean/com/sun/star/comp/beans/HasConnectionException.java
@@ -27,7 +27,7 @@
package com.sun.star.comp.beans;
-/** This expception is thrown when a method is called which
+/** This exception is thrown when a method is called which
is only defined for not already having an established
connection.
diff --git a/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c b/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c
index 944c9ff5a38f..2d8591f336dd 100644
--- a/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c
+++ b/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c
@@ -52,7 +52,6 @@
#define SYSTEM_WIN32 1
#define SYSTEM_WIN16 2
#define SYSTEM_JAVA 3
-#define SYSTEM_OS2 4
#define SYSTEM_MAC 5
#define SYSTEM_XWINDOW 6
diff --git a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
index 336b3eb15463..5b3611057016 100644
--- a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
+++ b/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
@@ -44,7 +44,6 @@
#define SYSTEM_WIN32 1
#define SYSTEM_WIN16 2
#define SYSTEM_JAVA 3
-#define SYSTEM_OS2 4
#define SYSTEM_MAC 5
#define SYSTEM_XWINDOW 6
diff --git a/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c b/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c
index f7f86d8973b3..eba60760be54 100644
--- a/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c
+++ b/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c
@@ -36,14 +36,6 @@
#include "jawt.h"
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include "jawt_md.h"
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
#if defined assert
#undef assert
#endif
@@ -54,7 +46,6 @@
#define SYSTEM_WIN32 1
#define SYSTEM_WIN16 2
#define SYSTEM_JAVA 3
-#define SYSTEM_OS2 4
#define SYSTEM_MAC 5
#define SYSTEM_XWINDOW 6
diff --git a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
index 7adb1b7d7317..65078c849b4d 100644
--- a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
+++ b/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
@@ -34,12 +34,33 @@
#pragma warning(pop)
#endif
+#include <windows.h>
+#define JAWT_GetAWT hidden_JAWT_GetAWT
#include "jawt.h"
+#undef JAWT_GetAWT
#if defined _MSC_VER
#pragma warning(push, 1)
#endif
-#include "jawt_md.h"
+/* When cross-compiling to Windows we don't have any Windows JDK
+ * available. Copying this short snippet from win32/jawt_md.h can
+ * surely not be against its license. The intent is to enable
+ * interoperation with real Oracle Java after all. We leave out the
+ * informative comments that might have "artistic merit" and be more
+ * copyrightable. Use this also for native Windows compilation for
+ * simplicity.
+ */
+typedef struct jawt_Win32DrawingSurfaceInfo {
+ union {
+ HWND hwnd;
+ HBITMAP hbitmap;
+ void* pbits;
+ };
+ HDC hdc;
+ HPALETTE hpalette;
+} JAWT_Win32DrawingSurfaceInfo;
+
+extern __declspec(dllimport) unsigned char __stdcall JAWT_GetAWT(JNIEnv *, JAWT *);
#if defined _MSC_VER
#pragma warning(pop)
#endif
@@ -47,7 +68,6 @@
#define SYSTEM_WIN32 1
#define SYSTEM_WIN16 2
#define SYSTEM_JAVA 3
-#define SYSTEM_OS2 4
#define SYSTEM_MAC 5
#define SYSTEM_XWINDOW 6
diff --git a/bean/prj/d.lst b/bean/prj/d.lst
index b0478b3d4cd4..f3154b68b17c 100644
--- a/bean/prj/d.lst
+++ b/bean/prj/d.lst
@@ -1,5 +1,5 @@
-..\%__SRC%\class\officebean.jar %_DEST%\bin%_EXT%\officebean.jar
+..\%__SRC%\class\officebean.jar %_DEST%\bin\officebean.jar
-..\%__SRC%\bin\officebean.dll %_DEST%\bin%_EXT%\officebean.dll
-..\%__SRC%\lib\libofficebean.so %_DEST%\lib%_EXT%\libofficebean.so
-..\%__SRC%\lib\*officebean.dylib %_DEST%\lib%_EXT%\*officebean.dylib
+..\%__SRC%\bin\officebean.dll %_DEST%\bin\officebean.dll
+..\%__SRC%\lib\libofficebean.so %_DEST%\lib\libofficebean.so
+..\%__SRC%\lib\*officebean.dylib %_DEST%\lib\*officebean.dylib
diff --git a/crashrep/prj/d.lst b/crashrep/prj/d.lst
index a53aacc4659c..3ca113bb2284 100644
--- a/crashrep/prj/d.lst
+++ b/crashrep/prj/d.lst
@@ -1,3 +1,3 @@
-..\%__SRC%\bin\soreport.exe %_DEST%\bin%_EXT%\crashrep.exe
-..\%__SRC%\bin\soreport.exe.manifest %_DEST%\bin%_EXT%\crashrep.exe.manifest
-..\%__SRC%\bin\crashrep %_DEST%\bin%_EXT%\crashrep
+..\%__SRC%\bin\soreport.exe %_DEST%\bin\crashrep.exe
+..\%__SRC%\bin\soreport.exe.manifest %_DEST%\bin\crashrep.exe.manifest
+..\%__SRC%\bin\crashrep %_DEST%\bin\crashrep
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 406dd7499cfb..94d8a4a71603 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,cui,\
$$(INCLUDE) \
-I$(realpath $(SRCDIR)/cui/source/inc) \
-I$(OUTDIR)/inc \
- -I$(OUTDIR)/inc/offuh \
))
$(eval $(call gb_Library_add_defs,cui,\
@@ -45,6 +44,11 @@ $(eval $(call gb_Library_add_defs,cui,\
$(if $(filter TRUE,$(ENABLE_KDE4)),-DENABLE_KDE4) \
))
+$(eval $(call gb_Library_add_api,cui,\
+ offapi \
+ udkapi \
+))
+
# .IF "$(ENABLE_LAYOUT)" == "TRUE"
# CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
# .ENDIF # ENABLE_LAYOUT == TRUE
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 4b955b653cd4..9436944924eb 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -1041,7 +1041,7 @@ IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG )
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG )
{
- StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr );
+ StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aSaveAccelConfigStr );
return 0;
}
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 007ad3d2ab1e..26847cc25666 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -344,7 +344,7 @@ sal_Bool _SvxMacroTabPage::FillItemSet( SfxItemSet& /*rSet*/ )
{
m_xAppEvents->replaceByName( eventName, GetPropsByName( eventName, m_appEventsHash ) );
}
- catch( const Exception& )
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -361,7 +361,7 @@ sal_Bool _SvxMacroTabPage::FillItemSet( SfxItemSet& /*rSet*/ )
{
m_xDocEvents->replaceByName( eventName, GetPropsByName( eventName, m_docEventsHash ) );
}
- catch( const Exception& )
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -375,7 +375,7 @@ sal_Bool _SvxMacroTabPage::FillItemSet( SfxItemSet& /*rSet*/ )
}
}
}
- catch(Exception&)
+ catch (const Exception&)
{
}
// what is the return value about??
@@ -420,7 +420,7 @@ void _SvxMacroTabPage::Reset()
}
}
}
- catch(Exception&)
+ catch (const Exception&)
{
}
DisplayAppEvents(bAppEvents);
@@ -763,8 +763,9 @@ void _SvxMacroTabPage::InitAndSetHandler( Reference< container::XNameReplace> xA
{
m_appEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xAppEvents->getByName( eventNames[nEvent] ) );
}
- catch (Exception e)
- {}
+ catch (const Exception&)
+ {
+ }
}
if(m_xDocEvents.is())
{
@@ -776,8 +777,9 @@ void _SvxMacroTabPage::InitAndSetHandler( Reference< container::XNameReplace> xA
{
m_docEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xDocEvents->getByName( eventNames[nEvent] ) );
}
- catch (Exception e)
- {}
+ catch (const Exception&)
+ {
+ }
}
}
}
@@ -924,7 +926,7 @@ IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton )
{
(void)pButton; //unused
pPage->FillItemSet( *pOutSet );
- EndDialog( RET_CANCEL );
+ EndDialog( RET_OK );
return 0;
}
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index e4a4b293e2a6..0d77033cc2d7 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -73,69 +73,37 @@ Image SfxApplication::GetApplicationLogo()
return Image( aBitmap );
}
-/* intense magic to get strong version information */
+/* get good version information */
static String
GetBuildId()
{
- const String sCWSSchema( String::CreateFromAscii( "[CWS:" ) );
rtl::OUString sDefault;
- String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
- OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" );
- if ( sBuildId.Len() > 0 && sBuildId.Search( sCWSSchema ) == STRING_NOTFOUND )
+ rtl::OUString sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
+ if (!sBuildId.isEmpty() && sBuildId.getLength() > 50)
{
- // no cws part in brand buildid -> try basis buildid
- rtl::OUString sBasisBuildId( DEFINE_CONST_OUSTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
- rtl::Bootstrap::expandMacros( sBasisBuildId );
- sal_Int32 nIndex = sBasisBuildId.indexOf( sCWSSchema );
- if ( nIndex != -1 )
- sBuildId += String( sBasisBuildId.copy( nIndex ) );
- }
-
- String sProductSource( utl::Bootstrap::getProductSource( sDefault ) );
- OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" );
-
- // the product source is something like "DEV300", where the
- // build id is something like "300m12(Build:12345)". For better readability,
- // strip the duplicate UPD ("300").
- if ( sProductSource.Len() )
- {
- bool bMatchingUPD =
- ( sProductSource.Len() >= 3 )
- && ( sBuildId.Len() >= 3 )
- && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) );
- OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" );
- if ( bMatchingUPD )
- sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 );
-
- // prepend the product source
- sBuildId.Insert( sProductSource, 0 );
- }
-
- // Version information (in about box) (#i94693#)
- /* if the build ids of the basis or ure layer are different from the build id
- * of the brand layer then show them */
- rtl::OUString aBasisProductBuildId( DEFINE_CONST_OUSTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
- rtl::Bootstrap::expandMacros( aBasisProductBuildId );
- rtl::OUString aUREProductBuildId( DEFINE_CONST_OUSTRING("${$URE_BIN_DIR/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
- rtl::Bootstrap::expandMacros( aUREProductBuildId );
- if ( sBuildId.Search( String( aBasisProductBuildId ) ) == STRING_NOTFOUND
- || sBuildId.Search( String( aUREProductBuildId ) ) == STRING_NOTFOUND )
- {
- String sTemp( '-' );
- sTemp += String( aBasisProductBuildId );
- sTemp += '-';
- sTemp += String( aUREProductBuildId );
- sBuildId.Insert( sTemp, sBuildId.Search( ')' ) );
+ rtl::OUStringBuffer aBuffer;
+ aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t"));
+ sal_Int32 nIndex = 0;
+ do
+ {
+ rtl::OUString aToken = sBuildId.getToken( 0, '-', nIndex );
+ if (!aToken.isEmpty())
+ {
+ aBuffer.append(aToken);
+ if (nIndex >= 0)
+ {
+ if (nIndex % 5)
+ aBuffer.append(static_cast<sal_Unicode>('-'));
+ else
+ aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t"));
+ }
+ }
+ }
+ while ( nIndex >= 0 );
+ sBuildId = aBuffer.makeStringAndClear();
}
- // the build id format is "milestone(build)[cwsname]". For readability, it would
- // be nice to have some more spaces in there.
- xub_StrLen nPos = 0;
- if ( ( nPos = sBuildId.Search( sal_Unicode( '(' ) ) ) != STRING_NOTFOUND )
- sBuildId.Insert( sal_Unicode( ' ' ), nPos );
- if ( ( nPos = sBuildId.Search( sal_Unicode( '[' ) ) ) != STRING_NOTFOUND )
- sBuildId.Insert( sal_Unicode( ' ' ), nPos );
-
+ OSL_ENSURE( sBuildId.getLength() > 0, "No BUILDID in bootstrap file" );
return sBuildId;
}
@@ -169,6 +137,8 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
String sVersion = aVersionTextStr;
sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() );
sVersion += '\n';
+ sVersion += m_sBuildStr;
+ sVersion += ' ';
sVersion += GetBuildId();
#ifdef BUILD_VER_STRING
String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) );
@@ -177,28 +147,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
#endif
aVersionText.SetText( sVersion );
- // Initialization call for developers
- if ( aAccelStr.Len() && ByteString(U2S(aAccelStr)).IsAlphaAscii() )
- {
- Accelerator *pAccel = 0, *pPrevAccel = 0, *pFirstAccel = 0;
- aAccelStr.ToUpperAscii();
-
- for ( sal_uInt16 i = 0; i < aAccelStr.Len(); ++i )
- {
- pPrevAccel = pAccel;
- pAccel = new Accelerator;
- aAccelList.push_back( pAccel );
- sal_uInt16 nKey = aAccelStr.GetChar(i) - 'A' + KEY_A;
- pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) );
- if ( i > 0 )
- pPrevAccel->SetAccel( 1, pAccel );
- if ( i == 0 )
- pFirstAccel = pAccel;
- }
- pAccel->SetSelectHdl( LINK( this, AboutDialog, AccelSelectHdl ) );
- GetpApp()->InsertAccel( pFirstAccel );
- }
-
// set for background and text the correct system color
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
Color aWhiteCol( rSettings.GetWindowColor() );
@@ -235,17 +183,10 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
// determine size and position of the dialog & elements
Size aAppLogoSiz = aAppLogo.GetSizePixel();
- if (aAppLogoSiz.Width() < 300)
- aAppLogoSiz.Width() = 300;
-
- Size aOutSiz = GetOutputSizePixel();
- aOutSiz.Width() = aAppLogoSiz.Width();
-
// analyze size of the aVersionText widget
// character size
Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
// preferred Version widget size
- Size aVTSize = aVersionText.CalcMinimumSize();
long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 );
long nDlgMargin = a6Size.Width() * 2;
long nCtrlMargin = a6Size.Height() * 2;
@@ -269,47 +210,50 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
long nTextWidth = (aOutSiz.Width() - nDlgMargin);
// finally set the aVersionText widget position and size
- Size aVTCopySize = aVTSize;
- Point aVTCopyPnt;
- aVTCopySize.Width() = nTextWidth;
- aVTCopyPnt.X() = ( aOutSiz.Width() - aVTCopySize.Width() ) / 2;
- aVTCopyPnt.Y() = nY;
- aVersionText.SetPosSizePixel( aVTCopyPnt, aVTCopySize );
-
- nY += nCtrlMargin;
+ Size aVTSize = aVersionText.GetSizePixel();
+ aVTSize.Width() = nTextWidth;
+ aVersionText.SetSizePixel(aVTSize);
+ aVTSize = aVersionText.CalcMinimumSize();
+ Point aVTPnt;
+ aVTPnt.X() = ( aOutSiz.Width() - aVTSize.Width() ) / 2;
+ aVTPnt.Y() = nY;
+ aVersionText.SetPosSizePixel( aVTPnt, aVTSize );
- // OK-Button-Position (at the bottom and centered)
- Size aOKSiz = aOKButton.GetSizePixel();
- Point aOKPnt = aOKButton.GetPosPixel();
-
- // FixedHyperlink with more info link
- Point aLinkPnt = aInfoLink.GetPosPixel();
- Size aLinkSize = aInfoLink.GetSizePixel();
+ nY += aVTSize.Height() + nCtrlMargin;
// Multiline edit with Copyright-Text
- Point aCopyPnt = aCopyrightText.GetPosPixel();
- Size aCopySize = aCopyrightText.GetSizePixel();
- aCopySize.Width() = nTextWidth;
- aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - 3*aLinkSize.Height() - nCtrlMargin;
-
- aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2;
- aCopyPnt.Y() = nY;
- aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize );
+ // preferred Version widget size
+ aCopyrightText.SetSizePixel(Size(nTextWidth,600));
+ Size aCTSize = aCopyrightText.CalcMinimumSize();
+ aCTSize.Width()= nTextWidth;
+ Point aCTPnt;
+ aCTPnt.X() = ( aOutSiz.Width() - aCTSize.Width() ) / 2;
+ aCTPnt.Y() = nY;
+ aCopyrightText.SetPosSizePixel( aCTPnt, aCTSize );
- nY += aCopySize.Height() + aLinkSize.Height();
+ nY += aCTSize.Height() + nCtrlMargin;
- aLinkSize.Width() = aInfoLink.CalcMinimumSize().Width();
- aLinkPnt.X() = ( aOutSiz.Width() - aLinkSize.Width() ) / 2;
- aLinkPnt.Y() = nY;
- aInfoLink.SetPosSizePixel( aLinkPnt, aLinkSize );
+ // FixedHyperlink with more info link
+ Size aLTSize = aInfoLink.CalcMinimumSize();
+ Point aLTPnt;
+ aLTPnt.X() = ( aOutSiz.Width() - aLTSize.Width() ) / 2;
+ aLTPnt.Y() = nY;
+ aInfoLink.SetPosSizePixel( aLTPnt, aLTSize );
- nY += aLinkSize.Height() + nCtrlMargin;
+ nY += aLTSize.Height() + nCtrlMargin;
+ // OK-Button-Position (at the bottom and centered)
+ Size aOKSiz = aOKButton.GetSizePixel();
+ Point aOKPnt;
aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2;
aOKPnt.Y() = nY;
aOKButton.SetPosPixel( aOKPnt );
- // Change the width of the dialog
+ nY += aOKSiz.Height() + nCtrlMargin;
+
+ aOutSiz.Height() = nY;
+
+ // Change the size of the dialog
SetOutputSizePixel( aOutSiz );
FreeResource();
@@ -320,50 +264,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
// -----------------------------------------------------------------------
-AboutDialog::~AboutDialog()
-{
- // Clearing the developers call
- if ( !aAccelList.empty() )
- {
- GetpApp()->RemoveAccel( aAccelList.front() );
-
- for ( size_t i = 0, n = aAccelList.size(); i < n; ++i )
- delete aAccelList[ i ];
- aAccelList.clear();
- }
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer )
-{
- (void)pTimer; //unused
- ++m_nPendingScrolls;
- Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator )
-{
- (void)pAccelerator; //unused
- // init Timer
- aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) );
-
- // init scroll mode
- nOff = GetOutputSizePixel().Height();
- MapMode aMapMode( MAP_PIXEL );
- SetMapMode( aMapMode );
-
- // start scroll Timer
- aTimer.SetTimeout( SCROLL_TIMER );
- aTimer.Start();
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
{
rtl::OUString sURL=pHyperlink->GetURL();
@@ -394,15 +294,12 @@ IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
void AboutDialog::Paint( const Rectangle& rRect )
{
SetClipRegion( rRect );
-
- Point aPos( m_nDeltaWidth / 2, 0 );
+ Point aPos( 0, 0 );
DrawImage( aPos, aAppLogo );
}
sal_Bool AboutDialog::Close()
{
- // stop Timer and finish the dialog
- aTimer.Stop();
EndDialog( RET_OK );
return sal_False;
}
diff --git a/cui/source/dialogs/about.hrc b/cui/source/dialogs/about.hrc
index 2f7e97484c6b..fe314232a28a 100644
--- a/cui/source/dialogs/about.hrc
+++ b/cui/source/dialogs/about.hrc
@@ -29,10 +29,9 @@
#define ABOUT_BTN_OK 1
#define ABOUT_FTXT_VERSION 2
-#define ABOUT_STR_ACCEL 3
-#define ABOUT_FTXT_COPYRIGHT 4
-
-#define ABOUT_FTXT_LINK 5
+#define ABOUT_FTXT_COPYRIGHT 3
+#define ABOUT_FTXT_LINK 4
+#define ABOUT_STR_BUILD 5
#define ABOUT_STR_VERSION 6
#define ABOUT_STR_VENDOR 7
#define ABOUT_STR_COPYRIGHT 8
diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src
index 607460c37604..5ad35acc4e90 100644
--- a/cui/source/dialogs/about.src
+++ b/cui/source/dialogs/about.src
@@ -33,7 +33,6 @@ ModalDialog RID_DEFAULTABOUT
Size = MAP_APPFONT ( 245 , 280 ) ;
Moveable = TRUE ;
SVLook = TRUE ;
-// TEXT_DEFAULTABOUT
OKButton ABOUT_BTN_OK
{
DefButton = TRUE ;
@@ -57,6 +56,9 @@ ModalDialog RID_DEFAULTABOUT
IgnoreTab = TRUE ;
ReadOnly = TRUE ;
AutoVScroll = TRUE ;
+ LEFT = FALSE ;
+ CENTER = TRUE ;
+ RIGHT = FALSE ;
};
FixedText ABOUT_FTXT_LINK
{
@@ -94,8 +96,8 @@ ModalDialog RID_DEFAULTABOUT
{
Text[ en-US ] = "http://www.libreoffice.org/credits.html";
};
- String ABOUT_STR_ACCEL
+ String ABOUT_STR_BUILD
{
- Text = "SDT" ;
+ Text[ en-US ] = "Build ID:";
};
};
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index c25b11f48f65..c099128991bb 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -116,7 +116,7 @@ void SAL_CALL SearchThread::run()
nBeginFormat = nEndFormat = nFileNumber;
for( sal_uInt16 i = nBeginFormat; i <= nEndFormat; ++i )
- aFormats.push_back( ( (FilterEntry*) mpBrowser->aFilterEntryList.GetObject( i ) )->aFilterName.ToLowerAscii() );
+ aFormats.push_back( mpBrowser->aFilterEntryList[ i ]->aFilterName.ToLowerAscii() );
ImplSearch( maStartURL, aFormats, mpBrowser->bSearchRecursive );
}
@@ -205,13 +205,13 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
}
}
}
- catch( const ContentCreationException& )
+ catch (const ContentCreationException&)
{
}
- catch( const ::com::sun::star::uno::RuntimeException& )
+ catch (const ::com::sun::star::uno::RuntimeException&)
{
}
- catch( const ::com::sun::star::uno::Exception& )
+ catch (const ::com::sun::star::uno::Exception&)
{
}
}
@@ -279,10 +279,14 @@ void SearchProgress::StartExecuteModal( const Link& rEndDialogHdl )
// - TakeThread -
// --------------
-TakeThread::TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList ) :
- mpProgress ( pProgess ),
- mpBrowser ( pBrowser ),
- mrTakenList ( rTakenList )
+TakeThread::TakeThread(
+ TakeProgress* pProgess,
+ TPGalleryThemeProperties* pBrowser,
+ TokenList_impl& rTakenList
+) :
+ mpProgress ( pProgess ),
+ mpBrowser ( pBrowser ),
+ mrTakenList ( rTakenList )
{
}
@@ -298,9 +302,9 @@ void SAL_CALL TakeThread::run()
{
String aName;
INetURLObject aURL;
- sal_uInt16 nEntries;
+ sal_uInt16 nEntries;
GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme;
- sal_uInt16 nPos;
+ sal_uInt16 nPos;
GalleryProgress* pStatusProgress;
{
@@ -319,7 +323,7 @@ void SAL_CALL TakeThread::run()
aURL = INetURLObject(*mpBrowser->aFoundList[ nPos = mpBrowser->aLbxFound.GetSelectEntryPos( i ) ]);
// Position in Taken-Liste uebernehmen
- mrTakenList.Insert( (void*) (sal_uLong)nPos, LIST_APPEND );
+ mrTakenList.push_back( (sal_uLong)nPos );
{
SolarMutexGuard aGuard;
@@ -392,10 +396,9 @@ IMPL_LINK( TakeProgress, CleanUpHdl, void*, EMPTYARG )
mpBrowser->aLbxFound.SetNoSelection();
// mark all taken positions in aRemoveEntries
- for( i = 0UL, nCount = maTakenList.Count(); i < nCount; ++i )
- aRemoveEntries[ (sal_uLong) maTakenList.GetObject( i ) ] = true;
-
- maTakenList.Clear();
+ for( i = 0, nCount = maTakenList.size(); i < nCount; ++i )
+ aRemoveEntries[ maTakenList[ i ] ] = true;
+ maTakenList.clear();
// refill found list
for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
@@ -827,8 +830,9 @@ TPGalleryThemeProperties::~TPGalleryThemeProperties()
for ( size_t i = 0, n = aFoundList.size(); i < n; ++i )
delete aFoundList[ i ];
- for( void* pEntry = aFilterEntryList.First(); pEntry; pEntry = aFilterEntryList.Next() )
- delete (FilterEntry*) pEntry;
+ for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) {
+ delete aFilterEntryList[ i ];
+ }
}
// ------------------------------------------------------------------------
@@ -861,7 +865,7 @@ SfxTabPage* TPGalleryThemeProperties::Create( Window* pParent, const SfxItemSet&
void TPGalleryThemeProperties::FillFilterList()
{
- GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
String aExt;
String aName;
FilterEntry* pFilterEntry;
@@ -870,11 +874,12 @@ void TPGalleryThemeProperties::FillFilterList()
sal_Bool bInList;
// graphic filters
- for( i = 0, nKeyCount = pFilter->GetImportFormatCount(); i < nKeyCount; i++ )
+ for( i = 0, nKeyCount = rFilter.GetImportFormatCount(); i < nKeyCount; i++ )
{
- aExt = pFilter->GetImportFormatShortName( i );
- aName = pFilter->GetImportFormatName( i );
- pTestEntry = (FilterEntry*) aFilterEntryList.First();
+ aExt = rFilter.GetImportFormatShortName( i );
+ aName = rFilter.GetImportFormatName( i );
+ size_t entryIndex = 0;
+ pTestEntry = aFilterEntryList.empty() ? NULL : aFilterEntryList[ entryIndex ];
bInList = sal_False;
String aExtensions;
@@ -882,7 +887,7 @@ void TPGalleryThemeProperties::FillFilterList()
String sWildcard;
while( sal_True )
{
- sWildcard = pFilter->GetImportWildcard( i, j++ );
+ sWildcard = rFilter.GetImportWildcard( i, j++ );
if ( !sWildcard.Len() )
break;
if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND )
@@ -901,18 +906,24 @@ void TPGalleryThemeProperties::FillFilterList()
bInList = sal_True;
break;
}
- pTestEntry = (FilterEntry*) aFilterEntryList.Next();
+ pTestEntry = ( ++entryIndex < aFilterEntryList.size() )
+ ? aFilterEntryList[ entryIndex ] : NULL;
}
if ( !bInList )
{
pFilterEntry = new FilterEntry;
pFilterEntry->aFilterName = aExt;
- aFilterEntryList.Insert( pFilterEntry, aCbbFileType.InsertEntry( aName ) );
+ size_t pos = aCbbFileType.InsertEntry( aName );
+ if ( pos < aFilterEntryList.size() ) {
+ aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry );
+ } else {
+ aFilterEntryList.push_back( pFilterEntry );
+ }
}
}
// media filters
- static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
+ static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
::avmedia::FilterNameVector aFilters;
const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) );
::rtl::OUString aAllTypes;
@@ -927,9 +938,20 @@ void TPGalleryThemeProperties::FillFilterList()
pFilterEntry = new FilterEntry;
pFilterEntry->aFilterName = aFilters[ l ].second.getToken( 0, ';', nIndex );
- nFirstExtFilterPos = aCbbFileType.InsertEntry( addExtension( aFilters[ l ].first,
- aFilterWildcard += pFilterEntry->aFilterName ) );
- aFilterEntryList.Insert( pFilterEntry, nFirstExtFilterPos );
+ nFirstExtFilterPos = aCbbFileType.InsertEntry(
+ addExtension(
+ aFilters[ l ].first,
+ aFilterWildcard += pFilterEntry->aFilterName
+ )
+ );
+ if ( nFirstExtFilterPos < aFilterEntryList.size() ) {
+ aFilterEntryList.insert(
+ aFilterEntryList.begin() + nFirstExtFilterPos,
+ pFilterEntry
+ );
+ } else {
+ aFilterEntryList.push_back( pFilterEntry );
+ }
}
}
@@ -943,7 +965,7 @@ void TPGalleryThemeProperties::FillFilterList()
String sWildcard;
while( sal_True )
{
- sWildcard = pFilter->GetImportWildcard( i, j++ );
+ sWildcard = rFilter.GetImportWildcard( i, j++ );
if ( !sWildcard.Len() )
break;
if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND )
@@ -975,8 +997,12 @@ void TPGalleryThemeProperties::FillFilterList()
pFilterEntry = new FilterEntry;
pFilterEntry->aFilterName = String( CUI_RES( RID_SVXSTR_GALLERY_ALLFILES ) );
pFilterEntry->aFilterName = addExtension( pFilterEntry->aFilterName, aExtensions );
- aFilterEntryList.Insert(pFilterEntry, aCbbFileType. InsertEntry( pFilterEntry->aFilterName, 0 ) );
-
+ size_t pos = aCbbFileType.InsertEntry( pFilterEntry->aFilterName, 0 );
+ if ( pos < aFilterEntryList.size() ) {
+ aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry );
+ } else {
+ aFilterEntryList.push_back( pFilterEntry );
+ }
aCbbFileType.SetText( pFilterEntry->aFilterName );
}
@@ -1065,7 +1091,7 @@ IMPL_LINK( TPGalleryThemeProperties, ClickSearchHdl, void *, EMPTYARG )
}
}
}
- catch(IllegalArgumentException)
+ catch (const IllegalArgumentException&)
{
OSL_FAIL( "Folder picker failed with illegal arguments" );
}
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index cc2cd69f53d7..1b44a8dbf54a 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -290,7 +290,6 @@ sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem )
{
case INET_PROT_HTTP :
case INET_PROT_FTP :
- case INET_PROT_TELNET :
nPageId = RID_SVXPAGE_HYPERLINK_INTERNET;
break;
case INET_PROT_FILE :
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 356416a61753..ae30fa0b5f4c 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -395,7 +395,7 @@ void SvxHyperlinkNewDocTp::DoApply ()
}
}
}
- catch( uno::Exception )
+ catch (const uno::Exception&)
{
}
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 77e4cc1d2531..1018518b718d 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -34,18 +34,14 @@
#include "hyperdlg.hrc"
#include "hlmarkwn_def.hxx"
-#define STD_DOC_SUBPATH "internal"
-#define STD_DOC_NAME "url_transfer.htm"
-
sal_Char const sAnonymous[] = "anonymous";
sal_Char const sHTTPScheme[] = INET_HTTP_SCHEME;
sal_Char const sHTTPSScheme[] = INET_HTTPS_SCHEME;
sal_Char const sFTPScheme[] = INET_FTP_SCHEME;
-sal_Char const sTelnetScheme[] = INET_TELNET_SCHEME;
/*************************************************************************
|*
-|* Contructor / Destructor
+|* Constructor / Destructor
|*
|************************************************************************/
@@ -56,7 +52,6 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent,
maGrpLinkTyp ( this, CUI_RES (GRP_LINKTYPE) ),
maRbtLinktypInternet ( this, CUI_RES (RB_LINKTYP_INTERNET) ),
maRbtLinktypFTP ( this, CUI_RES (RB_LINKTYP_FTP) ),
- maRbtLinktypTelnet ( this, CUI_RES (RB_LINKTYP_TELNET) ),
maFtTarget ( this, CUI_RES (FT_TARGET_HTML) ),
maCbbTarget ( this, INET_PROT_HTTP ),
maBtBrowse ( this, CUI_RES (BTN_BROWSE) ),
@@ -81,19 +76,6 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent,
maCbbTarget.Show();
maCbbTarget.SetHelpId( HID_HYPERDLG_INET_PATH );
- // Find Path to Std-Doc
- String aStrBasePaths( SvtPathOptions().GetTemplatePath() );
- for( xub_StrLen n = 0; n < aStrBasePaths.GetTokenCount(); n++ )
- {
- INetURLObject aURL( aStrBasePaths.GetToken( n ) );
- aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_SUBPATH ) ) );
- aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_NAME ) ) );
- if ( FileExists( aURL ) )
- {
- maStrStdDocURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
- break;
- }
- }
SetExchangeSupport ();
///////////////////////////////////////
@@ -105,14 +87,13 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent,
maEdPassword.Show( sal_False );
maCbAnonymous.Show( sal_False );
maBtTarget.Enable( sal_False );
- maBtBrowse.Enable( maStrStdDocURL != aEmptyStr );
+ maBtBrowse.Enable( sal_True );
///////////////////////////////////////
// overload handlers
Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
maRbtLinktypInternet.SetClickHdl( aLink );
maRbtLinktypFTP.SetClickHdl ( aLink );
- maRbtLinktypTelnet.SetClickHdl ( aLink );
maCbAnonymous.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) );
maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickBrowseHdl_Impl ) );
maBtTarget.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickTargetHdl_Impl ) );
@@ -253,7 +234,7 @@ void SvxHyperlinkInternetTp::SetInitFocus()
/*************************************************************************
|*
-|* Contens of editfield "Taregt" modified
+|* Contents of editfield "Target" modified
|*
|************************************************************************/
@@ -272,7 +253,7 @@ IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, void *, EMPTYARG )
/*************************************************************************
|*
-|* If target-field was modify, to browse the new doc afeter timeout
+|* If target-field was modify, to browse the new doc after timeout
|*
|************************************************************************/
@@ -284,7 +265,7 @@ IMPL_LINK ( SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, EMPTYARG )
/*************************************************************************
|*
-|* Contens of editfield "Login" modified
+|* Contents of editfield "Login" modified
|*
|************************************************************************/
@@ -308,14 +289,10 @@ void SvxHyperlinkInternetTp::SetScheme( const String& aScheme )
//if aScheme is empty or unknown the default beaviour is like it where HTTP
sal_Bool bFTP = aScheme.SearchAscii( sFTPScheme ) == 0;
- sal_Bool bTelnet = sal_False;
- if( !bFTP )
- bTelnet = aScheme.SearchAscii( sTelnetScheme ) == 0;
- sal_Bool bInternet = !(bFTP || bTelnet);
+ sal_Bool bInternet = !(bFTP);
//update protocol button selection:
maRbtLinktypFTP.Check(bFTP);
- maRbtLinktypTelnet.Check(bTelnet);
maRbtLinktypInternet.Check(bInternet);
//update target:
@@ -338,7 +315,7 @@ void SvxHyperlinkInternetTp::SetScheme( const String& aScheme )
}
else
{
- //disable for https, ftp and telnet
+ //disable for https and ftp
maBtTarget.Disable();
if ( mbMarkWndOpen )
HideMarkWnd ();
@@ -371,10 +348,6 @@ String SvxHyperlinkInternetTp::GetSchemeFromButtons() const
{
return String::CreateFromAscii( INET_FTP_SCHEME );
}
- else if( maRbtLinktypTelnet.IsChecked() )
- {
- return String::CreateFromAscii( INET_TELNET_SCHEME );
- }
return String::CreateFromAscii( INET_HTTP_SCHEME );
}
@@ -384,16 +357,12 @@ INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
{
return INET_PROT_FTP;
}
- else if( maRbtLinktypTelnet.IsChecked() )
- {
- return INET_PROT_TELNET;
- }
return INET_PROT_HTTP;
}
/*************************************************************************
|*
-|* Click on Radiobutton : Internet, FTP or Telnet
+|* Click on Radiobutton : Internet or FTP
|*
|************************************************************************/
@@ -457,7 +426,8 @@ IMPL_LINK ( SvxHyperlinkInternetTp, ClickBrowseHdl_Impl, void *, EMPTYARG )
/////////////////////////////////////////////////
// Open URL if available
- SfxStringItem aName( SID_FILE_NAME, maStrStdDocURL );
+ SfxStringItem aName( SID_FILE_NAME, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "http://" ) ) );
SfxStringItem aRefererItem( SID_REFERER, UniString::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) );
SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_True );
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index cbfcacbf591d..c577095dd216 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -578,10 +578,6 @@ String SvxHyperlinkTabPageBase::GetSchemeFromURL( String aStrURL )
{
aStrScheme = String::CreateFromAscii( INET_NEWS_SCHEME );
}
- else if ( aStrURL.EqualsIgnoreCaseAscii( INET_TELNET_SCHEME, 0, 9 ) )
- {
- aStrScheme = String::CreateFromAscii( INET_TELNET_SCHEME );
- }
}
else
aStrScheme = INetURLObject::GetScheme( aProtocol );
diff --git a/cui/source/dialogs/hyperdlg.hrc b/cui/source/dialogs/hyperdlg.hrc
index c838ffd9c20d..ead6a8239059 100644
--- a/cui/source/dialogs/hyperdlg.hrc
+++ b/cui/source/dialogs/hyperdlg.hrc
@@ -30,7 +30,6 @@
#define GRP_LINKTYPE 1
#define RB_LINKTYP_INTERNET 2
#define RB_LINKTYP_FTP 3
-#define RB_LINKTYP_TELNET 4
#define FT_TARGET_HTML 5
#define CB_TARGET_HTML 6
#define FT_LOGIN 7
diff --git a/cui/source/dialogs/hyperdlg.src b/cui/source/dialogs/hyperdlg.src
index 66c9be97525d..38df0d9cb71c 100644
--- a/cui/source/dialogs/hyperdlg.src
+++ b/cui/source/dialogs/hyperdlg.src
@@ -68,13 +68,6 @@ TabPage RID_SVXPAGE_HYPERLINK_INTERNET
Size = MAP_APPFONT( 56 - COL_DIFF, 10 );
Text [ en-US ] = "~FTP";
};
- RadioButton RB_LINKTYP_TELNET
- {
- HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_INTERNET:RB_LINKTYP_TELNET";
- Pos = MAP_APPFONT( 173, 13 );
- Size = MAP_APPFONT( 56, 10 );
- Text [ en-US ] = "~Telnet";
- };
FixedText FT_TARGET_HTML
{
Pos = MAP_APPFONT ( 12 , 26 ) ;
@@ -124,7 +117,7 @@ TabPage RID_SVXPAGE_HYPERLINK_INTERNET
TabStop = TRUE ;
Text [ en-US ] = "WWW Browser";
- QuickHelpText [ en-US ] = "WWW Browser" ;
+ QuickHelpText [ en-US ] = "Open web browser, copy an URL, and paste it to Target field" ;
ButtonImage = Image
{
ImageBitmap = Bitmap { File = "browse.bmp" ; };
@@ -132,22 +125,6 @@ TabPage RID_SVXPAGE_HYPERLINK_INTERNET
};
};
- ImageButton BTN_TARGET
- {
- HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_INTERNET:BTN_TARGET";
- Pos = MAP_APPFONT ( 235, 40+2 ) ;
- Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
- TabStop = TRUE ;
- Text [ en-US ] = "Target in Document";
-
- QuickHelpText [ en-US ] = "Target in Document" ;
- ButtonImage = Image
- {
- ImageBitmap = Bitmap { File = "target.bmp" ; };
- MASKCOLOR
- };
- };
-
FixedLine GRP_MORE
{
Pos = MAP_APPFONT ( 6 , 92 ) ;
@@ -783,7 +760,7 @@ String RID_SVXSTR_HYPERDLG_HLINETTP
};
String RID_SVXSTR_HYPERDLG_HLINETTP_HELP
{
- Text [ en-US ] = "This is where you create a hyperlink to a Web page, FTP server or Telnet connection." ;
+ Text [ en-US ] = "This is where you create a hyperlink to a Web page or FTP server connection." ;
};
String RID_SVXSTR_HYPERDLG_HLMAILTP
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index f981edef298b..c78da40d90fb 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -45,15 +45,7 @@
using ::std::vector;
-#ifdef WNT
-int __cdecl IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
-#else
-#if defined(OS2) && defined(ICC)
-int _Optlink IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
-#else
-int IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
-#endif
-#endif
+int SAL_CALL IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
{
return *(sal_uInt16*)p1 - *(sal_uInt16*)p2;
}
@@ -279,7 +271,7 @@ IconChoiceDialog ::~IconChoiceDialog ()
// save configuration at INI-Manager
// and remove pages
SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
- aTabDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ aTabDlgOpt.SetWindowState(::rtl::OStringToOUString(GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US));
aTabDlgOpt.SetPageID( mnCurrentPageId );
for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
@@ -1114,7 +1106,7 @@ void IconChoiceDialog::Start_Impl()
if ( aTabDlgOpt.Exists() )
{
// ggf. Position aus Konfig
- SetWindowState( ByteString( aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ SetWindowState(rtl::OUStringToOString(aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US));
// initiale TabPage aus Programm/Hilfe/Konfig
nActPage = (sal_uInt16)aTabDlgOpt.GetPageID();
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 4f8b83bc67f9..2e36a529f5f8 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -45,6 +45,7 @@
#include "backgrnd.hxx"
#include <svx/dialogs.hrc> // RID_SVXPAGE_...
#include <tools/resary.hxx>
+#include <rtl/strbuf.hxx>
// class SvxSearchFormatDialog -------------------------------------------
@@ -186,9 +187,10 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent,
pEntry = aAttrLB.SvTreeListBox::InsertEntry( aAttrNames.GetString(nId) );
else
{
- ByteString sError( "no resource for slot id\nslot = " );
- sError += ByteString::CreateFromInt32( nSlot );
- DBG_ERRORFILE( sError.GetBuffer() );
+ rtl::OStringBuffer sError(
+ RTL_CONSTASCII_STRINGPARAM("no resource for slot id\nslot = "));
+ sError.append(static_cast<sal_Int32>(nSlot));
+ DBG_ERRORFILE(sError.getStr());
}
if ( pEntry )
diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx
index c04206ccb63b..8e3bc3140f1a 100644
--- a/cui/source/factory/cuiresmgr.cxx
+++ b/cui/source/factory/cuiresmgr.cxx
@@ -33,15 +33,14 @@
#include <svl/solar.hrc>
#include <vcl/svapp.hxx>
-static ResMgr* pResMgr=0;
-
// struct DialogsResMgr --------------------------------------------------
ResMgr* CuiResMgr::GetResMgr()
{
+ static ResMgr* pResMgr=0;
+
if ( !pResMgr )
{
- ByteString aName( "cui" );
- pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ pResMgr = ResMgr::CreateResMgr("cui", Application::GetSettings().GetUILocale());
}
return pResMgr;
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 49163e6034fc..5296dd5c01b9 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -40,7 +40,6 @@
#include "splitcelldlg.hxx"
#include "gallery.hrc"
#include "dstribut.hxx"
-#include "cuigaldlg.hxx"
#include "cuiimapwnd.hxx"
#include "hlmarkwn.hxx"
#include "cuicharmap.hxx"
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index 036787e4c88e..4e09e0e2e422 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -67,10 +67,7 @@ protected:
public:
AboutDialog( Window* pParent, const ResId& rId);
- ~AboutDialog();
- DECL_LINK( TimerHdl, Timer * );
- DECL_LINK( AccelSelectHdl, Accelerator * );
DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
};
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 5f88aa64fd3b..f6a6a6361bdc 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -66,12 +66,8 @@ protected:
sal_uInt16 nResIdPrewievWin, sal_uInt16 nResIdFontTypeFT );
virtual ~SvxCharBasePage();
- void SetPrevFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont );
- void SetPrevFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont );
- void SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nSlotPosture, sal_uInt16 nSlotWeight, SvxFont& rFont ); // posture/weight
- void SetPrevFontWidthScale( const SfxItemSet& rSet );
-
- void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
+ void SetPrevFontWidthScale( const SfxItemSet& rSet );
+ void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
inline SvxFont& GetPreviewFont();
inline SvxFont& GetPreviewCJKFont();
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index 79a9b58f9350..1009ce0e7283 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -59,7 +59,8 @@ class SearchProgress;
class TakeProgress;
class TPGalleryThemeProperties;
-typedef ::std::vector< UniString* > StringList;
+typedef ::std::vector< UniString* > StringList;
+typedef ::std::vector< sal_uLong > TokenList_impl;
// ---------------
// - FilterEntry -
@@ -137,14 +138,18 @@ private:
TakeProgress* mpProgress;
TPGalleryThemeProperties* mpBrowser;
- List& mrTakenList;
+ TokenList_impl& mrTakenList;
virtual void SAL_CALL run();
virtual void SAL_CALL onTerminated();
public:
- TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList );
+ TakeThread(
+ TakeProgress* pProgess,
+ TPGalleryThemeProperties* pBrowser,
+ TokenList_impl& rTakenList
+ );
virtual ~TakeThread();
};
@@ -160,7 +165,7 @@ private:
FixedLine aFLTakeProgress;
CancelButton aBtnCancel;
TakeThread maTakeThread;
- List maTakenList;
+ TokenList_impl maTakenList;
DECL_LINK( ClickCancelBtn, void* );
void Terminate();
@@ -304,6 +309,7 @@ public:
// ----------------------------
// - TPGalleryThemeProperties -
// ----------------------------
+typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
class TPGalleryThemeProperties : public SfxTabPage
{
@@ -320,13 +326,13 @@ class TPGalleryThemeProperties : public SfxTabPage
CheckBox aCbxPreview;
GalleryPreview aWndPreview;
- ExchangeData* pData;
- StringList aFoundList;
- List aFilterEntryList;
- Timer aPreviewTimer;
- String aLastFilterName;
- String aPreviewString;
- INetURLObject aURL;
+ ExchangeData* pData;
+ StringList aFoundList;
+ FilterEntryList_impl aFilterEntryList;
+ Timer aPreviewTimer;
+ String aLastFilterName;
+ String aPreviewString;
+ INetURLObject aURL;
sal_uInt16 nCurFilterPos;
sal_uInt16 nFirstExtFilterPos;
sal_Bool bEntriesFound;
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 26a6faf83887..3952b9f3a2aa 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -52,19 +52,19 @@ private:
XDashList* pNewDashList;
XLineEndList* pLineEndList;
XLineEndList* pNewLineEndList;
- sal_Bool bObjSelected;
+ sal_Bool bObjSelected;
ChangeType nLineEndListState;
ChangeType nDashListState;
ChangeType mnColorTableState;
- sal_uInt16 nPageType;
- sal_uInt16 nDlgType;
- sal_uInt16 nPosDashLb;
- sal_uInt16 nPosLineEndLb;
- sal_uInt16 mnPos;
- sal_Bool mbAreaTP;
- sal_Bool mbDeleteColorTable;
+ sal_uInt16 nPageType;
+ sal_uInt16 nDlgType;
+ sal_uInt16 nPosDashLb;
+ sal_uInt16 nPosLineEndLb;
+ sal_uInt16 mnPos;
+ sal_Bool mbAreaTP;
+ sal_Bool mbDeleteColorTable;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
@@ -81,13 +81,13 @@ public:
sal_Bool bHasObj = sal_True );
~SvxLineTabDialog();
- void SetNewDashList( XDashList* pInLst)
+ void SetNewDashList( XDashList* pInLst)
{ pNewDashList = pInLst; }
- XDashList* GetNewDashList() const { return pNewDashList; }
- const XDashList* GetDashList() const { return pDashList; }
+ XDashList* GetNewDashList() const { return pNewDashList; }
+ const XDashList* GetDashList() const { return pDashList; }
void SetNewLineEndList( XLineEndList* pInLst)
- { pNewLineEndList = pInLst; }
+ { pNewLineEndList = pInLst; }
XLineEndList* GetNewLineEndList() const { return pNewLineEndList; }
const XLineEndList* GetLineEndList() const { return pLineEndList; }
@@ -102,6 +102,9 @@ public:
|*
\************************************************************************/
+class SvxBmpItemInfo;
+typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList;
+
class SvxLineTabPage : public SvxTabPage
{
using TabPage::ActivatePage;
@@ -149,17 +152,17 @@ private:
MetricField aSymbolHeightMF;
CheckBox aSymbolRatioCB;
std::vector<String> aGrfNames;
- List aGrfBrushItems;
+ SvxBmpItemInfoList aGrfBrushItems;
String sNumCharFmtName;
- sal_Bool bLastWidthModified;
+ sal_Bool bLastWidthModified;
Size aSymbolLastSize;
Graphic aSymbolGraphic;
Size aSymbolSize;
- sal_Bool bSymbols;
+ sal_Bool bSymbols;
const SfxItemSet& rOutAttrs;
RECT_POINT eRP;
- sal_Bool bObjSelected;
+ sal_Bool bObjSelected;
XOutdevItemPool* pXPool;
XLineStyleItem aXLStyle;
@@ -176,15 +179,15 @@ private:
ChangeType* pnLineEndListState;
ChangeType* pnDashListState;
ChangeType* pnColorTableState;
- sal_uInt16 nPageType;
- sal_uInt16 nDlgType;
- sal_uInt16* pPosDashLb;
- sal_uInt16* pPosLineEndLb;
+ sal_uInt16 nPageType;
+ sal_uInt16 nDlgType;
+ sal_uInt16* pPosDashLb;
+ sal_uInt16* pPosLineEndLb;
SfxMapUnit ePoolUnit;
// #63083#
- sal_Int32 nActLineWidth;
+ sal_Int32 nActLineWidth;
//Handler f�r Gallery-Popup-Menue-Button + Size
DECL_LINK( GraphicHdl_Impl, MenuButton * );
@@ -282,7 +285,7 @@ private:
const SfxItemSet& rOutAttrs;
XDash aDash;
- sal_Bool bObjSelected;
+ sal_Bool bObjSelected;
XOutdevItemPool* pXPool;
XLineStyleItem aXLStyle;
@@ -295,9 +298,9 @@ private:
XDashList* pDashList;
ChangeType* pnDashListState;
- sal_uInt16* pPageType;
- sal_uInt16* pDlgType;
- sal_uInt16* pPosDashLb;
+ sal_uInt16* pPageType;
+ sal_uInt16* pDlgType;
+ sal_uInt16* pPosDashLb;
SfxMapUnit ePoolUnit;
FieldUnit eFUnit;
@@ -372,7 +375,7 @@ private:
const SfxItemSet& rOutAttrs;
const SdrObject* pPolyObj;
- sal_Bool bObjSelected;
+ sal_Bool bObjSelected;
XOutdevItemPool* pXPool;
XLineStyleItem aXLStyle;
@@ -384,8 +387,8 @@ private:
XLineEndList* pLineEndList;
ChangeType* pnLineEndListState;
- sal_uInt16* pPageType;
- sal_uInt16* pDlgType;
+ sal_uInt16* pPageType;
+ sal_uInt16* pDlgType;
sal_uInt16* pPosLineEndLb;
#ifdef _SVX_TPLNEEND_CXX
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index b803f01aaf1c..b4cd859c5b15 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -44,7 +44,6 @@ private:
FixedLine maGrpLinkTyp;
RadioButton maRbtLinktypInternet;
RadioButton maRbtLinktypFTP;
- RadioButton maRbtLinktypTelnet;
FixedText maFtTarget;
SvxHyperURLBox maCbbTarget;
ImageButton maBtBrowse;
@@ -60,12 +59,10 @@ private:
sal_Bool mbMarkWndOpen;
- String maStrStdDocURL;
-
- DECL_LINK (Click_SmartProtocol_Impl , void * ); // Radiobutton clicked: Type Internet, FTP or Telnet
- DECL_LINK (ClickAnonymousHdl_Impl , void * ); // Checkbox : Anonymer Benutzer
+ DECL_LINK (Click_SmartProtocol_Impl , void * ); // Radiobutton clicked: Type HTTP or FTP
+ DECL_LINK (ClickAnonymousHdl_Impl , void * ); // Checkbox : Anonymous User
DECL_LINK (ClickBrowseHdl_Impl , void * ); // Button : Browse
- DECL_LINK (ClickTargetHdl_Impl , void * ); // Button : Ziel
+ DECL_LINK (ClickTargetHdl_Impl , void * ); // Button : Target
DECL_LINK (ModifiedLoginHdl_Impl , void * ); // Contens of editfield "Login" modified
DECL_LINK (LostFocusTargetHdl_Impl , void * ); // Combobox "Target" lost its focus
DECL_LINK (ModifiedTargetHdl_Impl , void * ); // Contens of editfield "Target" modified
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index 0a3dbb237239..b13fe077e15b 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -28,8 +28,6 @@
#ifndef _SVX_TABBASE_HYPERLINK_HXX
#define _SVX_TABBASE_HYPERLINK_HXX
-#define INET_TELNET_SCHEME "telnet://"
-
#include <sfx2/app.hxx>
#include <sfx2/tabdlg.hxx>
#include <vcl/group.hxx>
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 289dac171671..e524a7d21e5d 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -222,7 +222,7 @@ public:
void SetPaperFormatRanges( Paper eStart, Paper eEnd )
{ ePaperStart = eStart, ePaperEnd = eEnd; }
- void SetCollectionList(const List* pList);
+ void SetCollectionList(const std::vector<String> &aList);
virtual void PageCreated (SfxAllItemSet aSet);
};
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 92d3fbb08c51..8e8035461e84 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -78,7 +78,6 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent,
sHeader3 (CUI_RES( STR_HEADER3 )),
sHeader4 (CUI_RES( STR_HEADER4 )),
- sFontGroup ("FontSubstitution"),
pCheckButtonData(0)
{
FreeResource();
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
index 2ed4787240e2..ecd324ea4f63 100644
--- a/cui/source/options/fontsubs.hxx
+++ b/cui/source/options/fontsubs.hxx
@@ -102,7 +102,6 @@ class SvxFontSubstTabPage : public SfxTabPage
String sHeader4;
Color aTextColor;
- ByteString sFontGroup;
SvLBoxButtonData* pCheckButtonData;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 13b861f07187..68a4fad5bc2b 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -196,6 +196,7 @@ IMPL_LINK( SvxDefaultColorOptPage, ResetToDefaults, void *, EMPTYARG )
aLbChartColors.GetFocus();
aLbChartColors.SelectEntryPos( 0 );
+ aPBRemove.Enable( sal_True );
}
return 0L;
@@ -217,6 +218,7 @@ IMPL_LINK( SvxDefaultColorOptPage, AddChartColor, void *, EMPTYARG )
aLbChartColors.GetFocus();
aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 );
+ aPBRemove.Enable( sal_True );
}
return 0L;
@@ -251,6 +253,8 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton )
aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 );
else if (aLbChartColors.GetEntryCount() > 0)
aLbChartColors.SelectEntryPos( nIndex );
+ else
+ aPBRemove.Enable( sal_False );
}
}
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 03f35d6d1111..503e4bb7778e 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -180,9 +180,12 @@ namespace
if ( xEnum.is() && xEnum->hasMoreElements() )
bRet = sal_True;
}
-
- catch( IllegalArgumentException ) {}
- catch( ElementExistException ) {}
+ catch (const IllegalArgumentException&)
+ {
+ }
+ catch (const ElementExistException&)
+ {
+ }
return bRet;
}
}
@@ -639,7 +642,7 @@ CanvasSettings::CanvasSettings() :
++pCurr;
}
}
- catch( Exception& )
+ catch (const Exception&)
{
}
}
@@ -677,8 +680,9 @@ sal_Bool CanvasSettings::IsHardwareAccelerationAvailable() const
return mbHWAccelAvailable;
}
}
- catch (Exception &)
- {}
+ catch (const Exception&)
+ {
+ }
++pCurrImpl;
}
@@ -1339,7 +1343,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe
}
}
- catch (Exception &e)
+ catch (const Exception &e)
{
// we'll just leave the box in it's default setting and won't
// even give it event handler...
@@ -1522,7 +1526,7 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
}
}
}
- catch (Exception& e)
+ catch (const Exception& e)
{
// we'll just leave the box in it's default setting and won't
// even give it event handler...
@@ -1757,7 +1761,7 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
aCTLLang >>= aLocale;
eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale );
}
- catch(Exception&)
+ catch (const Exception&)
{
}
//overwrite them by the values provided by the DocShell
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
index 8dcdb124e088..a3016e6f55e0 100644
--- a/cui/source/options/opthtml.cxx
+++ b/cui/source/options/opthtml.cxx
@@ -124,66 +124,66 @@ SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& )
{
- SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
if(aSize1NF.GetSavedValue() != aSize1NF.GetText())
- pHtmlOpt->SetFontSize(0, (sal_uInt16)aSize1NF.GetValue());
+ rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF.GetValue());
if(aSize2NF.GetSavedValue() != aSize2NF.GetText())
- pHtmlOpt->SetFontSize(1, (sal_uInt16)aSize2NF.GetValue());
+ rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF.GetValue());
if(aSize3NF.GetSavedValue() != aSize3NF.GetText())
- pHtmlOpt->SetFontSize(2, (sal_uInt16)aSize3NF.GetValue());
+ rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF.GetValue());
if(aSize4NF.GetSavedValue() != aSize4NF.GetText())
- pHtmlOpt->SetFontSize(3, (sal_uInt16)aSize4NF.GetValue());
+ rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF.GetValue());
if(aSize5NF.GetSavedValue() != aSize5NF.GetText())
- pHtmlOpt->SetFontSize(4, (sal_uInt16)aSize5NF.GetValue());
+ rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF.GetValue());
if(aSize6NF.GetSavedValue() != aSize6NF.GetText())
- pHtmlOpt->SetFontSize(5, (sal_uInt16)aSize6NF.GetValue());
+ rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF.GetValue());
if(aSize7NF.GetSavedValue() != aSize7NF.GetText())
- pHtmlOpt->SetFontSize(6, (sal_uInt16)aSize7NF.GetValue());
+ rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF.GetValue());
if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue())
- pHtmlOpt->SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked());
+ rHtmlOpt.SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked());
if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue())
- pHtmlOpt->SetImportUnknown(aUnknownTagCB.IsChecked());
+ rHtmlOpt.SetImportUnknown(aUnknownTagCB.IsChecked());
if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue())
- pHtmlOpt->SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked());
+ rHtmlOpt.SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked());
if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue())
- pHtmlOpt->SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]);
+ rHtmlOpt.SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]);
if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue())
- pHtmlOpt->SetStarBasic(aStarBasicCB.IsChecked());
+ rHtmlOpt.SetStarBasic(aStarBasicCB.IsChecked());
if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue())
- pHtmlOpt->SetStarBasicWarning(aStarBasicWarningCB.IsChecked());
+ rHtmlOpt.SetStarBasicWarning(aStarBasicWarningCB.IsChecked());
if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue())
- pHtmlOpt->SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked());
+ rHtmlOpt.SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked());
if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue())
- pHtmlOpt->SetPrintLayoutExtension(aPrintExtensionCB.IsChecked());
+ rHtmlOpt.SetPrintLayoutExtension(aPrintExtensionCB.IsChecked());
- if( aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
- pHtmlOpt->SetTextEncoding( aCharSetLB.GetSelectTextEncoding() );
+ if( aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
+ rHtmlOpt.SetTextEncoding( aCharSetLB.GetSelectTextEncoding() );
return sal_False;
}
void OfaHtmlTabPage::Reset( const SfxItemSet& )
{
- SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
- aSize1NF.SetValue(pHtmlOpt->GetFontSize(0));
- aSize2NF.SetValue(pHtmlOpt->GetFontSize(1));
- aSize3NF.SetValue(pHtmlOpt->GetFontSize(2));
- aSize4NF.SetValue(pHtmlOpt->GetFontSize(3));
- aSize5NF.SetValue(pHtmlOpt->GetFontSize(4));
- aSize6NF.SetValue(pHtmlOpt->GetFontSize(5));
- aSize7NF.SetValue(pHtmlOpt->GetFontSize(6));
- aNumbersEnglishUSCB.Check(pHtmlOpt->IsNumbersEnglishUS());
- aUnknownTagCB.Check(pHtmlOpt->IsImportUnknown());
- aIgnoreFontNamesCB.Check(pHtmlOpt->IsIgnoreFontFamily());
- sal_uInt16 nExport = pHtmlOpt->GetExportMode();
+ SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
+ aSize1NF.SetValue(rHtmlOpt.GetFontSize(0));
+ aSize2NF.SetValue(rHtmlOpt.GetFontSize(1));
+ aSize3NF.SetValue(rHtmlOpt.GetFontSize(2));
+ aSize4NF.SetValue(rHtmlOpt.GetFontSize(3));
+ aSize5NF.SetValue(rHtmlOpt.GetFontSize(4));
+ aSize6NF.SetValue(rHtmlOpt.GetFontSize(5));
+ aSize7NF.SetValue(rHtmlOpt.GetFontSize(6));
+ aNumbersEnglishUSCB.Check(rHtmlOpt.IsNumbersEnglishUS());
+ aUnknownTagCB.Check(rHtmlOpt.IsImportUnknown());
+ aIgnoreFontNamesCB.Check(rHtmlOpt.IsIgnoreFontFamily());
+ sal_uInt16 nExport = rHtmlOpt.GetExportMode();
if( nExport >= SAL_N_ELEMENTS( aExportToPosArr ) )
nExport = 4; // default for bad config entry is NS 4.0
sal_uInt16 nPosArr = aExportToPosArr[ nExport ];
@@ -194,11 +194,11 @@ void OfaHtmlTabPage::Reset( const SfxItemSet& )
ExportHdl_Impl(&aExportLB);
- aStarBasicCB .Check(pHtmlOpt->IsStarBasic());
- aStarBasicWarningCB .Check(pHtmlOpt->IsStarBasicWarning());
+ aStarBasicCB .Check(rHtmlOpt.IsStarBasic());
+ aStarBasicWarningCB .Check(rHtmlOpt.IsStarBasicWarning());
aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked());
- aSaveGrfLocalCB.Check(pHtmlOpt->IsSaveGraphicsLocal());
- aPrintExtensionCB.Check(pHtmlOpt->IsPrintLayoutExtension());
+ aSaveGrfLocalCB.Check(rHtmlOpt.IsSaveGraphicsLocal());
+ aPrintExtensionCB.Check(rHtmlOpt.IsPrintLayoutExtension());
aPrintExtensionCB.SaveValue();
aStarBasicCB .SaveValue();
@@ -215,9 +215,9 @@ void OfaHtmlTabPage::Reset( const SfxItemSet& )
aUnknownTagCB.SaveValue();
aIgnoreFontNamesCB.SaveValue();
- if( !pHtmlOpt->IsDefaultTextEncoding() &&
- aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
- aCharSetLB.SelectTextEncoding( pHtmlOpt->GetTextEncoding() );
+ if( !rHtmlOpt.IsDefaultTextEncoding() &&
+ aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() )
+ aCharSetLB.SelectTextEncoding( rHtmlOpt.GetTextEncoding() );
}
IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox)
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index cf63dc133674..4b80409e2f36 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -635,413 +635,6 @@ IMPL_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Edit *, pEdit )
}
-/********************************************************************/
-/* */
-/* SvxSearchTabPage */
-/* */
-/********************************************************************/
-
-SvxSearchTabPage::SvxSearchTabPage(Window* pParent, const SfxItemSet& rSet ) :
-
- SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_SEARCH ), rSet ),
-
- aSearchGB ( this, CUI_RES( GB_SEARCH ) ),
- aSearchLB ( this, CUI_RES( LB_SEARCH ) ),
- aSearchNameFT ( this, CUI_RES( FT_SEARCH_NAME ) ),
- aSearchNameED ( this, CUI_RES( ED_SEARCH_NAME ) ),
- aSearchFT ( this, CUI_RES( FT_SEARCH ) ),
- aAndRB ( this, CUI_RES( RB_AND ) ),
- aOrRB ( this, CUI_RES( RB_OR ) ),
- aExactRB ( this, CUI_RES( RB_EXACT ) ),
-
- aURLFT ( this, CUI_RES( FT_URL ) ),
- aURLED ( this, CUI_RES( ED_URL ) ),
-
- aPostFixFT ( this, CUI_RES( FT_POSTFIX ) ),
- aPostFixED ( this, CUI_RES( ED_POSTFIX ) ),
- aSeparatorFT ( this, CUI_RES( FT_SEPARATOR ) ),
- aSeparatorED ( this, CUI_RES( ED_SEPARATOR ) ),
- aCaseFT ( this, CUI_RES( FT_CASE ) ),
- aCaseED ( this, CUI_RES( ED_CASE ) ),
-
- aNewPB ( this, CUI_RES( PB_NEW ) ),
- aAddPB ( this, CUI_RES( PB_ADD ) ),
- aChangePB ( this, CUI_RES( PB_CHANGE ) ),
- aDeletePB ( this, CUI_RES( PB_DELETE ) ),
-
- sModifyMsg(CUI_RES(MSG_MODIFY))
-{
- FreeResource();
-
- SetExchangeSupport();
- aCaseED.SelectEntryPos(0); // falls kein Eintrag vorhanden ist, kann es sonst "Arger geben
-
- aNewPB.SetClickHdl(LINK( this, SvxSearchTabPage, NewSearchHdl_Impl ) );
- aAddPB.SetClickHdl(LINK( this, SvxSearchTabPage, AddSearchHdl_Impl ) );
- aChangePB.SetClickHdl(LINK( this, SvxSearchTabPage, ChangeSearchHdl_Impl ) );
- aDeletePB.SetClickHdl(LINK( this, SvxSearchTabPage, DeleteSearchHdl_Impl ) );
- aSearchLB.SetSelectHdl(LINK( this, SvxSearchTabPage, SearchEntryHdl_Impl ) );
-
- Link aLink = LINK( this, SvxSearchTabPage, SearchModifyHdl_Impl );
- aSearchNameED.SetModifyHdl( aLink );
- aURLED.SetModifyHdl( aLink );
- aSeparatorED.SetModifyHdl( aLink );
- aPostFixED.SetModifyHdl( aLink );
- aCaseED.SetSelectHdl( aLink );
-
- aLink = LINK( this, SvxSearchTabPage, SearchPartHdl_Impl );
- aAndRB.SetClickHdl( aLink );
- aOrRB.SetClickHdl( aLink );
- aExactRB.SetClickHdl( aLink );
-
- InitControls_Impl();
-}
-
-// -----------------------------------------------------------------------
-SvxSearchTabPage::~SvxSearchTabPage()
-{
-}
-// -----------------------------------------------------------------------
-
-SfxTabPage* SvxSearchTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
-{
- return new SvxSearchTabPage(pParent, rAttrSet);
-}
-
-// -----------------------------------------------------------------------
-
-void SvxSearchTabPage::Reset( const SfxItemSet& )
-{
- //The two lines below are moved here from the last part of this method
- aChangePB.Disable();
- aAddPB.Disable();
-
- sal_uInt16 nCount = aSearchConfig.Count();
- aSearchLB.Clear();
- for(sal_uInt16 i = 0; i < nCount; i++)
- {
- const SvxSearchEngineData& rData = aSearchConfig.GetData(i);
- aSearchLB.InsertEntry(rData.sEngineName);
- }
-
- if ( nCount )
- {
- aSearchLB.SelectEntryPos(0);
- SearchEntryHdl_Impl( &aSearchLB );
- }
- else
- aDeletePB.Disable();
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxSearchTabPage::FillItemSet( SfxItemSet& )
-{
- if(aSearchConfig.IsModified())
- aSearchConfig.Commit();
- return sal_True;
-}
-/*--------------------------------------------------------------------*/
-
-void SvxSearchTabPage::ActivatePage( const SfxItemSet& )
-{
-}
-
-/*--------------------------------------------------------------------*/
-
-int SvxSearchTabPage::DeactivatePage( SfxItemSet* _pSet )
-{
- if(!ConfirmLeave(String()))
- return KEEP_PAGE;
-
- if ( _pSet )
- FillItemSet( *_pSet );
- return LEAVE_PAGE;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvxSearchTabPage::ConfirmLeave( const String& rStringSelection)
-{
- if(aChangePB.IsEnabled())
- {
- QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
- sal_uInt16 nRet = aQuery.Execute();
- if(RET_CANCEL == nRet)
- {
- if(rStringSelection.Len())
- aSearchLB.SelectEntry(sLastSelectedEntry);
- return sal_False;
- }
- else if(RET_YES == nRet)
- {
- sal_uInt16 nEntryPos = aSearchLB.GetEntryPos( aSearchNameED.GetText() );
- if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
- aSearchLB.SelectEntryPos(nEntryPos);
- else
- aSearchLB.SetNoSelection();
- ChangeSearchHdl_Impl(0);
- if(rStringSelection.Len())
- aSearchLB.SelectEntry(rStringSelection);
- }
- else if(RET_NO == nRet)
- {
- aChangePB.Enable(sal_False);
- aAddPB.Enable(sal_False);
- SearchEntryHdl_Impl(&aSearchLB);
- }
- }
- if(aAddPB.IsEnabled())
- {
- QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
- sal_uInt16 nRet = aQuery.Execute();
- if(RET_CANCEL == nRet)
- {
- aSearchLB.SetNoSelection();
- return sal_False;
- }
- else if(RET_YES == nRet)
- {
- aSearchLB.SetNoSelection();
- AddSearchHdl_Impl(0);
- if(rStringSelection.Len())
- aSearchLB.SelectEntry(rStringSelection);
- }
- else if(RET_NO == nRet)
- {
- aAddPB.Enable(sal_False);
- aChangePB.Enable(sal_False);
- NewSearchHdl_Impl(0);
- }
-
- }
- return sal_True;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxSearchTabPage::InitControls_Impl()
-{
- // detect longest label text
- sal_Int32 i = 0;
- long nLabelTextWidth = 0;
- Window* pLabels[] = { &aSearchNameFT, &aSearchFT, &aURLFT, &aPostFixFT, &aSeparatorFT, &aCaseFT };
- Window** pLabel = pLabels;
- const sal_Int32 nLabelCount = SAL_N_ELEMENTS( pLabels );
- for ( ; i < nLabelCount; ++i, ++pLabel )
- {
- long nTemp = (*pLabel)->GetCtrlTextWidth( (*pLabel)->GetText() );
- if ( nTemp > nLabelTextWidth )
- nLabelTextWidth = nTemp;
- }
-
- // resize all labels
- nLabelTextWidth = nLabelTextWidth * 120 / 100; // additional space looks better
- const long nLabelWidth = aSearchNameFT.GetSizePixel().Width();
- const long nDelta = nLabelWidth - nLabelTextWidth;
- pLabel = pLabels;
- for ( i = 0; i < nLabelCount; ++i, ++pLabel )
- {
- Size aNewSize = (*pLabel)->GetSizePixel();
- aNewSize.Width() += nDelta;
- (*pLabel)->SetSizePixel( aNewSize );
- }
-
- // resize and move the edits
- Window* pEdits[] = { &aSearchNameED, &aAndRB, &aOrRB,
- &aExactRB, &aURLED, &aPostFixED, &aSeparatorED, &aCaseED };
- Window** pEdit = pEdits;
- const sal_Int32 nCCount = SAL_N_ELEMENTS( pEdits );
- for ( i = 0; i < nCCount; ++i, ++pEdit )
- {
- Point aNewPos = (*pEdit)->GetPosPixel();
- aNewPos.X() -= nDelta;
- Size aNewSize = (*pEdit)->GetSizePixel();
- if ( (*pEdit) != &aSeparatorED && (*pEdit) != &aCaseED )
- aNewSize.Width() += nDelta;
- (*pEdit)->SetPosSizePixel( aNewPos, aNewSize );
- }
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, NewSearchHdl_Impl, PushButton *, EMPTYARG )
-{
- SearchEntryHdl_Impl(&aSearchLB);
- if(aChangePB.IsEnabled() || aAddPB.IsEnabled())
- return 0;
- aSearchNameED.SetText( String() );
- aSearchLB.SetNoSelection();
- aCurrentSrchData = SvxSearchEngineData();
- aAndRB.Check( sal_True );
- SearchEntryHdl_Impl( &aSearchLB );
- SearchPartHdl_Impl( &aAndRB );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, AddSearchHdl_Impl, PushButton *, EMPTYARG )
-{
- aAddPB.Enable(sal_False);
- aChangePB.Enable(sal_False);
- aCurrentSrchData.sEngineName = aSearchNameED.GetText();
- aSearchConfig.SetData(aCurrentSrchData);
- aSearchLB.InsertEntry( aCurrentSrchData.sEngineName );
- aSearchLB.SelectEntry( aCurrentSrchData.sEngineName );
- SearchEntryHdl_Impl( &aSearchLB );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, ChangeSearchHdl_Impl, PushButton *, EMPTYARG )
-{
- aChangePB.Enable(sal_False);
- aAddPB.Enable(sal_False);
- sal_uInt16 nPos = aSearchLB.GetSelectEntryPos();
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- {
- String sEngine = aSearchLB.GetSelectEntry();
- aCurrentSrchData.sEngineName = sEngine;
- aSearchConfig.SetData(aCurrentSrchData);
- aSearchLB.SelectEntry(sEngine);
- SearchEntryHdl_Impl(&aSearchLB);
- }
- else
- {
- SetUpdateMode(sal_False);
- String sEntry = aSearchNameED.GetText();
- // im AddHdl wird sLastSelectedEntry umgesetzt
- String sTemp(sLastSelectedEntry);
- AddSearchHdl_Impl(0);
- aSearchLB.SelectEntry(sTemp);
- DeleteSearchHdl_Impl(0);
- aSearchLB.SelectEntry(sEntry);
- SearchEntryHdl_Impl(&aSearchLB);
- SetUpdateMode(sal_True);
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, DeleteSearchHdl_Impl, PushButton *, EMPTYARG)
-{
- aChangePB.Enable(sal_False);
- sal_uInt16 nPos = aSearchLB.GetSelectEntryPos();
- DBG_ASSERT(nPos != LISTBOX_ENTRY_NOTFOUND, "kein Eintrag selektiert!");
- aSearchConfig.RemoveData(aSearchLB.GetSelectEntry());
- aSearchLB.RemoveEntry(nPos);
- aSearchLB.SelectEntryPos(0);
- SearchEntryHdl_Impl(&aSearchLB);
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, SearchEntryHdl_Impl, ListBox*, pBox )
-{
- sal_uInt16 nEntryPos = pBox->GetSelectEntryPos();
- if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
- {
- String sSelection(pBox->GetSelectEntry());
- if(!ConfirmLeave(sSelection))
- return 0;
-
- const SvxSearchEngineData* pData = aSearchConfig.GetData(sSelection);
- DBG_ASSERT(pData, "SearchEngine not available");
- if(pData)
- {
- aSearchNameED.SetText(sSelection);
- sLastSelectedEntry = sSelection;
- sal_Bool bAnd = aAndRB.IsChecked();
- sal_Bool bOr = aOrRB.IsChecked();
-
- aURLED.SetText(bAnd ? pData->sAndPrefix : bOr ? pData->sOrPrefix : pData->sExactPrefix);
- aSeparatorED.SetText( bAnd ? pData->sAndSeparator : bOr ? pData->sOrSeparator : pData->sExactSeparator);
- aPostFixED.SetText(bAnd ? pData->sAndSuffix : bOr ? pData->sOrSuffix : pData->sExactSuffix );
- sal_Int32 nCase = bAnd ? pData->nAndCaseMatch : bOr ? pData->nOrCaseMatch : pData->nExactCaseMatch;
- aCaseED.SelectEntryPos( (sal_uInt16)nCase );
- aCurrentSrchData = *pData;
- }
- aDeletePB.Enable();
- }
- else
- {
- aDeletePB.Enable(sal_False);
- sLastSelectedEntry.Erase();
- }
- aChangePB.Enable(sal_False);
- aAddPB.Enable(sal_False);
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, SearchModifyHdl_Impl, SvxNoSpaceEdit*, pEdit )
-{
- if ( pEdit == &aSearchNameED )
- {
- sal_Bool bTextLen = ( 0 != pEdit->GetText().Len() );
- sal_Bool bFound = sal_False;
- if ( bTextLen )
- {
- sal_uInt16 nEntryPos = aSearchLB.GetEntryPos( pEdit->GetText() );
- bFound = ( nEntryPos != LISTBOX_ENTRY_NOTFOUND );
- if ( bFound )
- aSearchLB.SelectEntryPos(nEntryPos);
- else
- aSearchLB.SetNoSelection();
- }
- aChangePB.Enable( sLastSelectedEntry.Len() > 0 );
- aDeletePB.Enable(bFound);
- aAddPB.Enable(bTextLen && !bFound);
- }
- else
- {
- if ( aSearchLB.GetSelectEntryCount() && sLastSelectedEntry.Len() > 0 )
- aChangePB.Enable();
-
- if(aAndRB.IsChecked())
- {
- aCurrentSrchData.sAndPrefix = aURLED.GetText();
- aCurrentSrchData.sAndSeparator = aSeparatorED.GetText();
- aCurrentSrchData.sAndSuffix = aPostFixED.GetText();
- aCurrentSrchData.nAndCaseMatch = aCaseED.GetSelectEntryPos();
- }
- else if(aOrRB.IsChecked())
- {
- aCurrentSrchData.sOrPrefix = aURLED.GetText();
- aCurrentSrchData.sOrSeparator = aSeparatorED.GetText();
- aCurrentSrchData.sOrSuffix = aPostFixED.GetText();
- aCurrentSrchData.nOrCaseMatch = aCaseED.GetSelectEntryPos();
- }
- else
- {
- aCurrentSrchData.sExactPrefix = aURLED.GetText();
- aCurrentSrchData.sExactSeparator = aSeparatorED.GetText();
- aCurrentSrchData.sExactSuffix = aPostFixED.GetText();
- aCurrentSrchData.nExactCaseMatch = aCaseED.GetSelectEntryPos();
- }
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( SvxSearchTabPage, SearchPartHdl_Impl, RadioButton *, EMPTYARG )
-{
- sal_Bool bAnd = aAndRB.IsChecked();
- sal_Bool bOr = aOrRB.IsChecked();
-
- aURLED.SetText(bAnd ? aCurrentSrchData.sAndPrefix : bOr ? aCurrentSrchData.sOrPrefix : aCurrentSrchData.sExactPrefix);
- aSeparatorED.SetText( bAnd ? aCurrentSrchData.sAndSeparator : bOr ? aCurrentSrchData.sOrSeparator : aCurrentSrchData.sExactSeparator);
- aPostFixED.SetText(bAnd ? aCurrentSrchData.sAndSuffix : bOr ? aCurrentSrchData.sOrSuffix : aCurrentSrchData.sExactSuffix );
- sal_Int32 nCase = bAnd ? aCurrentSrchData.nAndCaseMatch : bOr ? aCurrentSrchData.nOrCaseMatch : aCurrentSrchData.nExactCaseMatch;
- aCaseED.SelectEntryPos( (sal_uInt16)nCase );
- return 0;
-}
//#98647#----------------------------------------------
void SvxScriptExecListBox::RequestHelp( const HelpEvent& rHEvt )
diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc
index 1bd09225ac9b..34dce4fca5de 100755
--- a/cui/source/options/optinet2.hrc
+++ b/cui/source/options/optinet2.hrc
@@ -56,29 +56,6 @@
#define FT_HTTPS_PORT 15
#define ED_HTTPS_PORT 15
-// Search ------------------------------------------------------------------
-#define GB_SEARCH 40
-#define LB_SEARCH 40
-#define FT_SEARCH_NAME 41
-#define ED_SEARCH_NAME 41
-#define FT_SEARCH 42
-#define RB_AND 43
-#define RB_OR 44
-#define RB_EXACT 45
-#define FT_URL 46
-#define ED_URL 46
-#define FT_POSTFIX 47
-#define ED_POSTFIX 47
-#define FT_SEPARATOR 48
-#define ED_SEPARATOR 48
-#define FT_CASE 49
-#define ED_CASE 49
-#define PB_CHANGE 53
-#define PB_DELETE 54
-#define PB_ADD 55
-#define PB_NEW 56
-#define MSG_MODIFY 57
-
// Protocols --------------------------------------------------------------
#define GB_DNS 105
#define RB_DNS_AUTO 106
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 751fb00f40cd..15dc1f892885 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -51,13 +51,8 @@ class SvtInetOptions;
#ifndef SV_NODIALOG
#define PROXY_CONTROLS 23
#define CACHE_CONTROLS 20
-#define INET_SEARCH 19
-#if defined(OS2)
-#define TYPE_CONTROLS 20
-#else
#define TYPE_CONTROLS 18
-#endif
namespace svx {
class SecurityOptionsDialog;
@@ -147,70 +142,6 @@ public:
virtual void Reset( const SfxItemSet& rSet );
};
-// class SvxSearchTabPage ------------------------------------------------
-class SvxSearchConfig;
-class SvxSearchTabPage : public SfxTabPage
-{
- using TabPage::ActivatePage;
- using TabPage::DeactivatePage;
-
-private:
- FixedLine aSearchGB;
- ListBox aSearchLB;
- FixedText aSearchNameFT;
- SvxNoSpaceEdit aSearchNameED;
-
- FixedText aSearchFT;
- RadioButton aAndRB;
- RadioButton aOrRB;
- RadioButton aExactRB;
-
- FixedText aURLFT;
- SvxNoSpaceEdit aURLED;
-
- FixedText aPostFixFT;
- SvxNoSpaceEdit aPostFixED;
- FixedText aSeparatorFT;
- SvxNoSpaceEdit aSeparatorED;
- FixedText aCaseFT;
- ListBox aCaseED;
-
- PushButton aNewPB;
- PushButton aAddPB;
- PushButton aChangePB;
- PushButton aDeletePB;
-
- String sLastSelectedEntry;
- String sModifyMsg;
-
- SvxSearchConfig aSearchConfig;
- SvxSearchEngineData aCurrentSrchData;
-
-#ifdef _SVX_OPTINET2_CXX
- void InitControls_Impl();
-
- DECL_LINK( NewSearchHdl_Impl, PushButton * );
- DECL_LINK( AddSearchHdl_Impl, PushButton * );
- DECL_LINK( ChangeSearchHdl_Impl, PushButton * );
- DECL_LINK( DeleteSearchHdl_Impl, PushButton * );
- DECL_LINK( SearchEntryHdl_Impl, ListBox * );
- DECL_LINK( SearchModifyHdl_Impl, SvxNoSpaceEdit * );
- DECL_LINK( SearchPartHdl_Impl, RadioButton * );
-#endif
-
- virtual void ActivatePage( const SfxItemSet& rSet );
- virtual int DeactivatePage( SfxItemSet* pSet = 0 );
- sal_Bool ConfirmLeave( const String& rStringSelection );
-
- SvxSearchTabPage( Window* pParent, const SfxItemSet& rSet );
- virtual ~SvxSearchTabPage();
-
-public:
- static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
- virtual sal_Bool FillItemSet( SfxItemSet& rSet );
- virtual void Reset( const SfxItemSet& rSet );
-};
-
// #98647# class SvxScriptExecListBox ------------------------------------
class SvxScriptExecListBox : public ListBox
{ // for adding tooltips to ListBox
diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src
index ad77c8d33bd9..64a3662a5087 100644
--- a/cui/source/options/optinet2.src
+++ b/cui/source/options/optinet2.src
@@ -274,172 +274,6 @@ TabPage RID_SVXPAGE_INET_PROXY
Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 1 and 255." ;
};
};
-/************************************************************************/
-/* */
-/* Suche */
-/* */
-/************************************************************************/
-TabPage RID_SVXPAGE_INET_SEARCH
-{
- HelpId = HID_OPTIONS_SEARCH ;
- OutputSize = TRUE ;
- Size = MAP_APPFONT ( 260 , 185 ) ;
- SVLook = TRUE ;
- Hide = TRUE ;
- Text [ en-US ] = "Search" ;
-
- #define GB_SEARCH_LEFT 6
- #define GB_SEARCH_TOP 3
- FixedLine GB_SEARCH
- {
- Pos = MAP_APPFONT ( GB_SEARCH_LEFT , GB_SEARCH_TOP ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Search in" ;
- };
- ListBox LB_SEARCH
- {
- HelpID = "cui:ListBox:RID_SVXPAGE_INET_SEARCH:LB_SEARCH";
- Pos = MAP_APPFONT ( 12 , GB_SEARCH_TOP + 11 ) ;
- Size = MAP_APPFONT ( 39 , 120 ) ;
- Border = TRUE ;
- AutoHScroll = TRUE;
- };
- #define LABEL_START_XPOS (GB_SEARCH_LEFT + 6 + 39 + 5 )
- #define LABEL_LEN 64
- #define EDIT_START_XPOS (LABEL_START_XPOS + LABEL_LEN + 3)
- FixedText FT_SEARCH_NAME
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 13 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "~Name" ;
- };
- Edit ED_SEARCH_NAME
- {
- HelpID = "cui:Edit:RID_SVXPAGE_INET_SEARCH:ED_SEARCH_NAME";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 11 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- Border = TRUE ;
- };
- FixedText FT_SEARCH
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 27 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "Type" ;
- };
- RadioButton RB_AND
- {
- HelpID = "cui:RadioButton:RID_SVXPAGE_INET_SEARCH:RB_AND";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 26 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
- Check = TRUE ;
- Text [ en-US ] = "And" ;
- };
- RadioButton RB_OR
- {
- HelpID = "cui:RadioButton:RID_SVXPAGE_INET_SEARCH:RB_OR";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 39 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
- Text [ en-US ] = "~Or" ;
- };
- RadioButton RB_EXACT
- {
- HelpID = "cui:RadioButton:RID_SVXPAGE_INET_SEARCH:RB_EXACT";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 52 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
- Text [ en-US ] = "E~xact" ;
- };
- FixedText FT_URL
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 67 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "~Prefix" ;
- };
- Edit ED_URL
- {
- HelpID = "cui:Edit:RID_SVXPAGE_INET_SEARCH:ED_URL";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 65 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- Border = TRUE ;
- };
- FixedText FT_POSTFIX
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 82 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "Su~ffix" ;
- };
- Edit ED_POSTFIX
- {
- HelpID = "cui:Edit:RID_SVXPAGE_INET_SEARCH:ED_POSTFIX";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 80 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- Border = TRUE ;
- };
- FixedText FT_SEPARATOR
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 97 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "~Separator" ;
- };
- Edit ED_SEPARATOR
- {
- HelpID = "cui:Edit:RID_SVXPAGE_INET_SEARCH:ED_SEPARATOR";
- Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 95 ) ;
- Size = MAP_APPFONT ( 42 , 12 ) ;
- Border = TRUE ;
- };
- FixedText FT_CASE
- {
- Pos = MAP_APPFONT ( LABEL_START_XPOS, GB_SEARCH_TOP + 112 ) ;
- Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
- Text [ en-US ] = "~Case match" ;
- };
- ListBox ED_CASE
- {
- HelpID = "cui:ListBox:RID_SVXPAGE_INET_SEARCH:ED_CASE";
- Pos = MAP_APPFONT ( EDIT_START_XPOS, GB_SEARCH_TOP + 110 ) ;
- Size = MAP_APPFONT ( 42 , 48 ) ;
- Border = TRUE ;
- DropDown = TRUE ;
- StringList [ en-US ] =
- {
- < "None" ; > ;
- < "Upper" ; > ;
- < "Lower" ; > ;
- };
- };
- PushButton PB_NEW
- {
- HelpID = "cui:PushButton:RID_SVXPAGE_INET_SEARCH:PB_NEW";
- Pos = MAP_APPFONT ( 39 , GB_SEARCH_TOP + 131 + 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "N~ew";
- };
- PushButton PB_ADD
- {
- HelpID = "cui:PushButton:RID_SVXPAGE_INET_SEARCH:PB_ADD";
- Pos = MAP_APPFONT ( 92 , GB_SEARCH_TOP + 131 + 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Add" ;
- };
- PushButton PB_CHANGE
- {
- HelpID = "cui:PushButton:RID_SVXPAGE_INET_SEARCH:PB_CHANGE";
- Pos = MAP_APPFONT ( 145 , GB_SEARCH_TOP + 131 + 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Modify" ;
- };
- PushButton PB_DELETE
- {
- HelpID = "cui:PushButton:RID_SVXPAGE_INET_SEARCH:PB_DELETE";
- Pos = MAP_APPFONT ( 198 , GB_SEARCH_TOP + 131 + 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Delete" ;
- };
- String MSG_MODIFY
- {
- Text [ en-US ] = "Do you want to accept the current modification?";
- };
-};
/************************************************************************/
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index beb0d062d60e..164661a7b773 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -149,8 +149,8 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(Window* pParent, const SfxItemSet& rS
#endif
FreeResource();
- //quick launch only available in Win and OS/2
-#if !defined(WNT) && !defined(OS2) && !defined(ENABLE_GTK)
+ //quick launch only available in Win
+#if !defined(WNT) && !defined(ENABLE_GTK)
aQuickLaunchFL.Hide();
aQuickLaunchCB.Hide();
#endif
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 45119573c5da..c6b87d000bcd 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -35,7 +35,6 @@
#include <sfx2/app.hxx>
#include <svl/aeitem.hxx>
#include <svtools/svtabbx.hxx>
-#include <svtools/filedlg.hxx>
#include <tools/config.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index df99ea8f597f..e914524dc597 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -544,7 +544,6 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
{
aAutoSaveEdit.Enable();
aMinuteFT.Enable();
- aAutoSaveEdit.GrabFocus();
}
else
{
@@ -558,20 +557,13 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties)
{
OUString sRet;
- sal_Int32 nFlags;
const PropertyValue* pProperties = rProperties.getConstArray();
for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
{
if(!pProperties[nProp].Name.compareToAscii("UIName"))
{
pProperties[nProp].Value >>= sRet;
- }
- else if(!pProperties[nProp].Name.compareToAscii("Flags"))
- {
- if ( pProperties[nProp].Value >>= nFlags )
- {
- nFlags &= 0x100;
- }
+ break;
}
else if(!pProperties[nProp].Name.compareToAscii("Name"))
{
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index a025fcaf790d..d8909c4bdde1 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -346,7 +346,6 @@ SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItem
case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break;
case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break;
case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break;
- case RID_SVXPAGE_INET_SEARCH: fnCreate = &SvxSearchTabPage::Create; break;
case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break;
case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break;
case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break;
@@ -405,7 +404,6 @@ static OptionsMapping_Impl const OptionsMap_Impl[] =
{ "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL },
{ "Internet", NULL, SID_INET_DLG },
{ "Internet", "Proxy", RID_SVXPAGE_INET_PROXY },
- { "Internet", "Search", RID_SVXPAGE_INET_SEARCH },
{ "Internet", "Email", RID_SVXPAGE_INET_MAIL },
{ "Internet", "MozillaPlugin", RID_SVXPAGE_INET_MOZPLUGIN },
{ "LoadSave", NULL, SID_FILTER_DLG },
@@ -1168,7 +1166,7 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->
GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
- pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : XColorTable::GetStdColorTable();
+ pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : &XColorTable::GetStdColorTable();
rColPage.SetColorTable( pColorTab );
rColPage.SetPageType( &nUnknownType );
diff --git a/cui/source/options/treeopt.src b/cui/source/options/treeopt.src
index f4429608b291..39b70689349b 100644
--- a/cui/source/options/treeopt.src
+++ b/cui/source/options/treeopt.src
@@ -119,7 +119,7 @@ ModalDialog RID_OFADLG_OPTIONS_TREE
{
< "This dialog is used to define general settings when working with %PRODUCTNAME. Enter your personal data, the defaults to be used when saving documents, and paths to important files. These settings will be saved automatically and used in later sessions as well."; SID_GENERAL_OPTIONS; > ;
< "This is where you make settings concerning language and writing aids for your work with %PRODUCTNAME."; SID_LANGUAGE_OPTIONS; > ;
- < "This is where you configure %PRODUCTNAME for the Internet. You can define search engines or save your proxy settings." ; SID_INET_DLG; > ;
+ < "This is where you configure %PRODUCTNAME for the Internet. You can save your proxy settings." ; SID_INET_DLG; > ;
< "This is where you specify various settings for text documents. These settings determine how your text documents are handled in %PRODUCTNAME and are valid for all new %PRODUCTNAME Writer documents. You can also define a few settings for the active text document if you save it afterwards." ; SID_SW_EDITOPTIONS; > ;
< "This is where you define the basic settings for %PRODUCTNAME documents in HTML format. For example, you decide which contents should be displayed on the screen or printed, how the pages are scrolled on the screen, in which color keywords are highlighted in the source text and much more." ; SID_SW_ONLINEOPTIONS; > ;
< "This is where you define various global settings for spreadsheets. For example, you can define which contents should be displayed and in which direction the cursor will move after you enter data in a cell. You also define sort lists, the number of the decimal places displayed, etc." ; SID_SC_EDITOPTIONS; > ;
@@ -184,7 +184,6 @@ Resource RID_OFADLG_OPTIONS_TREE_PAGES
{
< "Internet" ; 0; > ;
< "Proxy" ; RID_SVXPAGE_INET_PROXY; > ;
- < "Search" ; RID_SVXPAGE_INET_SEARCH; > ;
< "E-mail" ; RID_SVXPAGE_INET_MAIL; > ;
< "Browser Plug-in" ; RID_SVXPAGE_INET_MOZPLUGIN; > ;
};
@@ -237,6 +236,7 @@ Resource RID_OFADLG_OPTIONS_TREE_PAGES
{
< "%PRODUCTNAME Calc" ; 0; > ;
< "General" ; SID_SC_TP_LAYOUT ;> ;
+ < "Defaults" ; RID_SC_TP_DEFAULTS ;> ;
< "View" ; SID_SC_TP_CONTENT ;> ;
< "International" ; RID_OFA_TP_INTERNATIONAL ;> ;
< "Calculate" ; SID_SC_TP_CALC ;> ;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 1df841d22ae1..f6f0ee48d4fe 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -117,7 +117,7 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) :
else
{
// remove smart tag tab page if no extensions are installed
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() )
RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS);
@@ -230,7 +230,7 @@ SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent,
sal_Bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
long nFlags = pAutoCorrect->GetFlags();
sal_uInt16 nPos = 0;
@@ -246,9 +246,9 @@ sal_Bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& )
sal_Bool bReturn = nFlags != pAutoCorrect->GetFlags();
if(bReturn )
{
- SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
- pCfg->SetModified();
- pCfg->Commit();
+ SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
+ rCfg.SetModified();
+ rCfg.Commit();
}
return bReturn;
}
@@ -260,7 +260,7 @@ void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& )
void OfaAutocorrOptionsPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const long nFlags = pAutoCorrect->GetFlags();
aCheckLB.SetUpdateMode(sal_False);
@@ -546,7 +546,7 @@ SfxTabPage* OfaSwAutoFmtOptionsPage::Create( Window* pParent,
sal_Bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& )
{
sal_Bool bModified = sal_False;
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
long nFlags = pAutoCorrect->GetFlags();
@@ -651,9 +651,9 @@ sal_Bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& )
if(bModified || nFlags != pAutoCorrect->GetFlags())
{
- SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
- pCfg->SetModified();
- pCfg->Commit();
+ SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
+ rCfg.SetModified();
+ rCfg.Commit();
}
return sal_True;
@@ -671,7 +671,7 @@ void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& )
void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
const long nFlags = pAutoCorrect->GetFlags();
@@ -1023,7 +1023,7 @@ int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* )
sal_Bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last();
while(pDoubleStringArray)
{
@@ -1222,7 +1222,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset,
}
else
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang);
for(sal_uInt16 i = 0; i < pWordList->Count(); i++)
@@ -1572,7 +1572,7 @@ int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* )
sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
StringsArraysPtr pArrays = aStringsTable.Last();
while(pArrays)
{
@@ -1753,7 +1753,7 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
}
else
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang);
const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang);
sal_uInt16 i;
@@ -1770,7 +1770,7 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
void OfaAutocorrExceptPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
RefillReplaceBoxes(sal_True, eLang, eLang);
aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst ));
aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst ));
@@ -2004,7 +2004,7 @@ SfxTabPage* OfaQuoteTabPage::Create( Window* pParent,
sal_Bool OfaQuoteTabPage::FillItemSet( SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
long nFlags = pAutoCorrect->GetFlags();
@@ -2063,9 +2063,9 @@ sal_Bool OfaQuoteTabPage::FillItemSet( SfxItemSet& )
if( bModified || bReturn )
{
- SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
- pCfg->SetModified();
- pCfg->Commit();
+ SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
+ rCfg.SetModified();
+ rCfg.Commit();
}
return bReturn;
}
@@ -2077,7 +2077,7 @@ void OfaQuoteTabPage::ActivatePage( const SfxItemSet& )
void OfaQuoteTabPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const long nFlags = pAutoCorrect->GetFlags();
// Initialize the Sw options
@@ -2153,7 +2153,7 @@ IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn )
LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 ));
pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg );
sal_UCS4 cDlg;
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
LanguageType eLang = Application::GetSettings().GetLanguage();
switch( nMode )
{
@@ -2319,7 +2319,7 @@ SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent,
sal_Bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& )
{
sal_Bool bModified = sal_False, bCheck;
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
sal_uInt16 nVal;
@@ -2362,16 +2362,16 @@ sal_Bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& )
}
if( bModified )
{
- SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
- pCfg->SetModified();
- pCfg->Commit();
+ SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
+ rCfg.SetModified();
+ rCfg.Commit();
}
return sal_True;
}
void OfaAutoCompleteTabPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
aCBActiv.Check( 0 != pOpt->bAutoCompleteWords );
@@ -2676,7 +2676,7 @@ IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG)
*/
sal_Bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
@@ -2719,7 +2719,7 @@ sal_Bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& )
*/
void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& )
{
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags();
const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 87a0a6a01efe..517ae4c0bfcc 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -207,302 +207,20 @@ SvxCharBasePage::~SvxCharBasePage()
// -----------------------------------------------------------------------
-//void SvxCharBasePage::SetPrevFontAttributes( const SfxItemSet& rSet )
void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet )
{
- SvxFont& rFont = GetPreviewFont();
- SvxFont& rCJKFont = GetPreviewCJKFont();
- SvxFont& rCTLFont = GetPreviewCTLFont();
- sal_uInt16 nWhich;
-
- nWhich = GetWhich( SID_CHAR_DLG_PREVIEW_STRING );
- if( ISITEMSET )
- {
- const SfxStringItem& rItem = ( SfxStringItem& ) rSet.Get( nWhich );
- ::rtl::OUString aString = rItem.GetValue();
- if( aString.getLength() != 0 )
- m_aPreviewWin.SetPreviewText( aString );
- else
- m_aPreviewWin.SetFontNameAsPreviewText();
- }
-
- // Underline
- FontUnderline eUnderline;
- nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
- if( ISITEMSET )
- {
- const SvxUnderlineItem& rItem = ( SvxUnderlineItem& ) rSet.Get( nWhich );
- eUnderline = ( FontUnderline ) rItem.GetValue();
- m_aPreviewWin.SetTextLineColor( rItem.GetColor() );
- }
- else
- eUnderline = UNDERLINE_NONE;
-
- rFont.SetUnderline( eUnderline );
- rCJKFont.SetUnderline( eUnderline );
- rCTLFont.SetUnderline( eUnderline );
-
- // Overline
- FontUnderline eOverline;
- nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
- if( ISITEMSET )
- {
- const SvxOverlineItem& rItem = ( SvxOverlineItem& ) rSet.Get( nWhich );
- eOverline = ( FontUnderline ) rItem.GetValue();
- m_aPreviewWin.SetOverlineColor( rItem.GetColor() );
- }
- else
- eOverline = UNDERLINE_NONE;
-
- rFont.SetOverline( eOverline );
- rCJKFont.SetOverline( eOverline );
- rCTLFont.SetOverline( eOverline );
-
- // Strikeout
- FontStrikeout eStrikeout;
- nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
- if( ISITEMSET )
- {
- const SvxCrossedOutItem& rItem = ( SvxCrossedOutItem& ) rSet.Get( nWhich );
- eStrikeout = ( FontStrikeout ) rItem.GetValue();
- }
- else
- eStrikeout = STRIKEOUT_NONE;
-
- rFont.SetStrikeout( eStrikeout );
- rCJKFont.SetStrikeout( eStrikeout );
- rCTLFont.SetStrikeout( eStrikeout );
-
- // WordLineMode
- nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
- if( ISITEMSET )
- {
- const SvxWordLineModeItem& rItem = ( SvxWordLineModeItem& ) rSet.Get( nWhich );
- rFont.SetWordLineMode( rItem.GetValue() );
- rCJKFont.SetWordLineMode( rItem.GetValue() );
- rCTLFont.SetWordLineMode( rItem.GetValue() );
- }
-
- // Emphasis
- nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
- if( ISITEMSET )
- {
- const SvxEmphasisMarkItem& rItem = ( SvxEmphasisMarkItem& ) rSet.Get( nWhich );
- FontEmphasisMark eMark = rItem.GetEmphasisMark();
- rFont.SetEmphasisMark( eMark );
- rCJKFont.SetEmphasisMark( eMark );
- rCTLFont.SetEmphasisMark( eMark );
- }
-
- // Relief
- nWhich = GetWhich( SID_ATTR_CHAR_RELIEF );
- if( ISITEMSET )
- {
- const SvxCharReliefItem& rItem = ( SvxCharReliefItem& ) rSet.Get( nWhich );
- FontRelief eFontRelief = ( FontRelief ) rItem.GetValue();
- rFont.SetRelief( eFontRelief );
- rCJKFont.SetRelief( eFontRelief );
- rCTLFont.SetRelief( eFontRelief );
- }
-
- // Effects
- nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
- if( ISITEMSET )
- {
- const SvxCaseMapItem& rItem = ( SvxCaseMapItem& ) rSet.Get( nWhich );
- SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue();
- rFont.SetCaseMap( eCaseMap );
- rCJKFont.SetCaseMap( eCaseMap );
- // #i78474# small caps do not exist in CTL fonts
- rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap );
- }
-
- // Outline
- nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
- if( ISITEMSET )
- {
- const SvxContourItem& rItem = ( SvxContourItem& ) rSet.Get( nWhich );
- sal_Bool bOutline = rItem.GetValue();
- rFont.SetOutline( bOutline );
- rCJKFont.SetOutline( bOutline );
- rCTLFont.SetOutline( bOutline );
- }
-
- // Shadow
- nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
- if( ISITEMSET )
- {
- const SvxShadowedItem& rItem = ( SvxShadowedItem& ) rSet.Get( nWhich );
- sal_Bool bShadow = rItem.GetValue();
- rFont.SetShadow( bShadow );
- rCJKFont.SetShadow( bShadow );
- rCTLFont.SetShadow( bShadow );
- }
-
- // Background
- sal_Bool bTransparent;
- nWhich = GetWhich( m_bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR );
- if( ISITEMSET )
- {
- const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich );
- const Color& rColor = rBrush.GetColor();
- bTransparent = rColor.GetTransparency() > 0;
- rFont.SetFillColor( rColor );
- rCJKFont.SetFillColor( rColor );
- rCTLFont.SetFillColor( rColor );
- }
- else
- bTransparent = sal_True;
-
- rFont.SetTransparent( bTransparent );
- rCJKFont.SetTransparent( bTransparent );
- rCTLFont.SetTransparent( bTransparent );
-
- Color aBackCol( COL_TRANSPARENT );
- if( !m_bPreviewBackgroundToCharacter )
- {
- nWhich = GetWhich( SID_ATTR_BRUSH );
- if( ISITEMSET )
- {
- const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich );
- if( GPOS_NONE == rBrush.GetGraphicPos() )
- aBackCol = rBrush.GetColor();
- }
- }
- m_aPreviewWin.SetBackColor( aBackCol );
-
- // Font
- SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont );
- SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont );
- SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont );
-
- // Style
- SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont );
- SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont );
- SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont );
-
- // Size
- SetPrevFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont );
- SetPrevFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont );
- SetPrevFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont );
-
- // Color
- nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
- if( ISITEMSET )
- {
- const SvxColorItem& rItem = ( SvxColorItem& ) rSet.Get( nWhich );
- Color aCol( rItem.GetValue() );
- rFont.SetColor( aCol );
- rCJKFont.SetColor( aCol );
- rCTLFont.SetColor( aCol );
-
- m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
- }
-
- // Kerning
- nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
- if( ISITEMSET )
- {
- const SvxKerningItem& rItem = ( SvxKerningItem& ) rSet.Get( nWhich );
- short nKern = ( short )
- LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP );
- rFont.SetFixKerning( nKern );
- rCJKFont.SetFixKerning( nKern );
- rCTLFont.SetFixKerning( nKern );
- }
-
- // Escapement
- nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
- const sal_uInt8 nProp = 100;
- short nEsc;
- sal_uInt8 nEscProp;
- if( ISITEMSET )
- {
- const SvxEscapementItem& rItem = ( SvxEscapementItem& ) rSet.Get( nWhich );
- nEsc = rItem.GetEsc();
- nEscProp = rItem.GetProp();
-
- if( nEsc == DFLT_ESC_AUTO_SUPER )
- nEsc = DFLT_ESC_SUPER;
- else if( nEsc == DFLT_ESC_AUTO_SUB )
- nEsc = DFLT_ESC_SUB;
- }
- else
- {
- nEsc = 0;
- nEscProp = 100;
- }
-
- SetPrevFontEscapement( nProp, nEscProp, nEsc );
-
- // Font width scale
- SetPrevFontWidthScale( rSet );
-
- m_aPreviewWin.Invalidate();
+ m_aPreviewWin.SetFromItemSet( rSet, m_bPreviewBackgroundToCharacter );
}
-// -----------------------------------------------------------------------
-
-void SvxCharBasePage::SetPrevFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont )
-{
- sal_uInt16 nWhich = GetWhich( nSlot );
- long nH;
- if( rSet.GetItemState( nWhich ) >= SFX_ITEM_SET )
- {
- nH = LogicToLogic( ( ( SvxFontHeightItem& ) rSet.Get( nWhich ) ).GetHeight(),
- ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ),
- MAP_TWIP );
- }
- else
- nH = 240; // as default 12pt
-
- rFont.SetSize( Size( 0, nH ) );
-}
-
-// -----------------------------------------------------------------------
-
-void SvxCharBasePage::SetPrevFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont )
-{
- sal_uInt16 nWhich = GetWhich( nSlot );
- if( ISITEMSET )
- {
- const SvxFontItem& rFontItem = ( SvxFontItem& ) rSet.Get( nWhich );
- rFont.SetFamily( rFontItem.GetFamily() );
- rFont.SetName( rFontItem.GetFamilyName() );
- rFont.SetPitch( rFontItem.GetPitch() );
- rFont.SetCharSet( rFontItem.GetCharSet() );
- rFont.SetStyleName( rFontItem.GetStyleName() );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvxCharBasePage::SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont& rFont )
-{
- sal_uInt16 nWhich = GetWhich( nPosture );
- if( ISITEMSET )
- {
- const SvxPostureItem& rItem = ( SvxPostureItem& ) rSet.Get( nWhich );
- rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE );
- }
-
- nWhich = GetWhich( nWeight );
- if( ISITEMSET )
- {
- SvxWeightItem& rItem = ( SvxWeightItem& ) rSet.Get( nWhich );
- rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL );
- }
-}
// -----------------------------------------------------------------------
void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet& rSet )
{
- sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
if( ISITEMSET )
{
- const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich );
-
+ const SvxCharScaleWidthItem &rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich );
m_aPreviewWin.SetFontWidthScale( rItem.GetValue() );
}
}
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 5586714da17d..42cde8c17fb2 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -3586,13 +3586,10 @@ void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
if (pListItem)
{
ListBox& myCharFmtLB = GetCharFmtListBox();
- const List *pList = (pListItem)->GetList();
- sal_uInt32 nCount = pList->Count();;
+ const std::vector<String> &aList = (pListItem)->GetList();
+ sal_uInt32 nCount = aList.size();;
for(sal_uInt32 i = 0; i < nCount; i++)
- {
- myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) );
-
- }
+ myCharFmtLB.InsertEntry(aList[i]);
}
if (pMetricItem)
SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index ef1fff0de271..59977eba1251 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -560,11 +560,6 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
bool bOrientationSupport =
pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION );
-#ifdef OS2
- // unter OS/2 wird bei HasSupport() immer sal_True returned
- // aber nur als Dummy, deshalb FALSE
- bOrientationSupport = sal_False;
-#endif
if ( !bOrientationSupport &&
aPaperSize.Width() > aPaperSize.Height() )
@@ -1645,13 +1640,13 @@ IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG )
// -----------------------------------------------------------------------
-void SvxPageDescPage::SetCollectionList(const List* pList)
+void SvxPageDescPage::SetCollectionList(const std::vector<String> &aList)
{
- sStandardRegister = *(String*)pList->GetObject(0);
- for( sal_uInt16 i = 1; i < pList->Count(); i++ )
- {
- aRegisterLB.InsertEntry(*(String*)pList->GetObject(i));
- }
+ OSL_ENSURE(!aList.empty(), "Empty string list");
+
+ sStandardRegister = aList[0];
+ for( sal_uInt16 i = 1; i < aList.size(); i++ )
+ aRegisterLB.InsertEntry(aList[i]);
aRegisterCB .Show();
aRegisterFT .Show();
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 2b5e57e5d8bd..2b44a9ebd136 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -266,12 +266,11 @@ SvxLineTabPage::~SvxLineTabPage()
if(pSymbolList)
delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
- SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
- while( pInfo )
+ for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i )
{
+ SvxBmpItemInfo* pInfo = aGrfBrushItems[ i ];
delete pInfo->pBrushItem;
delete pInfo;
- pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
}
}
void SvxLineTabPage::Construct()
@@ -1485,7 +1484,11 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
pInfo->pBrushItem = pBrushItem;
pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
- aGrfBrushItems.Insert(pInfo, i);
+ if ( i < aGrfBrushItems.size() ) {
+ aGrfBrushItems.insert( aGrfBrushItems.begin() + i, pInfo );
+ } else {
+ aGrfBrushItems.push_back( pInfo );
+ }
const Graphic* pGraphic = pBrushItem->GetGraphic();
if(pGraphic)
@@ -1564,7 +1567,11 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
pInfo->pBrushItem = pBrushItem;
pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
- aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
+ if ( (size_t)(nNumMenuGalleryItems + i) < aGrfBrushItems.size() ) {
+ aGrfBrushItems.insert( aGrfBrushItems.begin() + nNumMenuGalleryItems + i, pInfo );
+ } else {
+ aGrfBrushItems.push_back( pInfo );
+ }
Size aSize(aBitmap.GetSizePixel());
if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
@@ -1596,9 +1603,9 @@ IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
SvxBmpItemInfo* pBmpInfo = 0;
- for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
+ for ( size_t i = 0; i < pThis->aGrfBrushItems.size(); i++ )
{
- SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
+ SvxBmpItemInfo* pInfo = pThis->aGrfBrushItems[ i ];
if( pInfo->pBrushItem == pItem )
{
pBmpInfo = pInfo; break;
@@ -1650,7 +1657,7 @@ IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
bResetSize = sal_True;
}
- SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
+ SvxBmpItemInfo* pInfo = aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ];
pGraphic = pInfo->pBrushItem->GetGraphic();
}
else switch(nItemId)
diff --git a/embedserv/prj/build.lst b/embedserv/prj/build.lst
index 189479e4bca3..a6cfd10ea298 100644
--- a/embedserv/prj/build.lst
+++ b/embedserv/prj/build.lst
@@ -1,4 +1,4 @@
-es embedserv : offuh sal cppu cppuhelper comphelper LIBXSLT:libxslt NULL
+es embedserv : offapi sal cppu cppuhelper comphelper LIBXSLT:libxslt NULL
es embedserv usr1 - w es_mkout NULL
es embedserv\source\embed nmake - w es_embed NULL
es embedserv\source\inprocserv nmake - w es_inproc NULL
diff --git a/embedserv/prj/d.lst b/embedserv/prj/d.lst
index e01fbabf84e0..292dfe821cd3 100644
--- a/embedserv/prj/d.lst
+++ b/embedserv/prj/d.lst
@@ -1,2 +1,2 @@
-..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
-..\%__SRC%\misc\emser.component %_DEST%\xml%_EXT%\emser.component
+..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll
+..\%__SRC%\misc\emser.component %_DEST%\xml\emser.component
diff --git a/embedserv/source/inc/embservconst.h b/embedserv/source/inc/embservconst.h
index e682ec4aa5ee..d045c7837b57 100644
--- a/embedserv/source/inc/embservconst.h
+++ b/embedserv/source/inc/embservconst.h
@@ -29,7 +29,7 @@
#ifndef _EMBSERVCONST_H_
#define _EMBSERVCONST_H_
-#include <initguid.h>
+#include <guiddef.h>
#ifndef _COMPHELPER_CLASSIDS_HXX
#include <comphelper/classids.hxx>
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 5866eb6a6c91..83a8d6ba581e 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -160,9 +160,14 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t)
return Any();
if ( ( t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) || t == getCppuType(static_cast<Reference<XAutomationInvocation>*>( 0)) ) && !m_spDispatch)
return Any();
-
- return WeakImplHelper7<XInvocation, XBridgeSupplier2,
- XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation>::queryInterface(t);
+ // XDirectInvocation seems to be an oracle replacement for XAutomationInvocation, however it is flawed esecially wrt. assumptions about whether to invoke a
+ // Put or Get property, the implementation code has no business guessing that, it's up to the caller to decide that. Worse XDirectInvocation duplicates lots of code.
+ // XAutomationInvocation provides seperate calls for put& get
+ // properties. Note: Currently the basic runtime doesn't call put properties directly, it should... after all the basic runtime should know whether it is calling a put or get property.
+ // For the moment for ease of merging we will let the XDirectInvoke and XAuthomationInvocation interfaces stay side by side ( and for the momemnt at least I would prefer the basic
+ // runtime to call XAutomationInvocation instead of XDirectInvoke
+ return WeakImplHelper8<XInvocation, XBridgeSupplier2,
+ XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >::queryInterface(t);
}
Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void)
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index f2882fc4417d..9282de1596ee 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -51,7 +51,7 @@
#endif
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
-#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/implbase8.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
@@ -84,7 +84,7 @@ typedef boost::unordered_multimap<OUString, unsigned int, hashOUString_Impl, equ
// This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
// If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
// The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
-class IUnknownWrapper_Impl : public WeakImplHelper7< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation >,
+class IUnknownWrapper_Impl : public WeakImplHelper8< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >,
public UnoConversionUtilities<IUnknownWrapper_Impl>
diff --git a/extensions/source/oooimprovement/onlogrotate_job.cxx b/extensions/source/oooimprovement/onlogrotate_job.cxx
index 255a324702f6..8dd9c60f1222 100644
--- a/extensions/source/oooimprovement/onlogrotate_job.cxx
+++ b/extensions/source/oooimprovement/onlogrotate_job.cxx
@@ -201,7 +201,7 @@ namespace oooimprovement
throw(RuntimeException)
{
Reference<XDesktop> xDesktop(
- m_ServiceFactory->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")),
+ m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),
UNO_QUERY);
if(xDesktop.is())
xDesktop->addTerminateListener(Reference<XTerminateListener>(new OnLogRotateThreadWatcher(m_ServiceFactory)));
diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
index d13068576663..b98ba85260d9 100644
--- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
+++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
@@ -94,7 +94,7 @@ extern "C" {
# endif
#endif
-#ifndef _NPAPI_H_
+#if ! defined ( _NPAPI_H_) && ! defined (npapi_h_)
extern "C" {
#include <npsdk/npupp.h>
}
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index ca4baaca2afb..62314f1ac7e6 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -75,6 +75,7 @@
#include <svx/svxdlg.hxx>
#include <svx/svxids.hrc>
#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
#include <map>
#include <algorithm>
@@ -942,7 +943,7 @@ namespace pcr
// DF definite problem here
// OK & Cancel seem to be both returning 0
- if ( pDialog->Execute() != 0 )
+ if ( pDialog->Execute() == RET_CANCEL )
return InteractiveSelectionResult_Cancelled;
try
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index c8217a734fae..75b61bda4195 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -693,9 +693,7 @@ namespace pcr
}
if ( !pColorTable )
- {
- pColorTable = XColorTable::GetStdColorTable();
- }
+ pColorTable = &XColorTable::GetStdColorTable();
DBG_ASSERT(pColorTable, "OColorControl::OColorControl: no color table!");
diff --git a/extensions/source/svg/makefile.mk b/extensions/source/svg/makefile.mk
deleted file mode 100644
index c46aede54920..000000000000
--- a/extensions/source/svg/makefile.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=extensions
-TARGET=svg
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-# --- Files -------------------------------------
-
-SLOFILES= $(SLO)$/svgprinter.obj \
- $(SLO)$/svguno.obj \
- $(SLO)$/svgwriter.obj \
- $(SLO)$/svgaction.obj
-
-# --- Library -----------------------------------
-
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1IMPLIB=i$(SHL1TARGET)
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-
-SHL1STDLIBS=\
- $(XMLOFFLIB) \
- $(VCLLIB) \
- $(TOOLSLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-SHL1LIBS= $(SLB)$/$(TARGET).lib
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/extensions/source/svg/svgaction.cxx b/extensions/source/svg/svgaction.cxx
deleted file mode 100644
index 8e8a7342d976..000000000000
--- a/extensions/source/svg/svgaction.cxx
+++ /dev/null
@@ -1,1461 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgaction.hxx"
-#include <vcl/virdev.hxx>
-#include <vcl/cvtgrf.hxx>
-#include <vcl/metric.hxx>
-
-#undef _SVG_USE_NATIVE_TEXTDECORATION
-#undef _SVG_USE_TSPANS
-
-// -----------
-// - statics -
-// -----------
-
-static const char aXMLElemSVG[] = "svg";
-static const char aXMLElemG[] = "g";
-static const char aXMLElemDefs[] = "defs";
-static const char aXMLElemClipPath[] = "clipPath";
-static const char aXMLElemLine[] = "line";
-static const char aXMLElemRect[] = "rect";
-static const char aXMLElemEllipse[] = "ellipse";
-static const char aXMLElemPath[] = "path";
-static const char aXMLElemPolygon[] = "polygon";
-static const char aXMLElemPolyLine[] = "polyline";
-static const char aXMLElemText[] = "text";
-static const char aXMLElemTSpan[] = "tspan";
-static const char aXMLElemImage[] = "image";
-
-static const char aXMLAttrTransform[] = "transform";
-static const char aXMLAttrStyle[] = "style";
-static const char aXMLAttrId[] = "id";
-
-static const char aXMLAttrD[] = "d";
-static const char aXMLAttrX[] = "x";
-static const char aXMLAttrY[] = "y";
-static const char aXMLAttrX1[] = "x1";
-static const char aXMLAttrY1[] = "y1";
-static const char aXMLAttrX2[] = "x2";
-static const char aXMLAttrY2[] = "y2";
-static const char aXMLAttrCX[] = "cx";
-static const char aXMLAttrCY[] = "cy";
-static const char aXMLAttrRX[] = "rx";
-static const char aXMLAttrRY[] = "ry";
-static const char aXMLAttrWidth[] = "width";
-static const char aXMLAttrHeight[] = "height";
-static const char aXMLAttrPoints[] = "points";
-static const char aXMLAttrXLinkHRef[] = "xlink:href";
-
-static const sal_Unicode pBase64[] =
-{
- //0 1 2 3 4 5 6 7
- 'A','B','C','D','E','F','G','H', // 0
- 'I','J','K','L','M','N','O','P', // 1
- 'Q','R','S','T','U','V','W','X', // 2
- 'Y','Z','a','b','c','d','e','f', // 3
- 'g','h','i','j','k','l','m','n', // 4
- 'o','p','q','r','s','t','u','v', // 5
- 'w','x','y','z','0','1','2','3', // 6
- '4','5','6','7','8','9','+','/' // 7
-};
-
-// --------------
-// - FastString -
-// --------------
-
-FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) :
- mpBuffer( new sal_Unicode[ nInitLen * sizeof( sal_Unicode ) ] ),
- mnBufLen( nInitLen ),
- mnCurLen( 0 ),
- mnBufInc( nIncrement ),
- mnPartPos( 0 )
-{
- DBG_ASSERT( nInitLen, "invalid initial length" );
- DBG_ASSERT( nIncrement, "invalid increment" );
-}
-
-// -----------------------------------------------------------------------------
-
-FastString::FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ) :
- mnBufInc( 2048 ),
- mnPartPos( 0 )
-{
- DBG_ASSERT( pBufferForBase64Encoding && nBufLen, "invalid arguments" );
-
- const sal_uInt32 nQuadCount = nBufLen / 3;
- const sal_uInt32 nRest = nBufLen % 3;
-
- if( nQuadCount || nRest )
- {
- mnBufLen = mnCurLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
- mpBuffer = new sal_Unicode[ mnBufLen * sizeof( sal_Unicode ) ];
-
- sal_Char* pTmpSrc = pBufferForBase64Encoding;
- sal_Unicode* pTmpDst = mpBuffer;
-
- for( sal_uInt32 i = 0; i < nQuadCount; i++ )
- {
- const sal_Int32 nA = *pTmpSrc++;
- const sal_Int32 nB = *pTmpSrc++;
- const sal_Int32 nC = *pTmpSrc++;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ];
- *pTmpDst++ = pBase64[ nC & 0x3f ];
- }
-
- if( 1 == nRest )
- {
- const sal_Int32 nA = *pTmpSrc;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ];
- *pTmpDst++ = '=';
- *pTmpDst = '=';
- }
- else if( 2 == nRest )
- {
- const sal_Int32 nA = *pTmpSrc++;
- const sal_Int32 nB = *pTmpSrc;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ];
- *pTmpDst = '=';
- }
- }
- else
- {
- mpBuffer = new sal_Unicode[ ( mnBufLen = 1 ) * sizeof( sal_Unicode ) ];
- mnCurLen = 0;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-FastString::~FastString()
-{
- delete[] mpBuffer;
-}
-
-// -----------------------------------------------------------------------------
-
-FastString& FastString::operator+=( const NMSP_RTL::OUString& rStr )
-{
- if( rStr.getLength() )
- {
- if( ( mnCurLen + rStr.getLength() ) > mnBufLen )
- {
- const sal_uInt32 nNewBufLen = ( mnBufLen + ( ( ( mnCurLen + rStr.getLength() ) - mnBufLen ) / mnBufInc + 1 ) * mnBufInc );
- sal_Unicode* pNewBuffer = new sal_Unicode[ nNewBufLen * sizeof( sal_Unicode ) ];
-
- memcpy( pNewBuffer, mpBuffer, mnBufLen * sizeof( sal_Unicode ) );
- delete[] mpBuffer;
- mpBuffer = pNewBuffer;
- mnBufLen = nNewBufLen;
- }
-
- memcpy( mpBuffer + mnCurLen, rStr.getStr(), rStr.getLength() * sizeof( sal_Unicode ) );
- mnCurLen += rStr.getLength();
-
- if( maString.getLength() )
- maString = NMSP_RTL::OUString();
- }
-
- return *this;
-}
-
-// -----------------------------------------------------------------------------
-
-const NMSP_RTL::OUString& FastString::GetString() const
-{
- if( !maString.getLength() && mnCurLen )
- ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
-
- return maString;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool FastString::GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
-{
- const sal_uInt32 nLength = Min( mnCurLen, nPartLen );
-
- mnPartPos = 0;
-
- if( nLength )
- {
- rPartString = NMSP_RTL::OUString( mpBuffer, nLength );
- mnPartPos = nLength;
- }
-
- return( rPartString.getLength() > 0 );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool FastString::GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
-{
- if( mnPartPos < mnCurLen )
- {
- const sal_uInt32 nLength = Min( mnCurLen - mnPartPos, nPartLen );
- rPartString = NMSP_RTL::OUString( mpBuffer + mnPartPos, nLength );
- mnPartPos += nLength;
- }
- else
- rPartString = NMSP_RTL::OUString();
-
- return( rPartString.getLength() > 0 );
-}
-
-// ----------------------
-// - SVGAttributeWriter -
-// ----------------------
-
-SVGAttributeWriter::SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport ) :
- mrParent( rParent ),
- mrExport( rExport ),
- mpElemFont( NULL ),
- mpElemPaint( NULL )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGAttributeWriter::~SVGAttributeWriter()
-{
- delete mpElemPaint;
- delete mpElemFont;
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
-{
- FastString aStyle;
-
- // font family
- aStyle += B2UCONST( "font-family:" );
- aStyle += NMSP_RTL::OUString( rFont.GetName().GetToken( 0, ';' ) );
-
- // font size
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-size:" );
- aStyle += mrParent.GetValueString( mrParent.ImplMap( Size( 0, rFont.GetHeight() ) ).Height(), mrParent.HasDoublePoints() );
-
- // font style
- if( rFont.GetItalic() != ITALIC_NONE )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-style:" );
-
- if( rFont.GetItalic() == ITALIC_OBLIQUE )
- aStyle += B2UCONST( "oblique" );
- else
- aStyle += B2UCONST( "italic" );
- }
-
- // font weight
- sal_Int32 nFontWeight;
-
- switch( rFont.GetWeight() )
- {
- case WEIGHT_THIN: nFontWeight = 100; break;
- case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
- case WEIGHT_LIGHT: nFontWeight = 300; break;
- case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
- case WEIGHT_NORMAL: nFontWeight = 400; break;
- case WEIGHT_MEDIUM: nFontWeight = 500; break;
- case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
- case WEIGHT_BOLD: nFontWeight = 700; break;
- case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
- case WEIGHT_BLACK: nFontWeight = 900; break;
- default: nFontWeight = 400; break;
- }
-
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-weight:" );
- aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
-
- // !!!
- // font-variant
- // font-stretch
- // font-size-adjust
-
-#ifdef _SVG_USE_NATIVE_TEXTDECORATION
-
- if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "text-decoration:" );
-
- if( rFont.GetUnderline() != UNDERLINE_NONE )
- aStyle += B2UCONST( " underline" );
-
- if( rFont.GetStrikeout() != STRIKEOUT_NONE )
- aStyle += B2UCONST( " line-through" );
- }
-
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- return aStyle.GetString();
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor )
-{
- FastString aStyle;
-
- // line color
- aStyle += B2UCONST( "stroke:" );
-
- if( rLineColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // line color value in rgb
- aStyle += B2UCONST( "rgb(" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetRed() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetGreen() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetBlue() );
- aStyle += B2UCONST( ")" );
-
- // line color opacity in percent if neccessary
- if( rLineColor.GetTransparency() )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rLineColor.GetTransparency() ) / 2.55 ) );
- aStyle += B2UCONST( "%" );
- }
- }
-
- // fill color
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill:" );
-
- if( rFillColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // fill color value in rgb
- aStyle += B2UCONST( "rgb(" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetRed() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetGreen() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetBlue() );
- aStyle += B2UCONST( ")" );
-
- // fill color opacity in percent if neccessary
- if( rFillColor.GetTransparency() )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rFillColor.GetTransparency() ) / 2.55 ) );
- aStyle += B2UCONST( "%" );
- }
- }
-
- return aStyle.GetString();
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGAttributeWriter::SetFontAttr( const Font& rFont )
-{
- if( !mpElemFont || ( rFont != maCurFont ) )
- {
- delete mpElemPaint, mpElemPaint = NULL;
- delete mpElemFont;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetFontStyle( maCurFont = rFont ) );
- mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFillColor )
-{
- if( !mpElemPaint || ( rLineColor != maCurLineColor ) || ( rFillColor != maCurFillColor ) )
- {
- delete mpElemPaint;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetPaintStyle( maCurLineColor = rLineColor, maCurFillColor = rFillColor ) );
- mpElemPaint = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-}
-
-// -------------------
-// - SVGActionWriter -
-// -------------------
-
-SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
- VirtualDevice* pParentVDev, sal_Bool bWriteDoublePoints ) :
- mrExport( rExport ),
- mrMtf( rMtf ),
- mpContext( NULL ),
- mnCurClipId( 1 ),
- mbClipAttrChanged( sal_False ),
- mbDoublePoints( bWriteDoublePoints )
-{
- if( pParentVDev )
- {
- mpVDev = pParentVDev;
- mbDestroyVDev = sal_False;
- maTargetMapMode = mpVDev->GetMapMode();
- }
- else
- {
- mpVDev = new VirtualDevice;
- mpVDev->EnableOutput( sal_False );
- mbDestroyVDev = sal_True;
- maTargetMapMode = MAP_100TH_MM;
- }
-
- mpVDev->Push();
- mpVDev->SetMapMode( mrMtf.GetPrefMapMode() );
- ImplWriteActions( mrMtf );
- mpVDev->Pop();
-}
-
-// -----------------------------------------------------------------------------
-
-SVGActionWriter::~SVGActionWriter()
-{
- DBG_ASSERT( !mpContext, "Not all contexts are closed" );
-
- if( mbDestroyVDev )
- delete mpVDev;
-}
-
-// -----------------------------------------------------------------------------
-
-long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
-{
- return ImplMap( Size( nVal, nVal ) ).Width();
-}
-
-// -----------------------------------------------------------------------------
-
-Point SVGActionWriter::ImplMap( const Point& rPt ) const
-{
- return mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
-}
-
-// -----------------------------------------------------------------------------
-
-Size SVGActionWriter::ImplMap( const Size& rSz ) const
-{
- return mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGActionWriter::GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints )
-{
- if( !bDoublePoints )
- return NMSP_RTL::OUString::valueOf( nVal );
- else
- {
- const double fPoints = nVal * 72.0 / 2540.0;
- const sal_Int32 nInt = (sal_Int32) fPoints;
-
- return( ( NMSP_RTL::OUString::valueOf( nInt ) +=
- NMSP_RTL::OUString::valueOf( (sal_Unicode) '.' ) ) +=
- NMSP_RTL::OUString::valueOf( labs( (sal_Int32) ( ( fPoints - nInt ) * 100.0 ) ) ) );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor,
- const NMSP_RTL::OUString* pStyle )
-{
- const Point aPt1( ImplMap( rPt1 ) );
- const Point aPt2( ImplMap( rPt2 ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPt1.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPt1.Y(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPt2.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPt2.Y(), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- if( pLineColor )
- {
- // !!! mrExport.AddAttribute( XML_NAMESPACE_NONE, ... )
- OSL_FAIL( "SVGActionWriter::ImplWriteLine: Line color not implemented" );
- }
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemLine, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
-{
- const Rectangle aRect( ImplMap( rRect ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight(), mbDoublePoints ) );
-
- if( nRadX )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
-
- if( nRadY )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemRect, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
-{
- const Point aCenter( ImplMap( rCenter ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, GetValueString( aCenter.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, GetValueString( aCenter.Y(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemEllipse, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPoly.GetSize() )
- {
- if( rPoly.HasFlags() )
- ImplWritePolyPolygon( rPoly, bLineOnly, pStyle );
- else
- {
- FastString aStyle;
- FastString aPoints;
- sal_uInt16 i = 0, nSize = rPoly.GetSize();
- const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
-
- // points
- while( i < nSize )
- {
- const Point aPolyPoint( ImplMap( rPoly[ i ] ) );
-
- aPoints += GetValueString( aPolyPoint.X(), mbDoublePoints );
- aPoints += B2UCONST( "," );
- aPoints += GetValueString( aPolyPoint.Y(), mbDoublePoints );
-
- if( ++i < nSize )
- aPoints += aBlank;
- }
-
- // style
- if( bLineOnly )
- {
- aStyle += B2UCONST( "fill:none" );
-
- if( pStyle )
- {
- aStyle += B2UCONST( ";" );
- aStyle += *pStyle;
- }
- }
- else if( pStyle )
- aStyle += *pStyle;
-
- // add point attribute
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPoints, aPoints.GetString() );
-
- // add style attribute
- if( aStyle.GetLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
-
- {
- // write polyline/polygon element
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, bLineOnly ? aXMLElemPolyLine : aXMLElemPolygon, sal_True, sal_True );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPolyPoly.Count() )
- {
- if( ( rPolyPoly.Count() == 1 ) && ( rPolyPoly[ 0 ].HasFlags() == sal_False ) )
- ImplWritePolygon( rPolyPoly[ 0 ], bLineOnly, pStyle );
- else
- {
- FastString aStyle;
- FastString aPathData;
- const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
- const NMSP_RTL::OUString aComma( B2UCONST( "," ) );
- Point aPolyPoint;
-
- for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
- {
- const Polygon& rPoly = rPolyPoly[ (sal_uInt16) i ];
- sal_uInt16 n = 1, nSize = rPoly.GetSize();
-
- if( nSize > 1 )
- {
- aPathData += B2UCONST( "M " );
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ 0 ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- sal_Char nCurrentMode = 0;
-
- while( n < nSize )
- {
- aPathData += aBlank;
- if ( ( rPoly.GetFlags( n ) == POLY_CONTROL ) && ( ( n + 2 ) < nSize ) )
- {
- if ( nCurrentMode != 'C' )
- {
- nCurrentMode = 'C';
- aPathData += B2UCONST( "C " );
- }
- for ( int j = 0; j < 3; j++ )
- {
- if ( j )
- aPathData += aBlank;
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ n++ ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- }
- }
- else
- {
- if ( nCurrentMode != 'L' )
- {
- nCurrentMode = 'L';
- aPathData += B2UCONST( "L " );
- }
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ n++ ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- }
- }
- aPathData += B2UCONST( " Z" );
-
- if( i < ( nCount - 1 ) )
- aPathData += aBlank;
- }
- }
- if( bLineOnly )
- {
- aStyle += B2UCONST( "fill:none" );
- if( pStyle )
- aStyle += B2UCONST( ";" );
- }
- if( pStyle )
- aStyle += *pStyle;
-
- // add style attribute
- if( aStyle.GetLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
-
- // add path data attribute
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, aPathData.GetString() );
- {
- // write polyline/polygon element
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, sal_True, sal_True );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPolyPoly.Count() )
- {
- SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- FastString aClipId;
- FastString aClipStyle;
-
- aClipId += B2UCONST( "clip" );
- aClipId += NMSP_RTL::OUString::valueOf( ImplGetNextClipId() );
-
- {
- SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aClipId.GetString() );
-
- {
- SvXMLElementExport aElemClipPath( mrExport, XML_NAMESPACE_NONE, aXMLElemClipPath, sal_True, sal_True );
- ImplWritePolyPolygon( rPolyPoly, sal_False );
- }
- }
-
- // create new context with clippath set
- aClipStyle += B2UCONST( "clip-path:URL(#" );
- aClipStyle += aClipId.GetString();
- aClipStyle += B2UCONST( ")" );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aClipStyle.GetString() );
-
- {
- GDIMetaFile aTmpMtf;
- SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
-
- mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
- const sal_Int32* pDXArray, long nWidth,
- const NMSP_RTL::OUString* pStyle )
-{
- String aText( rText ); aText.EraseLeadingChars( ' ' );
- sal_uInt32 nLen = aText.Len(), i;
-
- if( nLen )
- {
- Size aNormSize;
- sal_Int32* pOwnArray;
- sal_Int32* pDX;
-
- // get text sizes
- if( pDXArray )
- {
- pOwnArray = NULL;
- aNormSize = Size( mpVDev->GetTextWidth( aText ), 0 );
- pDX = const_cast< sal_Int32* >( pDXArray );
- }
- else
- {
- pOwnArray = new sal_Int32[ nLen ];
- aNormSize = Size( mpVDev->GetTextArray( aText, pOwnArray ), 0 );
- pDX = pOwnArray;
- }
-
- if( nLen > 1 )
- {
- aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( aText.GetChar( (sal_uInt16) nLen - 1 ) );
-
- if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
- {
- const double fFactor = (double) nWidth / aNormSize.Width();
-
- for( i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
- }
- }
-
- FastString aStyle;
- const Font& rFont = mpVDev->GetFont();
- const FontMetric aMetric( mpVDev->GetFontMetric() );
- Point aBaseLinePos( rPos );
- SvXMLElementExport* pTransform = NULL;
-
- // leading whitespaces erased? => adjust position
- if( nLen < rText.Len() )
- {
- aBaseLinePos.X() += mpVDev->GetTextWidth( ' ' ) * ( rText.Len() - nLen );
- }
-
- // always adjust text position to match baseline alignment
- switch( rFont.GetAlign() )
- {
- case( ALIGN_TOP ):
- aBaseLinePos.Y() += aMetric.GetAscent();
- break;
-
- case( ALIGN_BOTTOM ):
- aBaseLinePos.Y() -= aMetric.GetDescent();
- break;
-
- default:
- break;
- }
-
- // get mapped text position
- const Point aPt( ImplMap( aBaseLinePos ) );
-
- // if text is rotated, set transform at new g element
- if( rFont.GetOrientation() )
- {
- String aTransform;
-
- aTransform = NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM("translate"));
- aTransform += '(';
- aTransform += String( GetValueString( aPt.X(), mbDoublePoints ) );
- aTransform += ',';
- aTransform += String( GetValueString( aPt.Y(), mbDoublePoints ) );
- aTransform += ')';
-
- aTransform += String( NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(" rotate")) );
- aTransform += '(';
- aTransform += String( NMSP_RTL::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
- aTransform += ')';
-
- aTransform += String( NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(" translate")) );
- aTransform += '(';
- aTransform += String( GetValueString( -aPt.X(), mbDoublePoints ) );
- aTransform += ',';
- aTransform += String( GetValueString( -aPt.Y(), mbDoublePoints ) );
- aTransform += ')';
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
- pTransform = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-
- // add additional style if requested
- if( pStyle && pStyle->getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- // write text element
-#ifdef _SVG_USE_TSPANS
- if( pDXArray )
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- FastString aTSpanX;
- const NMSP_RTL::OUString aSpace( ' ' );
- long i, nX, nCount;
-
- aTSpanX += GetValueString( aPt.X(), mbDoublePoints );
- aTSpanX += aSpace;
-
- for( i = 0, nX = aPt.X(), nCount = ( nLen - 1 ); i < nCount; )
- {
- aTSpanX += GetValueString( aPt.X() + pDX[ i++ ], mbDoublePoints );
- aTSpanX += aSpace;
- }
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
-
- {
- try
- {
- try
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
- }
- catch( ::com::sun::star::xml::sax::SAXException& )
- {
- // string seems to contain invalid characters
- }
- }
- }
- }
- else
-#endif
- {
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
-
- try
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
- }
- catch( ::com::sun::star::xml::sax::SAXException& )
- {
- // string seems to contain invalid characters
- }
- }
-
-#ifndef _SVG_USE_NATIVE_TEXTDECORATION
-
- // write strikeout if neccessary
- if( ( rFont.GetStrikeout() != STRIKEOUT_NONE ) || ( rFont.GetUnderline() != UNDERLINE_NONE ) )
- {
- Polygon aPoly( 4 );
- const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
-
- if( rFont.GetStrikeout() )
- {
- const long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
-
- aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
- aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
- aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
- aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
-
- ImplWritePolygon( aPoly, sal_False );
- }
-
- if( rFont.GetUnderline() )
- {
- const long nYLinePos = aBaseLinePos.Y() + ( nLineHeight << 1 );
-
- aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
- aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
- aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
- aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
-
- ImplWritePolygon( aPoly, sal_False );
- }
- }
-
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- delete[] pOwnArray;
- delete pTransform;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
- const Point& rPt, const Size& rSz,
- const Point& rSrcPt, const Size& rSrcSz,
- const NMSP_RTL::OUString* /*pStyle*/ )
-{
- if( !!rBmpEx )
- {
- BitmapEx aBmpEx( rBmpEx );
- Point aPoint = Point();
- const Rectangle aBmpRect( aPoint, rBmpEx.GetSizePixel() );
- const Rectangle aSrcRect( rSrcPt, rSrcSz );
-
- if( aSrcRect != aBmpRect )
- aBmpEx.Crop( aSrcRect );
-
- if( !!aBmpEx )
- {
- SvMemoryStream aOStm( 65535, 65535 );
-
- if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
- {
- const Point aPt( ImplMap( rPt ) );
- const Size aSz( ImplMap( rSz ) );
- FastString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell() );
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- {
- static const sal_uInt32 nPartLen = 64;
- const NMSP_RTL::OUString aSpace( ' ' );
- const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
- NMSP_RTL::OUString aString;
- NMSP_RTL::OUString aImageString;
-
- aString = aLineFeed;
- aString += B2UCONST( "<" );
- aString += NMSP_RTL::OUString::createFromAscii( aXMLElemImage );
- aString += aSpace;
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrX );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aPt.X(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrY );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aPt.Y(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrWidth );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aSz.Width(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrHeight );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aSz.Height(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrXLinkHRef );
- aString += B2UCONST( "=\"data:image/png;base64," );
-
- if( aImageData.GetFirstPartString( nPartLen, aImageString ) )
- {
- xExtDocHandler->unknown( aString += aImageString );
-
- while( aImageData.GetNextPartString( nPartLen, aImageString ) )
- {
- xExtDocHandler->unknown( aLineFeed );
- xExtDocHandler->unknown( aImageString );
- }
- }
-
- xExtDocHandler->unknown( B2UCONST( "\"/>" ) );
- }
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle )
-{
- ImplAcquireContext();
-
- for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; i++ )
- {
- const MetaAction* pAction = rMtf.GetAction( i );
- const sal_uInt16 nType = pAction->GetType();
-
- switch( nType )
- {
- case( META_PIXEL_ACTION ):
- {
- const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
-
- mpContext->SetPaintAttr( pA->GetColor(), pA->GetColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor(), pStyle );
- }
- break;
-
- case( META_POINT_ACTION ):
- {
- const MetaPointAction* pA = (const MetaPointAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL, pStyle );
- }
- break;
-
- case( META_LINE_ACTION ):
- {
- const MetaLineAction* pA = (const MetaLineAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL, pStyle );
- }
- break;
-
- case( META_RECT_ACTION ):
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0, pStyle );
- }
- break;
-
- case( META_ROUNDRECT_ACTION ):
- {
- const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound(), pStyle );
- }
- break;
-
- case( META_ELLIPSE_ACTION ):
- {
- const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
- const Rectangle& rRect = pA->GetRect();
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1, pStyle );
- }
- break;
-
- case( META_ARC_ACTION ):
- case( META_PIE_ACTION ):
- case( META_CHORD_ACTION ):
- case( META_POLYGON_ACTION ):
- {
- Polygon aPoly;
-
- switch( nType )
- {
- case( META_ARC_ACTION ):
- {
- const MetaArcAction* pA = (const MetaArcAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
- }
- break;
-
- case( META_PIE_ACTION ):
- {
- const MetaPieAction* pA = (const MetaPieAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
- }
- break;
-
- case( META_CHORD_ACTION ):
- {
- const MetaChordAction* pA = (const MetaChordAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
- }
- break;
-
- case( META_POLYGON_ACTION ):
- aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
- break;
- }
-
- if( aPoly.GetSize() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolygon( aPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_POLYLINE_ACTION ):
- {
- const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
- const Polygon& rPoly = pA->GetPolygon();
-
- if( rPoly.GetSize() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolygon( rPoly, sal_True, pStyle );
- }
- }
- break;
-
- case( META_POLYPOLYGON_ACTION ):
- {
- const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
- const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
-
- if( rPolyPoly.Count() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_GRADIENT_ACTION ):
- {
- const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
- GDIMetaFile aTmpMtf;
-
- mpVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- break;
-
- case( META_GRADIENTEX_ACTION ):
- {
- const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
- ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), pStyle );
- }
- break;
-
- case META_HATCH_ACTION:
- {
- const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
- GDIMetaFile aTmpMtf;
-
- mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- break;
-
- case( META_TRANSPARENT_ACTION ):
- {
- const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
- const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
-
- if( rPolyPoly.Count() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_FLOATTRANSPARENT_ACTION ):
- {
- const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
- GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
- Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
- const Size aSrcSize( aTmpMtf.GetPrefSize() );
- const Point aDestPt( pA->GetPoint() );
- const Size aDestSize( pA->GetSize() );
- const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
- const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
- long nMoveX, nMoveY;
-
- if( fScaleX != 1.0 || fScaleY != 1.0 )
- {
- aTmpMtf.Scale( fScaleX, fScaleY );
- aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
- }
-
- nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
-
- if( nMoveX || nMoveY )
- aTmpMtf.Move( nMoveX, nMoveY );
-
- mpVDev->Push();
- ImplWriteActions( aTmpMtf, pStyle );
- mpVDev->Pop();
- }
- break;
-
- case( META_EPS_ACTION ):
- {
- const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
- const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
- sal_Bool bFound = sal_False;
-
- for( size_t j = 0, nCount2 = aGDIMetaFile.GetActionSize(); ( j < nCount2 ) && !bFound; j++ )
- {
- const MetaAction* pSubstAct = aGDIMetaFile.GetAction( j );
-
- if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
- {
- bFound = sal_True;
- const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pBmpScaleAction->GetBitmap(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
- }
- }
- }
- break;
-
- case( META_COMMENT_ACTION ):
- {
- const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
- String aSkipComment;
-
- if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
- {
- const MetaGradientExAction* pGradAction = NULL;
- sal_Bool bDone = sal_False;
-
- while( !bDone && ( ++i < nCount ) )
- {
- pAction = rMtf.GetAction( i );
-
- if( pAction->GetType() == META_GRADIENTEX_ACTION )
- pGradAction = (const MetaGradientExAction*) pAction;
- else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
- ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
- {
- bDone = sal_True;
- }
- }
-
- if( pGradAction )
- ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pStyle );
- }
- }
- break;
-
- case( META_BMP_ACTION ):
- {
- const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPSCALE_ACTION ):
- {
- const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPSCALEPART_ACTION ):
- {
- const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
- }
- break;
-
- case( META_BMPEX_ACTION ):
- {
- const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPEXSCALE_ACTION ):
- {
- const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPEXSCALEPART_ACTION ):
- {
- const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
- }
- break;
-
- case( META_TEXT_ACTION ):
- {
- const MetaTextAction* pA = (const MetaTextAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
- }
- break;
-
- case( META_TEXTRECT_ACTION ):
- {
- const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0, pStyle );
- }
- break;
-
- case( META_TEXTARRAY_ACTION ):
- {
- const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
- const Point aPos( ImplMap( pA->GetPoint() ) );
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0, pStyle );
- }
- break;
-
- case( META_STRETCHTEXT_ACTION ):
- {
- const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth(), pStyle );
- }
- break;
-
- case( META_CLIPREGION_ACTION ):
- case( META_ISECTRECTCLIPREGION_ACTION ):
- case( META_ISECTREGIONCLIPREGION_ACTION ):
- case( META_MOVECLIPREGION_ACTION ):
- {
- ( (MetaAction*) pAction )->Execute( mpVDev );
- mbClipAttrChanged = sal_True;
- }
- break;
-
- case( META_REFPOINT_ACTION ):
- case( META_MAPMODE_ACTION ):
- case( META_LINECOLOR_ACTION ):
- case( META_FILLCOLOR_ACTION ):
- case( META_TEXTLINECOLOR_ACTION ):
- case( META_TEXTFILLCOLOR_ACTION ):
- case( META_TEXTCOLOR_ACTION ):
- case( META_TEXTALIGN_ACTION ):
- case( META_FONT_ACTION ):
- case( META_PUSH_ACTION ):
- case( META_POP_ACTION ):
- {
- ( (MetaAction*) pAction )->Execute( mpVDev );
- }
- break;
-
- case( META_RASTEROP_ACTION ):
- case( META_MASK_ACTION ):
- case( META_MASKSCALE_ACTION ):
- case( META_MASKSCALEPART_ACTION ):
- case( META_WALLPAPER_ACTION ):
- case( META_TEXTLINE_ACTION ):
- case( META_LAYOUTMODE_ACTION ):
- {
- // !!! >>> we don't want to support these actions
- }
- break;
-
-#ifdef DBG_UTIL
- default :
- ByteString aDbgOut( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" );
- aDbgOut.Append( ByteString::CreateFromInt32( nType ) );
- OSL_FAIL( aDbgOut.GetBuffer() );
- break;
-#endif
- }
- }
-
- ImplReleaseContext();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgaction.hxx b/extensions/source/svg/svgaction.hxx
deleted file mode 100644
index 309d20aec6b4..000000000000
--- a/extensions/source/svg/svgaction.hxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGACTION_HXX
-#define _SVGACTION_HXX
-
-#include "svgcom.hxx"
-
-// --------------
-// - FastString -
-// --------------
-
-class FastString
-{
-private:
-
- NMSP_RTL::OUString maString;
- sal_Unicode* mpBuffer;
- sal_uInt32 mnBufLen;
- sal_uInt32 mnCurLen;
- sal_uInt32 mnBufInc;
- sal_uInt32 mnPartPos;
-
-public:
-
- FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 );
- FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen );
- ~FastString();
-
- FastString& operator+=( const NMSP_RTL::OUString& rStr );
-
- const NMSP_RTL::OUString& GetString() const;
- sal_Bool GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
- sal_Bool GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
-
- sal_uInt32 GetLength() const { return mnCurLen; }
- void Clear() { mnCurLen = 0, maString = NMSP_RTL::OUString(); }
-};
-
-// ----------------------
-// - SVGAttributeWriter -
-// ----------------------
-
-class SVGActionWriter;
-
-class SVGAttributeWriter
-{
-private:
-
- Font maCurFont;
- Color maCurLineColor;
- Color maCurFillColor;
- SVGActionWriter& mrParent;
- SvXMLExport& mrExport;
- SvXMLElementExport* mpElemFont;
- SvXMLElementExport* mpElemPaint;
-
- SVGAttributeWriter();
-
-public:
-
- SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport );
- virtual ~SVGAttributeWriter();
-
- NMSP_RTL::OUString GetFontStyle( const Font& rFont );
- NMSP_RTL::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor );
-
- void SetFontAttr( const Font& rFont );
- void SetPaintAttr( const Color& rLineColor, const Color& rFillColor );
-};
-
-// -------------------
-// - SVGActionWriter -
-// -------------------
-
-class SVGAttributeWriter;
-class SvXMLExport;
-class GDIMetaFile;
-
-class SVGActionWriter
-{
- friend class SVGAttributeWriter;
-
-private:
-
- Stack maContextStack;
- SvXMLExport& mrExport;
- const GDIMetaFile& mrMtf;
- SVGAttributeWriter* mpContext;
- VirtualDevice* mpVDev;
- MapMode maTargetMapMode;
- sal_Int32 mnCurClipId;
- sal_Bool mbDestroyVDev;
- sal_Bool mbPaintAttrChanged;
- sal_Bool mbFontAttrChanged;
- sal_Bool mbClipAttrChanged;
- sal_Bool mbDoublePoints;
-
- SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( *this, mrExport ) ); return mpContext; }
- void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
-
- long ImplMap( sal_Int32 nVal ) const;
- Point ImplMap( const Point& rPt ) const;
- Size ImplMap( const Size& rSz ) const;
- inline Rectangle ImplMap( const Rectangle& rRect ) const { return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) ); }
-
- void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const NMSP_RTL::OUString* pStyle = NULL );
-
- void ImplCheckFontAttributes();
- void ImplCheckPaintAttributes();
-
- void ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle = NULL );
-
- sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
-
- SVGActionWriter();
-
-public:
-
- static NMSP_RTL::OUString GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints );
-
-public:
-
- SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
- VirtualDevice* pParentVDev = NULL,
- sal_Bool bWriteDoublePoints = sal_False );
- virtual ~SVGActionWriter();
-
- const VirtualDevice& GetVDev() const { return *mpVDev; }
- sal_Bool HasDoublePoints() const { return mbDoublePoints; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgcom.hxx b/extensions/source/svg/svgcom.hxx
deleted file mode 100644
index b43beeb611e9..000000000000
--- a/extensions/source/svg/svgcom.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGCOM_HXX
-#define _SVGCOM_HXX
-
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
-#include <tools/debug.hxx>
-#include <tools/stream.hxx>
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/stack.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/metaact.hxx>
-
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/svg/XSVGWriter.hpp>
-#include <com/sun/star/svg/XSVGPrinter.hpp>
-#include <xmloff/xmlexp.hxx>
-#include <xmloff/nmspmap.hxx>
-
-// -----------------------------------------------------------------------------
-
-#define NMSP_CPPU cppu
-#define NMSP_RTL rtl
-#define NMSP_UNO com::sun::star::uno
-#define NMSP_LANG com::sun::star::lang
-#define NMSP_SAX com::sun::star::xml::sax
-#define NMSP_SVG com::sun::star::svg
-#define NMSP_REGISTRY com::sun::star::registry
-
-
-#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
-#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
-#define ANY NMSP_UNO::Any
-#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
-#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" )
-
-#endif // _SYNCCOM_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgprinter.cxx b/extensions/source/svg/svgprinter.cxx
deleted file mode 100644
index 288f5bac5d22..000000000000
--- a/extensions/source/svg/svgprinter.cxx
+++ /dev/null
@@ -1,331 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#define _RMPRINTER_EXT
-
-#include "svgprinter.hxx"
-#include "svgaction.hxx"
-#include <uno/mapping.hxx>
-#include <vcl/print.hxx>
-#include <vcl/virdev.hxx>
-
-static const char aXMLElemSVG[] = "svg";
-static const char aXMLElemMetaSVG[] = "staroffice:svgElementMeta";
-static const char aXMLElemDesc[] = "desc";
-static const char aXMLElemMeta[] = "metadata";
-static const char aXMLElemRect[] = "rect";
-
-static const char aXMLAttrMetaSVGOuter[] = "isOuterElement";
-static const char aXMLAttrMetaSVGPage[] = "isPageElement";
-static const char aXMLAttrViewBox[] = "viewBox";
-static const char aXMLAttrX[] = "x";
-static const char aXMLAttrY[] = "y";
-static const char aXMLAttrWidth[] = "width";
-static const char aXMLAttrHeight[] = "height";
-
-// ----------------
-// - SVGMtfExport -
-// ----------------
-
-class SVGPrinterExport : public SvXMLExport
-{
-private:
-
- Printer maPrinter;
- VirtualDevice* mpVDev;
- SvXMLElementExport* mpOuterElement;
- sal_uInt32 mnPage;
-
- SVGPrinterExport();
-
- SvXMLElementExport* ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize );
- void ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage );
-
-protected:
-
- virtual void _ExportMeta() {}
- virtual void _ExportStyles( sal_Bool /*bUsed*/ ) {}
- virtual void _ExportAutoStyles() {}
- virtual void _ExportContent() {}
- virtual void _ExportMasterStyles() {}
- virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) { (void)eClass; return 0; }
-
-public:
-
- // #110680#
- SVGPrinterExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const JobSetup& rSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies,
- sal_Bool bCollate );
-
- virtual ~SVGPrinterExport();
-
- virtual void writePage( const JobSetup& rJobSetup, const GDIMetaFile& rMtf );
-};
-
-// -----------------------------------------------------------------------------
-
-// #110680#
-SVGPrinterExport::SVGPrinterExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const JobSetup& rSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 /*nCopies*/,
- sal_Bool /*bCollate*/ )
-: SvXMLExport( xServiceFactory, NMSP_RTL::OUString(), rxHandler ),
- mpVDev( NULL ),
- mnPage( 0 )
-{
- maPrinter.SetJobSetup( rSetup );
-
- GetDocHandler()->startDocument();
-
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- {
- NMSP_RTL::OUString aString;
- const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
-
- // intro
- xExtDocHandler->unknown( ( aString = SVG_DTD_STRING ) += aLineFeed );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT metadata (#PCDATA | staroffice:svgElementMeta)*> " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT staroffice:svgElementMeta ANY> " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ATTLIST staroffice:svgElementMeta " ) += aLineFeed ) );
-
- // ATTLIST
- xExtDocHandler->unknown( ( aString = B2UCONST( "isOuterElement (true | false) \"false\" " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "isPageElement (true | false) \"true\"" ) += aLineFeed ) );
-
- // end of intro
- xExtDocHandler->unknown( ( aString = B2UCONST( ">" ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "]>" ) ) );
- }
-
- // create outer element
- Size aOutputSize;
-
- mpOuterElement = ImplCreateSVGElement( rSetup, aOutputSize );
-
- // write description
- SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, sal_True, sal_True );
- NMSP_RTL::OUString aDesc( B2UCONST( "document name: " ) );
-
- GetDocHandler()->characters( aDesc += rJobName );
- delete pDescElem;
-
- // write meta attributes
- ImplWriteMetaAttr( sal_True, sal_False );
-}
-
-// -----------------------------------------------------------------------------
-
-SVGPrinterExport::~SVGPrinterExport()
-{
- delete mpOuterElement;
- GetDocHandler()->endDocument();
- delete mpVDev;
-}
-
-// -----------------------------------------------------------------------------
-
-SvXMLElementExport* SVGPrinterExport::ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize )
-{
- NMSP_RTL::OUString aAttr;
-
- delete mpVDev;
- mpVDev = new VirtualDevice;
- mpVDev->EnableOutput( sal_False );
- mpVDev->SetMapMode( MAP_100TH_MM );
- maPrinter.SetJobSetup( rSetup );
-
- rOutputSize = maPrinter.PixelToLogic( maPrinter.GetOutputSizePixel(), mpVDev->GetMapMode() );
-
- aAttr = SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
-
- aAttr = B2UCONST( "0.0 0.0 " );
- aAttr += SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
- aAttr += B2UCONST( " " );
- aAttr += SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrViewBox, aAttr );
-
- return( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemSVG, sal_True, sal_True ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGPrinterExport::ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage )
-{
- SvXMLElementExport aMetaData( *this, XML_NAMESPACE_NONE, aXMLElemMeta, sal_True, sal_True );
- NMSP_RTL::OUString aAttr;
-
- aAttr = bOuter ? B2UCONST( "true" ) : B2UCONST( "false" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGOuter, aAttr );
-
- aAttr = bPage ? B2UCONST( "true" ) : B2UCONST( "false" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGPage, aAttr );
-
- {
- delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemMetaSVG, sal_True, sal_True ) );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGPrinterExport::writePage( const JobSetup& rSetup, const GDIMetaFile& rMtf )
-{
- Size aOutputSize;
- NMSP_RTL::OUString aAttr;
- SvXMLElementExport* pPageElem = ImplCreateSVGElement( rSetup, aOutputSize );
-
- // write description
- SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, sal_True, sal_True );
- NMSP_RTL::OUString aDesc( B2UCONST( "page: " ) );
-
- GetDocHandler()->characters( aDesc += NMSP_RTL::OUString::valueOf( (sal_Int32) ++mnPage ) );
- delete pDescElem;
-
- // write meta attributes
- ImplWriteMetaAttr( sal_False, sal_True );
-
- // write dummy rect element
- aAttr = B2UCONST( "0.0" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aAttr );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( aOutputSize.Width(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( aOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
-
- delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemRect, sal_True, sal_True ) );
- delete( new SVGActionWriter( *this, rMtf, mpVDev, sal_True ) );
-
- delete pPageElem;
-}
-
-// --------------
-// - SVGPrinter -
-// --------------
-
-SVGPrinter::SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
- mxFact( rxMgr ),
- mpWriter( NULL )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGPrinter::~SVGPrinter()
-{
- delete mpWriter;
-}
-
-// -----------------------------------------------------------------------------
-
-
-ANY SAL_CALL SVGPrinter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
-{
- const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGPrinter* >( this ) ) );
-
- return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::acquire() throw()
-{
- OWeakObject::acquire();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::release() throw()
-{
- OWeakObject::release();
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool SAL_CALL SVGPrinter::startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const SEQ( sal_Int8 )& rJobSetupSeq,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException )
-{
- const sal_Bool bRet = ( mpWriter == NULL );
-
- if( bRet )
- {
- SvMemoryStream aMemStm( (char*) rJobSetupSeq.getConstArray(), rJobSetupSeq.getLength(), STREAM_READ );
- JobSetup aJobSetup;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aJobSetup;
-
- const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxHandler );
-
- // #110680#
- // mpWriter = new SVGPrinterExport( xDocumentHandler, aJobSetup, rJobName, nCopies, bCollate );
- mpWriter = new SVGPrinterExport( mxFact, xDocumentHandler, aJobSetup, rJobName, nCopies, bCollate );
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException )
-{
- SvMemoryStream aMemStm( (char*) rPrintPage.getConstArray(), rPrintPage.getLength(), STREAM_READ );
- PrinterPage aPage;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aPage;
- mpWriter->writePage( aPage.GetJobSetup(), *aPage.GetGDIMetaFile() );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::endJob() throw( NMSP_UNO::RuntimeException )
-{
- delete mpWriter, mpWriter = NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgprinter.hxx b/extensions/source/svg/svgprinter.hxx
deleted file mode 100644
index bbc29a06b6f8..000000000000
--- a/extensions/source/svg/svgprinter.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGPRINTER_HXX
-#define _SVGPRINTER_HXX
-
-#include "svgcom.hxx"
-
-// -------------
-// - SVGWriter -
-// -------------
-
-class SVGPrinterExport;
-
-class SVGPrinter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGPrinter
-{
-private:
-
- REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
- SVGPrinterExport* mpWriter;
-
- SVGPrinter();
-
-public:
-
- SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
- virtual ~SVGPrinter();
-
- // XInterface
- virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XSVGPrinter
- virtual sal_Bool SAL_CALL startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const SEQ( sal_Int8 )& rJobSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL endJob() throw( NMSP_UNO::RuntimeException );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svguno.cxx b/extensions/source/svg/svguno.cxx
deleted file mode 100644
index 615f700542d4..000000000000
--- a/extensions/source/svg/svguno.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgcom.hxx"
-#include "svgwriter.hxx"
-#include "svgprinter.hxx"
-
-#include <cppuhelper/factory.hxx>
-#include <uno/mapping.hxx>
-
-// -------------------
-// - factory methods -
-// -------------------
-
-static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
-{
- return REF( NMSP_UNO::XInterface )( *new SVGWriter( rxFact ) );
-}
-
-// -----------------------------------------------------------------------------
-
-static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
-{
- return REF( NMSP_UNO::XInterface )( *new SVGPrinter( rxFact ) );
-}
-
-// ------------------------------------------
-// - component_getImplementationEnvironment -
-// ------------------------------------------
-
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-// ------------------------
-// - component_getFactory -
-// ------------------------
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
-{
- REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
- void* pRet = 0;
-
- if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGWriter" ) == 0 )
- {
- const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGWriter" ) );
-
- xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
- reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
- B2UCONST( "com.sun.star.comp.extensions.SVGWriter" ),
- create_SVGWriter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
- }
- else if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGPrinter" ) == 0 )
- {
- const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGPrinter" ) );
-
- xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
- reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
- B2UCONST( "com.sun.star.comp.extensions.SVGPrinter" ),
- create_SVGPrinter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgwriter.cxx b/extensions/source/svg/svgwriter.cxx
deleted file mode 100644
index e89c69e4b4e1..000000000000
--- a/extensions/source/svg/svgwriter.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgwriter.hxx"
-#include "svgaction.hxx"
-#include <uno/mapping.hxx>
-
-// ----------------
-// - SVGMtfExport -
-// ----------------
-
-class SVGMtfExport : public SvXMLExport
-{
-private:
-
- SVGMtfExport();
-
-protected:
-
- virtual void _ExportMeta() {}
- virtual void _ExportStyles( sal_Bool /*bUsed*/ ) {}
- virtual void _ExportAutoStyles() {}
- virtual void _ExportContent() {}
- virtual void _ExportMasterStyles() {}
- virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /*eClass*/ ) { return 0; }
-
-public:
-
- SVGMtfExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler );
-
- virtual ~SVGMtfExport();
-
- virtual void writeMtf( const GDIMetaFile& rMtf );
-};
-
-// -----------------------------------------------------------------------------
-
-SVGMtfExport::SVGMtfExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler )
-: SvXMLExport( xServiceFactory, NMSP_RTL::OUString(), rxHandler )
-{
- GetDocHandler()->startDocument();
-}
-
-// -----------------------------------------------------------------------------
-
-SVGMtfExport::~SVGMtfExport()
-{
- GetDocHandler()->endDocument();
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGMtfExport::writeMtf( const GDIMetaFile& rMtf )
-{
- const Size aSize( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_MM ) );
- NMSP_RTL::OUString aAttr;
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- xExtDocHandler->unknown( SVG_DTD_STRING );
-
- aAttr = NMSP_RTL::OUString::valueOf( aSize.Width() );
- aAttr += B2UCONST( "mm" );
- AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
-
- aAttr = NMSP_RTL::OUString::valueOf( aSize.Height() );
- aAttr += B2UCONST( "mm" );
- AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
-
- aAttr = B2UCONST( "0 0 " );
- aAttr += NMSP_RTL::OUString::valueOf( aSize.Width() * 100L );
- aAttr += B2UCONST( " " );
- aAttr += NMSP_RTL::OUString::valueOf( aSize.Height() * 100L );
- AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
-
- {
- SvXMLElementExport aSVG( *this, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
- SVGActionWriter* pWriter = new SVGActionWriter( *this, rMtf );
-
- delete pWriter;
- }
-}
-
-// -------------
-// - SVGWriter -
-// -------------
-
-SVGWriter::SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
- mxFact( rxMgr )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGWriter::~SVGWriter()
-{
-}
-
-// -----------------------------------------------------------------------------
-
-
-ANY SAL_CALL SVGWriter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
-{
- const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGWriter* >( this ) ) );
-
- return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::acquire() throw()
-{
- OWeakObject::acquire();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::release() throw()
-{
- OWeakObject::release();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
- const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException )
-{
- SvMemoryStream aMemStm( (char*) rMtfSeq.getConstArray(), rMtfSeq.getLength(), STREAM_READ );
- GDIMetaFile aMtf;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aMtf;
-
- const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxDocHandler );
-
- SVGMtfExport* pWriter = new SVGMtfExport( mxFact, xDocumentHandler );
-
- pWriter->writeMtf( aMtf );
- delete pWriter;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/Jobs.xcu b/extensions/source/update/check/Jobs.xcu
index ed324650c66f..840d630698cb 100644
--- a/extensions/source/update/check/Jobs.xcu
+++ b/extensions/source/update/check/Jobs.xcu
@@ -8,7 +8,7 @@
</prop>
<node oor:name="Arguments">
<prop oor:name="AutoCheckEnabled" oor:type="xs:boolean" oor:op="replace">
- <value>false</value>
+ <value>true</value>
</prop>
<prop oor:name="LastCheck" oor:type="xs:long" oor:op="replace">
<value>0</value>
diff --git a/extensions/source/update/tools/ztool.cxx b/extensions/source/update/tools/ztool.cxx
index fbcf02e66a65..78b7186dd089 100644
--- a/extensions/source/update/tools/ztool.cxx
+++ b/extensions/source/update/tools/ztool.cxx
@@ -37,11 +37,7 @@ void show_usage()
fputs("ztool usage: ztool <source> <dest>\n", stderr);
}
-int
-#ifdef WNT
-__cdecl
-#endif
-main( int argc, char **argv )
+int SAL_CALL main( int argc, char **argv )
{
if ( argc != 3 )
{
diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx
index fe780c7a2ecc..388a902afa94 100644
--- a/extensions/test/ole/OleClient/clientTest.cxx
+++ b/extensions/test/ole/OleClient/clientTest.cxx
@@ -82,7 +82,7 @@ void printResultVariantArray( VARIANT & var);
void printVariant( VARIANT & var);
void printSequence( Sequence<Any>& val);
-extern "C" int __cdecl main( int , char **)
+extern "C" int SAL_CALL main( int , char **)
{
HRESULT hr;
if( FAILED( hr=CoInitialize(NULL)))
diff --git a/extensions/test/ole/OleConverterVar1/convTest.cxx b/extensions/test/ole/OleConverterVar1/convTest.cxx
index c9955d40d169..e430ad225f7c 100644
--- a/extensions/test/ole/OleConverterVar1/convTest.cxx
+++ b/extensions/test/ole/OleConverterVar1/convTest.cxx
@@ -74,7 +74,7 @@ void printVariant( VARIANT & var);
-int __cdecl _tmain( int argc, _TCHAR * argv[] )
+int SAL_CALL _tmain( int argc, _TCHAR * argv[] )
{
HRESULT hr;
if( FAILED( hr=CoInitialize(NULL)))
diff --git a/extensions/test/ole/cppToUno/testcppuno.cxx b/extensions/test/ole/cppToUno/testcppuno.cxx
index 80d93dfb731c..42210be75ecb 100644
--- a/extensions/test/ole/cppToUno/testcppuno.cxx
+++ b/extensions/test/ole/cppToUno/testcppuno.cxx
@@ -61,7 +61,7 @@ bool incrementMultidimensionalIndex(
const sal_Int32 * parDimensionLengths,
sal_Int32 * parMultidimensionalIndex);
-int __cdecl _tmain( int /*argc*/, _TCHAR * /*argv[]*/ )
+int SAL_CALL _tmain( int /*argc*/, _TCHAR * /*argv[]*/ )
{
HRESULT hr;
if( FAILED( hr=CoInitialize(NULL)))
diff --git a/forms/Library_frm.mk b/forms/Library_frm.mk
index f99dcb82c7f8..91ec3b0c549c 100644
--- a/forms/Library_frm.mk
+++ b/forms/Library_frm.mk
@@ -38,6 +38,12 @@ $(eval $(call gb_Library_set_include,frm,\
-I$(OUTDIR)/inc \
))
+$(eval $(call gb_Library_add_api,frm,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
$(eval $(call gb_Library_add_linked_libs,frm,\
comphelper \
cppu \
diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl
index a4bb19333bf5..66e02dc8d8c4 100644
--- a/forms/qa/unoapi/knownissues.xcl
+++ b/forms/qa/unoapi/knownissues.xcl
@@ -129,9 +129,3 @@ forms.OGridControlModel::com::sun::star::view::XSelectionSupplier
### i111333 ###
forms.OImageControlControl::com::sun::star::awt::XControl
-
-### fd#35728 ###
-forms.OGridControlModel::com::sun::star::form::component::GridControl
-forms.OGridControlModel::com::sun::star::beans::XMultiPropertySet
-forms.OGridControlModel::com::sun::star::beans::XPropertySet
-forms.OGridControlModel::com::sun::star::beans::XFastPropertySet
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index 9bc330360e56..d75ef8b5df68 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -42,13 +42,15 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/text/XText.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/property.hxx>
#include <comphelper/basicio.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/servicehelper.hxx>
#include "services.hxx"
#include "frm_resource.hrc"
#include <tools/debug.hxx>
-#include <rtl/uuid.h>
#include <rtl/memory.h>
//.........................................................................
@@ -63,6 +65,7 @@ using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::text;
using namespace ::com::sun::star::form::binding;
const sal_uInt16 WIDTH = 0x0001;
@@ -121,21 +124,14 @@ sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
/*************************************************************************/
-//------------------------------------------------------------------
+namespace
+{
+ class theOGridColumnImplementationId : public rtl::Static< UnoTunnelIdInit, theOGridColumnImplementationId > {};
+}
+
const Sequence<sal_Int8>& OGridColumn::getUnoTunnelImplementationId()
{
- static Sequence< sal_Int8 > * pSeq = 0;
- if( !pSeq )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pSeq )
- {
- static Sequence< sal_Int8 > aSeq( 16 );
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
- pSeq = &aSeq;
- }
- }
- return *pSeq;
+ return theOGridColumnImplementationId::get().getSeq();
}
//------------------------------------------------------------------
@@ -173,6 +169,7 @@ Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
aTypes.removeType( XServiceInfo::static_type() );
aTypes.removeType( XBindableValue::static_type() );
aTypes.removeType( XPropertyContainer::static_type() );
+
// but re-add their base class(es)
aTypes.addType( XChild::static_type() );
@@ -180,6 +177,10 @@ Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
if ( query_aggregation( m_xAggregate, xProv ))
aTypes.addTypes( xProv->getTypes() );
+ aTypes.removeType( XTextRange::static_type() );
+ aTypes.removeType( XSimpleText::static_type() );
+ aTypes.removeType( XText::static_type() );
+
return aTypes.getTypes();
}
@@ -192,6 +193,7 @@ Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeE
|| _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL)))
|| _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL)))
|| _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL)))
+ || comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType)
)
return aReturn;
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 78fa5df14c25..c09e9f6cf3b9 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -163,7 +163,7 @@ private:
if ( m_xDocumentModify.is() )
_enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified();
}
- catch( const Exception& )
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -410,7 +410,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) );
}
}
- catch( const Exception& )
+ catch(const Exception&)
{
throw WrappedTargetException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given database form." ) ),
@@ -1173,7 +1173,7 @@ bool ODatabaseForm::hasValidParent() const
// the parent form is loaded and on a "virtual" row -> not valid
return false;
}
- catch(Exception&)
+ catch(const Exception&)
{
// parent could be forwardonly?
return false;
@@ -1261,11 +1261,10 @@ sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNot
m_xAggregateAsRowSet->execute();
bSuccess = sal_True;
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
_rClearForNotifies.clear();
if (m_sCurrentErrorContext.getLength())
@@ -1307,7 +1306,7 @@ sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNot
xUpdate->moveToInsertRow();
}
}
- catch(SQLException& eDB)
+ catch(const SQLException& eDB)
{
_rClearForNotifies.clear();
if (m_sCurrentErrorContext.getLength())
@@ -1750,7 +1749,9 @@ void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const A
{
m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, rValue);
}
- catch(Exception&) { }
+ catch(const Exception&)
+ {
+ }
}
break;
case PROPERTY_ID_TARGET_URL:
@@ -2051,7 +2052,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners)
if ( aDefault.hasValue() )
xColUpdate->updateObject( aDefault );
}
- catch(Exception&)
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -2059,7 +2060,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners)
}
}
}
- catch(Exception&)
+ catch(const Exception&)
{
}
@@ -2419,7 +2420,7 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com
Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW );
xParentProperties->removePropertyChangeListener( PROPERTY_ISNEW, this );
}
- catch( const Exception& )
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -2441,7 +2442,7 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com
Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW );
xParentProperties->addPropertyChangeListener( PROPERTY_ISNEW, this );
}
- catch( const Exception& )
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -2871,11 +2872,11 @@ sal_Bool ODatabaseForm::implEnsureConnection()
return xConnection.is();
}
}
- catch(SQLException& eDB)
+ catch(const SQLException& eDB)
{
onError(eDB, FRM_RES_STRING(RID_STR_CONNECTERROR));
}
- catch( Exception )
+ catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -2904,7 +2905,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs
// a database form always uses caching
// we use starting fetchsize with at least 10 rows
if (bConnected)
- m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10));
+ m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40));
// if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded"
// so we don't need to execute the statement again, this was already done
@@ -2962,9 +2963,8 @@ void SAL_CALL ODatabaseForm::unload() throw( RuntimeException )
if (xCloseable.is())
xCloseable->close();
}
- catch( const SQLException& e )
+ catch(const SQLException&)
{
- (void)e;
}
aGuard.reset();
}
@@ -3020,10 +3020,9 @@ void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInterac
m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_REFRESHING_FORM);
bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler);
}
- catch( const SQLException& e )
+ catch(const SQLException&)
{
OSL_FAIL("ODatabaseForm::reload_impl : shouldn't executeRowSet catch this exception?");
- (void)e;
}
if (bSuccess)
@@ -3122,19 +3121,22 @@ bool ODatabaseForm::impl_approveRowChange_throw( const EventObject& _rEvent, con
if ( !xListener->approveRowSetChange( _rEvent ) )
return false;
}
- catch ( const DisposedException& e )
+ catch (const DisposedException& e)
{
if ( e.Context == xListener )
aIter.remove();
}
- catch ( const RuntimeException& ) { throw; }
- catch ( const SQLException& )
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const SQLException&)
{
if ( _bAllowSQLException )
throw;
DBG_UNHANDLED_EXCEPTION();
}
- catch ( const Exception& )
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -3163,13 +3165,16 @@ sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event) thr
if ( !xListener->approveCursorMove( event ) )
return sal_False;
}
- catch ( const DisposedException& e )
+ catch (const DisposedException& e)
{
if ( e.Context == xListener )
aIter.remove();
}
- catch ( const RuntimeException& ) { throw; }
- catch ( const Exception& )
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -3209,13 +3214,16 @@ sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event) t
if ( !xListener->approveRowChange( event ) )
return false;
}
- catch ( const DisposedException& e )
+ catch (const DisposedException& e)
{
if ( e.Context == xListener )
aIter.remove();
}
- catch ( const RuntimeException& ) { throw; }
- catch ( const Exception& )
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -3499,12 +3507,11 @@ void SAL_CALL ODatabaseForm::insertRow() throw( SQLException, RuntimeException )
if (query_aggregation( m_xAggregate, xUpdate))
xUpdate->insertRow();
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto;
throw;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD));
throw;
@@ -3520,12 +3527,11 @@ void SAL_CALL ODatabaseForm::updateRow() throw( SQLException, RuntimeException )
if (query_aggregation( m_xAggregate, xUpdate))
xUpdate->updateRow();
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto;
throw;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
onError(eDb, FRM_RES_STRING(RID_STR_ERR_UPDATERECORD));
throw;
@@ -3541,12 +3547,11 @@ void SAL_CALL ODatabaseForm::deleteRow() throw( SQLException, RuntimeException )
if (query_aggregation( m_xAggregate, xUpdate))
xUpdate->deleteRow();
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto;
throw;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORD));
throw;
@@ -3562,12 +3567,11 @@ void SAL_CALL ODatabaseForm::cancelRowUpdates() throw( SQLException, RuntimeExce
if (query_aggregation( m_xAggregate, xUpdate))
xUpdate->cancelRowUpdates();
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto;
throw;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD));
throw;
@@ -3627,12 +3631,11 @@ Sequence<sal_Int32> SAL_CALL ODatabaseForm::deleteRows(const Sequence<Any>& rows
if (query_aggregation( m_xAggregate, xDelete))
return xDelete->deleteRows(rows);
}
- catch( const RowSetVetoException& eVeto )
+ catch(const RowSetVetoException&)
{
- (void)eVeto; // make compiler happy
throw;
}
- catch(SQLException& eDb)
+ catch(const SQLException& eDb)
{
onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORDS));
throw;
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index d745a1b3837a..7d2fa43756f5 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -485,7 +485,7 @@ namespace
{
_rxDest->setPropertyValue( pSourceProps->Name, _rxSource->getPropertyValue( pSourceProps->Name ) );
}
- catch( IllegalArgumentException e )
+ catch(const IllegalArgumentException& e)
{
#if OSL_DEBUG_LEVEL > 0
::rtl::OString sMessage( "could not transfer the property named '" );
@@ -497,6 +497,8 @@ namespace
sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
}
OSL_FAIL( sMessage.getStr() );
+#else
+ (void)e;
#endif
}
@@ -675,7 +677,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
void OEditModel::resetNoBroadcast()
{
OEditBaseModel::resetNoBroadcast();
- m_aLastKnownValue.clear();
}
//------------------------------------------------------------------------------
@@ -683,38 +684,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aNewValue != m_aLastKnownValue )
- {
- ::rtl::OUString sNewValue;
- aNewValue >>= sNewValue;
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
- if ( !aNewValue.hasValue()
- || ( !sNewValue.getLength() // an empty string
- && m_bEmptyIsNull // which should be interpreted as NULL
- )
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
)
+ )
+ {
+ m_xColumnUpdate->updateNull();
+ }
+ else
+ {
+ OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
+ try
{
- m_xColumnUpdate->updateNull();
- }
- else
- {
- OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
- try
+ if ( m_pValueFormatter.get() )
{
- if ( m_pValueFormatter.get() )
- {
- if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
- return sal_False;
- }
- else
- m_xColumnUpdate->updateString( sNewValue );
- }
- catch ( const Exception& )
- {
- return sal_False;
+ if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
+ return sal_False;
}
+ else
+ m_xColumnUpdate->updateString( sNewValue );
+ }
+ catch ( const Exception& )
+ {
+ return sal_False;
}
- m_aLastKnownValue = aNewValue;
}
return sal_True;
@@ -724,6 +721,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
Any OEditModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" );
+ Any aRet;
if ( m_pValueFormatter.get() )
{
::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() );
@@ -732,7 +730,6 @@ Any OEditModel::translateDbColumnToControlValue()
&& m_pValueFormatter->getColumn()->wasNull()
)
{
- m_aLastKnownValue.clear();
}
else
{
@@ -744,14 +741,11 @@ Any OEditModel::translateDbColumnToControlValue()
sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() );
}
- m_aLastKnownValue <<= sValue;
+ aRet <<= sValue;
}
}
- else
- m_aLastKnownValue.clear();
- return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
- // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
+ return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() );
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index e3c84612443f..bbe7063c66f1 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -45,7 +45,6 @@ namespace frm
class OEditModel
:public OEditBaseModel
{
- ::com::sun::star::uno::Any m_aLastKnownValue;
::std::auto_ptr< ::dbtools::FormattedColumnValue >
m_pValueFormatter;
sal_Bool m_bMaxTextLenModified : 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index 69643053bed8..4decc560fa4b 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -631,19 +631,39 @@ namespace frm
if (xListBox.is())
{
m_aText = aText;
- xListBox->selectItem(m_aText, sal_True);
- if ( xListBox->getSelectedItemPos() >= 0 )
+ MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( m_aText );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
{
- const bool isQuoted = ( aText.getLength() > 0 )
- && ( aText[0] == '\'' )
- && ( aText[aText.getLength() - 1] == '\'' );
+ const bool isQuoted = ( m_aText.getLength() > 1 )
+ && ( m_aText[0] == '\'' )
+ && ( m_aText[ m_aText.getLength() - 1 ] == '\'' );
if ( isQuoted )
{
- xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True );
+ m_aText = m_aText.copy( 1, m_aText.getLength() - 2 );
+ itemPos = m_aDisplayItemToValueItem.find( m_aText );
}
}
+
+ OSL_ENSURE( ( itemPos != m_aDisplayItemToValueItem.end() ) || ( m_aText.getLength() == 0 ),
+ "OFilterControl::setText: this text is not in my display list!" );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
+ m_aText = ::rtl::OUString();
+
+ if ( m_aText.getLength() == 0)
+ {
+ while ( xListBox->getSelectedItemPos() >= 0 )
+ {
+ xListBox->selectItemPos( xListBox->getSelectedItemPos(), sal_False );
+ }
+ }
+ else
+ {
+ xListBox->selectItem( m_aText, sal_True );
+ }
}
- } break;
+ }
+ break;
+
default:
{
Reference< XTextComponent > xText( getPeer(), UNO_QUERY );
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 871385c207a6..9d0170078da1 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -1038,10 +1038,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
m_xColumnUpdate->updateNull();
else
{
- // als Value koennen nur double, string oder void auftreten
try
{
- if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE )
+ double f = 0.0;
+ if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
{
DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
}
diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx
index 93746147f3cd..c89a2001e057 100644
--- a/forms/source/resource/frm_resource.cxx
+++ b/forms/source/resource/frm_resource.cxx
@@ -59,9 +59,7 @@ namespace frm
if (m_pImpl)
return;
- ByteString sFileName("frm");
-
- m_pImpl = SimpleResMgr::Create(sFileName.GetBuffer(), Application::GetSettings().GetUILocale());
+ m_pImpl = SimpleResMgr::Create("frm", Application::GetSettings().GetUILocale());
if (m_pImpl)
{
diff --git a/lingucomponent/prj/d.lst b/lingucomponent/prj/d.lst
index 4760a299c84d..690135049bb5 100644
--- a/lingucomponent/prj/d.lst
+++ b/lingucomponent/prj/d.lst
@@ -1,53 +1,53 @@
-..\%__SRC%\bin\*.dat %_DEST%\bin%_EXT%\*.dat
-..\%__SRC%\bin\*.idx %_DEST%\bin%_EXT%\*.idx
-..\%__SRC%\bin\*.aff %_DEST%\bin%_EXT%\*.aff
-..\%__SRC%\bin\*.dic %_DEST%\bin%_EXT%\*.dic
-..\%__SRC%\bin\*.lst %_DEST%\bin%_EXT%\*.lst
-
-..\%__SRC%\bin\lnth* %_DEST%\bin%_EXT%\lnth*
-..\%__SRC%\lib\ilnth* %_DEST%\lib%_EXT%\ilnth*
-..\%__SRC%\lib\liblnth.a %_DEST%\lib%_EXT%\liblnth.a
-..\%__SRC%\lib\liblnth*.dylib %_DEST%\lib%_EXT%\liblnth*.dylib
-..\%__SRC%\lib\liblnth*.so %_DEST%\lib%_EXT%\liblnth*.so
-
-..\%__SRC%\bin\spell* %_DEST%\bin%_EXT%\spell*
-..\%__SRC%\lib\ilspell* %_DEST%\lib%_EXT%\ilspell*
-..\%__SRC%\lib\libspell*.dylib %_DEST%\lib%_EXT%\libspell*.dylib
-..\%__SRC%\lib\libspell*.so %_DEST%\lib%_EXT%\libspell*.so
-
-..\%__SRC%\bin\hunspell* %_DEST%\bin%_EXT%\hunspell*
-..\%__SRC%\lib\ilhunspell* %_DEST%\lib%_EXT%\ilhunspell*
-..\%__SRC%\lib\libhunspell*.dylib %_DEST%\lib%_EXT%\libhunspell*.dylib
-..\%__SRC%\lib\libhunspell*.so %_DEST%\lib%_EXT%\libhunspell*.so
-
-..\%__SRC%\bin\hyph* %_DEST%\bin%_EXT%\hyph*
-..\%__SRC%\lib\ihyph* %_DEST%\lib%_EXT%\ihyph*
-..\%__SRC%\lib\libhnj.* %_DEST%\lib%_EXT%\libhnj.*
-..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
-..\%__SRC%\lib\libhyphen*.so %_DEST%\lib%_EXT%\libhyphen*.so
-
-..\%__SRC%\bin\ulingu* %_DEST%\bin%_EXT%\ulingu*
-..\%__SRC%\lib\ilulingu* %_DEST%\lib%_EXT%\iulingu*
-..\%__SRC%\lib\libulingu.a %_DEST%\lib%_EXT%\libulingu.a
-..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
-
-..\%__SRC%\bin\guesslan* %_DEST%\bin%_EXT%\guesslan*
-..\%__SRC%\lib\iguesslang* %_DEST%\lib%_EXT%\iguesslang*
-..\%__SRC%\lib\libguesslang*.dylib %_DEST%\lib%_EXT%\libguesslang*.dylib
-..\%__SRC%\lib\libguesslang*.so %_DEST%\lib%_EXT%\libguesslang*.so
-
-..\%__SRC%\lib\libMacOSXSpell*.dylib %_DEST%\lib%_EXT%\libMacOSXSpell*.dylib
-
-
-mkdir: %_DEST%\xml%_EXT%\registry
-mkdir: %_DEST%\xml%_EXT%\registry\data
-mkdir: %_DEST%\xml%_EXT%\registry\data\org
-mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice
-mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office
-..\config\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\*.xcu
-
-..\%__SRC%\misc\MacOSXSpell.component %_DEST%\xml%_EXT%\MacOSXSpell.component
-..\%__SRC%\misc\guesslang.component %_DEST%\xml%_EXT%\guesslang.component
-..\%__SRC%\misc\hyphen.component %_DEST%\xml%_EXT%\hyphen.component
-..\%__SRC%\misc\lnth.component %_DEST%\xml%_EXT%\lnth.component
-..\%__SRC%\misc\spell.component %_DEST%\xml%_EXT%\spell.component
+..\%__SRC%\bin\*.dat %_DEST%\bin\*.dat
+..\%__SRC%\bin\*.idx %_DEST%\bin\*.idx
+..\%__SRC%\bin\*.aff %_DEST%\bin\*.aff
+..\%__SRC%\bin\*.dic %_DEST%\bin\*.dic
+..\%__SRC%\bin\*.lst %_DEST%\bin\*.lst
+
+..\%__SRC%\bin\lnth* %_DEST%\bin\lnth*
+..\%__SRC%\lib\ilnth* %_DEST%\lib\ilnth*
+..\%__SRC%\lib\liblnth.a %_DEST%\lib\liblnth.a
+..\%__SRC%\lib\liblnth*.dylib %_DEST%\lib\liblnth*.dylib
+..\%__SRC%\lib\liblnth*.so %_DEST%\lib\liblnth*.so
+
+..\%__SRC%\bin\spell* %_DEST%\bin\spell*
+..\%__SRC%\lib\ilspell* %_DEST%\lib\ilspell*
+..\%__SRC%\lib\libspell*.dylib %_DEST%\lib\libspell*.dylib
+..\%__SRC%\lib\libspell*.so %_DEST%\lib\libspell*.so
+
+..\%__SRC%\bin\hunspell* %_DEST%\bin\hunspell*
+..\%__SRC%\lib\ilhunspell* %_DEST%\lib\ilhunspell*
+..\%__SRC%\lib\libhunspell*.dylib %_DEST%\lib\libhunspell*.dylib
+..\%__SRC%\lib\libhunspell*.so %_DEST%\lib\libhunspell*.so
+
+..\%__SRC%\bin\hyph* %_DEST%\bin\hyph*
+..\%__SRC%\lib\ihyph* %_DEST%\lib\ihyph*
+..\%__SRC%\lib\libhnj.* %_DEST%\lib\libhnj.*
+..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
+..\%__SRC%\lib\libhyphen*.so %_DEST%\lib\libhyphen*.so
+
+..\%__SRC%\bin\ulingu* %_DEST%\bin\ulingu*
+..\%__SRC%\lib\ilulingu* %_DEST%\lib\iulingu*
+..\%__SRC%\lib\libulingu.a %_DEST%\lib\libulingu.a
+..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib
+
+..\%__SRC%\bin\guesslan* %_DEST%\bin\guesslan*
+..\%__SRC%\lib\iguesslang* %_DEST%\lib\iguesslang*
+..\%__SRC%\lib\libguesslang*.dylib %_DEST%\lib\libguesslang*.dylib
+..\%__SRC%\lib\libguesslang*.so %_DEST%\lib\libguesslang*.so
+
+..\%__SRC%\lib\libMacOSXSpell*.dylib %_DEST%\lib\libMacOSXSpell*.dylib
+
+
+mkdir: %_DEST%\xml\registry
+mkdir: %_DEST%\xml\registry\data
+mkdir: %_DEST%\xml\registry\data\org
+mkdir: %_DEST%\xml\registry\data\org\openoffice
+mkdir: %_DEST%\xml\registry\data\org\openoffice\Office
+..\config\*.xcu %_DEST%\xml\registry\data\org\openoffice\Office\*.xcu
+
+..\%__SRC%\misc\MacOSXSpell.component %_DEST%\xml\MacOSXSpell.component
+..\%__SRC%\misc\guesslang.component %_DEST%\xml\guesslang.component
+..\%__SRC%\misc\hyphen.component %_DEST%\xml\hyphen.component
+..\%__SRC%\misc\lnth.component %_DEST%\xml\lnth.component
+..\%__SRC%\misc\spell.component %_DEST%\xml\spell.component
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index e54cc7471407..1f8a5089efce 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -95,15 +95,15 @@ Hyphenator::Hyphenator() :
numdict = 0;
}
-
Hyphenator::~Hyphenator()
{
if (numdict && aDicts)
{
- for (int i=0; i < numdict; i++)
+ for (int i=0; i < numdict; ++i)
{
- if (aDicts[i].apCC) delete aDicts[i].apCC;
- aDicts[i].apCC = NULL;
+ delete aDicts[i].apCC;
+ if (aDicts[i].aPtr)
+ hnj_hyphen_free(aDicts[i].aPtr);
}
}
delete[] aDicts;
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
index bc5d1ae66e93..c09723d52a92 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
@@ -32,9 +32,7 @@ TARGET = hyphen_lib
ENABLE_EXCEPTIONS=TRUE
USE_DEFFILE=TRUE
-.IF "$(GUI)"=="OS2"
-HNJLIB=hyphen.lib
-.ELIF "$(GUI)"=="UNX" || "$(COM)"=="GCC"
+.IF "$(GUI)"=="UNX" || "$(COM)"=="GCC"
HNJLIB=-lhyphen
.ELSE
HNJLIB=hyphen.lib
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index e210c2e7e501..31bcadce6d0b 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -76,8 +76,8 @@ using ::rtl::OString;
///////////////////////////////////////////////////////////////////////////
-SpellChecker::SpellChecker() :
- aEvtListeners ( GetLinguMutex() )
+SpellChecker::SpellChecker()
+ : aEvtListeners(GetLinguMutex())
{
aDicts = NULL;
aDEncs = NULL;
@@ -88,25 +88,24 @@ SpellChecker::SpellChecker() :
numdict = 0;
}
-
SpellChecker::~SpellChecker()
{
if (aDicts)
{
- for (int i = 0; i < numdict; i++)
+ for (int i = 0; i < numdict; ++i)
{
- if (aDicts[i]) delete aDicts[i];
+ delete aDicts[i];
aDicts[i] = NULL;
}
delete[] aDicts;
}
aDicts = NULL;
numdict = 0;
- if (aDEncs) delete[] aDEncs;
+ delete[] aDEncs;
aDEncs = NULL;
- if (aDLocs) delete[] aDLocs;
+ delete[] aDLocs;
aDLocs = NULL;
- if (aDNames) delete[] aDNames;
+ delete[] aDNames;
aDNames = NULL;
if (pPropHelper)
{
diff --git a/lingucomponent/source/thesaurus/libnth/makefile.mk b/lingucomponent/source/thesaurus/libnth/makefile.mk
index d204fb2c7c1b..1cbecd32dd83 100644
--- a/lingucomponent/source/thesaurus/libnth/makefile.mk
+++ b/lingucomponent/source/thesaurus/libnth/makefile.mk
@@ -37,9 +37,6 @@ USE_DEFFILE=TRUE
.IF "$(GUI)"=="UNX"
MYTHESLIB=-lmythes
.ENDIF # unx
-.IF "$(GUI)"=="OS2"
-MYTHESLIB=$(SLB)\libmythes.lib
-.ENDIF # os2
.IF "$(GUI)"=="WNT"
MYTHESLIB=libmythes.lib
.ENDIF # wnt
diff --git a/package/inc/EncryptedDataHeader.hxx b/package/inc/EncryptedDataHeader.hxx
index ed0ffe6628e3..43487ac88ea0 100644
--- a/package/inc/EncryptedDataHeader.hxx
+++ b/package/inc/EncryptedDataHeader.hxx
@@ -32,22 +32,26 @@
/* The structure of this header is as follows:
- Header signature 4 bytes
- Version number 2 bytes
- Iteraction count 4 bytes
- Size 4 bytes
- Salt length 2 bytes
- IV length 2 bytes
- Digest length 2 bytes
- MediaType length 2 bytes
- Salt content X bytes
- IV content X bytes
- digest content X bytes
- MediaType X bytes
+ Header signature 4 bytes
+ Version number 2 bytes
+ Iteraction count 4 bytes
+ Size 4 bytes
+ EncAlgorithm 4 bytes
+ DigestAlgorithm 4 bytes
+ DerivedKeySize 4 bytes
+ StartKeyAlgorithm 4 bytes
+ Salt length 2 bytes
+ IV length 2 bytes
+ Digest length 2 bytes
+ MediaType length 2 bytes
+ Salt content X bytes
+ IV content X bytes
+ digest content X bytes
+ MediaType X bytes
*/
-const sal_uInt32 n_ConstHeader = 0x0502474dL; // "MG\002\005"
-const sal_Int32 n_ConstHeaderSize = 22; // + salt length + iv length + digest length + mediatype length
+const sal_uInt32 n_ConstHeader = 0x05024d4dL; // "MM\002\005"
+const sal_Int32 n_ConstHeaderSize = 38; // + salt length + iv length + digest length + mediatype length
const sal_Int16 n_ConstCurrentVersion = 1;
#endif
diff --git a/package/inc/EncryptionData.hxx b/package/inc/EncryptionData.hxx
index ab2a658208c9..283b0b94caea 100644
--- a/package/inc/EncryptionData.hxx
+++ b/package/inc/EncryptionData.hxx
@@ -31,16 +31,54 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/weak.hxx>
-class EncryptionData : public cppu::OWeakObject
+class BaseEncryptionData : public cppu::OWeakObject
{
public:
- // On export aKey holds the derived key
- // On import aKey holds the hash of the user enterred key
- com::sun::star::uno::Sequence < sal_Int8 > aKey;
- com::sun::star::uno::Sequence < sal_uInt8 > aSalt, aInitVector, aDigest;
- sal_Int32 nIterationCount;
- EncryptionData(): nIterationCount ( 0 ){}
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSalt;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aInitVector;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aDigest;
+ sal_Int32 m_nIterationCount;
+
+ BaseEncryptionData()
+ : m_nIterationCount ( 0 ){}
+
+ BaseEncryptionData( const BaseEncryptionData& aData )
+ : cppu::OWeakObject()
+ , m_aSalt( aData.m_aSalt )
+ , m_aInitVector( aData.m_aInitVector )
+ , m_aDigest( aData.m_aDigest )
+ , m_nIterationCount( aData.m_nIterationCount )
+ {}
};
+
+class EncryptionData : public BaseEncryptionData
+{
+public:
+ ::com::sun::star::uno::Sequence < sal_Int8 > m_aKey;
+ sal_Int32 m_nEncAlg;
+ sal_Int32 m_nCheckAlg;
+ sal_Int32 m_nDerivedKeySize;
+ sal_Int32 m_nStartKeyGenID;
+
+ EncryptionData( const BaseEncryptionData& aData, const ::com::sun::star::uno::Sequence< sal_Int8 >& aKey, sal_Int32 nEncAlg, sal_Int32 nCheckAlg, sal_Int32 nDerivedKeySize, sal_Int32 nStartKeyGenID )
+ : BaseEncryptionData( aData )
+ , m_aKey( aKey )
+ , m_nEncAlg( nEncAlg )
+ , m_nCheckAlg( nCheckAlg )
+ , m_nDerivedKeySize( nDerivedKeySize )
+ , m_nStartKeyGenID( nStartKeyGenID )
+ {}
+
+ EncryptionData( const EncryptionData& aData )
+ : BaseEncryptionData( aData )
+ , m_aKey( aData.m_aKey )
+ , m_nEncAlg( aData.m_nEncAlg )
+ , m_nCheckAlg( aData.m_nCheckAlg )
+ , m_nDerivedKeySize( aData.m_nDerivedKeySize )
+ , m_nStartKeyGenID( aData.m_nStartKeyGenID )
+ {}
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/inc/PackageConstants.hxx b/package/inc/PackageConstants.hxx
index 7dd4d78a4e9b..be82010175fc 100644
--- a/package/inc/PackageConstants.hxx
+++ b/package/inc/PackageConstants.hxx
@@ -32,21 +32,39 @@
const sal_Int32 n_ConstBufferSize = 32768;
const sal_Int32 n_ConstMaxMemoryStreamSize = 20480;
+
+// by calculation of the digest we read 32 bytes more ( if available )
+// it allows to ignore the padding if the stream is longer than n_ConstDigestDecrypt since we read at least two blocks more;
+// if the stream is shorter or equal the padding will be done successfully
const sal_Int32 n_ConstDigestLength = 1024;
+const sal_Int32 n_ConstDigestDecrypt = 1056; // 1024 + 32
// the constants related to the manifest.xml entries
-#define PKG_MNFST_MEDIATYPE 0
-#define PKG_MNFST_VERSION 1
-#define PKG_MNFST_FULLPATH 2
+#define PKG_MNFST_MEDIATYPE 0
+#define PKG_MNFST_VERSION 1
+#define PKG_MNFST_FULLPATH 2
-#define PKG_MNFST_INIVECTOR 3
-#define PKG_MNFST_SALT 4
-#define PKG_MNFST_ITERATION 5
-#define PKG_MNFST_UCOMPSIZE 6
-#define PKG_MNFST_DIGEST 7
+#define PKG_MNFST_INIVECTOR 3
+#define PKG_MNFST_SALT 4
+#define PKG_MNFST_ITERATION 5
+#define PKG_MNFST_UCOMPSIZE 6
+#define PKG_MNFST_DIGEST 7
+#define PKG_MNFST_ENCALG 8
+#define PKG_MNFST_STARTALG 9
+#define PKG_MNFST_DIGESTALG 10
+#define PKG_MNFST_DERKEYSIZE 11
#define PKG_SIZE_NOENCR_MNFST 3
-#define PKG_SIZE_ENCR_MNFST 8
+#define PKG_SIZE_ENCR_MNFST 12
+
+// the properties related constants
+#define ENCRYPTION_KEY_PROPERTY "EncryptionKey"
+#define STORAGE_ENCRYPTION_KEYS_PROPERTY "StorageEncryptionKeys"
+#define ENCRYPTION_ALGORITHMS_PROPERTY "EncryptionAlgorithms"
+#define HAS_ENCRYPTED_ENTRIES_PROPERTY "HasEncryptedEntries"
+#define HAS_NONENCRYPTED_ENTRIES_PROPERTY "HasNonEncryptedEntries"
+#define IS_INCONSISTENT_PROPERTY "IsInconsistent"
+#define MEDIATYPE_FALLBACK_USED_PROPERTY "MediaTypeFallbackUsed"
#endif
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 8193eef68a5d..05186c0abccf 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -32,9 +32,13 @@
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/packages/NoEncryptionException.hpp>
#include <com/sun/star/packages/WrongPasswordException.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+
#include <ByteGrabber.hxx>
#include <HashMaps.hxx>
#include <Inflater.hxx>
+#include <EncryptionData.hxx>
#include <mutexholder.hxx>
@@ -46,6 +50,7 @@ namespace rtl
{
template < class T > class Reference;
}
+
/*
* We impose arbitrary but reasonable limit on ZIP files.
*/
@@ -54,9 +59,7 @@ namespace rtl
#define ZIP_MAXEXTRA 256
#define ZIP_MAXENTRIES (0x10000 - 2)
-typedef void* rtlCipher;
class ZipEnumeration;
-class EncryptionData;
class ZipFile
{
@@ -69,20 +72,20 @@ protected:
ZipUtils::Inflater aInflater;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xFactory;
+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
::com::sun::star::uno::Reference < ::com::sun::star::ucb::XProgressHandler > xProgressHandler;
sal_Bool bRecoveryMode;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createMemoryStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createFileStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
@@ -90,7 +93,7 @@ protected:
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createUnbufferedStream(
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bDecrypt,
::rtl::OUString aMediaType = ::rtl::OUString() );
@@ -126,44 +129,59 @@ public:
void setInputStream ( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewStream );
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
- static sal_Bool StaticGetCipher ( const rtl::Reference < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode );
- static void StaticFillHeader ( const rtl::Reference < EncryptionData > & rData,
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > StaticGetDigestContextForChecksum(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::rtl::Reference< EncryptionData >& xEncryptionData );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > StaticGetCipher(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::rtl::Reference< EncryptionData >& xEncryptionData,
+ bool bEncrypt );
+
+ static void StaticFillHeader ( const ::rtl::Reference < EncryptionData > & rData,
sal_Int32 nSize,
const ::rtl::OUString& aMediaType,
sal_Int8 * & pHeader );
- static sal_Bool StaticFillData ( rtl::Reference < EncryptionData > & rData,
+ static sal_Bool StaticFillData ( ::rtl::Reference < BaseEncryptionData > & rData,
+ sal_Int32 &rEncAlgorithm,
+ sal_Int32 &rChecksumAlgorithm,
+ sal_Int32 &rDerivedKeySize,
+ sal_Int32 &rStartKeyGenID,
sal_Int32 &rSize,
::rtl::OUString& aMediaType,
- ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &rStream );
+ const ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream );
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > StaticGetDataFromRawStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream,
- const rtl::Reference < EncryptionData > &rData )
+ const ::rtl::Reference < EncryptionData > &rData )
throw ( ::com::sun::star::packages::WrongPasswordException,
::com::sun::star::packages::zip::ZipIOException,
::com::sun::star::uno::RuntimeException );
- static sal_Bool StaticHasValidPassword ( const ::com::sun::star::uno::Sequence< sal_Int8 > &aReadBuffer,
- const rtl::Reference < EncryptionData > &rData );
+ static sal_Bool StaticHasValidPassword (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Sequence< sal_Int8 > &aReadBuffer,
+ const ::rtl::Reference < EncryptionData > &rData );
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::WrongPasswordException,
@@ -173,7 +191,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getWrappedRawStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
const ::rtl::OUString& aMediaType,
SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::NoEncryptionException,
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 9cd58d74e657..b5d6ee8b54f2 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -28,39 +28,52 @@
#ifndef _ZIP_OUTPUT_STREAM_HXX
#define _ZIP_OUTPUT_STREAM_HXX
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+
#include <ByteChucker.hxx>
#include <Deflater.hxx>
#include <CRC32.hxx>
-#include <rtl/cipher.h>
-#include <rtl/digest.h>
#include <vector>
struct ZipEntry;
-class EncryptionData;
+class ZipPackageStream;
namespace rtl
{
template < class T > class Reference;
}
+
class ZipOutputStream
{
protected:
- com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream;
+
::std::vector < ZipEntry * > aZipList;
- com::sun::star::uno::Sequence < sal_Int8 > aBuffer, aEncryptionBuffer;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aDeflateBuffer;
+
::rtl::OUString sComment;
ZipUtils::Deflater aDeflater;
- rtlCipher aCipher;
- rtlDigest aDigest;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext;
+
CRC32 aCRC;
ByteChucker aChucker;
ZipEntry *pCurrentEntry;
sal_Int16 nMethod, nLevel, mnDigested;
sal_Bool bFinished, bEncryptCurrentEntry;
- EncryptionData *pCurrentEncryptData;
+ ZipPackageStream* m_pCurrentStream;
public:
- ZipOutputStream( com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > &xOStream );
+ ZipOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream );
~ZipOutputStream();
// rawWrite to support a direct write to the output stream
@@ -75,7 +88,7 @@ public:
void SAL_CALL setLevel( sal_Int32 nNewLevel )
throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL putNextEntry( ZipEntry& rEntry,
- rtl::Reference < EncryptionData > &rData,
+ ZipPackageStream* pStream,
sal_Bool bEncrypt = sal_False )
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void SAL_CALL closeEntry( )
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index 226a19e529b5..ed7be23ea429 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -36,9 +36,12 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <HashMaps.hxx>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <HashMaps.hxx>
#include <osl/file.h>
#include <mutexholder.hxx>
#include <vector>
@@ -83,18 +86,24 @@ class ZipPackage : public cppu::WeakImplHelper7
protected:
SotMutexHolderRef m_aMutexHolder;
- ::com::sun::star::uno::Sequence < sal_Int8 > m_aEncryptionKey;
- FolderHash m_aRecent;
- ::rtl::OUString m_aURL;
- sal_Bool m_bHasEncryptedEntries;
- sal_Bool m_bHasNonEncryptedEntries;
- sal_Bool m_bInconsistent;
- sal_Bool m_bUseManifest;
- sal_Bool m_bForceRecovery;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
+
+ FolderHash m_aRecent;
+ ::rtl::OUString m_aURL;
- sal_Bool m_bMediaTypeFallbackUsed;
- sal_Int32 m_nFormat;
- sal_Bool m_bAllowRemoveOnInsert;
+ sal_Int32 m_nStartKeyGenerationID;
+ sal_Int32 m_nChecksumDigestID;
+ sal_Int32 m_nCommonEncryptionID;
+ sal_Bool m_bHasEncryptedEntries;
+ sal_Bool m_bHasNonEncryptedEntries;
+
+ sal_Bool m_bInconsistent;
+ sal_Bool m_bForceRecovery;
+
+ sal_Bool m_bMediaTypeFallbackUsed;
+ sal_Int32 m_nFormat;
+ sal_Bool m_bAllowRemoveOnInsert;
InitialisationMode m_eMode;
@@ -121,15 +130,20 @@ protected:
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xTempStream );
public:
- ZipPackage (const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory);
+ ZipPackage( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory );
virtual ~ZipPackage( void );
ZipFile& getZipFile() { return *m_pZipFile;}
- const com::sun::star::uno::Sequence < sal_Int8 > & getEncryptionKey ( ) {return m_aEncryptionKey;}
sal_Int32 getFormat() const { return m_nFormat; }
+ sal_Int32 GetStartKeyGenID() const { return m_nStartKeyGenerationID; }
+ sal_Int32 GetEncAlgID() const { return m_nCommonEncryptionID; }
+ sal_Int32 GetChecksumAlgID() const { return m_nChecksumDigestID; }
+ sal_Int32 GetDefaultDerivedKeySize() const { return m_nCommonEncryptionID == ::com::sun::star::xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 32 : 16; }
+
SotMutexHolderRef GetSharedMutexRef() { return m_aMutexHolder; }
void ConnectTo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
+ const ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey();
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
diff --git a/package/source/zippackage/ZipPackageEntry.hxx b/package/inc/ZipPackageEntry.hxx
index 6ae623a50664..6ae623a50664 100644
--- a/package/source/zippackage/ZipPackageEntry.hxx
+++ b/package/inc/ZipPackageEntry.hxx
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index c6ace8edf0c2..59be1b7b36ce 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -92,10 +92,10 @@ public:
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
- bool saveChild(const rtl::OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool);
+ bool saveChild(const rtl::OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool & rRandomPool);
// Recursive functions
- void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
+ void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence< sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
throw(::com::sun::star::uno::RuntimeException);
void releaseUpwardRef();
diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx
index 9bdc09d04f92..cb165af9ee97 100644
--- a/package/source/zippackage/ZipPackageStream.hxx
+++ b/package/inc/ZipPackageStream.hxx
@@ -30,11 +30,13 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/packages/XDataSinkEncrSupport.hpp>
#include <ZipPackageEntry.hxx>
#include <rtl/ref.hxx>
-#include <EncryptionData.hxx>
#include <cppuhelper/implbase2.hxx>
+
+#include <EncryptionData.hxx>
#include <mutexholder.hxx>
#define PACKAGE_STREAM_NOTSET 0
@@ -57,7 +59,15 @@ protected:
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
ZipPackage &rZipPackage;
sal_Bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted;
- rtl::Reference < EncryptionData > xEncryptionData;
+
+ ::rtl::Reference< BaseEncryptionData > m_xBaseEncryptionData;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
+
+ sal_Int32 m_nImportedStartKeyAlgorithm;
+ sal_Int32 m_nImportedEncryptionAlgorithm;
+ sal_Int32 m_nImportedChecksumAlgorithm;
+ sal_Int32 m_nImportedDerivedKeySize;
sal_uInt8 m_nStreamMode;
sal_uInt32 m_nMagicalHackPos;
@@ -69,7 +79,9 @@ protected:
sal_Bool m_bFromManifest;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& GetOwnSeekStream();
+ bool m_bUseWinEncoding;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream();
public:
sal_Bool HasOwnKey () const { return bHaveOwnKey;}
@@ -81,46 +93,56 @@ public:
sal_Bool IsFromManifest() const { return m_bFromManifest; }
void SetFromManifest( sal_Bool bValue ) { m_bFromManifest = bValue; }
- rtl::Reference < EncryptionData > & getEncryptionData ()
- { return xEncryptionData;}
- const com::sun::star::uno::Sequence < sal_Int8 >& getKey () const
- { return xEncryptionData->aKey;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getInitialisationVector () const
- { return xEncryptionData->aInitVector;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getDigest () const
- { return xEncryptionData->aDigest;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getSalt () const
- { return xEncryptionData->aSalt;}
+ ::rtl::Reference< EncryptionData > GetEncryptionData( bool bWinEncoding = false );
+ void SetBaseEncryptionData( const ::rtl::Reference< BaseEncryptionData >& xData );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey( bool bWinEncoding = false );
+
+ sal_Int32 GetStartKeyGenID();
+
+ const com::sun::star::uno::Sequence < sal_Int8 > getInitialisationVector () const
+ { return m_xBaseEncryptionData->m_aInitVector;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getDigest () const
+ { return m_xBaseEncryptionData->m_aDigest;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getSalt () const
+ { return m_xBaseEncryptionData->m_aSalt;}
sal_Int32 getIterationCount () const
- { return xEncryptionData->nIterationCount;}
+ { return m_xBaseEncryptionData->m_nIterationCount;}
sal_Int32 getSize () const
{ return aEntry.nSize;}
sal_uInt8 GetStreamMode() const { return m_nStreamMode; }
sal_uInt32 GetMagicalHackPos() const { return m_nMagicalHackPos; }
sal_uInt32 GetMagicalHackSize() const { return m_nMagicalHackSize; }
+ sal_Int32 GetEncryptionAlgorithm() const;
+ sal_Int32 GetBlockSize() const;
void SetToBeCompressed (sal_Bool bNewValue) { bToBeCompressed = bNewValue;}
void SetIsEncrypted (sal_Bool bNewValue) { bIsEncrypted = bNewValue;}
+ void SetImportedStartKeyAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedStartKeyAlgorithm = nAlgorithm; }
+ void SetImportedEncryptionAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedEncryptionAlgorithm = nAlgorithm; }
+ void SetImportedChecksumAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedChecksumAlgorithm = nAlgorithm; }
+ void SetImportedDerivedKeySize( sal_Int32 nSize ) { m_nImportedDerivedKeySize = nSize; }
void SetToBeEncrypted (sal_Bool bNewValue)
{
bToBeEncrypted = bNewValue;
- if ( bToBeEncrypted && !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
- else if ( !bToBeEncrypted && xEncryptionData.is() )
- xEncryptionData.clear();
+ if ( bToBeEncrypted && !m_xBaseEncryptionData.is())
+ m_xBaseEncryptionData = new BaseEncryptionData;
+ else if ( !bToBeEncrypted && m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData.clear();
}
void SetPackageMember (sal_Bool bNewValue);
+
void setKey (const com::sun::star::uno::Sequence < sal_Int8 >& rNewKey )
- { xEncryptionData->aKey = rNewKey;}
- void setInitialisationVector (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewVector )
- { xEncryptionData->aInitVector = rNewVector;}
- void setSalt (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewSalt )
- { xEncryptionData->aSalt = rNewSalt;}
- void setDigest (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewDigest )
- { xEncryptionData->aDigest = rNewDigest;}
+ { m_aEncryptionKey = rNewKey; m_aStorageEncryptionKeys.realloc( 0 ); }
+ void setInitialisationVector (const com::sun::star::uno::Sequence < sal_Int8 >& rNewVector )
+ { m_xBaseEncryptionData->m_aInitVector = rNewVector;}
+ void setSalt (const com::sun::star::uno::Sequence < sal_Int8 >& rNewSalt )
+ { m_xBaseEncryptionData->m_aSalt = rNewSalt;}
+ void setDigest (const com::sun::star::uno::Sequence < sal_Int8 >& rNewDigest )
+ { m_xBaseEncryptionData->m_aDigest = rNewDigest;}
void setIterationCount (const sal_Int32 nNewCount)
- { xEncryptionData->nIterationCount = nNewCount;}
+ { m_xBaseEncryptionData->m_nIterationCount = nNewCount;}
void setSize (const sal_Int32 nNewSize);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; }
diff --git a/package/qa/storages/TestHelper.java b/package/qa/storages/TestHelper.java
index dc28786513b1..1a67f2bfdf79 100644
--- a/package/qa/storages/TestHelper.java
+++ b/package/qa/storages/TestHelper.java
@@ -1434,24 +1434,24 @@ public class TestHelper {
try
{
- byte pData[][] = new byte[1][22];
- if ( xHeadRawStream.readBytes( pData, 22 ) != 22 )
+ byte pData[][] = new byte[1][38];
+ if ( xHeadRawStream.readBytes( pData, 38 ) != 38 )
{
Error( "Can't read header of encrypted stream '" + sStreamName + "' raw representations!" );
return false;
}
- if ( pData[0][0] != 0x4d || pData[0][1] != 0x47 || pData[0][2] != 0x02 || pData[0][3] != 0x05 )
+ if ( pData[0][0] != 0x4d || pData[0][1] != 0x4d || pData[0][2] != 0x02 || pData[0][3] != 0x05 )
{
Error( "No signature in the header of encrypted stream '" + sStreamName + "' raw representations!" );
return false;
}
int nVariableHeaderLength =
- ( pData[0][14] + pData[0][15] * 0x100 ) // salt length
- + ( pData[0][16] + pData[0][17] * 0x100 ) // iv length
- + ( pData[0][18] + pData[0][19] * 0x100 ) // digest length
- + ( pData[0][20] + pData[0][21] * 0x100 ); // mediatype length
+ ( pData[0][30] + pData[0][31] * 0x100 ) // salt length
+ + ( pData[0][32] + pData[0][33] * 0x100 ) // iv length
+ + ( pData[0][34] + pData[0][35] * 0x100 ) // digest length
+ + ( pData[0][36] + pData[0][37] * 0x100 ); // mediatype length
xHeadRawStream.skipBytes( nVariableHeaderLength );
@@ -1467,7 +1467,7 @@ public class TestHelper {
if ( nRead1 != nRead2 )
{
- Error( "The encrypted stream '" + sStreamName + "' raw representations have different size!" );
+ Error( "The encrypted stream '" + sStreamName + "' raw representations have different size! nRead1 - nRead2 = " + ( new Integer( nRead1 - nRead2 ) ).toString() );
return false;
}
diff --git a/package/source/manifest/Base64Codec.cxx b/package/source/manifest/Base64Codec.cxx
index cf539d0790c4..b4f5b6d32ffd 100644
--- a/package/source/manifest/Base64Codec.cxx
+++ b/package/source/manifest/Base64Codec.cxx
@@ -131,11 +131,11 @@ void ThreeByteToFourByte (const sal_uInt8* pBuffer, const sal_Int32 nStart, cons
sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
}
-void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_uInt8 >& aPass)
+void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_Int8 >& aPass)
{
sal_Int32 i(0);
sal_Int32 nBufferLength(aPass.getLength());
- const sal_uInt8* pBuffer = aPass.getConstArray();
+ const sal_uInt8* pBuffer = reinterpret_cast< const sal_uInt8* >( aPass.getConstArray() );
while (i < nBufferLength)
{
rtl::OUStringBuffer sBuffer;
@@ -185,7 +185,7 @@ void FourByteToThreeByte (sal_uInt8* pBuffer, sal_Int32& nLength, const sal_Int3
pBuffer[nStart + 2] = OneByte;
}
-void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::OUString& sBuffer)
+void Base64Codec::decodeBase64(uno::Sequence< sal_Int8 >& aBuffer, const rtl::OUString& sBuffer)
{
sal_Int32 nFirstLength((sBuffer.getLength() / 4) * 3);
sal_uInt8* pBuffer = new sal_uInt8[nFirstLength];
@@ -201,7 +201,7 @@ void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::O
i += 4;
k += 3;
}
- aBuffer = uno::Sequence<sal_uInt8>(pBuffer, nSecondLength);
+ aBuffer = uno::Sequence<sal_Int8>( reinterpret_cast< sal_Int8* >( pBuffer ), nSecondLength );
delete[] pBuffer;
}
diff --git a/package/source/manifest/Base64Codec.hxx b/package/source/manifest/Base64Codec.hxx
index 8cae2a7037fd..60bd018c159b 100644
--- a/package/source/manifest/Base64Codec.hxx
+++ b/package/source/manifest/Base64Codec.hxx
@@ -40,8 +40,8 @@ class OUStringBuffer;
class Base64Codec
{
public:
- static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_uInt8>& aPass);
- static void decodeBase64(com::sun::star::uno::Sequence<sal_uInt8>& aPass, const rtl::OUString& sBuffer);
+ static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
+ static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer);
};
#endif
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index 65b9c6181727..969f4d834835 100644
--- a/package/source/manifest/ManifestDefines.hxx
+++ b/package/source/manifest/ManifestDefines.hxx
@@ -54,16 +54,29 @@
#define ELEMENT_START_KEY_GENERATION "manifest:start-key-generation"
#define ATTRIBUTE_START_KEY_GENERATION_NAME "manifest:start-key-generation-name"
-#define ALGORITHM_SHA1 "SHA1"
#define ATTRIBUTE_KEY_SIZE "manifest:key-size"
-#define START_KEY_SIZE "20"
#define ELEMENT_KEY_DERIVATION "manifest:key-derivation"
#define ATTRIBUTE_KEY_DERIVATION_NAME "manifest:key-derivation-name"
#define ATTRIBUTE_SALT "manifest:salt"
#define ATTRIBUTE_ITERATION_COUNT "manifest:iteration-count"
-#define CHECKSUM_TYPE "SHA1/1K"
-#define DERIVED_KEY_SIZE "16"
+
+#define SHA256_URL "http://www.w3.org/2000/09/xmldsig#sha256"
+#define SHA1_NAME "SHA1"
+#define SHA1_URL "http://www.w3.org/2000/09/xmldsig#sha1"
+
+#define SHA1_1K_NAME "SHA1/1K"
+#define SHA1_1K_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#sha1-1k"
+#define SHA256_1K_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#sha256-1k"
+
+#define BLOWFISH_NAME "Blowfish CFB"
+#define BLOWFISH_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#blowfish"
+#define AES128_URL "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+#define AES192_URL "http://www.w3.org/2001/04/xmlenc#aes192-cbc"
+#define AES256_URL "http://www.w3.org/2001/04/xmlenc#aes256-cbc"
+
+#define PBKDF2_NAME "PBKDF2"
+#define PBKDF2_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#pbkdf2"
#endif
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index e173e8da8d53..b5dc6c049440 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -28,80 +28,92 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ManifestExport.hxx>
-#include <ManifestDefines.hxx>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <Base64Codec.hxx>
+
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ManifestDefines.hxx>
+#include <ManifestExport.hxx>
+#include <Base64Codec.hxx>
+
+#include <rtl/ustrbuf.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/attributelist.hxx>
-using namespace com::sun::star::beans;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::xml::sax;
+using namespace ::com::sun::star;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const Sequence < Sequence < PropertyValue > > &rManList )
+ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHandler, const uno::Sequence< uno::Sequence < beans::PropertyValue > >& rManList )
{
- const OUString sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) );
- const OUString sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) );
- const OUString sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) );
- const OUString sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) );
- const OUString sStartKeyGenerationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) );
- const OUString sKeyDerivationElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) );
-
- const OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) );
- const OUString sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) );
- const OUString sVersionAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) );
- const OUString sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) );
- const OUString sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) );
- const OUString sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) );
- const OUString sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) );
- const OUString sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) );
- const OUString sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) );
- const OUString sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) );
- const OUString sStartKeyGenerationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) );
- const OUString sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) );
- const OUString sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) );
- const OUString sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM) );
-
- const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
- const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
- const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
- const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
- const OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
- const OUString sInitialisationVectorProperty( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
- const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
- const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
-
- const OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
- const OUString sBlowfish ( RTL_CONSTASCII_USTRINGPARAM ( "Blowfish CFB" ) );
- const OUString sPBKDF2 ( RTL_CONSTASCII_USTRINGPARAM ( "PBKDF2" ) );
- const OUString sChecksumType ( RTL_CONSTASCII_USTRINGPARAM ( CHECKSUM_TYPE ) );
- const OUString sStartKeySize ( RTL_CONSTASCII_USTRINGPARAM ( START_KEY_SIZE ) );
- const OUString sDerivedKeySize ( RTL_CONSTASCII_USTRINGPARAM ( DERIVED_KEY_SIZE ) );
- const OUString sSHA1 ( RTL_CONSTASCII_USTRINGPARAM ( ALGORITHM_SHA1 ) );
+ const ::rtl::OUString sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) );
+ const ::rtl::OUString sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) );
+ const ::rtl::OUString sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) );
+ const ::rtl::OUString sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) );
+ const ::rtl::OUString sStartKeyGenerationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) );
+ const ::rtl::OUString sKeyDerivationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) );
+
+ const ::rtl::OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) );
+ const ::rtl::OUString sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) );
+ const ::rtl::OUString sVersionAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) );
+ const ::rtl::OUString sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) );
+ const ::rtl::OUString sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) );
+ const ::rtl::OUString sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) );
+ const ::rtl::OUString sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) );
+ const ::rtl::OUString sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) );
+ const ::rtl::OUString sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) );
+ const ::rtl::OUString sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) );
+ const ::rtl::OUString sStartKeyGenerationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) );
+ const ::rtl::OUString sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) );
+ const ::rtl::OUString sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) );
+ const ::rtl::OUString sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM) );
+
+ const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
+ const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+ const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
+ const ::rtl::OUString sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+ const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
+ const ::rtl::OUString sInitialisationVectorProperty( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
+ const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
+ const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const ::rtl::OUString sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const ::rtl::OUString sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
+ const ::rtl::OUString sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+
+ const ::rtl::OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+
+ const ::rtl::OUString sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) );
+ const ::rtl::OUString sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) );
+
+ const ::rtl::OUString sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) );
+ const ::rtl::OUString sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) );
+
+ const ::rtl::OUString sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) );
+ const ::rtl::OUString sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) );
+
+ const ::rtl::OUString sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) );
::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList;
- const Sequence < PropertyValue > *pSequence = rManList.getConstArray();
+ const uno::Sequence < beans::PropertyValue > *pSequence = rManList.getConstArray();
const sal_uInt32 nManLength = rManList.getLength();
// find the mediatype of the document if any
- OUString aDocMediaType;
- OUString aDocVersion;
+ ::rtl::OUString aDocMediaType;
+ ::rtl::OUString aDocVersion;
for (sal_uInt32 nInd = 0; nInd < nManLength ; nInd++ )
{
- OUString aMediaType;
- OUString aPath;
- OUString aVersion;
+ ::rtl::OUString aMediaType;
+ ::rtl::OUString aPath;
+ ::rtl::OUString aVersion;
- const PropertyValue *pValue = pSequence[nInd].getConstArray();
+ const beans::PropertyValue *pValue = pSequence[nInd].getConstArray();
for (sal_uInt32 j = 0, nNum = pSequence[nInd].getLength(); j < nNum; j++, pValue++)
{
if (pValue->Name.equals (sMediaTypeProperty) )
@@ -121,7 +133,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
break;
}
- if ( aPath.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) )
+ if ( aPath.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) )
{
aDocMediaType = aMediaType;
aDocVersion = aVersion;
@@ -134,28 +146,28 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
sal_Bool bStoreStartKeyGeneration = sal_False;
if ( aDocMediaType.getLength() )
{
- if ( aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
-
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
+ if ( aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
+
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
{
// oasis format
- pRootAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
+ pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
sCdataAttribute,
- OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) );
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) );
bAcceptNonemptyVersion = sal_True;
if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
{
@@ -168,21 +180,21 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
{
// even if it is no SO6 format the namespace must be specified
// thus SO6 format is used as default one
- pRootAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
+ pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
sCdataAttribute,
- OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_NAMESPACE ) ) );
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_NAMESPACE ) ) );
bProvideDTD = sal_True;
}
}
- Reference < XAttributeList > xRootAttrList (pRootAttrList);
+ uno::Reference < xml::sax::XAttributeList > xRootAttrList (pRootAttrList);
xHandler->startDocument();
- Reference < XExtendedDocumentHandler > xExtHandler ( xHandler, UNO_QUERY );
+ uno::Reference < xml::sax::XExtendedDocumentHandler > xExtHandler ( xHandler, uno::UNO_QUERY );
if ( xExtHandler.is() && bProvideDTD )
{
- OUString aDocType ( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_DOCTYPE ) );
+ ::rtl::OUString aDocType ( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_DOCTYPE ) );
xExtHandler->unknown ( aDocType );
xHandler->ignorableWhitespace ( sWhiteSpace );
}
@@ -191,9 +203,9 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
for (sal_uInt32 i = 0 ; i < nManLength ; i++)
{
::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList;
- const PropertyValue *pValue = pSequence[i].getConstArray();
- OUString aString;
- const PropertyValue *pVector = NULL, *pSalt = NULL, *pIterationCount = NULL, *pDigest = NULL;
+ const beans::PropertyValue *pValue = pSequence[i].getConstArray();
+ ::rtl::OUString aString;
+ const uno::Any *pVector = NULL, *pSalt = NULL, *pIterationCount = NULL, *pDigest = NULL, *pDigestAlg = NULL, *pEncryptAlg = NULL, *pStartKeyAlg = NULL, *pDerivedKeySize = NULL;
for (sal_uInt32 j = 0, nNum = pSequence[i].getLength(); j < nNum; j++, pValue++)
{
if (pValue->Name.equals (sMediaTypeProperty) )
@@ -217,47 +229,87 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
{
sal_Int32 nSize = 0;
pValue->Value >>= nSize;
- OUStringBuffer aBuffer;
+ ::rtl::OUStringBuffer aBuffer;
aBuffer.append ( nSize );
pAttrList->AddAttribute ( sSizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
}
else if (pValue->Name.equals (sInitialisationVectorProperty) )
- pVector = pValue;
+ pVector = &pValue->Value;
else if (pValue->Name.equals (sSaltProperty) )
- pSalt = pValue;
+ pSalt = &pValue->Value;
else if (pValue->Name.equals (sIterationCountProperty) )
- pIterationCount = pValue;
+ pIterationCount = &pValue->Value;
else if (pValue->Name.equals ( sDigestProperty ) )
- pDigest = pValue;
+ pDigest = &pValue->Value;
+ else if (pValue->Name.equals ( sDigestAlgProperty ) )
+ pDigestAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sEncryptionAlgProperty ) )
+ pEncryptAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sStartKeyAlgProperty ) )
+ pStartKeyAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sDerivedKeySizeProperty ) )
+ pDerivedKeySize = &pValue->Value;
}
+
xHandler->ignorableWhitespace ( sWhiteSpace );
- Reference < XAttributeList > xAttrList ( pAttrList );
+ uno::Reference < xml::sax::XAttributeList > xAttrList ( pAttrList );
xHandler->startElement( sFileEntryElement , xAttrList);
- if ( pVector && pSalt && pIterationCount )
+ if ( pVector && pSalt && pIterationCount && pDigest && pDigestAlg && pEncryptAlg && pStartKeyAlg && pDerivedKeySize )
{
// ==== Encryption Data
::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList;
- Reference < XAttributeList > xNewAttrList (pNewAttrList);
- OUStringBuffer aBuffer;
- Sequence < sal_uInt8 > aSequence;
+ uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList);
+ ::rtl::OUStringBuffer aBuffer;
+ uno::Sequence < sal_Int8 > aSequence;
xHandler->ignorableWhitespace ( sWhiteSpace );
- if ( pDigest )
- {
- pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
- pDigest->Value >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
- pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
- }
+
+ // ==== Digest
+ ::rtl::OUString sChecksumType;
+ sal_Int32 nDigestAlgID = 0;
+ *pDigestAlg >>= nDigestAlgID;
+ if ( nDigestAlgID == xml::crypto::DigestID::SHA256_1K )
+ sChecksumType = sSHA256_1k_URL;
+ else if ( nDigestAlgID == xml::crypto::DigestID::SHA1_1K )
+ sChecksumType = sSHA1_1k_Name;
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected digest algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
+ *pDigest >>= aSequence;
+ Base64Codec::encodeBase64( aBuffer, aSequence );
+ pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
+
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
// ==== Algorithm
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sBlowfish );
+ sal_Int32 nEncAlgID = 0;
+ sal_Int32 nDerivedKeySize = 0;
+ *pEncryptAlg >>= nEncAlgID;
+ *pDerivedKeySize >>= nDerivedKeySize;
- pVector->Value >>= aSequence;
+ ::rtl::OUString sEncAlgName;
+ if ( nEncAlgID == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ OSL_ENSURE( nDerivedKeySize, "Unexpected key size is provided!" );
+ if ( nDerivedKeySize != 32 )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected key size is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ sEncAlgName = sAES256_URL;
+ }
+ else if ( nEncAlgID == xml::crypto::CipherID::BLOWFISH_CFB_8 )
+ {
+ sEncAlgName = sBlowfish_Name;
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpecte encryption algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName );
+
+ *pVector >>= aSequence;
Base64Codec::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
@@ -270,17 +322,20 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2 );
+ pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2_Name );
if ( bStoreStartKeyGeneration )
- pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sDerivedKeySize );
+ {
+ aBuffer.append( nDerivedKeySize );
+ pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
+ }
sal_Int32 nCount = 0;
- pIterationCount->Value >>= nCount;
+ *pIterationCount >>= nCount;
aBuffer.append (nCount);
pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
- pSalt->Value >>= aSequence;
+ *pSalt >>= aSequence;
Base64Codec::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
@@ -297,8 +352,26 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- // currently SHA1 is used to generate 20-bytes start key
- pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sSHA1 );
+ ::rtl::OUString sStartKeyAlg;
+ ::rtl::OUString sStartKeySize;
+ sal_Int32 nStartKeyAlgID = 0;
+ *pStartKeyAlg >>= nStartKeyAlgID;
+ if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 )
+ {
+ sStartKeyAlg = sSHA256_URL;
+ aBuffer.append( (sal_Int32)32 );
+ sStartKeySize = aBuffer.makeStringAndClear();
+ }
+ else if ( nStartKeyAlgID == xml::crypto::DigestID::SHA1 )
+ {
+ sStartKeyAlg = sSHA1_Name;
+ aBuffer.append( (sal_Int32)20 );
+ sStartKeySize = aBuffer.makeStringAndClear();
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sStartKeyAlg );
pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize );
xHandler->ignorableWhitespace ( sWhiteSpace );
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 58310e5ed116..f685f7ea87fb 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -32,6 +32,8 @@
#include <ManifestDefines.hxx>
#include <Base64Codec.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
using namespace com::sun::star::uno;
@@ -45,12 +47,14 @@ using ::rtl::OUString;
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
: nNumProperty ( 0 )
, bIgnoreEncryptData ( sal_False )
+, nDerivedKeySize( 0 )
, rManVector ( rNewManVector )
, sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) )
, sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) )
, sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) )
, sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) )
+, sStartKeyAlgElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) )
, sKeyDerivationElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) )
, sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) )
@@ -61,7 +65,9 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV
, sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) )
, sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) )
, sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) )
+, sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) )
, sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) )
+, sStartKeyAlgNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) )
, sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) )
, sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM ) )
, sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) )
@@ -70,15 +76,33 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV
, sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) )
, sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) )
, sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) )
+, sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) )
, sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) )
, sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) )
, sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) )
, sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) )
+, sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) )
+, sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) )
+, sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) )
, sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) )
-, sBlowfish ( RTL_CONSTASCII_USTRINGPARAM ( "Blowfish CFB" ) )
-, sPBKDF2 ( RTL_CONSTASCII_USTRINGPARAM ( "PBKDF2" ) )
-, sChecksumType ( RTL_CONSTASCII_USTRINGPARAM ( CHECKSUM_TYPE ) )
+
+, sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) )
+, sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) )
+, sSHA1_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_URL ) )
+
+, sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) )
+, sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) )
+, sSHA1_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_URL ) )
+
+, sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) )
+, sBlowfish_URL ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_URL ) )
+, sAES128_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES128_URL ) )
+, sAES192_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES192_URL ) )
+, sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) )
+
+, sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) )
+, sPBKDF2_URL ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_URL ) )
{
aStack.reserve( 10 );
}
@@ -143,15 +167,32 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if ( aConvertedName.equals( sEncryptionDataElement ) )
{
// If this element exists, then this stream is encrypted and we need
- // to store the initialisation vector, salt and iteration count used
+ // to import the initialisation vector, salt and iteration count used
+ nDerivedKeySize = 0;
OUString aString = aConvertedAttribs[sChecksumTypeAttribute];
- if ( aString == sChecksumType && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sChecksumAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sDigestProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) )
+ {
+ aSequence[nNumProperty].Name = sDigestAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K;
+ }
+ else if ( aString.equals( sSHA256_1k_URL ) )
+ {
+ aSequence[nNumProperty].Name = sDigestAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+
+ if ( !bIgnoreEncryptData )
+ {
+ aString = aConvertedAttribs[sChecksumAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sDigestProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ }
}
}
}
@@ -159,38 +200,98 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
{
if ( aConvertedName == sAlgorithmElement )
{
- OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString == sBlowfish && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sInitialisationVectorAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sInitialisationVectorProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
+ if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
+ }
+ else if ( aString.equals( sAES256_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
+ nDerivedKeySize = 32;
+ }
+ else if ( aString.equals( sAES192_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
+ nDerivedKeySize = 24;
+ }
+ else if ( aString.equals( sAES128_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
+ nDerivedKeySize = 16;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+
+ if ( !bIgnoreEncryptData )
+ {
+ aString = aConvertedAttribs[sInitialisationVectorAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sInitialisationVectorProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ }
}
- else
- // If we don't recognise the algorithm, then the key derivation info
- // is useless to us
- bIgnoreEncryptData = sal_True;
}
else if ( aConvertedName == sKeyDerivationElement )
{
- OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString == sPBKDF2 && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
+ {
+ OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
+ if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) )
+ {
+ aString = aConvertedAttribs[sSaltAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sSaltProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+
+ aString = aConvertedAttribs[sIterationCountAttribute];
+ aSequence[nNumProperty].Name = sIterationCountProperty;
+ aSequence[nNumProperty++].Value <<= aString.toInt32();
+
+ aString = aConvertedAttribs[sKeySizeAttribute];
+ if ( aString.getLength() )
+ {
+ sal_Int32 nKey = aString.toInt32();
+ OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
+ nDerivedKeySize = nKey;
+ }
+ else if ( !nDerivedKeySize )
+ nDerivedKeySize = 16;
+ else if ( nDerivedKeySize != 16 )
+ OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" );
+
+ aSequence[nNumProperty].Name = sDerivedKeySizeProperty;
+ aSequence[nNumProperty++].Value <<= nDerivedKeySize;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+ }
+ }
+ else if ( aConvertedName == sStartKeyAlgElement )
+ {
+ OUString aString = aConvertedAttribs[sStartKeyAlgNameAttribute];
+ if ( aString.equals( sSHA256_URL ) )
+ {
+ aSequence[nNumProperty].Name = sStartKeyAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256;
+ }
+ else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) )
{
- aString = aConvertedAttribs[sSaltAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sSaltProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
-
- aString = aConvertedAttribs[sIterationCountAttribute];
- aSequence[nNumProperty].Name = sIterationCountProperty;
- aSequence[nNumProperty++].Value <<= aString.toInt32();
+ aSequence[nNumProperty].Name = sStartKeyAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1;
}
else
- // If we don't recognise the key derivation technique, then the
- // algorithm info is useless to us
bIgnoreEncryptData = sal_True;
}
}
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 4b74d903ee76..1c646a7952a6 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -65,12 +65,14 @@ protected:
sal_Int16 nNumProperty;
ManifestStack aStack;
sal_Bool bIgnoreEncryptData;
+ sal_Int32 nDerivedKeySize;
::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
const ::rtl::OUString sFileEntryElement;
const ::rtl::OUString sManifestElement;
const ::rtl::OUString sEncryptionDataElement;
const ::rtl::OUString sAlgorithmElement;
+ const ::rtl::OUString sStartKeyAlgElement;
const ::rtl::OUString sKeyDerivationElement;
const ::rtl::OUString sCdataAttribute;
@@ -81,7 +83,9 @@ protected:
const ::rtl::OUString sSaltAttribute;
const ::rtl::OUString sInitialisationVectorAttribute;
const ::rtl::OUString sIterationCountAttribute;
+ const ::rtl::OUString sKeySizeAttribute;
const ::rtl::OUString sAlgorithmNameAttribute;
+ const ::rtl::OUString sStartKeyAlgNameAttribute;
const ::rtl::OUString sKeyDerivationNameAttribute;
const ::rtl::OUString sChecksumAttribute;
const ::rtl::OUString sChecksumTypeAttribute;
@@ -90,15 +94,33 @@ protected:
const ::rtl::OUString sMediaTypeProperty;
const ::rtl::OUString sVersionProperty;
const ::rtl::OUString sIterationCountProperty;
+ const ::rtl::OUString sDerivedKeySizeProperty;
const ::rtl::OUString sSaltProperty;
const ::rtl::OUString sInitialisationVectorProperty;
const ::rtl::OUString sSizeProperty;
const ::rtl::OUString sDigestProperty;
+ const ::rtl::OUString sEncryptionAlgProperty;
+ const ::rtl::OUString sStartKeyAlgProperty;
+ const ::rtl::OUString sDigestAlgProperty;
const ::rtl::OUString sWhiteSpace;
- const ::rtl::OUString sBlowfish;
- const ::rtl::OUString sPBKDF2;
- const ::rtl::OUString sChecksumType;
+
+ const ::rtl::OUString sSHA256_URL;
+ const ::rtl::OUString sSHA1_Name;
+ const ::rtl::OUString sSHA1_URL;
+
+ const ::rtl::OUString sSHA256_1k_URL;
+ const ::rtl::OUString sSHA1_1k_Name;
+ const ::rtl::OUString sSHA1_1k_URL;
+
+ const ::rtl::OUString sBlowfish_Name;
+ const ::rtl::OUString sBlowfish_URL;
+ const ::rtl::OUString sAES128_URL;
+ const ::rtl::OUString sAES192_URL;
+ const ::rtl::OUString sAES256_URL;
+
+ const ::rtl::OUString sPBKDF2_Name;
+ const ::rtl::OUString sPBKDF2_URL;
::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName,
diff --git a/package/source/manifest/UnoRegister.cxx b/package/source/manifest/UnoRegister.cxx
index fc0781c11088..c5734977de46 100644
--- a/package/source/manifest/UnoRegister.cxx
+++ b/package/source/manifest/UnoRegister.cxx
@@ -37,6 +37,7 @@
#include <zipfileaccess.hxx>
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -57,9 +58,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{
void * pRet = 0;
- Reference< XMultiServiceFactory > xSMgr(
+ uno::Reference< XMultiServiceFactory > xSMgr(
reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
- Reference< XSingleServiceFactory > xFactory;
+ uno::Reference< XSingleServiceFactory > xFactory;
if (ManifestReader::static_getImplementationName().compareToAscii( pImplName ) == 0)
xFactory = ManifestReader::createServiceFactory ( xSMgr );
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 89a6b5b17c53..56b308b60478 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -47,16 +47,18 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
+#include <rtl/digest.h>
+#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
+
+#include <PackageConstants.hxx>
+#include <mutexholder.hxx>
+
#include "selfterminatefilestream.hxx"
#include "owriteablestream.hxx"
#include "oseekinstream.hxx"
-#include "mutexholder.hxx"
#include "xstorage.hxx"
-#include <rtl/digest.h>
-#include <rtl/logfile.hxx>
-#include <rtl/instance.hxx>
-
// since the copying uses 32000 blocks usually, it makes sense to have a smaller size
#define MAX_STORCACHE_SIZE 30000
@@ -111,15 +113,14 @@ namespace
{
//-----------------------------------------------
void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& xPropertySet,
- const uno::Sequence< sal_Int8 >& aKey )
+ const uno::Sequence< beans::NamedValue >& aKey )
{
OSL_ENSURE( xPropertySet.is(), "No property set is provided!\n" );
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- xPropertySet->setPropertyValue( aString_EncryptionKey, uno::makeAny( aKey ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ), uno::makeAny( aKey ) );
}
catch ( const uno::Exception& rException )
{
@@ -137,9 +138,8 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- return xPropertySet->getPropertyValue( aString_EncryptionKey );
+ return xPropertySet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) );
}
catch ( const uno::Exception& rException )
{
@@ -152,16 +152,65 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe
}
//-----------------------------------------------
-sal_Bool SequencesEqual( uno::Sequence< sal_Int8 > aSequence1, uno::Sequence< sal_Int8 > aSequence2 )
+bool SequencesEqual( const uno::Sequence< sal_Int8 >& aSequence1, const uno::Sequence< sal_Int8 >& aSequence2 )
{
if ( aSequence1.getLength() != aSequence2.getLength() )
- return sal_False;
+ return false;
for ( sal_Int32 nInd = 0; nInd < aSequence1.getLength(); nInd++ )
if ( aSequence1[nInd] != aSequence2[nInd] )
- return sal_False;
+ return false;
+
+ return true;
+}
+
+//-----------------------------------------------
+bool SequencesEqual( const uno::Sequence< beans::NamedValue >& aSequence1, const uno::Sequence< beans::NamedValue >& aSequence2 )
+{
+ if ( aSequence1.getLength() != aSequence2.getLength() )
+ return false;
+
+ for ( sal_Int32 nInd = 0; nInd < aSequence1.getLength(); nInd++ )
+ {
+ bool bHasMember = false;
+ uno::Sequence< sal_Int8 > aMember1;
+ sal_Int32 nMember1 = 0;
+ if ( ( aSequence1[nInd].Value >>= aMember1 ) )
+ {
+ for ( sal_Int32 nInd2 = 0; nInd2 < aSequence2.getLength(); nInd2++ )
+ {
+ if ( aSequence1[nInd].Name.equals( aSequence2[nInd2].Name ) )
+ {
+ bHasMember = true;
+
+ uno::Sequence< sal_Int8 > aMember2;
+ if ( !( aSequence2[nInd2].Value >>= aMember2 ) || !SequencesEqual( aMember1, aMember2 ) )
+ return false;
+ }
+ }
+ }
+ else if ( ( aSequence1[nInd].Value >>= nMember1 ) )
+ {
+ for ( sal_Int32 nInd2 = 0; nInd2 < aSequence2.getLength(); nInd2++ )
+ {
+ if ( aSequence1[nInd].Name.equals( aSequence2[nInd2].Name ) )
+ {
+ bHasMember = true;
- return sal_True;
+ sal_Int32 nMember2 = 0;
+ if ( !( aSequence2[nInd2].Value >>= nMember2 ) || nMember1 != nMember2 )
+ return false;
+ }
+ }
+ }
+ else
+ return false;
+
+ if ( !bHasMember )
+ return false;
+ }
+
+ return true;
}
//-----------------------------------------------
@@ -395,7 +444,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted()
// since a new key set to the package stream it should not be removed except the case when
// the stream becomes nonencrypted
- uno::Sequence< sal_Int8 > aKey;
+ uno::Sequence< beans::NamedValue > aKey;
if ( bToBeEncr )
GetEncryptionKeyProperty_Impl( xPropSet ) >>= aKey;
@@ -822,8 +871,8 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt
throw uno::RuntimeException();
// set to be encrypted but do not use encryption key
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Encrypted") ),
uno::makeAny( sal_True ) );
}
@@ -921,8 +970,8 @@ void OWriteStream_Impl::Commit()
throw uno::RuntimeException();
// set to be encrypted but do not use encryption key
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Encrypted") ),
uno::makeAny( sal_True ) );
}
@@ -931,8 +980,8 @@ void OWriteStream_Impl::Commit()
if ( m_nStorageType != embed::StorageFormats::PACKAGE )
throw uno::RuntimeException();
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( m_aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( m_aEncryptionData.getAsConstNamedValueList() ) );
}
// the stream should be free soon, after package is stored
@@ -1265,7 +1314,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod
}
else
{
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) );
+ SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getAsConstNamedValueList() );
try {
xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess );
@@ -1274,55 +1323,22 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod
m_bHasCachedEncryptionData = sal_True;
m_aEncryptionData = aEncryptionData;
}
- catch( const packages::WrongPasswordException& )
- {
- // retry with different encoding
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- // the stream must be cashed to be resaved
- xResultStream = GetStream_Impl( nStreamMode | embed::ElementModes::SEEKABLE, bHierarchyAccess );
-
- m_bUseCommonEncryption = sal_False; // very important to set it to false
- m_bHasCachedEncryptionData = sal_True;
- m_aEncryptionData = aEncryptionData;
-
- // the stream must be resaved with new password encryption
- if ( nStreamMode & embed::ElementModes::WRITE )
- {
- FillTempGetFileName();
- m_bHasDataToFlush = sal_True;
-
- // TODO/LATER: should the notification be done?
- if ( m_pParent )
- m_pParent->m_bIsModified = sal_True;
- }
- }
- catch( const packages::WrongPasswordException& rWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- catch ( const uno::Exception& rException )
- {
- AddLog( rException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
-
- OSL_FAIL( "Can't write encryption related properties!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- throw io::IOException(); // TODO:
- }
- }
- catch( const uno::Exception& rException )
+ catch( const packages::WrongPasswordException& rWrongPasswordException )
{
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
-
- AddLog( rException.Message );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
+ AddLog( rWrongPasswordException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
+ catch ( const uno::Exception& rException )
+ {
+ AddLog( rException.Message );
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
+ OSL_FAIL( "Can't write encryption related properties!\n" );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
+ throw io::IOException(); // TODO:
+ }
}
OSL_ENSURE( xResultStream.is(), "In case stream can not be retrieved an exception must be thrown!\n" );
@@ -1625,8 +1641,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
{
// TODO: introduce last commited cashed password information and use it here
// that means "use common pass" also should be remembered on flash
- uno::Sequence< sal_Int8 > aNewKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() );
- uno::Sequence< sal_Int8 > aOldKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() );
+ uno::Sequence< beans::NamedValue > aKey = aEncryptionData.getAsConstNamedValueList();
uno::Reference< beans::XPropertySet > xProps( m_xPackageStream, uno::UNO_QUERY );
if ( !xProps.is() )
@@ -1637,9 +1652,9 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
if ( !bEncr )
throw packages::NoEncryptionException();
- uno::Sequence< sal_Int8 > aEncrKey;
- xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ) ) >>= aEncrKey;
- if ( !SequencesEqual( aNewKey, aEncrKey ) && !SequencesEqual( aOldKey, aEncrKey ) )
+ uno::Sequence< beans::NamedValue > aPackKey;
+ xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) ) >>= aPackKey;
+ if ( !SequencesEqual( aKey, aPackKey ) )
throw packages::WrongPasswordException();
// the correct key must be set already
@@ -1648,7 +1663,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
else
{
uno::Reference< beans::XPropertySet > xPropertySet( m_xPackageStream, uno::UNO_QUERY );
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) );
+ SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getAsConstNamedValueList() );
try {
xDataToCopy = m_xPackageStream->getDataStream();
@@ -1656,42 +1671,19 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
if ( !xDataToCopy.is() )
{
OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- }
- }
- catch( const packages::WrongPasswordException& rWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- xDataToCopy = m_xPackageStream->getDataStream();
-
- if ( !xDataToCopy.is() )
- {
- OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- }
- catch( const uno::Exception& rException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( rException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
}
}
catch( const uno::Exception& rException )
{
OSL_FAIL( "Can't open encrypted stream!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
AddLog( rException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
}
// in case of new inserted package stream it is possible that input stream still was not set
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index ed25369717cb..9c0c117f5e35 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <PackageConstants.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -572,7 +573,7 @@ void OStorage_Impl::GetStorageProperties()
if ( !m_bControlMediaType )
{
uno::Reference< beans::XPropertySet > xPackageProps( m_xPackage, uno::UNO_QUERY_THROW );
- xPackageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaTypeFallbackUsed" ) ) ) >>= m_bMTFallbackUsed;
+ xPackageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) ) >>= m_bMTFallbackUsed;
xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= m_aMediaType;
m_bControlMediaType = sal_True;
@@ -750,9 +751,17 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes
{
try
{
- uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDest, uno::UNO_QUERY );
+ uno::Reference< embed::XEncryptionProtectedStorage > xEncr( xDest, uno::UNO_QUERY );
if ( xEncr.is() )
+ {
xEncr->setEncryptionData( GetCommonRootEncryptionData().getAsConstNamedValueList() );
+
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_xPackage, uno::UNO_QUERY_THROW );
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ >>= aAlgorithms;
+ xEncr->setEncryptionAlgorithms( aAlgorithms );
+ }
}
catch( const packages::NoEncryptionException& rNoEncryptionException )
{
@@ -985,7 +994,9 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement,
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Handled exception" ) ) );
// If the common storage password does not allow to open the stream
- // it must be copyed in raw way
+ // it could be copyed in raw way, the problem is that the StartKey should be the same
+ // in the ODF1.2 package, so an invalid package could be produced if the stream
+ // is copied from ODF1.1 package, where it is allowed to have different StartKeys
uno::Reference< embed::XStorageRawAccess > xRawDest( xDest, uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > xRawInStream = pElement->m_pStream->GetRawInStream();
xRawDest->insertRawEncrStreamElement( aName, xRawInStream );
@@ -2278,7 +2289,8 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType )
( rType
, static_cast<embed::XStorageRawAccess*> ( this )
, static_cast<embed::XEncryptionProtectedSource*> ( this )
- , static_cast<embed::XEncryptionProtectedSource2*> ( this ) );
+ , static_cast<embed::XEncryptionProtectedSource2*> ( this )
+ , static_cast<embed::XEncryptionProtectedStorage*> ( this ) );
}
else
{
@@ -2338,6 +2350,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
, ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL )
, ::getCppuType( ( const uno::Reference< util::XModifiable >* )NULL )
+ , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedStorage >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL )
, ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) );
@@ -4697,18 +4710,23 @@ void SAL_CALL OStorage::removeEncryption()
// TODO: check if the password is valid
// update all streams that was encrypted with old password
- uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY );
- if ( !xPackPropSet.is() )
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
-
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
try
{
- xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
m_pImpl->m_bHasCommonEncryptionData = sal_False;
m_pImpl->m_aCommonEncryptionData.clear();
}
+ catch( const uno::RuntimeException& rRException )
+ {
+ m_pImpl->AddLog( rRException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" );
+ throw;
+ }
catch( const uno::Exception& rException )
{
m_pImpl->AddLog( rException.Message );
@@ -4762,21 +4780,18 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
uno::Any aCaught( ::cppu::getCaughtException() );
- throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
- uno::UNO_QUERY ),
- aCaught );
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ),
+ aCaught );
}
- uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY );
- if ( !xPackPropSet.is() )
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
-
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
try
{
::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData );
- xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ),
- uno::makeAny( aEncryptionMap.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) );
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( aEncryptionMap.getAsConstNamedValueList() ) );
m_pImpl->m_bHasCommonEncryptionData = sal_True;
m_pImpl->m_aCommonEncryptionData = aEncryptionMap;
@@ -4789,7 +4804,148 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
+}
+
+//____________________________________________________________________________________________________
+// XEncryptionProtectedStorage
+//____________________________________________________________________________________________________
+
+//-----------------------------------------------
+void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::NamedValue >& aAlgorithms )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionAlgorithms" );
+
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ if ( !aAlgorithms.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected empty encryption algorithms list!") ), uno::Reference< uno::XInterface >() );
+
+ OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
+ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
+ uno::UNO_QUERY ),
+ aCaught );
+ }
+
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ),
+ uno::makeAny( aAlgorithms ) );
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch( lang::IllegalArgumentException& aIAException )
+ {
+ m_pImpl->AddLog( aIAException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+}
+
+//-----------------------------------------------
+uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms()
+ throw (uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::getEncryptionAlgorithms" );
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ uno::Sequence< beans::NamedValue > aResult;
+ OSL_ENSURE( m_pData->m_bIsRoot, "getEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
+ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
+ uno::UNO_QUERY ),
+ aCaught );
+ }
+
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) ) >>= aResult;
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+
+ return aResult;
}
@@ -4864,13 +5020,13 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName,
m_pImpl->m_bIsModified = sal_True;
}
}
- else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasNonEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsInconsistent" ) )
+ else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "RepairPackage" ) ) ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsRoot" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaTypeFallbackUsed" ) ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -4944,7 +5100,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE
&& ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaTypeFallbackUsed" ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Version" ) ) ) )
{
try
@@ -5001,9 +5157,9 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
return uno::makeAny( sal_False ); // RepairPackage
}
else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE
- && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasNonEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsInconsistent" ) ) ) )
+ && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) ) ) )
{
try {
m_pImpl->ReadContents();
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 2811616424c0..f472444556c2 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -37,7 +37,7 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
#include <com/sun/star/embed/XClassifiedObject.hpp>
-#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
+#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -297,7 +297,7 @@ class OStorage : public ::com::sun::star::lang::XTypeProvider
, public ::com::sun::star::embed::XTransactedObject
, public ::com::sun::star::embed::XTransactionBroadcaster
, public ::com::sun::star::util::XModifiable
- , public ::com::sun::star::embed::XEncryptionProtectedSource2
+ , public ::com::sun::star::embed::XEncryptionProtectedStorage
, public ::com::sun::star::beans::XPropertySet
, public ::com::sun::star::embed::XOptimizedStorage
, public ::com::sun::star::embed::XRelationshipAccess
@@ -647,6 +647,13 @@ public:
throw ( ::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
+ //____________________________________________________________________________________________________
+ // XEncryptionProtectedStorage
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL setEncryptionAlgorithms( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aAlgorithms ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() throw (::com::sun::star::uno::RuntimeException);
//____________________________________________________________________________________________________
// XPropertySet
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx
index cd90de5b09e3..30318ce5c520 100644
--- a/package/source/zipapi/Deflater.cxx
+++ b/package/source/zipapi/Deflater.cxx
@@ -95,7 +95,7 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
pStream->avail_in = nLength;
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
nResult = deflateParams(pStream, nLevel, nStrategy);
#else
nResult = z_deflateParams(pStream, nLevel, nStrategy);
@@ -121,7 +121,7 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
pStream->avail_in = nLength;
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
nResult = deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
#else
nResult = z_deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
@@ -190,7 +190,7 @@ sal_Int32 SAL_CALL Deflater::getTotalOut( )
}
void SAL_CALL Deflater::reset( )
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIXB
deflateReset(pStream);
#else
z_deflateReset(pStream);
@@ -203,7 +203,7 @@ void SAL_CALL Deflater::end( )
{
if (pStream != NULL)
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
deflateEnd(pStream);
#else
z_deflateEnd(pStream);
diff --git a/package/source/zipapi/EntryInputStream.cxx b/package/source/zipapi/EntryInputStream.cxx
deleted file mode 100644
index 047f1716e0f5..000000000000
--- a/package/source/zipapi/EntryInputStream.cxx
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <EntryInputStream.hxx>
-#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <rtl/cipher.h>
-#include <rtl/digest.h>
-#include <memory.h> // for memcpy
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::packages::zip;
-using namespace com::sun::star::packages::zip::ZipConstants;
-
-using ::rtl::OUString;
-
-/** Provides access to the compressed data in a zipfile.
- *
- * uncompresses the stream into memory and seeks on it 'in memory'
- * This and the ZipPackageBuffer used in the ZipOutputStream are memory hogs
- * and will hopefully be replaced eventually
- *
- * Acts on the same underlying XInputStream as both the full Zip File and other
- * EntryInputStreams, and thus must maintain its current position in the stream and
- * seek to it before performing any reads.
- */
-
-EntryInputStream::EntryInputStream( Reference < io::XInputStream > xNewInput,
- const ZipEntry & rNewEntry,
- const rtl::Reference < EncryptionData > &xEncryptData,
- sal_Bool bGetRawStream)
-: xStream( xNewInput )
-, xSeek( xNewInput, UNO_QUERY )
-, aEntry (rNewEntry )
-, nCurrent( 0 )
-, bHaveInMemory ( sal_False )
-, aInflater( sal_True )
-, aBuffer( 0 )
-, xEncryptionData (xEncryptData)
-, bRawStream (bGetRawStream)
-{
- if (bGetRawStream)
- {
- nUncompressedSize = aEntry.nMethod == DEFLATED ? aEntry.nCompressedSize : aEntry.nSize;
- nEnd = aEntry.nOffset + nUncompressedSize;
- }
- else
- {
- nEnd = aEntry.nMethod == DEFLATED ? aEntry.nOffset + aEntry.nCompressedSize : aEntry.nOffset + aEntry.nSize;
- nUncompressedSize = aEntry.nSize;
- }
-}
-void EntryInputStream::readIntoMemory()
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (!bHaveInMemory)
- {
- Sequence < sal_Int8 > aReadBuffer;
- xSeek->seek(aEntry.nOffset);
- sal_Int32 nSize = aEntry.nMethod == DEFLATED ? aEntry.nCompressedSize : aEntry.nSize;
-
- if (nSize <0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
-
- xStream->readBytes( aReadBuffer, nSize ); // Now it holds the raw stuff from disk
-
- if (xEncryptionData->aSalt.getLength())
- {
- // Have salt, will travel
- Sequence < sal_uInt8 > aDerivedKey (16);
- rtlCipherError aResult;
- Sequence < sal_Int8 > aDecryptBuffer;
-
- // Get the key
- rtl_digest_PBKDF2 ( aDerivedKey.getArray(), 16,
- reinterpret_cast < const sal_uInt8 * > (xEncryptionData->aKey.getConstArray()),
- xEncryptionData->aKey.getLength(),
- xEncryptionData->aSalt.getConstArray(),
- xEncryptionData->aSalt.getLength(),
- xEncryptionData->nIterationCount );
-
- rtlCipher aCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- aResult = rtl_cipher_init( aCipher, rtl_Cipher_DirectionDecode,
- aDerivedKey.getConstArray(),
- aDerivedKey.getLength(),
- xEncryptionData->aInitVector.getConstArray(),
- xEncryptionData->aInitVector.getLength());
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aDecryptBuffer.realloc ( nSize );
- aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aReadBuffer = aDecryptBuffer; // Now it holds the decrypted data
- }
- if (bRawStream || aEntry.nMethod == STORED)
- aBuffer = aReadBuffer; // bRawStream means the caller doesn't want it decompressed
- else
- {
- aInflater.setInputSegment(aReadBuffer, 0, nSize );
- aBuffer.realloc( aEntry.nSize );
- aInflater.doInflate(aBuffer);
- aInflater.end();
- }
- bHaveInMemory = sal_True;
- }
-}
-EntryInputStream::~EntryInputStream( void )
-{
-}
-
-sal_Int32 SAL_CALL EntryInputStream::readBytes( Sequence< sal_Int8 >& aData,
- sal_Int32 nBytesToRead )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (nBytesToRead <0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
- if (!bHaveInMemory)
- readIntoMemory();
- if (nBytesToRead + nCurrent > nUncompressedSize)
- nBytesToRead = static_cast < sal_Int32> ( nUncompressedSize - nCurrent );
-
- aData.realloc( nBytesToRead );
- memcpy(aData.getArray(), aBuffer.getConstArray() + nCurrent, nBytesToRead);
- nCurrent+=nBytesToRead;
-
- return nBytesToRead;
-}
-sal_Int32 SAL_CALL EntryInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,
- sal_Int32 nMaxBytesToRead )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- return readBytes( aData, nMaxBytesToRead );
-}
-void SAL_CALL EntryInputStream::skipBytes( sal_Int32 nBytesToSkip )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (nBytesToSkip < 0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
-
- if (nBytesToSkip + nCurrent > nUncompressedSize)
- nBytesToSkip = static_cast < sal_Int32 > (nUncompressedSize- nCurrent);
-
- nCurrent+=nBytesToSkip;
-}
-sal_Int32 SAL_CALL EntryInputStream::available( )
- throw(io::NotConnectedException, io::IOException, RuntimeException)
-{
- return static_cast < sal_Int32 > (nUncompressedSize - nCurrent);
-}
-void SAL_CALL EntryInputStream::closeInput( )
- throw(io::NotConnectedException, io::IOException, RuntimeException)
-{
-}
-
-void SAL_CALL EntryInputStream::seek( sal_Int64 location )
- throw(lang::IllegalArgumentException, io::IOException, RuntimeException)
-{
- if (location > nUncompressedSize)
- location = nUncompressedSize;
- if (location <0)
- location = 0;
- nCurrent = location;
-}
-sal_Int64 SAL_CALL EntryInputStream::getPosition( )
- throw(io::IOException, RuntimeException)
-{
- return nCurrent;
-}
-sal_Int64 SAL_CALL EntryInputStream::getLength( )
- throw(io::IOException, RuntimeException)
-{
- return nUncompressedSize;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/EntryInputStream.hxx b/package/source/zipapi/EntryInputStream.hxx
deleted file mode 100644
index 8a5bf0dc835f..000000000000
--- a/package/source/zipapi/EntryInputStream.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-#ifndef _ENTRY_INPUT_STREAM_HXX
-#define _ENTRY_INPUT_STREAM_HXX
-
-#include <cppuhelper/implbase2.hxx> // helper for implementations
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <Inflater.hxx>
-#include <com/sun/star/packages/zip/ZipEntry.hpp>
-#include <rtl/ref.hxx>
-#include <EncryptionData.hxx>
-class EntryInputStream : public cppu::WeakImplHelper2< com::sun::star::io::XInputStream,
- com::sun::star::io::XSeekable >
-{
-protected:
- com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xStream;
- com::sun::star::uno::Reference< com::sun::star::io::XSeekable > xSeek;
- sal_Int64 nEnd, nCurrent, nUncompressedSize;
- sal_Bool bRawStream, bHaveInMemory, bEncrypted;
- com::sun::star::uno::Sequence < sal_Int8 > aBuffer;
- const rtl::Reference < EncryptionData > xEncryptionData;
- const com::sun::star::packages::zip::ZipEntry aEntry;
- Inflater aInflater;
- void readIntoMemory()
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-public:
- EntryInputStream( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xInput,
- const com::sun::star::packages::zip::ZipEntry &rNewEntry,
- const rtl::Reference < EncryptionData > &xEncryptData,
- sal_Bool bGetRawStream = sal_False);
- virtual ~EntryInputStream();
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- // XSeekable
- virtual void SAL_CALL seek( sal_Int64 location )
- throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- /*
-private:
- void fill( void );
- */
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx
index a32a0007f541..40d2bee99333 100644
--- a/package/source/zipapi/Inflater.cxx
+++ b/package/source/zipapi/Inflater.cxx
@@ -107,7 +107,7 @@ void SAL_CALL Inflater::end( )
{
if (pStream != NULL)
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
inflateEnd(pStream);
#else
z_inflateEnd(pStream);
@@ -132,7 +132,7 @@ sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 > &rBuffer, sal_Int32 n
pStream->next_out = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset );
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
sal_Int32 nResult = ::inflate(pStream, Z_PARTIAL_FLUSH);
#else
sal_Int32 nResult = ::z_inflate(pStream, Z_PARTIAL_FLUSH);
diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx
index 5e167490d632..77315d0689db 100644
--- a/package/source/zipapi/MemoryByteGrabber.hxx
+++ b/package/source/zipapi/MemoryByteGrabber.hxx
@@ -63,7 +63,7 @@ public:
nBytesToRead = mnEnd - mnCurrent;
aData.realloc ( nBytesToRead );
- memcpy ( aData.getArray(), mpBuffer + mnCurrent, nBytesToRead );
+ rtl_copyMemory( aData.getArray(), mpBuffer + mnCurrent, nBytesToRead );
mnCurrent += nBytesToRead;
return nBytesToRead;
}
diff --git a/package/source/zipapi/XFileStream.cxx b/package/source/zipapi/XFileStream.cxx
deleted file mode 100644
index 6afe8079c5ec..000000000000
--- a/package/source/zipapi/XFileStream.cxx
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <XFileStream.hxx>
-#include <EncryptionData.hxx>
-#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <PackageConstants.hxx>
-#include <rtl/cipher.h>
-#include <ZipFile.hxx>
-#include <EncryptedDataHeader.hxx>
-#include <com/sun/star/io/XOutputStream.hpp>
-
-using namespace com::sun::star::packages::zip::ZipConstants;
-using namespace com::sun::star::io;
-using namespace com::sun::star::uno;
-using com::sun::star::lang::IllegalArgumentException;
-using ::rtl::OUString;
-
-XFileStream::XFileStream( ZipEntry & rEntry,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewTempStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bNewRawStream,
- sal_Bool bIsEncrypted )
-: maEntry ( rEntry )
-, mxData ( rData )
-, mbRawStream ( bNewRawStream )
-, mbFinished ( sal_False )
-, mxTempIn ( xNewTempStream )
-, mxTempSeek ( xNewTempStream, UNO_QUERY )
-, mxTempOut ( xNewTempStream, UNO_QUERY )
-, mxZipStream ( xNewZipStream )
-, mxZipSeek ( xNewZipStream, UNO_QUERY )
-, maInflater ( sal_True )
-, maCipher ( NULL )
-{
- mnZipCurrent = maEntry.nOffset;
- if (mbRawStream)
- {
- mnZipSize = maEntry.nMethod == DEFLATED ? maEntry.nCompressedSize : maEntry.nSize;
- mnZipEnd = maEntry.nOffset + mnZipSize;
- }
- else
- {
- mnZipSize = maEntry.nSize;
- mnZipEnd = maEntry.nMethod == DEFLATED ? maEntry.nOffset + maEntry.nCompressedSize : maEntry.nOffset + maEntry.nSize;
- }
-
- if ( bIsEncrypted )
- {
- sal_Bool bHaveEncryptData = ( !rData.isEmpty() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
-
- // if we have all the encrypted data, and want a raw stream, then prepend it to the stream, otherwise
- // make a cipher so we can decrypt it
- if ( bHaveEncryptData )
- {
- if ( !bNewRawStream )
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
- else
- {
- // Put in the EncryptedDataHeader
- Sequence < sal_Int8 > aEncryptedDataHeader ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() );
- sal_Int8 * pHeader = aEncryptedDataHeader.getArray();
- ZipFile::StaticFillHeader ( rData, rEntry.nSize, pHeader );
- mxTempOut->writeBytes ( aEncryptedDataHeader );
- mnZipSize += mxTempSeek->getPosition();
- mxTempSeek->seek ( 0 );
- }
- }
- }
-}
-
-XFileStream::~XFileStream()
-{
- if ( maCipher )
- rtl_cipher_destroy ( maCipher );
-}
-
-void XFileStream::fill( sal_Int64 nUntil)
-{
- sal_Int32 nRead;
- sal_Int64 nPosition = mxTempSeek->getPosition();
- mxTempSeek->seek ( mxTempSeek->getLength() );
- maBuffer.realloc ( n_ConstBufferSize );
-
- while ( mxTempSeek->getLength() < nUntil )
- {
- if ( !mbRawStream )
- {
- while ( 0 == ( nRead = maInflater.doInflate( maBuffer ) ) )
- {
- if ( maInflater.finished() || maInflater.needsDictionary() )
- {
- // some error handling ?
- return;
- }
-
- sal_Int64 nDiff = mnZipEnd - mnZipCurrent;
- if ( nDiff > 0 )
- {
- mxZipSeek->seek ( mnZipCurrent );
- nRead = mxZipStream->readBytes ( maCompBuffer, static_cast < sal_Int32 > ( nDiff < n_ConstBufferSize ? nDiff : n_ConstBufferSize ) );
- mnZipCurrent += nRead;
- // maCompBuffer now has the uncompressed data, check if we need to decrypt
- // before passing to the Inflater
- if ( maCipher )
- {
- Sequence < sal_Int8 > aCryptBuffer ( nRead );
- rtlCipherError aResult = rtl_cipher_decode ( maCipher,
- maCompBuffer.getConstArray(),
- nRead,
- reinterpret_cast < sal_uInt8 * > (aCryptBuffer.getArray()),
- nRead);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- maCompBuffer = aCryptBuffer; // Now it holds the decrypted data
-
- }
- maInflater.setInput ( maCompBuffer );
- }
- else
- {
- // some error handling ?
- return;
- }
- }
- }
- else
- {
- sal_Int64 nDiff = mnZipEnd - mnZipCurrent;
- mxZipSeek->seek ( mnZipCurrent );
- nRead = mxZipStream->readBytes ( maBuffer, static_cast < sal_Int32 > ( nDiff < n_ConstBufferSize ? nDiff : n_ConstBufferSize ) );
- mnZipCurrent += nRead;
- }
- Sequence < sal_Int8 > aTmpBuffer ( maBuffer.getConstArray(), nRead );
- mxTempOut->writeBytes ( aTmpBuffer );
- }
- mxTempSeek->seek ( nPosition );
-}
-
-sal_Int32 SAL_CALL XFileStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- sal_Int64 nPosition = mxTempSeek->getPosition();
- if ( nPosition + nBytesToRead > mnZipSize )
- nBytesToRead = static_cast < sal_Int32 > ( mnZipSize - nPosition );
-
- sal_Int64 nUntil = nBytesToRead + nPosition + n_ConstBufferSize;
- if (nUntil > mnZipSize )
- nUntil = mnZipSize;
- if ( nUntil > mxTempSeek->getLength() )
- fill ( nUntil );
- sal_Int32 nRead = mxTempIn->readBytes ( aData, nBytesToRead );
- return nRead;
-}
-
-sal_Int32 SAL_CALL XFileStream::readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- return readBytes ( aData, nMaxBytesToRead );
-}
-void SAL_CALL XFileStream::skipBytes( sal_Int32 nBytesToSkip )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- seek ( mxTempSeek->getPosition() + nBytesToSkip );
-}
-
-sal_Int32 SAL_CALL XFileStream::available( )
- throw( NotConnectedException, IOException, RuntimeException)
-{
- return static_cast < sal_Int32 > ( mnZipSize - mxTempSeek->getPosition() );
-}
-
-void SAL_CALL XFileStream::closeInput( )
- throw( NotConnectedException, IOException, RuntimeException)
-{
-}
-void SAL_CALL XFileStream::seek( sal_Int64 location )
- throw( IllegalArgumentException, IOException, RuntimeException)
-{
- if ( location > mnZipSize || location < 0 )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 );
- if ( location > mxTempSeek->getLength() )
- {
- sal_Int64 nUntil = location + n_ConstBufferSize > mnZipSize ? mnZipSize : location + n_ConstBufferSize;
- fill ( nUntil );
- }
- mxTempSeek->seek ( location );
-}
-sal_Int64 SAL_CALL XFileStream::getPosition( )
- throw(IOException, RuntimeException)
-{
- return mxTempSeek->getPosition();
-}
-sal_Int64 SAL_CALL XFileStream::getLength( )
- throw(IOException, RuntimeException)
-{
- return mnZipSize;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XFileStream.hxx b/package/source/zipapi/XFileStream.hxx
deleted file mode 100644
index 51518de9591c..000000000000
--- a/package/source/zipapi/XFileStream.hxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-#ifndef _XFILE_STREAM_HXX
-#define _XFILE_STREAM_HXX
-
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <rtl/ref.hxx>
-#include <Inflater.hxx>
-#include <ZipEntry.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace io { class XOutputStream; }
-} } }
-class EncryptionData;
-typedef void* rtlCipher;
-class XFileStream : public cppu::WeakImplHelper2
-<
- com::sun::star::io::XInputStream,
- com::sun::star::io::XSeekable
->
-{
-protected:
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxZipStream;
- com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxTempIn;
- com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxTempSeek;
- com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > mxTempOut;
- com::sun::star::uno::Sequence < sal_Int8 > maBuffer, maCompBuffer;
- ZipEntry maEntry;
- rtl::Reference < EncryptionData > mxData;
- rtlCipher maCipher;
- Inflater maInflater;
- sal_Bool mbRawStream, mbFinished;
- sal_Int64 mnZipCurrent, mnZipEnd, mnZipSize;
- void fill( sal_Int64 nUntil );
-
-public:
- XFileStream( ZipEntry & rEntry,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewTempStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted );
- virtual ~XFileStream();
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- // XSeekable
- virtual void SAL_CALL seek( sal_Int64 location )
- throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XMemoryStream.cxx b/package/source/zipapi/XMemoryStream.cxx
deleted file mode 100644
index 7003bf1b814b..000000000000
--- a/package/source/zipapi/XMemoryStream.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <XMemoryStream.hxx>
-
-using namespace com::sun::star::io;
-using namespace com::sun::star::uno;
-
-XMemoryStream::XMemoryStream ( com::sun::star::uno::Sequence < sal_Int8 > & rNewBuffer )
-: ZipPackageBuffer ( rNewBuffer )
-{
-}
-XMemoryStream::~XMemoryStream(void)
-{
-}
-::com::sun::star::uno::Any SAL_CALL XMemoryStream::queryInterface( const com::sun::star::uno::Type& rType )
- throw(com::sun::star::uno::RuntimeException)
-{
- return ::cppu::queryInterface ( rType ,
- // OWeakObject interfaces
- reinterpret_cast< XInterface* > ( this ) ,
- static_cast< XWeak* > ( this ) ,
- // my interfaces
- static_cast< XInputStream* > ( this ) ,
- static_cast< XSeekable* > ( this ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 1cad883f972a..a6049fd2cbef 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -28,12 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <XUnbufferedStream.hxx>
-#include <EncryptionData.hxx>
+
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+
+#include <XUnbufferedStream.hxx>
+#include <EncryptionData.hxx>
#include <PackageConstants.hxx>
-#include <rtl/cipher.h>
#include <ZipFile.hxx>
#include <EncryptedDataHeader.hxx>
#include <algorithm>
@@ -48,6 +50,7 @@
using namespace ::com::sun::star;
#endif
+using namespace ::com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
@@ -55,20 +58,22 @@ using com::sun::star::lang::IllegalArgumentException;
using com::sun::star::packages::zip::ZipIOException;
using ::rtl::OUString;
-XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
- ZipEntry & rEntry,
- Reference < XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Int8 nStreamMode,
- sal_Bool bIsEncrypted,
- const ::rtl::OUString& aMediaType,
- sal_Bool bRecoveryMode )
+XUnbufferedStream::XUnbufferedStream(
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ SotMutexHolderRef aMutexHolder,
+ ZipEntry & rEntry,
+ Reference < XInputStream > xNewZipStream,
+ const ::rtl::Reference< EncryptionData >& rData,
+ sal_Int8 nStreamMode,
+ sal_Bool bIsEncrypted,
+ const ::rtl::OUString& aMediaType,
+ sal_Bool bRecoveryMode )
: maMutexHolder( aMutexHolder.Is() ? aMutexHolder : SotMutexHolderRef( new SotMutexHolder ) )
, mxZipStream ( xNewZipStream )
, mxZipSeek ( xNewZipStream, UNO_QUERY )
, maEntry ( rEntry )
, mxData ( rData )
-, maCipher ( NULL )
+, mnBlockSize( 1 )
, maInflater ( sal_True )
, mbRawStream ( nStreamMode == UNBUFF_STREAM_RAW || nStreamMode == UNBUFF_STREAM_WRAPPEDRAW )
, mbWrappedRaw ( nStreamMode == UNBUFF_STREAM_WRAPPEDRAW )
@@ -91,11 +96,15 @@ XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
mnZipSize = maEntry.nSize;
mnZipEnd = maEntry.nMethod == DEFLATED ? maEntry.nOffset + maEntry.nCompressedSize : maEntry.nOffset + maEntry.nSize;
}
- sal_Bool bHaveEncryptData = ( rData.is() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
+ sal_Bool bHaveEncryptData = ( rData.is() && rData->m_aSalt.getLength() && rData->m_aInitVector.getLength() && rData->m_nIterationCount != 0 ) ? sal_True : sal_False;
sal_Bool bMustDecrypt = ( nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False;
if ( bMustDecrypt )
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
+ {
+ m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
+ mnBlockSize = ( rData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 16 : 1 );
+ }
+
if ( bHaveEncryptData && mbWrappedRaw && bIsEncrypted )
{
// if we have the data needed to decrypt it, but didn't want it decrypted (or
@@ -104,24 +113,26 @@ XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
// Make a buffer big enough to hold both the header and the data itself
maHeader.realloc ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() +
+ rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() +
+ rData->m_aDigest.getLength() +
aMediaType.getLength() * sizeof( sal_Unicode ) );
sal_Int8 * pHeader = maHeader.getArray();
- ZipFile::StaticFillHeader ( rData, rEntry.nSize, aMediaType, pHeader );
+ ZipFile::StaticFillHeader( rData, rEntry.nSize, aMediaType, pHeader );
mnHeaderToRead = static_cast < sal_Int16 > ( maHeader.getLength() );
}
}
// allows to read package raw stream
-XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStream,
- const rtl::Reference < EncryptionData > &rData )
+XUnbufferedStream::XUnbufferedStream(
+ const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/,
+ const Reference < XInputStream >& xRawStream,
+ const ::rtl::Reference< EncryptionData >& rData )
: maMutexHolder( new SotMutexHolder )
, mxZipStream ( xRawStream )
, mxZipSeek ( xRawStream, UNO_QUERY )
, mxData ( rData )
-, maCipher ( NULL )
+, mnBlockSize( 1 )
, maInflater ( sal_True )
, mbRawStream ( sal_False )
, mbWrappedRaw ( sal_False )
@@ -137,8 +148,8 @@ XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStre
OSL_ENSURE( mxZipSeek.is(), "The stream must be seekable!\n" );
// skip raw header, it must be already parsed to rData
- mnZipCurrent = n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength();
+ mnZipCurrent = n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength();
try {
if ( mxZipSeek.is() )
@@ -150,13 +161,12 @@ XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStre
mnZipEnd = mnZipCurrent + mnZipSize;
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
+ // the raw data will not be decrypted, no need for the cipher
+ // m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
}
XUnbufferedStream::~XUnbufferedStream()
{
- if ( maCipher )
- rtl_cipher_destroy ( maCipher );
}
sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
@@ -183,7 +193,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
{
sal_Int16 nHeadRead = static_cast< sal_Int16 >(( nRequestedBytes > mnHeaderToRead ?
mnHeaderToRead : nRequestedBytes ));
- memcpy ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead );
+ rtl_copyMemory ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead );
mnHeaderToRead = mnHeaderToRead - nHeadRead;
if ( nHeadRead < nRequestedBytes )
@@ -245,12 +255,17 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Dictionaries are not supported!" ) ),
Reference< XInterface >() );
- sal_Int32 nDiff = static_cast < sal_Int32 > ( mnZipEnd - mnZipCurrent );
+ sal_Int32 nDiff = static_cast< sal_Int32 >( mnZipEnd - mnZipCurrent );
if ( nDiff > 0 )
{
mxZipSeek->seek ( mnZipCurrent );
- sal_Int32 nToRead = std::min ( nDiff, std::max ( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) ) );
- sal_Int32 nZipRead = mxZipStream->readBytes ( maCompBuffer, nToRead );
+
+ sal_Int32 nToRead = std::max( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) );
+ if ( mnBlockSize > 1 )
+ nToRead = nToRead + mnBlockSize - nToRead % mnBlockSize;
+ nToRead = std::min( nDiff, nToRead );
+
+ sal_Int32 nZipRead = mxZipStream->readBytes( maCompBuffer, nToRead );
if ( nZipRead < nToRead )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No expected data!" ) ),
Reference< XInterface >() );
@@ -258,23 +273,22 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
mnZipCurrent += nZipRead;
// maCompBuffer now has the data, check if we need to decrypt
// before passing to the Inflater
- if ( maCipher )
+ if ( m_xCipherContext.is() )
{
if ( mbCheckCRC )
maCRC.update( maCompBuffer );
- Sequence < sal_Int8 > aCryptBuffer ( nZipRead );
- rtlCipherError aResult =
- rtl_cipher_decode ( maCipher,
- maCompBuffer.getConstArray(),
- nZipRead,
- reinterpret_cast < sal_uInt8 * > (aCryptBuffer.getArray()),
- nZipRead);
- if( aResult != rtl_Cipher_E_None ) {
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
+ maCompBuffer = m_xCipherContext->convertWithCipherContext( maCompBuffer );
+ if ( mnZipCurrent == mnZipEnd )
+ {
+ uno::Sequence< sal_Int8 > aSuffix = m_xCipherContext->finalizeCipherContextAndDispose();
+ if ( aSuffix.getLength() )
+ {
+ sal_Int32 nOldLen = maCompBuffer.getLength();
+ maCompBuffer.realloc( nOldLen + aSuffix.getLength() );
+ rtl_copyMemory( maCompBuffer.getArray() + nOldLen, aSuffix.getConstArray(), aSuffix.getLength() );
+ }
}
- maCompBuffer = aCryptBuffer; // Now it holds the decrypted data
-
}
maInflater.setInput ( maCompBuffer );
}
@@ -293,7 +307,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
if ( mbCheckCRC && ( !mbRawStream || mbWrappedRaw ) )
{
- if ( !maCipher && !mbWrappedRaw )
+ if ( !m_xCipherContext.is() && !mbWrappedRaw )
maCRC.update( aData );
#if 0
diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx
index 320031f515dd..43a659485c24 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -32,6 +32,8 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
#include <cppuhelper/implbase1.hxx>
#include <rtl/ref.hxx>
#include <Inflater.hxx>
@@ -44,7 +46,6 @@
#define UNBUFF_STREAM_WRAPPEDRAW 2
class EncryptionData;
-typedef void* rtlCipher;
class XUnbufferedStream : public cppu::WeakImplHelper1
<
com::sun::star::io::XInputStream
@@ -57,8 +58,9 @@ protected:
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
com::sun::star::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
ZipEntry maEntry;
- rtl::Reference < EncryptionData > mxData;
- rtlCipher maCipher;
+ ::rtl::Reference< EncryptionData > mxData;
+ sal_Int32 mnBlockSize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
ZipUtils::Inflater maInflater;
sal_Bool mbRawStream, mbWrappedRaw, mbFinished;
sal_Int16 mnHeaderToRead;
@@ -68,18 +70,21 @@ protected:
public:
XUnbufferedStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData >& rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
const ::rtl::OUString& aMediaType,
sal_Bool bRecoveryMode );
// allows to read package raw stream
- XUnbufferedStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
- const rtl::Reference < EncryptionData > &rData );
+ XUnbufferedStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
+ const ::rtl::Reference< EncryptionData >& rData );
virtual ~XUnbufferedStream();
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 4c6115f21768..5151d26781b6 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -28,29 +28,36 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ZipFile.hxx>
-#include <ZipEnumeration.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <rtl/cipher.h>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+#include <com/sun/star/xml/crypto/XCipherContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
#include <rtl/digest.h>
-/*
-#include <XMemoryStream.hxx>
-#include <XFileStream.hxx>
-*/
+
+#include <vector>
+
+#include "blowfishcontext.hxx"
+#include "sha1context.hxx"
+#include <ZipFile.hxx>
+#include <ZipEnumeration.hxx>
#include <XUnbufferedStream.hxx>
#include <PackageConstants.hxx>
#include <EncryptedDataHeader.hxx>
#include <EncryptionData.hxx>
#include <MemoryByteGrabber.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <CRC32.hxx>
-#include <string.h> // for memcpy
-#include <vector>
-
-#include <comphelper/storagehelper.hxx>
+#define AES_CBC_BLOCK_SIZE 16
using namespace com::sun::star;
using namespace com::sun::star::io;
@@ -66,13 +73,13 @@ using ZipUtils::Inflater;
/** This class is used to read entries from a zip file
*/
-ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, xFactory ( xNewFactory )
+, m_xFactory ( xNewFactory )
, bRecoveryMode( sal_False )
{
if (bInitialise)
@@ -80,20 +87,20 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe
if ( readCEN() == -1 )
{
aEntries.clear();
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () );
}
}
}
-ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise, sal_Bool bForceRecovery, Reference < XProgressHandler > xProgress )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise, sal_Bool bForceRecovery, uno::Reference < XProgressHandler > xProgress )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, xFactory ( xNewFactory )
+, m_xFactory ( xNewFactory )
, xProgressHandler( xProgress )
, bRecoveryMode( bForceRecovery )
{
@@ -106,7 +113,7 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe
else if ( readCEN() == -1 )
{
aEntries.clear();
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () );
}
}
}
@@ -116,55 +123,94 @@ ZipFile::~ZipFile()
aEntries.clear();
}
-void ZipFile::setInputStream ( Reference < XInputStream > xNewStream )
+void ZipFile::setInputStream ( uno::Reference < XInputStream > xNewStream )
{
::osl::MutexGuard aGuard( m_aMutex );
xStream = xNewStream;
- xSeek = Reference < XSeekable > ( xStream, UNO_QUERY );
+ xSeek = uno::Reference < XSeekable > ( xStream, UNO_QUERY );
aGrabber.setInputStream ( xStream );
}
-sal_Bool ZipFile::StaticGetCipher ( const rtl::Reference < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode )
+uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData )
{
- sal_Bool bResult = sal_False;
- if ( xEncryptionData.is() )
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext;
+ if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA256_1K )
{
- Sequence < sal_uInt8 > aDerivedKey (16);
- rtlCipherError aResult;
- Sequence < sal_Int8 > aDecryptBuffer;
-
- // Get the key
- rtl_digest_PBKDF2 ( aDerivedKey.getArray(), 16,
- reinterpret_cast < const sal_uInt8 * > (xEncryptionData->aKey.getConstArray() ),
- xEncryptionData->aKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aSalt.getConstArray() ),
- xEncryptionData->aSalt.getLength(),
- xEncryptionData->nIterationCount );
-
- rCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- aResult = rtl_cipher_init( rCipher, bDecode ? rtl_Cipher_DirectionDecode : rtl_Cipher_DirectionEncode,
- aDerivedKey.getConstArray(),
- aDerivedKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aInitVector.getConstArray() ),
- xEncryptionData->aInitVector.getLength());
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
-
- bResult = ( aResult == rtl_Cipher_E_None );
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
}
+ else if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA1_1K )
+ xDigestContext.set( SHA1DigestContext::Create(), uno::UNO_SET_THROW );
- return bResult;
+ return xDigestContext;
}
-void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData,
+uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData, bool bEncrypt )
+{
+ uno::Reference< xml::crypto::XCipherContext > xResult;
+
+ try
+ {
+ uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize );
+ if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > (xEncryptionData->m_aKey.getConstArray() ),
+ xEncryptionData->m_aKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > ( xEncryptionData->m_aSalt.getConstArray() ),
+ xEncryptionData->m_aSalt.getLength(),
+ xEncryptionData->m_nIterationCount ) )
+ {
+ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create derived key!") ),
+ uno::Reference< XInterface >() );
+ }
+
+ if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() );
+ }
+ else if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::BLOWFISH_CFB_8 )
+ {
+ xResult = BlowfishCFB8CipherContext::Create( aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt );
+ }
+ else
+ {
+ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown cipher algorithm is requested!") ),
+ uno::Reference< XInterface >() );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Can not create cipher context!" );
+ }
+
+ return xResult;
+}
+
+void ZipFile::StaticFillHeader( const ::rtl::Reference< EncryptionData >& rData,
sal_Int32 nSize,
const ::rtl::OUString& aMediaType,
sal_Int8 * & pHeader )
{
// I think it's safe to restrict vector and salt length to 2 bytes !
- sal_Int16 nIVLength = static_cast < sal_Int16 > ( rData->aInitVector.getLength() );
- sal_Int16 nSaltLength = static_cast < sal_Int16 > ( rData->aSalt.getLength() );
- sal_Int16 nDigestLength = static_cast < sal_Int16 > ( rData->aDigest.getLength() );
+ sal_Int16 nIVLength = static_cast < sal_Int16 > ( rData->m_aInitVector.getLength() );
+ sal_Int16 nSaltLength = static_cast < sal_Int16 > ( rData->m_aSalt.getLength() );
+ sal_Int16 nDigestLength = static_cast < sal_Int16 > ( rData->m_aDigest.getLength() );
sal_Int16 nMediaTypeLength = static_cast < sal_Int16 > ( aMediaType.getLength() * sizeof( sal_Unicode ) );
// First the header
@@ -178,7 +224,7 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = ( n_ConstCurrentVersion >> 8 ) & 0xFF;
// Then the iteration Count
- sal_Int32 nIterationCount = rData->nIterationCount;
+ sal_Int32 nIterationCount = rData->m_nIterationCount;
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 0 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 8 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 16 ) & 0xFF);
@@ -190,6 +236,34 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = static_cast< sal_Int8 >(( nSize >> 16 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nSize >> 24 ) & 0xFF);
+ // Then the encryption algorithm
+ sal_Int32 nEncAlgID = rData->m_nEncAlg;
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 24 ) & 0xFF);
+
+ // Then the checksum algorithm
+ sal_Int32 nChecksumAlgID = rData->m_nCheckAlg;
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 24 ) & 0xFF);
+
+ // Then the derived key size
+ sal_Int32 nDerivedKeySize = rData->m_nDerivedKeySize;
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 24 ) & 0xFF);
+
+ // Then the start key generation algorithm
+ sal_Int32 nKeyAlgID = rData->m_nStartKeyGenID;
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 24 ) & 0xFF);
+
// Then the salt length
*(pHeader++) = static_cast< sal_Int8 >(( nSaltLength >> 0 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nSaltLength >> 8 ) & 0xFF);
@@ -207,26 +281,30 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = static_cast< sal_Int8 >(( nMediaTypeLength >> 8 ) & 0xFF);
// Then the salt content
- memcpy ( pHeader, rData->aSalt.getConstArray(), nSaltLength );
+ rtl_copyMemory ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength );
pHeader += nSaltLength;
// Then the IV content
- memcpy ( pHeader, rData->aInitVector.getConstArray(), nIVLength );
+ rtl_copyMemory ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength );
pHeader += nIVLength;
// Then the digest content
- memcpy ( pHeader, rData->aDigest.getConstArray(), nDigestLength );
+ rtl_copyMemory ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength );
pHeader += nDigestLength;
// Then the mediatype itself
- memcpy ( pHeader, aMediaType.getStr(), nMediaTypeLength );
+ rtl_copyMemory ( pHeader, aMediaType.getStr(), nMediaTypeLength );
pHeader += nMediaTypeLength;
}
-sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
+sal_Bool ZipFile::StaticFillData ( ::rtl::Reference< BaseEncryptionData > & rData,
+ sal_Int32 &rEncAlg,
+ sal_Int32 &rChecksumAlg,
+ sal_Int32 &rDerivedKeySize,
+ sal_Int32 &rStartKeyGenID,
sal_Int32 &rSize,
::rtl::OUString& aMediaType,
- Reference < XInputStream > &rStream )
+ const uno::Reference< XInputStream >& rStream )
{
sal_Bool bOk = sal_False;
const sal_Int32 nHeaderSize = n_ConstHeaderSize - 4;
@@ -243,13 +321,33 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
nCount |= ( pBuffer[nPos++] & 0xFF ) << 8;
nCount |= ( pBuffer[nPos++] & 0xFF ) << 16;
nCount |= ( pBuffer[nPos++] & 0xFF ) << 24;
- rData->nIterationCount = nCount;
+ rData->m_nIterationCount = nCount;
rSize = pBuffer[nPos++] & 0xFF;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 8;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 16;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 24;
+ rEncAlg = pBuffer[nPos++] & 0xFF;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rChecksumAlg = pBuffer[nPos++] & 0xFF;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rDerivedKeySize = pBuffer[nPos++] & 0xFF;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rStartKeyGenID = pBuffer[nPos++] & 0xFF;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
sal_Int16 nSaltLength = pBuffer[nPos++] & 0xFF;
nSaltLength |= ( pBuffer[nPos++] & 0xFF ) << 8;
sal_Int16 nIVLength = ( pBuffer[nPos++] & 0xFF );
@@ -262,16 +360,16 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
if ( nSaltLength == rStream->readBytes ( aBuffer, nSaltLength ) )
{
- rData->aSalt.realloc ( nSaltLength );
- memcpy ( rData->aSalt.getArray(), aBuffer.getConstArray(), nSaltLength );
+ rData->m_aSalt.realloc ( nSaltLength );
+ rtl_copyMemory ( rData->m_aSalt.getArray(), aBuffer.getConstArray(), nSaltLength );
if ( nIVLength == rStream->readBytes ( aBuffer, nIVLength ) )
{
- rData->aInitVector.realloc ( nIVLength );
- memcpy ( rData->aInitVector.getArray(), aBuffer.getConstArray(), nIVLength );
+ rData->m_aInitVector.realloc ( nIVLength );
+ rtl_copyMemory ( rData->m_aInitVector.getArray(), aBuffer.getConstArray(), nIVLength );
if ( nDigestLength == rStream->readBytes ( aBuffer, nDigestLength ) )
{
- rData->aDigest.realloc ( nDigestLength );
- memcpy ( rData->aDigest.getArray(), aBuffer.getConstArray(), nDigestLength );
+ rData->m_aDigest.realloc ( nDigestLength );
+ rtl_copyMemory ( rData->m_aDigest.getArray(), aBuffer.getConstArray(), nDigestLength );
if ( nMediaTypeLength == rStream->readBytes ( aBuffer, nMediaTypeLength ) )
{
@@ -287,85 +385,107 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
return bOk;
}
-Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< XInputStream >& xStream,
- const rtl::Reference < EncryptionData > &rData )
+uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< XInputStream >& xStream,
+ const ::rtl::Reference< EncryptionData > &rData )
throw ( packages::WrongPasswordException, ZipIOException, RuntimeException )
{
if ( !rData.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
- if ( !rData->aKey.getLength() )
+ if ( !rData->m_aKey.getLength() )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Reference< XSeekable > xSeek( xStream, UNO_QUERY );
+ uno::Reference< XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "The stream must be seekable!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" );
- if ( rData->aDigest.getLength() )
+ OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
+ if ( rData->m_aDigest.getLength() )
{
- sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
- nSize = nSize > n_ConstDigestLength ? n_ConstDigestLength : nSize;
+ sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
+ if ( nSize > n_ConstDigestLength + 32 )
+ nSize = n_ConstDigestLength + 32;
// skip header
- xSeek->seek( n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength() );
+ xSeek->seek( n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength() );
// Only want to read enough to verify the digest
Sequence < sal_Int8 > aReadBuffer ( nSize );
xStream->readBytes( aReadBuffer, nSize );
- if ( !StaticHasValidPassword( aReadBuffer, rData ) )
+ if ( !StaticHasValidPassword( xFactory, aReadBuffer, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
- return new XUnbufferedStream ( xStream, rData );
+ return new XUnbufferedStream( xFactory, xStream, rData );
+}
+
+#if 0
+// for debugging purposes
+void CheckSequence( const uno::Sequence< sal_Int8 >& aSequence )
+{
+ if ( aSequence.getLength() )
+ {
+ sal_Int32* pPointer = *( (sal_Int32**)&aSequence );
+ sal_Int32 nSize = *( pPointer + 1 );
+ sal_Int32 nMemSize = *( pPointer - 2 );
+ sal_Int32 nUsedMemSize = ( nSize + 4 * sizeof( sal_Int32 ) );
+ OSL_ENSURE( nSize == aSequence.getLength() && nUsedMemSize + 7 - ( nUsedMemSize - 1 ) % 8 == nMemSize, "Broken Sequence!" );
+ }
}
+#endif
-sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffer, const rtl::Reference < EncryptionData > &rData )
+sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServiceFactory >& xFactory, const Sequence< sal_Int8 > &aReadBuffer, const ::rtl::Reference< EncryptionData > &rData )
{
- if ( !rData.is() || !rData->aKey.getLength() )
+ if ( !rData.is() || !rData->m_aKey.getLength() )
return sal_False;
sal_Bool bRet = sal_False;
- sal_Int32 nSize = aReadBuffer.getLength();
-
- // make a temporary cipher
- rtlCipher aCipher;
- StaticGetCipher ( rData, aCipher, sal_True );
-
- Sequence < sal_Int8 > aDecryptBuffer ( nSize );
- rtlDigest aDigest = rtl_digest_createSHA1();
- rtlDigestError aDigestResult;
- Sequence < sal_uInt8 > aDigestSeq ( RTL_DIGEST_LENGTH_SHA1 );
- rtlCipherError aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- if(aResult != rtl_Cipher_E_None ) {
- OSL_ASSERT ( aResult == rtl_Cipher_E_None);
+
+ uno::Reference< xml::crypto::XCipherContext > xCipher( StaticGetCipher( xFactory, rData, false ), uno::UNO_SET_THROW );
+
+ uno::Sequence< sal_Int8 > aDecryptBuffer;
+ uno::Sequence< sal_Int8 > aDecryptBuffer2;
+ try
+ {
+ aDecryptBuffer = xCipher->convertWithCipherContext( aReadBuffer );
+ aDecryptBuffer2 = xCipher->finalizeCipherContextAndDispose();
+ }
+ catch( uno::Exception& )
+ {
+ // decryption with padding will throw the exception in finalizing if the buffer represent only part of the stream
+ // it is no problem, actually this is why we read 32 additional bytes ( two of maximal possible encryption blocks )
+ }
+
+ if ( aDecryptBuffer2.getLength() )
+ {
+ sal_Int32 nOldLen = aDecryptBuffer.getLength();
+ aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() );
+ rtl_copyMemory( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() );
}
- aDigestResult = rtl_digest_updateSHA1 ( aDigest,
- static_cast < const void * > ( aDecryptBuffer.getConstArray() ), nSize );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
+ if ( aDecryptBuffer.getLength() > n_ConstDigestLength )
+ aDecryptBuffer.realloc( n_ConstDigestLength );
+
+ uno::Sequence< sal_Int8 > aDigestSeq;
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext( StaticGetDigestContextForChecksum( xFactory, rData ), uno::UNO_SET_THROW );
- aDigestResult = rtl_digest_getSHA1 ( aDigest, aDigestSeq.getArray(), RTL_DIGEST_LENGTH_SHA1 );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
+ xDigestContext->updateDigest( aDecryptBuffer );
+ aDigestSeq = xDigestContext->finalizeDigestAndDispose();
// If we don't have a digest, then we have to assume that the password is correct
- if ( rData->aDigest.getLength() != 0 &&
- ( aDigestSeq.getLength() != rData->aDigest.getLength() ||
+ if ( rData->m_aDigest.getLength() != 0 &&
+ ( aDigestSeq.getLength() != rData->m_aDigest.getLength() ||
0 != rtl_compareMemory ( aDigestSeq.getConstArray(),
- rData->aDigest.getConstArray(),
+ rData->m_aDigest.getConstArray(),
aDigestSeq.getLength() ) ) )
{
// We should probably tell the user that the password they entered was wrong
@@ -373,136 +493,44 @@ sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffe
else
bRet = sal_True;
- rtl_digest_destroySHA1 ( aDigest );
-
return bRet;
}
-sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const rtl::Reference < EncryptionData > &rData )
+sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const ::rtl::Reference< EncryptionData >& rData )
{
::osl::MutexGuard aGuard( m_aMutex );
sal_Bool bRet = sal_False;
- if ( rData->aKey.getLength() )
+ if ( rData.is() && rData->m_aKey.getLength() )
{
xSeek->seek( rEntry.nOffset );
sal_Int32 nSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
// Only want to read enough to verify the digest
- nSize = nSize > n_ConstDigestLength ? n_ConstDigestLength : nSize;
+ if ( nSize > n_ConstDigestDecrypt )
+ nSize = n_ConstDigestDecrypt;
+
Sequence < sal_Int8 > aReadBuffer ( nSize );
xStream->readBytes( aReadBuffer, nSize );
- bRet = StaticHasValidPassword( aReadBuffer, rData );
+ bRet = StaticHasValidPassword( m_xFactory, aReadBuffer, rData );
}
+
return bRet;
}
-#if 0
-Reference < XInputStream > ZipFile::createFileStream(
- ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted )
-{
- static OUString sServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- Reference < XInputStream > xTempStream = Reference < XInputStream > ( xFactory->createInstance ( sServiceName ), UNO_QUERY );
- return new XFileStream ( rEntry, xStream, xTempStream, rData, bRawStream, bIsEncrypted );
-}
-Reference < XInputStream > ZipFile::createMemoryStream(
- ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted )
-{
- sal_Int32 nUncompressedSize, nEnd;
- if (bRawStream)
- {
- nUncompressedSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
- nEnd = rEntry.nOffset + nUncompressedSize;
- }
- else
- {
- nUncompressedSize = rEntry.nSize;
- nEnd = rEntry.nMethod == DEFLATED ? rEntry.nOffset + rEntry.nCompressedSize : rEntry.nOffset + rEntry.nSize;
- }
- sal_Int32 nSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
- Sequence < sal_Int8 > aReadBuffer ( nSize ), aDecryptBuffer, aWriteBuffer;
- rtlCipher aCipher;
-
- // If the encryption key is zero, we need to return the raw stream. First check if
- // we have the salt. If we have the salt, then check if we have the encryption key
- // if not, return rawStream instead.
-
- sal_Bool bHaveEncryptData = ( rData.is() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
- sal_Bool bMustDecrypt = ( !bRawStream && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False;
-
- if ( bMustDecrypt )
- {
- StaticGetCipher ( rData, aCipher, sal_True );
- aDecryptBuffer.realloc ( nSize );
- }
-
- if ( nSize <0 )
- throw IOException ( );
-
- xSeek->seek( rEntry.nOffset );
- xStream->readBytes( aReadBuffer, nSize ); // Now it holds the raw stuff from disk
-
- if ( bMustDecrypt )
- {
- rtlCipherError aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aReadBuffer = aDecryptBuffer; // Now it holds the decrypted data
- }
- if (bRawStream || rEntry.nMethod == STORED)
- aWriteBuffer = aReadBuffer; // bRawStream means the caller doesn't want it decompressed
- else
- {
- aInflater.setInputSegment( aReadBuffer, 0, nSize );
- aWriteBuffer.realloc( nUncompressedSize );
- aInflater.doInflate( aWriteBuffer );
- aInflater.reset();
- }
-
- if ( bHaveEncryptData && !bMustDecrypt && bIsEncrypted )
- {
- // if we have the data needed to decrypt it, but didn't want it decrypted (or
- // we couldn't decrypt it due to wrong password), then we prepend this
- // data to the stream
-
- // Make a buffer big enough to hold both the header and the data itself
- Sequence < sal_Int8 > aEncryptedDataHeader ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() +
- aWriteBuffer.getLength() );
- sal_Int8 * pHeader = aEncryptedDataHeader.getArray();
- StaticFillHeader ( rData, rEntry.nSize, pHeader );
- memcpy ( pHeader, aWriteBuffer.getConstArray(), aWriteBuffer.getLength() );
-
- // dump old buffer and point aWriteBuffer to the new one with the header
- aWriteBuffer = aEncryptedDataHeader;
- }
- return Reference < XInputStream > ( new XMemoryStream ( aWriteBuffer ) );
-}
-#endif
-Reference < XInputStream > ZipFile::createUnbufferedStream(
+uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
::rtl::OUString aMediaType )
{
::osl::MutexGuard aGuard( m_aMutex );
- return new XUnbufferedStream ( aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
+ return new XUnbufferedStream ( m_xFactory, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
}
@@ -511,8 +539,8 @@ ZipEnumeration * SAL_CALL ZipFile::entries( )
return new ZipEnumeration ( aEntries );
}
-Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
@@ -529,7 +557,7 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- if ( bIsEncrypted && rData.is() && rData->aDigest.getLength() )
+ if ( bIsEncrypted && rData.is() && rData->m_aDigest.getLength() )
bNeedRawStream = !hasValidPassword ( rEntry, rData );
return createUnbufferedStream ( aMutexHolder,
@@ -539,8 +567,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw ( packages::WrongPasswordException,
@@ -562,12 +590,12 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
// to detect password correctness
if ( !rData.is() )
throw ZipException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" );
- if ( rData->aDigest.getLength() && !hasValidPassword ( rEntry, rData ) )
+ OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
+ if ( rData->m_aDigest.getLength() && !hasValidPassword ( rEntry, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
else
@@ -580,8 +608,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData >& rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
@@ -594,9 +622,9 @@ Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
return createUnbufferedStream ( aMutexHolder, rEntry, rData, UNBUFF_STREAM_RAW, bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
+uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData >& rData,
const ::rtl::OUString& aMediaType,
SotMutexHolderRef aMutexHolder )
throw ( packages::NoEncryptionException,
@@ -628,7 +656,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
aGrabber >> nTestSig;
if (nTestSig != LOCSIG)
- throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid LOC header (bad signature") ), Reference < XInterface > () );
+ throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid LOC header (bad signature") ), uno::Reference < XInterface > () );
aGrabber >> nVersion;
aGrabber >> nFlag;
aGrabber >> nHow;
@@ -674,7 +702,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
if ( bBroken && !bRecoveryMode )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
return sal_True;
}
@@ -708,17 +736,17 @@ sal_Int32 ZipFile::findEND( )
}
catch ( IllegalArgumentException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( NotConnectedException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( BufferSizeExceededException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
sal_Int32 ZipFile::readCEN()
@@ -739,25 +767,25 @@ sal_Int32 ZipFile::readCEN()
aGrabber >> nCenOff;
if ( nTotal * CENHDR > nCenLen )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "invalid END header (bad entry count)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "invalid END header (bad entry count)") ), uno::Reference < XInterface > () );
if ( nTotal > ZIP_MAXENTRIES )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "too many entries in ZIP File") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "too many entries in ZIP File") ), uno::Reference < XInterface > () );
if ( nCenLen < 0 || nCenLen > nEndPos )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () );
nCenPos = nEndPos - nCenLen;
if ( nCenOff < 0 || nCenOff > nCenPos )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () );
nLocPos = nCenPos - nCenOff;
aGrabber.seek( nCenPos );
Sequence < sal_Int8 > aCENBuffer ( nCenLen );
sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen );
if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
- throw ZipException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Error reading CEN into memory buffer!") ), Reference < XInterface > () );
+ throw ZipException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Error reading CEN into memory buffer!") ), uno::Reference < XInterface > () );
MemoryByteGrabber aMemGrabber ( aCENBuffer );
@@ -769,19 +797,19 @@ sal_Int32 ZipFile::readCEN()
{
aMemGrabber >> nTestSig;
if ( nTestSig != CENSIG )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad signature)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad signature)") ), uno::Reference < XInterface > () );
aMemGrabber.skipBytes ( 2 );
aMemGrabber >> aEntry.nVersion;
if ( ( aEntry.nVersion & 1 ) == 1 )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (encrypted entry)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (encrypted entry)") ), uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nFlag;
aMemGrabber >> aEntry.nMethod;
if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED)
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad compression method)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad compression method)") ), uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nTime;
aMemGrabber >> aEntry.nCrc;
@@ -797,13 +825,13 @@ sal_Int32 ZipFile::readCEN()
aEntry.nOffset *= -1;
if ( aEntry.nPathLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), uno::Reference < XInterface > () );
if ( nCommentLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), uno::Reference < XInterface > () );
if ( aEntry.nExtraLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), uno::Reference < XInterface > () );
// read always in UTF8, some tools seem not to set UTF8 bit
aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
@@ -811,14 +839,14 @@ sal_Int32 ZipFile::readCEN()
RTL_TEXTENCODING_UTF8 );
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, sal_True ) )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), uno::Reference < XInterface > () );
aMemGrabber.skipBytes( aEntry.nPathLen + aEntry.nExtraLen + nCommentLen );
aEntries[aEntry.sPath] = aEntry;
}
if (nCount != nTotal)
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Count != Total") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Count != Total") ), uno::Reference < XInterface > () );
}
catch ( IllegalArgumentException & )
{
@@ -991,15 +1019,15 @@ sal_Int32 ZipFile::recover()
}
catch ( IllegalArgumentException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( NotConnectedException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( BufferSizeExceededException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
}
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 4e08b7e8520d..b1b8ce7e2c38 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -28,18 +28,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ZipOutputStream.hxx>
+
#include <com/sun/star/packages/zip/ZipConstants.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/storagehelper.hxx>
+
#include <osl/time.h>
+
#include <EncryptionData.hxx>
#include <PackageConstants.hxx>
#include <ZipEntry.hxx>
#include <ZipFile.hxx>
-#include <rtl/ref.hxx>
-#include <com/sun/star/io/XOutputStream.hpp>
-
-#include <comphelper/storagehelper.hxx>
+#include <ZipPackageStream.hxx>
+#include <ZipOutputStream.hxx>
+using namespace com::sun::star;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
using namespace com::sun::star::packages;
@@ -48,17 +51,18 @@ using namespace com::sun::star::packages::zip::ZipConstants;
/** This class is used to write Zip files
*/
-ZipOutputStream::ZipOutputStream( Reference < XOutputStream > &xOStream )
-: xStream(xOStream)
-, aBuffer(n_ConstBufferSize)
+ZipOutputStream::ZipOutputStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference < XOutputStream > &xOStream )
+: m_xFactory( xFactory )
+, xStream(xOStream)
+, m_aDeflateBuffer(n_ConstBufferSize)
, aDeflater(DEFAULT_COMPRESSION, sal_True)
, aChucker(xOStream)
, pCurrentEntry(NULL)
, nMethod(DEFLATED)
, bFinished(sal_False)
, bEncryptCurrentEntry(sal_False)
-
-
+, m_pCurrentStream(NULL)
{
}
@@ -80,7 +84,7 @@ void SAL_CALL ZipOutputStream::setLevel( sal_Int32 nNewLevel )
}
void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry,
- rtl::Reference < EncryptionData > &xEncryptData,
+ ZipPackageStream* pStream,
sal_Bool bEncrypt)
throw(IOException, RuntimeException)
{
@@ -94,18 +98,20 @@ void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry,
rEntry.nFlag = 1 << 11;
if (rEntry.nSize == -1 || rEntry.nCompressedSize == -1 ||
rEntry.nCrc == -1)
+ {
+ rEntry.nSize = rEntry.nCompressedSize = 0;
rEntry.nFlag |= 8;
+ }
if (bEncrypt)
{
bEncryptCurrentEntry = sal_True;
- ZipFile::StaticGetCipher( xEncryptData, aCipher, sal_False );
-
- aDigest = rtl_digest_createSHA1();
+ m_xCipherContext = ZipFile::StaticGetCipher( m_xFactory, pStream->GetEncryptionData(), true );
+ m_xDigestContext = ZipFile::StaticGetDigestContextForChecksum( m_xFactory, pStream->GetEncryptionData() );
mnDigested = 0;
rEntry.nFlag |= 1 << 4;
- pCurrentEncryptData = xEncryptData.get();
+ m_pCurrentStream = pStream;
}
sal_Int32 nLOCLength = writeLOC(rEntry);
rEntry.nOffset = static_cast < sal_Int32 > (aChucker.GetPosition()) - nLOCLength;
@@ -144,11 +150,12 @@ void SAL_CALL ZipOutputStream::closeEntry( )
}
else
{
- pEntry->nSize = aDeflater.getTotalIn();
- pEntry->nCompressedSize = aDeflater.getTotalOut();
+ if ( !bEncryptCurrentEntry )
+ {
+ pEntry->nSize = aDeflater.getTotalIn();
+ pEntry->nCompressedSize = aDeflater.getTotalOut();
+ }
pEntry->nCrc = aCRC.getValue();
- if ( bEncryptCurrentEntry )
- pEntry->nSize = pEntry->nCompressedSize;
writeEXT(*pEntry);
}
aDeflater.reset();
@@ -165,19 +172,22 @@ void SAL_CALL ZipOutputStream::closeEntry( )
if (bEncryptCurrentEntry)
{
- rtlDigestError aDigestResult;
- aEncryptionBuffer.realloc ( 0 );
bEncryptCurrentEntry = sal_False;
- rtl_cipher_destroy ( aCipher );
- pCurrentEncryptData->aDigest.realloc ( RTL_DIGEST_LENGTH_SHA1 );
- aDigestResult = rtl_digest_getSHA1 ( aDigest,
- reinterpret_cast < sal_uInt8 * > ( pCurrentEncryptData->aDigest.getArray() ),
- RTL_DIGEST_LENGTH_SHA1 );
- OSL_ASSERT( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
- rtl_digest_destroySHA1 ( aDigest );
+
+ m_xCipherContext.clear();
+
+ uno::Sequence< sal_Int8 > aDigestSeq;
+ if ( m_xDigestContext.is() )
+ {
+ aDigestSeq = m_xDigestContext->finalizeDigestAndDispose();
+ m_xDigestContext.clear();
+ }
+
+ if ( m_pCurrentStream )
+ m_pCurrentStream->setDigest( aDigestSeq );
}
pCurrentEntry = NULL;
+ m_pCurrentStream = NULL;
}
}
@@ -242,43 +252,53 @@ void SAL_CALL ZipOutputStream::finish( )
void ZipOutputStream::doDeflate()
{
- sal_Int32 nLength = aDeflater.doDeflateSegment(aBuffer, 0, aBuffer.getLength());
- sal_Int32 nOldLength = aBuffer.getLength();
+ sal_Int32 nLength = aDeflater.doDeflateSegment(m_aDeflateBuffer, 0, m_aDeflateBuffer.getLength());
if ( nLength > 0 )
{
- Sequence < sal_Int8 > aTmpBuffer ( aBuffer.getConstArray(), nLength );
- const void *pTmpBuffer = static_cast < const void * > ( aTmpBuffer.getConstArray() );
- if (bEncryptCurrentEntry)
+ uno::Sequence< sal_Int8 > aTmpBuffer( m_aDeflateBuffer.getConstArray(), nLength );
+ if ( bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
{
// Need to update our digest before encryption...
- rtlDigestError aDigestResult = rtl_Digest_E_None;
- sal_Int16 nDiff = n_ConstDigestLength - mnDigested;
+ sal_Int32 nDiff = n_ConstDigestLength - mnDigested;
if ( nDiff )
{
- sal_Int16 nEat = static_cast < sal_Int16 > ( nDiff > nLength ? nLength : nDiff );
- aDigestResult = rtl_digest_updateSHA1 ( aDigest, pTmpBuffer, nEat );
- mnDigested = mnDigested + nEat;
+ sal_Int32 nEat = ::std::min( nLength, nDiff );
+ uno::Sequence< sal_Int8 > aTmpSeq( aTmpBuffer.getConstArray(), nEat );
+ m_xDigestContext->updateDigest( aTmpSeq );
+ mnDigested = mnDigested + static_cast< sal_Int16 >( nEat );
}
- OSL_ASSERT( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
-
- aEncryptionBuffer.realloc ( nLength );
- rtlCipherError aCipherResult;
- aCipherResult = rtl_cipher_encode ( aCipher, pTmpBuffer,
- nLength, reinterpret_cast < sal_uInt8 * > (aEncryptionBuffer.getArray()), nLength );
- OSL_ASSERT( aCipherResult == rtl_Cipher_E_None );
- (void)aCipherResult;
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->convertWithCipherContext( aTmpBuffer );
aChucker.WriteBytes( aEncryptionBuffer );
- aCRC.update ( aEncryptionBuffer );
- aEncryptionBuffer.realloc ( nOldLength );
+
+ // the sizes as well as checksum for encrypted streams is calculated here
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
}
else
+ {
aChucker.WriteBytes ( aTmpBuffer );
+ }
+ }
+
+ if ( aDeflater.finished() && bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
+ {
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->finalizeCipherContextAndDispose();
+ if ( aEncryptionBuffer.getLength() )
+ {
+ aChucker.WriteBytes( aEncryptionBuffer );
+
+ // the sizes as well as checksum for encrypted streams is calculated hier
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
+ }
}
}
+
void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
throw(IOException, RuntimeException)
{
@@ -295,7 +315,7 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
- throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
@@ -344,7 +364,7 @@ sal_Int32 ZipOutputStream::writeLOC( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
- throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx
new file mode 100644
index 000000000000..6459cc4e4b5e
--- /dev/null
+++ b/package/source/zipapi/blowfishcontext.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_package.hxx"
+
+#include <rtl/cipher.h>
+#include <rtl/ref.hxx>
+
+#include "blowfishcontext.hxx"
+
+using namespace ::com::sun::star;
+
+// static
+uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( const uno::Sequence< sal_Int8 >& aDerivedKey, const uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt )
+{
+ ::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext();
+ xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
+ if ( !xResult->m_pCipher )
+ throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create cipher!")),
+ uno::Reference< XInterface >() );
+
+ if ( rtl_Cipher_E_None != rtl_cipher_init(
+ xResult->m_pCipher,
+ bEncrypt ? rtl_Cipher_DirectionEncode : rtl_Cipher_DirectionDecode,
+ reinterpret_cast< const sal_uInt8* >( aDerivedKey.getConstArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ),
+ aInitVector.getLength() ) )
+ {
+ throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not initialize cipher!") ),
+ uno::Reference< XInterface >() );
+ }
+
+ xResult->m_bEncrypt = bEncrypt;
+
+ return uno::Reference< xml::crypto::XCipherContext >( xResult.get() );
+}
+
+BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext()
+{
+ if ( m_pCipher )
+ {
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+ }
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::IllegalArgumentException, lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( aData.getLength() );
+ rtlCipherError nError = rtl_Cipher_E_None;
+
+ if ( m_bEncrypt )
+ {
+ rtl_cipher_encode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+ else
+ {
+ rtl_cipher_decode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+
+ if ( rtl_Cipher_E_None != nError )
+ {
+ throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not decrypt/encrypt with cipher!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+ return aResult;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+
+ return uno::Sequence< sal_Int8 >();
+}
+
+
diff --git a/package/source/zipapi/blowfishcontext.hxx b/package/source/zipapi/blowfishcontext.hxx
new file mode 100644
index 000000000000..49cce2fc0e65
--- /dev/null
+++ b/package/source/zipapi/blowfishcontext.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _BLOWFISHCONTEXT_HXX
+#define _BLOWFISHCONTEXT_HXX
+
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+
+class BlowfishCFB8CipherContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XCipherContext >
+{
+ ::osl::Mutex m_aMutex;
+ void* m_pCipher;
+ bool m_bEncrypt;
+
+ BlowfishCFB8CipherContext()
+ : m_pCipher( NULL )
+ , m_bEncrypt( false )
+ {}
+
+public:
+
+ virtual ~BlowfishCFB8CipherContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext >
+ Create( const ::com::sun::star::uno::Sequence< sal_Int8 >& aDerivedKey, const ::com::sun::star::uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt );
+
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _BLOWFISHCONTEXT_HXX
+
diff --git a/package/source/zipapi/makefile.mk b/package/source/zipapi/makefile.mk
index ec8d63694ec6..8a07d448ddbb 100644
--- a/package/source/zipapi/makefile.mk
+++ b/package/source/zipapi/makefile.mk
@@ -46,8 +46,10 @@ SLOFILES= \
$(SLO)$/CRC32.obj \
$(SLO)$/ByteChucker.obj \
$(SLO)$/ByteGrabber.obj \
+ $(SLO)$/blowfishcontext.obj \
$(SLO)$/Inflater.obj \
$(SLO)$/Deflater.obj \
+ $(SLO)$/sha1context.obj \
$(SLO)$/ZipEnumeration.obj \
$(SLO)$/ZipFile.obj \
$(SLO)$/ZipOutputStream.obj \
diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx
new file mode 100644
index 000000000000..0e34fd4a9661
--- /dev/null
+++ b/package/source/zipapi/sha1context.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_package.hxx"
+
+#include <rtl/digest.h>
+#include <rtl/ref.hxx>
+
+#include "sha1context.hxx"
+
+using namespace ::com::sun::star;
+
+// static
+uno::Reference< xml::crypto::XDigestContext > SHA1DigestContext::Create()
+{
+ ::rtl::Reference< SHA1DigestContext > xResult = new SHA1DigestContext();
+ xResult->m_pDigest = rtl_digest_createSHA1();
+ if ( !xResult->m_pDigest )
+ throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create cipher!") ),
+ uno::Reference< XInterface >() );
+
+ return uno::Reference< xml::crypto::XDigestContext >( xResult.get() );
+}
+
+SHA1DigestContext::~SHA1DigestContext()
+{
+ if ( m_pDigest )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+ }
+}
+
+void SAL_CALL SHA1DigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ if ( rtl_Digest_E_None != rtl_digest_updateSHA1( m_pDigest, aData.getConstArray(), aData.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL SHA1DigestContext::finalizeDigestAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( RTL_DIGEST_LENGTH_SHA1 );
+ if ( rtl_Digest_E_None != rtl_digest_getSHA1( m_pDigest, reinterpret_cast< sal_uInt8* >( aResult.getArray() ), aResult.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ return aResult;
+}
+
+
diff --git a/package/source/zipapi/XMemoryStream.hxx b/package/source/zipapi/sha1context.hxx
index 935712abbe42..6d9374db8a46 100644
--- a/package/source/zipapi/XMemoryStream.hxx
+++ b/package/source/zipapi/sha1context.hxx
@@ -25,21 +25,35 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _XMEMORY_STREAM_HXX
-#define _XMEMORY_STREAM_HXX
+#ifndef _SHA1CONTEXT_HXX
+#define _SHA1CONTEXT_HXX
-#include <ZipPackageBuffer.hxx>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
-class ZipPackage;
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
-class XMemoryStream: public ZipPackageBuffer
+class SHA1DigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
{
+ ::osl::Mutex m_aMutex;
+ void* m_pDigest;
+
+ SHA1DigestContext()
+ : m_pDigest( NULL )
+ {}
+
public:
- XMemoryStream ( com::sun::star::uno::Sequence < sal_Int8 > & rNewBuffer );
- virtual ~XMemoryStream(void);
- virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& rType )
- throw(com::sun::star::uno::RuntimeException);
+
+ virtual ~SHA1DigestContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext >
+ Create();
+
+ virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+
};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index e3ab5caabd63..ed5f81ba592d 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -17,7 +17,7 @@
* 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).
+ * ( 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
@@ -26,7 +26,7 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
+// MARKER( update_precomp.py ): autogen include statement, do not remove
#include "precompiled_package.hxx"
#include <ZipPackage.hxx>
#include <ZipPackageSink.hxx>
@@ -63,6 +63,8 @@
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <cppuhelper/implbase1.hxx>
#include <ContentInfo.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -83,6 +85,7 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
#include <comphelper/documentconstants.hxx>
+#include <comphelper/sequenceashashmap.hxx>
using namespace std;
using namespace osl;
@@ -156,35 +159,37 @@ public:
class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
{
- virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ virtual sal_Int32 SAL_CALL readBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
- virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ virtual sal_Int32 SAL_CALL readSomeBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
virtual void SAL_CALL skipBytes( sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{}
virtual sal_Int32 SAL_CALL available()
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
virtual void SAL_CALL closeInput()
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{}
};
//===========================================================================
-ZipPackage::ZipPackage (const uno::Reference < XMultiServiceFactory > &xNewFactory)
+ZipPackage::ZipPackage ( const uno::Reference < XMultiServiceFactory > &xNewFactory )
: m_aMutexHolder( new SotMutexHolder )
+, m_nStartKeyGenerationID( xml::crypto::DigestID::SHA1 )
+, m_nChecksumDigestID( xml::crypto::DigestID::SHA1_1K )
+, m_nCommonEncryptionID( xml::crypto::CipherID::BLOWFISH_CFB_8 )
, m_bHasEncryptedEntries ( sal_False )
, m_bHasNonEncryptedEntries ( sal_False )
, m_bInconsistent ( sal_False )
-, m_bUseManifest ( sal_True )
, m_bForceRecovery ( sal_False )
, m_bMediaTypeFallbackUsed ( sal_False )
, m_nFormat( embed::StorageFormats::PACKAGE ) // package is the default format
@@ -206,28 +211,19 @@ ZipPackage::~ZipPackage( void )
// So there is no need in explicit m_pRootFolder->releaseUpwardRef() call here any more
// since m_pRootFolder has no parent and cleaning of it's children will be done automatically
// during m_pRootFolder dieing by refcount.
-
-#if 0
- // As all folders and streams contain references to their parents,
- // we must remove these references so that they will be deleted when
- // the boost::unordered_map of the root folder is cleared, releasing all subfolders
- // and substreams which in turn release theirs, etc. When m_xRootFolder is
- // released when this destructor completes, the folder tree should be
- // deleted fully (and automagically).
-
- m_pRootFolder->releaseUpwardRef();
-#endif
}
+//--------------------------------------------------------
void ZipPackage::parseManifest()
{
if ( m_nFormat == embed::StorageFormats::PACKAGE )
{
sal_Bool bManifestParsed = sal_False;
+ bool bDifferentStartKeyAlgorithm = false;
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
if ( m_xRootFolder->hasByName( sMeta ) )
{
- const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
+ const OUString sManifest ( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) );
try {
uno::Reference< XUnoTunnel > xTunnel;
@@ -238,11 +234,11 @@ void ZipPackage::parseManifest()
{
aAny = xMetaInfFolder->getByName( sManifest );
aAny >>= xTunnel;
- uno::Reference < XActiveDataSink > xSink (xTunnel, UNO_QUERY);
- if (xSink.is())
+ uno::Reference < XActiveDataSink > xSink ( xTunnel, UNO_QUERY );
+ if ( xSink.is() )
{
OUString sManifestReader ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestReader" ) );
- uno::Reference < XManifestReader > xReader (m_xFactory->createInstance( sManifestReader ), UNO_QUERY );
+ uno::Reference < XManifestReader > xReader ( m_xFactory->createInstance( sManifestReader ), UNO_QUERY );
if ( xReader.is() )
{
const OUString sPropFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
@@ -253,45 +249,57 @@ void ZipPackage::parseManifest()
const OUString sPropIterationCount ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
const OUString sPropSize ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
const OUString sPropDigest ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const OUString sPropDerivedKeySize ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+ const OUString sPropDigestAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+ const OUString sPropEncryptionAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const OUString sPropStartKeyAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
- Sequence < Sequence < PropertyValue > > aManifestSequence = xReader->readManifestSequence ( xSink->getInputStream() );
+ uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence = xReader->readManifestSequence ( xSink->getInputStream() );
sal_Int32 nLength = aManifestSequence.getLength();
- const Sequence < PropertyValue > *pSequence = aManifestSequence.getConstArray();
+ const uno::Sequence < PropertyValue > *pSequence = aManifestSequence.getConstArray();
ZipPackageStream *pStream = NULL;
ZipPackageFolder *pFolder = NULL;
- for (sal_Int32 i = 0; i < nLength ; i++, pSequence++)
+ for ( sal_Int32 i = 0; i < nLength ; i++, pSequence++ )
{
OUString sPath, sMediaType, sVersion;
const PropertyValue *pValue = pSequence->getConstArray();
- const Any *pSalt = NULL, *pVector = NULL, *pCount = NULL, *pSize = NULL, *pDigest = NULL;
- for (sal_Int32 j = 0, nNum = pSequence->getLength(); j < nNum; j++ )
+ const Any *pSalt = NULL, *pVector = NULL, *pCount = NULL, *pSize = NULL, *pDigest = NULL, *pDigestAlg = NULL, *pEncryptionAlg = NULL, *pStartKeyAlg = NULL, *pDerivedKeySize = NULL;
+ for ( sal_Int32 j = 0, nNum = pSequence->getLength(); j < nNum; j++ )
{
- if (pValue[j].Name.equals( sPropFullPath ) )
+ if ( pValue[j].Name.equals( sPropFullPath ) )
pValue[j].Value >>= sPath;
- else if (pValue[j].Name.equals( sPropVersion ) )
+ else if ( pValue[j].Name.equals( sPropVersion ) )
pValue[j].Value >>= sVersion;
- else if (pValue[j].Name.equals( sPropMediaType ) )
+ else if ( pValue[j].Name.equals( sPropMediaType ) )
pValue[j].Value >>= sMediaType;
- else if (pValue[j].Name.equals( sPropSalt ) )
- pSalt = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropInitialisationVector ) )
- pVector = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropIterationCount ) )
- pCount = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropSize ) )
- pSize = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropDigest ) )
- pDigest = &(pValue[j].Value);
+ else if ( pValue[j].Name.equals( sPropSalt ) )
+ pSalt = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropInitialisationVector ) )
+ pVector = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropIterationCount ) )
+ pCount = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropSize ) )
+ pSize = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDigest ) )
+ pDigest = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDigestAlgorithm ) )
+ pDigestAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropEncryptionAlgorithm ) )
+ pEncryptionAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropStartKeyAlgorithm ) )
+ pStartKeyAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDerivedKeySize ) )
+ pDerivedKeySize = &( pValue[j].Value );
}
- if (sPath.getLength() && hasByHierarchicalName ( sPath ) )
+ if ( sPath.getLength() && hasByHierarchicalName ( sPath ) )
{
aAny = getByHierarchicalName( sPath );
uno::Reference < XUnoTunnel > xUnoTunnel;
aAny >>= xUnoTunnel;
sal_Int64 nTest=0;
- if ((nTest = xUnoTunnel->getSomething(ZipPackageFolder::static_getImplementationId())) != 0)
+ if ( (nTest = xUnoTunnel->getSomething( ZipPackageFolder::static_getImplementationId() )) != 0 )
{
pFolder = reinterpret_cast < ZipPackageFolder* > ( nTest );
pFolder->SetMediaType ( sMediaType );
@@ -299,15 +307,16 @@ void ZipPackage::parseManifest()
}
else
{
- pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething(ZipPackageStream::static_getImplementationId()));
+ pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething( ZipPackageStream::static_getImplementationId() ));
pStream->SetMediaType ( sMediaType );
pStream->SetFromManifest( sal_True );
- if (pSalt && pVector && pCount && pSize)
+ if ( pSalt && pVector && pCount && pSize && pDigest && pDigestAlg && pEncryptionAlg )
{
- Sequence < sal_uInt8 > aSequence;
- sal_Int32 nCount = 0, nSize = 0;
- pStream->SetToBeEncrypted ( sal_True );
+ uno::Sequence < sal_Int8 > aSequence;
+ sal_Int32 nCount = 0, nSize = 0, nDigestAlg = 0, nEncryptionAlg = 0, nDerivedKeySize = 16, nStartKeyAlg = xml::crypto::DigestID::SHA1;
+
+ pStream->SetToBeEncrypted ( sal_True );
*pSalt >>= aSequence;
pStream->setSalt ( aSequence );
@@ -321,18 +330,34 @@ void ZipPackage::parseManifest()
*pSize >>= nSize;
pStream->setSize ( nSize );
- if ( pDigest )
- {
- *pDigest >>= aSequence;
- pStream->setDigest ( aSequence );
- }
+ *pDigest >>= aSequence;
+ pStream->setDigest ( aSequence );
+
+ *pDigestAlg >>= nDigestAlg;
+ pStream->SetImportedChecksumAlgorithm( nDigestAlg );
+
+ *pEncryptionAlg >>= nEncryptionAlg;
+ pStream->SetImportedEncryptionAlgorithm( nEncryptionAlg );
+
+ if ( pDerivedKeySize )
+ *pDerivedKeySize >>= nDerivedKeySize;
+ pStream->SetImportedDerivedKeySize( nDerivedKeySize );
+
+ if ( pStartKeyAlg )
+ *pStartKeyAlg >>= nStartKeyAlg;
+ pStream->SetImportedStartKeyAlgorithm( nStartKeyAlg );
pStream->SetToBeCompressed ( sal_True );
pStream->SetToBeEncrypted ( sal_True );
pStream->SetIsEncrypted ( sal_True );
if ( !m_bHasEncryptedEntries
&& pStream->getName().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ) ) )
+ {
m_bHasEncryptedEntries = sal_True;
+ m_nStartKeyGenerationID = nStartKeyAlg;
+ m_nChecksumDigestID = nDigestAlg;
+ m_nCommonEncryptionID = nEncryptionAlg;
+ }
}
else
m_bHasNonEncryptedEntries = sal_True;
@@ -382,7 +407,7 @@ void ZipPackage::parseManifest()
nRead = aData.getLength();
if ( nRead )
- aPackageMediatype = ::rtl::OUString( (sal_Char*)aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
+ aPackageMediatype = ::rtl::OUString( ( sal_Char* )aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
}
}
@@ -411,24 +436,35 @@ void ZipPackage::parseManifest()
m_bInconsistent = m_pRootFolder->LookForUnexpectedODF12Streams( ::rtl::OUString() );
- sal_Bool bODF12AndOlder = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
- if ( !m_bForceRecovery && bODF12AndOlder && m_bInconsistent )
+ sal_Bool bODF12AndNewer = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
+ if ( !m_bForceRecovery && bODF12AndNewer )
{
- // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
- // in case of ODF1.2 documents without version in manifest.xml the property IsInconsistent
- // should be checked later
- throw ZipIOException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
- uno::Reference< uno::XInterface >() );
+ if ( m_bInconsistent )
+ {
+ // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
+ // in case of ODF1.2 documents without version in manifest.xml the property IsInconsistent
+ // should be checked later
+ throw ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ else if ( bDifferentStartKeyAlgorithm )
+ {
+ // all the streams should be encrypted with the same StartKey in ODF1.2
+ // TODO/LATER: in future the exception should be thrown
+ OSL_ENSURE( false, "ODF1.2 contains different StartKey Algorithms" );
+ // throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "More than one Start Key Generation algorithm is specified!" ) ), uno::Reference< uno::XInterface >() );
+ }
}
// in case it is a correct ODF1.2 document, the version must be set
// and the META-INF folder is reserved for package format
- if ( bODF12AndOlder )
+ if ( bODF12AndNewer )
m_xRootFolder->removeByName( sMeta );
}
}
+//--------------------------------------------------------
void ZipPackage::parseContentType()
{
if ( m_nFormat == embed::StorageFormats::OFOPXML )
@@ -465,7 +501,7 @@ void ZipPackage::parseContentType()
for ( nInd = 0; nInd < aContentTypeInfo[1].getLength(); nInd++ )
{
::rtl::OUString aPath;
- if ( aContentTypeInfo[1][nInd].First.toChar() == (sal_Unicode)'/' )
+ if ( aContentTypeInfo[1][nInd].First.toChar() == ( sal_Unicode )'/' )
aPath = aContentTypeInfo[1][nInd].First.copy( 1 );
else
aPath = aContentTypeInfo[1][nInd].First;
@@ -497,6 +533,7 @@ void ZipPackage::parseContentType()
}
}
+//--------------------------------------------------------
void ZipPackage::getZipFileContents()
{
auto_ptr < ZipEnumeration > pEnum ( m_pZipFile->entries() );
@@ -506,7 +543,7 @@ void ZipPackage::getZipFileContents()
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- while (pEnum->hasMoreElements())
+ while ( pEnum->hasMoreElements() )
{
nIndex = nOldIndex = 0;
pCurrent = m_pRootFolder;
@@ -523,18 +560,18 @@ void ZipPackage::getZipFileContents()
nStreamIndex = rName.lastIndexOf ( '/' );
if ( nStreamIndex != -1 )
{
- sDirName = rName.copy ( 0, nStreamIndex);
+ sDirName = rName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
- pCurrent = (*aIter).second;
+ pCurrent = ( *aIter ).second;
}
if ( pCurrent == m_pRootFolder )
{
- while ( (nIndex = rName.indexOf('/', nOldIndex) ) != -1 )
+ while ( ( nIndex = rName.indexOf( '/', nOldIndex ) ) != -1 )
{
sTemp = rName.copy ( nOldIndex, nIndex - nOldIndex );
- if (nIndex == nOldIndex)
+ if ( nIndex == nOldIndex )
break;
if ( !pCurrent->hasByName( sTemp ) )
{
@@ -544,7 +581,7 @@ void ZipPackage::getZipFileContents()
pCurrent = pPkgFolder;
}
else
- pCurrent = pCurrent->doGetByName(sTemp).pFolder;
+ pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
nOldIndex = nIndex+1;
}
if ( nStreamIndex != -1 && sDirName.getLength() )
@@ -553,7 +590,7 @@ void ZipPackage::getZipFileContents()
if ( rName.getLength() -1 != nStreamIndex )
{
nStreamIndex++;
- sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex);
+ sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex );
pPkgStream = new ZipPackageStream( *this, m_xFactory, m_bAllowRemoveOnInsert );
pPkgStream->SetPackageMember( sal_True );
pPkgStream->setZipEntryOnLoading( rEntry );
@@ -568,9 +605,9 @@ void ZipPackage::getZipFileContents()
parseContentType();
}
-// XInitialization
-void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "{ ZipPackage::initialize" );
sal_Bool bBadZipFile = sal_False, bHaveZipFile = sal_True;
@@ -582,7 +619,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
for( int ind = 0; ind < aArguments.getLength(); ind++ )
{
OUString aParamUrl;
- if ( (aArguments[ind] >>= aParamUrl))
+ if ( ( aArguments[ind] >>= aParamUrl ))
{
m_eMode = e_IMode_URL;
try
@@ -629,13 +666,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
if( !bHasSizeProperty || ( bHasSizeProperty && aSize ) )
{
uno::Reference < XActiveDataSink > xSink = new ZipPackageSink;
- if (aContent.openStream ( xSink ) )
+ if ( aContent.openStream ( xSink ) )
m_xContentStream = xSink->getInputStream();
}
else
bHaveZipFile = sal_False;
}
- catch (com::sun::star::uno::Exception&)
+ catch ( com::sun::star::uno::Exception& )
{
// Exception derived from uno::Exception thrown. This probably
// means the file doesn't exist...we'll create it at
@@ -643,13 +680,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
bHaveZipFile = sal_False;
}
}
- else if ( (aArguments[ind] >>= m_xStream ) )
+ else if ( ( aArguments[ind] >>= m_xStream ) )
{
// a writable stream can implement both XStream & XInputStream
m_eMode = e_IMode_XStream;
m_xContentStream = m_xStream->getInputStream();
}
- else if ( (aArguments[ind] >>= m_xContentStream) )
+ else if ( ( aArguments[ind] >>= m_xContentStream ) )
{
m_eMode = e_IMode_XInputStream;
}
@@ -717,7 +754,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
try
{
- if (m_xContentStream.is())
+ if ( m_xContentStream.is() )
{
// the stream must be seekable, if it is not it will be wrapped
m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xFactory );
@@ -732,7 +769,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
else
bHaveZipFile = sal_False;
}
- catch (com::sun::star::uno::Exception&)
+ catch ( com::sun::star::uno::Exception& )
{
// Exception derived from uno::Exception thrown. This probably
// means the file doesn't exist...we'll create it at
@@ -775,22 +812,23 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "} ZipPackage::initialize" );
}
+//--------------------------------------------------------
Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
- throw(NoSuchElementException, RuntimeException)
+ throw( NoSuchElementException, RuntimeException )
{
OUString sTemp, sDirName;
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- if ( (nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
- return makeAny ( uno::Reference < XUnoTunnel > (m_pRootFolder) );
+ if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
+ return makeAny ( uno::Reference < XUnoTunnel > ( m_pRootFolder ) );
else
{
nStreamIndex = aName.lastIndexOf ( '/' );
bool bFolder = nStreamIndex == nIndex-1;
if ( nStreamIndex != -1 )
{
- sDirName = aName.copy ( 0, nStreamIndex);
+ sDirName = aName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
{
@@ -798,16 +836,16 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
{
sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex );
sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 );
- if ( sTemp == (*aIter).second->getName() )
- return makeAny ( uno::Reference < XUnoTunnel > ( (*aIter).second ) );
+ if ( sTemp == ( *aIter ).second->getName() )
+ return makeAny ( uno::Reference < XUnoTunnel > ( ( *aIter ).second ) );
else
m_aRecent.erase ( aIter );
}
else
{
sTemp = aName.copy ( nStreamIndex + 1 );
- if ( (*aIter).second->hasByName( sTemp ) )
- return (*aIter).second->getByName( sTemp );
+ if ( ( *aIter ).second->hasByName( sTemp ) )
+ return ( *aIter ).second->getByName( sTemp );
else
m_aRecent.erase( aIter );
}
@@ -821,15 +859,15 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
nOldIndex = 0;
ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
- while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 )
{
- sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex );
if ( nIndex == nOldIndex )
break;
if ( pCurrent->hasByName( sTemp ) )
{
pPrevious = pCurrent;
- pCurrent = pCurrent->doGetByName(sTemp).pFolder;
+ pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
}
else
throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -837,16 +875,16 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
}
if ( bFolder )
{
- if (nStreamIndex != -1 )
+ if ( nStreamIndex != -1 )
m_aRecent[sDirName] = pPrevious;
return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) );
}
else
{
- sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
if ( pCurrent->hasByName ( sTemp ) )
{
- if (nStreamIndex != -1 )
+ if ( nStreamIndex != -1 )
m_aRecent[sDirName] = pCurrent;
return pCurrent->getByName( sTemp );
}
@@ -856,14 +894,15 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
}
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
- throw(RuntimeException)
+ throw( RuntimeException )
{
OUString sTemp, sDirName;
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- if ( (nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
+ if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
return sal_True;
else
{
@@ -871,7 +910,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
bool bFolder = nStreamIndex == nIndex-1;
if ( nStreamIndex != -1 )
{
- sDirName = aName.copy ( 0, nStreamIndex);
+ sDirName = aName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
{
@@ -879,7 +918,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
{
sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex );
sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 );
- if ( sTemp == (*aIter).second->getName() )
+ if ( sTemp == ( *aIter ).second->getName() )
return sal_True;
else
m_aRecent.erase ( aIter );
@@ -887,7 +926,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
else
{
sTemp = aName.copy ( nStreamIndex + 1 );
- if ( (*aIter).second->hasByName( sTemp ) )
+ if ( ( *aIter ).second->hasByName( sTemp ) )
return sal_True;
else
m_aRecent.erase( aIter );
@@ -902,9 +941,9 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
nOldIndex = 0;
- while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 )
{
- sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex );
if ( nIndex == nOldIndex )
break;
if ( pCurrent->hasByName( sTemp ) )
@@ -923,7 +962,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
else
{
- sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
if ( pCurrent->hasByName( sTemp ) )
{
@@ -935,21 +974,22 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
}
-// XSingleServiceFactory
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance( )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance()
+ throw( Exception, RuntimeException )
{
- uno::Reference < XInterface > xRef = *(new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ));
+ uno::Reference < XInterface > xRef = *( new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ) );
return xRef;
}
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
sal_Bool bArg = sal_False;
uno::Reference < XInterface > xRef;
if ( aArguments.getLength() )
aArguments[0] >>= bArg;
- if (bArg)
+ if ( bArg )
xRef = *new ZipPackageFolder ( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
else
xRef = *new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert );
@@ -957,16 +997,17 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c
return xRef;
}
+//--------------------------------------------------------
void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
{
const OUString sMime ( RTL_CONSTASCII_USTRINGPARAM ( "mimetype" ) );
- if (m_xRootFolder->hasByName( sMime ) )
+ if ( m_xRootFolder->hasByName( sMime ) )
m_xRootFolder->removeByName( sMime );
ZipEntry * pEntry = new ZipEntry;
- sal_Int32 nBufferLength = m_pRootFolder->GetMediaType( ).getLength();
+ sal_Int32 nBufferLength = m_pRootFolder->GetMediaType().getLength();
OString sMediaType = OUStringToOString( m_pRootFolder->GetMediaType(), RTL_TEXTENCODING_ASCII_US );
- Sequence< sal_Int8 > aType( (sal_Int8*)sMediaType.getStr(),
+ uno::Sequence< sal_Int8 > aType( ( sal_Int8* )sMediaType.getStr(),
nBufferLength );
@@ -981,14 +1022,12 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
try
{
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( aType, 0, nBufferLength );
aZipOut.closeEntry();
}
catch ( ::com::sun::star::io::IOException & r )
{
- OSL_FAIL( "Error adding mimetype to the ZipOutputStream" );
throw WrappedTargetException(
OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Error adding mimetype to the ZipOutputStream!" ) ),
static_cast < OWeakObject * > ( this ),
@@ -996,7 +1035,8 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
}
}
-void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+//--------------------------------------------------------
+void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
// Write the manifest
uno::Reference < XOutputStream > xManOutStream;
@@ -1006,28 +1046,29 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence
{
ZipEntry * pEntry = new ZipEntry;
ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
- xManOutStream = uno::Reference < XOutputStream > (*pBuffer, UNO_QUERY);
+ xManOutStream = uno::Reference < XOutputStream > ( *pBuffer, UNO_QUERY );
- pEntry->sPath = OUString( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml") );
+ pEntry->sPath = OUString( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
pEntry->nMethod = DEFLATED;
pEntry->nCrc = pEntry->nSize = pEntry->nCompressedSize = -1;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
- // Convert vector into a Sequence
- Sequence < Sequence < PropertyValue > > aManifestSequence ( aManList.size() );
- Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
- for (vector < Sequence < PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end();
+ // Convert vector into a uno::Sequence
+ uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence ( aManList.size() );
+ sal_Int32 nInd = 0;
+ for ( vector < uno::Sequence < PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end();
aIter != aEnd;
- ++aIter, ++pSequence)
- *pSequence= (*aIter);
+ aIter++, nInd++ )
+ {
+ aManifestSequence[nInd] = ( *aIter );
+ }
xWriter->writeManifestSequence ( xManOutStream, aManifestSequence );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
// the manifest.xml is never encrypted - so pass an empty reference
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
aZipOut.closeEntry();
}
@@ -1042,7 +1083,8 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence
}
}
-void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+//--------------------------------------------------------
+void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
const OUString sFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
@@ -1051,12 +1093,12 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
uno::Reference< io::XOutputStream > xConTypeOutStream( *pBuffer, UNO_QUERY );
- pEntry->sPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml") );
+ pEntry->sPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml" ) );
pEntry->nMethod = DEFLATED;
pEntry->nCrc = pEntry->nSize = pEntry->nCompressedSize = -1;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
- // Convert vector into a Sequence
+ // Convert vector into a uno::Sequence
// TODO/LATER: use Defaulst entries in future
uno::Sequence< beans::StringPair > aDefaultsSequence;
uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() );
@@ -1068,14 +1110,14 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
{
::rtl::OUString aPath;
::rtl::OUString aType;
- OSL_ENSURE( (*aIter)[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && (*aIter)[PKG_MNFST_FULLPATH].Name.equals( sFullPath ),
+ OSL_ENSURE( ( *aIter )[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && ( *aIter )[PKG_MNFST_FULLPATH].Name.equals( sFullPath ),
"The mediatype sequence format is wrong!\n" );
- (*aIter)[PKG_MNFST_MEDIATYPE].Value >>= aType;
+ ( *aIter )[PKG_MNFST_MEDIATYPE].Value >>= aType;
if ( aType.getLength() )
{
// only nonempty type makes sence here
nSeqLength++;
- (*aIter)[PKG_MNFST_FULLPATH].Value >>= aPath;
+ ( *aIter )[PKG_MNFST_FULLPATH].Value >>= aPath;
aOverridesSequence[nSeqLength-1].First = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) + aPath;
aOverridesSequence[nSeqLength-1].Second = aType;
}
@@ -1089,12 +1131,12 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
pBuffer->realloc( nBufferLength );
// there is no encryption in this format currently
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
aZipOut.closeEntry();
}
+//--------------------------------------------------------
void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream )
{
m_xContentSeek.set( xInStream, uno::UNO_QUERY_THROW );
@@ -1108,6 +1150,7 @@ void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream
m_pZipFile = new ZipFile ( m_xContentStream, m_xFactory, sal_False );
}
+//--------------------------------------------------------
uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
{
// In case the target local file does not exist or empty
@@ -1154,9 +1197,9 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
}
// Hand it to the ZipOutputStream:
- ZipOutputStream aZipOut ( xTempOut );
- aZipOut.setMethod(DEFLATED);
- aZipOut.setLevel(DEFAULT_COMPRESSION);
+ ZipOutputStream aZipOut( m_xFactory, xTempOut );
+ aZipOut.setMethod( DEFLATED );
+ aZipOut.setLevel( DEFAULT_COMPRESSION );
try
{
@@ -1169,7 +1212,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if ( m_xRootFolder->hasByName( sMeta ) )
{
- const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
+ const OUString sManifest ( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) );
uno::Reference< XUnoTunnel > xTunnel;
Any aAny = m_xRootFolder->getByName( sMeta );
@@ -1194,7 +1237,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
}
// Create a vector to store data for the manifest.xml file
- vector < Sequence < PropertyValue > > aManList;
+ vector < uno::Sequence < PropertyValue > > aManList;
const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
const OUString sVersion ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
@@ -1202,11 +1245,11 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if ( m_nFormat == embed::StorageFormats::PACKAGE )
{
- Sequence < PropertyValue > aPropSeq ( PKG_SIZE_NOENCR_MNFST );
+ uno::Sequence < PropertyValue > aPropSeq( PKG_SIZE_NOENCR_MNFST );
aPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType;
- aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= m_pRootFolder->GetMediaType( );
+ aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= m_pRootFolder->GetMediaType();
aPropSeq [PKG_MNFST_VERSION].Name = sVersion;
- aPropSeq [PKG_MNFST_VERSION].Value <<= m_pRootFolder->GetVersion( );
+ aPropSeq [PKG_MNFST_VERSION].Value <<= m_pRootFolder->GetVersion();
aPropSeq [PKG_MNFST_FULLPATH].Name = sFullPath;
aPropSeq [PKG_MNFST_FULLPATH].Value <<= OUString ( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
@@ -1221,15 +1264,14 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
-
- // call saveContents (it will recursively save sub-directories
+ // call saveContents ( it will recursively save sub-directories
OUString aEmptyString;
- m_pRootFolder->saveContents( aEmptyString, aManList, aZipOut, m_aEncryptionKey, aRandomPool );
+ m_pRootFolder->saveContents( aEmptyString, aManList, aZipOut, GetEncryptionKey(), aRandomPool );
// Clean up random pool memory
rtl_random_destroyPool ( aRandomPool );
- if( m_bUseManifest && m_nFormat == embed::StorageFormats::PACKAGE )
+ if( m_nFormat == embed::StorageFormats::PACKAGE )
{
WriteManifest( aZipOut, aManList );
}
@@ -1298,10 +1340,11 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
return xResult;
}
+//--------------------------------------------------------
uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
{
// open and truncate the original file
- Content aOriginalContent (m_aURL, uno::Reference < XCommandEnvironment >() );
+ Content aOriginalContent ( m_aURL, uno::Reference < XCommandEnvironment >() );
uno::Reference< XActiveDataStreamer > xSink = new ActiveDataStreamer;
if ( m_eMode == e_IMode_URL )
@@ -1335,7 +1378,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
aArg.Mode = OpenMode::DOCUMENT;
aArg.Priority = 0; // unused
aArg.Sink = xSink;
- aArg.Properties = Sequence< Property >( 0 ); // unused
+ aArg.Properties = uno::Sequence< Property >( 0 ); // unused
aOriginalContent.executeCommand( OUString(RTL_CONSTASCII_USTRINGPARAM( "open" )), makeAny( aArg ) );
}
@@ -1349,9 +1392,9 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
return xSink;
}
-// XChangesBatch
+//--------------------------------------------------------
void SAL_CALL ZipPackage::commitChanges()
- throw(WrappedTargetException, RuntimeException)
+ throw( WrappedTargetException, RuntimeException )
{
// lock the component for the time of commiting
::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
@@ -1414,8 +1457,8 @@ void SAL_CALL ZipPackage::commitChanges()
::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutputStream );
xOutputStream->flush();
uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor(
- xOutputStream, uno::UNO_QUERY);
- if (asyncOutputMonitor.is()) {
+ xOutputStream, uno::UNO_QUERY );
+ if ( asyncOutputMonitor.is() ) {
asyncOutputMonitor->waitForCompletion();
}
}
@@ -1501,7 +1544,7 @@ void SAL_CALL ZipPackage::commitChanges()
// if the file is still not corrupted, it can become after the next step
aContent.executeCommand ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "transfer" ) ), aAny );
}
- catch (::com::sun::star::uno::Exception& r)
+ catch ( ::com::sun::star::uno::Exception& r )
{
if ( bCanBeCorrupted )
DisconnectFromTargetAndThrowException_Impl( xTempInStream );
@@ -1521,6 +1564,7 @@ void SAL_CALL ZipPackage::commitChanges()
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "} ZipPackage::commitChanges" );
}
+//--------------------------------------------------------
void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Reference< io::XInputStream >& xTempStream )
{
m_xStream = uno::Reference< io::XStream >( xTempStream, uno::UNO_QUERY );
@@ -1549,15 +1593,47 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc
makeAny ( aException ) );
}
-sal_Bool SAL_CALL ZipPackage::hasPendingChanges( )
- throw(RuntimeException)
+//--------------------------------------------------------
+const uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey()
+{
+ uno::Sequence< sal_Int8 > aResult;
+
+ if ( m_aStorageEncryptionKeys.getLength() )
+ {
+ ::rtl::OUString aNameToFind;
+ if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA256 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA256UTF8;
+ else if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA1 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ for ( sal_Int32 nInd = 0; nInd < m_aStorageEncryptionKeys.getLength(); nInd++ )
+ if ( m_aStorageEncryptionKeys[nInd].Name.equals( aNameToFind ) )
+ m_aStorageEncryptionKeys[nInd].Value >>= aResult;
+
+ // empty keys are not allowed here
+ // so it is not important whether there is no key, or the key is empty, it is an error
+ if ( !aResult.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+ }
+ else
+ aResult = m_aEncryptionKey;
+
+ return aResult;
+}
+
+//--------------------------------------------------------
+sal_Bool SAL_CALL ZipPackage::hasPendingChanges()
+ throw( RuntimeException )
{
return sal_False;
}
-Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
- throw(RuntimeException)
+//--------------------------------------------------------
+Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges()
+ throw( RuntimeException )
{
- return Sequence < ElementChange > ();
+ return uno::Sequence < ElementChange > ();
}
/**
@@ -1567,150 +1643,247 @@ Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
uno::Reference < XInterface >SAL_CALL ZipPackage_createInstance(
const uno::Reference< XMultiServiceFactory > & xMgr )
{
- return uno::Reference< XInterface >( *new ZipPackage(xMgr) );
+ return uno::Reference< XInterface >( *new ZipPackage( xMgr ) );
}
+//--------------------------------------------------------
OUString ZipPackage::static_getImplementationName()
{
return OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.comp.ZipPackage" ) );
}
+//--------------------------------------------------------
Sequence< OUString > ZipPackage::static_getSupportedServiceNames()
{
- Sequence< OUString > aNames(1);
+ uno::Sequence< OUString > aNames( 1 );
aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.Package" ) );
return aNames;
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::static_supportsService( OUString const & rServiceName )
{
return rServiceName == getSupportedServiceNames()[0];
}
+//--------------------------------------------------------
OUString ZipPackage::getImplementationName()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_getImplementationName();
}
+//--------------------------------------------------------
Sequence< OUString > ZipPackage::getSupportedServiceNames()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_getSupportedServiceNames();
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_supportsService ( rServiceName );
}
+//--------------------------------------------------------
uno::Reference < XSingleServiceFactory > ZipPackage::createServiceFactory( uno::Reference < XMultiServiceFactory > const & rServiceFactory )
{
- return cppu::createSingleFactory (rServiceFactory,
+ return cppu::createSingleFactory ( rServiceFactory,
static_getImplementationName(),
ZipPackage_createInstance,
- static_getSupportedServiceNames());
+ static_getSupportedServiceNames() );
}
namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
-// XUnoTunnel
+//--------------------------------------------------------
Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
::cppu::OImplementationId &rId = lcl_ImplId::get();
return rId.getImplementationId();
}
-sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+//--------------------------------------------------------
+sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw( RuntimeException )
{
- if (aIdentifier.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
+ if ( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
return reinterpret_cast < sal_Int64 > ( this );
return 0;
}
-uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo( )
- throw(RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo()
+ throw( RuntimeException )
{
return uno::Reference < XPropertySetInfo > ();
}
+
+//--------------------------------------------------------
void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
{
if ( m_nFormat != embed::StorageFormats::PACKAGE )
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasNonEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsInconsistent") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaTypeFallbackUsed") ) )
+ if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
{
- if (!( aValue >>= m_aEncryptionKey ) || m_aEncryptionKey.getLength() == 0 )
+ if ( !( aValue >>= m_aEncryptionKey ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_aStorageEncryptionKeys.realloc( 0 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- if (!( aValue >>= m_bUseManifest ) )
+ // this property is only necessary to support raw passwords in storage API;
+ // because of this support the storage has to operate with more than one key dependent on storage generation algorithm;
+ // when this support is removed, the storage will get only one key from outside
+ // TODO/LATER: Get rid of this property as well as of support of raw passwords in storages
+ uno::Sequence< beans::NamedValue > aKeys;
+ if ( !( aValue >>= aKeys ) || ( aKeys.getLength() && aKeys.getLength() < 2 ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ if ( aKeys.getLength() )
+ {
+ bool bHasSHA256 = false;
+ bool bHasSHA1 = false;
+ for ( sal_Int32 nInd = 0; nInd < aKeys.getLength(); nInd++ )
+ {
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ) )
+ bHasSHA256 = true;
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ) )
+ bHasSHA1 = true;
+ }
+
+ if ( !bHasSHA256 || !bHasSHA1 )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Expected keys are not provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ m_aStorageEncryptionKeys = aKeys;
+ m_aEncryptionKey.realloc( 0 );
+ }
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ {
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ if ( m_pZipFile || !( aValue >>= aAlgorithms ) || aAlgorithms.getLength() == 0 )
+ {
+ // the algorithms can not be changed if the file has a persistence based on the algorithms ( m_pZipFile )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ for ( sal_Int32 nInd = 0; nInd < aAlgorithms.getLength(); nInd++ )
+ {
+ if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartKeyGenerationAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA256 && nID != xml::crypto::DigestID::SHA1 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nStartKeyGenerationID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::CipherID::AES_CBC_W3C_PADDING && nID != xml::crypto::CipherID::BLOWFISH_CFB_8 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nCommonEncryptionID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChecksumAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA1_1K && nID != xml::crypto::DigestID::SHA256_1K ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nChecksumDigestID = nID;
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "Unexpected encryption algorithm is provided!" );
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+ }
}
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
+
+//--------------------------------------------------------
Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
// TODO/LATER: Activate the check when zip-ucp is ready
// if ( m_nFormat != embed::StorageFormats::PACKAGE )
// throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
Any aAny;
- if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "EncryptionKey" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( ENCRYPTION_KEY_PROPERTY ) ) )
{
aAny <<= m_aEncryptionKey;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasEncryptedEntries" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
{
- aAny <<= m_bHasEncryptedEntries;
+ ::comphelper::SequenceAsHashMap aAlgorithms;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StartKeyGenerationAlgorithm" ) ) ] <<= m_nStartKeyGenerationID;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionAlgorithm" ) ) ] <<= m_nCommonEncryptionID;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChecksumAlgorithm" ) ) ] <<= m_nChecksumDigestID;
+ aAny <<= aAlgorithms.getAsConstNamedValueList();
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasNonEncryptedEntries" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- aAny <<= m_bHasNonEncryptedEntries;
+ aAny <<= m_aStorageEncryptionKeys;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "IsInconsistent" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( HAS_ENCRYPTED_ENTRIES_PROPERTY ) ) )
{
- aAny <<= m_bInconsistent;
+ aAny <<= m_bHasEncryptedEntries;
+ return aAny;
+ }
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) ) )
+ {
+ aAny <<= m_bHasNonEncryptedEntries;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "UseManifest" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( IS_INCONSISTENT_PROPERTY ) ) )
{
- aAny <<= m_bUseManifest;
+ aAny <<= m_bInconsistent;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "MediaTypeFallbackUsed" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
{
aAny <<= m_bMediaTypeFallbackUsed;
return aAny;
}
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx
index df789850189f..0d034f6af34c 100644
--- a/package/source/zippackage/ZipPackageEntry.cxx
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@ -75,18 +75,18 @@ void SAL_CALL ZipPackageEntry::setName( const OUString& aName )
// unfortunately no other exception than RuntimeException can be thrown here
// usually the package is used through storage implementation, the problem should be detected there
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_True ) )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
msName = aName;
if ( pParent )
pParent->doInsertByName ( this, sal_False );
}
-Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
+uno::Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
throw(RuntimeException)
{
- // return Reference< XInterface >( xParent, UNO_QUERY );
- return Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
+ // return uno::Reference< XInterface >( xParent, UNO_QUERY );
+ return uno::Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
}
void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert )
@@ -97,11 +97,11 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns
pNewParent->doInsertByName ( this, sal_False );
}
-void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewParent )
+void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xNewParent )
throw(NoSupportException, RuntimeException)
{
sal_Int64 nTest(0);
- Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY );
+ uno::Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY );
if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::static_getImplementationId () ) ) == 0 )
throw NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -115,24 +115,24 @@ void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewPar
}
}
//XPropertySet
-Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
throw(RuntimeException)
{
- return Reference < beans::XPropertySetInfo > ();
+ return uno::Reference < beans::XPropertySetInfo > ();
}
-void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 3667c30847ca..01f8e7008e5b 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -47,22 +47,21 @@
#include <rtl/instance.hxx>
#include <memory>
+using namespace com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::packages::zip;
using namespace com::sun::star::packages;
using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
using namespace com::sun::star::io;
using namespace cppu;
using namespace std;
using namespace ::com::sun::star;
-using rtl::OUString;
-namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
+namespace { struct lcl_CachedImplId : public rtl::Static< uno::Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
-ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
+ZipPackageFolder::ZipPackageFolder ( const uno::Reference< XMultiServiceFactory >& xFactory,
sal_Int32 nFormat,
sal_Bool bAllowRemoveOnInsert )
: m_xFactory( xFactory )
@@ -81,7 +80,7 @@ ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xF
aEntry.nCompressedSize = 0;
aEntry.nSize = 0;
aEntry.nOffset = -1;
- Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
+ uno::Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
if ( !rCachedImplId.getLength() )
rCachedImplId = getImplementationId();
}
@@ -99,7 +98,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
!bHasUnexpected && aCI != aEnd;
++aCI)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -111,7 +110,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
}
else
{
- OUString sOwnPath = aPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sOwnPath = aPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
bHasUnexpected = rInfo.pFolder->LookForUnexpectedODF12Streams( sOwnPath );
}
}
@@ -157,7 +156,7 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
aCI != aEnd;
++aCI)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -193,14 +192,14 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_get
}
// XNameContainer
-void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
if (hasByName(aName))
throw ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
{
- Reference < XUnoTunnel > xRef;
+ uno::Reference < XUnoTunnel > xRef;
aElement >>= xRef;
if ( ( aElement >>= xRef ) )
{
@@ -227,8 +226,8 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any&
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
}
-void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( Name );
if ( aIter == maContents.end() )
@@ -236,55 +235,55 @@ void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
maContents.erase( aIter );
}
// XEnumerationAccess
-Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
- throw(RuntimeException)
+uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
+ throw(uno::RuntimeException)
{
- return Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
+ return uno::Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
}
// XElementAccess
-Type SAL_CALL ZipPackageFolder::getElementType( )
- throw(RuntimeException)
+uno::Type SAL_CALL ZipPackageFolder::getElementType( )
+ throw(uno::RuntimeException)
{
- return ::getCppuType ((const Reference< XUnoTunnel > *) 0);
+ return ::getCppuType ((const uno::Reference< XUnoTunnel > *) 0);
}
sal_Bool SAL_CALL ZipPackageFolder::hasElements( )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
return maContents.size() > 0;
}
// XNameAccess
-ContentInfo& ZipPackageFolder::doGetByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ContentInfo& ZipPackageFolder::doGetByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( aName );
if ( aIter == maContents.end())
throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return *(*aIter).second;
}
-Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
- return makeAny ( doGetByName ( aName ).xTunnel );
+ return uno::makeAny ( doGetByName ( aName ).xTunnel );
}
-Sequence< OUString > SAL_CALL ZipPackageFolder::getElementNames( )
- throw(RuntimeException)
+uno::Sequence< ::rtl::OUString > SAL_CALL ZipPackageFolder::getElementNames( )
+ throw(uno::RuntimeException)
{
sal_uInt32 i=0, nSize = maContents.size();
- Sequence < OUString > aSequence ( nSize );
+ uno::Sequence < ::rtl::OUString > aSequence ( nSize );
for ( ContentHash::const_iterator aIterator = maContents.begin(), aEnd = maContents.end();
aIterator != aEnd;
++i, ++aIterator)
aSequence[i] = (*aIterator).first;
return aSequence;
}
-sal_Bool SAL_CALL ZipPackageFolder::hasByName( const OUString& aName )
- throw(RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
{
return maContents.find ( aName ) != maContents.end ();
}
// XNameReplace
-void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
if ( hasByName( aName ) )
removeByName( aName );
@@ -293,7 +292,7 @@ void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any&
insertByName(aName, aElement);
}
-static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rStream )
+static void ImplSetStoredData( ZipEntry & rEntry, uno::Reference< XInputStream> & rStream )
{
// It's very annoying that we have to do this, but lots of zip packages
// don't allow data descriptors for STORED streams, meaning we have to
@@ -305,25 +304,29 @@ static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rS
rEntry.nCrc = aCRC32.getValue();
}
-bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
+bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const ContentInfo &rInfo, ::rtl::OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool)
{
bool bSuccess = true;
- const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
- const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
- const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
- const OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
- const OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
- const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
- const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
- const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
-
- Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+ const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
+ const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const ::rtl::OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
+ const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
+ const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
+ const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
+ const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const ::rtl::OUString sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const ::rtl::OUString sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
+ const ::rtl::OUString sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+ const ::rtl::OUString sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+
+ uno::Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
OSL_ENSURE( ( rInfo.bFolder && rInfo.pFolder ) || ( !rInfo.bFolder && rInfo.pStream ), "A valid child object is expected!" );
if ( rInfo.bFolder )
{
- OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sTempName = rPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
if ( rInfo.pFolder->GetMediaType().getLength() )
{
@@ -378,7 +381,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
sal_Int32 nOwnStreamOrigSize = bRawStream ? rInfo.pStream->GetMagicalHackSize() : rInfo.pStream->getSize();
sal_Bool bUseNonSeekableAccess = sal_False;
- Reference < XInputStream > xStream;
+ uno::Reference < XInputStream > xStream;
if ( !rInfo.pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
{
// the stream is not a package member, not a raw stream,
@@ -386,7 +389,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
// in this case nonseekable access can be used
xStream = rInfo.pStream->GetOwnStreamNoWrap();
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
}
@@ -402,7 +405,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
return bSuccess;
}
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
try
{
if ( xSeek.is() )
@@ -450,15 +453,13 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
else
{
- OSL_FAIL( "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
bSuccess = false;
return bSuccess;
}
}
}
- catch ( Exception& )
+ catch ( uno::Exception& )
{
- OSL_FAIL( "The stream provided to the package component has problems!" );
bSuccess = false;
return bSuccess;
}
@@ -467,9 +468,9 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
{
if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
{
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
+ uno::Sequence < sal_Int8 > aSalt( 16 ), aVector( rInfo.pStream->GetBlockSize() );
rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
- rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
+ rtl_random_getBytes ( rRandomPool, aVector.getArray(), aVector.getLength() );
sal_Int32 nIterationCount = 1024;
if ( !rInfo.pStream->HasOwnKey() )
@@ -498,8 +499,20 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( bRawStream || bTransportOwnEncrStreamAsRaw )
{
+ ::rtl::Reference< EncryptionData > xEncData = rInfo.pStream->GetEncryptionData();
+ if ( !xEncData.is() )
+ throw uno::RuntimeException();
+
aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+ aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
+ aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= xEncData->m_nDerivedKeySize;
}
}
}
@@ -520,7 +533,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( !xStream.is() )
{
// Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
bSuccess = false;
return bSuccess;
}
@@ -531,11 +543,11 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( bRawStream )
xStream->skipBytes( rInfo.pStream->GetMagicalHackPos() );
- rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), sal_False );
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream, sal_False );
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ uno::Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
sal_Int32 nLength;
do
@@ -549,12 +561,10 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
}
@@ -576,7 +586,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( !xStream.is() )
{
// Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
bSuccess = false;
return bSuccess;
}
@@ -590,12 +599,12 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
try
{
- rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), bToBeEncrypted);
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream, bToBeEncrypted);
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
sal_Int32 nLength;
- Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
+ uno::Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
do
{
nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
@@ -607,19 +616,30 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
if ( bToBeEncrypted )
{
+ ::rtl::Reference< EncryptionData > xEncData = rInfo.pStream->GetEncryptionData();
+ if ( !xEncData.is() )
+ throw uno::RuntimeException();
+
aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+ aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
+ aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= xEncData->m_nDerivedKeySize;
+
rInfo.pStream->SetIsEncrypted ( sal_True );
}
}
@@ -665,8 +685,8 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
return bSuccess;
}
-void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
- throw(RuntimeException)
+void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool )
+ throw( uno::RuntimeException )
{
bool bWritingFailed = false;
@@ -681,18 +701,15 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
try
{
- rtl::Reference < EncryptionData > aEmptyEncr;
- rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
+ rZipOut.putNextEntry( *pTempEntry, NULL, sal_False );
rZipOut.rawCloseEntry();
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bWritingFailed = true;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bWritingFailed = true;
}
}
@@ -713,7 +730,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
aCI != aEnd; ++aCI)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( !bMimeTypeStreamStored || !rShortName.equals( aMimeTypeStreamName ) )
@@ -721,7 +738,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
}
if( bWritingFailed )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::releaseUpwardRef( void )
@@ -753,8 +770,8 @@ void ZipPackageFolder::releaseUpwardRef( void )
#endif
}
-sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(uno::RuntimeException)
{
sal_Int64 nMe = 0;
if ( aIdentifier.getLength() == 16 &&
@@ -762,8 +779,8 @@ sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& a
nMe = reinterpret_cast < sal_Int64 > ( this );
return nMe;
}
-void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
{
if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")))
{
@@ -780,8 +797,8 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName,
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
-Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, uno::RuntimeException)
{
if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
@@ -789,18 +806,18 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
// if ( m_nFormat != embed::StorageFormats::PACKAGE )
// throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return makeAny ( sMediaType );
+ return uno::makeAny ( sMediaType );
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Version" ) ) )
- return makeAny( m_sVersion );
+ return uno::makeAny( m_sVersion );
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
- return makeAny ( aEntry.nSize );
+ return uno::makeAny ( aEntry.nSize );
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
try
{
@@ -817,21 +834,21 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetPa
if ( bSetParent )
pEntry->setParent ( *this );
}
-OUString ZipPackageFolder::getImplementationName()
- throw (RuntimeException)
+::rtl::OUString ZipPackageFolder::getImplementationName()
+ throw (uno::RuntimeException)
{
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
}
-Sequence< OUString > ZipPackageFolder::getSupportedServiceNames()
- throw (RuntimeException)
+uno::Sequence< ::rtl::OUString > ZipPackageFolder::getSupportedServiceNames()
+ throw (uno::RuntimeException)
{
- Sequence< OUString > aNames(1);
- aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
+ uno::Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
return aNames;
}
-sal_Bool SAL_CALL ZipPackageFolder::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::supportsService( ::rtl::OUString const & rServiceName )
+ throw (uno::RuntimeException)
{
return rServiceName == getSupportedServiceNames()[0];
}
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 1287067a9f4d..d63560440ccb 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -17,7 +17,7 @@
* 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).
+ * ( 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
@@ -26,7 +26,7 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
+// MARKER( update_precomp.py ): autogen include statement, do not remove
#include "precompiled_package.hxx"
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
@@ -35,6 +35,8 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <ZipPackageStream.hxx>
@@ -67,21 +69,25 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_get
}
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
- const Reference< XMultiServiceFactory >& xFactory,
+ const uno::Reference< XMultiServiceFactory >& xFactory,
sal_Bool bAllowRemoveOnInsert )
: m_xFactory( xFactory )
-, rZipPackage(rNewPackage)
+, rZipPackage( rNewPackage )
, bToBeCompressed ( sal_True )
, bToBeEncrypted ( sal_False )
, bHaveOwnKey ( sal_False )
, bIsEncrypted ( sal_False )
-, xEncryptionData ( )
+, m_nImportedStartKeyAlgorithm( 0 )
+, m_nImportedEncryptionAlgorithm( 0 )
+, m_nImportedChecksumAlgorithm( 0 )
+, m_nImportedDerivedKeySize( 0 )
, m_nStreamMode( PACKAGE_STREAM_NOTSET )
, m_nMagicalHackPos( 0 )
, m_nMagicalHackSize( 0 )
, m_bHasSeekable( sal_False )
, m_bCompressedIsSetFromOutside( sal_False )
, m_bFromManifest( sal_False )
+, m_bUseWinEncoding( false )
{
OSL_ENSURE( m_xFactory.is(), "No factory is provided to ZipPackageStream!\n" );
@@ -108,7 +114,7 @@ ZipPackageStream::~ZipPackageStream( void )
{
}
-void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry)
+void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry )
{
aEntry.nVersion = rInEntry.nVersion;
aEntry.nFlag = rInEntry.nFlag;
@@ -138,7 +144,7 @@ void ZipPackageStream::CloseOwnStreamIfAny()
}
//--------------------------------------------------------------------------
-uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream()
+uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream()
{
if ( !m_bHasSeekable && xStream.is() )
{
@@ -147,10 +153,10 @@ uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream()
// is accessed before commit it MUST be wrapped.
// Wrap the stream in case it is not seekable
xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xFactory );
- Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
+ uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
m_bHasSeekable = sal_True;
}
@@ -164,18 +170,18 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
if ( m_nStreamMode != PACKAGE_STREAM_RAW || !GetOwnSeekStream().is() )
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if ( !xEncryptionData.is() )
+ if ( m_xBaseEncryptionData.is() )
throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Encrypted stream without encryption data!\n" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
uno::Reference< io::XSeekable > xSeek( GetOwnSeekStream(), UNO_QUERY );
if ( !xSeek.is() )
throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must be seekable!\n" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// skip header
- xSeek->seek( n_ConstHeaderSize + xEncryptionData->aInitVector.getLength() +
- xEncryptionData->aSalt.getLength() + xEncryptionData->aDigest.getLength() );
+ xSeek->seek( n_ConstHeaderSize + getInitialisationVector().getLength() +
+ getSalt().getLength() + getDigest().getLength() );
// create temporary stream
uno::Reference < io::XOutputStream > xTempOut(
@@ -195,17 +201,95 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr )
+sal_Int32 ZipPackageStream::GetEncryptionAlgorithm() const
{
- if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || (bAddHeaderForEncr && !bToBeEncrypted) )
+ return m_nImportedEncryptionAlgorithm ? m_nImportedEncryptionAlgorithm : rZipPackage.GetEncAlgID();
+}
+
+//--------------------------------------------------------------------------
+sal_Int32 ZipPackageStream::GetBlockSize() const
+{
+ return GetEncryptionAlgorithm() == ::com::sun::star::xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 16 : 8;
+}
+
+//--------------------------------------------------------------------------
+::rtl::Reference< EncryptionData > ZipPackageStream::GetEncryptionData( bool bUseWinEncoding )
+{
+ ::rtl::Reference< EncryptionData > xResult;
+ if ( m_xBaseEncryptionData.is() )
+ xResult = new EncryptionData(
+ *m_xBaseEncryptionData,
+ GetEncryptionKey( bUseWinEncoding ),
+ GetEncryptionAlgorithm(),
+ m_nImportedChecksumAlgorithm ? m_nImportedChecksumAlgorithm : rZipPackage.GetChecksumAlgID(),
+ m_nImportedDerivedKeySize ? m_nImportedDerivedKeySize : rZipPackage.GetDefaultDerivedKeySize(),
+ GetStartKeyGenID() );
+
+ return xResult;
+}
+
+//--------------------------------------------------------------------------
+void ZipPackageStream::SetBaseEncryptionData( const ::rtl::Reference< BaseEncryptionData >& xData )
+{
+ m_xBaseEncryptionData = xData;
+}
+
+//--------------------------------------------------------------------------
+uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncoding )
+{
+ uno::Sequence< sal_Int8 > aResult;
+ sal_Int32 nKeyGenID = GetStartKeyGenID();
+ bUseWinEncoding = ( bUseWinEncoding || m_bUseWinEncoding );
+
+ if ( bHaveOwnKey && m_aStorageEncryptionKeys.getLength() )
+ {
+ ::rtl::OUString aNameToFind;
+ if ( nKeyGenID == xml::crypto::DigestID::SHA256 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA256UTF8;
+ else if ( nKeyGenID == xml::crypto::DigestID::SHA1 )
+ {
+ aNameToFind = bUseWinEncoding ? PACKAGE_ENCRYPTIONDATA_SHA1MS1252 : PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ for ( sal_Int32 nInd = 0; nInd < m_aStorageEncryptionKeys.getLength(); nInd++ )
+ if ( m_aStorageEncryptionKeys[nInd].Name.equals( aNameToFind ) )
+ m_aStorageEncryptionKeys[nInd].Value >>= aResult;
+
+ // empty keys are not allowed here
+ // so it is not important whether there is no key, or the key is empty, it is an error
+ if ( !aResult.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+ }
+ else
+ aResult = m_aEncryptionKey;
+
+ if ( !aResult.getLength() || !bHaveOwnKey )
+ aResult = rZipPackage.GetEncryptionKey();
+
+ return aResult;
+}
+
+//--------------------------------------------------------------------------
+sal_Int32 ZipPackageStream::GetStartKeyGenID()
+{
+ // generally should all the streams use the same Start Key
+ // but if raw copy without password takes place, we should preserve the imported algorithm
+ return m_nImportedStartKeyAlgorithm ? m_nImportedStartKeyAlgorithm : rZipPackage.GetStartKeyGenID();
+}
+
+//--------------------------------------------------------------------------
+uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr )
+{
+ if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || ( bAddHeaderForEncr && !bToBeEncrypted ) )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
Sequence< sal_Int8 > aKey;
if ( bToBeEncrypted )
{
- aKey = ( !xEncryptionData.is() || !bHaveOwnKey ) ? rZipPackage.getEncryptionKey() :
- xEncryptionData->aKey;
+ aKey = GetEncryptionKey();
if ( !aKey.getLength() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -221,7 +305,7 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
// create a package based on it
ZipPackage* pPackage = new ZipPackage( m_xFactory );
- Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
+ uno::Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
if ( !xPackageAsFactory.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -230,14 +314,14 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
pPackage->initialize( aArgs );
// create a new package stream
- Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY );
+ uno::Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY );
if ( !xNewPackStream.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
xNewPackStream->setDataStream( static_cast< io::XInputStream* >(
new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ) ) );
- Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
+ uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
if ( !xNewPSProps.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -246,26 +330,26 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ), makeAny( bToBeCompressed ) );
if ( bToBeEncrypted )
{
- xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), makeAny( aKey ) );
+ xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ), makeAny( aKey ) );
xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Encrypted" ) ), makeAny( sal_True ) );
}
// insert a new stream in the package
- Reference< XUnoTunnel > xTunnel;
+ uno::Reference< XUnoTunnel > xTunnel;
Any aRoot = pPackage->getByHierarchicalName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) );
aRoot >>= xTunnel;
- Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY );
+ uno::Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY );
if ( !xRootNameContainer.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY );
+ uno::Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY );
xRootNameContainer->insertByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "dummy" ) ), makeAny( xNPSTunnel ) );
// commit the temporary package
pPackage->commitChanges();
// get raw stream from the temporary package
- Reference< io::XInputStream > xInRaw;
+ uno::Reference< io::XInputStream > xInRaw;
if ( bAddHeaderForEncr )
xInRaw = xNewPackStream->getRawStream();
else
@@ -286,12 +370,12 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
xTempSeek->seek( 0 );
// close raw stream, package stream and folder
- xInRaw = Reference< io::XInputStream >();
- xNewPSProps = Reference< XPropertySet >();
- xNPSTunnel = Reference< XUnoTunnel >();
- xNewPackStream = Reference< XDataSinkEncrSupport >();
- xTunnel = Reference< XUnoTunnel >();
- xRootNameContainer = Reference< container::XNameContainer >();
+ xInRaw = uno::Reference< io::XInputStream >();
+ xNewPSProps = uno::Reference< XPropertySet >();
+ xNPSTunnel = uno::Reference< XUnoTunnel >();
+ xNewPackStream = uno::Reference< XDataSinkEncrSupport >();
+ xTunnel = uno::Reference< XUnoTunnel >();
+ xRootNameContainer = uno::Reference< container::XNameContainer >();
// return the stream representing the first temporary file
return xTempIn;
@@ -317,7 +401,7 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
sal_Bool bOk = sal_False;
- rtl::Reference < EncryptionData > xTempEncrData;
+ ::rtl::Reference< BaseEncryptionData > xTempEncrData;
sal_Int32 nMagHackSize = 0;
Sequence < sal_Int8 > aHeader ( 4 );
@@ -333,17 +417,25 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
if ( nHeader == n_ConstHeader )
{
// this is one of our god-awful, but extremely devious hacks, everyone cheer
- xTempEncrData = new EncryptionData;
+ xTempEncrData = new BaseEncryptionData;
::rtl::OUString aMediaType;
- if ( ZipFile::StaticFillData ( xTempEncrData, nMagHackSize, aMediaType, GetOwnSeekStream() ) )
+ sal_Int32 nEncAlgorithm = 0;
+ sal_Int32 nChecksumAlgorithm = 0;
+ sal_Int32 nDerivedKeySize = 0;
+ sal_Int32 nStartKeyGenID = 0;
+ if ( ZipFile::StaticFillData( xTempEncrData, nEncAlgorithm, nChecksumAlgorithm, nDerivedKeySize, nStartKeyGenID, nMagHackSize, aMediaType, GetOwnSeekStream() ) )
{
// We'll want to skip the data we've just read, so calculate how much we just read
// and remember it
- m_nMagicalHackPos = n_ConstHeaderSize + xTempEncrData->aSalt.getLength()
- + xTempEncrData->aInitVector.getLength()
- + xTempEncrData->aDigest.getLength()
+ m_nMagicalHackPos = n_ConstHeaderSize + xTempEncrData->m_aSalt.getLength()
+ + xTempEncrData->m_aInitVector.getLength()
+ + xTempEncrData->m_aDigest.getLength()
+ aMediaType.getLength() * sizeof( sal_Unicode );
+ m_nImportedEncryptionAlgorithm = nEncAlgorithm;
+ m_nImportedChecksumAlgorithm = nChecksumAlgorithm;
+ m_nImportedDerivedKeySize = nDerivedKeySize;
+ m_nImportedStartKeyAlgorithm = nStartKeyGenID;
m_nMagicalHackSize = nMagHackSize;
sMediaType = aMediaType;
@@ -362,7 +454,7 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
return sal_False;
}
- xEncryptionData = xTempEncrData;
+ m_xBaseEncryptionData = xTempEncrData;
SetIsEncrypted ( sal_True );
// it's already compressed and encrypted
bToBeEncrypted = bToBeCompressed = sal_False;
@@ -384,11 +476,12 @@ void ZipPackageStream::SetPackageMember( sal_Bool bNewValue )
// XActiveDataSink
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStream >& aStream )
- throw(RuntimeException)
+void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInputStream >& aStream )
+ throw( RuntimeException )
{
// if seekable access is required the wrapping will be done on demand
xStream = aStream;
+ m_nImportedEncryptionAlgorithm = 0;
m_bHasSeekable = sal_False;
SetPackageMember ( sal_False );
aEntry.nTime = -1;
@@ -396,94 +489,100 @@ void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStrea
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
- throw(RuntimeException)
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
+ throw( RuntimeException )
{
try
{
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
- return Reference < io::XInputStream > ();
+ return uno::Reference < io::XInputStream > ();
}
- catch (ZipException &)//rException)
+ catch ( ZipException & )//rException )
{
- OSL_FAIL( "ZipException thrown");//rException.Message);
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "ZipException thrown" );//rException.Message);
+ return uno::Reference < io::XInputStream > ();
}
- catch (Exception &)
+ catch ( Exception & )
{
- OSL_FAIL( "Exception is thrown during stream wrapping!\n");
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "Exception is thrown during stream wrapping!\n" );
+ return uno::Reference < io::XInputStream > ();
}
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( )
- throw(RuntimeException)
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream()
+ throw( RuntimeException )
{
try
{
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getInputStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getInputStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
- return Reference < io::XInputStream > ();
+ return uno::Reference < io::XInputStream > ();
}
- catch (ZipException &)//rException)
+ catch ( ZipException & )//rException )
{
- OSL_FAIL( "ZipException thrown");//rException.Message);
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "ZipException thrown" );//rException.Message);
+ return uno::Reference < io::XInputStream > ();
}
- catch (Exception &)
+ catch ( Exception & )
{
- OSL_FAIL( "Exception is thrown during stream wrapping!\n");
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "Exception is thrown during stream wrapping!\n" );
+ return uno::Reference < io::XInputStream > ();
}
}
// XDataSinkEncrSupport
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
throw ( packages::WrongPasswordException,
io::IOException,
RuntimeException )
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
-
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
-
- return rZipPackage.getZipFile().getDataStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ uno::Reference< io::XInputStream > xResult;
+ try
+ {
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ }
+ catch( packages::WrongPasswordException& )
+ {
+ // workaround for the encrypted documents generated with the old OOo1.x bug.
+ if ( rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 && !m_bUseWinEncoding )
+ {
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ m_bUseWinEncoding = true;
+ }
+ else
+ throw;
+ }
+ return xResult;
}
else if ( m_nStreamMode == PACKAGE_STREAM_RAW )
- return ZipFile::StaticGetDataFromRawStream( GetOwnSeekStream(), xEncryptionData );
+ return ZipFile::StaticGetDataFromRawStream( m_xFactory, GetOwnSeekStream(), GetEncryptionData() );
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
@@ -493,25 +592,25 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
throw ( packages::NoEncryptionException,
io::IOException,
uno::RuntimeException )
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( !bIsEncrypted || !xEncryptionData.is() )
+ if ( !bIsEncrypted || !GetEncryptionData().is() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return rZipPackage.getZipFile().getWrappedRawStream( aEntry, xEncryptionData, sMediaType, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), sMediaType, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
@@ -528,7 +627,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setDataStream( const Reference< io::XInputStream >& aStream )
+void SAL_CALL ZipPackageStream::setDataStream( const uno::Reference< io::XInputStream >& aStream )
throw ( io::IOException,
RuntimeException )
{
@@ -537,21 +636,21 @@ void SAL_CALL ZipPackageStream::setDataStream( const Reference< io::XInputStream
}
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream >& aStream )
+void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputStream >& aStream )
throw ( packages::EncryptionNotAllowedException,
packages::NoRawFormatException,
io::IOException,
- RuntimeException)
+ RuntimeException )
{
// wrap the stream in case it is not seekable
- Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory );
- Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
+ uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory );
+ uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
xSeek->seek( 0 );
- Reference< io::XInputStream > xOldStream = xStream;
+ uno::Reference< io::XInputStream > xOldStream = xStream;
xStream = xNewStream;
if ( !ParsePackageRawStream() )
{
@@ -574,15 +673,15 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
@@ -595,14 +694,14 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
return TryToGetRawFromDataStream( sal_False );
}
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
}
// XUnoTunnel
//--------------------------------------------------------------------------
sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+ throw( RuntimeException )
{
sal_Int64 nMe = 0;
if ( aIdentifier.getLength() == 16 &&
@@ -614,18 +713,18 @@ sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& a
// XPropertySet
//--------------------------------------------------------------------------
void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
{
- if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")))
+ if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" )) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && rZipPackage.getFormat() != embed::StorageFormats::OFOPXML )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if ( aValue >>= sMediaType )
{
- if (sMediaType.getLength() > 0)
+ if ( sMediaType.getLength() > 0 )
{
- if ( sMediaType.indexOf (OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1
+ if ( sMediaType.indexOf ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1
|| sMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM ( "application/vnd.sun.star.oleobject" ) ) ) )
bToBeCompressed = sal_True;
else if ( !m_bCompressedIsSetFromOutside )
@@ -634,18 +733,18 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "MediaType must be a string!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Size") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
{
if ( !( aValue >>= aEntry.nSize ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Size property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Encrypted") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Encrypted" ) ) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -656,25 +755,25 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
// In case of new raw stream, the stream must not be encrypted on storing
if ( bEnc && m_nStreamMode == PACKAGE_STREAM_RAW )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
bToBeEncrypted = bEnc;
- if ( bToBeEncrypted && !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
+ if ( bToBeEncrypted && !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Encrypted property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Sequence < sal_Int8 > aNewKey;
+ uno::Sequence< sal_Int8 > aNewKey;
if ( !( aValue >>= aNewKey ) )
{
@@ -685,31 +784,69 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
Sequence < sal_Int8 > aSequence ( nPathLength );
sal_Int8 *pArray = aSequence.getArray();
const sal_Unicode *pChar = sTempString.getStr();
- for ( sal_Int16 i = 0; i < nPathLength; i++)
- pArray[i] = static_cast < const sal_Int8 > (pChar[i]);
+ for ( sal_Int16 i = 0; i < nPathLength; i++ )
+ pArray[i] = static_cast < const sal_Int8 > ( pChar[i] );
aNewKey = aSequence;
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for EncryptionKey property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
if ( aNewKey.getLength() )
{
- if ( !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
+ if ( !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
+
+ m_aEncryptionKey = aNewKey;
+ // In case of new raw stream, the stream must not be encrypted on storing
+ bHaveOwnKey = sal_True;
+ if ( m_nStreamMode != PACKAGE_STREAM_RAW )
+ bToBeEncrypted = sal_True;
+ }
+ else
+ {
+ bHaveOwnKey = sal_False;
+ m_aEncryptionKey.realloc( 0 );
+ }
+
+ m_aStorageEncryptionKeys.realloc( 0 );
+ }
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
+ {
+ if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
+ throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+
+ uno::Sequence< beans::NamedValue > aKeys;
+ if ( !( aValue >>= aKeys ) )
+ {
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for StorageEncryptionKeys property!\n" ) ),
+ uno::Reference< XInterface >(),
+ 2 );
+ }
+
+ if ( aKeys.getLength() )
+ {
+ if ( !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
+
+ m_aStorageEncryptionKeys = aKeys;
- xEncryptionData->aKey = aNewKey;
// In case of new raw stream, the stream must not be encrypted on storing
bHaveOwnKey = sal_True;
if ( m_nStreamMode != PACKAGE_STREAM_RAW )
bToBeEncrypted = sal_True;
}
else
+ {
bHaveOwnKey = sal_False;
+ m_aStorageEncryptionKeys.realloc( 0 );
+ }
+
+ m_aEncryptionKey.realloc( 0 );
}
- else if (aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
+ else if ( aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
{
sal_Bool bCompr = sal_False;
@@ -718,7 +855,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
// In case of new raw stream, the stream must not be encrypted on storing
if ( bCompr && m_nStreamMode == PACKAGE_STREAM_RAW )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
bToBeCompressed = bCompr;
@@ -726,7 +863,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Compressed property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
else
@@ -735,37 +872,42 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
//--------------------------------------------------------------------------
Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( beans::UnknownPropertyException, WrappedTargetException, RuntimeException )
{
Any aAny;
- if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
aAny <<= sMediaType;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
{
aAny <<= aEntry.nSize;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Encrypted" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Encrypted" ) ) )
{
aAny <<= ((m_nStreamMode == PACKAGE_STREAM_RAW) ? sal_True : bToBeEncrypted);
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WasEncrypted" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WasEncrypted" ) ) )
{
aAny <<= bIsEncrypted;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
{
aAny <<= bToBeCompressed;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionKey" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
+ {
+ aAny <<= m_aEncryptionKey;
+ return aAny;
+ }
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- aAny <<= (!xEncryptionData.is() ? Sequence < sal_Int8 > () : xEncryptionData->aKey);
+ aAny <<= m_aStorageEncryptionKeys;
return aAny;
}
else
@@ -773,30 +915,30 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
}
//--------------------------------------------------------------------------
-void ZipPackageStream::setSize (const sal_Int32 nNewSize)
+void ZipPackageStream::setSize ( const sal_Int32 nNewSize )
{
- if (aEntry.nCompressedSize != nNewSize )
+ if ( aEntry.nCompressedSize != nNewSize )
aEntry.nMethod = DEFLATED;
aEntry.nSize = nNewSize;
}
//--------------------------------------------------------------------------
OUString ZipPackageStream::getImplementationName()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageStream" ) );
}
//--------------------------------------------------------------------------
Sequence< OUString > ZipPackageStream::getSupportedServiceNames()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
- Sequence< OUString > aNames(1);
+ Sequence< OUString > aNames( 1 );
aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageStream" ) );
return aNames;
}
//--------------------------------------------------------------------------
sal_Bool SAL_CALL ZipPackageStream::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return rServiceName == getSupportedServiceNames()[0];
}
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index a75bed446335..e4b9d75b9ba3 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -41,6 +41,7 @@
#include <EncryptionData.hxx>
#include <ucbhelper/content.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -252,7 +253,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName )
throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
- new EncryptionData(),
+ ::rtl::Reference< EncryptionData >(),
sal_False,
m_aMutexHolder ) );
@@ -367,7 +368,7 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern(
if ( StringGoodForPattern_Impl( (*aIter).second.sPath, aPattern ) )
{
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
- new EncryptionData(),
+ ::rtl::Reference< EncryptionData >(),
sal_False,
m_aMutexHolder ) );
diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst
index 4c62f004f0c9..4ca42cac8f80 100644
--- a/setup_native/prj/build.lst
+++ b/setup_native/prj/build.lst
@@ -4,7 +4,6 @@ pk setup_native\scripts\source nmake - u sn_sour
pk setup_native\scripts nmake - u sn_scripts sn_source.u NULL
pk setup_native\source\mac nmake - u sn_mac NULL
pk setup_native\source\win32\customactions\tools nmake - w sn_tools NULL
-pk setup_native\source\win32\customactions\relnotes nmake - w sn_relnotes NULL
pk setup_native\source\win32\customactions\rebase nmake - w sn_rebase NULL
pk setup_native\source\win32\customactions\regactivex nmake - w sn_regactivex NULL
pk setup_native\source\win32\customactions\regpatchactivex nmake - w sn_regpatchactivex NULL
diff --git a/setup_native/prj/d.lst b/setup_native/prj/d.lst
index 358fce0f449d..6221f738c123 100644
--- a/setup_native/prj/d.lst
+++ b/setup_native/prj/d.lst
@@ -1,12 +1,12 @@
-mkdir: %_DEST%\bin%_EXT%\osl
-..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
-..\%__SRC%\bin\*.exe %_DEST%\bin%_EXT%\*.exe
-..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
+mkdir: %_DEST%\bin\osl
+..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll
+..\%__SRC%\bin\*.exe %_DEST%\bin\*.exe
+..\%__SRC%\class\*.jar %_DEST%\bin\*.jar
-mkdir: %_DEST%\bin%_EXT%\userscripts
-..\%__SRC%\bin\install %_DEST%\bin%_EXT%\userscripts\install
-..\%__SRC%\bin\uninstall %_DEST%\bin%_EXT%\userscripts\uninstall
-..\%__SRC%\bin\noarch\fake-db-1.0-0.noarch.rpm %_DEST%\bin%_EXT%\openoffice.org-userland-1.0-0.noarch.rpm
+mkdir: %_DEST%\bin\userscripts
+..\%__SRC%\bin\install %_DEST%\bin\userscripts\install
+..\%__SRC%\bin\uninstall %_DEST%\bin\userscripts\uninstall
+..\%__SRC%\bin\noarch\fake-db-1.0-0.noarch.rpm %_DEST%\bin\openoffice.org-userland-1.0-0.noarch.rpm
mkdir: %_DEST%\bin\osolsmf
..\%__SRC%\bin\ulfconv %_DEST%\bin\ulfconv
@@ -48,6 +48,7 @@ mkdir: %_DEST%\bin\osolsmf
..\scripts\mac_install.script %_DEST%\bin\mac_install.script
..\scripts\osx_install_languagepack.applescript %_DEST%\bin\osx_install_languagepack.applescript
..\scripts\osx_install_patch.applescript %_DEST%\bin\osx_install_patch.applescript
-..\%__SRC%\lib\getuid.so %_DEST%\bin%_EXT%\getuid.so
+
+..\%__SRC%\lib\getuid.so %_DEST%\bin\getuid.so
..\inc\setup_native\qswin32.h %_DEST%\inc\setup_native\qswin32.h
diff --git a/setup_native/source/mac/ooo/DS_Store b/setup_native/source/mac/ooo/DS_Store
index af137c0e6c41..9431578cebb3 100644
--- a/setup_native/source/mac/ooo/DS_Store
+++ b/setup_native/source/mac/ooo/DS_Store
Binary files differ
diff --git a/setup_native/source/mac/ooo/DS_Store_Langpack b/setup_native/source/mac/ooo/DS_Store_Langpack
index 21b08ffb18cc..3a8ad71a5660 100644
--- a/setup_native/source/mac/ooo/DS_Store_Langpack
+++ b/setup_native/source/mac/ooo/DS_Store_Langpack
Binary files differ
diff --git a/setup_native/source/mac/ooo3_installer.icns b/setup_native/source/mac/ooo3_installer.icns
index bacdd17d8470..45fca0fcaf80 100644
--- a/setup_native/source/mac/ooo3_installer.icns
+++ b/setup_native/source/mac/ooo3_installer.icns
Binary files differ
diff --git a/setup_native/source/packinfo/packinfo_extensions.txt b/setup_native/source/packinfo/packinfo_extensions.txt
index 7d76ef7f95f6..d9948ca0c0c4 100644
--- a/setup_native/source/packinfo/packinfo_extensions.txt
+++ b/setup_native/source/packinfo/packinfo_extensions.txt
@@ -25,7 +25,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Presentation Minimizer extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -40,7 +40,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Report Builder extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -55,7 +55,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "MediaWiki publisher extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -70,7 +70,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Presenter Screen extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -85,7 +85,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "PDF import extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -101,7 +101,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by FSF.hu"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Lightproof extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -116,7 +116,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by FSF.hu"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Numbertext extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -131,7 +131,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by FSF.hu"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Hungarian Cross-reference Toolbar extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -146,7 +146,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2010 by FSF.hu"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Typography Toolbar extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -161,7 +161,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "Copyright (c) 2008 Cor Nouws"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "ConvertTextToNumber extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -176,7 +176,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by Tibor Hornyák"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Watch Window extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -191,7 +191,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2010 by OxygenOffice Professional"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Diagram extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -206,7 +206,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2010 by OxygenOffice Professional"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Validator extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -221,7 +221,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2010 by EuroOffice Extension Creator"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Barcode extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -236,7 +236,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by Przemyslaw Rumik"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Google Docs extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -251,7 +251,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2009 by Sun Microsystems, Inc."
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "NLPSolver extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -266,7 +266,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2005-2009 by Daniel Naber"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "LanguageTool extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -281,7 +281,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2008 by Sun Mcrosystems, Inc."
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "MySQL Connector extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -296,7 +296,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "2005 by Caolan McNamara"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "oooblogger extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -311,7 +311,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Script provider for BeanShell extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -326,7 +326,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Script provider for JavaScript extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
@@ -341,7 +341,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Script provider for Python extension for %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%PACKAGEVERSION"
diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt
index 588487ee41d0..3d0f68ab7663 100755
--- a/setup_native/source/packinfo/packinfo_office.txt
+++ b/setup_native/source/packinfo/packinfo_office.txt
@@ -27,7 +27,7 @@ findrequires = "find-requires-gnome.sh"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Gnome integration module for LibreOffice %OOOBASEVERSION"
+description = "Gnome integration module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -42,7 +42,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "KDE integration module for LibreOffice %OOOBASEVERSION"
+description = "KDE integration module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -58,7 +58,7 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Core module for LibreOffice %OOOBASEVERSION"
+description = "Core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -74,7 +74,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Writer module for LibreOffice %OOOBASEVERSION"
+description = "Writer module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -90,7 +90,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Calc module for LibreOffice %OOOBASEVERSION"
+description = "Calc module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -106,7 +106,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Draw module for LibreOffice %OOOBASEVERSION"
+description = "Draw module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -122,7 +122,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
vendor = "The Document Foundation"
-description = "Impress module for LibreOffice %OOOBASEVERSION"
+description = "Impress module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -137,8 +137,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSIONg-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Base module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Base module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -153,8 +153,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Math module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Math module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -168,8 +168,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Legacy filters (e.g. StarOffice 5.2) for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Legacy filters (e.g. StarOffice 5.2) for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -183,8 +183,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Graphic filter module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Graphic filter module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -198,8 +198,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Usage tracking module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Usage tracking module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -213,8 +213,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Testtool module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Testtool module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -228,8 +228,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "English spellchecker module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "English spellchecker module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -243,8 +243,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "XSLT filter samples module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "XSLT filter samples module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -258,8 +258,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Java filter module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Java filter module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -273,8 +273,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "ActiveX control for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "ActiveX control for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -288,7 +288,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2010 by Oracle"
solariscopyright = "solariscopyrightfile"
vendor = "Oracle"
-description = "Online update modul for OpenOffice.org %OOOBASEVERSION"
+description = "Online update modul for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -302,8 +302,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Pyuno module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Pyuno module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -317,8 +317,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-pyuno"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Email mailmerge module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Email mailmerge module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -332,8 +332,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Headless display module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Headless display module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -347,8 +347,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Images module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Images module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -362,8 +362,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Mailcap module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Mailcap module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -377,8 +377,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Linguistic module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Linguistic module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -393,8 +393,8 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -408,8 +408,8 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -424,8 +424,8 @@ findrequires = "find-requires-x11.sh"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -439,8 +439,8 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -454,8 +454,8 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -469,8 +469,8 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01"
freebsdrequires = ""
copyright = "1999-2009 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "Office core module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "Office core module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
@@ -1077,8 +1077,8 @@ freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-impress"
requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-impress"
copyright = "1999-2007 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
-description = "OpenGL slide transitions module for OpenOffice.org %OOOBASEVERSION"
+vendor = "The Document Foundation"
+description = "OpenGL slide transitions module for %PRODUCTNAME %OOOBASEVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
End
diff --git a/setup_native/source/packinfo/packinfo_office_lang.txt b/setup_native/source/packinfo/packinfo_office_lang.txt
index 859d1d6ec1cf..0e2e05c4d6b7 100755
--- a/setup_native/source/packinfo/packinfo_office_lang.txt
+++ b/setup_native/source/packinfo/packinfo_office_lang.txt
@@ -186,7 +186,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "SUN Template Pack (%LANGUAGESTRING) %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
@@ -202,7 +202,7 @@ requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBAS
linuxpatchrequires = ""
copyright = "1999-2008 by OpenOffice.org"
solariscopyright = "solariscopyrightfile"
-vendor = "OpenOffice.org"
+vendor = "The Document Foundation"
description = "Lightproof (%LANGUAGESTRING) %PRODUCTNAME %PRODUCTVERSION"
destpath = "/opt"
packageversion = "%OOOPACKAGEVERSION"
diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt
index 0be870990b71..3ab47f925802 100755
--- a/setup_native/source/packinfo/shellscripts_extensions.txt
+++ b/setup_native/source/packinfo/shellscripts_extensions.txt
@@ -76,6 +76,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -87,6 +93,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -99,6 +111,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -111,6 +129,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]
then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt
index f5344b9860ef..aa90dc53fe99 100644
--- a/setup_native/source/packinfo/spellchecker_selection.txt
+++ b/setup_native/source/packinfo/spellchecker_selection.txt
@@ -8,47 +8,47 @@
# shall be included into the language pack, the keyword "EMPTY" can
# be used as first entry.
-af = "af,en-US"
-ar = "EMPTY,en-US"
-ca = "ca,es,en-US,fr"
-cs = "cs,en-US"
-da = "da,de-DE,en-US"
-de = "de-DE,de-AT,de-CH,en-US,fr,it"
-en-US = "en-US,es,fr"
-en-GB = "en-US,es,fr"
-es = "es,en-US,fr,pt"
-et = "et,en-US"
-fr = "fr,en-US,es"
-gl = "gl,en-US,pt,es"
-he = "he,en-US"
-hu = "hu,de-DE,en-US"
-hr = "hr,de-DE,en-US"
-it = "it,de-DE,en-US,fr"
-ja = "EMPTY,en-US"
-ko = "EMPTY,en-US"
-ku = "ku-TR,en-US"
-lt = "lt,en-US"
-nb = "no,en-US,fr,de-DE,es"
-ne = "ne,en-US"
-nl = "nl,en-US,fr,de-DE"
-nn = "no,en-US,fr,de-DE,es"
-oc = "oc,fr,en-US"
-pl = "pl,de-DE,en-US,ru"
-pt-BR = "pt,en-US,es"
-pt = "pt,en-US,es"
-ro = "ro,en-US,de-DE,hu"
-ru = "ru,de-DE,en-US"
-sk = "sk,en-US"
-sl = "sl,en-US"
-sv = "sv,de-DE,en-US"
-sr = "sr,en-US"
+af = "af"
+ar = "EMPTY"
+ca = "ca,es,fr"
+cs = "cs"
+da = "da,de-DE"
+de = "de-DE,de-AT,de-CH,fr,it"
+en-US = "en,es,fr"
+en-GB = "en,es,fr"
+es = "es,fr,pt"
+et = "et"
+fr = "fr,es"
+gl = "gl,pt,es"
+he = "he"
+hu = "hu,de-DE"
+hr = "hr,de-DE"
+it = "it,de-DE,fr"
+ja = "EMPTY"
+ko = "EMPTY"
+ku = "ku-TR"
+lt = "lt"
+nb = "no,fr,de-DE,es"
+ne = "ne"
+nl = "nl,fr,de-DE"
+nn = "no,fr,de-DE,es"
+oc = "oc,fr"
+pl = "pl,de-DE,ru"
+pt-BR = "pt,es"
+pt = "pt,es"
+ro = "ro,de-DE,hu"
+ru = "ru,de-DE"
+sk = "sk"
+sl = "sl"
+sv = "sv,de-DE"
+sr = "sr"
# ! Note the package 'sr' also holds the dictionaries for 'sh' !
-sh = "sr,en-US"
-sw = "sw,en-US"
-th = "th,en-US"
-uk = "uk,ru,en-US"
-vi = "vi,en-US,fr"
-zh-TW = "EMPTY,en-US"
-zh-CN = "EMPTY,en-US"
-zu = "zu,en-US"
+sh = "sr"
+sw = "sw"
+th = "th"
+uk = "uk,ru"
+vi = "vi,fr"
+zh-TW = "EMPTY"
+zh-CN = "EMPTY"
+zu = "zu"
diff --git a/setup_native/source/win32/customactions/javafilter/makefile.mk b/setup_native/source/win32/customactions/javafilter/makefile.mk
index 3ee19cff53b4..3039ef4ccabd 100644
--- a/setup_native/source/win32/customactions/javafilter/makefile.mk
+++ b/setup_native/source/win32/customactions/javafilter/makefile.mk
@@ -40,7 +40,7 @@ DYNAMIC_CRT=
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -62,9 +62,9 @@ DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
.ENDIF
+
# --- Targets --------------------------------------------------------------
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk
index 365772ca8cd3..94eab3a0109c 100644
--- a/setup_native/source/win32/customactions/languagepacks/makefile.mk
+++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk
@@ -44,7 +44,7 @@ CDEFS+=-Dnot_used_define_to_disable_pch
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk
index 77cd11e0322c..641f48ab6e27 100755
--- a/setup_native/source/win32/customactions/patch/makefile.mk
+++ b/setup_native/source/win32/customactions/patch/makefile.mk
@@ -43,7 +43,7 @@ CDEFS+=-Dnot_used_define_to_disable_pch
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -86,4 +86,3 @@ DEF1EXPORTFILE=exports.dxp
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
diff --git a/setup_native/source/win32/customactions/quickstarter/makefile.mk b/setup_native/source/win32/customactions/quickstarter/makefile.mk
index 870571578697..57b53d262ac7 100644
--- a/setup_native/source/win32/customactions/quickstarter/makefile.mk
+++ b/setup_native/source/win32/customactions/quickstarter/makefile.mk
@@ -45,7 +45,7 @@ UWINAPILIB=
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
STDSHL += \
$(ADVAPI32LIB)\
@@ -91,4 +91,3 @@ DEF2EXPORTFILE=$(TARGET2).dxp
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
diff --git a/setup_native/source/win32/customactions/rebase/makefile.mk b/setup_native/source/win32/customactions/rebase/makefile.mk
index cb9e29db1e60..fb1fc22a8555 100644
--- a/setup_native/source/win32/customactions/rebase/makefile.mk
+++ b/setup_native/source/win32/customactions/rebase/makefile.mk
@@ -44,7 +44,7 @@ UWINAPILIB=
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
STDSHL += \
$(ADVAPI32LIB)\
diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx
index 1eb3fedbf2f0..ad3686c52b3d 100644
--- a/setup_native/source/win32/customactions/rebase/rebase.cxx
+++ b/setup_native/source/win32/customactions/rebase/rebase.cxx
@@ -20,11 +20,14 @@
#include <malloc.h>
#include <time.h>
#include <string>
+#include <boost/unordered_map.hpp>
const DWORD PE_Signature = 0x00004550;
+typedef std::pair< std::string, bool > StringPair;
+typedef boost::unordered_map< std::string, bool > ExcludeLibsMap;
#ifdef DEBUG
-inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
+static void OutputDebugStringFormat( LPCSTR pFormat, ... )
{
CHAR buffer[1024];
va_list args;
@@ -34,7 +37,7 @@ inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
OutputDebugStringA( buffer );
}
#else
-static inline void OutputDebugStringFormat( LPCSTR, ... )
+static void OutputDebugStringFormat( LPCSTR, ... )
{
}
#endif
@@ -99,22 +102,31 @@ static BOOL rebaseImage( MSIHANDLE /*handle*/, const std::string& sFilePath, LPV
return bResult;
}
-static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address )
+static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address, ExcludeLibsMap& rExcludeMap )
{
- std::string sDir = sPath;
- std::string sPattern = sPath + TEXT("*.dll");
-
+ std::string sDir = sPath;
+ std::string sPattern = sPath + TEXT("*.dll");
WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
+ HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
if ( IsValidHandle(hFind) )
{
BOOL fSuccess = false;
do
{
- std::string sLibFile = sDir + aFindFileData.cFileName;
- rebaseImage( handle, sLibFile, address );
+ std::string sFileName = aFindFileData.cFileName;
+ if ( rExcludeMap.find( sFileName ) == rExcludeMap.end() )
+ {
+ OutputDebugStringFormat( "Rebase library: %s", sFileName.c_str() );
+ std::string sLibFile = sDir + sFileName;
+ rebaseImage( handle, sLibFile, address );
+ }
+ else
+ {
+ OutputDebugStringFormat( "Exclude library %s from rebase", sFileName.c_str() );
+ }
+
fSuccess = FindNextFile( hFind, &aFindFileData );
}
while ( fSuccess );
@@ -125,7 +137,7 @@ static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LP
return ERROR_SUCCESS;
}
-static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
+static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress, ExcludeLibsMap& rMap )
{
std::string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
@@ -133,9 +145,9 @@ static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
std::string sOfficeDir = sInstallPath + TEXT("program\\");
std::string sUreDir = sInstallPath + TEXT("URE\\bin\\");
- BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress );
+ BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress, rMap );
return bResult;
}
@@ -147,21 +159,66 @@ static BOOL IsServerSystem( MSIHANDLE /*handle*/ )
GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osVersionInfoEx));
if ( osVersionInfoEx.wProductType != VER_NT_WORKSTATION )
+ {
+ OutputDebugStringFormat( "Server system detected. No rebase necessary!" );
return TRUE;
+ }
else
+ {
+ OutputDebugStringFormat( "Client system detected. Rebase necessary!" );
return FALSE;
+ }
+}
+
+static void InitExcludeFromRebaseList( MSIHANDLE handle, ExcludeLibsMap& rMap )
+{
+ size_t nPos( 0 );
+ const TCHAR cDelim = ',';
+ std::string sLibsExcluded = GetMsiProperty(handle, TEXT("EXCLUDE_FROM_REBASE"));
+
+ while ( nPos < sLibsExcluded.size() )
+ {
+ size_t nDelPos = sLibsExcluded.find_first_of( cDelim, nPos );
+
+ std::string sExcludedLibName;
+ if ( nDelPos != std::string::npos )
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos, nDelPos - nPos );
+ nPos = nDelPos+1;
+ }
+ else
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos );
+ nPos = sLibsExcluded.size();
+ }
+
+ if ( sExcludedLibName.size() > 0 )
+ {
+ OutputDebugStringFormat( "Insert library %s into exclude from rebase list", sExcludedLibName.c_str() );
+ rMap.insert( StringPair( sExcludedLibName, true ));
+ }
+ }
}
extern "C" BOOL __stdcall RebaseLibrariesOnProperties( MSIHANDLE handle )
{
static LPVOID pDefault = reinterpret_cast<LPVOID>(0x10000000);
+ OutputDebugStringFormat( "RebaseLibrariesOnProperties has been called" );
std::string sDontOptimizeLibs = GetMsiProperty(handle, TEXT("DONTOPTIMIZELIBS"));
if ( sDontOptimizeLibs.length() > 0 && sDontOptimizeLibs == "1" )
+ {
+ OutputDebugStringFormat( "Don't optimize libraries set. No rebase necessary!" );
return TRUE;
+ }
if ( !IsServerSystem( handle ))
- return rebaseImages( handle, pDefault );
+ {
+ ExcludeLibsMap aExcludeLibsMap;
+ InitExcludeFromRebaseList( handle, aExcludeLibsMap );
+
+ return rebaseImages( handle, pDefault, aExcludeLibsMap );
+ }
return TRUE;
}
diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk b/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk
index 24037f0c0c5b..0f162fa6cd9a 100644
--- a/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk
+++ b/setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk
@@ -42,7 +42,7 @@ CFLAGS+=-DUNICODE -D_UNICODE
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx
index 45fbed4819d2..5220b1ed6d0c 100644
--- a/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx
+++ b/setup_native/source/win32/customactions/reg4msdoc/registrar.cxx
@@ -81,6 +81,14 @@ void Registrar::RegisterForMsWord() const
RegistrationContextInformation::Writer);
RegisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXWordDocumentFileExtension(),
+ m_ContextInformation.GetMOOXWordDocumentDisplayName(),
+ m_ContextInformation.GetWordDocumentDefaultIconEntry(),
+ m_ContextInformation.GetWordDocumentDefaultShellCommand(),
+ m_ContextInformation.ShellNewCommandDisplayName(),
+ RegistrationContextInformation::Writer);
+
+ RegisterForMsOfficeApplication(
m_ContextInformation.GetWordTemplateFileExtension(),
m_ContextInformation.GetWordTemplateDisplayName(),
m_ContextInformation.GetWordTemplateDefaultIconEntry(),
@@ -114,6 +122,14 @@ void Registrar::UnregisterForMsWord() const
try
{
UnregisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXWordDocumentFileExtension());
+ }
+ catch(RegistryKeyNotFoundException&)
+ {}
+
+ try
+ {
+ UnregisterForMsOfficeApplication(
m_ContextInformation.GetWordTemplateFileExtension());
}
catch(RegistryKeyNotFoundException&)
@@ -192,6 +208,14 @@ void Registrar::RegisterForMsExcel() const
RegistrationContextInformation::Calc);
RegisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXExcelSheetFileExtension(),
+ m_ContextInformation.GetMOOXExcelSheetDisplayName(),
+ m_ContextInformation.GetExcelSheetDefaultIconEntry(),
+ m_ContextInformation.GetExcelSheetDefaultShellCommand(),
+ m_ContextInformation.ShellNewCommandDisplayName(),
+ RegistrationContextInformation::Calc);
+
+ RegisterForMsOfficeApplication(
m_ContextInformation.GetExcelTemplateFileExtension(),
m_ContextInformation.GetExcelTemplateDisplayName(),
m_ContextInformation.GetExcelTemplateDefaultIconEntry(),
@@ -217,6 +241,22 @@ void Registrar::UnregisterForMsExcel() const
try
{
UnregisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXExcelSheetFileExtension());
+ }
+ catch(RegistryKeyNotFoundException&)
+ {}
+
+ try
+ {
+ UnregisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXPowerPointDocumentFileExtension());
+ }
+ catch(RegistryKeyNotFoundException&)
+ {}
+
+ try
+ {
+ UnregisterForMsOfficeApplication(
m_ContextInformation.GetExcelTemplateFileExtension());
}
catch(RegistryKeyNotFoundException&)
@@ -244,6 +284,14 @@ void Registrar::RegisterForMsPowerPoint() const
RegistrationContextInformation::Impress);
RegisterForMsOfficeApplication(
+ m_ContextInformation.GetMOOXPowerPointDocumentFileExtension(),
+ m_ContextInformation.GetMOOXPowerPointDocumentDisplayName(),
+ m_ContextInformation.GetPowerPointDocumentDefaultIconEntry(),
+ m_ContextInformation.GetPowerPointDocumentDefaultShellCommand(),
+ m_ContextInformation.ShellNewCommandDisplayName(),
+ RegistrationContextInformation::Impress);
+
+ RegisterForMsOfficeApplication(
m_ContextInformation.GetPowerPointShowFileExtension(),
m_ContextInformation.GetPowerPointShowDisplayName(),
m_ContextInformation.GetPowerPointShowDefaultIconEntry(),
diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx
index f07c35a4d988..2f04d319dd80 100644
--- a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx
+++ b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx
@@ -53,6 +53,18 @@ std::wstring RegistrationContextInformation::GetWordDocumentDefaultShellCommand(
return std::wstring(TEXT("open"));
}
+std::wstring RegistrationContextInformation::GetMOOXWordDocumentDisplayName() const
+{
+ std::wstring str;
+ str = TEXT("Microsoft Word 2007 Document");
+ return str;
+}
+
+std::wstring RegistrationContextInformation::GetMOOXWordDocumentFileExtension() const
+{
+ return std::wstring(TEXT(".docx"));
+}
+
std::wstring RegistrationContextInformation::GetWordTemplateDisplayName() const
{
std::wstring str;
@@ -125,6 +137,18 @@ std::wstring RegistrationContextInformation::GetExcelSheetDefaultShellCommand()
return std::wstring(TEXT("open"));
}
+std::wstring RegistrationContextInformation::GetMOOXExcelSheetDisplayName() const
+{
+ std::wstring str;
+ str = TEXT("Microsoft Excel 2007 Spreadsheet");
+ return str;
+}
+
+std::wstring RegistrationContextInformation::GetMOOXExcelSheetFileExtension() const
+{
+ return std::wstring(TEXT(".xlsx"));
+}
+
std::wstring RegistrationContextInformation::GetExcelTemplateDisplayName() const
{
std::wstring str;
@@ -173,6 +197,18 @@ std::wstring RegistrationContextInformation::GetPowerPointDocumentDefaultShellCo
return std::wstring(TEXT("open"));
}
+std::wstring RegistrationContextInformation::GetMOOXPowerPointDocumentDisplayName() const
+{
+ std::wstring str;
+ str = TEXT("Microsoft PowerPoint 2007 Presentation");
+ return str;
+}
+
+std::wstring RegistrationContextInformation::GetMOOXPowerPointDocumentFileExtension() const
+{
+ return std::wstring(TEXT(".pptx"));
+}
+
std::wstring RegistrationContextInformation::GetPowerPointTemplateDisplayName() const
{
std::wstring str;
diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx
index 91a42e6b58d7..d3297b14775c 100644
--- a/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx
+++ b/setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx
@@ -47,6 +47,14 @@ public:
std::wstring GetWordDocumentDefaultIconEntry() const;
std::wstring GetWordDocumentDefaultShellCommand() const;
+ /** MOOX Word document information
+ The icon index is the index of the icon
+ in soffice.exe to be associated with
+ word document files
+ */
+ std::wstring GetMOOXWordDocumentDisplayName() const;
+ std::wstring GetMOOXWordDocumentFileExtension() const;
+
/** Word template information
The icon index is the index of the icon
in soffice.exe to be associated with
@@ -77,6 +85,9 @@ public:
std::wstring GetExcelSheetDefaultIconEntry() const;
std::wstring GetExcelSheetDefaultShellCommand() const;
+ std::wstring GetMOOXExcelSheetDisplayName() const;
+ std::wstring GetMOOXExcelSheetFileExtension() const;
+
/** Excel template information
The icon index is the index of the icon
in soffice.exe to be associated with
@@ -97,6 +108,9 @@ public:
std::wstring GetPowerPointDocumentDefaultIconEntry() const;
std::wstring GetPowerPointDocumentDefaultShellCommand() const;
+ std::wstring GetMOOXPowerPointDocumentDisplayName() const;
+ std::wstring GetMOOXPowerPointDocumentFileExtension() const;
+
/** PowerPoint template information
The icon index is the index of the icon
in soffice.exe to be associated with
diff --git a/setup_native/source/win32/customactions/reg64/makefile.mk b/setup_native/source/win32/customactions/reg64/makefile.mk
index 4cb5a5ca20d0..a0d7fbaefc1f 100644
--- a/setup_native/source/win32/customactions/reg64/makefile.mk
+++ b/setup_native/source/win32/customactions/reg64/makefile.mk
@@ -44,7 +44,7 @@ CDEFS+=-Dnot_used_define_to_disable_pch
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -74,4 +74,3 @@ DEF1EXPORTFILE=exports.dxp
.INCLUDE : target.mk
INCLUDE!:=$(subst,/stl, $(INCLUDE))
-.EXPORT : INCLUDE
diff --git a/setup_native/source/win32/customactions/regactivex/makefile.mk b/setup_native/source/win32/customactions/regactivex/makefile.mk
index cc71dc39ada1..22eb1c89f7cd 100644
--- a/setup_native/source/win32/customactions/regactivex/makefile.mk
+++ b/setup_native/source/win32/customactions/regactivex/makefile.mk
@@ -40,7 +40,7 @@ USE_DEFFILE=TRUE
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -67,4 +67,3 @@ DEF1EXPORTFILE=exports.dxp
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
diff --git a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
index 4c6668db268c..9641c8ba018c 100644
--- a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
+++ b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
@@ -30,14 +30,14 @@ PRJNAME=setup_native
TARGET=regpatchactivex
USE_DEFFILE=TRUE
-.IF "$(GUI)"=="WNT"
-
# --- Settings -----------------------------------------------------
ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
+
STDSHL=
# --- Files --------------------------------------------------------
@@ -78,12 +78,10 @@ SHL1BASE = 0x1c000000
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
+.ENDIF
+
# --- Targets --------------------------------------------------------------
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
-
-.ENDIF
-
diff --git a/setup_native/source/win32/customactions/relnotes/exports.dxp b/setup_native/source/win32/customactions/relnotes/exports.dxp
deleted file mode 100644
index 55a454d3d58f..000000000000
--- a/setup_native/source/win32/customactions/relnotes/exports.dxp
+++ /dev/null
@@ -1,3 +0,0 @@
-ShowReleaseNotesBefore
-ShowReleaseNotesAfter
-ShowSurveyAfter
diff --git a/setup_native/source/win32/customactions/relnotes/makefile.mk b/setup_native/source/win32/customactions/relnotes/makefile.mk
deleted file mode 100644
index 526d45e71393..000000000000
--- a/setup_native/source/win32/customactions/relnotes/makefile.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..$/..
-PRJNAME=setup_native
-TARGET=relnotes
-
-
-# --- Settings -----------------------------------------------------
-
-ENABLE_EXCEPTIONS=TRUE
-NO_DEFAULT_STL=TRUE
-DYNAMIC_CRT=
-USE_DEFFILE=TRUE
-
-.INCLUDE : settings.mk
-
-CDEFS+=-DUNICODE
-
-UWINAPILIB=
-
-# --- Files --------------------------------------------------------
-
-.IF "$(GUI)"=="WNT"
-
-SLOFILES = $(SLO)$/relnotes.obj
-
-STDSHL+= \
- $(ADVAPI32LIB)\
- $(SHELL32LIB)\
- $(MSILIB)
-
-SHL1LIBS = $(SLB)$/$(TARGET).lib
-
-SHL1TARGET = $(TARGET)
-SHL1IMPLIB = i$(TARGET)
-
-SHL1DEF = $(MISC)$/$(SHL1TARGET).def
-SHL1DEPN = $(SLB)$/$(TARGET).lib
-SHL1BASE = 0x1c000000
-DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE=exports.dxp
-
-.ENDIF
-
-# --- Targets --------------------------------------------------------------
-
-.INCLUDE : target.mk
-
-# -------------------------------------------------------------------------
-
-
diff --git a/setup_native/source/win32/customactions/relnotes/relnotes.cxx b/setup_native/source/win32/customactions/relnotes/relnotes.cxx
deleted file mode 100644
index 48aaf9b417bd..000000000000
--- a/setup_native/source/win32/customactions/relnotes/relnotes.cxx
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- 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.
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma warning(push,1) // disable warnings within system headers
-#pragma warning(disable: 4917)
-#endif
-#include <windows.h>
-#include <msiquery.h>
-#include <shlobj.h>
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#include <string.h>
-#include <malloc.h>
-#include <stdio.h>
-#include <strsafe.h>
-#include <string>
-
-//----------------------------------------------------------
-#ifdef DEBUG
-inline void OutputDebugStringFormat( LPCTSTR pFormat, ... )
-{
- TCHAR buffer[1024];
- va_list args;
-
- va_start( args, pFormat );
- StringCchVPrintf( buffer, sizeof(buffer), pFormat, args );
- OutputDebugString( buffer );
-}
-#else
-static inline void OutputDebugStringFormat( LPCTSTR, ... )
-{
-}
-#endif
-
-//----------------------------------------------------------
-inline bool IsValidHandle( HANDLE handle )
-{
- return (NULL != handle) && (INVALID_HANDLE_VALUE != handle);
-}
-
-//----------------------------------------------------------
-static bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value)
-{
- DWORD sz = 0;
- LPTSTR dummy = TEXT("");
- if (MsiGetProperty(handle, name, dummy, &sz) == ERROR_MORE_DATA)
- {
- sz++;
- DWORD nbytes = sz * sizeof(TCHAR);
- LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes));
- ZeroMemory(buff, nbytes);
- MsiGetProperty(handle, name, buff, &sz);
- value = buff;
- return true;
- }
- return false;
-}
-
-//----------------------------------------------------------
-//----------------------------------------------------------
-//----------------------------------------------------------
-UINT ShowReleaseNotes( TCHAR* pFileName, TCHAR* pFilePath )
-{
- TCHAR sFullPath[ MAX_PATH ];
-
- if ( FAILED( StringCchCopy( sFullPath, MAX_PATH, pFilePath ) ) )
- {
- OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not copy path [%s]"), pFilePath );
- return ERROR_SUCCESS;
- }
-
- if ( FAILED( StringCchCat( sFullPath, MAX_PATH, pFileName ) ) )
- {
- OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not append filename [%s]"), pFileName );
- return ERROR_SUCCESS;
- }
-
- HANDLE hFile = CreateFile( sFullPath, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
- if ( IsValidHandle(hFile) )
- {
- CloseHandle( hFile );
- OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Found file [%s]"), sFullPath );
-
- SHELLEXECUTEINFOW aExecInf;
- ZeroMemory( &aExecInf, sizeof( aExecInf ) );
-
- aExecInf.cbSize = sizeof( aExecInf );
- aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI;
- aExecInf.lpVerb = TEXT("open");
- aExecInf.lpFile = sFullPath;
- aExecInf.lpDirectory = NULL;
- aExecInf.nShow = SW_SHOWNORMAL;
-
- SetLastError( 0 );
- ShellExecuteEx( &aExecInf );
- }
- else
- {
- OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: File not found [%s]"), sFullPath );
- }
-
- return ERROR_SUCCESS;
-}
-
-//----------------------------------------------------------
-extern "C" UINT __stdcall ShowReleaseNotesBefore( MSIHANDLE )
-{
- TCHAR szPath[MAX_PATH];
-
- if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) )
- return ERROR_SUCCESS;
-
- OutputDebugString( TEXT("DEBUG: ShowReleaseNotesBefore called") );
-
- return ShowReleaseNotes( TEXT("\\sun\\releasenote1.url"), szPath );
-}
-
-//----------------------------------------------------------
-extern "C" UINT __stdcall ShowReleaseNotesAfter( MSIHANDLE )
-{
- TCHAR szPath[MAX_PATH];
-
- if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) )
- return ERROR_SUCCESS;
-
- OutputDebugString( TEXT("DEBUG: ShowReleaseNotesAfter called") );
-
- return ShowReleaseNotes( TEXT("\\sun\\releasenote2.url"), szPath );
-}
-
-//----------------------------------------------------------
-extern "C" UINT __stdcall ShowSurveyAfter( MSIHANDLE handle )
-{
- std::wstring prodname;
-
- GetMsiProp( handle, TEXT("ProductName"), prodname );
- std::wstring::size_type nIndex = prodname.find( TEXT( "OpenOffice.org" ) );
- if( std::wstring::npos == nIndex )
- return ERROR_SUCCESS;
-
- OutputDebugString( TEXT("DEBUG: ShowSurveyAfter called") );
-
- SHELLEXECUTEINFOW aExecInf;
- ZeroMemory( &aExecInf, sizeof( aExecInf ) );
-
- aExecInf.cbSize = sizeof( aExecInf );
- aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI;
- aExecInf.lpVerb = TEXT("open");
- aExecInf.lpFile = TEXT("http://surveys.libreoffice.org/deinstall");
- aExecInf.lpDirectory = NULL;
- aExecInf.nShow = SW_SHOWNORMAL;
-
- SetLastError( 0 );
- ShellExecuteEx( &aExecInf );
-
- return ERROR_SUCCESS;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/win32/customactions/sellang/makefile.mk b/setup_native/source/win32/customactions/sellang/makefile.mk
index a75c994fffc4..ffad814e3d74 100644
--- a/setup_native/source/win32/customactions/sellang/makefile.mk
+++ b/setup_native/source/win32/customactions/sellang/makefile.mk
@@ -31,8 +31,6 @@ PRJ=..$/..$/..$/..
PRJNAME=setup_native
TARGET=sellangmsi
-.IF "$(GUI)"=="WNT"
-
# --- Settings -----------------------------------------------------
ENABLE_EXCEPTIONS=TRUE
@@ -42,6 +40,8 @@ USE_DEFFILE=TRUE
.INCLUDE : settings.mk
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
+
CFLAGS+=-D_STLP_USE_STATIC_LIB
# --- Files --------------------------------------------------------
@@ -51,11 +51,12 @@ UWINAPILIB=
SLOFILES = \
$(SLO)$/sellang.obj
-SHL1STDLIBS= kernel32.lib\
- user32.lib\
- advapi32.lib\
- shell32.lib\
- msi.lib
+SHL1STDLIBS= \
+ $(KERNEL32LIB)\
+ $(USER32LIB)\
+ $(ADVAPI32LIB)\
+ $(SHELL32LIB)\
+ $(MSILIB)
SHL1LIBS = $(SLB)$/$(TARGET).lib
@@ -68,11 +69,10 @@ SHL1BASE = 0x1c000000
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
+.ENDIF
+
# --- Targets --------------------------------------------------------------
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
-
-.ENDIF
diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk
index de8f943320f0..e0950d992dc2 100644
--- a/setup_native/source/win32/customactions/shellextensions/makefile.mk
+++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk
@@ -43,7 +43,7 @@ CDEFS+=-Dnot_used_define_to_disable_pch
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -96,5 +96,3 @@ DEF1EXPORTFILE=exports.dxp
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
-
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 53066682e397..28ea3998e76f 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -198,13 +198,13 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
- std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ // std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") );
std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
std::_tstring mystr;
WIN32_FIND_DATA aFindFileData;
-
- mystr = "unopkg file: " + sUnoPkgFile;
+ bool registrationError = false;
// Find unopkg.exe
HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
@@ -213,14 +213,27 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
// unopkg.exe exists in program directory
std::_tstring sCommand = sUnoPkgFile + " sync";
- mystr = "Command: " + sCommand;
DWORD exitCode = 0;
- ExecuteCommand( sCommand.c_str(), & exitCode);
+ bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
+ if ( ! fSuccess )
+ {
+ mystr = "ERROR: An error occured during registration of extensions!";
+ MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK);
+ registrationError = true;
+ }
+
FindClose( hFindUnopkg );
}
- return ERROR_SUCCESS;
+ if ( registrationError )
+ {
+ return 1;
+ }
+ else
+ {
+ return ERROR_SUCCESS;
+ }
}
diff --git a/setup_native/source/win32/customactions/thesaurus/makefile.mk b/setup_native/source/win32/customactions/thesaurus/makefile.mk
index c353341bf353..3041f87598ac 100755
--- a/setup_native/source/win32/customactions/thesaurus/makefile.mk
+++ b/setup_native/source/win32/customactions/thesaurus/makefile.mk
@@ -31,8 +31,6 @@ PRJ=..$/..$/..$/..
PRJNAME=setup_native
TARGET=thidxmsi
-.IF "$(GUI)"=="WNT"
-
# --- Settings -----------------------------------------------------
ENABLE_EXCEPTIONS=TRUE
@@ -42,6 +40,8 @@ USE_DEFFILE=TRUE
.INCLUDE : settings.mk
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
+
CFLAGS+=-D_STLP_USE_STATIC_LIB
# --- Files --------------------------------------------------------
@@ -68,11 +68,10 @@ SHL1BASE = 0x1c000000
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
+.ENDIF
+
# --- Targets --------------------------------------------------------------
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
-
-.ENDIF
diff --git a/setup_native/source/win32/customactions/tools/makefile.mk b/setup_native/source/win32/customactions/tools/makefile.mk
index 24e14861b968..61c58036b9a8 100644
--- a/setup_native/source/win32/customactions/tools/makefile.mk
+++ b/setup_native/source/win32/customactions/tools/makefile.mk
@@ -41,7 +41,7 @@ USE_DEFFILE=TRUE
# --- Files --------------------------------------------------------
-.IF "$(GUI)"=="WNT"
+.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!=""
UWINAPILIB=
@@ -70,5 +70,3 @@ DEF1EXPORTFILE=exports.dxp
.INCLUDE : target.mk
# -------------------------------------------------------------------------
-
-
diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt
index 26c1b03511da..ff3e9f372bec 100644
--- a/setup_native/source/win32/msi-encodinglist.txt
+++ b/setup_native/source/win32/msi-encodinglist.txt
@@ -88,7 +88,6 @@ nl 1252 1043
nn 1252 2068
no 1252 1044
nr 0 1580 # Ndebele South
-ns 0 1132 # Northern Sotho (Sepedi)
nso 0 1132
ny 0 1598
oc 1252 1154 # Occitan-lengadocian
@@ -135,6 +134,7 @@ ti-ER 0 1139 # Tigrinya
tn 0 1074 # Setsuana
tr 1254 1055 # Turkish
ts 0 1073 # Tsonga
+tk 0 1090
tt 1251 1092 # Tatar
ug 0 2200
uk 1251 1058 # Ukrainian
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
index dc9e4d454a22..7bc0a1b29de6 100644
--- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -134,8 +134,8 @@ public:
sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature);
~DigitalSignaturesDialog();
- // Initialize the dialog and the security environment, returns sal_True on success
- sal_Bool Init( const rtl::OUString& rTokenName );
+ // Initialize the dialog and the security environment, returns TRUE on success
+ sal_Bool Init();
// Set the storage which should be signed or verified
void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore );
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
index 9e416fe37d0f..d0d3bbe8d012 100644
--- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -133,10 +133,9 @@ public:
XMLSignatureHelper(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& mrCtx );
~XMLSignatureHelper();
- // Initialize the security context with given crypto token.
- // Empty string means default crypto token.
- // Returns true for success.
- bool Init( const rtl::OUString& rTokenPath );
+ // Initialize the security context with default crypto token.
+ // Returns true for success.
+ bool Init();
// Set UriBinding to create input streams to open files.
// Default implementation is capable to open files from disk.
diff --git a/xmlsecurity/qa/certext/User_35_Root_11.crt b/xmlsecurity/qa/certext/User_35_Root_11.crt
new file mode 100644
index 000000000000..0092d16c7a60
--- /dev/null
+++ b/xmlsecurity/qa/certext/User_35_Root_11.crt
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 89401fab3b1e..b503a391aff5 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -221,7 +221,7 @@ sal_Bool DocumentDigitalSignatures::ImplViewSignatures(
sal_Bool bChanges = sal_False;
DigitalSignaturesDialog aSignaturesDialog(
NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature);
- bool bInit = aSignaturesDialog.Init( rtl::OUString() );
+ bool bInit = aSignaturesDialog.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
if ( bInit )
{
@@ -277,7 +277,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
XMLSignatureHelper aSignatureHelper( mxCtx );
- bool bInit = aSignatureHelper.Init( rtl::OUString() );
+ bool bInit = aSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
@@ -380,7 +380,7 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException
Reference< dcss::xml::crypto::XSecurityEnvironment > xSecEnv;
XMLSignatureHelper aSignatureHelper( mxCtx );
- if ( aSignatureHelper.Init( rtl::OUString() ) )
+ if ( aSignatureHelper.Init() )
xSecEnv = aSignatureHelper.GetSecurityEnvironment();
MacroSecurity aDlg( NULL, mxCtx, xSecEnv );
@@ -392,7 +392,7 @@ void DocumentDigitalSignatures::showCertificate(
{
XMLSignatureHelper aSignatureHelper( mxCtx );
- bool bInit = aSignatureHelper.Init( rtl::OUString() );
+ bool bInit = aSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
@@ -440,8 +440,6 @@ void DocumentDigitalSignatures::showCertificate(
::ucbhelper::ContentBroker* pBroker = NULL;
//warning free code
- //if ( aLocObj.GetProtocol() == INET_PROT_FILE && ( pBroker = ::ucbhelper::ContentBroker::get() ) )
- // xContentProvider = pBroker->getContentProviderInterface();
if ( aLocObj.GetProtocol() == INET_PROT_FILE)
{
pBroker = ::ucbhelper::ContentBroker::get();
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 1fb5c590602f..1c69f9c2161b 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -53,19 +53,10 @@ namespace css = ::com::sun::star;
namespace
{
- void ShrinkToFit( FixedImage& _rImage );
- void AdjustPosAndSize( Control& _rCtrl, Point& _rStartIn_EndOut, long _nXOffset = 0 );
-
void ShrinkToFit( FixedImage& _rImg )
{
_rImg.SetSizePixel( _rImg.GetImage().GetSizePixel() );
}
-
- void AdjustPosAndSize( Control& _rCtrl, Point& _rStartIn_EndOut, long _nOffs )
- {
- _rCtrl.SetPosPixel( _rStartIn_EndOut );
- _rStartIn_EndOut.X() += XmlSec::ShrinkToFitWidth( _rCtrl, _nOffs );
- }
}
CertificateViewer::CertificateViewer(
@@ -300,12 +291,6 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif
aLBEntry = pairIssuer.first;
aDetails = pairIssuer.second;
InsertElement( String( XMLSEC_RES( STR_ISSUER ) ), aLBEntry, aDetails );
- /*
- aSeq = xCert->getIssuerUniqueID();
- aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
- aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( String( XMLSEC_RES( STR_ISSUER_ID ) ), aLBEntry, aDetails, true );
- */
DateTime aDateTime;
utl::typeConvert( xCert->getNotValidBefore(), aDateTime );
@@ -324,12 +309,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif
aLBEntry = pairSubject.first;
aDetails = pairSubject.second;
InsertElement( String( XMLSEC_RES( STR_SUBJECT ) ), aLBEntry, aDetails );
- /*
- aSeq = xCert->getSubjectUniqueID();
- aLBEntry = XmlSec::GetHexString( aSeq, pHexSep );
- aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
- InsertElement( String( XMLSEC_RES( STR_SUBJECT_ID ) ), aLBEntry, aDetails, true );
- */
+
aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm();
InsertElement( String( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO ) ), aLBEntry, aDetails );
aSeq = xCert->getSubjectPublicKeyValue();
diff --git a/xmlsecurity/source/dialogs/dialogs.hrc b/xmlsecurity/source/dialogs/dialogs.hrc
index d315f7ccc020..e8f144577451 100644
--- a/xmlsecurity/source/dialogs/dialogs.hrc
+++ b/xmlsecurity/source/dialogs/dialogs.hrc
@@ -84,25 +84,19 @@
#define FI_STATE_NOTVALIDATED 12
#define FI_STATE_OLDSIGNATURE 16
-//#define DS_WIDTH DLGS_WIDTH
-//#define DS_HEIGHT DLGS_HEIGHT
#define DS_BTNWIDTH_1 70
#define DS_BTNSPACE_X RSC_SP_CTRL_X
#define DS_WIDTH (RSC_SP_DLG_INNERBORDER_LEFT+RSC_SP_DLG_INNERBORDER_RIGHT+2*DS_BTNSPACE_X+3*DS_BTNWIDTH_1)
#define DS_HEIGHT (DLGS_WIDTH*2/3)
#define DS_COL_0 RSC_SP_DLG_INNERBORDER_LEFT
-//#define DS_COL_MID (DS_WIDTH/2)
-//#define DS_COL_3 (DS_COL_MID-(DS_BTNWIDTH_1/2))
-//#define DS_COL_4 (DS_COL_2+DS_BTNWIDTH_1)
-//#define DS_COL_2 (DS_COL_3-DS_BTNSPACE_X)
-//#define DS_COL_1 (DS_COL_2-DS_BTNWIDTH_1)
+
#define DS_COL_1 DS_COL_0
#define DS_COL_2 (DS_COL_1+DS_BTNWIDTH_1)
#define DS_COL_3 (DS_COL_2+DS_BTNSPACE_X)
#define DS_COL_4 (DS_COL_3+DS_BTNWIDTH_1)
#define DS_COL_5 (DS_COL_4+DS_BTNSPACE_X)
-//#define DS_COL_6 (DS_COL_5+DS_BTNWIDTH_1)
+
#define DS_COL_7 (DS_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
#define DS_COL_6 DS_COL_7
@@ -242,8 +236,6 @@
#define CVP_ROW_3 (CVP_ROW_2+RSC_CD_PUSHBUTTON_HEIGHT)
#define CVP_ROW_4 (CVP_ROW_3+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
-//#define CV_ROW_0A (CV_ROW_0+RSC_SP_CTRL_DESC_Y+RSC_CD_FIXEDTEXT_HEIGHT)
-//#define CV_ROW_2A (CV_ROW_2+RSC_SP_CTRL_DESC_Y+RSC_CD_FIXEDTEXT_HEIGHT)
// --------- tab dialog macro security ---------
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index b77bceab6b41..471e7fbb6f9e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -259,9 +259,9 @@ DigitalSignaturesDialog::~DigitalSignaturesDialog()
{
}
-sal_Bool DigitalSignaturesDialog::Init( const rtl::OUString& rTokenName )
+sal_Bool DigitalSignaturesDialog::Init()
{
- bool bInit = maSignatureHelper.Init( rTokenName );
+ bool bInit = maSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index cb06dc53c936..c50eb835a4fc 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -371,8 +371,6 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP( Window* _pParent,
mbAuthorsReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS );
maTrustCertROFI.Show( mbAuthorsReadonly );
mbAuthorsReadonly ? maTrustCertLB.DisableTable() : maTrustCertLB.EnableTable();
-// unused button
-// maAddCertPB.Enable( !mbAuthorsReadonly );
FillCertLB();
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 09d68d8ca595..73cb5676d783 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -53,9 +53,6 @@ namespace XmlSec
if( !pResMgr )
{
ByteString aName( "xmlsec" );
-// pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILanguage() );
-// LanguageType aLang( LANGUAGE_ENGLISH_US );
-// pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), aLang );
// MT: Change to Locale
pResMgr = ResMgr::CreateResMgr( aName.GetBuffer() );
}
diff --git a/xmlsecurity/source/dialogs/stbcontrl.cxx b/xmlsecurity/source/dialogs/stbcontrl.cxx
index 125ca1590068..db5e970ce406 100644
--- a/xmlsecurity/source/dialogs/stbcontrl.cxx
+++ b/xmlsecurity/source/dialogs/stbcontrl.cxx
@@ -95,13 +95,7 @@ void XmlSecStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt )
{
// can / has to be done when integrated in Office!
-// if( rCEvt.GetCommand() == .... )
- if( false )
- {
-// GetBindings().GetDispatcher()->Execute( SID_PSZ_FUNCTION, SFX_CALLMODE_RECORD, &aItem, 0L );
- }
- else
- SfxStatusBarControl::Command( rCEvt );
+ SfxStatusBarControl::Command( rCEvt );
}
void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
diff --git a/xmlsecurity/source/dialogs/warnings.cxx b/xmlsecurity/source/dialogs/warnings.cxx
index 995bb6abba8a..43c110a81a14 100644
--- a/xmlsecurity/source/dialogs/warnings.cxx
+++ b/xmlsecurity/source/dialogs/warnings.cxx
@@ -77,7 +77,6 @@ MacroWarning::MacroWarning( Window* _pParent, uno::Reference< dcss::xml::crypto:
maViewSignsBtn.SetClickHdl( LINK( this, MacroWarning, ViewSignsBtnHdl ) );
maEnableBtn.SetClickHdl( LINK( this, MacroWarning, EnableBtnHdl ) );
-// maDisableBtn.SetClickHdl( LINK( this, MacroWarning, DisableBtnHdl ) );
if( mxCert.is() )
maSignsFI.SetText( XmlSec::GetContentPart( mxCert->getSubjectName() ) );
@@ -139,9 +138,4 @@ IMPL_LINK( MacroWarning, EnableBtnHdl, void*, EMPTYARG )
return 0;
}
-/*IMPL_LINK( MacroWarning, DisableBtnHdl, void*, EMPTYARG )
-{
- return 0;
-}*/
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
index 3761b27fc090..5be0154ebe11 100644
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ b/xmlsecurity/source/framework/buffernode.cxx
@@ -286,12 +286,6 @@ rtl::OUString BufferNode::printChildren() const
}
rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(" ));
- /*
- if (((ElementCollector*)(*ii))->isInternalNotificationSuppressed())
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*IN-Suppressed* " ));
- }
- */
rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SecID=" ));
rc += rtl::OUString::valueOf(((ElementCollector*)(*ii))->getSecurityId());
rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ));
diff --git a/xmlsecurity/source/framework/elementcollector.cxx b/xmlsecurity/source/framework/elementcollector.cxx
index 341a3fd3f920..2822c9746d39 100644
--- a/xmlsecurity/source/framework/elementcollector.cxx
+++ b/xmlsecurity/source/framework/elementcollector.cxx
@@ -91,13 +91,6 @@ ElementCollector::ElementCollector(
m_type = cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR;
}
-/*
-bool ElementCollector::isInternalNotificationSuppressed() const
-{
- return m_bInternalNotificationSuppressed;
-}
-*/
-
cssxc::sax::ElementMarkPriority ElementCollector::getPriority() const
{
return m_nPriority;
diff --git a/xmlsecurity/source/framework/elementcollector.hxx b/xmlsecurity/source/framework/elementcollector.hxx
index d08044017e1b..72ed2c87026a 100644
--- a/xmlsecurity/source/framework/elementcollector.hxx
+++ b/xmlsecurity/source/framework/elementcollector.hxx
@@ -86,7 +86,6 @@ public:
xReferenceResolvedListener);
virtual ~ElementCollector() {};
- //bool isInternalNotificationSuppressed() const;
com::sun::star::xml::crypto::sax::ElementMarkPriority getPriority() const;
bool getModify() const;
void notifyListener();
diff --git a/xmlsecurity/source/framework/securityengine.hxx b/xmlsecurity/source/framework/securityengine.hxx
index 7a36d29bc35b..d6dc0b9117fd 100644
--- a/xmlsecurity/source/framework/securityengine.hxx
+++ b/xmlsecurity/source/framework/securityengine.hxx
@@ -105,7 +105,6 @@ protected:
/*
* the status of the operation
*/
- //bool m_bOperationSucceed;
com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus;
/*
diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx
index 56d69f2558d9..3399663e1332 100644
--- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx
@@ -135,9 +135,6 @@ Reference< XInterface > SAL_CALL XMLEncryptionTemplateImpl :: impl_createInstanc
}
Reference< XSingleServiceFactory > XMLEncryptionTemplateImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
- //Reference< XSingleServiceFactory > xFactory ;
- //xFactory = ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName , impl_createInstance , impl_getSupportedServiceNames ) ;
- //return xFactory ;
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
index 46d5b6f84226..21dd97381a6a 100644
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
@@ -160,9 +160,6 @@ Reference< XInterface > SAL_CALL XMLSignatureTemplateImpl :: impl_createInstance
}
Reference< XSingleServiceFactory > XMLSignatureTemplateImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
- //Reference< XSingleServiceFactory > xFactory ;
- //xFactory = ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName , impl_createInstance , impl_getSupportedServiceNames ) ;
- //return xFactory ;
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 4e74ffd8877b..22a41bb3f4df 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -70,11 +70,9 @@ XMLSignatureHelper::XMLSignatureHelper( const uno::Reference< uno::XComponentCon
XMLSignatureHelper::~XMLSignatureHelper()
{
- if ( mxSEInitializer.is() && mxSecurityContext.is() )
- mxSEInitializer->freeSecurityContext( mxSecurityContext );
}
-bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath )
+bool XMLSignatureHelper::Init()
{
DBG_ASSERT( !mxSEInitializer.is(), "XMLSignatureHelper::Init - mxSEInitializer already set!" );
DBG_ASSERT( !mxSecurityContext.is(), "XMLSignatureHelper::Init - mxSecurityContext already set!" );
@@ -82,7 +80,7 @@ bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath )
ImplCreateSEInitializer();
if ( mxSEInitializer.is() )
- mxSecurityContext = mxSEInitializer->createSecurityContext( rTokenPath );
+ mxSecurityContext = mxSEInitializer->createSecurityContext( ::rtl::OUString() );
return mxSecurityContext.is();
}
@@ -402,7 +400,6 @@ sal_Int32 XMLSignatureHelper::GetSecurityEnvironmentNumber()
return (mxSecurityContext.is()?(mxSecurityContext->getSecurityEnvironmentNumber()): 0);
}
-
IMPL_LINK( XMLSignatureHelper, SignatureCreationResultListener, XMLSignatureCreationResult*, pResult )
{
maCreationResults.insert( maCreationResults.begin() + maCreationResults.size(), *pResult );
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index 9a073f141cd5..fed623cb22b1 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -32,6 +32,7 @@
#include <xmlsecurity/xmlsignaturehelper.hxx>
#include <xmlsignaturehelper2.hxx>
+#include <tools/solar.h>
#include <unotools/streamhelper.hxx>
#include <com/sun/star/embed/XStorage.hpp>
diff --git a/xmlsecurity/source/xmlsec/diagnose.cxx b/xmlsecurity/source/xmlsec/diagnose.cxx
index 05bf0275f3d1..88002aa1bcb2 100644
--- a/xmlsecurity/source/xmlsec/diagnose.cxx
+++ b/xmlsecurity/source/xmlsec/diagnose.cxx
@@ -34,8 +34,7 @@
namespace xmlsecurity {
-struct UseDiagnose : public rtl::StaticWithInit<
- const bool, UseDiagnose>
+struct UseDiagnose : public rtl::StaticWithInit< bool, UseDiagnose>
{
bool operator () () const
{
diff --git a/xmlsecurity/source/xmlsec/makefile.mk b/xmlsecurity/source/xmlsec/makefile.mk
index 44b668b84765..36b30f4f25a3 100644
--- a/xmlsecurity/source/xmlsec/makefile.mk
+++ b/xmlsecurity/source/xmlsec/makefile.mk
@@ -49,11 +49,11 @@ CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
.ENDIF
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
-CDEFS += -DXMLSEC_CRYPTO_MSCRYPTO -DXMLSEC_NO_XSLT
-.ELSE
-CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT
+CDEFS += -DXMLSEC_CRYPTO_MSCRYPTO
.ENDIF
+CDEFS += -DXMLSEC_NO_XSLT
+
# --- Files --------------------------------------------------------
SLOFILES = \
$(SLO)$/biginteger.obj \
diff --git a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
index 20153edf18e6..2287266de3fa 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
+++ b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
@@ -63,7 +63,8 @@ SLOFILES = \
$(SLO)$/xmlsignature_mscryptimpl.obj \
$(SLO)$/x509certificate_mscryptimpl.obj \
$(SLO)$/seinitializer_mscryptimpl.obj \
- $(SLO)$/xsec_mscrypt.obj
+ $(SLO)$/xsec_mscrypt.obj \
+ $(SLO)$/sanextension_mscryptimpl.obj
.ENDIF
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
new file mode 100644
index 000000000000..9c47a853d470
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+#include <sal/config.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/security/ExtAltNameType.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/sequence.hxx>
+
+
+#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_
+#include "sanextension_mscryptimpl.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::security ;
+using ::rtl::OUString ;
+
+using ::com::sun::star::security::XCertificateExtension ;
+
+
+SanExtensionImpl :: SanExtensionImpl() :
+ m_critical( sal_False )
+{
+}
+
+SanExtensionImpl :: ~SanExtensionImpl() {
+}
+
+
+//Methods from XCertificateExtension
+sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_critical ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnId ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnValue ;
+}
+
+//Methods from XSanExtension
+::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){
+
+ if (!m_Entries.hasElements())
+ {
+ CERT_ALT_NAME_INFO *subjectName;
+ DWORD size;
+ CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, (unsigned char*) m_xExtnValue.getArray(), m_xExtnValue.getLength(), CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,&subjectName, &size);
+
+ CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[subjectName->cAltEntry];
+
+ for (unsigned int i = 0; i < (unsigned int)subjectName->cAltEntry; i++){
+ PCERT_ALT_NAME_ENTRY pEntry = &subjectName->rgAltEntry[i];
+
+ switch(pEntry->dwAltNameChoice) {
+ case CERT_ALT_NAME_OTHER_NAME :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME;
+ PCERT_OTHER_NAME pOtherName = pEntry->pOtherName;
+
+ ::com::sun::star::beans::NamedValue otherNameProp;
+ otherNameProp.Name = ::rtl::OUString::createFromAscii(pOtherName->pszObjId);
+
+ Sequence< sal_Int8 > otherName( pOtherName->Value.cbData ) ;
+ for( unsigned int n = 0; n < (unsigned int) pOtherName->Value.cbData ; n ++ )
+ otherName[n] = *( pOtherName->Value.pbData + n ) ;
+
+ otherNameProp.Value <<= otherName;
+
+ arrCertAltNameEntry[i].Value <<= otherNameProp;
+ break;
+ }
+ case CERT_ALT_NAME_RFC822_NAME :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszRfc822Name);
+ break;
+ case CERT_ALT_NAME_DNS_NAME :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszDNSName);
+ break;
+ case CERT_ALT_NAME_DIRECTORY_NAME :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME;
+ break;
+ }
+ case CERT_ALT_NAME_URL :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszURL);
+ break;
+ case CERT_ALT_NAME_IP_ADDRESS :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS;
+
+ Sequence< sal_Int8 > ipAddress( pEntry->IPAddress.cbData ) ;
+ for( unsigned int n = 0; n < pEntry->IPAddress.cbData ; n ++ )
+ ipAddress[n] = *( pEntry->IPAddress.pbData + n ) ;
+
+ arrCertAltNameEntry[i].Value <<= ipAddress;
+ break;
+ }
+ case CERT_ALT_NAME_REGISTERED_ID :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(pEntry->pszRegisteredID);
+ break;
+ }
+ }
+ m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, subjectName->cAltEntry);
+
+ delete [] arrCertAltNameEntry;
+ }
+
+ return m_Entries;
+}
+
+//Helper method
+void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) {
+ m_critical = critical ;
+ m_xExtnId = extnId ;
+ m_xExtnValue = extnValue ;
+}
+
+void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) {
+ unsigned int i ;
+ if( value != NULL && vlen != 0 ) {
+ Sequence< sal_Int8 > extnv( vlen ) ;
+ for( i = 0; i < vlen ; i ++ )
+ extnv[i] = *( value + i ) ;
+
+ m_xExtnValue = extnv ;
+ } else {
+ m_xExtnValue = Sequence<sal_Int8>();
+ }
+
+ if( id != NULL && idlen != 0 ) {
+ Sequence< sal_Int8 > extnId( idlen ) ;
+ for( i = 0; i < idlen ; i ++ )
+ extnId[i] = *( id + i ) ;
+
+ m_xExtnId = extnId ;
+ } else {
+ m_xExtnId = Sequence<sal_Int8>();
+ }
+
+ m_critical = critical ;
+}
+
+void SanExtensionImpl :: extractCertExt () {
+}
+
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx
new file mode 100644
index 000000000000..0fb3616486be
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_
+#define _SANEXTENSION_MSCRYPTIMPL_HXX_
+
+#ifdef _MSC_VER
+#pragma warning(push,1)
+#endif
+#include "Windows.h"
+#include "WinCrypt.h"
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include "com/sun/star/uno/SecurityException.hpp"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/security/XCertificateExtension.hpp>
+#include <com/sun/star/security/XSanExtension.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+
+class SanExtensionImpl : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::security::XSanExtension >
+{
+ private :
+ sal_Bool m_critical ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
+
+ ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
+
+ public :
+ SanExtensionImpl() ;
+ virtual ~SanExtensionImpl() ;
+
+ //Methods from XCertificateExtension
+ virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Methods from XSanExtension
+
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Helper method
+ void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
+
+ void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
+
+ void extractCertExt() ;
+} ;
+
+#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
+
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 94017fe97286..33587ab59d0b 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -43,7 +43,7 @@
#include "securityenvironment_mscryptimpl.hxx"
#include "x509certificate_mscryptimpl.hxx"
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
#include <xmlsec/xmlsec.h>
#include <xmlsec/keysmngr.h>
@@ -230,17 +230,15 @@ sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl :: getSomething( const Sequen
}
/* XUnoTunnel extension */
+
+
+namespace
+{
+ class theSecurityEnvironment_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_MSCryptImplUnoTunnelId > {};
+}
+
const Sequence< sal_Int8>& SecurityEnvironment_MSCryptImpl :: getUnoTunnelId() {
- static Sequence< sal_Int8 >* pSeq = 0 ;
- if( !pSeq ) {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if( !pSeq ) {
- static Sequence< sal_Int8> aSeq( 16 ) ;
- rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ;
- pSeq = &aSeq ;
- }
- }
- return *pSeq ;
+ return theSecurityEnvironment_MSCryptImplUnoTunnelId::get().getSeq();
}
/* XUnoTunnel extension */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 8f0b7c7a9979..c35cd7621a79 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -57,6 +57,9 @@
#include <list>
#include "xmlsec/xmlsec.h"
+#include "sal/types.h"
+
+
class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4<
::com::sun::star::xml::crypto::XSecurityEnvironment ,
::com::sun::star::lang::XInitialization ,
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index d5ab2898ee5a..ea2f8ce27e73 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -29,9 +29,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmlsecurity.hxx"
#include <sal/config.h>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
#include "x509certificate_mscryptimpl.hxx"
#include "certificateextension_xmlsecimpl.hxx"
+#include "sanextension_mscryptimpl.hxx"
#include "oid.hxx"
@@ -387,7 +388,13 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su
for( unsigned int i = 0; i < m_pCertContext->pCertInfo->cExtension; i++ ) {
pExtn = &(m_pCertContext->pCertInfo->rgExtension[i]) ;
- xExtn = new CertificateExtension_XmlSecImpl() ;
+
+ ::rtl::OUString objId = ::rtl::OUString::createFromAscii( pExtn->pszObjId );
+
+ if ( objId.equalsAscii("2.5.29.17") )
+ xExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ xExtn = new CertificateExtension_XmlSecImpl() ;
if( xExtn == NULL )
throw RuntimeException() ;
@@ -482,17 +489,14 @@ sal_Int64 SAL_CALL X509Certificate_MSCryptImpl :: getSomething( const Sequence<
}
/* XUnoTunnel extension */
+
+namespace
+{
+ class theX509Certificate_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theX509Certificate_MSCryptImplUnoTunnelId > {};
+}
+
const Sequence< sal_Int8>& X509Certificate_MSCryptImpl :: getUnoTunnelId() {
- static Sequence< sal_Int8 >* pSeq = 0 ;
- if( !pSeq ) {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if( !pSeq ) {
- static Sequence< sal_Int8> aSeq( 16 ) ;
- rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ;
- pSeq = &aSeq ;
- }
- }
- return *pSeq ;
+ return theX509Certificate_MSCryptImplUnoTunnelId::get().getSeq();
}
/* XUnoTunnel extension */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index c9fed3227f0b..2a8983216e17 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmlsecurity.hxx"
#include <sal/config.h>
-#include <rtl/uuid.h>
#include "securityenvironment_mscryptimpl.hxx"
#include "xmlsecuritycontext_mscryptimpl.hxx"
@@ -132,126 +131,6 @@ void SAL_CALL XMLSecurityContext_MSCryptImpl::setDefaultSecurityEnvironmentIndex
//dummy
}
-#if 0
-/* XXMLSecurityContext */
-void SAL_CALL XMLSecurityContext_MSCryptImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) {
- HCERTSTORE hkeyStore ;
- HCERTSTORE hCertStore ;
- HCRYPTKEY symKey ;
- HCRYPTKEY pubKey ;
- HCRYPTKEY priKey ;
- unsigned int i ;
-
- if( !aSecurityEnvironment.is() )
- throw RuntimeException() ;
-
- m_xSecurityEnvironment = aSecurityEnvironment ;
-
- //Clear key manager
- if( m_pKeysMngr != NULL ) {
- xmlSecKeysMngrDestroy( m_pKeysMngr ) ;
- m_pKeysMngr = NULL ;
- }
-
- //Create key manager
- Reference< XUnoTunnel > xEnvTunnel( m_xSecurityEnvironment , UNO_QUERY ) ;
- if( !xEnvTunnel.is() ) {
- throw RuntimeException() ;
- }
-
- SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
- if( pSecEnv == NULL )
- throw RuntimeException() ;
-
- hkeyStore = pSecEnv->getCryptoSlot() ;
- hCertStore = pSecEnv->getCertDb() ;
-
- /*-
- * The following lines is based on the of xmlsec-mscrypto crypto engine
- */
- m_pKeysMngr = xmlSecMSCryptoAppliedKeysMngrCreate( hkeyStore , hCertStore ) ;
- if( m_pKeysMngr == NULL )
- throw RuntimeException() ;
-
- /*-
- * Adopt symmetric key into keys manager
- */
- for( i = 0 ; ( symKey = pSecEnv->getSymKey( i ) ) != NULL ; i ++ ) {
- if( xmlSecMSCryptoAppliedKeysMngrSymKeyLoad( m_pKeysMngr, symKey ) < 0 ) {
- throw RuntimeException() ;
- }
- }
-
- /*-
- * Adopt asymmetric public key into keys manager
- */
- for( i = 0 ; ( pubKey = pSecEnv->getPubKey( i ) ) != NULL ; i ++ ) {
- if( xmlSecMSCryptoAppliedKeysMngrPubKeyLoad( m_pKeysMngr, pubKey ) < 0 ) {
- throw RuntimeException() ;
- }
- }
-
- /*-
- * Adopt asymmetric private key into keys manager
- */
- for( i = 0 ; ( priKey = pSecEnv->getPriKey( i ) ) != NULL ; i ++ ) {
- if( xmlSecMSCryptoAppliedKeysMngrPriKeyLoad( m_pKeysMngr, priKey ) < 0 ) {
- throw RuntimeException() ;
- }
- }
-
- /*-
- * Adopt system default certificate store.
- */
- if( pSecEnv->defaultEnabled() ) {
- HCERTSTORE hSystemStore ;
-
- //Add system key store into the keys manager.
- hSystemStore = CertOpenSystemStore( 0, "MY" ) ;
- if( hSystemStore != NULL ) {
- if( xmlSecMSCryptoAppliedKeysMngrAdoptKeyStore( m_pKeysMngr, hSystemStore ) < 0 ) {
- CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
- throw RuntimeException() ;
- }
- }
-
- //Add system root store into the keys manager.
- hSystemStore = CertOpenSystemStore( 0, "Root" ) ;
- if( hSystemStore != NULL ) {
- if( xmlSecMSCryptoAppliedKeysMngrAdoptTrustedStore( m_pKeysMngr, hSystemStore ) < 0 ) {
- CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
- throw RuntimeException() ;
- }
- }
-
- //Add system trusted store into the keys manager.
- hSystemStore = CertOpenSystemStore( 0, "Trust" ) ;
- if( hSystemStore != NULL ) {
- if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( m_pKeysMngr, hSystemStore ) < 0 ) {
- CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
- throw RuntimeException() ;
- }
- }
-
- //Add system CA store into the keys manager.
- hSystemStore = CertOpenSystemStore( 0, "CA" ) ;
- if( hSystemStore != NULL ) {
- if( xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore( m_pKeysMngr, hSystemStore ) < 0 ) {
- CertCloseStore( hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG ) ;
- throw RuntimeException() ;
- }
- }
- }
-}
-
-/* XXMLSecurityContext */
-Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContext_MSCryptImpl :: getSecurityEnvironment()
- throw (RuntimeException)
-{
- return m_xSecurityEnvironment ;
-}
-#endif
-
/* XInitialization */
void SAL_CALL XMLSecurityContext_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) {
// TBD
@@ -302,44 +181,4 @@ Reference< XSingleServiceFactory > XMLSecurityContext_MSCryptImpl :: impl_create
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
}
-#if 0
-/* XUnoTunnel */
-sal_Int64 SAL_CALL XMLSecurityContext_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
-throw (RuntimeException)
-{
- if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
- return ( sal_Int64 )this ;
- }
- return 0 ;
-}
-
-/* XUnoTunnel extension */
-const Sequence< sal_Int8>& XMLSecurityContext_MSCryptImpl :: getUnoTunnelId() {
- static Sequence< sal_Int8 >* pSeq = 0 ;
- if( !pSeq ) {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if( !pSeq ) {
- static Sequence< sal_Int8> aSeq( 16 ) ;
- rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ;
- pSeq = &aSeq ;
- }
- }
- return *pSeq ;
-}
-
-/* XUnoTunnel extension */
-XMLSecurityContext_MSCryptImpl* XMLSecurityContext_MSCryptImpl :: getImplementation( const Reference< XInterface > xObj ) {
- Reference< XUnoTunnel > xUT( xObj , UNO_QUERY ) ;
- if( xUT.is() ) {
- return ( XMLSecurityContext_MSCryptImpl* )xUT->getSomething( getUnoTunnelId() ) ;
- } else
- return NULL ;
-}
-
-/* Native methods */
-xmlSecKeysMngrPtr XMLSecurityContext_MSCryptImpl :: keysManager() throw( Exception, RuntimeException ) {
- return m_pKeysMngr ;
-}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
new file mode 100644
index 000000000000..93a17e3514b7
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
@@ -0,0 +1,276 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <precompiled_xmlsecurity.hxx>
+
+#include <osl/time.h>
+#include <rtl/random.h>
+#include <rtl/ref.hxx>
+
+#include "ciphercontext.hxx"
+
+using namespace ::com::sun::star;
+
+uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANISM_TYPE nNSSCipherID, const uno::Sequence< ::sal_Int8 >& aKey, const uno::Sequence< ::sal_Int8 >& aInitializationVector, bool bEncryption, bool bW3CPadding )
+{
+ ::rtl::Reference< OCipherContext > xResult = new OCipherContext;
+
+ xResult->m_pSlot = PK11_GetBestSlot( nNSSCipherID, NULL );
+ if ( xResult->m_pSlot )
+ {
+ SECItem aKeyItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aKey.getConstArray() ) ), aKey.getLength() };
+ xResult->m_pSymKey = PK11_ImportSymKey( xResult->m_pSlot, nNSSCipherID, PK11_OriginDerive, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, &aKeyItem, NULL );
+ if ( xResult->m_pSymKey )
+ {
+ SECItem aIVItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aInitializationVector.getConstArray() ) ), aInitializationVector.getLength() };
+ xResult->m_pSecParam = PK11_ParamFromIV( nNSSCipherID, &aIVItem );
+ if ( xResult->m_pSecParam )
+ {
+ xResult->m_pContext = PK11_CreateContextBySymKey( nNSSCipherID, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, xResult->m_pSymKey, xResult->m_pSecParam);
+ if ( xResult->m_pContext )
+ {
+ xResult->m_bEncryption = bEncryption;
+ xResult->m_bW3CPadding = bW3CPadding;
+ xResult->m_bPadding = bW3CPadding || ( PK11_GetPadMechanism( nNSSCipherID ) == nNSSCipherID );
+ xResult->m_nBlockSize = PK11_GetBlockSize( nNSSCipherID, xResult->m_pSecParam );
+ if ( xResult->m_nBlockSize <= SAL_MAX_INT8 )
+ return xResult.get();
+ }
+ }
+ }
+ }
+
+ return uno::Reference< xml::crypto::XCipherContext >();
+}
+
+void OCipherContext::Dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pContext )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ }
+
+ if ( m_pSecParam )
+ {
+ SECITEM_FreeItem( m_pSecParam, PR_TRUE );
+ m_pSecParam = NULL;
+ }
+
+ if ( m_pSymKey )
+ {
+ PK11_FreeSymKey( m_pSymKey );
+ m_pSymKey = NULL;
+ }
+
+ if ( m_pSlot )
+ {
+ PK11_FreeSlot( m_pSlot );
+ m_pSlot = NULL;
+ }
+
+ m_bDisposed = true;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
+ throw ( lang::IllegalArgumentException, lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aToConvert;
+ if ( aData.getLength() )
+ {
+ sal_Int32 nOldLastBlockLen = m_aLastBlock.getLength();
+ OSL_ENSURE( nOldLastBlockLen <= m_nBlockSize, "Unexpected last block size!" );
+
+ sal_Int32 nAvailableData = nOldLastBlockLen + aData.getLength();
+ sal_Int32 nToConvertLen = nAvailableData;
+ if ( m_bEncryption || !m_bW3CPadding )
+ {
+ if ( nAvailableData % m_nBlockSize == 0 )
+ nToConvertLen = nAvailableData;
+ else if ( nAvailableData < m_nBlockSize )
+ nToConvertLen = 0;
+ else
+ nToConvertLen = nAvailableData - nAvailableData % m_nBlockSize;
+ }
+ else
+ {
+ // decryption with W3C padding needs at least one block for finalizing
+ if ( nAvailableData < m_nBlockSize * 2 )
+ nToConvertLen = 0;
+ else
+ nToConvertLen = nAvailableData - nAvailableData % m_nBlockSize - m_nBlockSize;
+ }
+
+ aToConvert.realloc( nToConvertLen );
+ if ( nToConvertLen == 0 )
+ {
+ m_aLastBlock.realloc( nOldLastBlockLen + aData.getLength() );
+ rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen, aData.getConstArray(), aData.getLength() );
+ // aToConvert stays empty
+ }
+ else if ( nToConvertLen < nOldLastBlockLen )
+ {
+ rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nToConvertLen );
+ rtl_copyMemory( m_aLastBlock.getArray(), m_aLastBlock.getConstArray() + nToConvertLen, nOldLastBlockLen - nToConvertLen );
+ m_aLastBlock.realloc( nOldLastBlockLen - nToConvertLen + aData.getLength() );
+ rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen - nToConvertLen, aData.getConstArray(), aData.getLength() );
+ }
+ else
+ {
+ rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nOldLastBlockLen );
+ if ( nToConvertLen > nOldLastBlockLen )
+ rtl_copyMemory( aToConvert.getArray() + nOldLastBlockLen, aData.getConstArray(), nToConvertLen - nOldLastBlockLen );
+ m_aLastBlock.realloc( nAvailableData - nToConvertLen );
+ rtl_copyMemory( m_aLastBlock.getArray(), aData.getConstArray() + nToConvertLen - nOldLastBlockLen, nAvailableData - nToConvertLen );
+ }
+ }
+
+ uno::Sequence< sal_Int8 > aResult;
+ OSL_ENSURE( aToConvert.getLength() % m_nBlockSize == 0, "Unexpected size of the data to encrypt!" );
+ if ( aToConvert.getLength() )
+ {
+ int nResultLen = 0;
+ aResult.realloc( aToConvert.getLength() + m_nBlockSize );
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ) ), aToConvert.getLength() ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ m_nConverted += aToConvert.getLength();
+ aResult.realloc( nResultLen );
+ }
+
+ return aResult;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDispose()
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ OSL_ENSURE( m_nBlockSize <= SAL_MAX_INT8, "Unexpected block size!" );
+ OSL_ENSURE( m_nConverted % m_nBlockSize == 0, "Unexpected amount of bytes is already converted!" );
+ sal_Int32 nSizeForPadding = ( m_nConverted + m_aLastBlock.getLength() ) % m_nBlockSize;
+
+ // if it is decryption, the amount of data should be rounded to the block size even in case of padding
+ if ( ( !m_bPadding || !m_bEncryption ) && nSizeForPadding )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The data should contain complete blocks only." ) ), uno::Reference< uno::XInterface >() );
+
+ if ( m_bW3CPadding && m_bEncryption )
+ {
+ // in this case the last block should be smaller than standtard block
+ // it will be increased with the padding
+ OSL_ENSURE( m_aLastBlock.getLength() < m_nBlockSize, "Unexpected size of cashed incomplete last block!" );
+
+ // W3CPadding handling for encryption
+ sal_Int32 nPaddingSize = m_nBlockSize - nSizeForPadding;
+ sal_Int32 nOldLastBlockLen = m_aLastBlock.getLength();
+ m_aLastBlock.realloc( nOldLastBlockLen + nPaddingSize );
+
+ if ( nPaddingSize > 1 )
+ {
+ TimeValue aTime;
+ osl_getSystemTime( &aTime );
+ rtlRandomPool aRandomPool = rtl_random_createPool();
+ rtl_random_addBytes( aRandomPool, &aTime, 8 );
+ rtl_random_getBytes( aRandomPool, m_aLastBlock.getArray() + nOldLastBlockLen, nPaddingSize - 1 );
+ rtl_random_destroyPool ( aRandomPool );
+ }
+ m_aLastBlock[m_aLastBlock.getLength() - 1] = static_cast< sal_Int8 >( nPaddingSize );
+ }
+
+ // finally should the last block be smaller than two standard blocks
+ OSL_ENSURE( m_aLastBlock.getLength() < m_nBlockSize * 2 , "Unexpected size of cashed incomplete last block!" );
+
+ uno::Sequence< sal_Int8 > aResult;
+ if ( m_aLastBlock.getLength() )
+ {
+ int nPrefResLen = 0;
+ aResult.realloc( m_aLastBlock.getLength() + m_nBlockSize );
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ) ), m_aLastBlock.getLength() ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( nPrefResLen );
+ m_aLastBlock.realloc( 0 );
+ }
+
+ sal_Int32 nPrefixLen = aResult.getLength();
+ aResult.realloc( nPrefixLen + m_nBlockSize * 2 );
+ unsigned nFinalLen = 0;
+ if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() + nPrefixLen ), &nFinalLen, aResult.getLength() - nPrefixLen ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( nPrefixLen + nFinalLen );
+
+ if ( m_bW3CPadding && !m_bEncryption )
+ {
+ // W3CPadding handling for decryption
+ // aResult should have anough data, since we let m_aLastBlock be big enough in case of decryption
+ OSL_ENSURE( aResult.getLength() >= m_nBlockSize, "Not enough data to handle the padding!" );
+
+ sal_Int8 nBytesToRemove = aResult[aResult.getLength() - 1];
+ if ( nBytesToRemove <= 0 || nBytesToRemove > aResult.getLength() )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( aResult.getLength() - nBytesToRemove );
+ }
+
+ Dispose();
+
+ return aResult;
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
new file mode 100644
index 000000000000..1574a6238bd4
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _CIPHERCONTEXT_HXX
+#define _CIPHERCONTEXT_HXX
+
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include <pk11pub.h>
+
+class OCipherContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XCipherContext >
+{
+private:
+ ::osl::Mutex m_aMutex;
+
+ PK11SlotInfo* m_pSlot;
+ PK11SymKey* m_pSymKey;
+ SECItem* m_pSecParam;
+ PK11Context* m_pContext;
+
+ sal_Int32 m_nBlockSize;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aLastBlock;
+
+ bool m_bEncryption;
+ bool m_bPadding;
+ bool m_bW3CPadding;
+ sal_Int64 m_nConverted;
+
+ bool m_bDisposed;
+ bool m_bBroken;
+
+ void Dispose();
+
+ OCipherContext()
+ : m_pSlot( NULL )
+ , m_pSymKey( NULL )
+ , m_pSecParam( NULL )
+ , m_pContext( NULL )
+ , m_nBlockSize( 0 )
+ , m_bEncryption( false )
+ , m_bPadding( false )
+ , m_bW3CPadding( false )
+ , m_nConverted( 0 )
+ , m_bDisposed( false )
+ , m_bBroken( false )
+ {}
+
+public:
+
+ virtual ~OCipherContext()
+ {
+ Dispose();
+ }
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > Create( CK_MECHANISM_TYPE nNSSCipherID, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aKey, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aInitializationVector, bool bEncryption, bool bW3CPadding );
+
+ // XCipherContext
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
new file mode 100644
index 000000000000..4b3a0d094bd9
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <precompiled_xmlsecurity.hxx>
+
+#include <pk11pub.h>
+#include "digestcontext.hxx"
+
+using namespace ::com::sun::star;
+
+ODigestContext::~ODigestContext()
+{
+ if ( m_pContext )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ }
+}
+
+void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ if ( !m_b1KData || m_nDigested < 1024 )
+ {
+ uno::Sequence< sal_Int8 > aToDigest = aData;
+ if ( m_b1KData && m_nDigested + aData.getLength() > 1024 )
+ aToDigest.realloc( 1024 - m_nDigested );
+
+ if ( PK11_DigestOp( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != SECSuccess )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bBroken = true;
+ throw uno::RuntimeException();
+ }
+
+ m_nDigested += aToDigest.getLength();
+ }
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL ODigestContext::finalizeDigestAndDispose()
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( m_nDigestLength );
+ unsigned int nResultLen = 0;
+ if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength() ) != SECSuccess )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bBroken = true;
+ throw uno::RuntimeException();
+ }
+
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bDisposed = true;
+
+ aResult.realloc( nResultLen );
+ return aResult;
+}
+
diff --git a/extensions/source/svg/svgwriter.hxx b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
index 2622f83f0182..8f9ef475a485 100644
--- a/extensions/source/svg/svgwriter.hxx
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,38 +25,44 @@
*
************************************************************************/
-#ifndef _SVGWRITER_HXX
-#define _SVGWRITER_HXX
+#ifndef _DIGESTCONTEXT_HXX
+#define _DIGESTCONTEXT_HXX
-#include "svgcom.hxx"
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
-// -------------
-// - SVGWriter -
-// -------------
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
-class SVGWriter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGWriter
+class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
{
private:
+ ::osl::Mutex m_aMutex;
- REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+ PK11Context* m_pContext;
+ sal_Int32 m_nDigestLength;
+ bool m_b1KData;
+ sal_Int32 m_nDigested;
- SVGWriter();
+ bool m_bDisposed;
+ bool m_bBroken;
public:
+ ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData )
+ : m_pContext( pContext )
+ , m_nDigestLength( nDigestLength )
+ , m_b1KData( b1KData )
+ , m_nDigested( 0 )
+ , m_bDisposed( false )
+ , m_bBroken( false )
+ {}
- SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
- virtual ~SVGWriter();
+ virtual ~ODigestContext();
- // XInterface
- virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- // XSVGWriter
- virtual void SAL_CALL write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
- const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException );
+ // XDigestContext
+ virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
};
#endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/nss/makefile.mk b/xmlsecurity/source/xmlsec/nss/makefile.mk
index de6a059573a2..ce088e2bb3dc 100644
--- a/xmlsecurity/source/xmlsec/nss/makefile.mk
+++ b/xmlsecurity/source/xmlsec/nss/makefile.mk
@@ -41,12 +41,6 @@ ENABLE_EXCEPTIONS = TRUE
CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
.ENDIF
-.IF "$(CRYPTO_ENGINE)" != "nss"
-LIBTARGET=NO
-.ENDIF
-
-.IF "$(CRYPTO_ENGINE)" == "nss"
-
.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES"
.IF "$(SYSTEM_MOZILLA)" != "YES"
@all:
@@ -93,7 +87,11 @@ $(MOZ_INC)$/profile \
-I$(MOZ_INC)$/embed_base
.ENDIF
-CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT
+.IF "$(CRYPTO_ENGINE)" == "nss"
+CDEFS += -DXMLSEC_CRYPTO_NSS
+.ENDIF
+
+CDEFS += -DXMLSEC_NO_XSLT
# --- Files --------------------------------------------------------
@@ -109,17 +107,22 @@ SOLARINC += -I$(NSS_INC)
.ENDIF
SLOFILES = \
+ $(SLO)$/nssinitializer.obj \
+ $(SLO)$/digestcontext.obj \
+ $(SLO)$/ciphercontext.obj \
+ $(SLO)$/xsec_nss.obj
+
+.IF "$(CRYPTO_ENGINE)" == "nss"
+SLOFILES += \
$(SLO)$/securityenvironment_nssimpl.obj \
+ $(SLO)$/seinitializer_nssimpl.obj \
$(SLO)$/xmlencryption_nssimpl.obj \
$(SLO)$/xmlsecuritycontext_nssimpl.obj \
$(SLO)$/xmlsignature_nssimpl.obj \
$(SLO)$/x509certificate_nssimpl.obj \
- $(SLO)$/seinitializer_nssimpl.obj \
- $(SLO)$/xsec_nss.obj \
- $(SLO)$/secerror.obj
-
+ $(SLO)$/sanextension_nssimpl.obj \
+ $(SLO)$/secerror.obj
-
.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
new file mode 100644
index 000000000000..ded32952d410
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+
+/*
+ * Turn off DEBUG Assertions
+ */
+#ifdef _DEBUG
+ #define _DEBUG_WAS_DEFINED _DEBUG
+ #undef _DEBUG
+#else
+ #undef _DEBUG_WAS_DEFINED
+#endif
+
+/*
+ * and turn off the additional virtual methods which are part of some interfaces when compiled
+ * with debug
+ */
+#ifdef DEBUG
+ #define DEBUG_WAS_DEFINED DEBUG
+ #undef DEBUG
+#else
+ #undef DEBUG_WAS_DEFINED
+#endif
+
+
+#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+
+#include <sal/types.h>
+#include <rtl/instance.hxx>
+#include <rtl/bootstrap.hxx>
+#include <rtl/string.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
+#include <tools/debug.hxx>
+#include <rtl/logfile.hxx>
+
+#include "seinitializer_nssimpl.hxx"
+#include "../diagnose.hxx"
+
+#include "securityenvironment_nssimpl.hxx"
+#include "digestcontext.hxx"
+#include "ciphercontext.hxx"
+
+#include <nspr.h>
+#include <cert.h>
+#include <nss.h>
+#include <pk11pub.h>
+#include <secmod.h>
+#include <nssckbi.h>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = css::uno;
+namespace cssl = css::lang;
+namespace cssxc = css::xml::crypto;
+
+using namespace xmlsecurity;
+using namespace com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OString;
+
+#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.NSSInitializer_NssImpl"
+
+#define ROOT_CERTS "Root Certs for OpenOffice.org"
+
+extern "C" void nsscrypto_finalize();
+
+
+namespace
+{
+
+bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init );
+
+struct InitNSSInitialize
+{
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+
+ InitNSSInitialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
+ : mxMSF( xMSF )
+ {
+ }
+
+ bool * operator()()
+ {
+ static bool bInitialized = false;
+ bool bNSSInit = false;
+ bInitialized = nsscrypto_initialize( mxMSF, bNSSInit );
+ if (bNSSInit)
+ atexit(nsscrypto_finalize );
+ return & bInitialized;
+ }
+};
+
+struct GetNSSInitStaticMutex
+{
+ ::osl::Mutex* operator()()
+ {
+ static ::osl::Mutex aNSSInitMutex;
+ return &aNSSInitMutex;
+ }
+};
+
+void deleteRootsModule()
+{
+ SECMODModule *RootsModule = 0;
+ SECMODModuleList *list = SECMOD_GetDefaultModuleList();
+ SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
+ SECMOD_GetReadLock(lock);
+
+ while (!RootsModule && list)
+ {
+ SECMODModule *module = list->module;
+
+ for (int i=0; i < module->slotCount; i++)
+ {
+ PK11SlotInfo *slot = module->slots[i];
+ if (PK11_IsPresent(slot))
+ {
+ if (PK11_HasRootCerts(slot))
+ {
+ xmlsec_trace("The root certifificates module \"%s"
+ "\" is already loaded: \n%s",
+ module->commonName, module->dllName);
+
+ RootsModule = SECMOD_ReferenceModule(module);
+ break;
+ }
+ }
+ }
+ list = list->next;
+ }
+ SECMOD_ReleaseReadLock(lock);
+
+ if (RootsModule)
+ {
+ PRInt32 modType;
+ if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
+ {
+ xmlsec_trace("Deleted module \"%s\".", RootsModule->commonName);
+ }
+ else
+ {
+ xmlsec_trace("Failed to delete \"%s\" : \n%s",
+ RootsModule->commonName, RootsModule->dllName);
+ }
+ SECMOD_DestroyModule(RootsModule);
+ RootsModule = 0;
+ }
+}
+
+::rtl::OString getMozillaCurrentProfile( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
+{
+ ::rtl::OString sResult;
+ // first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
+ char* pEnv = getenv( "MOZILLA_CERTIFICATE_FOLDER" );
+ if ( pEnv )
+ {
+ sResult = ::rtl::OString( pEnv );
+ RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using env MOZILLA_CERTIFICATE_FOLDER: %s", sResult.getStr() );
+ }
+ else
+ {
+ mozilla::MozillaProductType productTypes[4] = {
+ mozilla::MozillaProductType_Thunderbird,
+ mozilla::MozillaProductType_Mozilla,
+ mozilla::MozillaProductType_Firefox,
+ mozilla::MozillaProductType_Default };
+ int nProduct = 4;
+
+ uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
+ OSL_ENSURE( xInstance.is(), "failed to create instance" );
+
+ uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
+ = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
+ OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
+
+ if (xMozillaBootstrap.is())
+ {
+ for (int i=0; i<nProduct; i++)
+ {
+ ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
+
+ if (profile != NULL && profile.getLength()>0)
+ {
+ ::rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
+ sResult = ::rtl::OUStringToOString( sProfilePath, osl_getThreadTextEncoding() );
+ RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using Mozilla Profile: %s", sResult.getStr() );
+ }
+ }
+ }
+
+ RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
+ }
+
+ return sResult;
+}
+
+//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
+//the roots certificate module (libnssckbi.so), which they use, into the
+//profile. This module will then already be loaded during NSS_Init (and the
+//other init functions). This fails in two cases. First, FF3 was used to create
+//the profile, or possibly used that profile before, and second the profile was
+//used on a different platform.
+//
+//Then one needs to add the roots module oneself. This should be done with
+//SECMOD_LoadUserModule rather then SECMOD_AddNewModule. The latter would write
+//the location of the roots module to the profile, which makes FF2 and TB2 use
+//it instead of there own module.
+//
+//When using SYSTEM_MOZILLA then the libnss3.so lib is typically found in
+///usr/lib. This folder may, however, NOT contain the roots certificate
+//module. That is, just providing the library name in SECMOD_LoadUserModule or
+//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH
+//contains an FF or TB installation.
+//ATTENTION: DO NOT call this function directly instead use initNSS
+//return true - whole initialization was successful
+//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
+//was successful and therefor NSS_Shutdown should be called when terminating.
+bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init )
+{
+ bool return_value = true;
+
+ // this method must be called only once, no need for additional lock
+ rtl::OString sCertDir;
+
+ (void) xMSF;
+#ifdef XMLSEC_CRYPTO_NSS
+ if ( xMSF.is() )
+ sCertDir = getMozillaCurrentProfile( xMSF );
+#endif
+ xmlsec_trace( "Using profile: %s", sCertDir.getStr() );
+
+ PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
+
+ // there might be no profile
+ if ( sCertDir.getLength() > 0 )
+ {
+ if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess )
+ {
+ xmlsec_trace("Initializing NSS with profile failed.");
+ char * error = NULL;
+
+ PR_GetErrorText(error);
+ if (error)
+ xmlsec_trace("%s",error);
+ return false ;
+ }
+ }
+ else
+ {
+ xmlsec_trace("Initializing NSS without profile.");
+ if ( NSS_NoDB_Init(NULL) != SECSuccess )
+ {
+ xmlsec_trace("Initializing NSS without profile failed.");
+ char * error = NULL;
+ PR_GetErrorText(error);
+ if (error)
+ xmlsec_trace("%s",error);
+ return false ;
+ }
+ }
+ out_nss_init = true;
+
+#ifdef XMLSEC_CRYPTO_NSS
+#if defined SYSTEM_MOZILLA
+ if (!SECMOD_HasRootCerts())
+ {
+#endif
+ deleteRootsModule();
+
+#if defined SYSTEM_MOZILLA
+ OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("libnssckbi"SAL_DLLEXTENSION));
+#else
+ OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("${OOO_BASE_DIR}/program/libnssckbi"SAL_DLLEXTENSION));
+#endif
+ ::rtl::Bootstrap::expandMacros(rootModule);
+
+ OUString rootModulePath;
+ if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
+ {
+ ::rtl::OString ospath = ::rtl::OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
+ ::rtl::OStringBuffer pkcs11moduleSpec;
+ pkcs11moduleSpec.append("name=\"");
+ pkcs11moduleSpec.append(ROOT_CERTS);
+ pkcs11moduleSpec.append("\" library=\"");
+ pkcs11moduleSpec.append(ospath.getStr());
+ pkcs11moduleSpec.append("\"");
+
+ SECMODModule * RootsModule =
+ SECMOD_LoadUserModule(
+ const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
+ 0, // no parent
+ PR_FALSE); // do not recurse
+
+ if (RootsModule)
+ {
+
+ bool found = RootsModule->loaded;
+
+ SECMOD_DestroyModule(RootsModule);
+ RootsModule = 0;
+ if (found)
+ xmlsec_trace("Added new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ else
+ {
+ xmlsec_trace("FAILED to load the new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
+ }
+ }
+ else
+ {
+ xmlsec_trace("FAILED to add new root certifice module: "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
+
+ }
+ }
+ else
+ {
+ xmlsec_trace("Adding new root certificate module failed.");
+ return_value = false;
+ }
+#if SYSTEM_MOZILLA
+ }
+#endif
+#endif
+
+ return return_value;
+}
+
+
+// must be extern "C" because we pass the function pointer to atexit
+extern "C" void nsscrypto_finalize()
+{
+ SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
+
+ if (RootsModule)
+ {
+
+ if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
+ {
+ xmlsec_trace("Unloaded module \""ROOT_CERTS"\".");
+ }
+ else
+ {
+ xmlsec_trace("Failed unloadeding module \""ROOT_CERTS"\".");
+ }
+ SECMOD_DestroyModule(RootsModule);
+ }
+ else
+ {
+ xmlsec_trace("Unloading module \""ROOT_CERTS
+ "\" failed because it was not found.");
+ }
+ PK11_LogoutAll();
+ NSS_Shutdown();
+}
+} // namespace
+
+ONSSInitializer::ONSSInitializer(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
+ :mxMSF( rxMSF )
+{
+}
+
+ONSSInitializer::~ONSSInitializer()
+{
+}
+
+bool ONSSInitializer::initNSS( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
+{
+ return *rtl_Instance< bool, InitNSSInitialize, ::osl::MutexGuard, GetNSSInitStaticMutex >
+ ::create( InitNSSInitialize( xMSF ), GetNSSInitStaticMutex() );
+}
+
+css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ SECOidTag nNSSDigestID = SEC_OID_UNKNOWN;
+ sal_Int32 nDigestLength = 0;
+ bool b1KData = false;
+ if ( nDigestID == css::xml::crypto::DigestID::SHA256
+ || nDigestID == css::xml::crypto::DigestID::SHA256_1K )
+ {
+ nNSSDigestID = SEC_OID_SHA256;
+ nDigestLength = 32;
+ b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K );
+ }
+ else if ( nDigestID == css::xml::crypto::DigestID::SHA1
+ || nDigestID == css::xml::crypto::DigestID::SHA1_1K )
+ {
+ nNSSDigestID = SEC_OID_SHA1;
+ nDigestLength = 20;
+ b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K );
+ }
+ else
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected digest requested." ) ), css::uno::Reference< css::uno::XInterface >(), 1 );
+
+ if ( aParams.getLength() )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
+
+ css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
+ if( initNSS( mxMSF ) )
+ {
+ PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID );
+ if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess )
+ xResult = new ODigestContext( pContext, nDigestLength, b1KData );
+ }
+
+ return xResult;
+}
+
+css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer::getCipherContext( ::sal_Int32 nCipherID, const css::uno::Sequence< ::sal_Int8 >& aKey, const css::uno::Sequence< ::sal_Int8 >& aInitializationVector, ::sal_Bool bEncryption, const css::uno::Sequence< css::beans::NamedValue >& aParams )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ CK_MECHANISM_TYPE nNSSCipherID = 0;
+ bool bW3CPadding = false;
+ if ( nCipherID == css::xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ nNSSCipherID = CKM_AES_CBC;
+ bW3CPadding = true;
+
+ if ( aKey.getLength() != 16 && aKey.getLength() != 24 && aKey.getLength() != 32 )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected key length." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
+
+ if ( aParams.getLength() )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for cipher creation." ) ), css::uno::Reference< css::uno::XInterface >(), 5 );
+ }
+ else
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected cipher requested." ) ), css::uno::Reference< css::uno::XInterface >(), 1 );
+
+ css::uno::Reference< css::xml::crypto::XCipherContext > xResult;
+ if( initNSS( mxMSF ) )
+ {
+ if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected length of initialization vector." ) ), css::uno::Reference< css::uno::XInterface >(), 3 );
+
+ xResult = OCipherContext::Create( nNSSCipherID, aKey, aInitializationVector, bEncryption, bW3CPadding );
+ }
+
+ return xResult;
+}
+
+rtl::OUString ONSSInitializer_getImplementationName ()
+ throw (cssu::RuntimeException)
+{
+
+ return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
+}
+
+sal_Bool SAL_CALL ONSSInitializer_supportsService( const rtl::OUString& ServiceName )
+ throw (cssu::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( NSS_SERVICE_NAME ));
+}
+
+cssu::Sequence< rtl::OUString > SAL_CALL ONSSInitializer_getSupportedServiceNames( )
+ throw (cssu::RuntimeException)
+{
+ cssu::Sequence < rtl::OUString > aRet(1);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) );
+ return aRet;
+}
+
+cssu::Reference< cssu::XInterface > SAL_CALL ONSSInitializer_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
+ throw( cssu::Exception )
+{
+ return (cppu::OWeakObject*) new ONSSInitializer( rSMgr );
+}
+
+/* XServiceInfo */
+rtl::OUString SAL_CALL ONSSInitializer::getImplementationName()
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_getImplementationName();
+}
+sal_Bool SAL_CALL ONSSInitializer::supportsService( const rtl::OUString& rServiceName )
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_supportsService( rServiceName );
+}
+cssu::Sequence< rtl::OUString > SAL_CALL ONSSInitializer::getSupportedServiceNames( )
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_getSupportedServiceNames();
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
new file mode 100644
index 000000000000..6e7fed190d60
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _NSSINITIALIZER_HXX
+#define _NSSINITIALIZER_HXX
+
+#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/XCipherContextSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+#define NSS_SERVICE_NAME "com.sun.star.xml.crypto.NSSInitializer"
+
+class ONSSInitializer : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::xml::crypto::XDigestContextSupplier,
+ ::com::sun::star::xml::crypto::XCipherContextSupplier,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ONSSInitializer()
+ {}
+
+public:
+ ONSSInitializer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
+ virtual ~ONSSInitializer();
+
+ bool initNSS( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xMSF );
+
+ /* XDigestContextSupplier */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > SAL_CALL getDigestContext( ::sal_Int32 nDigestID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ /* XCipherContextSupplier */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > SAL_CALL getCipherContext( ::sal_Int32 nCipherID, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aKey, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aInitializationVector, ::sal_Bool bEncryption, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ /* XServiceInfo */
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+rtl::OUString ONSSInitializer_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL ONSSInitializer_supportsService( const rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL ONSSInitializer_getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL ONSSInitializer_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
new file mode 100644
index 000000000000..2c66321121db
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+*
+* 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.
+*
+* 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.
+*
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+#include <sal/config.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/security/ExtAltNameType.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/sequence.hxx>
+#include <seccomon.h>
+#include <cert.h>
+#include <certt.h>
+#include <secitem.h>
+#include <secport.h>
+
+
+#ifndef _SANEXTENSION_NSSIMPL_HXX_
+#include "sanextension_nssimpl.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::security ;
+using ::rtl::OUString ;
+
+using ::com::sun::star::security::XCertificateExtension ;
+
+
+SanExtensionImpl :: SanExtensionImpl() :
+m_critical( sal_False )
+{
+}
+
+SanExtensionImpl :: ~SanExtensionImpl() {
+}
+
+
+//Methods from XCertificateExtension
+sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_critical ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnId ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnValue ;
+}
+
+namespace {
+ // Helper functions from nss/lib/certdb/genname.c
+ static int GetNamesLength(CERTGeneralName *names)
+ {
+ int length = 0;
+ CERTGeneralName *first;
+
+ first = names;
+ if (names != NULL) {
+ do {
+ length++;
+ names = CERT_GetNextGeneralName(names);
+ } while (names != first);
+ }
+ return length;
+ }
+
+}
+
+//Methods from XSanExtension
+::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){
+
+ if (!m_Entries.hasElements())
+ {
+ SECItem item;
+
+ item.type = siDERCertBuffer;
+ item.data = (unsigned char*) m_xExtnValue.getArray();
+ item.len = m_xExtnValue.getLength();
+
+ PRArenaPool *arena;
+ CERTGeneralName *nameList;
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+
+ if (!arena)
+ return m_Entries;
+
+ nameList = CERT_DecodeAltNameExtension(arena, &item);
+
+ CERTGeneralName* current = nameList;
+
+ int size = GetNamesLength(nameList);
+ CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[size];
+ for(int i = 0; i < size ; i++){
+ switch (current->type) {
+ case certOtherName: {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME;
+ ::com::sun::star::beans::PropertyValue otherNameProp;
+ otherNameProp.Name = ::rtl::OUString::createFromAscii(CERT_GetOidString(&current->name.OthName.oid));
+
+ Sequence< sal_Int8 > otherName( current->name.OthName.name.len ) ;
+ for( unsigned int r = 0; r < current->name.OthName.name.len ; r ++ )
+ otherName[r] = *( current->name.OthName.name.data + r ) ;
+
+ otherNameProp.Value <<= otherName;
+
+ arrCertAltNameEntry[i].Value <<= otherNameProp;
+ break;
+ }
+ case certRFC822Name:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certDNSName:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certX400Address: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS;
+ break;
+ }
+ case certDirectoryName: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME;
+ break;
+ }
+ case certEDIPartyName: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME;
+ break;
+ }
+ case certURI:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certIPAddress: {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS;
+
+ Sequence< sal_Int8 > ipAddress( current->name.other.len ) ;
+ for( unsigned int r = 0; r < current->name.other.len ; r ++ )
+ ipAddress[r] = *( current->name.other.data + r ) ;
+
+ arrCertAltNameEntry[i].Value <<= ipAddress;
+ break;
+ }
+ case certRegisterID:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID;
+
+
+ rtl::OString nssOid = ::rtl::OString(CERT_GetOidString(&current->name.other));
+ rtl::OString unoOid = removeOIDFromString(nssOid);
+ arrCertAltNameEntry[i].Value <<= rtl::OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ current = CERT_GetNextGeneralName(current);
+ }
+
+ m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, size);
+
+ delete [] arrCertAltNameEntry;
+
+ PORT_FreeArena(arena, PR_FALSE);
+
+
+ }
+
+ return m_Entries;
+}
+
+::rtl::OString SanExtensionImpl :: removeOIDFromString( const ::rtl::OString &oidString)
+ {
+ ::rtl::OString objID;
+ ::rtl::OString oid("OID.");
+ if (oidString.match(oid))
+ objID = oidString.copy(oid.getLength());
+ else
+ objID = oidString;
+ return objID;
+
+ }
+//Helper method
+void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) {
+ m_critical = critical ;
+ m_xExtnId = extnId ;
+ m_xExtnValue = extnValue ;
+}
+
+void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) {
+ unsigned int i ;
+ if( value != NULL && vlen != 0 ) {
+ Sequence< sal_Int8 > extnv( vlen ) ;
+ for( i = 0; i < vlen ; i ++ )
+ extnv[i] = *( value + i ) ;
+
+ m_xExtnValue = extnv ;
+ } else {
+ m_xExtnValue = Sequence<sal_Int8>();
+ }
+
+ if( id != NULL && idlen != 0 ) {
+ Sequence< sal_Int8 > extnId( idlen ) ;
+ for( i = 0; i < idlen ; i ++ )
+ extnId[i] = *( id + i ) ;
+
+ m_xExtnId = extnId ;
+ } else {
+ m_xExtnId = Sequence<sal_Int8>();
+ }
+
+ m_critical = critical ;
+}
+
+void SanExtensionImpl :: extractCertExt () {
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
new file mode 100644
index 000000000000..88425aa8d125
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _SANEXTENSION_NSSIMPL_HXX_
+#define _SANEXTENSION_NSSIMPL_HXX_
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include "com/sun/star/uno/SecurityException.hpp"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/security/XCertificateExtension.hpp>
+#include <com/sun/star/security/XSanExtension.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+
+class SanExtensionImpl : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::security::XSanExtension >
+{
+ private :
+ sal_Bool m_critical ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
+ ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
+
+ ::rtl::OString removeOIDFromString( const ::rtl::OString &oid);
+
+ public :
+ SanExtensionImpl() ;
+ virtual ~SanExtensionImpl() ;
+
+ //Methods from XCertificateExtension
+ virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Methods from XSanExtension
+
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Helper method
+ void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
+
+ void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
+
+ void extractCertExt() ;
+} ;
+
+#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
+
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index a6a1af956728..cb740e5d3ede 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -40,7 +40,7 @@
#include <sal/macros.h>
#include "securityenvironment_nssimpl.hxx"
#include "x509certificate_nssimpl.hxx"
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
#include "../diagnose.hxx"
#include <sal/types.h>
@@ -89,7 +89,29 @@ extern X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
struct UsageDescription
{
SECCertificateUsage usage;
- char const * const description;
+ char const* description;
+
+ UsageDescription()
+ : usage( certificateUsageCheckAllUsages )
+ , description( NULL )
+ {}
+
+ UsageDescription( SECCertificateUsage i_usage, char const* i_description )
+ : usage( i_usage )
+ , description( i_description )
+ {}
+
+ UsageDescription( const UsageDescription& aDescription )
+ : usage( aDescription.usage )
+ , description( aDescription.description )
+ {}
+
+ UsageDescription& operator =( const UsageDescription& aDescription )
+ {
+ usage = aDescription.usage;
+ description = aDescription.description;
+ return *this;
+ }
};
@@ -220,17 +242,14 @@ sal_Int64 SAL_CALL SecurityEnvironment_NssImpl :: getSomething( const Sequence<
}
/* XUnoTunnel extension */
+
+namespace
+{
+ class theSecurityEnvironment_NssImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_NssImplUnoTunnelId > {};
+}
+
const Sequence< sal_Int8>& SecurityEnvironment_NssImpl :: getUnoTunnelId() {
- static Sequence< sal_Int8 >* pSeq = 0 ;
- if( !pSeq ) {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if( !pSeq ) {
- static Sequence< sal_Int8> aSeq( 16 ) ;
- rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ;
- pSeq = &aSeq ;
- }
- }
- return *pSeq ;
+ return theSecurityEnvironment_NssImplUnoTunnelId::get().getSeq();
}
/* XUnoTunnel extension */
@@ -868,14 +887,12 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
// certificateUsageAnyCA
// certificateUsageProtectedObjectSigner
- UsageDescription arUsages[] =
- {
- {certificateUsageSSLClient, "certificateUsageSSLClient" },
- {certificateUsageSSLServer, "certificateUsageSSLServer" },
- {certificateUsageSSLCA, "certificateUsageSSLCA" },
- {certificateUsageEmailSigner, "certificateUsageEmailSigner"}, //only usable for end certs
- {certificateUsageEmailRecipient, "certificateUsageEmailRecipient"}
- };
+ UsageDescription arUsages[5];
+ arUsages[0] = UsageDescription( certificateUsageSSLClient, "certificateUsageSSLClient" );
+ arUsages[1] = UsageDescription( certificateUsageSSLServer, "certificateUsageSSLServer" );
+ arUsages[2] = UsageDescription( certificateUsageSSLCA, "certificateUsageSSLCA" );
+ arUsages[3] = UsageDescription( certificateUsageEmailSigner, "certificateUsageEmailSigner" );
+ arUsages[4] = UsageDescription( certificateUsageEmailRecipient, "certificateUsageEmailRecipient" );
int numUsages = SAL_N_ELEMENTS(arUsages);
for (int i = 0; i < numUsages; i++)
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 5bb2a9ecb567..1e521cf272fd 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -50,339 +50,45 @@
#undef DEBUG_WAS_DEFINED
#endif
-
#include <sal/types.h>
-#include "rtl/instance.hxx"
-#include "rtl/bootstrap.hxx"
-#include "rtl/string.hxx"
-#include "rtl/strbuf.hxx"
-#include "osl/file.hxx"
-#include "osl/thread.h"
+#include <rtl/bootstrap.hxx>
+#include <rtl/string.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
#include <tools/debug.hxx>
#include <rtl/logfile.hxx>
#include "seinitializer_nssimpl.hxx"
-#include "../diagnose.hxx"
-
#include "securityenvironment_nssimpl.hxx"
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include "nspr.h"
-#include "cert.h"
-#include "nss.h"
-#include "secmod.h"
-#include "nssckbi.h"
+#include <nspr.h>
+#include <cert.h>
+#include <nss.h>
+#include <pk11pub.h>
+#include <secmod.h>
+#include <nssckbi.h>
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
+namespace css = ::com::sun::star;
+namespace cssu = css::uno;
+namespace cssl = css::lang;
+namespace cssxc = css::xml::crypto;
-using namespace xmlsecurity;
using namespace com::sun::star;
using ::rtl::OUString;
using ::rtl::OString;
-#define SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
+#define SE_SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl"
#define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment"
#define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext"
-
-#define ROOT_CERTS "Root Certs for OpenOffice.org"
-
-
-extern "C" void nsscrypto_finalize();
-
-
-namespace
-{
-
-bool nsscrypto_initialize( const char * sProfile, bool & out_nss_init);
-
-struct InitNSSInitialize
-{
- //path to the database folder
- const OString m_sProfile;
- InitNSSInitialize(const OString & sProfile): m_sProfile(sProfile) {};
- bool * operator()()
- {
- static bool bInitialized = false;
- bool bNSSInit = false;
- bInitialized = nsscrypto_initialize(m_sProfile.getStr(), bNSSInit);
- if (bNSSInit)
- atexit(nsscrypto_finalize );
- return & bInitialized;
-
- }
-};
-
-bool * initNSS(const OString & sProfile)
-{
- return rtl_Instance< bool, InitNSSInitialize,
- ::osl::MutexGuard, ::osl::GetGlobalMutex >::create(
- InitNSSInitialize(sProfile), ::osl::GetGlobalMutex());
-}
-
-void deleteRootsModule()
-{
- SECMODModule *RootsModule = 0;
- SECMODModuleList *list = SECMOD_GetDefaultModuleList();
- SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
- SECMOD_GetReadLock(lock);
-
- while (!RootsModule && list)
- {
- SECMODModule *module = list->module;
-
- for (int i=0; i < module->slotCount; i++)
- {
- PK11SlotInfo *slot = module->slots[i];
- if (PK11_IsPresent(slot))
- {
- if (PK11_HasRootCerts(slot))
- {
- xmlsec_trace("The root certifificates module \"%s"
- "\" is already loaded: \n%s",
- module->commonName, module->dllName);
-
- RootsModule = SECMOD_ReferenceModule(module);
- break;
- }
- }
- }
- list = list->next;
- }
- SECMOD_ReleaseReadLock(lock);
-
- if (RootsModule)
- {
- PRInt32 modType;
- if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
- {
- xmlsec_trace("Deleted module \"%s\".", RootsModule->commonName);
- }
- else
- {
- xmlsec_trace("Failed to delete \"%s\" : \n%s",
- RootsModule->commonName, RootsModule->dllName);
- }
- SECMOD_DestroyModule(RootsModule);
- RootsModule = 0;
- }
-}
-
-//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
-//the roots certificate module (libnssckbi.so), which they use, into the
-//profile. This module will then already be loaded during NSS_Init (and the
-//other init functions). This fails in two cases. First, FF3 was used to create
-//the profile, or possibly used that profile before, and second the profile was
-//used on a different platform.
-//
-//Then one needs to add the roots module oneself. This should be done with
-//SECMOD_LoadUserModule rather then SECMOD_AddNewModule. The latter would write
-//the location of the roots module to the profile, which makes FF2 and TB2 use
-//it instead of there own module.
-//
-//When using SYSTEM_MOZILLA then the libnss3.so lib is typically found in
-///usr/lib. This folder may, however, NOT contain the roots certificate
-//module. That is, just providing the library name in SECMOD_LoadUserModule or
-//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH
-//contains an FF or TB installation.
-//ATTENTION: DO NOT call this function directly instead use initNSS
-//return true - whole initialization was successful
-//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
-//was successful and therefor NSS_Shutdown should be called when terminating.
-bool nsscrypto_initialize( const char* token, bool & out_nss_init )
-{
- bool return_value = true;
-
- xmlsec_trace("Using profile: %s", token);
-
- PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
-
- //token may be an empty string
- if (token != NULL && strlen(token) > 0)
- {
- if( NSS_InitReadWrite( token ) != SECSuccess )
- {
- xmlsec_trace("Initializing NSS with profile failed.");
- char * error = NULL;
-
- PR_GetErrorText(error);
- if (error)
- xmlsec_trace("%s",error);
- return false ;
- }
- }
- else
- {
- xmlsec_trace("Initializing NSS without profile.");
- if ( NSS_NoDB_Init(NULL) != SECSuccess )
- {
- xmlsec_trace("Initializing NSS without profile failed.");
- char * error = NULL;
- PR_GetErrorText(error);
- if (error)
- xmlsec_trace("%s",error);
- return false ;
- }
- }
- out_nss_init = true;
-
-#if defined SYSTEM_MOZILLA
- if (!SECMOD_HasRootCerts())
- {
-#endif
- deleteRootsModule();
-
-#if defined SYSTEM_MOZILLA
- OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("libnssckbi"SAL_DLLEXTENSION));
-#else
- OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("${OOO_BASE_DIR}/program/libnssckbi"SAL_DLLEXTENSION));
-#endif
- ::rtl::Bootstrap::expandMacros(rootModule);
-
- OUString rootModulePath;
- if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
- {
- ::rtl::OString ospath = ::rtl::OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
- ::rtl::OStringBuffer pkcs11moduleSpec;
- pkcs11moduleSpec.append("name=\"");
- pkcs11moduleSpec.append(ROOT_CERTS);
- pkcs11moduleSpec.append("\" library=\"");
- pkcs11moduleSpec.append(ospath.getStr());
- pkcs11moduleSpec.append("\"");
-
- SECMODModule * RootsModule =
- SECMOD_LoadUserModule(
- const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
- 0, // no parent
- PR_FALSE); // do not recurse
-
- if (RootsModule)
- {
-
- bool found = RootsModule->loaded;
-
- SECMOD_DestroyModule(RootsModule);
- RootsModule = 0;
- if (found)
- xmlsec_trace("Added new root certificate module "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- else
- {
- xmlsec_trace("FAILED to load the new root certificate module "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- return_value = false;
- }
- }
- else
- {
- xmlsec_trace("FAILED to add new root certifice module: "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- return_value = false;
-
- }
- }
- else
- {
- xmlsec_trace("Adding new root certificate module failed.");
- return_value = false;
- }
-#if SYSTEM_MOZILLA
- }
-#endif
-
- return return_value;
-}
-
-
-// must be extern "C" because we pass the function pointer to atexit
-extern "C" void nsscrypto_finalize()
-{
- SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
-
- if (RootsModule)
- {
-
- if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
- {
- xmlsec_trace("Unloaded module \""ROOT_CERTS"\".");
- }
- else
- {
- xmlsec_trace("Failed unloadeding module \""ROOT_CERTS"\".");
- }
- SECMOD_DestroyModule(RootsModule);
- }
- else
- {
- xmlsec_trace("Unloading module \""ROOT_CERTS
- "\" failed because it was not found.");
- }
- PK11_LogoutAll();
- NSS_Shutdown();
-}
-
-
-bool getMozillaCurrentProfile(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF,
- rtl::OUString& profilePath)
-{
- /*
- * first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
- */
- char * env = getenv("MOZILLA_CERTIFICATE_FOLDER");
- if (env)
- {
- profilePath = rtl::OUString::createFromAscii( env );
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using env MOZILLA_CERTIFICATE_FOLDER: %s", rtl::OUStringToOString( profilePath, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return true;
- }
- else
- {
- mozilla::MozillaProductType productTypes[4] = {
- mozilla::MozillaProductType_Thunderbird,
- mozilla::MozillaProductType_Mozilla,
- mozilla::MozillaProductType_Firefox,
- mozilla::MozillaProductType_Default };
-
- uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
-
- uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
- = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
- OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
-
- if (xMozillaBootstrap.is())
- {
int nProduct = 4;
- for (int i=0; i<nProduct; i++)
- {
- ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
-
- if (profile != NULL && profile.getLength()>0)
- {
- profilePath = xMozillaBootstrap->getProfilePath(productTypes[i],profile);
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using Mozilla Profile: %s", rtl::OUStringToOString( profilePath, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return true;
- }
- }
- }
-
- RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
- return false;
- }
-}
-
-} // namespace
-
SEInitializer_NssImpl::SEInitializer_NssImpl(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- :mxMSF( rxMSF )
+ const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
{
+ mxMSF = rxMSF;
}
SEInitializer_NssImpl::~SEInitializer_NssImpl()
@@ -391,36 +97,13 @@ SEInitializer_NssImpl::~SEInitializer_NssImpl()
/* XSEInitializer */
cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
- SEInitializer_NssImpl::createSecurityContext(
- const rtl::OUString& sCertDB )
+ SEInitializer_NssImpl::createSecurityContext( const ::rtl::OUString& )
throw (cssu::RuntimeException)
{
CERTCertDBHandle *pCertHandle = NULL ;
- rtl::OString sCertDir;
- if( sCertDB.getLength() )
- {
- sCertDir = rtl::OUStringToOString(sCertDB, RTL_TEXTENCODING_ASCII_US);
- }
- else
- {
- static rtl::OString* pDefaultCertDir = NULL;
- if ( !pDefaultCertDir )
- {
- pDefaultCertDir = new rtl::OString;
- rtl::OUString ouCertDir;
-
- if ( getMozillaCurrentProfile(mxMSF, ouCertDir) )
- *pDefaultCertDir = rtl::OUStringToOString(ouCertDir, RTL_TEXTENCODING_ASCII_US);
- }
- sCertDir = *pDefaultCertDir;
-
- }
-
- if( ! *initNSS( sCertDir.getStr() ) )
- {
+ if( !initNSS( mxMSF ) )
return NULL;
- }
pCertHandle = CERT_GetDefaultCertDB() ;
@@ -477,18 +160,18 @@ rtl::OUString SEInitializer_NssImpl_getImplementationName ()
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName )
throw (cssu::RuntimeException)
{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SE_SERVICE_NAME )) || ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( NSS_SERVICE_NAME ));
}
cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
throw (cssu::RuntimeException)
{
- cssu::Sequence < rtl::OUString > aRet(1);
+ cssu::Sequence < rtl::OUString > aRet(2);
rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SE_SERVICE_NAME ) );
+ pArray[1] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) );
return aRet;
}
-#undef SERVICE_NAME
cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
throw( cssu::Exception )
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
index 6012a0317c5b..776c2ffd4a78 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
@@ -31,46 +31,28 @@
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase2.hxx>
+
+#include <cppuhelper/implbase1.hxx>
#include <libxml/tree.h>
-class SEInitializer_NssImpl : public cppu::WeakImplHelper2
+#include "nssinitializer.hxx"
+
+class SEInitializer_NssImpl : public cppu::ImplInheritanceHelper1
<
- com::sun::star::xml::crypto::XSEInitializer,
- com::sun::star::lang::XServiceInfo
+ ONSSInitializer,
+ ::com::sun::star::xml::crypto::XSEInitializer
>
-/****** SEInitializer_NssImpl.hxx/CLASS SEInitializer_NssImpl ***********
- *
- * NAME
- * SEInitializer_NssImpl -- Class to initialize a Security Context
- * instance
- *
- * FUNCTION
- * Use this class to initialize a XmlSec based Security Context
- * instance. After this instance is used up, use this class to free this
- * instance.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
{
-private:
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
-
public:
- SEInitializer_NssImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF);
+ SEInitializer_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
virtual ~SEInitializer_NssImpl();
/* XSEInitializer */
- virtual com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSecurityContext >
- SAL_CALL createSecurityContext( const rtl::OUString& certDB )
- throw (com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::crypto::XXMLSecurityContext >
+ SAL_CALL createSecurityContext( const ::rtl::OUString& )
+ throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL freeSecurityContext( const com::sun::star::uno::Reference<
com::sun::star::xml::crypto::XXMLSecurityContext >& securityContext )
@@ -78,27 +60,27 @@ public:
/* XServiceInfo */
virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
+ throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
+ throw (::com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
};
rtl::OUString SEInitializer_NssImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL SEInitializer_NssImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( com::sun::star::uno::Exception );
+com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL SEInitializer_NssImpl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
#endif
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 3fe691f4acda..61a52adf7735 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -41,11 +41,12 @@
#include "pk11func.h"
#include <sal/config.h>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
#include "x509certificate_nssimpl.hxx"
#include "certificateextension_xmlsecimpl.hxx"
+#include "sanextension_nssimpl.hxx"
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::security ;
@@ -120,13 +121,13 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
//Convert the time to readable local time
PR_ExplodeTime( notBefore, PR_LocalTimeParameters, &explTime ) ;
- dateTime.HundredthSeconds = explTime.tm_usec / 1000 ;
- dateTime.Seconds = explTime.tm_sec ;
- dateTime.Minutes = explTime.tm_min ;
- dateTime.Hours = explTime.tm_hour ;
- dateTime.Day = explTime.tm_mday ;
- dateTime.Month = explTime.tm_month+1 ;
- dateTime.Year = explTime.tm_year ;
+ dateTime.HundredthSeconds = static_cast< sal_Int16 >( explTime.tm_usec / 1000 );
+ dateTime.Seconds = static_cast< sal_Int16 >( explTime.tm_sec );
+ dateTime.Minutes = static_cast< sal_Int16 >( explTime.tm_min );
+ dateTime.Hours = static_cast< sal_Int16 >( explTime.tm_hour );
+ dateTime.Day = static_cast< sal_Int16 >( explTime.tm_mday );
+ dateTime.Month = static_cast< sal_Int16 >( explTime.tm_month+1 );
+ dateTime.Year = static_cast< sal_Int16 >( explTime.tm_year );
return dateTime ;
} else {
@@ -149,13 +150,13 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
//Convert the time to readable local time
PR_ExplodeTime( notAfter, PR_LocalTimeParameters, &explTime ) ;
- dateTime.HundredthSeconds = explTime.tm_usec / 1000 ;
- dateTime.Seconds = explTime.tm_sec ;
- dateTime.Minutes = explTime.tm_min ;
- dateTime.Hours = explTime.tm_hour ;
- dateTime.Day = explTime.tm_mday ;
- dateTime.Month = explTime.tm_month+1 ;
- dateTime.Year = explTime.tm_year ;
+ dateTime.HundredthSeconds = static_cast< sal_Int16 >( explTime.tm_usec / 1000 );
+ dateTime.Seconds = static_cast< sal_Int16 >( explTime.tm_sec );
+ dateTime.Minutes = static_cast< sal_Int16 >( explTime.tm_min );
+ dateTime.Hours = static_cast< sal_Int16 >( explTime.tm_hour );
+ dateTime.Day = static_cast< sal_Int16 >( explTime.tm_mday );
+ dateTime.Month = static_cast< sal_Int16 >( explTime.tm_month+1 );
+ dateTime.Year = static_cast< sal_Int16 >( explTime.tm_year );
return dateTime ;
} else {
@@ -198,12 +199,27 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
Sequence< Reference< XCertificateExtension > > xExtns( len ) ;
for( extns = m_pCert->extensions, len = 0; *extns != NULL; extns ++, len ++ ) {
- pExtn = new CertificateExtension_XmlSecImpl() ;
+ const SECItem id = (*extns)->id;
+ ::rtl::OString oidString(CERT_GetOidString(&id));
+
+ // remove "OID." prefix if existing
+ ::rtl::OString objID;
+ ::rtl::OString oid("OID.");
+ if (oidString.match(oid))
+ objID = oidString.copy(oid.getLength());
+ else
+ objID = oidString;
+
+ if ( objID.equals("2.5.29.17") )
+ pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ pExtn = new CertificateExtension_XmlSecImpl() ;
+
if( (*extns)->critical.data == NULL )
crit = sal_False ;
else
crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ;
- pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (*extns)->id.data, (*extns)->id.len, crit ) ;
+ pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objID.getStr(), objID.getLength(), crit ) ;
xExtns[len] = pExtn ;
}
@@ -227,7 +243,12 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
pExtn = NULL ;
for( extns = m_pCert->extensions; *extns != NULL; extns ++ ) {
if( SECITEM_CompareItem( &idItem, &(*extns)->id ) == SECEqual ) {
- pExtn = new CertificateExtension_XmlSecImpl() ;
+ const SECItem id = (*extns)->id;
+ ::rtl::OString objId(CERT_GetOidString(&id));
+ if ( objId.equals("OID.2.5.29.17") )
+ pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ pExtn = new CertificateExtension_XmlSecImpl() ;
if( (*extns)->critical.data == NULL )
crit = sal_False ;
else
@@ -304,17 +325,14 @@ sal_Int64 SAL_CALL X509Certificate_NssImpl :: getSomething( const Sequence< sal_
}
/* XUnoTunnel extension */
+
+namespace
+{
+ class theX509Certificate_NssImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theX509Certificate_NssImplUnoTunnelId > {};
+}
+
const Sequence< sal_Int8>& X509Certificate_NssImpl :: getUnoTunnelId() {
- static Sequence< sal_Int8 >* pSeq = 0 ;
- if( !pSeq ) {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if( !pSeq ) {
- static Sequence< sal_Int8> aSeq( 16 ) ;
- rtl_createUuid( ( sal_uInt8* )aSeq.getArray() , 0 , sal_True ) ;
- pSeq = &aSeq ;
- }
- }
- return *pSeq ;
+ return theX509Certificate_NssImplUnoTunnelId::get().getSeq();
}
/* XUnoTunnel extension */
diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
index 466652ab25bb..171c7bc365a3 100644
--- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
@@ -57,21 +57,41 @@ void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServ
void* pRet = 0;
Reference< XSingleServiceFactory > xFactory ;
- if( pImplName != NULL && pServiceManager != NULL ) {
- if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ if( pImplName != NULL && pServiceManager != NULL )
+ {
+#ifdef XMLSEC_CRYPTO_NSS
+ if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
+ xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
+ }
+ else if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLSignature_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLSecurityContext_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = SecurityEnvironment_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLEncryption_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+#else
+ if( ONSSInitializer_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
OUString::createFromAscii( pImplName ),
- SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
+ ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
}
+#endif
}
if( xFactory.is() ) {
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index 8a8a00b22d24..9463251d3c0b 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -46,7 +46,7 @@ namespace cssxcsax = com::sun::star::xml::csax;
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
+xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
{
rtl::OString ostr = rtl::OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
return xmlStrndup( ( xmlChar* )ostr.getStr(), ( int )ostr.getLength() ) ;
@@ -56,7 +56,7 @@ xmlChar* ous_to_xmlstr( const rtl::OUString& oustr )
* The return value is NULL terminated. The application has the responsibilty to
* deallocte the return value.
*/
-xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
+xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
{
rtl::OString ostr = rtl::OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
length = ostr.getLength();
@@ -68,16 +68,16 @@ xmlChar* ous_to_nxmlstr( const rtl::OUString& oustr, int& length )
* The return value and the referenced value must be NULL terminated.
* The application has the responsibilty to deallocte the return value.
*/
-const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
+const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
{
xmlChar* attname = NULL ;
xmlChar* attvalue = NULL ;
const xmlChar** attrs = NULL ;
rtl::OUString oustr ;
-
+
sal_Int32 nLength = aAttributes.getLength();;
- if( nLength != 0 )
+ if( nLength != 0 )
{
attrs = ( const xmlChar** )xmlMalloc( ( nLength * 2 + 2 ) * sizeof( xmlChar* ) ) ;
}
@@ -86,12 +86,12 @@ const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLAttribut
return NULL ;
}
- for( int i = 0 , j = 0 ; j < nLength ; ++j )
+ for( int i = 0 , j = 0 ; j < nLength ; ++j )
{
attname = ous_to_xmlstr( aAttributes[j].sName ) ;
attvalue = ous_to_xmlstr( aAttributes[j].sValue ) ;
- if( attname != NULL && attvalue != NULL )
+ if( attname != NULL && attvalue != NULL )
{
attrs[i++] = attname ;
attrs[i++] = attvalue ;
@@ -122,7 +122,7 @@ SAXHelper::SAXHelper( )
{
xmlInitParser() ;
LIBXML_TEST_VERSION ;
-
+
/*
* compile error:
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS ;
@@ -140,27 +140,27 @@ SAXHelper::SAXHelper( )
*
* mmi : re-initialize the SAX handler to version 1
*/
-
+
xmlSAXVersion(m_pParserCtxt->sax, 1);
/* end */
- if( m_pParserCtxt->inputTab[0] != NULL )
+ if( m_pParserCtxt->inputTab[0] != NULL )
{
m_pParserCtxt->inputTab[0] = NULL ;
}
-
- if( m_pParserCtxt == NULL )
+
+ if( m_pParserCtxt == NULL )
{
#ifndef XMLSEC_NO_XSLT
- xsltCleanupGlobals() ;
+ xsltCleanupGlobals() ;
#endif
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
throw cssu::RuntimeException() ;
}
- else if( m_pParserCtxt->sax == NULL )
+ else if( m_pParserCtxt->sax == NULL )
{
xmlFreeParserCtxt( m_pParserCtxt ) ;
@@ -168,8 +168,8 @@ SAXHelper::SAXHelper( )
xsltCleanupGlobals() ;
#endif
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
m_pParserCtxt = NULL ;
throw cssu::RuntimeException() ;
}
@@ -191,7 +191,7 @@ SAXHelper::SAXHelper( )
* destruct the xml tree.
*/
SAXHelper::~SAXHelper() {
- if( m_pParserCtxt != NULL )
+ if( m_pParserCtxt != NULL )
{
/*
* In the situation that no object refer the Document, this destructor
@@ -206,14 +206,14 @@ SAXHelper::~SAXHelper() {
m_pParserCtxt = NULL ;
}
- if( m_pSaxHandler != NULL )
+ if( m_pSaxHandler != NULL )
{
xmlFree( m_pSaxHandler ) ;
m_pSaxHandler = NULL ;
}
// see issue i74334, we cannot call xmlCleanupParser when libxml is still used
-// in other parts of the office.
-// xmlCleanupParser() ;
+// in other parts of the office.
+// xmlCleanupParser() ;
}
xmlNodePtr SAXHelper::getCurrentNode()
@@ -230,7 +230,7 @@ void SAXHelper::setCurrentNode(const xmlNodePtr pNode)
* node, in order to make compatibility.
*/
m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
- = m_pParserCtxt->node
+ = m_pParserCtxt->node
= pNode;
}
@@ -243,14 +243,14 @@ xmlDocPtr SAXHelper::getDocument()
* XDocumentHandler -- start an xml document
*/
void SAXHelper::startDocument( void )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
/*
* Adjust inputTab
*/
xmlParserInputPtr pInput = xmlNewInputStream( m_pParserCtxt ) ;
- if( m_pParserCtxt->inputTab != NULL && m_pParserCtxt->inputMax != 0 )
+ if( m_pParserCtxt->inputTab != NULL && m_pParserCtxt->inputMax != 0 )
{
m_pParserCtxt->inputTab[0] = pInput ;
m_pParserCtxt->input = pInput ;
@@ -258,7 +258,7 @@ void SAXHelper::startDocument( void )
m_pSaxHandler->startDocument( m_pParserCtxt ) ;
- if( m_pParserCtxt == NULL || m_pParserCtxt->myDoc == NULL )
+ if( m_pParserCtxt == NULL || m_pParserCtxt->myDoc == NULL )
{
throw cssu::RuntimeException() ;
}
@@ -267,8 +267,8 @@ void SAXHelper::startDocument( void )
/**
* XDocumentHandler -- end an xml document
*/
-void SAXHelper::endDocument( void )
- throw( cssxs::SAXException , cssu::RuntimeException )
+void SAXHelper::endDocument( void )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
m_pSaxHandler->endDocument( m_pParserCtxt ) ;
}
@@ -279,33 +279,33 @@ void SAXHelper::endDocument( void )
void SAXHelper::startElement(
const rtl::OUString& aName,
const cssu::Sequence< cssxcsax::XMLAttribute >& aAttributes )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* fullName = NULL ;
const xmlChar** attrs = NULL ;
fullName = ous_to_xmlstr( aName ) ;
attrs = attrlist_to_nxmlstr( aAttributes ) ;
-
+
if( fullName != NULL || attrs != NULL )
{
m_pSaxHandler->startElement( m_pParserCtxt , fullName , attrs ) ;
}
- if( fullName != NULL )
+ if( fullName != NULL )
{
xmlFree( ( xmlChar* )fullName ) ;
fullName = NULL ;
}
-
- if( attrs != NULL )
+
+ if( attrs != NULL )
{
- for( int i = 0 ; attrs[i] != NULL ; ++i )
+ for( int i = 0 ; attrs[i] != NULL ; ++i )
{
xmlFree( ( xmlChar* )attrs[i] ) ;
attrs[i] = NULL ;
}
-
+
xmlFree( ( void* ) attrs ) ;
attrs = NULL ;
}
@@ -315,14 +315,14 @@ void SAXHelper::startElement(
* XDocumentHandler -- end an xml element
*/
void SAXHelper::endElement( const rtl::OUString& aName )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
xmlChar* fullname = NULL ;
fullname = ous_to_xmlstr( aName ) ;
m_pSaxHandler->endElement( m_pParserCtxt , fullname ) ;
- if( fullname != NULL )
+ if( fullname != NULL )
{
xmlFree( ( xmlChar* )fullname ) ;
fullname = NULL ;
@@ -333,7 +333,7 @@ void SAXHelper::endElement( const rtl::OUString& aName )
* XDocumentHandler -- an xml element or cdata characters
*/
void SAXHelper::characters( const rtl::OUString& aChars )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* chars = NULL ;
int length = 0 ;
@@ -341,7 +341,7 @@ void SAXHelper::characters( const rtl::OUString& aChars )
chars = ous_to_nxmlstr( aChars, length ) ;
m_pSaxHandler->characters( m_pParserCtxt , chars , length ) ;
- if( chars != NULL )
+ if( chars != NULL )
{
xmlFree( ( xmlChar* )chars ) ;
}
@@ -350,8 +350,8 @@ void SAXHelper::characters( const rtl::OUString& aChars )
/**
* XDocumentHandler -- ignorable xml white space
*/
-void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
- throw( cssxs::SAXException , cssu::RuntimeException )
+void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
const xmlChar* chars = NULL ;
int length = 0 ;
@@ -359,7 +359,7 @@ void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
chars = ous_to_nxmlstr( aWhitespaces, length ) ;
m_pSaxHandler->ignorableWhitespace( m_pParserCtxt , chars , length ) ;
- if( chars != NULL )
+ if( chars != NULL )
{
xmlFree( ( xmlChar* )chars ) ;
}
@@ -371,7 +371,7 @@ void SAXHelper::ignorableWhitespace( const rtl::OUString& aWhitespaces )
void SAXHelper::processingInstruction(
const rtl::OUString& aTarget,
const rtl::OUString& aData )
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
xmlChar* target = NULL ;
xmlChar* data = NULL ;
@@ -381,13 +381,13 @@ void SAXHelper::processingInstruction(
m_pSaxHandler->processingInstruction( m_pParserCtxt , target , data ) ;
- if( target != NULL )
+ if( target != NULL )
{
xmlFree( ( xmlChar* )target ) ;
target = NULL ;
}
-
- if( data != NULL )
+
+ if( data != NULL )
{
xmlFree( ( xmlChar* )data ) ;
data = NULL ;
@@ -400,7 +400,7 @@ void SAXHelper::processingInstruction(
*/
void SAXHelper::setDocumentLocator(
const cssu::Reference< cssxs::XLocator > &)
- throw( cssxs::SAXException , cssu::RuntimeException )
+ throw( cssxs::SAXException , cssu::RuntimeException )
{
}
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
index 2b59be2dadff..d7d919920067 100644
--- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
+++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
@@ -94,9 +94,7 @@ Reference< XInterface > SerialNumberAdapterImpl_createInstance(
extern "C"
{
-#if defined( XMLSEC_CRYPTO_NSS )
extern void* nss_component_getFactory( const sal_Char*, void*, void* );
-#endif
#if defined( XMLSEC_CRYPTO_MSCRYPTO )
extern void* mscrypt_component_getFactory( const sal_Char*, void*, void* );
@@ -135,11 +133,9 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_
xFactory->acquire() ;
pRet = xFactory.get() ;
} else {
-#if defined( XMLSEC_CRYPTO_NSS )
pRet = nss_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
if( pRet != NULL )
return pRet ;
-#endif
#if defined( XMLSEC_CRYPTO_MSCRYPTO )
pRet = mscrypt_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
index 7061a98fa15f..f6c52e5ac22f 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
@@ -32,3 +32,4 @@ V 350113102213Z 101E unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/C
V 350113102601Z 101F unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x000\x00<\x00 \x00>\x00#\x00;\x00 \x00"\x00+\x00"
V 350113102847Z 1020 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x001\x00 \x00\\x00"\x00a\x00,\x00b\x00"\x00+\x00C\x00N\x00=\x00U\x00S\x00,\x00 \x00>\x00 \x00\\x00\\x00d\x00e\x00 \x00<
V 350113104059Z 1021 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x001\x004\x00 \x00"\x00,\x00m\x00i\x00d\x00d\x00l\x00e\x00 \x00q\x00u\x00o\x00t\x00e
+V 111108105139Z 1022 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=User 35
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem
new file mode 100644
index 000000000000..6902605756af
--- /dev/null
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
index c7781419a38b..b70608fe859d 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
@@ -1 +1 @@
-1022
+1023
diff --git a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
index 8bf98da50e74..9d98db508b63 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
+++ b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
@@ -178,13 +178,16 @@ authorityKeyIdentifier=keyid,issuer
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
-subjectAltName=dirName:dn_subjectAlt
-# Copy subject details
-# issuerAltName=issuer:copy
-
-
-[dn_subjectAlt]
-CN=User 14 Root 11
+subjectAltName=DNS:alt.openoffice.org,IP:192.168.7.1,IP:13::17,email:my@other.address,RID:1.2.3.4,otherName:1.2.3.4;UTF8:some other identifier,dirName:dir_sect,URI:http://my.url.here/
+# Copy subject details
+# issuerAltName=issuer:copy
+
+
+[dir_sect]
+C=DE
+O=OpenOffice.org
+OU=Development
+CN=User 32 Root 11
[ v3_req ]
diff --git a/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt
new file mode 100644
index 000000000000..0092d16c7a60
--- /dev/null
+++ b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk
index ff5a952fc2e4..de84faa27bcd 100644
--- a/xmlsecurity/util/makefile.mk
+++ b/xmlsecurity/util/makefile.mk
@@ -81,10 +81,10 @@ SHL2LIBS= \
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
SHL2LIBS += \
$(SLB)$/xs_mscrypt.lib
-.ELSE
+.ENDIF
+
SHL2LIBS += \
$(SLB)$/xs_nss.lib
-.ENDIF
.ENDIF
@@ -118,19 +118,22 @@ SHL2STDLIBS += $(MOZ_NSS_LIBS)
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
SHL2STDLIBS+= $(MSCRYPTOLIBS)
+# SHL2STDLIBS+= $(XMLSECLIB) $(LIBXML2LIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB)
+SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB)
.ELSE
SHL2STDLIBS+= $(NSSCRYPTOLIBS)
.ENDIF
+
SHL2IMPLIB = $(SHL2TARGET)
SHL2DEF = $(MISC)$/$(SHL2TARGET).def
DEF2NAME = $(SHL2TARGET)
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
DEF2EXPORTFILE = exports_xsmscrypt.dxp
-.ELSE
-DEF2EXPORTFILE = exports_xsnss.dxp
.ENDIF
+DEF2EXPORTFILE = exports_xsnss.dxp
+
SRSFILELIST= \
$(SRS)$/component.srs \
$(SRS)$/dialogs.srs
diff --git a/xmlsecurity/util/xsec_xmlsec.component b/xmlsecurity/util/xsec_xmlsec.component
index 9d8a1713f70c..01d69bb61b5d 100644
--- a/xmlsecurity/util/xsec_xmlsec.component
+++ b/xmlsecurity/util/xsec_xmlsec.component
@@ -32,6 +32,7 @@
<service name="com.sun.star.security.SerialNumberAdapter"/>
</implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl">
+ <service name="com.sun.star.xml.crypto.NSSInitializer"/>
<service name="com.sun.star.xml.crypto.SEInitializer"/>
</implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_NssImpl">
diff --git a/xmlsecurity/util/xsec_xmlsec.windows.component b/xmlsecurity/util/xsec_xmlsec.windows.component
index 43f193a0db31..cb877c20c6f4 100644
--- a/xmlsecurity/util/xsec_xmlsec.windows.component
+++ b/xmlsecurity/util/xsec_xmlsec.windows.component
@@ -31,6 +31,9 @@
<implementation name="com.sun.star.security.SerialNumberAdapter">
<service name="com.sun.star.security.SerialNumberAdapter"/>
</implementation>
+ <implementation name="com.sun.star.xml.security.bridge.xmlsec.NSSInitializer_NssImpl">
+ <service name="com.sun.star.xml.crypto.NSSInitializer"/>
+ </implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SEInitializer_MSCryptImpl">
<service name="com.sun.star.xml.crypto.SEInitializer"/>
</implementation>