diff --git a/.gitignore b/.gitignore index 6f17050..ed1a89b 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,12 @@ /libreoffice-filters-3.4.4.2.tar.bz2 /libreoffice-help-3.4.4.2.tar.bz2 /libreoffice-impress-3.4.4.2.tar.bz2 +/libreoffice-core-3.5.0.0.tar.bz2 +/libreoffice-binfilter-3.5.0.0.tar.bz2 +/a8b25a0bf696fd126a08319d88998492-libvisio-0.0.11.tar.bz2 +/e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 +/libreoffice-help-3.5.0.0.tar.bz2 +/7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz +/0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz +/libreoffice-translations-3.5.0.0.tar.bz2 +/libreoffice-multiliblauncher.sh diff --git a/0001-Related-fdo-37195-migrationoo3-not-registered.patch b/0001-Related-fdo-37195-migrationoo3-not-registered.patch deleted file mode 100644 index 2640b65..0000000 --- a/0001-Related-fdo-37195-migrationoo3-not-registered.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 5e4c9fb9bbf12b40afbefb30e8d71d6e046b5bd0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 26 Aug 2011 13:05:32 +0100 -Subject: [PATCH] Related: fdo#37195 migrationoo3 not registered - ---- - postprocess/packcomponents/makefile.mk | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - -diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk -index b5f50a0..c23da77 100644 ---- a/postprocess/packcomponents/makefile.mk -+++ b/postprocess/packcomponents/makefile.mk -@@ -126,6 +126,7 @@ - lwpfilter \ - mcnttype \ - migrationoo2 \ -+ migrationoo3 \ - mtfrenderer \ - msfilter \ - msworksfilter \ diff --git a/0001-Related-i58612-don-t-crash-anyway.patch b/0001-Related-i58612-don-t-crash-anyway.patch deleted file mode 100644 index 47c81b9..0000000 --- a/0001-Related-i58612-don-t-crash-anyway.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 3524727db0f3cfecf3a47046795c527808c10c3e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Thu, 23 Jun 2011 15:14:00 +0100 -Subject: [PATCH] Related: #i58612# don't crash anyway - ---- - sw/source/core/text/frmform.cxx | 11 ++++++----- - sw/source/core/text/inftxt.cxx | 3 ++- - sw/source/core/text/txtfly.cxx | 6 ++++-- - sw/source/core/text/txtfrm.cxx | 7 +++++-- - 4 files changed, 17 insertions(+), 10 deletions(-) - -diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx -index 6a4be32..6b3b9cc 100755 ---- a/sw/source/core/text/frmform.cxx -+++ b/sw/source/core/text/frmform.cxx -@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, - - if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() ) - { -- const SwLineLayout* pLine; -+ SwTxtFrm *pMaster = FindMaster(); -+ OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); -+ const SwLineLayout* pLine=NULL; -+ if (pMaster) - { -- SwTxtFrm *pMaster = FindMaster(); -- OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" ); - if( !pMaster->HasPara() ) - pMaster->GetFormatted(); - SwTxtSizeInfo aInf( pMaster ); -@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, - aMasterLine.Bottom(); - pLine = aMasterLine.GetCurr(); - } -- SwLinePortion* pRest = -- rLine.MakeRestPortion( pLine, GetOfst() ); -+ SwLinePortion* pRest = pLine ? -+ rLine.MakeRestPortion(pLine, GetOfst()) : NULL; - if( pRest ) - rInf.SetRest( pRest ); - else -diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx -index 570b3c6..a76d746 100644 ---- a/sw/source/core/text/inftxt.cxx -+++ b/sw/source/core/text/inftxt.cxx -@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init() - if ( GetTxtFrm()->IsFollow() ) - { - const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster(); -- const SwLinePortion* pTmpPara = pMaster->GetPara(); -+ OSL_ENSURE(pMaster, "pTxtFrm without Master"); -+ const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL; - - // there is a master for this follow and the master does not have - // any contents (especially it does not have a number portion) -diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx -index 2d21ece..fbff110 100644 ---- a/sw/source/core/text/txtfly.cxx -+++ b/sw/source/core/text/txtfly.cxx -@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const - const SwCntntFrm* SwTxtFly::_GetMaster() - { - pMaster = pCurrFrm; -- while( pMaster->IsFollow() ) -+ while( pMaster && pMaster->IsFollow() ) - pMaster = (SwCntntFrm*)pMaster->FindMaster(); - return pMaster; - } -@@ -1551,7 +1551,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList() - SwTwips SwTxtFly::CalcMinBottom() const - { - SwTwips nRet = 0; -- const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs(); -+ const SwCntntFrm *pLclMaster = GetMaster(); -+ OSL_ENSURE(pLclMaster, "SwTxtFly without master"); -+ const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL; - const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0; - if( nCount ) - { -diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx -index 6e5f764..9e4a237 100644 ---- a/sw/source/core/text/txtfrm.cxx -+++ b/sw/source/core/text/txtfrm.cxx -@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects() - } - } - -- if ( IsFollow() ) -+ if (IsFollow()) - { -- FindMaster()->HideAndShowObjects(); -+ SwTxtFrm *pMaster = FindMaster(); -+ OSL_ENSURE(pMaster, "SwTxtFrm without master"); -+ if (pMaster) -+ pMaster->HideAndShowObjects(); - } - } - --- -1.7.6.4 - diff --git a/0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch b/0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch deleted file mode 100644 index 937184d..0000000 --- a/0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 5613954b275de8de9e6852738a7bfd215252d134 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 7 Jun 2011 17:03:52 +0100 -Subject: [PATCH] Related: rhbz#652604 better survive exceptions thrown during - autorecover - ---- - framework/inc/services/autorecovery.hxx | 20 ++++++++++++++ - framework/source/services/autorecovery.cxx | 40 +++++++++++++++++++++------ - 2 files changed, 51 insertions(+), 9 deletions(-) - -diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx -index 636ad98..6c4207e 100644 ---- a/framework/inc/services/autorecovery.hxx -+++ b/framework/inc/services/autorecovery.hxx -@@ -861,6 +861,26 @@ class AutoRecovery : public css::lang::XTypeProvider - const ::rtl::OUString& sEventType, - AutoRecovery::TDocumentInfo* pInfo ); - -+ -+ class ListenerInformer -+ { -+ private: -+ AutoRecovery &m_rRecovery; -+ sal_Int32 m_eJob; -+ bool m_bStopped; -+ public: -+ ListenerInformer(AutoRecovery &rRecovery, sal_Int32 eJob) -+ : m_rRecovery(rRecovery), m_eJob(eJob), m_bStopped(false) -+ { -+ } -+ void start(); -+ void stop(); -+ ~ListenerInformer() -+ { -+ stop(); -+ } -+ }; -+ - //--------------------------------------- - - // TODO document me -diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx -index efe2f17..ec60d13 100644 ---- a/framework/source/services/autorecovery.cxx -+++ b/framework/source/services/autorecovery.cxx -@@ -576,6 +576,21 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& - implts_dispatch(aParams); - } - -+void AutoRecovery::ListenerInformer::start() -+{ -+ m_rRecovery.implts_informListener(m_eJob, -+ AutoRecovery::implst_createFeatureStateEvent(m_eJob, OPERATION_START, NULL)); -+} -+ -+void AutoRecovery::ListenerInformer::stop() -+{ -+ if (m_bStopped) -+ return; -+ m_rRecovery.implts_informListener(m_eJob, -+ AutoRecovery::implst_createFeatureStateEvent(m_eJob, OPERATION_STOP, NULL)); -+ m_bStopped = true; -+} -+ - //----------------------------------------------- - void AutoRecovery::implts_dispatch(const DispatchParams& aParams) - { -@@ -599,8 +614,8 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) - implts_stopTimer(); - implts_stopListening(); - -- implts_informListener(eJob, -- AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_START, NULL)); -+ ListenerInformer aListenerInformer(*this, eJob); -+ aListenerInformer.start(); - - try - { -@@ -676,13 +691,14 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) - ) - implts_cleanUpWorkingEntry(aParams); - } -- catch(const css::uno::RuntimeException& exRun) -- { throw exRun; } -+ catch(const css::uno::RuntimeException&) -+ { -+ throw; -+ } - catch(const css::uno::Exception&) - {} // TODO better error handling - -- implts_informListener(eJob, -- AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_STOP, NULL)); -+ aListenerInformer.stop(); - - // SAFE -> ---------------------------------- - aWriteLock.lock(); -@@ -1304,8 +1320,8 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn - xModify->insertByName(sID, css::uno::makeAny(xSet)); - } - } -- catch(const css::uno::RuntimeException& exRun) -- { throw exRun; } -+ catch(const css::uno::RuntimeException&) -+ { throw; } - catch(const css::uno::Exception&) - {} // ??? can it happen that a full disc let these set of operations fail too ??? - -@@ -1627,7 +1643,13 @@ IMPL_LINK(AutoRecovery, implts_asyncDispatch, void*, EMPTYARG) - aWriteLock.unlock(); - // <- SAFE - -- implts_dispatch(aParams); -+ try -+ { -+ implts_dispatch(aParams); -+ } -+ catch (...) -+ { -+ } - return 0; - } - --- -1.7.5.2 - diff --git a/0001-Related-rhbz-702833-addEventListener-without-removeE.patch b/0001-Related-rhbz-702833-addEventListener-without-removeE.patch deleted file mode 100644 index 6a192bb..0000000 --- a/0001-Related-rhbz-702833-addEventListener-without-removeE.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 6f42aa185adc436d976da04b8b193dfe25d61f7a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 17 Jun 2011 13:38:27 +0100 -Subject: [PATCH] Related: rhbz#702833 addEventListener without - removeEventListener - ---- - .../source/deployment/gui/dp_gui_extlistbox.cxx | 12 +++++++++++- - 1 files changed, 11 insertions(+), 1 deletions(-) - -diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx -index 8cdf0a6..3d0d426 100644 ---- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx -+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx -@@ -970,18 +970,20 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & - if ( ! pEntry->m_sTitle.Len() ) - return 0; - -- xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); -+ bool bNewEntryInserted = false; - - ::osl::ClearableMutexGuard guard(m_entriesMutex); - if ( m_vEntries.empty() ) - { - m_vEntries.push_back( pEntry ); -+ bNewEntryInserted = true; - } - else - { - if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) - { - m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); -+ bNewEntryInserted = true; - } - else if ( !m_bInCheckMode ) - { -@@ -989,6 +991,14 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & - } - } - -+ //Related: rhbz#702833 Only add a Listener if we're adding a new entry, to -+ //keep in sync with removeEventListener logic -+ if (bNewEntryInserted) -+ { -+ pEntry->m_xPackage->addEventListener(uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); -+ } -+ -+ - pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); - pEntry->m_bUser = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER ); - pEntry->m_bShared = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ); --- -1.7.5.4 - diff --git a/0001-Related-rhbz-711087-band-aid.patch b/0001-Related-rhbz-711087-band-aid.patch deleted file mode 100644 index 384115e..0000000 --- a/0001-Related-rhbz-711087-band-aid.patch +++ /dev/null @@ -1,26 +0,0 @@ -From fe44d66adbab17b804a27d91148490b23fce75da Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 17 Jun 2011 16:14:12 +0100 -Subject: [PATCH] Related: rhbz#711087 band-aid - ---- - sc/source/ui/undo/undoblk.cxx | 3 +++ - 1 files changed, 3 insertions(+), 0 deletions(-) - -diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx -index 8439801..d535c9c 100644 ---- a/sc/source/ui/undo/undoblk.cxx -+++ b/sc/source/ui/undo/undoblk.cxx -@@ -2084,6 +2084,9 @@ void ScUndoRemoveMerge::Undo() - for (set::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end(); - itr != itrEnd; ++itr) - { -+ OSL_ENSURE(pUndoDoc, "NULL pUndoDoc!"); -+ if (!pUndoDoc) -+ continue; - // There is no need to extend merge area because it's already been extended. - ScRange aRange = maOption.getSingleRange(*itr); - pDoc->DeleteAreaTab(aRange, IDF_ATTRIB); --- -1.7.5.4 - diff --git a/0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch b/0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch deleted file mode 100644 index 86591c3..0000000 --- a/0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 04a5edc0b8a6399e0e692b4164dc72851fffcab9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 5 Jul 2011 12:41:43 +0100 -Subject: [PATCH] Related: rhbz#718976 crash in SwTxtSizeInfo::GetMultiCreator - ---- - sw/source/core/text/pormulti.cxx | 7 +++++-- - 1 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx -index 1a31cf4..336a57d 100644 ---- a/sw/source/core/text/pormulti.cxx -+++ b/sw/source/core/text/pormulti.cxx -@@ -947,15 +947,18 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, - else - pRotItem = NULL; - const SvxTwoLinesItem* p2Lines = NULL; -+ const SwTxtNode *pLclTxtNode = pFrm->GetTxtNode(); -+ if( !pLclTxtNode ) -+ return NULL; - const SfxPoolItem* pItem; -- if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet(). -+ if( SFX_ITEM_SET == pLclTxtNode->GetSwAttrSet(). - GetItemState( RES_CHRATR_TWO_LINES, sal_True, &pItem ) && - ((SvxTwoLinesItem*)pItem)->GetValue() ) - p2Lines = (SvxTwoLinesItem*)pItem; - else - pItem = NULL; - -- const SwpHints *pHints = pFrm->GetTxtNode()->GetpSwpHints(); -+ const SwpHints *pHints = pLclTxtNode->GetpSwpHints(); - if( !pHints && !p2Lines && !pRotate ) - return NULL; - const SwTxtAttr *pRuby = NULL; --- -1.7.5.4 - diff --git a/0001-Related-rhbz-730225-avoid-segv-in-ld-this-was-set-to.patch b/0001-Related-rhbz-730225-avoid-segv-in-ld-this-was-set-to.patch deleted file mode 100644 index 6abf3f7..0000000 --- a/0001-Related-rhbz-730225-avoid-segv-in-ld-this-was-set-to.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 761d4c5487570b9c1b37ac4ea13d86fcdb244f65 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 12 Aug 2011 09:44:45 +0100 -Subject: [PATCH] Related: rhbz#730225 avoid segv in ld, this was set to -O0 - around 2000 - ---- - sd/Library_sdfilt.mk | 12 +----------- - 1 files changed, 1 insertions(+), 11 deletions(-) - -diff --git a/sd/source/filter/eppt/makefile.mk b/sd/source/filter/eppt/makefile.mk -index 2a91103..7871436 100644 ---- a/sd/source/filter/eppt/makefile.mk -+++ b/sd/source/filter/eppt/makefile.mk -@@ -37,10 +37,6 @@ VISIBILITY_HIDDEN=TRUE - - # --- Files -------------------------------------------------------- - --.IF "$(COM)"=="GCC" --NOOPTFILES= $(SLO)$/epptso.obj --.ENDIF -- - SLOFILES = $(SLO)$/eppt.obj \ - $(SLO)$/epptso.obj \ - $(SLO)$/escherex.obj \ diff --git a/0001-Related-rhbz-753201-fedora-ant-java-1.5.0-gcj-won-t-.patch b/0001-Related-rhbz-753201-fedora-ant-java-1.5.0-gcj-won-t-.patch deleted file mode 100644 index a3ed7c4..0000000 --- a/0001-Related-rhbz-753201-fedora-ant-java-1.5.0-gcj-won-t-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From fd567018ec52a53b00b5da7782b3100177b2c028 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 11 Nov 2011 15:45:58 +0000 -Subject: [PATCH] Related: rhbz#753201 fedora ant+java-1.5.0-gcj won't resolve - env variables - ---- - rhino/makefile.mk | 4 ++-- - rhino/rhino1_5R5-find_swing.patch | 5 ++--- - 2 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/rhino/makefile.mk b/rhino/makefile.mk -index 91117d9..577d030 100644 ---- a/rhino/makefile.mk -+++ b/rhino/makefile.mk -@@ -58,9 +58,9 @@ FIXED_TARFILE_LOCATION=$(TARFILE_LOCATION) - .IF "$(JAVACISGCJ)"=="yes" - JAVA_HOME= - .EXPORT : JAVA_HOME --BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj jar -+BUILD_ACTION=$(ANT) -DTARFILE_LOCATION="$(FIXED_TARFILE_LOCATION)" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj jar - .ELSE --BUILD_ACTION=TARFILE_LOCATION="$(FIXED_TARFILE_LOCATION)" $(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar -+BUILD_ACTION=$(ANT) -DTARFILE_LOCATION="$(FIXED_TARFILE_LOCATION)" -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar - .ENDIF - - # --- Targets ------------------------------------------------------ -diff --git a/rhino/rhino1_5R5-find_swing.patch b/rhino/rhino1_5R5-find_swing.patch -index 220c4f4..f074fa8 100644 ---- a/rhino/rhino1_5R5-find_swing.patch -+++ b/rhino/rhino1_5R5-find_swing.patch -@@ -1,11 +1,10 @@ - --- misc/rhino1_5R5/toolsrc/build.xml 2009-10-29 18:29:46.605524507 +0100 - +++ misc/build/rhino1_5R5/toolsrc/build.xml 2009-10-29 18:29:26.536908810 +0100 --@@ -12,6 +12,8 @@ -+@@ -12,6 +12,7 @@ - - - --+ --+ -++ - - - --- -1.7.6.4 - diff --git a/0001-Resolves-fdo-32665-handle-that-FreeSerif-lacks-some-.patch b/0001-Resolves-fdo-32665-handle-that-FreeSerif-lacks-some-.patch deleted file mode 100644 index 58a10d7..0000000 --- a/0001-Resolves-fdo-32665-handle-that-FreeSerif-lacks-some-.patch +++ /dev/null @@ -1,311 +0,0 @@ -From 58b48f188bbfd9a3382460d6de63848eb3db416d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Thu, 27 Oct 2011 12:24:11 +0100 -Subject: [PATCH] Resolves: fdo#32665 handle that FreeSerif lacks some glyphs - in bold/italic - -FreeSerif lacks glyphs in bold/italic variants that it has in the normal one. A -lot of our glyph fallback infrastructure, especially the caches don't expect -that a normal variant of a font with extra emboldening or extra font skew can -be a fallback for a bold/italic variant of itself which exists, but doesn't -have the missing glyphs that the normal one does. - -We really need to improve our glyph/font caching, but we can get 90% of the -way there by excluding such cases from the caches. ---- - vcl/generic/fontmanager/fontconfig.cxx | 18 ++++++++- - vcl/generic/fontmanager/fontsubst.cxx | 6 +++- - vcl/generic/glyphs/glyphcache.cxx | 7 ++++ - vcl/inc/outfont.hxx | 19 ++++++++++ - vcl/inc/vcl/fontmanager.hxx | 3 +- - vcl/source/gdi/outdev3.cxx | 60 ++++++++++++++++++++++---------- - 6 files changed, 90 insertions(+), 23 deletions(-) - -diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx -index be91349..a4f5f7f 100644 ---- a/vcl/unx/source/fontmanager/fontconfig.cxx -+++ b/vcl/unx/source/fontmanager/fontconfig.cxx -@@ -68,6 +68,9 @@ - #ifndef FC_EMBOLDEN - #define FC_EMBOLDEN "embolden" - #endif -+ #ifndef FC_MATRIX -+ #define FC_MATRIX "matrix" -+ #endif - #ifndef FC_FONTFORMAT - #define FC_FONTFORMAT "fontformat" - #endif -@@ -145,6 +148,7 @@ - FcResult (*m_pFcPatternGetString)(const FcPattern*,const char*,int,FcChar8**); - FcResult (*m_pFcPatternGetInteger)(const FcPattern*,const char*,int,int*); - FcResult (*m_pFcPatternGetDouble)(const FcPattern*,const char*,int,double*); -+ FcResult (*m_pFcPatternGetMatrix)(const FcPattern*,const char*,int,FcMatrix**); - FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*); - void (*m_pFcDefaultSubstitute)(FcPattern *); - FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); -@@ -255,6 +259,9 @@ - FcResult FcPatternGetDouble( const FcPattern* pPattern, const char* object, int n, double* s ) - { return m_pFcPatternGetDouble( pPattern, object, n, s ); } - -+ FcResult FcPatternGetMatrix( const FcPattern* pPattern, const char* object, int n, FcMatrix** s ) -+ { return m_pFcPatternGetMatrix( pPattern, object, n, s ); } -+ - FcResult FcPatternGetBool( const FcPattern* pPattern, const char* object, int n, FcBool* s ) - { return m_pFcPatternGetBool( pPattern, object, n, s ); } - FcBool FcConfigAppFontAddFile( FcConfig* pConfig, const FcChar8* pFileName ) -@@ -381,6 +388,8 @@ - loadSymbol( "FcPatternGetInteger" ); - m_pFcPatternGetDouble = (FcResult(*)(const FcPattern*,const char*,int,double*)) - loadSymbol( "FcPatternGetDouble" ); -+ m_pFcPatternGetMatrix = (FcResult(*)(const FcPattern*,const char*,int,FcMatrix**)) -+ loadSymbol( "FcPatternGetMatrix" ); - m_pFcPatternGetBool = (FcResult(*)(const FcPattern*,const char*,int,FcBool*)) - loadSymbol( "FcPatternGetBool" ); - m_pFcConfigAppFontAddFile = (FcBool(*)(FcConfig*, const FcChar8*)) -@@ -453,6 +462,7 @@ - m_pFcPatternGetString && - m_pFcPatternGetInteger && - m_pFcPatternGetDouble && -+ m_pFcPatternGetMatrix && - m_pFcPatternGetBool && - m_pFcConfigAppFontAddFile && - m_pFcConfigAppFontAddDir && -@@ -1260,7 +1270,7 @@ - rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, - rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, - italic::type &rItalic, weight::type &rWeight, -- width::type &rWidth, pitch::type &rPitch) const -+ width::type &rWidth, pitch::type &rPitch, bool &rEmbolden, ItalicMatrix &rMatrix) const - { - rtl::OUString aName; - FontCfgWrapper& rWrapper = FontCfgWrapper::get(); -@@ -1353,6 +1363,17 @@ - rPitch = convertSpacing(val); - if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val)) - rWidth = convertWidth(val); -+ FcBool bEmbolden; -+ if (FcResultMatch == rWrapper.FcPatternGetBool(pSet->fonts[0], FC_EMBOLDEN, 0, &bEmbolden)) -+ rEmbolden = bEmbolden; -+ FcMatrix *pMatrix = 0; -+ if (FcResultMatch == rWrapper.FcPatternGetMatrix(pSet->fonts[0], FC_MATRIX, 0, &pMatrix)) -+ { -+ rMatrix.xx = pMatrix->xx; -+ rMatrix.xy = pMatrix->xy; -+ rMatrix.yx = pMatrix->yx; -+ rMatrix.yy = pMatrix->yy; -+ } - } - - // update rMissingCodes by removing resolved unicodes -diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx -index 3bf2d07..2d187b1 100644 ---- a/vcl/unx/source/gdi/salgdi3.cxx -+++ b/vcl/unx/source/gdi/salgdi3.cxx -@@ -1526,8 +1526,14 @@ - } - } - -+ bool bEmbolden = rFontSelData.mbEmbolden; -+ ItalicMatrix aMatrix = rFontSelData.maItalicMatrix; -+ - const psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); -- aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch); -+ aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch, bEmbolden, aMatrix ); -+ -+ aRet.maItalicMatrix = aMatrix; -+ aRet.mbEmbolden = bEmbolden; - - switch (eItalic) - { -diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx -index 5322b65..fa712bb 100644 ---- a/vcl/source/glyphs/glyphcache.cxx -+++ b/vcl/source/glyphs/glyphcache.cxx -@@ -163,6 +163,13 @@ bool GlyphCache::IFSD_Equal::operator()( const ImplFontSelectData& rA, const Imp - != STRING_NOTFOUND) && rA.maTargetName != rB.maTargetName) - return false; - #endif -+ -+ if (rA.mbEmbolden != rB.mbEmbolden) -+ return false; -+ -+ if (rA.maItalicMatrix != rB.maItalicMatrix) -+ return false; -+ - return true; - } - -diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx -index faf2b00..857d944 100644 ---- a/vcl/inc/vcl/outfont.hxx -+++ b/vcl/inc/vcl/outfont.hxx -@@ -175,6 +191,9 @@ public: // TODO: change to private - bool mbVertical; // vertical mode of requested font - bool mbNonAntialiased; // true if antialiasing is disabled - -+ bool mbEmbolden; // Force emboldening -+ ItalicMatrix maItalicMatrix; // Force matrix for slant -+ - const ImplFontData* mpFontData; // a matching ImplFontData object - ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry - }; -diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx -index 0af5e14..4a110ad 100644 ---- a/vcl/inc/vcl/fontmanager.hxx -+++ b/vcl/inc/vcl/fontmanager.hxx -@@ -36,6 +36,7 @@ - - #include "vcl/dllapi.h" - #include "vcl/helper.hxx" -+#include "vcl/vclenum.hxx" - - #include "com/sun/star/lang/Locale.hpp" - -@@ -737,7 +738,7 @@ - - rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, - const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight, -- width::type& rWidth, pitch::type& rPitch) const; -+ width::type& rWidth, pitch::type& rPitch, bool &rEmboldening, ItalicMatrix &rMatrix) const; - bool hasFontconfig() const { return m_bFontconfigSuccess; } - - int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ); -diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx -index b0f59cd..3cc438c 100755 ---- a/vcl/source/gdi/outdev3.cxx -+++ b/vcl/source/gdi/outdev3.cxx -@@ -865,9 +865,11 @@ bool ImplFontData::IsBetterMatch( const ImplFontSelectData& rFSD, FontMatchStatu - - if( rFSD.meWeight != WEIGHT_DONTKNOW ) - { -- // if not bold prefer light fonts to bold fonts -- int nReqWeight = (int)rFSD.meWeight; -- if ( rFSD.meWeight > WEIGHT_MEDIUM ) -+ // if not bold or requiring emboldening prefer light fonts to bold fonts -+ FontWeight ePatternWeight = rFSD.mbEmbolden ? WEIGHT_NORMAL : rFSD.meWeight; -+ -+ int nReqWeight = (int)ePatternWeight; -+ if ( ePatternWeight > WEIGHT_MEDIUM ) - nReqWeight += 100; - - int nGivenWeight = (int)meWeight; -@@ -897,14 +899,17 @@ bool ImplFontData::IsBetterMatch( const ImplFontSelectData& rFSD, FontMatchStatu - nMatch += 150; - } - -- if ( rFSD.meItalic == ITALIC_NONE ) -+ // if requiring custom matrix to fake italic, prefer upright font -+ FontItalic ePatternItalic = rFSD.maItalicMatrix != ItalicMatrix() ? ITALIC_NONE : rFSD.meItalic; -+ -+ if ( ePatternItalic == ITALIC_NONE ) - { - if( meItalic == ITALIC_NONE ) - nMatch += 900; - } - else - { -- if( rFSD.meItalic == meItalic ) -+ if( ePatternItalic == meItalic ) - nMatch += 900; - else if( meItalic != ITALIC_NONE ) - nMatch += 600; -@@ -1457,22 +1462,31 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( ImplFontSelectData& - else - rFontSelData.maSearchName = String(); - -- // cache the result even if there was no match -- for(;;) -- { -- if( !rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &rFontSelData.maSearchName ) ) -- rFontSelData.mpFontEntry->AddFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName ); -- if( nStrIndex >= aOldMissingCodes.getLength() ) -- break; -- cChar = aOldMissingCodes.iterateCodePoints( &nStrIndex ); -- } -- if( rFontSelData.maSearchName.Len() != 0 ) -+ //See fdo#32665 for an example. FreeSerif that has glyphs in normal -+ //font, but not in the italic or bold version -+ bool bSubSetOfFontRequiresPropertyFaking = rFontSelData.mbEmbolden || rFontSelData.maItalicMatrix != ItalicMatrix(); -+ -+ // cache the result even if there was no match, unless its from part of a font for which the properties need -+ // to be faked. We need to rework this cache to take into account that fontconfig can return different fonts -+ // for different input sizes, weights, etc. Basically the cache is way to naive -+ if (!bSubSetOfFontRequiresPropertyFaking) - { -- // remove cache entries that were still not resolved -- for( nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) -+ for(;;) - { -- cChar = rMissingCodes.iterateCodePoints( &nStrIndex ); -- rFontSelData.mpFontEntry->IgnoreFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName ); -+ if( !rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &rFontSelData.maSearchName ) ) -+ rFontSelData.mpFontEntry->AddFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName ); -+ if( nStrIndex >= aOldMissingCodes.getLength() ) -+ break; -+ cChar = aOldMissingCodes.iterateCodePoints( &nStrIndex ); -+ } -+ if( rFontSelData.maSearchName.Len() != 0 ) -+ { -+ // remove cache entries that were still not resolved -+ for( nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); ) -+ { -+ cChar = rMissingCodes.iterateCodePoints( &nStrIndex ); -+ rFontSelData.mpFontEntry->IgnoreFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName ); -+ } - } - } - } -@@ -2180,6 +2194,7 @@ ImplFontSelectData::ImplFontSelectData( const Font& rFont, - meLanguage( rFont.GetLanguage() ), - mbVertical( rFont.IsVertical() ), - mbNonAntialiased( false ), -+ mbEmbolden( false ), - mpFontData( NULL ), - mpFontEntry( NULL ) - { -@@ -2215,6 +2230,7 @@ ImplFontSelectData::ImplFontSelectData( const ImplFontData& rFontData, - meLanguage( 0 ), - mbVertical( bVertical ), - mbNonAntialiased( false ), -+ mbEmbolden( false ), - mpFontData( &rFontData ), - mpFontEntry( NULL ) - { -@@ -2297,6 +2313,12 @@ bool ImplFontCache::IFSD_Equal::operator()(const ImplFontSelectData& rA, const I - return false; - #endif - -+ if (rA.mbEmbolden != rB.mbEmbolden) -+ return false; -+ -+ if (rA.maItalicMatrix != rB.maItalicMatrix) -+ return false; -+ - return true; - } - ---- a/vcl/inc/vcl/vclenum.hxx 2011-10-27 15:10:10.402317337 +0100 -+++ b/vcl/inc/vcl/vclenum.hxx 2011-10-27 15:10:29.561528762 +0100 -@@ -326,6 +326,22 @@ - - #endif - -+struct ItalicMatrix -+{ -+ double xx, xy, yx, yy; -+ ItalicMatrix() : xx(1), xy(0), yx(0), yy(1) {} -+}; -+ -+inline bool operator ==(const ItalicMatrix& a, const ItalicMatrix& b) -+{ -+ return a.xx == b.xx && a.xy == b.xy && a.yx == b.yx && a.yy == b.yy; -+} -+ -+inline bool operator !=(const ItalicMatrix& a, const ItalicMatrix& b) -+{ -+ return a.xx != b.xx || a.xy != b.xy || a.yx != b.yx || a.yy != b.yy; -+} -+ - #endif // _VCL_VCLENUM_HXX - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/0001-Resolves-rhbz-693265-fix-crash-from-unhandled-except.patch b/0001-Resolves-rhbz-693265-fix-crash-from-unhandled-except.patch deleted file mode 100644 index 5ac6ea7..0000000 --- a/0001-Resolves-rhbz-693265-fix-crash-from-unhandled-except.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0da2906aa147050c3e99846d5908a60b99df69ba Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 2 Aug 2011 16:56:30 +0100 -Subject: [PATCH] Resolves: rhbz#693265 fix crash from unhandled exception - ---- - vcl/source/gdi/impgraph.cxx | 28 ++++++++++++++++++++++++---- - 1 files changed, 24 insertions(+), 4 deletions(-) - -diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx -index 3b6d9a4..6fdb163 100644 ---- a/vcl/source/gdi/impgraph.cxx -+++ b/vcl/source/gdi/impgraph.cxx -@@ -1077,7 +1077,14 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap ) - - if( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) - { -- SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -+ SvStream* pOStm = NULL; -+ try -+ { -+ pOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -+ } -+ catch( const ::com::sun::star::uno::Exception& ) -+ { -+ } - - if( pOStm ) - { -@@ -1282,8 +1289,14 @@ sal_Bool ImpGraphic::ImplSwapOut() - - if( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) - { -- SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -- -+ SvStream* pOStm = NULL; -+ try -+ { -+ pOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -+ } -+ catch( const ::com::sun::star::uno::Exception& ) -+ { -+ } - if( pOStm ) - { - pOStm->SetVersion( SOFFICE_FILEFORMAT_50 ); -@@ -1382,7 +1395,14 @@ sal_Bool ImpGraphic::ImplSwapIn() - - if( aSwapURL.Len() ) - { -- SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aSwapURL, STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -+ SvStream* pIStm = NULL; -+ try -+ { -+ pIStm = ::utl::UcbStreamHelper::CreateStream( aSwapURL, STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); -+ } -+ catch( const ::com::sun::star::uno::Exception& ) -+ { -+ } - - if( pIStm ) - { --- -1.7.6 - diff --git a/0001-Resolves-rhbz-695509-crash-in-RefreshDocumentLB.patch b/0001-Resolves-rhbz-695509-crash-in-RefreshDocumentLB.patch deleted file mode 100644 index c6fb27a..0000000 --- a/0001-Resolves-rhbz-695509-crash-in-RefreshDocumentLB.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5cc73f49400f9719ffd5382e64931de6eb8f130c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Sun, 17 Apr 2011 22:57:40 +0100 -Subject: [PATCH] Resolves: rhbz#695509 crash in RefreshDocumentLB - ---- - sd/source/ui/dlg/navigatr.cxx | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - -diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx -index 09426b8..edee709 100644 ---- a/sd/source/ui/dlg/navigatr.cxx -+++ b/sd/source/ui/dlg/navigatr.cxx -@@ -713,7 +713,8 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName ) - NavDocInfo* pInfo = new NavDocInfo(); - pInfo->mpDocShell = pDocShell; - -- aStr = pDocShell->GetMedium()->GetName(); -+ SfxMedium *pMedium = pDocShell->GetMedium(); -+ aStr = pMedium ? pMedium->GetName() : String(); - if( aStr.Len() ) - pInfo->SetName(); - else --- -1.7.4.2 - diff --git a/0001-Resolves-rhbz-713154-pdf-export-dialog-too-tall-to-f.patch b/0001-Resolves-rhbz-713154-pdf-export-dialog-too-tall-to-f.patch deleted file mode 100644 index 3b9c943..0000000 --- a/0001-Resolves-rhbz-713154-pdf-export-dialog-too-tall-to-f.patch +++ /dev/null @@ -1,511 +0,0 @@ -From e7493d7aa73cfaab2e2f81b7fb6a71e2af77fcc2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Thu, 16 Jun 2011 12:41:45 +0100 -Subject: [PATCH] Resolves: rhbz#713154 pdf export dialog too tall to fit on - netbooks - ---- - filter/source/pdf/impdialog.cxx | 8 +++ - filter/source/pdf/impdialog.hrc | 5 ++ - filter/source/pdf/impdialog.hxx | 8 +++ - filter/source/pdf/impdialog.src | 119 ++++++++++++++++++++++++--------------- - 4 files changed, 94 insertions(+), 46 deletions(-) - -diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx -index c8d5049..54ec9b3 100644 ---- a/filter/source/pdf/impdialog.cxx -+++ b/filter/source/pdf/impdialog.cxx -@@ -434,6 +434,8 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, - maCbReduceImageResolution( this, PDFFilterResId( CB_REDUCEIMAGERESOLUTION ) ), - maCoReduceImageResolution( this, PDFFilterResId( CO_REDUCEIMAGERESOLUTION ) ), - -+ m_aVerticalLine(this, PDFFilterResId(FL_GENERAL_VERTICAL)), -+ - maFlGeneral( this, PDFFilterResId( FL_GENERAL ) ), - maCbPDFA1b( this, PDFFilterResId( CB_PDFA_1B_SELECT ) ), - -@@ -791,6 +793,8 @@ ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window* pParent, - maRbMagnZoom( this, PDFFilterResId( RB_MAGNF_ZOOM ) ), - maNumZoom( this, PDFFilterResId( NUM_MAGNF_ZOOM ) ), - -+ m_aVerticalLine(this, PDFFilterResId(FL_INITVIEW_VERTICAL)), -+ - maFlPageLayout( this, PDFFilterResId( FL_PAGE_LAYOUT ) ), - maRbPgLyDefault( this, PDFFilterResId( RB_PGLY_DEFAULT ) ), - maRbPgLySinglePage( this, PDFFilterResId( RB_PGLY_SINGPG ) ), -@@ -955,6 +959,8 @@ ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window* pParent, - maCbOpenFullScreen( this, PDFFilterResId( CB_WNDOPT_OPNFULL ) ), - maCbDispDocTitle( this, PDFFilterResId( CB_DISPDOCTITLE ) ), - -+ m_aVerticalLine(this, PDFFilterResId(FL_VPREFER_VERTICAL)), -+ - maFlUIOptions( this, PDFFilterResId( FL_USRIFOPT ) ), - maCbHideViewerMenubar( this, PDFFilterResId( CB_UOP_HIDEVMENUBAR ) ), - maCbHideViewerToolbar( this, PDFFilterResId( CB_UOP_HIDEVTOOLBAR ) ), -@@ -1053,6 +1059,8 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, - maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET ) ), - maOwnerPwdPdfa( PDFFilterResId( STR_OWNER_PWD_PDFA ) ), - -+ m_aVerticalLine(this, PDFFilterResId(FL_SECURITY_VERTICAL)), -+ - maFlPrintPermissions( this, PDFFilterResId( FL_PRINT_PERMISSIONS ) ), - maRbPrintNone( this, PDFFilterResId( RB_PRINT_NONE ) ), - maRbPrintLowRes( this, PDFFilterResId( RB_PRINT_LOWRES ) ), -diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc -index 75708d1..61f2d14 100644 ---- a/filter/source/pdf/impdialog.hrc -+++ b/filter/source/pdf/impdialog.hrc -@@ -188,3 +188,8 @@ - #define CB_CNV_OOO_DOCTOPDF 155 - #define CB_EXP_BMRK_TO_DEST 156 - //<--- -+ -+#define FL_GENERAL_VERTICAL 157 -+#define FL_INITVIEW_VERTICAL 158 -+#define FL_VPREFER_VERTICAL 158 -+#define FL_SECURITY_VERTICAL 160 -diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx -index bc2cd3e..a784973 100644 ---- a/filter/source/pdf/impdialog.hxx -+++ b/filter/source/pdf/impdialog.hxx -@@ -190,6 +190,8 @@ class ImpPDFTabGeneralPage : public SfxTabPage - CheckBox maCbReduceImageResolution; - ComboBox maCoReduceImageResolution; - -+ FixedLine m_aVerticalLine; -+ - FixedLine maFlGeneral; - CheckBox maCbPDFA1b; - CheckBox maCbTaggedPDF; -@@ -254,6 +256,8 @@ class ImpPDFTabOpnFtrPage : public SfxTabPage - RadioButton maRbMagnZoom; - MetricField maNumZoom; - -+ FixedLine m_aVerticalLine; -+ - FixedLine maFlPageLayout; - RadioButton maRbPgLyDefault; - RadioButton maRbPgLySinglePage; -@@ -287,6 +291,8 @@ class ImpPDFTabViewerPage : public SfxTabPage - CheckBox maCbOpenFullScreen; - CheckBox maCbDispDocTitle; - -+ FixedLine m_aVerticalLine; -+ - FixedLine maFlUIOptions; - CheckBox maCbHideViewerMenubar; - CheckBox maCbHideViewerToolbar; -@@ -330,6 +336,8 @@ class ImpPDFTabSecurityPage : public SfxTabPage - String maOwnerPwdUnset; - String maOwnerPwdPdfa; - -+ FixedLine m_aVerticalLine; -+ - FixedLine maFlPrintPermissions; - RadioButton maRbPrintNone; - RadioButton maRbPrintLowRes; -diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src -index 531d728..1779b5f 100644 ---- a/filter/source/pdf/impdialog.src -+++ b/filter/source/pdf/impdialog.src -@@ -27,7 +27,7 @@ - - #include "impdialog.hrc" - --#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 268 ) -+#define TAB_PDF_SIZE Size = MAP_APPFONT ( 352, 155 ) - //string for TabDialog standard buttons - String STR_PDF_EXPORT - { -@@ -153,16 +153,24 @@ - "1200 DPI" ; - }; - }; -+ -+ FixedLine FL_GENERAL_VERTICAL -+ { -+ Pos = MAP_APPFONT ( 175 , 3 ) ; -+ Size = MAP_APPFONT ( 4 , 150 ) ; -+ Vert = TRUE; -+ }; -+ - FixedLine FL_GENERAL - { -- Pos = MAP_APPFONT ( 6 , 117 ) ; -+ Pos = MAP_APPFONT ( 182 , 3 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text[ en-US ] = "General"; - }; - CheckBox CB_PDFA_1B_SELECT - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_PDFA_1B_SELECT"; -- Pos = MAP_APPFONT ( 12, 128 ) ; -+ Pos = MAP_APPFONT ( 188, 14 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "P~DF/A-1a"; -@@ -170,7 +178,7 @@ - CheckBox CB_TAGGEDPDF - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_TAGGEDPDF"; -- Pos = MAP_APPFONT ( 12 , 141 ) ; -+ Pos = MAP_APPFONT ( 188 , 27 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "~Tagged PDF"; -@@ -178,14 +186,14 @@ - CheckBox CB_EXPORTFORMFIELDS - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTFORMFIELDS"; -- Pos = MAP_APPFONT ( 12 , 154 ) ; -+ Pos = MAP_APPFONT ( 188 , 40 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "~Create PDF form"; - }; - FixedText FT_FORMSFORMAT - { -- Pos = MAP_APPFONT ( 30 , 168 ) ; -+ Pos = MAP_APPFONT ( 206 , 54 ) ; - Size = MAP_APPFONT ( 93, 8 ) ; - Text[ en-US ] = "Submit ~format"; - }; -@@ -193,7 +201,7 @@ - { - HelpID = "filter:ListBox:RID_PDF_TAB_GENER:LB_FORMSFORMAT"; - Border = TRUE ; -- Pos = MAP_APPFONT ( 126, 166 ) ; -+ Pos = MAP_APPFONT ( 302, 52 ) ; - Size = MAP_APPFONT ( 38, 48 ) ; - DeltaLang = < Default ; Default ; Default ; Default ; > ; - TabStop = TRUE ; -@@ -209,7 +217,7 @@ - CheckBox CB_ALLOWDUPLICATEFIELDNAMES - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ALLOWDUPLICATEFIELDNAMES"; -- Pos = MAP_APPFONT( 30, 178 ); -+ Pos = MAP_APPFONT( 206, 64 ); - Size = MAP_APPFONT( 128, 10 ); - TabStop = TRUE; - Text [ en-US ] = "Allow duplicate field ~names"; -@@ -217,7 +225,7 @@ - CheckBox CB_EXPORTBOOKMARKS - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTBOOKMARKS"; -- Pos = MAP_APPFONT ( 12 , 190 ) ; -+ Pos = MAP_APPFONT ( 188 , 76 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Export ~bookmarks"; -@@ -225,7 +233,7 @@ - CheckBox CB_EXPORTNOTES - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTES"; -- Pos = MAP_APPFONT ( 12 , 203 ) ; -+ Pos = MAP_APPFONT ( 188 , 89 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "~Export comments"; -@@ -233,7 +241,7 @@ - CheckBox CB_EXPORTNOTESPAGES - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTESPAGES"; -- Pos = MAP_APPFONT ( 12 , 216 ) ; -+ Pos = MAP_APPFONT ( 188 , 102 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Export ~notes pages"; -@@ -241,7 +249,7 @@ - CheckBox CB_EXPORTEMPTYPAGES - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTEMPTYPAGES"; -- Pos = MAP_APPFONT ( 12 , 229 ) ; -+ Pos = MAP_APPFONT ( 188 , 115 ) ; - Size = MAP_APPFONT ( 158 , 16 ) ; - TabStop = TRUE ; - WordBreak = TRUE ; -@@ -250,7 +258,7 @@ - CheckBox CB_EMBEDSTANDARDFONTS - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EMBEDSTANDARDFONTS"; -- Pos = MAP_APPFONT ( 12 , 248 ) ; -+ Pos = MAP_APPFONT ( 188 , 134 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "E~mbed standard fonts"; -@@ -258,7 +266,7 @@ - CheckBox CB_ADDSTREAM - { - HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ADDSTREAM"; -- Pos = MAP_APPFONT ( 12 , 261 ) ; -+ Pos = MAP_APPFONT ( 188 , 147 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Create ~hybrid file"; -@@ -385,45 +393,52 @@ - Minimum = 50; - Maximum = 1600; - }; --//////////////////////////////////////// -+ -+ FixedLine FL_INITVIEW_VERTICAL -+ { -+ Pos = MAP_APPFONT ( 175 , 3 ) ; -+ Size = MAP_APPFONT ( 4 , 150 ) ; -+ Vert = TRUE; -+ }; -+ - FixedLine FL_PAGE_LAYOUT - { -- Pos = MAP_APPFONT ( 6 , 146 ) ; -- Size = MAP_APPFONT (164 , 8 ) ; -+ Pos = MAP_APPFONT ( 182 , 3 ) ; -+ Size = MAP_APPFONT (164 , 8 ) ; - Text[ en-US ] = "Page layout" ; - }; - RadioButton RB_PGLY_DEFAULT - { - HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_DEFAULT"; -- Pos = MAP_APPFONT ( 12 , 158 ) ; -+ Pos = MAP_APPFONT ( 188 , 15 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text[ en-US ] = "D~efault" ; - }; - RadioButton RB_PGLY_SINGPG - { - HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_SINGPG"; -- Pos = MAP_APPFONT ( 12 , 170 ) ; -+ Pos = MAP_APPFONT ( 188 , 27 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text[ en-US ] = "~Single page" ; - }; - RadioButton RB_PGLY_CONT - { - HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONT"; -- Pos = MAP_APPFONT ( 12 , 182 ) ; -+ Pos = MAP_APPFONT ( 188 , 39 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text[ en-US ] = "~Continuous" ; - }; - RadioButton RB_PGLY_CONTFAC - { - HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONTFAC"; -- Pos = MAP_APPFONT ( 12 , 194 ) ; -+ Pos = MAP_APPFONT ( 188 , 51 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text[ en-US ] = "C~ontinuous facing" ; - }; - CheckBox CB_PGLY_FIRSTLEFT - { - HelpID = "filter:CheckBox:RID_PDF_TAB_OPNFTR:CB_PGLY_FIRSTLEFT"; -- Pos = MAP_APPFONT ( 22 , 206 ) ; -+ Pos = MAP_APPFONT ( 198 , 63 ) ; - Size = MAP_APPFONT ( 148 , 10 ) ; - Text[ en-US ] = "First page is ~left" ; - }; -@@ -478,17 +493,23 @@ - Text[ en-US ] = "~Display document title"; - }; - --//////////////////////////////// -+ FixedLine FL_VPREFER_VERTICAL -+ { -+ Pos = MAP_APPFONT ( 175 , 3 ) ; -+ Size = MAP_APPFONT ( 4 , 150 ) ; -+ Vert = TRUE; -+ }; -+ - FixedLine FL_USRIFOPT - { -- Pos = MAP_APPFONT ( 6 , 64 ) ; -+ Pos = MAP_APPFONT ( 182 , 3 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text[ en-US ] = "User interface options" ; - }; - CheckBox CB_UOP_HIDEVMENUBAR - { - HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVMENUBAR"; -- Pos = MAP_APPFONT ( 12 , 76 ) ; -+ Pos = MAP_APPFONT ( 188 , 15 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Hide ~menubar"; -@@ -496,7 +517,7 @@ - CheckBox CB_UOP_HIDEVTOOLBAR - { - HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVTOOLBAR"; -- Pos = MAP_APPFONT ( 12 , 88 ) ; -+ Pos = MAP_APPFONT ( 188 , 27 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Hide ~toolbar"; -@@ -504,7 +525,7 @@ - CheckBox CB_UOP_HIDEVWINCTRL - { - HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVWINCTRL"; -- Pos = MAP_APPFONT ( 12 , 100 ) ; -+ Pos = MAP_APPFONT ( 188 , 39 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Hide ~window controls"; -@@ -513,14 +534,14 @@ - //////////////////////////////// - FixedLine FL_TRANSITIONS - { -- Pos = MAP_APPFONT ( 6 , 114 ) ; -+ Pos = MAP_APPFONT ( 6 , 64 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text[ en-US ] = "Transitions" ; - }; - CheckBox CB_TRANSITIONEFFECTS - { - HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_TRANSITIONEFFECTS"; -- Pos = MAP_APPFONT ( 12 , 126 ) ; -+ Pos = MAP_APPFONT ( 12 , 76 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "~Use transition effects"; -@@ -528,28 +549,28 @@ - //////////////////////////////// - FixedLine FL_BOOKMARKS - { -- Pos = MAP_APPFONT ( 6 , 140 ) ; -+ Pos = MAP_APPFONT ( 182 , 64 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text[ en-US ] = "Bookmarks" ; - }; - RadioButton RB_ALLBOOKMARKLEVELS - { - HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_ALLBOOKMARKLEVELS"; -- Pos = MAP_APPFONT ( 12 , 152 ) ; -+ Pos = MAP_APPFONT ( 188 , 76 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text[ en-US ] = "All bookmark levels"; - }; - RadioButton RB_VISIBLEBOOKMARKLEVELS - { - HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_VISIBLEBOOKMARKLEVELS"; -- Pos = MAP_APPFONT ( 12 , 166 ) ; -+ Pos = MAP_APPFONT ( 188 , 90 ) ; - Size = MAP_APPFONT ( 117 , 10 ) ; - Text[ en-US ] = "Visible bookmark levels"; - }; - NumericField NUM_BOOKMARKLEVELS - { - HelpID = "filter:NumericField:RID_PDF_TAB_VPREFER:NUM_BOOKMARKLEVELS"; -- Pos = MAP_APPFONT ( 132 , 165 ) ; -+ Pos = MAP_APPFONT ( 308 , 89 ) ; - Size = MAP_APPFONT ( 32 , 12 ) ; - Border = TRUE; - Spin = TRUE; -@@ -649,31 +670,37 @@ - Text [en-US] = "PDF doument will not be restricted due to PDF/A export."; - }; - --////////////////////////////// -+ FixedLine FL_SECURITY_VERTICAL -+ { -+ Pos = MAP_APPFONT ( 175 , 3 ) ; -+ Size = MAP_APPFONT ( 4 , 150 ) ; -+ Vert = TRUE; -+ }; -+ - FixedLine FL_PRINT_PERMISSIONS - { -- Pos = MAP_APPFONT ( 12 , 90 ) ; -+ Pos = MAP_APPFONT ( 182 , 5 ) ; - Size = MAP_APPFONT (156 , 8 ) ; - Text[ en-US ] = "Printing" ; - }; - RadioButton RB_PRINT_NONE - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_NONE"; -- Pos = MAP_APPFONT ( 18 , 101 ) ; -+ Pos = MAP_APPFONT ( 188 , 16 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "~Not permitted"; - }; - RadioButton RB_PRINT_LOWRES - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_LOWRES"; -- Pos = MAP_APPFONT ( 18 , 112 ) ; -+ Pos = MAP_APPFONT ( 188 , 27 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "~Low resolution (150 dpi)"; - }; - RadioButton RB_PRINT_HIGHRES - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_HIGHRES"; -- Pos = MAP_APPFONT ( 18 , 123 ) ; -+ Pos = MAP_APPFONT ( 188 , 38 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "~High resolution"; - }; -@@ -681,35 +708,35 @@ - ///////////////////////////// - FixedLine FL_CHANGES_ALLOWED - { -- Pos = MAP_APPFONT ( 12 , 134 ) ; -+ Pos = MAP_APPFONT ( 182 , 49 ) ; - Size = MAP_APPFONT (156 , 8 ) ; - Text[ en-US ] = "Changes" ; - }; - RadioButton RB_CHANGES_NONE - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_NONE"; -- Pos = MAP_APPFONT ( 18 , 145 ) ; -+ Pos = MAP_APPFONT ( 188 , 60 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "No~t permitted"; - }; - RadioButton RB_CHANGES_INSDEL - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_INSDEL"; -- Pos = MAP_APPFONT ( 18 , 157 ) ; -+ Pos = MAP_APPFONT ( 188 , 72 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "~Inserting, deleting, and rotating pages"; - }; - RadioButton RB_CHANGES_FILLFORM - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_FILLFORM"; -- Pos = MAP_APPFONT ( 18 , 168 ) ; -+ Pos = MAP_APPFONT ( 188 , 83 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text[ en-US ] = "~Filling in form fields"; - }; - RadioButton RB_CHANGES_COMMENT - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_COMMENT"; -- Pos = MAP_APPFONT ( 18 , 179 ) ; -+ Pos = MAP_APPFONT ( 188 , 94 ) ; - Size = MAP_APPFONT ( 152 , 16 ) ; - WordBreak = TRUE ; - Text[ en-US ] = "~Commenting, filling in form fields"; -@@ -717,7 +744,7 @@ - RadioButton RB_CHANGES_ANY_NOCOPY - { - HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_ANY_NOCOPY"; -- Pos = MAP_APPFONT ( 18 , 198 ) ; -+ Pos = MAP_APPFONT ( 188 , 113 ) ; - Size = MAP_APPFONT ( 152 , 10 ) ; - Text[ en-US ] = "~Any except extracting pages"; - }; -@@ -725,7 +752,7 @@ - CheckBox CB_ENDAB_COPY - { - HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENDAB_COPY"; -- Pos = MAP_APPFONT ( 12 , 211 ) ; -+ Pos = MAP_APPFONT ( 182 , 126 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Ena~ble copying of content" ; -@@ -734,7 +761,7 @@ - CheckBox CB_ENAB_ACCESS - { - HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENAB_ACCESS"; -- Pos = MAP_APPFONT ( 12 , 224 ) ; -+ Pos = MAP_APPFONT ( 182 , 139 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Enable text access for acce~ssibility tools" ; diff --git a/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch b/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch deleted file mode 100644 index a74e6f7..0000000 --- a/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch +++ /dev/null @@ -1,213 +0,0 @@ -From 4d974b37e75d1c46b9ddbf86bc6f2756014c7c46 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 19 Jul 2011 13:39:34 +0100 -Subject: [PATCH] Resolves: rhbz#715549 use fontconfig's detected format when - available - ---- - vcl/inc/vcl/fontmanager.hxx | 2 +- - vcl/unx/generic/fontmanager/fontconfig.cxx | 12 +++- - vcl/unx/generic/fontmanager/fontmanager.cxx | 81 +++++++++++++++++---------- - 3 files changed, 62 insertions(+), 33 deletions(-) - -diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx -index 410ecf1..816adbe 100644 ---- a/vcl/inc/vcl/fontmanager.hxx -+++ b/vcl/inc/vcl/fontmanager.hxx -@@ -333,7 +333,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager - - void getFontAttributesFromXLFD( PrintFont* pFont, const std::list< rtl::OString >& rXLFDs ) const; - -- bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const; -+ bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts, const char *pFormat=NULL ) const; - rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code - void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code - bool analyzeTrueTypeFile( PrintFont* pFont ) const; -diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx -index e4b2f00..5e97bec 100644 ---- a/vcl/unx/source/fontmanager/fontconfig.cxx -+++ b/vcl/unx/source/fontmanager/fontconfig.cxx -@@ -68,6 +68,9 @@ - #ifndef FC_EMBOLDEN - #define FC_EMBOLDEN "embolden" - #endif -+ #ifndef FC_FONTFORMAT -+ #define FC_FONTFORMAT "fontformat" -+ #endif - #else - typedef void FcConfig; - typedef void FcObjectSet; -@@ -842,6 +845,7 @@ - FcChar8* file = NULL; - FcChar8* family = NULL; - FcChar8* style = NULL; -+ FcChar8* format = NULL; - int slant = 0; - int weight = 0; - int spacing = 0; -@@ -856,6 +860,7 @@ - FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing ); - FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline ); - FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry ); -+ FcResult eFormatRes = rWrapper.FcPatternGetString(pFSet->fonts[i], FC_FONTFORMAT, 0, &format); - - if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch ) - continue; -@@ -863,13 +868,14 @@ - #if (OSL_DEBUG_LEVEL > 2) - fprintf( stderr, "found font \"%s\" in file %s\n" - " weight = %d, slant = %d, style = \"%s\"\n" -- " spacing = %d, outline = %d\n" -+ " spacing = %d, outline = %d, format %s\n" - , family, file - , eWeightRes == FcResultMatch ? weight : -1 - , eSpacRes == FcResultMatch ? slant : -1 - , eStyleRes == FcResultMatch ? (const char*) style : "" - , eSpacRes == FcResultMatch ? spacing : -1 - , eOutRes == FcResultMatch ? outline : -1 -+ , eFormatRes == FcResultMatch ? (const char*)format : "" - ); - #endif - -@@ -904,7 +910,9 @@ - // not known, analyze font file to get attributes - // not described by fontconfig (e.g. alias names, PSName) - std::list< OString > aDummy; -- analyzeFontFile( nDirID, aBase, aDummy, aFonts ); -+ if (eFormatRes != FcResultMatch) -+ format = NULL; -+ analyzeFontFile( nDirID, aBase, aDummy, aFonts, (const char*)format ); - #if OSL_DEBUG_LEVEL > 1 - if( aFonts.empty() ) - fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() ); -diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx -index 2dceb35..27a2629 100644 ---- a/vcl/unx/source/fontmanager/fontmanager.cxx -+++ b/vcl/unx/source/fontmanager/fontmanager.cxx -@@ -1281,9 +1281,12 @@ int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int /*nFaceN - return nFontId; - } - --// ------------------------------------------------------------------------- -+enum fontFormat -+{ -+ UNKNOWN, TRUETYPE, CFF, TYPE1, AFM -+}; - --bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ) const -+bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const - { - rNewFonts.clear(); - -@@ -1297,8 +1300,32 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co - if( access( aFullPath.getStr(), R_OK ) ) - return false; - -- ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); -- if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) -+ fontFormat eFormat = UNKNOWN; -+ if (pFormat) -+ { -+ if (!strcmp(pFormat, "TrueType")) -+ eFormat = TRUETYPE; -+ else if (!strcmp(pFormat, "CFF")) -+ eFormat = CFF; -+ else if (!strcmp(pFormat, "Type 1")) -+ eFormat = TYPE1; -+ } -+ if (eFormat == UNKNOWN) -+ { -+ ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); -+ if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) -+ eFormat = TYPE1; -+ else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) -+ eFormat = AFM; -+ else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) -+ || aExt.EqualsIgnoreCaseAscii( "ttc" ) -+ || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support -+ eFormat = TRUETYPE; -+ else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too -+ eFormat = CFF; -+ } -+ -+ if (eFormat == TYPE1) - { - // check for corresponding afm metric - // first look for an adjacent file -@@ -1352,7 +1379,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co - } - } - } -- else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) -+ else if (eFormat == AFM) - { - ByteString aFilePath( aDir ); - aFilePath.Append( '/' ); -@@ -1365,34 +1392,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co - else - delete pFont; - } -- else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) -- || aExt.EqualsIgnoreCaseAscii( "tte" ) // #i33947# for Gaiji support -- || aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too -- { -- TrueTypeFontFile* pFont = new TrueTypeFontFile(); -- pFont->m_nDirectory = nDirID; -- pFont->m_aFontFile = rFontFile; -- pFont->m_nCollectionEntry = -1; -- -- if( rXLFDs.size() ) -- getFontAttributesFromXLFD( pFont, rXLFDs ); -- // need to read the font anyway to get aliases inside the font file -- if( ! analyzeTrueTypeFile( pFont ) ) -- { -- delete pFont; -- pFont = NULL; -- } -- else -- rNewFonts.push_back( pFont ); -- } -- else if( aExt.EqualsIgnoreCaseAscii( "ttc" ) ) -+ else if (eFormat == TRUETYPE || eFormat == CFF) - { - // get number of ttc entries - int nLength = CountTTCFonts( aFullPath.getStr() ); - if( nLength ) - { - #if OSL_DEBUG_LEVEL > 1 -- fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength ); -+ fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength ); - #endif - for( int i = 0; i < nLength; i++ ) - { -@@ -1411,10 +1418,24 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co - rNewFonts.push_back( pFont ); - } - } --#if OSL_DEBUG_LEVEL > 1 - else -- fprintf( stderr, "CountTTCFonts( \"%s/%s\" ) failed\n", getDirectory(nDirID).getStr(), rFontFile.getStr() ); --#endif -+ { -+ TrueTypeFontFile* pFont = new TrueTypeFontFile(); -+ pFont->m_nDirectory = nDirID; -+ pFont->m_aFontFile = rFontFile; -+ pFont->m_nCollectionEntry = -1; -+ -+ if( rXLFDs.size() ) -+ getFontAttributesFromXLFD( pFont, rXLFDs ); -+ // need to read the font anyway to get aliases inside the font file -+ if( ! analyzeTrueTypeFile( pFont ) ) -+ { -+ delete pFont; -+ pFont = NULL; -+ } -+ else -+ rNewFonts.push_back( pFont ); -+ } - } - return ! rNewFonts.empty(); - } --- -1.7.6 - diff --git a/0001-Resolves-rhbz-738255-avoid-crash-on-NULL-pointer.patch b/0001-Resolves-rhbz-738255-avoid-crash-on-NULL-pointer.patch deleted file mode 100644 index f6cdc69..0000000 --- a/0001-Resolves-rhbz-738255-avoid-crash-on-NULL-pointer.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 76cf006837fdb687ce0a34ac673f3b8531b19700 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Thu, 15 Sep 2011 12:32:51 +0100 -Subject: [PATCH] Resolves: rhbz#738255 avoid crash on NULL pointer - ---- - sc/source/ui/app/inputhdl.cxx | 15 +++++++++------ - 1 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx -index 1524397..c30a8fd 100644 ---- a/sc/source/ui/app/inputhdl.cxx -+++ b/sc/source/ui/app/inputhdl.cxx -@@ -2469,13 +2469,16 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode ) - ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument(); - // #i67990# don't use pLastPattern in EnterHandler - const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); -- SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); -- // without conditional format, as in ScColumn::SetString -- sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter ); -- double nVal; -- if ( pFormatter->IsNumberFormat( aString, nFormat, nVal ) ) -+ if (pPattern) - { -- bSpellErrors = false; // ignore the spelling errors -+ SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); -+ // without conditional format, as in ScColumn::SetString -+ sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter ); -+ double nVal; -+ if ( pFormatter->IsNumberFormat( aString, nFormat, nVal ) ) -+ { -+ bSpellErrors = false; // ignore the spelling errors -+ } - } - } - } --- -1.7.6 - diff --git a/0001-Resolves-rhbz-751290-KDE-black-on-dark-tooltips.patch b/0001-Resolves-rhbz-751290-KDE-black-on-dark-tooltips.patch deleted file mode 100644 index 1d14db7..0000000 --- a/0001-Resolves-rhbz-751290-KDE-black-on-dark-tooltips.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 7cd58dbe32e5421986216dd7c6b24a4bb0b9c1e5 Mon Sep 17 00:00:00 2001 -From: Luboš Luňák -Date: Tue, 18 Oct 2011 14:52:47 +0000 -Subject: style tooltips properly with KDE4 vclplug (fdo#40461) - ---- -(limited to 'vcl/unx/kde4') - -diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx -index 10e7350..4dd54e5 100644 ---- a/vcl/unx/kde4/KDESalFrame.cxx -+++ b/vcl/unx/kde4/KDESalFrame.cxx -@@ -38,6 +38,8 @@ - #include - #include - #include -+#include -+#include - - #undef Region - -@@ -239,11 +241,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - style.SetFieldTextColor( aText ); - style.SetFieldRolloverTextColor( aText ); - style.SetWindowTextColor( aText ); -- style.SetHelpTextColor( aText ); - - // Base - style.SetFieldColor( aBase ); -- style.SetHelpColor( aBase ); - style.SetWindowColor( aBase ); - style.SetActiveTabColor( aBase ); - -@@ -268,11 +268,14 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - style.SetHighlightColor( aHigh ); - style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) ); - -+ // Tooltip -+ style.SetHelpColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipBase ))); -+ style.SetHelpTextColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipText ))); -+ - // Font - Font aFont = toFont( kapp->font(), rSettings.GetUILocale() ); - - style.SetAppFont( aFont ); -- style.SetHelpFont( aFont ); - - style.SetMenuFont( aFont ); // will be changed according to pMenuBar - //style.SetToolFont( aFont ); //already set above -@@ -291,6 +294,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - } - style.SetFloatTitleFont( aFont ); - -+ style.SetHelpFont( toFont( QToolTip::font(), rSettings.GetUILocale())); -+ - int flash_time = QApplication::cursorFlashTime(); - style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - --- -cgit v0.9.0.2-2-gbebe diff --git a/0001-add-Oracle-Java-1.7.0-recognition.patch b/0001-add-Oracle-Java-1.7.0-recognition.patch deleted file mode 100644 index 9889535..0000000 --- a/0001-add-Oracle-Java-1.7.0-recognition.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 549e54fb2f8113502743c443d6deadfe648dede1 Mon Sep 17 00:00:00 2001 -From: Hanno Meyer-Thurow -Date: Tue, 13 Sep 2011 13:23:28 +0100 -Subject: [PATCH] add Oracle Java 1.7.0 recognition - ---- - .../OpenOfficeorg/javavendors_linux.xml | 4 ++++ - jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx | 2 ++ - jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx | 1 + - 3 files changed, 7 insertions(+), 0 deletions(-) - -diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml -index ed329e5..489511f 100644 ---- a/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml -+++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml -@@ -9,6 +9,9 @@ - - 1.5.0 - -+ -+ 1.7.0 -+ - - 1.5.0 - -@@ -25,6 +28,7 @@ - - - vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so -+ vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so - vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so - vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so - vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so -diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx -index 8567d79..91ad4c6 100644 ---- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx -+++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx -@@ -112,6 +112,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) - - //Only do something if the sunjavaplugin created this JavaInfo - rtl::OUString sVendor1(RTL_CONSTASCII_USTRINGPARAM("Sun Microsystems Inc.")); -+ rtl::OUString sVendor9(RTL_CONSTASCII_USTRINGPARAM("Oracle Corporation")); - rtl::OUString sVendor2(RTL_CONSTASCII_USTRINGPARAM("IBM Corporation")); - rtl::OUString sVendor3(RTL_CONSTASCII_USTRINGPARAM("Blackdown Java-Linux Team")); - rtl::OUString sVendor4(RTL_CONSTASCII_USTRINGPARAM("Apple Inc.")); -@@ -121,6 +122,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) - rtl::OUString sVendor8(RTL_CONSTASCII_USTRINGPARAM("The FreeBSD Foundation")); - if ( ! (sVendor1.equals(pInfo->sVendor) == sal_True - || sVendor2.equals(pInfo->sVendor) == sal_True -+ || sVendor9.equals(pInfo->sVendor) == sal_True - || sVendor3.equals(pInfo->sVendor) == sal_True - || sVendor4.equals(pInfo->sVendor) == sal_True - || sVendor5.equals(pInfo->sVendor) == sal_True -diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx -index f24b6ff..5e87002 100644 ---- a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx -+++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx -@@ -52,6 +52,7 @@ namespace jfw_plugin - */ - BEGIN_VENDOR_MAP() - VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo) -+ VENDOR_MAP_ENTRY("Oracle Corporation", SunInfo) - VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo) - VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo) - VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo) --- -1.7.6.4 - diff --git a/0001-avoid-using-com.sun.org-apis.patch b/0001-avoid-using-com.sun.org-apis.patch deleted file mode 100644 index a275b6a..0000000 --- a/0001-avoid-using-com.sun.org-apis.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 04c5a36ab8d514cfbe8e40f4493787b2ab392ab5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 25 Oct 2011 13:49:51 +0100 -Subject: [PATCH] avoid using com.sun.org apis - ---- - .../pentaho/output/OfficeDocumentReportTarget.java | 10 ++++++---- - 1 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java -index cdc8eae..ef99a15 100644 ---- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java -+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java -@@ -41,7 +41,6 @@ import com.sun.star.report.pentaho.model.OfficeStyles; - import com.sun.star.report.pentaho.model.OfficeStylesCollection; - import com.sun.star.report.pentaho.styles.LengthCalculator; - import com.sun.star.report.pentaho.styles.StyleMapper; --import com.sun.org.apache.xerces.internal.parsers.DOMParser; - import java.util.logging.Level; - import java.util.logging.Logger; - import javax.xml.transform.OutputKeys; -@@ -49,6 +48,8 @@ import javax.xml.transform.Transformer; - import javax.xml.transform.TransformerFactory; - import javax.xml.transform.dom.DOMSource; - import javax.xml.transform.stream.StreamResult; -+import javax.xml.parsers.DocumentBuilderFactory; -+import javax.xml.parsers.DocumentBuilder; - import org.w3c.dom.Document; - import org.w3c.dom.Node; - import org.w3c.dom.NodeList; -@@ -1058,9 +1059,10 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget - try - { - inputStream = getInputRepository().createInputStream("meta.xml"); -- DOMParser dOMParser = new DOMParser(); -- dOMParser.parse(new InputSource(inputStream)); -- Document document = dOMParser.getDocument(); -+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); -+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); -+ Document document = dBuilder.parse(new InputSource(inputStream)); -+ - NodeList nl = document.getElementsByTagName("document-meta/meta/generator"); - Node node = document.getFirstChild().getFirstChild().getFirstChild().getFirstChild(); - String creator = node.getNodeValue(); --- -1.7.6.4 - diff --git a/0001-bubble-down-configure-test-findings-on-visibility.patch b/0001-bubble-down-configure-test-findings-on-visibility.patch deleted file mode 100644 index 79a331d..0000000 --- a/0001-bubble-down-configure-test-findings-on-visibility.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e33537190f7a57ddcfe1382d330fa5d28581f16b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Mon, 18 Apr 2011 09:01:37 +0100 -Subject: [PATCH] bubble down configure test findings on visibility - ---- - solenv/gbuild/platform/unxgcc.mk | 22 ++++++++++++++++++---- - 1 files changed, 18 insertions(+), 4 deletions(-) - -diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk -index 11a0205..b58e4ba 100755 ---- a/solenv/gbuild/platform/unxgcc.mk -+++ b/solenv/gbuild/platform/unxgcc.mk -@@ -59,7 +59,6 @@ endif - - gb_COMPILERDEFS := \ - -D$(COM) \ -- -DHAVE_GCC_VISIBILITY_FEATURE \ - -DCPPU_ENV=gcc3 \ - -DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \ - -@@ -71,7 +70,6 @@ gb_CFLAGS := \ - -fPIC \ - -fmessage-length=0 \ - -fno-common \ -- -fvisibility=hidden \ - -pipe \ - - gb_CXXFLAGS := \ -@@ -85,10 +83,26 @@ gb_CXXFLAGS := \ - -fPIC \ - -fmessage-length=0 \ - -fno-common \ -- -fvisibility-inlines-hidden \ -- -fvisibility=hidden \ - -pipe \ - -+ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE) -+gb_COMPILERDEFS += \ -+ -DHAVE_GCC_VISIBILITY_FEATURE \ -+ -+gb_CFLAGS += \ -+ -fvisibility=hidden -+ -+gb_CXXFLAGS += \ -+ -fvisibility=hidden \ -+ -+ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE) -+gb_CXXFLAGS += \ -+ -fvisibility-inlines-hidden \ -+ -+endif -+ -+endif -+ - gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') - gb_StrictAliasingUnsafe := $(shell expr $(gb_CCVER) \< 40600) - --- -1.7.4.2 - diff --git a/0001-fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch b/0001-fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch deleted file mode 100644 index 60ea617..0000000 --- a/0001-fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 082ecb53a9077b6ae01ce66237f48d88bcb0cc00 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= -Date: Thu, 20 Oct 2011 19:05:13 +0200 -Subject: [PATCH] fix horizontal scrollbars with KDE oxygen style (bnc#722918) - -Apparently there are two style flags for detecting the widget -is horizontal. ---- - vcl/unx/kde4/KDESalGraphics.cxx | 19 +++++++++++++------ - 1 files changed, 13 insertions(+), 6 deletions(-) - -diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx -index 749fbf0..b09fe53 100644 ---- a/vcl/unx/kde4/KDESalGraphics.cxx -+++ b/vcl/unx/kde4/KDESalGraphics.cxx -@@ -493,10 +493,9 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, - if (sbVal->mnVisibleSize < sbVal->mnMax) - option.state = QStyle::State_MouseOver; - -- //horizontal or vertical -- if (part == PART_DRAW_BACKGROUND_VERT) -- option.orientation = Qt::Vertical; -- else -+ bool horizontal = ( part == PART_DRAW_BACKGROUND_HORZ ); //horizontal or vertical -+ option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; -+ if( horizontal ) - option.state |= QStyle::State_Horizontal; - - //setup parameters from the OO values -@@ -592,7 +591,10 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, - option.maximum = slVal->mnMax; - option.minimum = slVal->mnMin; - option.sliderPosition = option.sliderValue = slVal->mnCur; -- option.orientation = (part == PART_TRACK_HORZ_AREA) ? Qt::Horizontal : Qt::Vertical; -+ bool horizontal = ( part == PART_TRACK_HORZ_AREA ); //horizontal or vertical -+ option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; -+ if( horizontal ) -+ option.state |= QStyle::State_Horizontal; - - draw( QStyle::CC_Slider, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); - } -@@ -903,7 +905,10 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p - QStyleOptionSlider option; - OSL_ASSERT( val.getType() == CTRL_SCROLLBAR ); - const ScrollbarValue* sbVal = static_cast(&val); -- option.orientation = ( part == PART_TRACK_HORZ_AREA ) ? Qt::Horizontal : Qt::Vertical; -+ bool horizontal = ( part == PART_TRACK_HORZ_AREA ); //horizontal or vertical -+ option.orientation = horizontal ? Qt::Horizontal : Qt::Vertical; -+ if( horizontal ) -+ option.state |= QStyle::State_Horizontal; - option.minimum = sbVal->mnMin; - option.maximum = sbVal->mnMax; - option.sliderValue = sbVal->mnCur; -@@ -971,6 +976,8 @@ sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nP - rect.moveTo( 0, 0 ); - QStyleOptionSlider options; - options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical; -+ if( bHorizontal ) -+ options.state |= QStyle::State_Horizontal; - options.rect = rect; - // some random sensible values, since we call this code only for scrollbar buttons, - // the slider position does not exactly matter --- -1.7.6.4 - diff --git a/0001-gtk3-fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch b/0001-gtk3-fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch deleted file mode 100644 index f833632..0000000 --- a/0001-gtk3-fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a07e8231a5cd3e12f7120486098479ab6ae6bcc2 Mon Sep 17 00:00:00 2001 -From: Michael Meeks -Date: Thu, 20 Oct 2011 21:49:40 +0100 -Subject: [PATCH] gtk3: fix cairo canvas crash for non X (or svp) backend - ---- - canvas/source/cairo/cairo_xlib_cairo.cxx | 3 +++ - 1 files changed, 3 insertions(+), 0 deletions(-) - -diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx -index a0569ab..8e9120d 100644 ---- a/canvas/source/cairo/cairo_xlib_cairo.cxx -+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx -@@ -55,6 +55,9 @@ namespace cairo - return false; - - Display* pDisplay = (Display*)pOutDev->GetSystemGfxData().pDisplay; -+ if( !pDisplay ) -+ return false; -+ - int nDummy; - return XQueryExtension( pDisplay, "RENDER", &nDummy, &nDummy, &nDummy ); - } --- -1.7.6.4 - diff --git a/0001-helgrind-Related-rhbz-655686-get-order-of-shutdown-c.patch b/0001-helgrind-Related-rhbz-655686-get-order-of-shutdown-c.patch deleted file mode 100644 index 25899df..0000000 --- a/0001-helgrind-Related-rhbz-655686-get-order-of-shutdown-c.patch +++ /dev/null @@ -1,622 +0,0 @@ -diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c -index 27ac970..c2294d8 100644 ---- a/sal/rtl/source/alloc_arena.c -+++ b/sal/rtl/source/alloc_arena.c -@@ -102,13 +102,6 @@ rtl_machdep_pagesize (void); - rtl_arena_type * gp_default_arena = 0; - - --/** rtl_arena_init() -- * @internal -- */ --static int --rtl_arena_init (void); -- -- - /* ================================================================= */ - - /** rtl_arena_segment_constructor() -@@ -921,6 +914,8 @@ rtl_arena_deactivate ( - * - * ================================================================= */ - -+extern void ensureArenaSingleton(); -+ - /** rtl_arena_create() - */ - rtl_arena_type * -@@ -973,7 +968,8 @@ try_alloc: - } - else if (gp_arena_arena == 0) - { -- if (rtl_arena_init()) -+ ensureArenaSingleton(); -+ if (gp_arena_arena) - { - /* try again */ - goto try_alloc; -@@ -1279,8 +1275,8 @@ rtl_machdep_pagesize (void) - * - * ================================================================= */ - --static void --rtl_arena_once_init (void) -+void -+rtl_arena_init (void) - { - { - /* list of arenas */ -@@ -1342,36 +1338,11 @@ rtl_arena_once_init (void) - ); - OSL_ASSERT(gp_arena_arena != 0); - } --} -- --static int --rtl_arena_init (void) --{ -- static sal_once_type g_once = SAL_ONCE_INIT; -- SAL_ONCE(&g_once, rtl_arena_once_init); -- return (gp_arena_arena != 0); -+ OSL_TRACE("rtl_arena_init completed"); - } - - /* ================================================================= */ - --/* -- Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 -- -- Mac OS X does not seem to support "__cxa__atexit", thus leading -- to the situation that "__attribute__((destructor))__" functions -- (in particular "rtl_{memory|cache|arena}_fini") become called -- _before_ global C++ object d'tors. -- -- Delegated the call to "rtl_arena_fini()" into a dummy C++ object, -- see alloc_fini.cxx . --*/ --#if defined(__GNUC__) && !defined(MACOSX) --static void rtl_arena_fini (void) __attribute__((destructor)); --#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) --#pragma fini(rtl_arena_fini) --static void rtl_arena_fini (void); --#endif /* __GNUC__ || __SUNPRO_C */ -- - void - rtl_arena_fini (void) - { -@@ -1394,6 +1365,7 @@ rtl_arena_fini (void) - } - RTL_MEMORY_LOCK_RELEASE(&(g_arena_list.m_lock)); - } -+ OSL_TRACE("rtl_arena_fini completed"); - } - - /* ================================================================= */ -diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c -index 06de201..ebf799e 100644 ---- a/sal/rtl/source/alloc_cache.c -+++ b/sal/rtl/source/alloc_cache.c -@@ -99,13 +99,6 @@ static rtl_cache_type * gp_cache_slab_cache = 0; - static rtl_cache_type * gp_cache_bufctl_cache = 0; - - --/** rtl_cache_init() -- * @internal -- */ --static int --rtl_cache_init (void); -- -- - /* ================================================================= */ - - /** RTL_CACHE_HASH_INDEX() -@@ -1119,6 +1112,8 @@ rtl_cache_deactivate ( - * - * ================================================================= */ - -+extern void ensureCacheSingleton(); -+ - /** rtl_cache_create() - */ - rtl_cache_type * -@@ -1176,7 +1171,8 @@ try_alloc: - } - else if (gp_cache_arena == 0) - { -- if (rtl_cache_init()) -+ ensureCacheSingleton(); -+ if (gp_cache_arena) - { - /* try again */ - goto try_alloc; -@@ -1583,8 +1579,8 @@ rtl_cache_wsupdate_all (void * arg) - * - * ================================================================= */ - --static void --rtl_cache_once_init (void) -+void -+rtl_cache_init (void) - { - { - /* list of caches */ -@@ -1680,36 +1676,11 @@ rtl_cache_once_init (void) - } - - rtl_cache_wsupdate_init(); --} -- --static int --rtl_cache_init (void) --{ -- static sal_once_type g_once = SAL_ONCE_INIT; -- SAL_ONCE(&g_once, rtl_cache_once_init); -- return (gp_cache_arena != 0); -+ OSL_TRACE("rtl_cache_init completed"); - } - - /* ================================================================= */ - --/* -- Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 -- -- Mac OS X does not seem to support "__cxa__atexit", thus leading -- to the situation that "__attribute__((destructor))__" functions -- (in particular "rtl_{memory|cache|arena}_fini") become called -- _before_ global C++ object d'tors. -- -- Delegated the call to "rtl_cache_fini()" into a dummy C++ object, -- see alloc_fini.cxx . --*/ --#if defined(__GNUC__) && !defined(MACOSX) --static void rtl_cache_fini (void) __attribute__((destructor)); --#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) --#pragma fini(rtl_cache_fini) --static void rtl_cache_fini (void); --#endif /* __GNUC__ || __SUNPRO_C */ -- - void - rtl_cache_fini (void) - { -@@ -1765,6 +1736,7 @@ rtl_cache_fini (void) - } - RTL_MEMORY_LOCK_RELEASE(&(g_cache_list.m_lock)); - } -+ OSL_TRACE("rtl_cache_fini completed"); - } - - /* ================================================================= */ -diff --git a/sal/rtl/source/alloc_fini.cxx b/sal/rtl/source/alloc_fini.cxx -index 5bc174e..f079676 100644 ---- a/sal/rtl/source/alloc_fini.cxx -+++ b/sal/rtl/source/alloc_fini.cxx -@@ -26,33 +26,72 @@ - * - ************************************************************************/ - --/* -- Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 -- -- Mac OS X does not seem to support "__cxa__atexit", thus leading -- to the situation that "__attribute__((destructor))__" functions -- (in particular "rtl_{memory|cache|arena}_fini") become called -- _before_ global C++ object d'tors. -- -- Using a C++ dummy object instead. --*/ -+#include - - extern "C" void rtl_memory_fini (void); --extern "C" void rtl_cache_fini (void); --extern "C" void rtl_arena_fini (void); -- --struct RTL_Alloc_Fini -+extern "C" void rtl_memory_init (void); -+namespace -+{ -+ struct rtlMemorySingleton -+ { -+ rtlMemorySingleton() -+ { -+ rtl_memory_init(); -+ } -+ ~rtlMemorySingleton() -+ { -+ rtl_memory_fini(); -+ } -+ }; -+ class theMemorySingleton : public rtl::Static{}; -+} -+extern "C" void ensureMemorySingleton() - { -- ~RTL_Alloc_Fini() ; --}; -+ theMemorySingleton::get(); -+} - --RTL_Alloc_Fini::~RTL_Alloc_Fini() -+extern "C" void rtl_cache_fini (void); -+extern "C" void rtl_cache_init (void); -+namespace -+{ -+ struct rtlCacheSingleton -+ { -+ rtlCacheSingleton() -+ { -+ rtl_cache_init(); -+ } -+ ~rtlCacheSingleton() -+ { -+ rtl_cache_fini(); -+ } -+ }; -+ class theCacheSingleton : public rtl::Static{}; -+} -+extern "C" void ensureCacheSingleton() - { -- rtl_memory_fini(); -- rtl_cache_fini(); -- rtl_arena_fini(); -+ theCacheSingleton::get(); - } - --static RTL_Alloc_Fini g_RTL_Alloc_Fini; -+extern "C" void rtl_arena_fini (void); -+extern "C" void rtl_arena_init (void); -+namespace -+{ -+ struct rtlArenaSingleton -+ { -+ rtlArenaSingleton() -+ { -+ rtl_arena_init(); -+ } -+ ~rtlArenaSingleton() -+ { -+ rtl_arena_fini(); -+ } -+ }; -+ class theArenaSingleton : public rtl::Static{}; -+} -+extern "C" void ensureArenaSingleton() -+{ -+ theArenaSingleton::get(); -+} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c -index 70504ac..fb95e83 100644 ---- a/sal/rtl/source/alloc_global.c -+++ b/sal/rtl/source/alloc_global.c -@@ -29,6 +29,7 @@ - #include "alloc_impl.h" - #include "rtl/alloc.h" - #include -+#include - - #include - #include -@@ -66,7 +67,6 @@ static void determine_alloc_mode(void) - - #include "internal/once.h" - #include "sal/macros.h" --#include "osl/diagnose.h" - - /* ================================================================= * - * -@@ -108,60 +108,7 @@ static rtl_cache_type * g_alloc_table[RTL_MEMORY_CACHED_LIMIT >> RTL_MEMALIGN_SH - - static rtl_arena_type * gp_alloc_arena = 0; - --/* ================================================================= * -- * -- * custom allocator initialization / finalization. -- * -- * ================================================================= */ -- --static void --rtl_memory_once_init (void) --{ -- { -- /* global memory arena */ -- OSL_ASSERT(gp_alloc_arena == 0); -- -- gp_alloc_arena = rtl_arena_create ( -- "rtl_alloc_arena", -- 2048, /* quantum */ -- 0, /* w/o quantum caching */ -- 0, /* default source */ -- rtl_arena_alloc, -- rtl_arena_free, -- 0 /* flags */ -- ); -- OSL_ASSERT(gp_alloc_arena != 0); -- } -- { -- sal_Size size; -- int i, n = RTL_MEMORY_CACHED_SIZES; -- -- for (i = 0; i < n; i++) -- { -- char name[RTL_CACHE_NAME_LENGTH + 1]; -- (void) snprintf (name, sizeof(name), "rtl_alloc_%lu", g_alloc_sizes[i]); -- g_alloc_caches[i] = rtl_cache_create (name, g_alloc_sizes[i], 0, NULL, NULL, NULL, NULL, NULL, 0); -- } -- -- size = RTL_MEMALIGN; -- for (i = 0; i < n; i++) -- { -- while (size <= g_alloc_sizes[i]) -- { -- g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT] = g_alloc_caches[i]; -- size += RTL_MEMALIGN; -- } -- } -- } --} -- --static int --rtl_memory_init (void) --{ -- static sal_once_type g_once = SAL_ONCE_INIT; -- SAL_ONCE(&g_once, rtl_memory_once_init); -- return (gp_alloc_arena != 0); --} -+extern void ensureMemorySingleton(); - - /* ================================================================= * - * -@@ -198,7 +145,8 @@ try_alloc: - } - else if (gp_alloc_arena == 0) - { -- if (rtl_memory_init()) -+ ensureMemorySingleton(); -+ if (gp_alloc_arena) - { - /* try again */ - goto try_alloc; -@@ -256,28 +204,58 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT - - #endif - -+/* ================================================================= * -+ * -+ * custom allocator initialization / finalization. -+ * -+ * ================================================================= */ -+ -+void rtl_memory_init (void) -+{ -+#if !defined(FORCE_SYSALLOC) -+ { -+ /* global memory arena */ -+ OSL_ASSERT(gp_alloc_arena == 0); -+ -+ gp_alloc_arena = rtl_arena_create ( -+ "rtl_alloc_arena", -+ 2048, /* quantum */ -+ 0, /* w/o quantum caching */ -+ 0, /* default source */ -+ rtl_arena_alloc, -+ rtl_arena_free, -+ 0 /* flags */ -+ ); -+ OSL_ASSERT(gp_alloc_arena != 0); -+ } -+ { -+ sal_Size size; -+ int i, n = RTL_MEMORY_CACHED_SIZES; -+ -+ for (i = 0; i < n; i++) -+ { -+ char name[RTL_CACHE_NAME_LENGTH + 1]; -+ (void) snprintf (name, sizeof(name), "rtl_alloc_%lu", g_alloc_sizes[i]); -+ g_alloc_caches[i] = rtl_cache_create (name, g_alloc_sizes[i], 0, NULL, NULL, NULL, NULL, NULL, 0); -+ } -+ -+ size = RTL_MEMALIGN; -+ for (i = 0; i < n; i++) -+ { -+ while (size <= g_alloc_sizes[i]) -+ { -+ g_alloc_table[(size - 1) >> RTL_MEMALIGN_SHIFT] = g_alloc_caches[i]; -+ size += RTL_MEMALIGN; -+ } -+ } -+ } -+#endif -+ OSL_TRACE("rtl_memory_init completed"); -+} -+ - /* ================================================================= */ - --/* -- Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 -- -- Mac OS X does not seem to support "__cxa__atexit", thus leading -- to the situation that "__attribute__((destructor))__" functions -- (in particular "rtl_memory_fini") become called _before_ global -- C++ object d'tors. -- -- Delegated the call to "rtl_memory_fini" into a dummy C++ object, -- see memory_fini.cxx . --*/ --#if defined(__GNUC__) && !defined(MACOSX) && !defined(AIX) --static void rtl_memory_fini (void) __attribute__((destructor)); --#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) --#pragma fini(rtl_memory_fini) --static void rtl_memory_fini (void); --#endif /* __GNUC__ || __SUNPRO_C */ -- --void --rtl_memory_fini (void) -+void rtl_memory_fini (void) - { - #if !defined(FORCE_SYSALLOC) - int i, n; -@@ -302,6 +280,7 @@ rtl_memory_fini (void) - gp_alloc_arena = 0; - } - #endif -+ OSL_TRACE("rtl_memory_fini completed"); - } - - /* ================================================================= * -diff --git a/sal/rtl/source/makefile.mk b/sal/rtl/source/makefile.mk -index 67ae7f8..9c3921d 100644 ---- a/sal/rtl/source/makefile.mk -+++ b/sal/rtl/source/makefile.mk -@@ -100,12 +100,8 @@ SLOFILES= \ - $(SLO)$/math.obj \ - $(SLO)$/alloc_global.obj\ - $(SLO)$/alloc_cache.obj \ -- $(SLO)$/alloc_arena.obj -- --.IF "$(OS)"=="MACOSX" || "$(OS)"=="AIX" --SLOFILES+=$(SLO)$/alloc_fini.obj --.ENDIF -- -+ $(SLO)$/alloc_arena.obj \ -+ $(SLO)$/alloc_fini.obj - - OBJFILES= \ - $(OBJ)$/memory.obj \ -@@ -132,11 +128,8 @@ OBJFILES= \ - $(OBJ)$/math.obj \ - $(OBJ)$/alloc_global.obj\ - $(OBJ)$/alloc_cache.obj \ -- $(OBJ)$/alloc_arena.obj -- --.IF "$(OS)"=="MACOSX" || "$(OS)"=="AIX" --OBJFILES+=$(OBJ)$/alloc_fini.obj --.ENDIF -+ $(OBJ)$/alloc_arena.obj \ -+ $(OBJ)$/alloc_fini.obj - - - APP1TARGET=gen_makefile -diff --git a/sal/rtl/source/alloc_fini.cxx b/sal/rtl/source/alloc_fini.cxx -index f079676..dfd3599 100644 ---- a/sal/rtl/source/alloc_fini.cxx -+++ b/sal/rtl/source/alloc_fini.cxx -@@ -43,7 +43,8 @@ namespace - rtl_memory_fini(); - } - }; -- class theMemorySingleton : public rtl::Static{}; -+ class theMemorySingleton -+ : public rtl::Static{}; - } - extern "C" void ensureMemorySingleton() - { -@@ -65,7 +66,8 @@ namespace - rtl_cache_fini(); - } - }; -- class theCacheSingleton : public rtl::Static{}; -+ class theCacheSingleton -+ : public rtl::Static{}; - } - extern "C" void ensureCacheSingleton() - { -@@ -87,11 +89,35 @@ namespace - rtl_arena_fini(); - } - }; -- class theArenaSingleton : public rtl::Static{}; -+ class theArenaSingleton -+ : public rtl::Static{}; - } - extern "C" void ensureArenaSingleton() - { - theArenaSingleton::get(); - } - -+extern "C" void rtl_locale_fini (void); -+extern "C" void rtl_locale_init (void); -+namespace -+{ -+ struct rtlLocaleSingleton -+ { -+ rtlLocaleSingleton() -+ { -+ rtl_locale_init(); -+ } -+ ~rtlLocaleSingleton() -+ { -+ rtl_locale_fini(); -+ } -+ }; -+ class theLocaleSingleton -+ : public rtl::Static{}; -+} -+extern "C" void ensureLocaleSingleton() -+{ -+ theLocaleSingleton::get(); -+} -+ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/sal/rtl/source/locale.c b/sal/rtl/source/locale.c -index 964be09..79f2fb8 100644 ---- a/sal/rtl/source/locale.c -+++ b/sal/rtl/source/locale.c -@@ -58,8 +58,6 @@ static RTL_HASHTABLE* g_pLocaleTable = NULL; - - static rtl_Locale* g_pDefaultLocale = NULL; - --static int rtl_locale_init (void); -- - /************************************************************************* - */ - void rtl_hashentry_destroy(RTL_HASHENTRY* entry) -@@ -228,29 +226,15 @@ sal_Bool rtl_hashtable_find(RTL_HASHTABLE * table, sal_Int32 key, sal_Int32 hash - /************************************************************************* - * rtl_locale_init - */ --static void rtl_locale_once_init (void) -+void rtl_locale_init (void) - { - OSL_ASSERT(g_pLocaleTable == 0); - rtl_hashtable_init(&g_pLocaleTable, 1); - } - --static int rtl_locale_init (void) --{ -- static sal_once_type g_once = SAL_ONCE_INIT; -- SAL_ONCE(&g_once, rtl_locale_once_init); -- return (g_pLocaleTable != 0); --} -- - /************************************************************************* - * rtl_locale_fini - */ --#if defined(__GNUC__) --static void rtl_locale_fini (void) __attribute__((destructor)); --#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) --#pragma fini(rtl_locale_fini) --static void rtl_locale_fini (void); --#endif /* __GNUC__ || __SUNPRO_C */ -- - void rtl_locale_fini (void) - { - if (g_pLocaleTable != 0) -@@ -260,6 +244,8 @@ void rtl_locale_fini (void) - } - } - -+extern void ensureLocaleSingleton(); -+ - /************************************************************************* - * rtl_locale_register - */ -@@ -278,7 +264,8 @@ rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const s - if ( !variant ) - variant = &c; - -- if (!rtl_locale_init()) -+ ensureLocaleSingleton(); -+ if (!g_pLocaleTable) - return NULL; - - hashCode = rtl_ustr_hashCode(language) ^ rtl_ustr_hashCode(country) ^ rtl_ustr_hashCode(variant); diff --git a/0001-rhbz-667082-do-not-crash-importing-section-containin.patch b/0001-rhbz-667082-do-not-crash-importing-section-containin.patch deleted file mode 100644 index 9f2f750..0000000 --- a/0001-rhbz-667082-do-not-crash-importing-section-containin.patch +++ /dev/null @@ -1,32 +0,0 @@ -From fc23cec13e5e17fb6d0f2d650b8889041af2da68 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Sat, 18 Jun 2011 16:54:43 +0200 -Subject: [PATCH] rhbz#667082 do not crash importing section containing just - an empty paragraph - ---- - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +------- - 1 files changed, 1 insertions(+), 7 deletions(-) - -diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx -index 759f8e7..9944c8c 100644 ---- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx -+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx -@@ -937,13 +937,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) - uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY ); - CheckParaRedline( xParaEnd ); - -- // Remove the last empty section paragraph if needed -- if ( m_bIsLastParaInSection && !m_bParaChanged ) -- { -- RemoveLastParagraph( ); -- m_bIsLastParaInSection = false; -- } -- -+ m_bIsLastParaInSection = false; - m_bParaChanged = false; - } - if( !bKeepLastParagraphProperties ) --- -1.7.5.2 - diff --git a/0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch b/0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch deleted file mode 100644 index 012c585..0000000 --- a/0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 6b8151cf40be1257db1c5165c5015490390cab6f Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Tue, 10 May 2011 09:55:55 +0200 -Subject: [PATCH] rhbz#702635 set correct page number when exporting selected - pages - ---- - filter/source/pdf/pdfexport.cxx | 4 +++- - 1 files changed, 3 insertions(+), 1 deletions(-) - -diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx -index bffd26c..5de0cbc 100644 ---- a/filter/source/pdf/pdfexport.cxx -+++ b/filter/source/pdf/pdfexport.cxx -@@ -193,6 +193,7 @@ sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com: - if ( nPageCount ) - { - sal_Int32 nSel = aMultiSelection.FirstSelected(); -+ sal_Int32 nCurrentPage(0); - while ( nSel != sal_Int32(SFX_ENDOFSELECTION) ) - { - Sequence< PropertyValue > aRenderer( rRenderable->getRenderer( nSel - 1, rSelection, rRenderOptions ) ); -@@ -204,7 +205,7 @@ sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com: - aRenderer[ nProperty].Value >>= aPageSize; - } - -- pPDFExtOutDevData->SetCurrentPageNumber( nSel - 1 ); -+ pPDFExtOutDevData->SetCurrentPageNumber( nCurrentPage ); - - GDIMetaFile aMtf; - const MapMode aMapMode( MAP_100TH_MM ); -@@ -242,6 +243,7 @@ sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com: - *pFirstPage <<= sal_False; - - ++mnProgressValue; -+ ++nCurrentPage; - } - } - else --- -1.7.5.1 - diff --git a/Backport-reading-AES-encrypted-ODF-1.2-documents.patch b/Backport-reading-AES-encrypted-ODF-1.2-documents.patch deleted file mode 100644 index e6c7225..0000000 --- a/Backport-reading-AES-encrypted-ODF-1.2-documents.patch +++ /dev/null @@ -1,8199 +0,0 @@ -From 8055f25337fd5141b50382e9939c9a018c33f1c3 Mon Sep 17 00:00:00 2001 -From: Stephan Bergmann -Date: Wed, 9 Nov 2011 08:54:35 +0100 -Subject: [PATCH] Backport reading AES-encrypted ODF 1.2 documents (as - genereated by LibO 3.5). - -This backports the reading half of CWS mav60 plus "Produce -correct sha256 uri, consume correct uri and original spec typo." It spans the -repos components, libs-core, libs-gui, and ure. ---- - package/inc/EncryptedDataHeader.hxx | 8 +- - package/inc/EncryptionData.hxx | 52 ++- - package/inc/PackageConstants.hxx | 20 +- - package/inc/ZipFile.hxx | 35 +- - package/inc/ZipOutputStream.hxx | 37 +- - package/inc/ZipPackage.hxx | 15 +- - package/inc/ZipPackageEntry.hxx | 106 ++++ - package/inc/ZipPackageFolder.hxx | 4 +- - package/inc/ZipPackageStream.hxx | 216 ++++++++ - package/qa/storages/TestHelper.java | 16 +- - package/source/manifest/Base64Codec.cxx | 8 +- - package/source/manifest/Base64Codec.hxx | 4 +- - package/source/manifest/ManifestDefines.hxx | 20 + - package/source/manifest/ManifestExport.cxx | 2 +- - package/source/manifest/ManifestImport.cxx | 134 +++++- - package/source/manifest/ManifestImport.hxx | 29 +- - package/source/xstor/owriteablestream.cxx | 162 +++---- - package/source/xstor/xstorage.cxx | 139 +++++- - package/source/xstor/xstorage.hxx | 9 +- - package/source/zipapi/EntryInputStream.cxx | 205 -------- - package/source/zipapi/EntryInputStream.hxx | 85 ---- - package/source/zipapi/XFileStream.cxx | 230 --------- - package/source/zipapi/XFileStream.hxx | 95 ---- - package/source/zipapi/XMemoryStream.cxx | 55 -- - package/source/zipapi/XMemoryStream.hxx | 45 -- - package/source/zipapi/XUnbufferedStream.cxx | 75 ++-- - package/source/zipapi/XUnbufferedStream.hxx | 13 +- - package/source/zipapi/ZipFile.cxx | 288 ++++++++--- - package/source/zipapi/ZipOutputStream.cxx | 102 +++-- - package/source/zipapi/blowfishcontext.cxx | 122 +++++ - package/source/zipapi/blowfishcontext.hxx | 58 +++ - package/source/zipapi/makefile.mk | 2 + - package/source/zipapi/sha1context.cxx | 97 ++++ - package/source/zipapi/sha1context.hxx | 57 +++ - package/source/zippackage/ZipPackage.cxx | 252 ++++++++-- - package/source/zippackage/ZipPackageEntry.hxx | 106 ---- - package/source/zippackage/ZipPackageFolder.cxx | 54 ++- - package/source/zippackage/ZipPackageStream.cxx | 238 +++++++-- - package/source/zippackage/ZipPackageStream.hxx | 196 -------- - package/source/zippackage/zipfileaccess.cxx | 5 +- - .../inc/xmlsecurity/digitalsignaturesdialog.hxx | 2 +- - xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx | 5 +- - .../source/component/documentdigitalsignatures.cxx | 8 +- - .../source/dialogs/digitalsignaturesdialog.cxx | 4 +- - xmlsecurity/source/helper/xmlsignaturehelper.cxx | 6 +- - xmlsecurity/source/xmlsec/makefile.mk | 6 +- - xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 276 +++++++++++ - xmlsecurity/source/xmlsec/nss/ciphercontext.hxx | 89 ++++ - xmlsecurity/source/xmlsec/nss/digestcontext.cxx | 101 ++++ - xmlsecurity/source/xmlsec/nss/digestcontext.hxx | 68 +++ - xmlsecurity/source/xmlsec/nss/makefile.mk | 20 +- - xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 521 ++++++++++++++++++++ - xmlsecurity/source/xmlsec/nss/nssinitializer.hxx | 90 ++++ - .../xmlsec/nss/securityenvironment_nssimpl.cxx | 38 ++- - .../source/xmlsec/nss/seinitializer_nssimpl.cxx | 355 +------------- - .../source/xmlsec/nss/seinitializer_nssimpl.hxx | 34 +- - .../source/xmlsec/nss/x509certificate_nssimpl.cxx | 28 +- - xmlsecurity/source/xmlsec/nss/xsec_nss.cxx | 34 +- - xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 4 - - xmlsecurity/util/makefile.mk | 10 +- - xmlsecurity/util/xsec_xmlsec.component | 1 + - xmlsecurity/util/xsec_xmlsec.windows.component | 3 + - 62 files changed, 3208 insertions(+), 1891 deletions(-) - create mode 100644 package/inc/ZipPackageEntry.hxx - create mode 100644 package/inc/ZipPackageStream.hxx - delete mode 100644 package/source/zipapi/EntryInputStream.cxx - delete mode 100644 package/source/zipapi/EntryInputStream.hxx - delete mode 100644 package/source/zipapi/XFileStream.cxx - delete mode 100644 package/source/zipapi/XFileStream.hxx - delete mode 100644 package/source/zipapi/XMemoryStream.cxx - delete mode 100644 package/source/zipapi/XMemoryStream.hxx - create mode 100644 package/source/zipapi/blowfishcontext.cxx - create mode 100644 package/source/zipapi/blowfishcontext.hxx - create mode 100644 package/source/zipapi/sha1context.cxx - create mode 100644 package/source/zipapi/sha1context.hxx - delete mode 100644 package/source/zippackage/ZipPackageEntry.hxx - delete mode 100644 package/source/zippackage/ZipPackageStream.hxx - create mode 100644 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx - create mode 100644 xmlsecurity/source/xmlsec/nss/ciphercontext.hxx - create mode 100644 xmlsecurity/source/xmlsec/nss/digestcontext.cxx - create mode 100644 xmlsecurity/source/xmlsec/nss/digestcontext.hxx - create mode 100644 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx - create mode 100644 xmlsecurity/source/xmlsec/nss/nssinitializer.hxx - -diff --git a/package/inc/EncryptedDataHeader.hxx b/package/inc/EncryptedDataHeader.hxx -index 88cdaa5..4e35664 100644 ---- a/package/inc/EncryptedDataHeader.hxx -+++ b/package/inc/EncryptedDataHeader.hxx -@@ -36,6 +36,10 @@ - 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 -@@ -46,8 +50,8 @@ - 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 4dba2e3..1662510 100644 ---- a/package/inc/EncryptionData.hxx -+++ b/package/inc/EncryptionData.hxx -@@ -31,16 +31,54 @@ - #include - #include - --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 229f739..7507ada 100644 ---- a/package/inc/PackageConstants.hxx -+++ b/package/inc/PackageConstants.hxx -@@ -32,7 +32,12 @@ - - 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 -@@ -44,9 +49,22 @@ const sal_Int32 n_ConstDigestLength = 1024; - #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 c64500c..bd108b3 100644 ---- a/package/inc/ZipFile.hxx -+++ b/package/inc/ZipFile.hxx -@@ -32,9 +32,15 @@ - #include - #include - #include -+#include -+#include -+ -+#include -+ - #include - #include - #include -+#include - - #include - -@@ -56,7 +62,6 @@ namespace rtl - - typedef void* rtlCipher; - class ZipEnumeration; --class EncryptionData; - - class ZipFile - { -@@ -69,7 +74,7 @@ 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; -@@ -133,25 +138,41 @@ public: - - 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 ) - 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( -diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx -index b36f4d2..506e913 100644 ---- a/package/inc/ZipOutputStream.hxx -+++ b/package/inc/ZipOutputStream.hxx -@@ -28,39 +28,48 @@ - #ifndef _ZIP_OUTPUT_STREAM_HXX - #define _ZIP_OUTPUT_STREAM_HXX - -+#include -+#include -+#include -+#include -+#include -+ - #include - #include - #include --#include --#include - - #include - - struct ZipEntry; --class EncryptionData; --namespace rtl --{ -- template < class T > class Reference; --} -+class ZipPackageStream; -+ - 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 +84,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 8ea3f60..a4aed11 100644 ---- a/package/inc/ZipPackage.hxx -+++ b/package/inc/ZipPackage.hxx -@@ -36,7 +36,9 @@ - #include - #include - #include -+#include - #include -+#include - #include - #include - #include -@@ -83,13 +85,17 @@ class ZipPackage : public cppu::WeakImplHelper7 - protected: - SotMutexHolderRef m_aMutexHolder; - -+ ::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_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_bUseManifest; - sal_Bool m_bForceRecovery; - - sal_Bool m_bMediaTypeFallbackUsed; -@@ -124,12 +130,17 @@ public: - 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/inc/ZipPackageEntry.hxx b/package/inc/ZipPackageEntry.hxx -new file mode 100644 -index 0000000..18adfdc ---- /dev/null -+++ b/package/inc/ZipPackageEntry.hxx -@@ -0,0 +1,106 @@ -+/* -*- 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef _ZIP_PACKAGE_ENTRY_HXX -+#define _ZIP_PACKAGE_ENTRY_HXX -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+class ZipPackageFolder; -+ -+class ZipPackageEntry : public cppu::WeakImplHelper5 -+< -+ com::sun::star::container::XNamed, -+ com::sun::star::container::XChild, -+ com::sun::star::lang::XUnoTunnel, -+ com::sun::star::beans::XPropertySet, -+ com::sun::star::lang::XServiceInfo -+> -+{ -+protected: -+ ::rtl::OUString msName; -+ bool mbIsFolder:1; -+ bool mbAllowRemoveOnInsert:1; -+ // com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xParent; -+ ::rtl::OUString sMediaType; -+ ZipPackageFolder * pParent; -+public: -+ ZipEntry aEntry; -+ ZipPackageEntry ( bool bNewFolder = sal_False ); -+ virtual ~ZipPackageEntry( void ); -+ -+ ::rtl::OUString & GetMediaType () { return sMediaType; } -+ void SetMediaType ( const ::rtl::OUString & sNewType) { sMediaType = sNewType; } -+ void doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert ); -+ bool IsFolder ( ) { return mbIsFolder; } -+ ZipPackageFolder* GetParent ( ) { return pParent; } -+ void SetFolder ( bool bSetFolder ) { mbIsFolder = bSetFolder; } -+ -+ void clearParent ( void ) -+ { -+ // xParent.clear(); -+ pParent = NULL; -+ } -+ // XNamed -+ virtual ::rtl::OUString SAL_CALL getName( ) -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) -+ throw(::com::sun::star::uno::RuntimeException); -+ // XChild -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) -+ throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); -+ // XUnoTunnel -+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) -+ throw(::com::sun::star::uno::RuntimeException) = 0; -+ // XPropertySet -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; -+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; -+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+}; -+#endif -+ -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx -index c6ace8e..59be1b7 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/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx -new file mode 100644 -index 0000000..a3bbf73 ---- /dev/null -+++ b/package/inc/ZipPackageStream.hxx -@@ -0,0 +1,216 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef _ZIP_PACKAGE_STREAM_HXX -+#define _ZIP_PACKAGE_STREAM_HXX -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+ -+#define PACKAGE_STREAM_NOTSET 0 -+#define PACKAGE_STREAM_PACKAGEMEMBER 1 -+#define PACKAGE_STREAM_DETECT 2 -+#define PACKAGE_STREAM_DATA 3 -+#define PACKAGE_STREAM_RAW 4 -+ -+class ZipPackage; -+struct ZipEntry; -+class ZipPackageStream : public cppu::ImplInheritanceHelper2 -+< -+ ZipPackageEntry, -+ ::com::sun::star::io::XActiveDataSink, -+ ::com::sun::star::packages::XDataSinkEncrSupport -+> -+{ -+protected: -+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream; -+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory; -+ ZipPackage &rZipPackage; -+ sal_Bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted; -+ -+ ::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; -+ sal_uInt32 m_nMagicalHackSize; -+ -+ sal_Bool m_bHasSeekable; -+ -+ sal_Bool m_bCompressedIsSetFromOutside; -+ -+ sal_Bool m_bFromManifest; -+ -+ bool m_bUseWinEncoding; -+ -+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream(); -+ -+public: -+ sal_Bool HasOwnKey () const { return bHaveOwnKey;} -+ sal_Bool IsToBeCompressed () const { return bToBeCompressed;} -+ sal_Bool IsToBeEncrypted () const { return bToBeEncrypted;} -+ sal_Bool IsEncrypted () const { return bIsEncrypted;} -+ sal_Bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;} -+ -+ sal_Bool IsFromManifest() const { return m_bFromManifest; } -+ void SetFromManifest( sal_Bool bValue ) { m_bFromManifest = bValue; } -+ -+ ::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 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 && !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 ) -+ { 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) -+ { m_xBaseEncryptionData->m_nIterationCount = nNewCount;} -+ void setSize (const sal_Int32 nNewSize); -+ -+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; } -+ -+ void CloseOwnStreamIfAny(); -+ -+ ZipPackageStream ( ZipPackage & rNewPackage, -+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory, -+ sal_Bool bAllowRemoveOnInsert ); -+ virtual ~ZipPackageStream( void ); -+ -+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetRawEncrStreamNoHeaderCopy(); -+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > TryToGetRawFromDataStream( -+ sal_Bool bAddHeaderForEncr ); -+ -+ sal_Bool ParsePackageRawStream(); -+ -+ void setZipEntryOnLoading( const ZipEntry &rInEntry); -+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData() -+ throw(::com::sun::star::uno::RuntimeException); -+ -+ static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId(); -+ -+ // XActiveDataSink -+ virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) -+ throw(::com::sun::star::uno::RuntimeException); -+ -+ // XDataSinkEncrSupport -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream() -+ throw ( ::com::sun::star::packages::WrongPasswordException, -+ ::com::sun::star::io::IOException, -+ ::com::sun::star::uno::RuntimeException ); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawStream() -+ throw ( ::com::sun::star::packages::NoEncryptionException, -+ ::com::sun::star::io::IOException, -+ ::com::sun::star::uno::RuntimeException ); -+ virtual void SAL_CALL setDataStream( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -+ throw ( ::com::sun::star::io::IOException, -+ ::com::sun::star::uno::RuntimeException ); -+ virtual void SAL_CALL setRawStream( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -+ throw ( ::com::sun::star::packages::EncryptionNotAllowedException, -+ ::com::sun::star::packages::NoRawFormatException, -+ ::com::sun::star::io::IOException, -+ ::com::sun::star::uno::RuntimeException ); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getPlainRawStream() -+ throw ( ::com::sun::star::io::IOException, -+ ::com::sun::star::uno::RuntimeException ); -+ -+ // XUnoTunnel -+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) -+ throw(::com::sun::star::uno::RuntimeException); -+ -+ // XPropertySet -+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::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); -+}; -+#endif -diff --git a/package/qa/storages/TestHelper.java b/package/qa/storages/TestHelper.java -index 0c1580f..b0b3434 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 1438d86..5dc4ebf 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(pBuffer, nSecondLength); -+ aBuffer = uno::Sequence( reinterpret_cast< sal_Int8* >( pBuffer ), nSecondLength ); - delete[] pBuffer; - } - -diff --git a/package/source/manifest/Base64Codec.hxx b/package/source/manifest/Base64Codec.hxx -index 941c115..60456ad 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& aPass); -- static void decodeBase64(com::sun::star::uno::Sequence& aPass, const rtl::OUString& sBuffer); -+ static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence& aPass); -+ static void decodeBase64(com::sun::star::uno::Sequence& aPass, const rtl::OUString& sBuffer); - }; - #endif - -diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx -index 67159ee..dc9c47e 100644 ---- a/package/source/manifest/ManifestDefines.hxx -+++ b/package/source/manifest/ManifestDefines.hxx -@@ -65,6 +65,26 @@ - #define CHECKSUM_TYPE "SHA1/1K" - #define DERIVED_KEY_SIZE "16" - -+#define SHA256_URL "http://www.w3.org/2001/04/xmlenc#sha256" -+//http://tools.oasis-open.org/issues/browse/OFFICE-3702 -+//http://tools.oasis-open.org/issues/browse/OFFICE-3708 -+#define SHA256_URL_TYPO "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 - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx -index dfdcf2f..bb53541 100644 ---- a/package/source/manifest/ManifestExport.cxx -+++ b/package/source/manifest/ManifestExport.cxx -@@ -239,7 +239,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S - ::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; - Reference < XAttributeList > xNewAttrList (pNewAttrList); - OUStringBuffer aBuffer; -- Sequence < sal_uInt8 > aSequence; -+ Sequence < sal_Int8 > aSequence; - - xHandler->ignorableWhitespace ( sWhiteSpace ); - if ( pDigest ) -diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx -index 2f99d66..abd67d5 100644 ---- a/package/source/manifest/ManifestImport.cxx -+++ b/package/source/manifest/ManifestImport.cxx -@@ -32,6 +32,8 @@ - #include - #include - #include -+#include -+#include - #include - - 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,34 @@ 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 ) ) -+, sSHA256_URL_TYPO ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL_TYPO ) ) -+, 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,43 +168,90 @@ 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 ) -+ { -+ 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]; -- Sequence < sal_uInt8 > aDecodeBuffer; -+ Sequence < sal_Int8 > aDecodeBuffer; - Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); - aSequence[nNumProperty].Name = sDigestProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - } - } - } -+ } - else if ( aIter->m_aConvertedName.equals( sEncryptionDataElement ) ) - { - if ( aConvertedName == sAlgorithmElement ) - { -+ if ( !bIgnoreEncryptData ) -+ { - OUString aString = aConvertedAttribs[sAlgorithmNameAttribute]; -- if ( aString == sBlowfish && !bIgnoreEncryptData ) -+ 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]; -- Sequence < sal_uInt8 > aDecodeBuffer; -+ 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 ) - { -+ if ( !bIgnoreEncryptData ) -+ { - OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute]; -- if ( aString == sPBKDF2 && !bIgnoreEncryptData ) -+ if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) ) - { - aString = aConvertedAttribs[sSaltAttribute]; -- Sequence < sal_uInt8 > aDecodeBuffer; -+ Sequence < sal_Int8 > aDecodeBuffer; - Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); - aSequence[nNumProperty].Name = sSaltProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; -@@ -187,10 +259,40 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re - 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) || aString.equals(sSHA256_URL_TYPO)) -+ { -+ aSequence[nNumProperty].Name = sStartKeyAlgProperty; -+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256; -+ } -+ else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) ) -+ { -+ 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 9655e71..4b92797 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,34 @@ 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 sSHA256_URL_TYPO; -+ 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/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx -index c1c5e8f..03e1776 100644 ---- a/package/source/xstor/owriteablestream.cxx -+++ b/package/source/xstor/owriteablestream.cxx -@@ -47,6 +47,8 @@ - #include - #include - -+#include -+ - #include "selfterminatefilestream.hxx" - #include "owriteablestream.hxx" - #include "oseekinstream.hxx" -@@ -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 ( uno::Exception& aException ) - { -@@ -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 ( uno::Exception& aException ) - { -@@ -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::createFromAscii( 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::createFromAscii( 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::createFromAscii( 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,32 +1323,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod - m_bHasCachedEncryptionData = sal_True; - m_aEncryptionData = aEncryptionData; - } -- catch( 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( packages::WrongPasswordException& aWrongPasswordException ) - { -- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); -+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); - AddLog( aWrongPasswordException.Message ); - AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; -@@ -1310,20 +1336,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod - 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 >() ); -+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); - throw io::IOException(); // TODO: - } - } -- catch( uno::Exception& aException ) -- { -- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); -- -- AddLog( aException.Message ); -- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); -- throw; -- } -- -- } - - 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::createFromAscii( 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( packages::WrongPasswordException& aWrongPasswordException ) -- { -- 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( aWrongPasswordException.Message ); -- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); -- throw; -+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); - } - } - catch( uno::Exception& aException ) - { -- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); -+ OSL_FAIL( "Can't open encrypted stream!" ); -+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); - AddLog( aException.Message ); - AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } -- } -- catch( uno::Exception& aException ) -- { -- OSL_FAIL( "Can't open encrypted stream!\n" ); -- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); -- AddLog( aException.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 ab3c5f3..1eca31c 100644 ---- a/package/source/xstor/xstorage.cxx -+++ b/package/source/xstor/xstorage.cxx -@@ -46,6 +46,7 @@ - #include - #include - -+#include - - #include - #include -@@ -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( packages::NoEncryptionException& aNoEncryptionException ) - { -@@ -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 ( this ) - , static_cast ( this ) -- , static_cast ( this ) ); -+ , static_cast ( this ) -+ , static_cast ( 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( uno::RuntimeException& aRException ) -+ { -+ m_pImpl->AddLog( aRException.Message ); -+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); -+ -+ OSL_FAIL( "The call must not fail, it is pretty simple!" ); -+ throw; -+ } - catch( uno::Exception& aException ) - { - m_pImpl->AddLog( aException.Message ); -@@ -4767,16 +4785,13 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu - 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; -@@ -4792,6 +4807,82 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu - - } - -+//____________________________________________________________________________________________________ -+// 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 >() ); -+ } -+ } -+} - - //____________________________________________________________________________________________________ - // XPropertySet -@@ -4864,13 +4955,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.equalsAscii( HAS_ENCRYPTED_ENTRIES_PROPERTY ) -+ || aPropertyName.equalsAscii( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) -+ || aPropertyName.equalsAscii( 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.equalsAscii( 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 +5035,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.equalsAscii( MEDIATYPE_FALLBACK_USED_PROPERTY ) - || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Version" ) ) ) ) - { - try -@@ -5001,9 +5092,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.equalsAscii( HAS_ENCRYPTED_ENTRIES_PROPERTY ) -+ || aPropertyName.equalsAscii( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) -+ || aPropertyName.equalsAscii( IS_INCONSISTENT_PROPERTY ) ) ) - { - try { - m_pImpl->ReadContents(); -diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx -index 66a626e..46764df 100644 ---- a/package/source/xstor/xstorage.hxx -+++ b/package/source/xstor/xstorage.hxx -@@ -37,7 +37,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -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,11 @@ 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); - - //____________________________________________________________________________________________________ - // XPropertySet -diff --git a/package/source/zipapi/EntryInputStream.cxx b/package/source/zipapi/EntryInputStream.cxx -deleted file mode 100644 -index 00ae61f..0000000 ---- 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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ -- --// MARKER(update_precomp.py): autogen include statement, do not remove --#include "precompiled_package.hxx" --#include --#include --#include --#include --#include // 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 cf1bf5a..0000000 ---- 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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ --#ifndef _ENTRY_INPUT_STREAM_HXX --#define _ENTRY_INPUT_STREAM_HXX -- --#include // helper for implementations --#include --#include --#include --#include --#include --#include --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/XFileStream.cxx b/package/source/zipapi/XFileStream.cxx -deleted file mode 100644 -index 6afe807..0000000 ---- 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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ -- --// MARKER(update_precomp.py): autogen include statement, do not remove --#include "precompiled_package.hxx" --#include --#include --#include --#include --#include --#include --#include --#include -- --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 51518de..0000000 ---- 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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ --#ifndef _XFILE_STREAM_HXX --#define _XFILE_STREAM_HXX -- --#include --#include --#include --#include --#include --#include --#include -- --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 8b737db..0000000 ---- 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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ -- --// MARKER(update_precomp.py): autogen include statement, do not remove --#include "precompiled_package.hxx" --#include -- --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/XMemoryStream.hxx b/package/source/zipapi/XMemoryStream.hxx -deleted file mode 100644 -index e6bc88e..0000000 ---- a/package/source/zipapi/XMemoryStream.hxx -+++ /dev/null -@@ -1,45 +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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ --#ifndef _XMEMORY_STREAM_HXX --#define _XMEMORY_STREAM_HXX -- --#include -- --class ZipPackage; -- --class XMemoryStream: public ZipPackageBuffer --{ --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); --}; --#endif -- --/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx -index 1cad883..bb757e6 100644 ---- a/package/source/zipapi/XUnbufferedStream.cxx -+++ b/package/source/zipapi/XUnbufferedStream.cxx -@@ -32,8 +32,9 @@ - #include - #include - #include -+#include -+ - #include --#include - #include - #include - #include -@@ -48,6 +49,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,7 +57,9 @@ using com::sun::star::lang::IllegalArgumentException; - using com::sun::star::packages::zip::ZipIOException; - using ::rtl::OUString; - --XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder, -+XUnbufferedStream::XUnbufferedStream( -+ const uno::Reference< lang::XMultiServiceFactory >& xFactory, -+ SotMutexHolderRef aMutexHolder, - ZipEntry & rEntry, - Reference < XInputStream > xNewZipStream, - const rtl::Reference < EncryptionData > &rData, -@@ -68,7 +72,7 @@ XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder, - , 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 +95,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 +112,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 +147,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 +160,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 ) -@@ -249,7 +258,12 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa - if ( nDiff > 0 ) - { - mxZipSeek->seek ( mnZipCurrent ); -- sal_Int32 nToRead = std::min ( nDiff, std::max ( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) ) ); -+ -+ 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!" ) ), -@@ -258,23 +272,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 ) -+ { -+ 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 +306,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 5cf7272..aa58ca7 100644 ---- a/package/source/zipapi/XUnbufferedStream.hxx -+++ b/package/source/zipapi/XUnbufferedStream.hxx -@@ -32,6 +32,8 @@ - #include - #include - #include -+#include -+ - #include - #include - #include -@@ -44,7 +46,6 @@ - #define UNBUFF_STREAM_WRAPPEDRAW 2 - - class EncryptionData; --typedef void* rtlCipher; - class XUnbufferedStream : public cppu::WeakImplHelper1 - < - com::sun::star::io::XInputStream -@@ -58,7 +59,8 @@ protected: - com::sun::star::uno::Sequence < sal_Int8 > maCompBuffer, maHeader; - ZipEntry maEntry; - rtl::Reference < EncryptionData > mxData; -- rtlCipher maCipher; -+ 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,6 +70,7 @@ 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, -@@ -78,8 +81,10 @@ public: - 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 2e9576b..fb56c28 100644 ---- a/package/source/zipapi/ZipFile.cxx -+++ b/package/source/zipapi/ZipFile.cxx -@@ -32,11 +32,22 @@ - #include - #include - #include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include - #include - /* - #include - #include - */ -+ -+#include "blowfishcontext.hxx" -+#include "sha1context.hxx" - #include - #include - #include -@@ -47,10 +58,10 @@ - - #include - --#include // for memcpy - #include - - #include -+#define AES_CBC_BLOCK_SIZE 16 - - using namespace com::sun::star; - using namespace com::sun::star::io; -@@ -72,7 +83,7 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe - , aInflater (sal_True) - , xStream(xInput) - , xSeek(xInput, UNO_QUERY) --, xFactory ( xNewFactory ) -+, m_xFactory ( xNewFactory ) - , bRecoveryMode( sal_False ) - { - if (bInitialise) -@@ -93,7 +104,7 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe - , aInflater (sal_True) - , xStream(xInput) - , xSeek(xInput, UNO_QUERY) --, xFactory ( xNewFactory ) -+, m_xFactory ( xNewFactory ) - , xProgressHandler( xProgress ) - , bRecoveryMode( bForceRecovery ) - { -@@ -136,18 +147,18 @@ sal_Bool ZipFile::StaticGetCipher ( const rtl::Reference < EncryptionData > & xE - - // 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 ); -+ 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 ); - - 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()); -+ reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->m_aInitVector.getConstArray() ), -+ xEncryptionData->m_aInitVector.getLength()); - OSL_ASSERT (aResult == rtl_Cipher_E_None); - - bResult = ( aResult == rtl_Cipher_E_None ); -@@ -156,15 +167,85 @@ sal_Bool ZipFile::StaticGetCipher ( const rtl::Reference < EncryptionData > & xE - return bResult; - } - -+uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData ) -+{ -+ uno::Reference< xml::crypto::XDigestContext > xDigestContext; -+ if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA256_1K ) -+ { -+ 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 xDigestContext; -+} -+ -+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::createFromAscii( "Can not create derived key!\n" ), -+ 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::createFromAscii( "Unknown cipher algorithm is requested!\n" ), -+ 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 +259,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 +271,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 +316,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 Reference< XInputStream >& rStream ) - { - sal_Bool bOk = sal_False; - const sal_Int32 nHeaderSize = n_ConstHeaderSize - 4; -@@ -243,13 +356,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 +395,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,7 +420,8 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData, - return bOk; - } - --Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< XInputStream >& xStream, -+Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< lang::XMultiServiceFactory >& xFactory, -+ const Reference< XInputStream >& xStream, - const rtl::Reference < EncryptionData > &rData ) - throw ( packages::WrongPasswordException, ZipIOException, RuntimeException ) - { -@@ -295,7 +429,7 @@ Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< - throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )), - 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 ); -@@ -306,66 +440,72 @@ Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< - - // 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; -+ 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 ); - } - --sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffer, const rtl::Reference < EncryptionData > &rData ) -+sal_Bool ZipFile::StaticHasValidPassword( const 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,8 +513,6 @@ sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffe - else - bRet = sal_True; - -- rtl_digest_destroySHA1 ( aDigest ); -- - return bRet; - } - -@@ -383,18 +521,20 @@ sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const rtl::Reference < E - ::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; - } -@@ -502,7 +642,7 @@ Reference < XInputStream > ZipFile::createUnbufferedStream( - { - ::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 ); - } - - -@@ -512,7 +652,7 @@ ZipEnumeration * SAL_CALL ZipFile::entries( ) - } - - Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry, -- const rtl::Reference < EncryptionData > &rData, -+ const rtl::Reference< EncryptionData > &rData, - sal_Bool bIsEncrypted, - SotMutexHolderRef aMutexHolder ) - throw(IOException, ZipException, RuntimeException) -@@ -529,7 +669,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, -@@ -540,7 +680,7 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry, - } - - Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry, -- const rtl::Reference < EncryptionData > &rData, -+ const rtl::Reference< EncryptionData > &rData, - sal_Bool bIsEncrypted, - SotMutexHolderRef aMutexHolder ) - throw ( packages::WrongPasswordException, -@@ -566,8 +706,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( 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 -- 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 -diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx -index 1d29e17..26c468d 100644 ---- a/package/source/zipapi/ZipOutputStream.cxx -+++ b/package/source/zipapi/ZipOutputStream.cxx -@@ -39,7 +39,9 @@ - #include - - #include -+#include - -+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 +50,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 +83,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 +97,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 +149,12 @@ void SAL_CALL ZipOutputStream::closeEntry( ) - } - else - { -+ 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 +171,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,42 +251,51 @@ 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) -+ 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 ); -+ -+ // the sizes as well as checksum for encrypted streams is calculated here -+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength(); -+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize; - aCRC.update ( aEncryptionBuffer ); -- aEncryptionBuffer.realloc ( nOldLength ); - } - 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) -diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx -new file mode 100644 -index 0000000..1739bb1 ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+// MARKER(update_precomp.py): autogen include statement, do not remove -+#include "precompiled_package.hxx" -+ -+#include -+#include -+ -+#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::createFromAscii( "Can not create cipher!\n" ), -+ 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::createFromAscii( "Can not initialize cipher!\n" ), -+ 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::createFromAscii( "Can not decrypt/encrypt with cipher!\n" ), -+ 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 0000000..49cce2f ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef _BLOWFISHCONTEXT_HXX -+#define _BLOWFISHCONTEXT_HXX -+ -+#include -+ -+#include -+#include -+ -+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 ec8d636..8a07d44 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 0000000..a71f20a ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+// MARKER(update_precomp.py): autogen include statement, do not remove -+#include "precompiled_package.hxx" -+ -+#include -+#include -+ -+#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::createFromAscii( "Can not create cipher!\n" ), -+ 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/sha1context.hxx b/package/source/zipapi/sha1context.hxx -new file mode 100644 -index 0000000..dbd1207 ---- /dev/null -+++ b/package/source/zipapi/sha1context.hxx -@@ -0,0 +1,57 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef _SHA1CONTEXT_HXX -+#define _SHA1CONTEXT_HXX -+ -+#include -+ -+#include -+#include -+ -+class SHA1DigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext > -+{ -+ ::osl::Mutex m_aMutex; -+ void* m_pDigest; -+ -+ SHA1DigestContext() -+ : m_pDigest( NULL ) -+ {} -+ -+public: -+ -+ 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 // _SHA1CONTEXT_HXX -+ -diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx -index 1f1e48a..b4809a0 100644 ---- a/package/source/zippackage/ZipPackage.cxx -+++ b/package/source/zippackage/ZipPackage.cxx -@@ -63,6 +63,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -83,6 +85,7 @@ - #include - #include - #include -+#include - - using namespace std; - using namespace osl; -@@ -181,10 +184,12 @@ class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream > - - 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 -@@ -224,6 +229,7 @@ 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 ) ) - { -@@ -253,6 +259,10 @@ 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() ); - sal_Int32 nLength = aManifestSequence.getLength(); -@@ -264,7 +274,7 @@ void ZipPackage::parseManifest() - { - OUString sPath, sMediaType, sVersion; - const PropertyValue *pValue = pSequence->getConstArray(); -- const Any *pSalt = NULL, *pVector = NULL, *pCount = NULL, *pSize = NULL, *pDigest = NULL; -+ 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 ) ) -@@ -283,6 +293,14 @@ void ZipPackage::parseManifest() - 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 ) ) -@@ -303,10 +321,10 @@ void ZipPackage::parseManifest() - 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; -+ 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; -@@ -321,18 +339,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; -@@ -411,20 +445,30 @@ 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 ); - } - } -@@ -981,14 +1025,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 ), -@@ -1015,19 +1057,20 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence - - // Convert vector into a Sequence - Sequence < Sequence < PropertyValue > > aManifestSequence ( aManList.size() ); -- Sequence < PropertyValue > * pSequence = aManifestSequence.getArray(); -+ sal_Int32 nInd = 0; - for (vector < 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(); - } -@@ -1089,8 +1132,7 @@ 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(); - } -@@ -1154,7 +1196,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() - } - - // Hand it to the ZipOutputStream: -- ZipOutputStream aZipOut ( xTempOut ); -+ ZipOutputStream aZipOut ( m_xFactory, xTempOut ); - aZipOut.setMethod(DEFLATED); - aZipOut.setLevel(DEFAULT_COMPRESSION); - -@@ -1224,12 +1266,12 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() - - // 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 ); - } -@@ -1549,6 +1591,36 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc - makeAny ( aException ) ); - } - -+//-------------------------------------------------------- -+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) - { -@@ -1639,20 +1711,91 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const - 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 >() ); -@@ -1665,32 +1808,41 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName ) - // 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 ( "UseManifest" ) ) ) -+ else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) ) ) - { -- aAny <<= m_bUseManifest; -+ aAny <<= m_bHasNonEncryptedEntries; -+ return aAny; -+ } -+ else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( IS_INCONSISTENT_PROPERTY ) ) ) -+ { -+ 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; -diff --git a/package/source/zippackage/ZipPackageEntry.hxx b/package/source/zippackage/ZipPackageEntry.hxx -deleted file mode 100644 -index eef9dd9..0000000 ---- a/package/source/zippackage/ZipPackageEntry.hxx -+++ /dev/null -@@ -1,106 +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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ --#ifndef _ZIP_PACKAGE_ENTRY_HXX --#define _ZIP_PACKAGE_ENTRY_HXX -- --#include --#include --#include --#include --#include --#include --#include --#include -- --class ZipPackageFolder; -- --class ZipPackageEntry : public cppu::WeakImplHelper5 --< -- com::sun::star::container::XNamed, -- com::sun::star::container::XChild, -- com::sun::star::lang::XUnoTunnel, -- com::sun::star::beans::XPropertySet, -- com::sun::star::lang::XServiceInfo --> --{ --protected: -- ::rtl::OUString msName; -- bool mbIsFolder:1; -- bool mbAllowRemoveOnInsert:1; -- // com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xParent; -- ::rtl::OUString sMediaType; -- ZipPackageFolder * pParent; --public: -- ZipEntry aEntry; -- ZipPackageEntry ( bool bNewFolder = sal_False ); -- virtual ~ZipPackageEntry( void ); -- -- ::rtl::OUString & GetMediaType () { return sMediaType; } -- void SetMediaType ( const ::rtl::OUString & sNewType) { sMediaType = sNewType; } -- void doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert ); -- bool IsFolder ( ) { return mbIsFolder; } -- ZipPackageFolder* GetParent ( ) { return pParent; } -- void SetFolder ( bool bSetFolder ) { mbIsFolder = bSetFolder; } -- -- void clearParent ( void ) -- { -- // xParent.clear(); -- pParent = NULL; -- } -- // XNamed -- virtual ::rtl::OUString SAL_CALL getName( ) -- throw(::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL setName( const ::rtl::OUString& aName ) -- throw(::com::sun::star::uno::RuntimeException); -- // XChild -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) -- throw(::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) -- throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); -- // XUnoTunnel -- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) -- throw(::com::sun::star::uno::RuntimeException) = 0; -- // XPropertySet -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) -- throw(::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; -- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0; -- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); --}; --#endif -- --/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx -index c412af1..534488d 100644 ---- a/package/source/zippackage/ZipPackageFolder.cxx -+++ b/package/source/zippackage/ZipPackageFolder.cxx -@@ -305,7 +305,7 @@ 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 OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool) - { - bool bSuccess = true; - -@@ -317,6 +317,10 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo - const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) ); - const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) ); - const 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" ) ); - - Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST); - -@@ -450,7 +454,6 @@ 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; - } -@@ -458,7 +461,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo - } - catch ( Exception& ) - { -- OSL_FAIL( "The stream provided to the package component has problems!" ); - bSuccess = false; - return bSuccess; - } -@@ -467,9 +469,9 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo - { - if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw ) - { -- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 ); -+ 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 +500,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 +534,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,7 +544,7 @@ 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(); - -@@ -549,12 +562,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 +587,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,7 +600,7 @@ 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(); - -@@ -607,19 +617,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,7 +686,7 @@ 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) -+void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool ) - throw(RuntimeException) - { - bool bWritingFailed = false; -@@ -681,18 +702,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; - } - } -diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx -index ce72beb..424053c 100644 ---- a/package/source/zippackage/ZipPackageStream.cxx -+++ b/package/source/zippackage/ZipPackageStream.cxx -@@ -35,6 +35,8 @@ - #include - #include - #include -+#include -+#include - - - #include -@@ -75,13 +77,17 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage, - , 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" ); - -@@ -138,7 +144,7 @@ void ZipPackageStream::CloseOwnStreamIfAny() - } - - //-------------------------------------------------------------------------- --uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream() -+uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream() - { - if ( !m_bHasSeekable && xStream.is() ) - { -@@ -164,7 +170,7 @@ 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 >() ); - -@@ -174,8 +180,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop - 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,6 +201,85 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop - } - - //-------------------------------------------------------------------------- -+sal_Int32 ZipPackageStream::GetEncryptionAlgorithm() const -+{ -+ 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(); -+} -+ -+//-------------------------------------------------------------------------- - Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr ) - { - if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || (bAddHeaderForEncr && !bToBeEncrypted) ) -@@ -204,8 +289,7 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B - - 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 >() ); - } -@@ -246,7 +330,7 @@ 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 ) ); - } - -@@ -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; -@@ -385,10 +477,11 @@ void ZipPackageStream::SetPackageMember( sal_Bool bNewValue ) - // XActiveDataSink - //-------------------------------------------------------------------------- - void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStream >& aStream ) -- throw(RuntimeException) -+ 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; -@@ -397,15 +490,13 @@ void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStrea - - //-------------------------------------------------------------------------- - Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData() -- throw(RuntimeException) -+ throw( RuntimeException ) - { - try - { - 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() ) - { -@@ -434,9 +525,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( ) - { - 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() ) - { -@@ -459,7 +548,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( ) - - // XDataSinkEncrSupport - //-------------------------------------------------------------------------- --Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() -+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() - throw ( packages::WrongPasswordException, - io::IOException, - RuntimeException ) -@@ -472,18 +561,28 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() - 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 ( 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() ); -@@ -508,10 +607,10 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream() - - 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 ) - { -@@ -541,7 +640,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream - 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 ); -@@ -582,7 +681,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( - - if (IsPackageMember()) - { -- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() ); -+ return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() ); - } - else if ( GetOwnSeekStream().is() ) - { -@@ -660,8 +759,8 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, - 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" ) ), -@@ -669,7 +768,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, - 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 >() ); -@@ -685,8 +784,8 @@ 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 -@@ -697,19 +796,57 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, - - if ( aNewKey.getLength() ) - { -- if ( !xEncryptionData.is()) -- xEncryptionData = new EncryptionData; -+ if ( !m_xBaseEncryptionData.is() ) -+ m_xBaseEncryptionData = new BaseEncryptionData; - -- xEncryptionData->aKey = aNewKey; -+ 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 ); - } -- else if (aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) ) -+ -+ 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; -+ -+ // 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" ) ) ) - { - sal_Bool bCompr = sal_False; - -@@ -763,9 +900,14 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName ) - 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 -diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/source/zippackage/ZipPackageStream.hxx -deleted file mode 100644 -index 321e385..0000000 ---- a/package/source/zippackage/ZipPackageStream.hxx -+++ /dev/null -@@ -1,196 +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 -- * -- * for a copy of the LGPLv3 License. -- * -- ************************************************************************/ --#ifndef _ZIP_PACKAGE_STREAM_HXX --#define _ZIP_PACKAGE_STREAM_HXX -- --#include --#include --#include --#include --#include --#include --#include --#include -- --#define PACKAGE_STREAM_NOTSET 0 --#define PACKAGE_STREAM_PACKAGEMEMBER 1 --#define PACKAGE_STREAM_DETECT 2 --#define PACKAGE_STREAM_DATA 3 --#define PACKAGE_STREAM_RAW 4 -- --class ZipPackage; --struct ZipEntry; --class ZipPackageStream : public cppu::ImplInheritanceHelper2 --< -- ZipPackageEntry, -- ::com::sun::star::io::XActiveDataSink, -- ::com::sun::star::packages::XDataSinkEncrSupport --> --{ --protected: -- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream; -- 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; -- -- sal_uInt8 m_nStreamMode; -- sal_uInt32 m_nMagicalHackPos; -- sal_uInt32 m_nMagicalHackSize; -- -- sal_Bool m_bHasSeekable; -- -- sal_Bool m_bCompressedIsSetFromOutside; -- -- sal_Bool m_bFromManifest; -- -- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& GetOwnSeekStream(); -- --public: -- sal_Bool HasOwnKey () const { return bHaveOwnKey;} -- sal_Bool IsToBeCompressed () const { return bToBeCompressed;} -- sal_Bool IsToBeEncrypted () const { return bToBeEncrypted;} -- sal_Bool IsEncrypted () const { return bIsEncrypted;} -- sal_Bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;} -- -- 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;} -- sal_Int32 getIterationCount () const -- { return xEncryptionData->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; } -- -- void SetToBeCompressed (sal_Bool bNewValue) { bToBeCompressed = bNewValue;} -- void SetIsEncrypted (sal_Bool bNewValue) { bIsEncrypted = bNewValue;} -- void SetToBeEncrypted (sal_Bool bNewValue) -- { -- bToBeEncrypted = bNewValue; -- if ( bToBeEncrypted && !xEncryptionData.is()) -- xEncryptionData = new EncryptionData; -- else if ( !bToBeEncrypted && xEncryptionData.is() ) -- xEncryptionData.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;} -- void setIterationCount (const sal_Int32 nNewCount) -- { xEncryptionData->nIterationCount = nNewCount;} -- void setSize (const sal_Int32 nNewSize); -- -- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; } -- -- void CloseOwnStreamIfAny(); -- -- ZipPackageStream ( ZipPackage & rNewPackage, -- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory, -- sal_Bool bAllowRemoveOnInsert ); -- virtual ~ZipPackageStream( void ); -- -- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetRawEncrStreamNoHeaderCopy(); -- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > TryToGetRawFromDataStream( -- sal_Bool bAddHeaderForEncr ); -- -- sal_Bool ParsePackageRawStream(); -- -- void setZipEntryOnLoading( const ZipEntry &rInEntry); -- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData() -- throw(::com::sun::star::uno::RuntimeException); -- -- static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId(); -- -- // XActiveDataSink -- virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -- throw(::com::sun::star::uno::RuntimeException); -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) -- throw(::com::sun::star::uno::RuntimeException); -- -- // XDataSinkEncrSupport -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream() -- throw ( ::com::sun::star::packages::WrongPasswordException, -- ::com::sun::star::io::IOException, -- ::com::sun::star::uno::RuntimeException ); -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawStream() -- throw ( ::com::sun::star::packages::NoEncryptionException, -- ::com::sun::star::io::IOException, -- ::com::sun::star::uno::RuntimeException ); -- virtual void SAL_CALL setDataStream( -- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -- throw ( ::com::sun::star::io::IOException, -- ::com::sun::star::uno::RuntimeException ); -- virtual void SAL_CALL setRawStream( -- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) -- throw ( ::com::sun::star::packages::EncryptionNotAllowedException, -- ::com::sun::star::packages::NoRawFormatException, -- ::com::sun::star::io::IOException, -- ::com::sun::star::uno::RuntimeException ); -- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getPlainRawStream() -- throw ( ::com::sun::star::io::IOException, -- ::com::sun::star::uno::RuntimeException ); -- -- // XUnoTunnel -- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) -- throw(::com::sun::star::uno::RuntimeException); -- -- // XPropertySet -- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) -- throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::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); --}; --#endif -- --/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx -index d0dc59f..60b148a 100644 ---- a/package/source/zippackage/zipfileaccess.cxx -+++ b/package/source/zippackage/zipfileaccess.cxx -@@ -41,6 +41,7 @@ - #include - - #include -+#include - - #include - -@@ -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/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx -index b90052a..4e0ad63 100644 ---- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx -+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx -@@ -134,7 +134,7 @@ public: - ~DigitalSignaturesDialog(); - - // Initialize the dialog and the security environment, returns sal_True on success -- sal_Bool Init( const rtl::OUString& rTokenName ); -+ 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 7401f23..eae0ce8 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. -+ // Initialize the security context with default crypto token. - // Returns true for success. -- bool Init( const rtl::OUString& rTokenPath ); -+ bool Init(); - - // Set UriBinding to create input streams to open files. - // Default implementation is capable to open files from disk. -diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx -index 8032883..f53acb4 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!" ); - -diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx -index 8a45f41..17ab79c 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/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx -index 7673bd2..0959e11 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(); - } -diff --git a/xmlsecurity/source/xmlsec/makefile.mk b/xmlsecurity/source/xmlsec/makefile.mk -index 44b668b..36b30f4 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/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx -new file mode 100644 -index 0000000..93a17e3 ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+#include -+ -+#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 0000000..1574a62 ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#ifndef _CIPHERCONTEXT_HXX -+#define _CIPHERCONTEXT_HXX -+ -+#include -+ -+#include -+#include -+#include -+ -+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 0000000..4b3a0d0 ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#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/xmlsecurity/source/xmlsec/nss/digestcontext.hxx b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx -new file mode 100644 -index 0000000..8f9ef47 ---- /dev/null -+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx -@@ -0,0 +1,68 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#ifndef _DIGESTCONTEXT_HXX -+#define _DIGESTCONTEXT_HXX -+ -+#include -+ -+#include -+#include -+ -+class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext > -+{ -+private: -+ ::osl::Mutex m_aMutex; -+ -+ PK11Context* m_pContext; -+ sal_Int32 m_nDigestLength; -+ bool m_b1KData; -+ sal_Int32 m_nDigested; -+ -+ 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 ) -+ {} -+ -+ virtual ~ODigestContext(); -+ -+ -+ // 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 -+ -diff --git a/xmlsecurity/source/xmlsec/nss/makefile.mk b/xmlsecurity/source/xmlsec/nss/makefile.mk -index de6a059..0875de9 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,13 +107,19 @@ 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)$/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 - - -diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx -new file mode 100644 -index 0000000..ded3295 ---- /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 -+ * -+ * 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 -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "seinitializer_nssimpl.hxx" -+#include "../diagnose.hxx" -+ -+#include "securityenvironment_nssimpl.hxx" -+#include "digestcontext.hxx" -+#include "ciphercontext.hxx" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+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 xInstance = rxMSF->createInstance( -+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); -+ OSL_ENSURE( xInstance.is(), "failed to create instance" ); -+ -+ uno::Reference xMozillaBootstrap -+ = uno::Reference(xInstance,uno::UNO_QUERY); -+ OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" ); -+ -+ if (xMozillaBootstrap.is()) -+ { -+ for (int i=0; igetDefaultProfile(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(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 0000000..6e7fed1 ---- /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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#ifndef _NSSINITIALIZER_HXX -+#define _NSSINITIALIZER_HXX -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#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/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx -index f184600..c1573e8 100644 ---- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx -+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx -@@ -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; -+ } - }; - - -@@ -868,14 +890,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 b9041e2..18dadf0 100644 ---- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx -+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx -@@ -52,7 +52,6 @@ - - - #include --#include "rtl/instance.hxx" - #include "rtl/bootstrap.hxx" - #include "rtl/string.hxx" - #include "rtl/strbuf.hxx" -@@ -62,327 +61,34 @@ - #include - - #include "seinitializer_nssimpl.hxx" --#include "../diagnose.hxx" -- - #include "securityenvironment_nssimpl.hxx" --#include - --#include "nspr.h" --#include "cert.h" --#include "nss.h" --#include "secmod.h" --#include "nssckbi.h" -+#include -+#include -+#include -+#include -+#include -+#include - - --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(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 xInstance = rxMSF->createInstance( -- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) ); -- OSL_ENSURE( xInstance.is(), "failed to create instance" ); -- -- uno::Reference xMozillaBootstrap -- = uno::Reference(xInstance,uno::UNO_QUERY); -- OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" ); -- -- if (xMozillaBootstrap.is()) -- { -- int nProduct = 4; -- for (int i=0; igetDefaultProfile(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 53e5129..2092b92 100644 ---- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx -+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx -@@ -31,37 +31,19 @@ - - #include - #include --#include --#include --#include --#include -+ -+#include - - #include - --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); - virtual ~SEInitializer_NssImpl(); -@@ -69,7 +51,7 @@ public: - /* XSEInitializer */ - virtual com::sun::star::uno::Reference< - com::sun::star::xml::crypto::XXMLSecurityContext > -- SAL_CALL createSecurityContext( const rtl::OUString& certDB ) -+ SAL_CALL createSecurityContext( const ::rtl::OUString& ) - throw (com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL freeSecurityContext( const com::sun::star::uno::Reference< -diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx -index 71a0221..93c9839 100644 ---- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx -+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx -@@ -120,13 +120,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 +149,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 { -diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx -index a226d96..7b2fbd0 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/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx -index 1eeec66..935f0d6 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* ); -@@ -141,11 +139,9 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplName , void* pServiceM - 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/util/makefile.mk b/xmlsecurity/util/makefile.mk -index ff5a952..be64450 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,6 +118,8 @@ SHL2STDLIBS += $(MOZ_NSS_LIBS) - - .IF "$(CRYPTO_ENGINE)" == "mscrypto" - SHL2STDLIBS+= $(MSCRYPTOLIBS) -+# SHL2STDLIBS+= $(XMLSECLIB) $(LIBXML2LIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB) -+SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB) - .ELSE - SHL2STDLIBS+= $(NSSCRYPTOLIBS) - .ENDIF -@@ -127,10 +129,10 @@ 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 de99189..df4c2a7 100644 ---- a/xmlsecurity/util/xsec_xmlsec.component -+++ b/xmlsecurity/util/xsec_xmlsec.component -@@ -32,6 +32,7 @@ - - - -+ - - - -diff --git a/xmlsecurity/util/xsec_xmlsec.windows.component b/xmlsecurity/util/xsec_xmlsec.windows.component -index fb11cc6..7b4ef87 100644 ---- a/xmlsecurity/util/xsec_xmlsec.windows.component -+++ b/xmlsecurity/util/xsec_xmlsec.windows.component -@@ -31,6 +31,9 @@ - - - -+ -+ -+ - - - --- -1.7.6.4 - -From 670427a194e3676f2c49a907ec47b43dc5cbbdae Mon Sep 17 00:00:00 2001 -From: Stephan Bergmann -Date: Wed, 9 Nov 2011 08:37:56 +0100 -Subject: [PATCH] Backport reading AES-encrypted ODF 1.2 documents (as - genereated by LibO 3.5). - -This backports the reading half of CWS mav60 plus "Produce -correct sha256 uri, consume correct uri and original spec typo." It spans the -repos components, libs-core, libs-gui, and ure. ---- - sfx2/source/appl/appopen.cxx | 5 +++-- - 1 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx -index 6ec4645..84f0cef 100644 ---- a/sfx2/source/appl/appopen.cxx -+++ b/sfx2/source/appl/appopen.cxx -@@ -288,8 +288,9 @@ private: - } - catch( const uno::Exception& ) - { -- // unknown error, do not try to ask again -- eResult = ::comphelper::DocPasswordVerifierResult_ABORT; -+ // unknown error, report it as wrong password -+ // TODO/LATER: we need an additional way to report unknown problems in this case -+ eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; - } - return eResult; - } --- -1.7.6.4 - -From 467dcc484a6782ffaa2bbb4cc059a68150a4298e Mon Sep 17 00:00:00 2001 -From: Stephan Bergmann -Date: Wed, 9 Nov 2011 08:38:58 +0100 -Subject: [PATCH] Backport reading AES-encrypted ODF 1.2 documents (as - genereated by LibO 3.5). - -This backports the reading half of CWS mav60 plus "Produce -correct sha256 uri, consume correct uri and original spec typo." It spans the -repos components, libs-core, libs-gui, and ure. ---- - comphelper/inc/comphelper/storagehelper.hxx | 1 + - comphelper/source/misc/storagehelper.cxx | 37 +++++++++++++++++++++++--- - 2 files changed, 33 insertions(+), 5 deletions(-) - -diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx -index 2f83331..807c6dd 100644 ---- a/comphelper/inc/comphelper/storagehelper.hxx -+++ b/comphelper/inc/comphelper/storagehelper.hxx -@@ -45,6 +45,7 @@ - #define ZIP_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZipFormat" ) ) - #define OFOPXML_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ) - -+#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA256UTF8EncryptionKey" ) ) - #define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1UTF8EncryptionKey" ) ) - #define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1MS1252EncryptionKey" ) ) - -diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx -index f703cd3..112ddf1 100644 ---- a/comphelper/source/misc/storagehelper.cxx -+++ b/comphelper/source/misc/storagehelper.cxx -@@ -35,6 +35,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - -@@ -427,14 +430,38 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( - { - // TODO/LATER: Should not the method be part of DocPasswordHelper? - uno::Sequence< beans::NamedValue > aEncryptionData; -+ sal_Int32 nSha1Ind = 0; - if ( aPassword.getLength() ) - { -+ // generate SHA256 start key -+ try -+ { -+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); -+ if ( !xFactory.is() ) -+ throw uno::RuntimeException(); -+ -+ uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ), uno::UNO_QUERY_THROW ); -+ uno::Reference< xml::crypto::XDigestContext > xDigestContext( xDigestContextSupplier->getDigestContext( xml::crypto::DigestID::SHA256, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW ); -+ -+ ::rtl::OString aUTF8Password( ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ) ); -+ xDigestContext->updateDigest( uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aUTF8Password.getStr() ), aUTF8Password.getLength() ) ); -+ uno::Sequence< sal_Int8 > aDigest = xDigestContext->finalizeDigestAndDispose(); -+ -+ aEncryptionData.realloc( ++nSha1Ind ); -+ aEncryptionData[0].Name = PACKAGE_ENCRYPTIONDATA_SHA256UTF8; -+ aEncryptionData[0].Value <<= aDigest; -+ } -+ catch ( uno::Exception& ) -+ { -+ OSL_ENSURE( false, "Can not create SHA256 digest!" ); -+ } -+ - // MS_1252 encoding was used for SO60 document format password encoding, - // this encoding supports only a minor subset of nonascii characters, - // but for compatibility reasons it has to be used for old document formats -- aEncryptionData.realloc( 2 ); -- aEncryptionData[0].Name = PACKAGE_ENCRYPTIONDATA_SHA1UTF8; -- aEncryptionData[1].Name = PACKAGE_ENCRYPTIONDATA_SHA1MS1252; -+ aEncryptionData.realloc( nSha1Ind + 2 ); -+ aEncryptionData[nSha1Ind].Name = PACKAGE_ENCRYPTIONDATA_SHA1UTF8; -+ aEncryptionData[nSha1Ind + 1].Name = PACKAGE_ENCRYPTIONDATA_SHA1MS1252; - - rtl_TextEncoding pEncoding[2] = { RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_MS_1252 }; - -@@ -450,11 +477,11 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( - - if ( nError != rtl_Digest_E_None ) - { -- aEncryptionData.realloc( 0 ); -+ aEncryptionData.realloc( nSha1Ind ); - break; - } - -- aEncryptionData[nInd].Value <<= uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); -+ aEncryptionData[nSha1Ind+nInd].Value <<= uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); - } - } - --- -1.7.6.4 - -From cb66db96806b506caa6e1e804c864efbb14e5a91 Mon Sep 17 00:00:00 2001 -From: Stephan Bergmann -Date: Wed, 9 Nov 2011 08:35:42 +0100 -Subject: [PATCH] Backport reading AES-encrypted ODF 1.2 documents (as - genereated by LibO 3.5). - -This backports the reading half of CWS mav60 plus "Produce -correct sha256 uri, consume correct uri and original spec typo." It spans the -repos components, libs-core, libs-gui, and ure. ---- - .../sun/star/embed/XEncryptionProtectedStorage.idl | 118 ++++++++++++++++++++ - offapi/com/sun/star/embed/makefile.mk | 1 + - offapi/com/sun/star/xml/crypto/CipherID.idl | 59 ++++++++++ - offapi/com/sun/star/xml/crypto/DigestID.idl | 71 ++++++++++++ - offapi/com/sun/star/xml/crypto/SEInitializer.idl | 4 + - offapi/com/sun/star/xml/crypto/XCipherContext.idl | 88 +++++++++++++++ - .../sun/star/xml/crypto/XCipherContextSupplier.idl | 91 +++++++++++++++ - offapi/com/sun/star/xml/crypto/XDigestContext.idl | 73 ++++++++++++ - .../sun/star/xml/crypto/XDigestContextSupplier.idl | 82 ++++++++++++++ - offapi/com/sun/star/xml/crypto/makefile.mk | 6 + - 10 files changed, 593 insertions(+), 0 deletions(-) - create mode 100644 offapi/com/sun/star/embed/XEncryptionProtectedStorage.idl - create mode 100644 offapi/com/sun/star/xml/crypto/CipherID.idl - create mode 100644 offapi/com/sun/star/xml/crypto/DigestID.idl - create mode 100644 offapi/com/sun/star/xml/crypto/XCipherContext.idl - create mode 100644 offapi/com/sun/star/xml/crypto/XCipherContextSupplier.idl - create mode 100644 offapi/com/sun/star/xml/crypto/XDigestContext.idl - create mode 100644 offapi/com/sun/star/xml/crypto/XDigestContextSupplier.idl - -diff --git a/offapi/com/sun/star/embed/XEncryptionProtectedStorage.idl b/offapi/com/sun/star/embed/XEncryptionProtectedStorage.idl -new file mode 100644 -index 0000000..91f1199 ---- /dev/null -+++ b/offapi/com/sun/star/embed/XEncryptionProtectedStorage.idl -@@ -0,0 +1,118 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_embed_XEncryptionProtectedStorage_idl__ -+#define __com_sun_star_embed_XEncryptionProtectedStorage_idl__ -+ -+#ifndef __com_sun_star_embed_XEncryptionProtectedSource2_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_beans_NamedValue_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_xml_crypto_DigestID_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_xml_crypto_CipherID_idl__ -+#include -+#endif -+ -+//============================================================================ -+ -+module com { module sun { module star { module embed { -+ -+//============================================================================ -+/** This interface allows to set a password for an object. -+ -+ This unpublished interface was introduced into a micro update of -+ LibreOffice 3.4; it is unclear in what exact form it will be included in -+ LibreOffice 3.5. A corresponding OOo interface (which is also unpublished) -+ is scheduled for inclusion into OOo 3.4 and contains an additional -+ getEncryptionAlgorithms method. -+ */ -+interface XEncryptionProtectedStorage: XEncryptionProtectedSource2 -+{ -+ // ----------------------------------------------------------------------- -+ /** allows to set the encryption algorithms for the object. -+

-+ The algorithms will of course be used only for streams that have been -+ marked to be encrypted. If no stream in the storage is marked to be -+ encrypted, the algorithms-related information may have no effect to -+ the result package. -+

-+ -+

-+ The following values could be part of the provided sequence: -+

-+
-+
StartKeyGenerationAlgorithm
-+
-+ specifies the algorithm that was used to generate -+ the EncryptionKey from the original password; in case -+ the contents should be decrypted, the algorithm might -+ be already known by the object; if a different one is -+ set an exception should be thrown to indicate the -+ error; it should take values from -+ DigestID. -+
-+
EncryptionAlgorithm
-+
-+ specifies the algorithm that should be used to -+ encrypt/decrypt the contents; in case the contents -+ should be decrypted, the algorithm might be already -+ known by the object; if a different one is set -+ an exception should be thrown to indicate the error; -+ it should take values from -+ CipherID. -+
-+
ChecksumAlgorithm
-+
-+ specifies the algorithm that was used to generate -+ the checksum of the encrypted data; in case -+ the contents should be decrypted, the algorithm might -+ be already known by the object; if a different one is -+ set an exception should be thrown to indicate the -+ error; it should take values from -+ DigestID. -+
-+
-+ */ -+ void setEncryptionAlgorithms( [in] sequence< ::com::sun::star::beans::NamedValue > aAlgorithms ) -+ raises( ::com::sun::star::lang::IllegalArgumentException ); -+}; -+ -+//============================================================================ -+ -+}; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/embed/makefile.mk b/offapi/com/sun/star/embed/makefile.mk -index 8ee156a..c142086 100644 ---- a/offapi/com/sun/star/embed/makefile.mk -+++ b/offapi/com/sun/star/embed/makefile.mk -@@ -78,6 +78,7 @@ IDLFILES=\ - XLinkFactory.idl\ - XEncryptionProtectedSource.idl\ - XEncryptionProtectedSource2.idl\ -+ XEncryptionProtectedStorage.idl\ - XInplaceClient.idl\ - XInsertObjectDialog.idl\ - XWindowSupplier.idl\ -diff --git a/offapi/com/sun/star/xml/crypto/CipherID.idl b/offapi/com/sun/star/xml/crypto/CipherID.idl -new file mode 100644 -index 0000000..a59c034 ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/CipherID.idl -@@ -0,0 +1,59 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_CipherID_idl__ -+#define __com_sun_star_xml_crypto_CipherID_idl__ -+ -+ -+//============================================================================ -+ -+module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** The constant set contains identifiers of supported cipher-creation -+ algorithms. -+ -+ @see XCipherContextSupplier -+ @since OOo 3.4 -+*/ -+constants CipherID -+{ -+ //------------------------------------------------------------------------ -+ /** identifier of AES algorithm in CBC mode with W3C padding -+ */ -+ const long AES_CBC_W3C_PADDING = 1; -+ -+ //------------------------------------------------------------------------ -+ /** identifier of the Blowfish algorithm in 8-bit CFB mode -+ */ -+ const long BLOWFISH_CFB_8 = 2; -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/DigestID.idl b/offapi/com/sun/star/xml/crypto/DigestID.idl -new file mode 100644 -index 0000000..bd2c61c ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/DigestID.idl -@@ -0,0 +1,71 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_DigestID_idl__ -+#define __com_sun_star_xml_crypto_DigestID_idl__ -+ -+ -+//============================================================================ -+ -+module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** The constant set contains identifiers of supported digest-creation -+ algorithms. -+ -+ @see XDigestContextSupplier -+ @since OOo 3.4 -+*/ -+constants DigestID -+{ -+ //------------------------------------------------------------------------ -+ /** identifier of SHA-1 algorithm -+ */ -+ const long SHA1 = 1; -+ -+ //------------------------------------------------------------------------ -+ /** identifier of SHA-256 algorithm -+ */ -+ const long SHA256 = 2; -+ -+ //------------------------------------------------------------------------ -+ /** identifier of SHA-1 algorithm that is applied to the first kilobyte -+ of data. -+ */ -+ const long SHA1_1K = 3; -+ -+ //------------------------------------------------------------------------ -+ /** identifier of SHA-256 algorithm that is applied to the first kilobyte -+ of data. -+ */ -+ const long SHA256_1K = 4; -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/SEInitializer.idl b/offapi/com/sun/star/xml/crypto/SEInitializer.idl -index beec5ef..5a9ff7d 100644 ---- a/offapi/com/sun/star/xml/crypto/SEInitializer.idl -+++ b/offapi/com/sun/star/xml/crypto/SEInitializer.idl -@@ -36,6 +36,8 @@ - #include - - #include -+#include -+#include - - #include - -@@ -46,6 +48,8 @@ module com { module sun { module star { module xml { module crypto { - */ - service SEInitializer { - interface com::sun::star::xml::crypto::XSEInitializer ; -+ interface ::com::sun::star::xml::crypto::XDigestContextSupplier; -+ interface ::com::sun::star::xml::crypto::XCipherContextSupplier; - interface com::sun::star::lang::XServiceInfo ; - }; - -diff --git a/offapi/com/sun/star/xml/crypto/XCipherContext.idl b/offapi/com/sun/star/xml/crypto/XCipherContext.idl -new file mode 100644 -index 0000000..fb84139 ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/XCipherContext.idl -@@ -0,0 +1,88 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_xciphercontext_idl_ -+#define __com_sun_star_xml_crypto_xciphercontext_idl_ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_DisposedException_idl__ -+#include -+#endif -+ -+//============================================================================ -+ -+ module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** This interface allows to encrypt/decrypt data using the cipher context. -+

-+ The algorithm as well as encryption data are specified on object creation. -+

-+ -+ @see XCipherContextSupplier -+ @since OOo 3.4 -+ */ -+interface XCipherContext : com::sun::star::uno::XInterface -+{ -+ //------------------------------------------------------------------------ -+ /** encrypts/decrypts the data using the cipher. -+

-+ Please have in mind, the cipher object state might depend from the -+ already encrypted/decrypted data ( it depends from the used -+ algorithm ). -+

-+ -+

-+ Whether the object does encryption or decryption is specified by -+ creation of the object. -+

-+ -+ @param aData -+ data that should be encrypted/decrypted -+ */ -+ sequence convertWithCipherContext( [in] sequence< byte > aData ) -+ raises( ::com::sun::star::lang::IllegalArgumentException, -+ ::com::sun::star::lang::DisposedException ); -+ -+ //------------------------------------------------------------------------ -+ /** finalizes cipher and disposes context. -+ */ -+ sequence finalizeCipherContextAndDispose() -+ raises( ::com::sun::star::lang::DisposedException ); -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/XCipherContextSupplier.idl b/offapi/com/sun/star/xml/crypto/XCipherContextSupplier.idl -new file mode 100644 -index 0000000..115cf7b ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/XCipherContextSupplier.idl -@@ -0,0 +1,91 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_xciphercontextsupplier_idl_ -+#define __com_sun_star_xml_crypto_xciphercontextsupplier_idl_ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_beans_NamedValue_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_xml_crypto_XCipherContext_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -+#include -+#endif -+ -+//============================================================================ -+ -+ module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** This interface allows to get an object that allows to encrypt/decrypt data -+ using the specified algorithm. -+ -+ @since OOo 3.4 -+ */ -+interface XCipherContextSupplier : com::sun::star::uno::XInterface -+{ -+ //------------------------------------------------------------------------ -+ /** returns an object that allows to encrypt/decrypt data. -+ -+ @param nCipherID -+ the internal ID specifying the algorithm, -+ should take value from CipherID -+ -+ @param aKey -+ the key that should be used for the encryption -+ -+ @param aInitializationVector -+ the initialization vector that should be used for the encryption -+ -+ @param bEncryption -+ whether an encryption or decryption cipher should be created -+ - Encryption -+ - Decryption -+ -+ @param aParams -+ optional parameters that could be used to initialize the cipher, -+ -+ @throws ::com::sun::star::lang::IllegalArgumentException -+ one of provided arguments is illegal -+ */ -+ -+ XCipherContext getCipherContext( [in] long nCipherID, [in] sequence< byte > aKey, [in] sequence< byte > aInitializationVector, [in] boolean bEncryption, [in] sequence< ::com::sun::star::beans::NamedValue > aParams ) -+ raises( ::com::sun::star::lang::IllegalArgumentException ); -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/XDigestContext.idl b/offapi/com/sun/star/xml/crypto/XDigestContext.idl -new file mode 100644 -index 0000000..36c1d99 ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/XDigestContext.idl -@@ -0,0 +1,73 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_xdigestcontext_idl_ -+#define __com_sun_star_xml_crypto_xdigestcontext_idl_ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_DisposedException_idl__ -+#include -+#endif -+ -+//============================================================================ -+ -+ module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** This interface allows to generate the digest. -+

-+ The algorithm to generate the digest is specified on object creation. -+

-+ -+ @see XDigestContextSupplier -+ @since OOo 3.4 -+ */ -+interface XDigestContext : com::sun::star::uno::XInterface -+{ -+ //------------------------------------------------------------------------ -+ /** update the digest with the given data. -+ -+ @param aData -+ data that should be used to update the digest -+ */ -+ void updateDigest( [in] sequence< byte > aData ) -+ raises( ::com::sun::star::lang::DisposedException ); -+ -+ //------------------------------------------------------------------------ -+ /** finalizes digest and disposes context. -+ */ -+ sequence finalizeDigestAndDispose() -+ raises( ::com::sun::star::lang::DisposedException ); -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/XDigestContextSupplier.idl b/offapi/com/sun/star/xml/crypto/XDigestContextSupplier.idl -new file mode 100644 -index 0000000..edb77a5 ---- /dev/null -+++ b/offapi/com/sun/star/xml/crypto/XDigestContextSupplier.idl -@@ -0,0 +1,82 @@ -+/************************************************************************* -+ * -+ * 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 -+ * -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+#ifndef __com_sun_star_xml_crypto_xdigestcontextsupplier_idl_ -+#define __com_sun_star_xml_crypto_xdigestcontextsupplier_idl_ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_beans_NamedValue_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_xml_crypto_XDigestContext_idl__ -+#include -+#endif -+ -+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -+#include -+#endif -+ -+//============================================================================ -+ -+ module com { module sun { module star { module xml { module crypto { -+ -+//============================================================================ -+/** This interface allows to get an object to generate a digest of a specified -+ format. -+ -+ @since OOo 3.4 -+ */ -+interface XDigestContextSupplier : com::sun::star::uno::XInterface -+{ -+ //------------------------------------------------------------------------ -+ /** returns an object that allows to generate the specified digest. -+ -+ @param nDigestID -+ the internal ID specifying the algorithm, -+ should take value from DigestID -+ -+ @param aParams -+ optional parameters that could be used to initialize the digest, -+ for example, it could contain a key and etc. -+ -+ @throws ::com::sun::star::lang::IllegalArgumentException -+ one of provided arguments is illegal -+ */ -+ XDigestContext getDigestContext( -+ [in] long nDigestID, -+ [in] sequence< ::com::sun::star::beans::NamedValue > aParams ) -+ raises( ::com::sun::star::lang::IllegalArgumentException ); -+}; -+ -+//============================================================================ -+ -+}; }; }; }; }; -+ -+#endif -diff --git a/offapi/com/sun/star/xml/crypto/makefile.mk b/offapi/com/sun/star/xml/crypto/makefile.mk -index 4aa3957..c03b2a7 100644 ---- a/offapi/com/sun/star/xml/crypto/makefile.mk -+++ b/offapi/com/sun/star/xml/crypto/makefile.mk -@@ -58,6 +58,12 @@ IDLFILES=\ - XMLSignatureException.idl \ - XMLEncryptionException.idl \ - XUriBinding.idl \ -+ CipherID.idl \ -+ DigestID.idl \ -+ XCipherContext.idl \ -+ XCipherContextSupplier.idl \ -+ XDigestContext.idl \ -+ XDigestContextSupplier.idl \ - SecurityOperationStatus.idl - - # ------------------------------------------------------------------ --- -1.7.6.4 - diff --git a/gdb-pretty-printers.patch b/gdb-pretty-printers.patch deleted file mode 100644 index 50f87e2..0000000 --- a/gdb-pretty-printers.patch +++ /dev/null @@ -1,2028 +0,0 @@ -From b852c77e068a8f3dedf550470be99d913241d7a8 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Fri, 29 Jul 2011 13:22:35 +0200 -Subject: [PATCH 1/2] add gdb pretty printers - ---- - solenv/gdb/libreoffice/__init__.py | 30 ++ - solenv/gdb/libreoffice/cppu.py | 164 ++++++++ - solenv/gdb/libreoffice/sal.py | 121 ++++++ - solenv/gdb/libreoffice/svl.py | 125 ++++++ - solenv/gdb/libreoffice/sw.py | 119 ++++++ - solenv/gdb/libreoffice/tl.py | 371 ++++++++++++++++++ - solenv/gdb/libreoffice/util/__init__.py | 30 ++ - solenv/gdb/libreoffice/util/compatibility.py | 38 ++ - solenv/gdb/libreoffice/util/printing.py | 139 +++++++ - solenv/gdb/libreoffice/util/string.py | 93 +++++ - solenv/gdb/libreoffice/util/uno.py | 539 ++++++++++++++++++++++++++ - 11 files changed, 1769 insertions(+), 0 deletions(-) - create mode 100644 solenv/gdb/libreoffice/__init__.py - create mode 100644 solenv/gdb/libreoffice/cppu.py - create mode 100644 solenv/gdb/libreoffice/sal.py - create mode 100644 solenv/gdb/libreoffice/svl.py - create mode 100644 solenv/gdb/libreoffice/sw.py - create mode 100644 solenv/gdb/libreoffice/tl.py - create mode 100644 solenv/gdb/libreoffice/util/__init__.py - create mode 100644 solenv/gdb/libreoffice/util/compatibility.py - create mode 100644 solenv/gdb/libreoffice/util/printing.py - create mode 100644 solenv/gdb/libreoffice/util/string.py - create mode 100644 solenv/gdb/libreoffice/util/uno.py - -diff --git a/solenv/gdb/libreoffice/__init__.py b/solenv/gdb/libreoffice/__init__.py -new file mode 100644 -index 0000000..90d8012 ---- /dev/null -+++ b/solenv/gdb/libreoffice/__init__.py -@@ -0,0 +1,30 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+ -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/cppu.py b/solenv/gdb/libreoffice/cppu.py -new file mode 100644 -index 0000000..8707ea5 ---- /dev/null -+++ b/solenv/gdb/libreoffice/cppu.py -@@ -0,0 +1,164 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+from libreoffice.util import printing -+from libreoffice.util.uno import TypeClass, make_uno_type, uno_cast -+ -+class UnoAnyPrinter(object): -+ '''Prints UNO any''' -+ -+ def __init__(self, typename, value): -+ self.value = value -+ self.typename = typename.replace('com::sun::star::', '') -+ -+ def to_string(self): -+ if self._is_set(): -+ return ('%s %s' % (self.typename, self._make_string())) -+ else: -+ return "empty %s" % self.typename -+ -+ def _is_set(self): -+ return self.value['pType'].dereference()['eTypeClass'] != TypeClass.VOID -+ -+ def _make_string(self): -+ ptr = self.value['pData'] -+ assert ptr -+ type_desc = self.value['pType'] -+ assert type_desc -+ type = make_uno_type(type_desc.dereference()) -+ assert type -+ return str(uno_cast(type, ptr).dereference()) -+ -+class UnoReferencePrinter(object): -+ '''Prints reference to a UNO interface''' -+ -+ def __init__(self, typename, value): -+ self.value = value -+ self.typename = typename.replace('com::sun::star::', '') -+ -+ def to_string(self): -+ iface = self.value['_pInterface'] -+ if iface: -+ impl = iface.cast(self._itype()).dereference() -+ return '%s to %s' % (self.typename, str(impl)) -+ else: -+ return "empty %s" % self.typename -+ -+ def _itype(self): -+ return self.value.type.template_argument(0).pointer() -+ -+class UnoSequencePrinter(object): -+ '''Prints UNO Sequence''' -+ -+ class iterator(object): -+ '''Sequence iterator''' -+ -+ def __init__(self, first, size): -+ self.item = first -+ self.size = size -+ self.count = 0 -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ if self.count == self.size: -+ raise StopIteration -+ count = self.count -+ self.count = self.count + 1 -+ elem = self.item.dereference() -+ self.item = self.item + 1 -+ return ('[%d]' % count, elem) -+ -+ -+ def __init__(self, typename, value): -+ self.value = value -+ self.typename = typename.replace('com::sun::star::', '') -+ -+ def to_string(self): -+ pimpl = self.value['_pSequence'] -+ if pimpl: -+ impl = pimpl.dereference() -+ elems = impl['nElements'] -+ if elems == 0: -+ return "empty %s" % self.typename -+ else: -+ return "%s of length %d" % (self.typename, elems) -+ else: -+ return "uninitialized %s" % self.typename -+ -+ def children(self): -+ pimpl = self.value['_pSequence'] -+ if pimpl: -+ impl = pimpl.dereference() -+ elemtype = self.value.type.template_argument(0) -+ elements = impl['elements'].cast(elemtype.pointer()) -+ return self.iterator(elements, int(impl['nElements'])) -+ else: -+ # TODO is that the best thing to do here? -+ return None -+ -+ def display_hint(self): -+ if self.value['_pSequence']: -+ return 'array' -+ else: -+ return None -+ -+class UnoTypePrinter(object): -+ '''Prints UNO Type''' -+ -+ def __init__(self, typename, value): -+ self.value = value -+ self.typename = typename.replace('com::sun::star::', '') -+ -+ def to_string(self): -+ uno = make_uno_type(self.value) -+ if uno: -+ return "%s %s" % (self.typename, uno.tag) -+ # return "%s %s" % (self.typename, uno.typename) -+ else: -+ return "invalid %s" % self.typename -+ -+printer = None -+ -+def build_pretty_printers(): -+ global printer -+ -+ printer = printing.Printer("libreoffice/cppu") -+ -+ # basic UNO stuff -+ printer.add('_uno_Any', UnoAnyPrinter) -+ printer.add('com::sun::star::uno::Any', UnoAnyPrinter) -+ printer.add('com::sun::star::uno::Sequence', UnoSequencePrinter) -+ printer.add('com::sun::star::uno::Type', UnoTypePrinter) -+ -+def register_pretty_printers(obj): -+ printing.register_pretty_printer(printer, obj) -+ -+build_pretty_printers() -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/sal.py b/solenv/gdb/libreoffice/sal.py -new file mode 100644 -index 0000000..e5a5d32 ---- /dev/null -+++ b/solenv/gdb/libreoffice/sal.py -@@ -0,0 +1,121 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+ -+from libreoffice.util import printing -+from libreoffice.util.string import StringPrinterHelper -+ -+class RtlStringPrinter(StringPrinterHelper): -+ '''Prints rtl_String or rtl_uString''' -+ -+ def __init__(self, typename, val, encoding = None): -+ super(RtlStringPrinter, self).__init__(typename, val, encoding) -+ -+ def data(self): -+ return self.val['buffer'] -+ -+ def length(self): -+ return self.val['length'] -+ -+class StringPrinter(StringPrinterHelper): -+ '''Prints rtl:: strings and string buffers''' -+ -+ def __init__(self, typename, val, encoding = None): -+ super(StringPrinter, self).__init__(typename, val, encoding) -+ -+ def valid(self): -+ return self.val['pData'] -+ -+ def data(self): -+ assert self.val['pData'] -+ return self.val['pData'].dereference()['buffer'] -+ -+ def length(self): -+ assert self.val['pData'] -+ return self.val['pData'].dereference()['length'] -+ -+class SalUnicodePrinter(StringPrinterHelper): -+ '''Prints a sal_Unicode*''' -+ -+ def __init__(self, typename, val): -+ super(SalUnicodePrinter, self).__init__(typename, val, 'utf-16') -+ -+ def data(self): -+ return self.val -+ -+ @staticmethod -+ def query(type): -+ type = type.unqualified() -+ if type.code != gdb.TYPE_CODE_PTR: -+ return False -+ return str(type.target()) == 'sal_Unicode' -+ -+class RtlReferencePrinter(object): -+ '''Prints rtl::Reference''' -+ -+ def __init__(self, typename, val): -+ self.typename = typename -+ self.val = val -+ -+ def to_string(self): -+ print("RtlReferencePrinter:to_string") -+ pointee = self.val['m_pBody'] -+ if pointee: -+ val = pointee.dereference() -+ return '%s to %s' % (self.typename, str(val)) -+ else: -+ return "empty %s" % self.typename -+ -+printer = None -+ -+def build_pretty_printers(): -+ global printer -+ -+ printer = printing.Printer("libreoffice/sal") -+ -+ # strings and string buffers -+ printer.add('_rtl_String', RtlStringPrinter) -+ printer.add('_rtl_uString', lambda name, val: RtlStringPrinter(name, -+ val, 'utf-16le')) -+ printer.add('rtl::OString', StringPrinter) -+ printer.add('rtl::OUString', lambda name, val: StringPrinter(name, val, 'utf-16')) -+ printer.add('rtl::OStringBuffer', StringPrinter) -+ printer.add('rtl::OUStringBuffer', lambda name, val: StringPrinter(name, val, 'utf-16')) -+ printer.add('sal_Unicode', SalUnicodePrinter, SalUnicodePrinter.query) -+ -+ # other stuff -+ printer.add('rtl::Reference', RtlReferencePrinter) -+ -+ return printer -+ -+def register_pretty_printers(obj): -+ printing.register_pretty_printer(printer, obj) -+ -+build_pretty_printers() -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/svl.py b/solenv/gdb/libreoffice/svl.py -new file mode 100644 -index 0000000..639f7c5 ---- /dev/null -+++ b/solenv/gdb/libreoffice/svl.py -@@ -0,0 +1,125 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+ -+from libreoffice.util import printing -+ -+class SvArrayPrinter(object): -+ '''Prints macro-declared arrays from svl module''' -+ -+ def __init__(self, typename, value): -+ self.typename = typename -+ self.value = value -+ -+ def to_string(self): -+ if int(self.value['nA']): -+ return "%s of length %d" % (self.typename, self.value['nA']) -+ else: -+ return "empty " + self.typename -+ -+ def children(self): -+ return self._iterator(self.value['pData'], self.value['nA']) -+ -+ def display_hint(self): -+ return 'array' -+ -+ class _iterator(object): -+ -+ def __init__(self, data, count): -+ self.data = data -+ self.count = count -+ self.pos = 0 -+ self._check_invariant() -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ if self.pos == self.count: -+ raise StopIteration() -+ -+ pos = self.pos -+ elem = self.data[pos] -+ self.pos = self.pos + 1 -+ -+ self._check_invariant() -+ return (str(pos), elem) -+ -+ def _check_invariant(self): -+ assert self.count >= 0 -+ if self.count > 0: -+ assert self.data -+ assert self.pos >= 0 -+ assert self.pos <= self.count -+ -+ @staticmethod -+ def query(type): -+ if type.code == gdb.TYPE_CODE_REF: -+ type = type.target() -+ type = type.unqualified().strip_typedefs() -+ -+ if not type.tag: -+ return False -+ -+ ushort = gdb.lookup_type('sal_uInt16') -+ conforming = True -+ for field in type.fields(): -+ if field.name == 'pData': -+ conforming = field.type.code == gdb.TYPE_CODE_PTR -+ elif field.name == 'nFree': -+ conforming = field.type == ushort -+ elif field.name == 'nA': -+ conforming = field.type == ushort -+ else: -+ conforming = False -+ if not conforming: -+ return False -+ -+ try: -+ gdb.lookup_type('FnForEach_' + type.tag) -+ except RuntimeError: -+ return False -+ -+ return True -+ -+printer = None -+ -+def build_pretty_printers(): -+ global printer -+ -+ printer = printing.Printer("libreoffice/svl") -+ -+ # macro-based arrays from svl module -+ printer.add('SvArray', SvArrayPrinter, SvArrayPrinter.query) -+ -+def register_pretty_printers(obj): -+ printing.register_pretty_printer(printer, obj) -+ -+build_pretty_printers() -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py -new file mode 100644 -index 0000000..761c153 ---- /dev/null -+++ b/solenv/gdb/libreoffice/sw.py -@@ -0,0 +1,119 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+from libreoffice.util import printing -+ -+ -+class BigPtrArrayPrinter(object): -+ '''Prints BigPtrArray.''' -+ -+ def __init__(self, typename, value): -+ self.typename = typename -+ self.value = value -+ -+ def to_string(self): -+ length = self.value['nSize'] -+ if length > 0: -+ return "%s of length %d" % (self.typename, length) -+ else: -+ return "empty %s" % self.typename -+ -+ def children(self): -+ return self._iterator(self.value) -+ -+ def display_hint(self): -+ return 'array' -+ -+ -+ class _iterator(object): -+ -+ def __init__(self, array): -+ self.blocks = array['ppInf'] -+ self.count = array['nSize'] -+ self.pos = 0 -+ self.block_count = array['nBlock'] -+ self.block_pos = 0 -+ self.block = None -+ self._next_block(False) -+ self._check_invariant() -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ if self.pos == self.count: -+ raise StopIteration() -+ -+ name = str(self.pos) -+ value = self.block['pData'][self.pos - self.block['nStart']] -+ if self.pos == self.block['nEnd']: -+ self._next_block() -+ self.pos += 1 -+ -+ self._check_invariant() -+ return (name, value) -+ -+ def _next_block(self, advance = True): -+ if advance: -+ self.block_pos += 1 -+ -+ if self.block_pos == self.block_count: -+ return -+ -+ pblock = self.blocks[self.block_pos] -+ assert pblock -+ block = pblock.dereference() -+ start = block['nStart'] -+ end = block['nEnd'] -+ assert end - start + 1 == block['nElem'] -+ if self.block: -+ assert start == self.block['nEnd'] + 1 -+ assert end <= self.count -+ else: -+ assert start == 0 -+ self.block = block -+ -+ def _check_invariant(self): -+ assert self.pos <= self.count -+ assert self.block_pos <= self.block_count -+ if self.pos == 0 and self.pos < self.count: -+ assert self.block != None -+ -+printer = None -+ -+def build_pretty_printers(): -+ global printer -+ -+ printer = printing.Printer("libreoffice/sw") -+ printer.add('BigPtrArray', BigPtrArrayPrinter) -+ -+def register_pretty_printers(obj): -+ printing.register_pretty_printer(printer, obj) -+ -+build_pretty_printers() -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/tl.py b/solenv/gdb/libreoffice/tl.py -new file mode 100644 -index 0000000..62c5ff5 ---- /dev/null -+++ b/solenv/gdb/libreoffice/tl.py -@@ -0,0 +1,371 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+ -+from libreoffice.util import printing -+from libreoffice.util.string import StringPrinterHelper -+ -+class StringPrinter(StringPrinterHelper): -+ '''Prints ByteString or UniString''' -+ -+ def __init__(self, typename, val, encoding = None): -+ super(StringPrinter, self).__init__(typename, val, encoding) -+ -+ def valid(self): -+ data = self.val['mpData'] -+ # mnRefCount is not a good indicator: it seems there could be -+ # cases where it is negative (-7FFFFFED) -+ return data #and data.dereference()['mnRefCount'] > 0 -+ -+ def data(self): -+ assert self.val['mpData'] -+ return self.val['mpData'].dereference()['maStr'] -+ -+ def length(self): -+ assert self.val['mpData'] -+ return self.val['mpData'].dereference()['mnLen'] -+ -+class BigIntPrinter(object): -+ '''Prints big integer''' -+ -+ def __init__(self, typename, val): -+ self.val = val -+ -+ def to_string(self): -+ if self.val['bIsSet']: -+ if self.val['bIsBig']: -+ return self._value() -+ else: -+ return self.val['nVal'] -+ else: -+ return "unset %s" % self.typename -+ -+ def _value(self): -+ len = self.val['nLen'] -+ digits = self.val['nNum'] -+ dsize = digits.dereference().type.sizeof * 8 -+ num = 0 -+ # The least significant byte is on index 0 -+ for i in reversed(range(0, len)): -+ num <<= dsize -+ num += digits[i] -+ return num -+ -+class ColorPrinter(object): -+ '''Prints color as rgb(r, g, b) or rgba(r, g, b, a)''' -+ -+ def __init__(self, typename, val): -+ self.val = val -+ -+ def to_string(self): -+ color = self.val['mnColor'] -+ b = color & 0xff -+ g = (color >> 8) & 0xff -+ r = (color >> 16) & 0xff -+ a = (color >> 24) & 0xff -+ if a: -+ return "rgba(%d, %d, %d, %d)" % (r, g, b, a) -+ else: -+ return "rgb(%d, %d, %d)" % (r, g, b) -+ -+class FractionPrinter(object): -+ '''Prints fraction''' -+ -+ def __init__(self, typename, val): -+ self.typename = typename -+ self.val = val -+ -+ def to_string(self): -+ numerator = self.val['nNumerator'] -+ denominator = self.val['nDenominator'] -+ if denominator > 0: -+ return "%d/%d" % (numerator, denominator) -+ else: -+ return "invalid %s" % self.typename -+ -+class DateTimeImpl(object): -+ -+ def __init__(self, date, time): -+ self.date = date -+ self.time = time -+ -+ def __str__(self): -+ result = '' -+ if self.date: -+ result += str(self.date) -+ if self.time: -+ result += ' ' -+ if self.time: -+ result += str(self.time) -+ return result -+ -+ @staticmethod -+ def parse(val): -+ return DateTimeImpl(DateImpl.parse(val), TimeImpl.parse(val)) -+ -+class DateTimePrinter(object): -+ '''Prints date and time''' -+ -+ def __init__(self, typename, val): -+ self.val = val -+ -+ def to_string(self): -+ return str(DateTimeImpl.parse(self.val)) -+ -+class DateImpl(DateTimeImpl): -+ -+ def __init__(self, year, month, day): -+ super(DateImpl, self).__init__(self, None) -+ self.year = year -+ self.month = month -+ self.day = day -+ -+ def __str__(self): -+ return "%d-%d-%d" % (self.year, self.month, self.day) -+ -+ @staticmethod -+ def parse(val): -+ date = val['nDate'] -+ d = date % 100 -+ m = (date / 100) % 100 -+ y = date / 10000 -+ return DateImpl(y, m, d) -+ -+class DatePrinter(object): -+ '''Prints date''' -+ -+ def __init__(self, typename, val): -+ self.val = val -+ -+ def to_string(self): -+ return str(DateImpl.parse(self.val)) -+ -+class TimeImpl(DateTimeImpl): -+ -+ def __init__(self, hour, minute, second, hundreth_of_second = 0): -+ super(TimeImpl, self).__init__(None, self) -+ self.hour = hour -+ self.minute = minute -+ self.second = second -+ self.hundreth_of_second = hundreth_of_second -+ -+ def __str__(self): -+ decimal = '' -+ if self.hundreth_of_second != 0: -+ decimal = '.%d' % self.hundreth_of_second -+ return "%d:%d:%d%s" % (self.hour, self.minute, self.second, decimal) -+ -+ @staticmethod -+ def parse(val): -+ time = val['nTime'] -+ h = time / 1000000 -+ m = (time / 10000) % 100 -+ s = (time / 100) % 100 -+ s_100 = time % 100 -+ return TimeImpl(h, m, s, s_100) -+ -+class TimePrinter(object): -+ '''Prints time''' -+ -+ def __init__(self, typename, val): -+ self.val = val -+ -+ def to_string(self): -+ return str(TimeImpl.parse(self.val)) -+ -+class IteratorHelper(object): -+ '''Implements a container iterator useable for both 'linear' -+ containers (like DynArray or List) and Tables -+ ''' -+ -+ def __init__(self, block, count, type = None): -+ self.count = count -+ self.type = type -+ self.pos = 0 -+ self.block = None -+ self.block_count = 0 -+ self.block_pos = 0 -+ if block: -+ self._next_block(block) -+ -+ self._check_invariant() -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ if self.pos == self.count: -+ raise StopIteration() -+ -+ if self.block_pos == self.block_count: -+ self._next_block(self.block['pNext']) -+ -+ name = self.name() -+ val = self.value() -+ self.advance() -+ -+ self._check_invariant() -+ return (name, val) -+ -+ def _next_block(self, block): -+ assert block -+ -+ self.block = block.dereference() -+ self.block_pos = 0 -+ self.block_count = block['nCount'] -+ -+ assert self.block_count <= block['nSize'] -+ assert self.block_count + self.pos <= self.count -+ -+ def _check_invariant(self): -+ assert self.count >= 0 -+ assert self.pos >= 0 -+ assert self.pos <= self.count -+ assert self.block_count >= 0 -+ if self.pos < self.count: -+ assert self.block_count > 0 -+ assert self.block != None -+ assert self.block_count <= self.count -+ assert self.block_pos >= 0 -+ assert self.block_pos <= self.block_count -+ -+class NoItemType(Exception): -+ pass -+ -+class ContainerHelper(object): -+ '''Provides support for specialized container printers''' -+ -+ def __init__(self, typename, val, iterator): -+ self.typename = typename -+ self.val = val -+ self.iterator = iterator -+ -+ def to_string(self): -+ size = self.val['nCount'] -+ if size > 0: -+ return "%s of length %d" % (self.typename, size) -+ elif size == 0: -+ return "empty %s" % self.typename -+ else: -+ return "invalid %s" % self.typename -+ -+ def children(self): -+ count = self.val.cast(gdb.lookup_type('Container'))['nCount'] -+ return self.iterator(self.val['pFirstBlock'], count) -+ -+class LinearIterator(IteratorHelper): -+ '''Is iterator for 'linear' container''' -+ -+ def __init__(self, block, count, type = None): -+ super(LinearIterator, self).__init__(block, count, type) -+ -+ def name(self): -+ return str(self.pos) -+ -+ def value(self): -+ nodes = self.block['pNodes']#.cast(self.type.pointer()) -+ return nodes[self.block_pos] -+ -+ def advance(self): -+ self.pos += 1 -+ self.block_pos += 1 -+ -+class LinearContainerPrinter(ContainerHelper): -+ '''Prints 'linear' container, like DynArray or List''' -+ -+ def __init__(self, typename, val): -+ super(LinearContainerPrinter, self).__init__(typename, val, LinearIterator) -+ -+ def display_hint(self): -+ return 'array' -+ -+class TableIterator(IteratorHelper): -+ '''Is iterator for Table''' -+ -+ def __init__(self, block, count, type = None): -+ super(TableIterator, self).__init__(block, count, type) -+ # ULONG doesn't work on 64-bit for some reason (gdb says it has -+ # size 4 and it's not a typedef to sal_uIntPtr) -+ self._key_type = gdb.lookup_type('sal_uIntPtr') -+ self.is_key = True -+ -+ def name(self): -+ return '' -+ -+ def value(self): -+ nodes = self.block['pNodes']#.cast(self.type.pointer()) -+ val = nodes[self.block_pos] -+ if self.is_key: -+ val = str(val.cast(self._key_type)) -+ return val -+ -+ def advance(self): -+ self.pos += 1 -+ self.block_pos += 1 -+ self.is_key = not self.is_key -+ -+class TablePrinter(ContainerHelper): -+ '''Prints table''' -+ -+ def __init__(self, typename, val): -+ super(TablePrinter, self).__init__(typename, val, TableIterator) -+ -+ def display_hint(self): -+ return 'map' -+ -+printer = None -+ -+def build_pretty_printers(): -+ global printer -+ -+ printer = printing.Printer('libreoffice/tl') -+ -+ # old-style strings -+ printer.add('ByteString', StringPrinter) -+ printer.add('String', lambda name, val: StringPrinter(name, val, 'utf-16')) -+ -+ # old-style containers -+ printer.add('DynArray', LinearContainerPrinter) -+ printer.add('List', LinearContainerPrinter) -+ printer.add('Stack', LinearContainerPrinter) -+ printer.add('Table', TablePrinter) -+ -+ # various types -+ printer.add('BigInt', BigIntPrinter) -+ printer.add('Color', ColorPrinter) -+ printer.add('Fraction', FractionPrinter) -+ printer.add('DateTime', DateTimePrinter) -+ printer.add('Date', DatePrinter) -+ printer.add('Time', TimePrinter) -+ -+def register_pretty_printers(obj): -+ printing.register_pretty_printer(printer, obj) -+ -+build_pretty_printers() -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/util/__init__.py b/solenv/gdb/libreoffice/util/__init__.py -new file mode 100644 -index 0000000..90d8012 ---- /dev/null -+++ b/solenv/gdb/libreoffice/util/__init__.py -@@ -0,0 +1,30 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+ -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/util/compatibility.py b/solenv/gdb/libreoffice/util/compatibility.py -new file mode 100644 -index 0000000..3011f93 ---- /dev/null -+++ b/solenv/gdb/libreoffice/util/compatibility.py -@@ -0,0 +1,38 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+ -+use_gdb_printing = True -+try: -+ import gdb.printing -+except ImportError: -+ use_gdb_printing = False -+ -+use_lazy_string = hasattr(gdb.Value, 'lazy_string') -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/util/printing.py b/solenv/gdb/libreoffice/util/printing.py -new file mode 100644 -index 0000000..e1f55b3 ---- /dev/null -+++ b/solenv/gdb/libreoffice/util/printing.py -@@ -0,0 +1,139 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+from collections import Mapping -+import gdb -+import re -+ -+from libreoffice.util.compatibility import use_gdb_printing -+ -+class SimplePrinter(object): -+ -+ def __init__(self, name, function): -+ self.name = name -+ self.function = function -+ self.enabled = True -+ -+ def invoke(self, val): -+ if not self.enabled: -+ return None -+ return self.function(self.name, val) -+ -+class NameLookup(Mapping): -+ -+ def __init__(self): -+ self.map = {} -+ self.name_regex = re.compile('^([\w:]+)(<.*>)?') -+ -+ def add(self, name, printer): -+ self.map[name] = printer -+ -+ def __len__(self): -+ return len(self.map) -+ -+ def __getitem__(self, type): -+ typename = self._basic_type(type) -+ if typename and typename in self.map: -+ return self.map[typename] -+ return None -+ -+ def __iter__(self): -+ return self.map -+ -+ def _basic_type(self, type): -+ basic_type = self.basic_type(type) -+ if basic_type: -+ match = self.name_regex.match(basic_type) -+ if match: -+ return match.group(1) -+ return None -+ -+ @staticmethod -+ def basic_type(type): -+ if type.code == gdb.TYPE_CODE_REF: -+ type = type.target() -+ type = type.unqualified().strip_typedefs() -+ return type.tag -+ -+class FunctionLookup(Mapping): -+ -+ def __init__(self): -+ self.map = {} -+ -+ def add(self, test, printer): -+ self.map[test] = printer -+ -+ def __len__(self): -+ return len(self.map) -+ -+ def __getitem__(self, type): -+ for (test, printer) in self.map.iteritems(): -+ if test(type): -+ return printer -+ return None -+ -+ def __iter__(self): -+ return self.map -+ -+class Printer(object): -+ -+ def __init__(self, name): -+ self.name = name -+ self.subprinters = [] -+ self.name_lookup = NameLookup() -+ self.func_lookup = FunctionLookup() -+ self.enabled = True -+ -+ def add(self, name, function, lookup = None): -+ printer = SimplePrinter(name, function) -+ self.subprinters.append(printer) -+ if not lookup: -+ self.name_lookup.add(name, printer) -+ else: -+ self.func_lookup.add(lookup, printer) -+ -+ -+ def __call__(self, val): -+ printer = self.name_lookup[val.type] -+ if not printer: -+ printer = self.func_lookup[val.type] -+ -+ if printer: -+ return printer.invoke(val) -+ return None -+ -+def register_pretty_printer(printer, obj): -+ '''Registers printer with objfile''' -+ -+ if use_gdb_printing: -+ gdb.printing.register_pretty_printer(obj, printer) -+ else: -+ if obj is None: -+ obj = gdb -+ obj.pretty_printers.append(printer) -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/util/string.py b/solenv/gdb/libreoffice/util/string.py -new file mode 100644 -index 0000000..e2db622 ---- /dev/null -+++ b/solenv/gdb/libreoffice/util/string.py -@@ -0,0 +1,93 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+ -+from libreoffice.util.compatibility import use_lazy_string -+ -+class StringPrinterHelper(object): -+ '''Base for all string pretty printers''' -+ -+ class MustBeImplemented(Exception): -+ pass -+ -+ def __init__(self, typename, val, encoding = None): -+ self.typename = typename -+ self.val = val -+ self.encoding = encoding -+ -+ def to_string(self): -+ data = self.data() -+ len = self.length() -+ if self.valid(): -+ return self.make_string(data, self.encoding, len) -+ else: -+ return "unintialized %s" % self.typename -+ -+ def display_hint(self): -+ if self.valid(): -+ return 'string' -+ else: -+ return None -+ -+ def valid(self): -+ return True -+ -+ def data(self): -+ raise self.MustBeImplemented() -+ -+ def length(self): -+ return -1 -+ -+ @staticmethod -+ def make_string(data, encoding = None, length = -1): -+ '''Creates a new string from memory''' -+ -+ if not encoding: -+ encoding = '' -+ -+ if use_lazy_string: -+ return data.lazy_string(encoding, length) -+ -+ # we need to determine length, if not given (for sal_Unicode*) -+ if length < 0: -+ length = 0 -+ while data[length] != 0 and length <= 512: # arbitrary limit -+ length += 1 -+ -+ # The gdb.Value.string() conversion works on array of bytes, but -+ # the length we have is the length of the string. So we must -+ # multiply it by width of character if the string is Unicode. -+ width = data[0].type.sizeof -+ if width > 1: -+ length = length * width -+ -+ char = gdb.lookup_type('char') -+ bytes = data.cast(char.pointer()) -+ return bytes.string(encoding, length = length) -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/libreoffice/util/uno.py b/solenv/gdb/libreoffice/util/uno.py -new file mode 100644 -index 0000000..23cf06a ---- /dev/null -+++ b/solenv/gdb/libreoffice/util/uno.py -@@ -0,0 +1,539 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import gdb -+import re -+ -+class UnsupportedType(Exception): -+ '''Represents exception thrown when an unsupported UNO type(like -+ array or union) is used.''' -+ -+ def __init__(self, type): -+ self.type = type -+ -+class UnknownType(Exception): -+ '''Represents exception thrown when an unknown UNO type is used.''' -+ -+ def __init__(self, type): -+ self.type = type -+ -+class TypeClass(object): -+ '''Represents type class of UNO type.''' -+ -+ # type class of void -+ VOID = 0 -+ # type class of char -+ CHAR = 1 -+ # type class of boolean -+ BOOLEAN = 2 -+ # type class of byte -+ BYTE = 3 -+ # type class of short -+ SHORT = 4 -+ # type class of unsigned short -+ UNSIGNED_SHORT = 5 -+ # type class of long -+ LONG = 6 -+ # type class of unsigned long -+ UNSIGNED_LONG = 7 -+ # type class of hyper -+ HYPER = 8 -+ # type class of unsigned hyper -+ UNSIGNED_HYPER = 9 -+ # type class of float -+ FLOAT = 10 -+ # type class of double -+ DOUBLE = 11 -+ # type class of string -+ STRING = 12 -+ # type class of type -+ TYPE = 13 -+ # type class of any -+ ANY = 14 -+ # type class of enum -+ ENUM = 15 -+ # type class of typedef -+ TYPEDEF = 16 -+ # type class of struct -+ STRUCT = 17 -+ # type class of union (not implemented) -+ UNION = 18 -+ # type class of exception -+ EXCEPTION = 19 -+ # type class of sequence -+ SEQUENCE = 20 -+ # type class of array (not implemented) -+ ARRAY = 21 -+ # type class of interface -+ INTERFACE = 22 -+ # type class of service (not implemented) -+ SERVICE = 23 -+ # type class of module (not implemented) -+ MODULE = 24 -+ # type class of interface method -+ INTERFACE_METHOD = 25 -+ # type class of interface attribute -+ INTERFACE_ATTRIBUTE = 26 -+ # type class of unknown type -+ UNKNOWN = 27 -+ # type class of properties -+ PROPERTY = 28 -+ # type class of constants -+ CONSTANT = 29 -+ # type class of constants groups -+ CONSTANTS = 30 -+ # type class of singletons -+ SINGLETON = 31 -+ -+class TemplateType(object): -+ -+ def __init__(self, template, *args): -+ self.template = template -+ self.args = args -+ -+ def __str__(self): -+ argtypes = [str(gdb.lookup_type(arg).strip_typedefs()) for arg in self.args] -+ return self.template + '<' + ', '.join(argtypes) + '>' -+ -+class Type(object): -+ '''Describes a UNO type.''' -+ -+ def __init__(self, typeclass, tag): -+ '''Constructs a new Type. -+ @param[in] typeclass value of com::sun::star::uno::TypeClass -+ @param[in] tag UNO name of the type -+ ''' -+ self.typeclass = typeclass -+ self.tag = tag -+ # C++ name of the type -+ self.typename = None -+ -+ def type(self): -+ '''Gets gdb.Type for the type''' -+ if self.typename: -+ return gdb.lookup_type(str(self.typename)) -+ return None -+ -+ @staticmethod -+ def uno2cpp(typename): -+ return str(typename).replace('.', '::')[1:-1] -+ -+ def strip_typedefs(self): -+ copy = self.copy() -+ copy.typename = self._strip_typedefs(self.typename) -+ return copy -+ -+ def _strip_typedefs(self, typename): -+ template_args = re.compile('([^<]+)(<.*>)') -+ match = template_args.match(typename) -+ type = self._lookup_type(match.group(1)) -+ types = [] -+ if match.group(2): -+ list_delim = re.compile(', *') -+ # FIXME: this does not work with nested templates -+ for arg in match.group(2).split(list_delim): -+ types.append(self._lookup_type(arg)) -+ -+ typename = str(type) -+ if not types.empty(): -+ typename += '<' + types.join(', ') + '>' -+ -+ return typename -+ -+ def _lookup_type(self, typename): -+ if typename != '': -+ type = gdb.lookup_type(typename) -+ if type: -+ type = type.strip_typedefs() -+ return type -+ -+def make_uno_type(val): -+ '''Creates a UNO type from gdb.Value of type -+ com::sun::star::uno::Type, typelib_TypeDescription, or -+ typelib_TypeDescriptionReference -+ ''' -+ -+ cssu_type = 'com::sun::star::uno::Type' -+ type_desc = '_typelib_TypeDescription' -+ type_descs =( -+ type_desc, -+ '_typelib_CompoundTypeDescription', -+ '_typelib_StructTypeDescription', -+ '_typelib_IndirectTypeDescription', -+ '_typelib_EnumTypeDescription', -+ '_typelib_InterfaceMemberTypeDescription', -+ '_typelib_InterfaceMethodTypeDescription', -+ '_typelib_InterfaceAttributeTypeDescription', -+ '_typelib_InterfaceTypeDescription' -+ ) -+ type_desc_ref = '_typelib_TypeDescriptionReference' -+ -+ type = val.type.strip_typedefs() -+ -+ if type.tag == cssu_type: -+ pvalue = val['_pType'] -+ assert pvalue -+ val = pvalue.dereference() -+ type = val.type.strip_typedefs() -+ -+ while type.tag == type_desc_ref: -+ pvalue = val['pType'] -+ assert pvalue -+ val = pvalue.dereference() -+ type = val.type.strip_typedefs() -+ -+ if type.tag not in type_descs: -+ return None -+ -+ # determination of the UNO type -+ full_val = val -+ if type.tag != type_desc: -+ while 'aBase' in val: -+ val = val['aBase'] -+ type_class = int(val['eTypeClass']) -+ name = val['pTypeName'].dereference() -+ uno_type = None -+ if type_class == TypeClass.VOID: -+ uno_type = VoidType() -+ elif type_class == TypeClass.CHAR: -+ uno_type = PrimitiveType(type_class, name, 'sal_Char') -+ elif type_class == TypeClass.BOOLEAN: -+ uno_type = PrimitiveType(type_class, name, 'sal_Bool') -+ elif type_class == TypeClass.BYTE: -+ uno_type = PrimitiveType(type_class, name, 'sal_Int8') -+ elif type_class == TypeClass.SHORT: -+ uno_type = PrimitiveType(type_class, name, 'sal_Int16') -+ elif type_class == TypeClass.UNSIGNED_SHORT: -+ uno_type = PrimitiveType(type_class, name, 'sal_uInt16') -+ elif type_class == TypeClass.LONG: -+ uno_type = PrimitiveType(type_class, name, 'sal_Int32') -+ elif type_class == TypeClass.UNSIGNED_LONG: -+ uno_type = PrimitiveType(type_class, name, 'sal_uInt32') -+ elif type_class == TypeClass.HYPER: -+ uno_type = PrimitiveType(type_class, name, 'sal_Int64') -+ elif type_class == TypeClass.UNSIGNED_HYPER: -+ uno_type = PrimitiveType(type_class, name, 'sal_uInt64') -+ elif type_class == TypeClass.FLOAT: -+ uno_type = PrimitiveType(type_class, name, 'float') -+ elif type_class == TypeClass.DOUBLE: -+ uno_type = PrimitiveType(type_class, name, 'double') -+ elif type_class == TypeClass.STRING: -+ uno_type = PrimitiveType(type_class, name, 'rtl::OUString') -+ elif type_class == TypeClass.TYPE: -+ uno_type = PrimitiveType(type_class, name, 'com::sun::star::uno::Type') -+ elif type_class == TypeClass.ANY: -+ uno_type = PrimitiveType(type_class, name, 'com::sun::star::uno::Any') -+ elif type_class == TypeClass.ENUM: -+ uno_type = EnumType(val, full_val) -+ elif type_class == TypeClass.TYPEDEF: -+ pass -+ elif type_class == TypeClass.STRUCT: -+ uno_type = StructType(val, full_val) -+ elif type_class == TypeClass.UNION: -+ raise UnsupportedType('union') -+ elif type_class == TypeClass.EXCEPTION: -+ uno_type = CompoundType(val, full_val) -+ elif type_class == TypeClass.SEQUENCE: -+ uno_type = IndirectType(val, full_val) -+ elif type_class == TypeClass.ARRAY: -+ raise UnsupportedType('array') -+ elif type_class == TypeClass.INTERFACE: -+ uno_type = InterfaceType(val, full_val) -+ elif type_class == TypeClass.SERVICE: -+ raise UnsupportedType('service') -+ elif type_class == TypeClass.MODULE: -+ raise UnsupportedType('module') -+ elif type_class == TypeClass.INTERFACE_METHOD: -+ uno_type = InterfaceMethodType(val, full_val) -+ elif type_class == TypeClass.INTERFACE_ATTRIBUTE: -+ uno_type = InterfaceAttributeType(val, full_val) -+ elif type_class == TypeClass.UNKNOWN: -+ raise UnknownType(type) -+ elif type_class == TypeClass.PROPERTY: -+ pass -+ elif type_class == TypeClass.CONSTANT: -+ pass -+ elif type_class == TypeClass.CONSTANTS: -+ pass -+ elif type_class == TypeClass.SINGLETON: -+ pass -+ else: -+ raise UnknownType(type) -+ -+ assert uno_type -+ return uno_type -+ -+def uno_cast(type, val): -+ '''Casts val or pointer to UNO type represented by type''' -+ if val.type.code == gdb.TYPE_CODE_PTR: -+ return val.cast(type.type().pointer()) -+ else: -+ return val.cast(type.type()) -+ -+class VoidType(Type): -+ -+ def __init__(self): -+ super(VoidType, self).__init__(TypeClass.VOID, "void") -+ self.typename = "void" -+ -+class PrimitiveType(Type): -+ -+ def __init__(self, typeclass, typename_uno, typename_cpp): -+ super(PrimitiveType, self).__init__(typeclass, typename_uno) -+ self.typename = str(typename_cpp) -+ -+class CompoundType(Type): -+ -+ def __init__(self, type, full_type): -+ super(CompoundType, self).__init__(type['eTypeClass'], type['pTypeName'].dereference()) -+ self.typename = self.uno2cpp(self.tag) -+ self._type = full_type -+ -+ class _iterator(object): -+ -+ def __init__(self, count, types, names): -+ self.count = count -+ self.members = members -+ self.names = names -+ self.pos = 0 -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ assert self.pos >= 0 and self.pos <= self.count -+ if self.pos == self.count: -+ raise StopIteration -+ -+ pmember = self.members[self.pos] -+ assert pmember -+ pname = self.names[self.i] -+ assert pname -+ self.pos = self.pos + 1 -+ member = make_uno_type(pmember.dereference()) -+ assert member -+ name = str(pname.dereference()) -+ return (name, member) -+ -+ def attributes(self): -+ return _iterator(self._type['nMembers'], self._type['ppTypeRefs'], -+ self._type['ppMemberNames']) -+ -+class StructType(CompoundType): -+ -+ def __init__(self, type, full_type): -+ full_type = full_type.cast(gdb.lookup_type('_typelib_StructTypeDescription')) -+ super(StructType, self).__init__(type, full_type['aBase']) -+ -+class IndirectType(Type): -+ -+ def __init__(self, type, full_type): -+ super(IndirectType, self).__init__(type['eTypeClass'], type['pTypeName'].dereference()) -+ full_type = full_type.cast(gdb.lookup_type('_typelib_IndirectTypeDescription')) -+ pelem = full_type['pType'] -+ assert pelem -+ self.element = make_uno_type(pelem.dereference()) -+ assert self.element -+ self.typename = TemplateType('com::sun::star::uno::Sequence', self.element.typename) -+ -+class EnumType(Type): -+ -+ def __init__(self, type, full_type): -+ super(EnumType, self).__init__(TypeClass.ENUM, type['pTypeName'].dereference()) -+ self.typename = self.uno2cpp(self.tag) -+ self._type = full_type.cast(gdb.lookup_type('_typelib_EnumTypeDescription')) -+ -+ class _iterator(object): -+ -+ def __init__(self, count, values, names): -+ self.count = count -+ self.values = values -+ self.names = names -+ self.pos = 0 -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ assert self.pos >= 0 and self.pos <= self.count -+ if self.pos == self.count: -+ raise StopIteration -+ -+ pvalue = self.values[self.pos] -+ assert pvalue -+ pname = self.names[self.pos] -+ assert pname -+ self.pos = self.pos + 1 -+ val = int(pvalue.dereference()) -+ name = str(pname.dereference()) -+ return (name, val) -+ -+ def values(self): -+ return _iterator(self._type['nEnumValues'], -+ self._type['ppEnumNames'], self._type['pEnumValues']) -+ -+ def default_value(self): -+ return self._type['nDefaultEnumValue'] -+ -+class InterfaceMemberType(Type): -+ -+ def __init__(self, type, full_type): -+ super(InterfaceMemberType, self).__init__(type['eTypeClass'], type['pTypeName'].dereference()) -+ (interface, delim, member) = self.tag.partition('::') -+ self.typename = self.uno2cpp(interface) + '::*' + member -+ full_type = full_type.cast(gdb.lookup_type('_typelib_InterfaceMemberTypeDescription')) -+ self.position = full_type['nPosition'] -+ pname = full_type['pMemberName'] -+ assert pname -+ self.name = pname.dereference() -+ -+class InterfaceMethodType(InterfaceMemberType): -+ -+ def __init__(self, type, full_type): -+ full_type = full_type.cast(gdb.lookup_type('_typelib_InterfaceMethodTypeDescription')) -+ super(InterfaceMethodType, self).__init__(type, full_type['aBase']) -+ pret = full_type['pReturnTypeRef'] -+ assert pret -+ self.return_type = make_uno_type(pret.dereference()) -+ assert self.return_type -+ self.oneway = full_type['bOneWay'] -+ self._type = full_type -+ -+ class _iterator(object): -+ -+ def __init__(self, count, values): -+ self.count = count -+ self.values = values -+ self.pos = 0 -+ assert values -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ assert self.pos >= 0 and self.pos <= self.count -+ if self.pos == self.count: -+ raise StopIteration -+ -+ val = self.values[self.pos] -+ self.pos = self.pos + 1 -+ return val -+ -+ class parameter(tuple): -+ -+ def __init__(self, type): -+ self.__init_tuple(type) -+ self.input = type['bIn'] -+ self.output = type['bOut'] -+ -+ def _init_tuple(self, type): -+ pname = self['pName'] -+ assert pname -+ ptype = self['pTypeRef'] -+ assert ptype -+ name = str(pname.dereference()) -+ type = make_uno_type(ptype.dereference()) -+ assert type -+ super(parameter, self).__init__(name, type) -+ -+ def parameters(self): -+ for param in _iterator(self._type['nParams'], self._type['pParams']): -+ yield parameter(param) -+ -+ def exceptions(self): -+ def make_exception(self, pex): -+ assert pex -+ ex = make_uno_type(pex.dereference()) -+ assert ex -+ return ex -+ -+ for ex in _iterator( -+ self._type['nExceptions'], self._type['ppExceptions']): -+ yield make_exception(ex) -+ -+class InterfaceAttributeType(InterfaceMemberType): -+ -+ def __init__(self, type, full_type): -+ full_type = full_type.cast(gdb.lookup_type('_typelib_InterfaceAttributeTypeDescription')) -+ super(InterfaceAttributeType, self).__init__(type, full_type['aBase']) -+ self.readonly = full_type['bReadOnly'] -+ ptype = full_type['pAttributeTypeRef'] -+ assert ptype -+ self.type = make_uno_type(ptype.dereference()) -+ assert self.type -+ -+class MembersNotInitialized(Exception): -+ '''Represents exception raised when interface type' members haven't -+ been initialized(i.e. just level 1 initialization has been -+ performed)''' -+ pass -+ -+class InterfaceType(Type): -+ -+ def __init__(self, type, full_type): -+ super(InterfaceType, self).__init__(TypeClass.INTERFACE, type['pTypeName'].dereference()) -+ assert int(type['eTypeClass']) == TypeClass.INTERFACE -+ self.typename = self.uno2cpp(self.tag) -+ full_type = full_type.cast(gdb.lookup_type('_typelib_InterfaceTypeDescription')) -+ self.uik = full_type['aUik'] -+ self._type = full_type -+ -+ class _iterator(object): -+ -+ def __init__(self, count, values): -+ assert values -+ self.count = count -+ self.values = values -+ self.pos = 0 -+ -+ def __iter__(self): -+ return self -+ -+ def next(self): -+ assert self.pos >= 0 and self.pos <= self.count -+ pvalue = self.values[self.pos] -+ assert pvalue -+ self.pos = self.pos + 1 -+ uno = make_uno_type(pvalue.dereference()) -+ assert uno -+ return uno -+ -+ def members(self): -+ return __members(self._type['nMembers'], self._type['ppMembers']) -+ -+ def all_members(self): -+ return __members(self._type['nAllMembers'], self._type['ppAllMembers']) -+ -+ def __members(count, values): -+ if values == 0: -+ raise MembersNotInitialized -+ return _iterator(count, values) -+ -+ def bases(self): -+ return _iterator(self._type['nBaseTypes'], self._type['ppBaseTypes']) -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: --- -1.7.6 - -From 9c1e67838844b4826c5a47f03aa4b363c127a705 Mon Sep 17 00:00:00 2001 -From: David Tardon -Date: Tue, 9 Aug 2011 10:35:19 +0200 -Subject: [PATCH 2/2] install gdb pretty printers - ---- - Makefile.in | 4 ++- - solenv/bin/install-gdb-printers | 68 +++++++++++++++++++++++++++++++++++++++ - solenv/gdb/autoload.template | 42 ++++++++++++++++++++++++ - 3 files changed, 113 insertions(+), 1 deletions(-) - create mode 100755 solenv/bin/install-gdb-printers - create mode 100644 solenv/gdb/autoload.template - -diff --git a/Makefile.in b/Makefile.in -index 72ef758..6ea879e 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -30,7 +30,8 @@ install: - ooinstall "@INSTALLDIR@" && \ - echo "" && \ - echo "Installation finished, you can now execute:" && \ -- echo "@INSTALLDIR@/program/soffice" -+ echo "@INSTALLDIR@/program/soffice" && \ -+ install-gdb-printers -a "@INSTALLDIR@" - - distro-pack-install: install - ./bin/distro-install-clean-up -@@ -46,6 +47,7 @@ dev-install: - dev-install: - @. ./*[Ee]nv.[Ss]et.sh && \ - ooinstall -l @abs_builddir@/install && \ -+ install-gdb-printers -a "$$SOLARVER/$$INPATH/installation/opt" -L && \ - echo "" && \ - echo "Developer installation finished, you can now execute:" && \ - echo "@abs_builddir@/install/program/soffice" -diff --git a/solenv/bin/install-gdb-printers b/solenv/bin/install-gdb-printers -new file mode 100755 -index 0000000..719c280 ---- /dev/null -+++ b/solenv/bin/install-gdb-printers -@@ -0,0 +1,68 @@ -+#!/bin/bash -+ -+GDBDIR="${SOLARENV}/gdb" -+ -+die() { -+ echo "$1" >&2 -+ exit 1 -+} -+ -+make_autoload() { -+ local dir="${DESTDIR}${autoloaddir}/$2" -+ local gdbfile="${dir}/$3-gdb.py" -+ -+ if ${create}; then -+ mkdir -p "${dir}" || die "cannot create dir '${dir}'" -+ elif ${follow}; then -+ gdbfile="$(readlink -f "${dir}/$3")-gdb.py" -+ fi -+ sed -e "s!%PYTHONDIR%!${pythondir}!" -e "s!%MODULE%!libreoffice.$1!" \ -+ "${GDBDIR}/autoload.template" > "${gdbfile}" -+} -+ -+# dir where the autoloaders will be placed -+autoloaddir= -+# dir where the pretty printers will be placed -+pythondir="${GDBDIR}" -+# Create autoload dir if it does not exist. This only makes sense when -+# installing into system gdb dir, so $autoloaddir must be absolute path. -+create=false -+# Follow links when looking up the path for the autoload file. This only -+# makes sense for dev-install. -+follow=false -+ -+# b defghijklmno qrstuvwxyzABCDEFGHIJK MNOPQRSTUVWXYZ0123456789 -+while getopts :a:cp:L opt; do -+ case ${opt} in -+ a) autoloaddir="${OPTARG}" ;; -+ c) create=true ;; -+ p) pythondir="${OPTARG}" ;; -+ L) follow=true ;; -+ *) die "unknown option ${OPTARG}" ;; -+ esac -+done -+ -+${create} && ${follow} && die "-c and -L cannot be used together" -+if [[ -n ${DESTDIR} ]]; then -+ [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path' -+ [[ ${pythondir:0:1} = / ]] || die 'the arg to -p must be an absolute path' -+fi -+if ${create}; then -+ [[ ${autoloaddir:0:1} = / ]] || die 'the arg to -a must be an absolute path' -+else -+ [[ ! -d ${DESTDIR}${autoloaddir} ]] && die "directory '${DESTDIR}${autoloaddir}' does not exist" -+fi -+[[ ! -d ${GDBDIR} ]] && die "directory '${GDBDIR}' does not exist" -+ -+if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then -+ mkdir -p "${DESTDIR}${pythondir}" || die "cannot create dir '${DESTDIR}${pythondir}'" -+ cp -r "${GDBDIR}/libreoffice" "${DESTDIR}${pythondir}" -+fi -+ -+make_autoload cppu ure/lib libuno_cppu.so.3 -+make_autoload sal ure/lib libuno_sal.so.3 -+make_autoload svl basis3.4/program libsvllo.so -+make_autoload sw basis3.4/program libswlo.so -+make_autoload tl basis3.4/program libtllo.so -+ -+# vim:set shiftwidth=4 softtabstop=4 expandtab: -diff --git a/solenv/gdb/autoload.template b/solenv/gdb/autoload.template -new file mode 100644 -index 0000000..3351606 ---- /dev/null -+++ b/solenv/gdb/autoload.template -@@ -0,0 +1,42 @@ -+# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -+# -+# The contents of this file are subject to the Mozilla Public License Version -+# 1.1 (the "License"); you may not use this file except in compliance with -+# the License or as specified alternatively below. You may obtain a copy of -+# the License at http://www.mozilla.org/MPL/ -+# -+# Software distributed under the License is distributed on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -+# for the specific language governing rights and limitations under the -+# License. -+# -+# The Initial Developer of the Original Code is -+# David Tardon, Red Hat Inc. -+# Portions created by the Initial Developer are Copyright (C) 2010 the -+# Initial Developer. All Rights Reserved. -+# -+# Major Contributor(s): -+# -+# For minor contributions see the git repository. -+# -+# Alternatively, the contents of this file may be used under the terms of -+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -+# instead of those above. -+ -+import os.path -+import sys -+ -+import gdb -+ -+pythondir = os.path.normpath('%PYTHONDIR%') -+ -+if gdb.current_objfile(): -+ if pythondir not in sys.path: -+ sys.path.insert(0, pythondir) -+ -+from %MODULE% import register_pretty_printers -+register_pretty_printers(gdb.current_objfile()) -+ -+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: --- -1.7.6 - diff --git a/kde4configure.patch b/kde4configure.patch deleted file mode 100644 index cc52971..0000000 --- a/kde4configure.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- /tmp/configure.in 2011-04-12 13:22:35.691633964 +0100 -+++ configure.in 2011-04-12 13:29:44.603368227 +0100 -@@ -6822,11 +6822,11 @@ - qt_libdirs="$QT4LIB /usr/lib $x_libraries" - - kde_incdirs="/usr/include $x_includes" -- kde_libdirs="/usr/lib $x_libraries" -+ kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries" - - if test "$host_cpu" = "x86_64" ; then - qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64" -- kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4" -+ kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel" - fi - - if test -n "$QTDIR" ; then -@@ -6855,7 +6855,7 @@ - fi - fi - if test -n "$KDE4DIR" ; then -- kde_incdirs="$KDE4DIR/include $kde_incdirs" -+ kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs" - if test "$host_cpu" != "x86_64" ; then - kde_libdirs="$KDE4DIR/lib $kde_libdirs" - else diff --git a/libreoffice-ppc64.patch b/libreoffice-ppc64.patch deleted file mode 100644 index fc0c0d3..0000000 --- a/libreoffice-ppc64.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/writerfilter/source/resourcemodel/makefile.mk b/writerfilter/source/resourcemodel/makefile.mk -index 73e049f..2aba722 100644 ---- a/writerfilter/source/resourcemodel/makefile.mk -+++ b/writerfilter/source/resourcemodel/makefile.mk -@@ -40,9 +40,6 @@ CDEFS+=-DWRITERFILTER_DLLIMPLEMENTATION - # --- Files -------------------------------------------------------- - - # work around gcc taking hours and/or OOM'ing on this file --NOOPTFILES= \ -- $(SLO)$/qnametostr.obj -- - SLOFILES= \ - $(SLO)$/Fraction.obj \ - $(SLO)$/LoggedResources.obj \ diff --git a/libreoffice.spec b/libreoffice.spec index b43b2c8..43a29bc 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -26,50 +26,41 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 -Version: 3.4.4.2 -Release: 5%{?dist} +Version: 3.5.0.0 +Release: 1%{?dist} License: LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and (CDDL or GPLv2) and Public Domain Group: Applications/Productivity URL: http://www.documentfoundation.org/develop BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Source0: %{source_url}/libreoffice-artwork-%{version}.tar.bz2 -Source1: %{source_url}/libreoffice-base-%{version}.tar.bz2 -Source2: %{source_url}/libreoffice-bootstrap-%{version}.tar.bz2 -Source3: %{source_url}/libreoffice-calc-%{version}.tar.bz2 -Source4: %{source_url}/libreoffice-components-%{version}.tar.bz2 -Source5: %{source_url}/libreoffice-extensions-%{version}.tar.bz2 -Source6: %{source_url}/libreoffice-extras-%{version}.tar.bz2 -Source7: %{source_url}/libreoffice-filters-%{version}.tar.bz2 -Source8: %{source_url}/libreoffice-help-%{version}.tar.bz2 -Source9: %{source_url}/libreoffice-impress-%{version}.tar.bz2 -Source10: %{source_url}/libreoffice-libs-core-%{version}.tar.bz2 -Source11: %{source_url}/libreoffice-libs-extern-%{version}.tar.bz2 -Source12: %{source_url}/libreoffice-libs-extern-sys-%{version}.tar.bz2 -Source13: %{source_url}/libreoffice-libs-gui-%{version}.tar.bz2 -Source14: %{source_url}/libreoffice-postprocess-%{version}.tar.bz2 -Source15: %{source_url}/libreoffice-sdk-%{version}.tar.bz2 -Source16: %{source_url}/libreoffice-testing-%{version}.tar.bz2 -Source17: %{source_url}/libreoffice-ure-%{version}.tar.bz2 -Source18: %{source_url}/libreoffice-writer-%{version}.tar.bz2 -Source19: %{source_url}/libreoffice-translations-%{version}.tar.bz2 -Source20: http://dev-www.libreoffice.org/extern/185d60944ea767075d27247c3162b3bc-unowinreg.dll -Source21: redhat-langpacks.tar.gz -Source22: libreoffice-multiliblauncher.sh -Source23: http://hg.services.openoffice.org/binaries/fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz -Source24: http://hg.services.openoffice.org/binaries/a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip -Source25: http://hg.services.openoffice.org/binaries/1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz -Source26: http://hg.services.openoffice.org/binaries/798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip -Source27: http://hg.services.openoffice.org/binaries/35c94d2df8893241173de1d16b6034c0-swingExSrc.zip -Source28: http://hg.services.openoffice.org/binaries/ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip -Source29: http://hg.services.openoffice.org/binaries/18f577b374d60b3c760a3a3350407632-STLport-4.5.tar.gz + +Source0: %{source_url}/libreoffice-core-%{version}.tar.bz2 +Source1: %{source_url}/libreoffice-binfilter-%{version}.tar.bz2 +Source2: %{source_url}/libreoffice-help-%{version}.tar.bz2 +Source3: %{source_url}/libreoffice-translations-%{version}.tar.bz2 +Source4: http://dev-www.libreoffice.org/extern/185d60944ea767075d27247c3162b3bc-unowinreg.dll +Source5: redhat-langpacks.tar.gz +Source6: libreoffice-multiliblauncher.sh +Source7: http://hg.services.openoffice.org/binaries/fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz +Source8: http://hg.services.openoffice.org/binaries/a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip +Source9: http://hg.services.openoffice.org/binaries/1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz +Source10: http://hg.services.openoffice.org/binaries/798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip +Source11: http://hg.services.openoffice.org/binaries/35c94d2df8893241173de1d16b6034c0-swingExSrc.zip +Source12: http://hg.services.openoffice.org/binaries/ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip +Source13: http://hg.services.openoffice.org/binaries/18f577b374d60b3c760a3a3350407632-STLport-4.5.tar.gz #Unfortunately later versions of hsqldb changed the file format, so if we use a later version we loose #backwards compatability. -Source30: http://hg.services.openoffice.org/binaries/17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip -Source31: http://dev-www.libreoffice.org/extern/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 +Source14: http://hg.services.openoffice.org/binaries/17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip +Source15: http://dev-www.libreoffice.org/extern/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 %if 0%{?rhel} -Source32: http://dev-www.libreoffice.org/src/0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2 -Source33: http://hg.services.openoffice.org/binaries/067201ea8b126597670b5eff72e1f66c-mythes-1.2.0.tar.gz +Source16: http://dev-www.libreoffice.org/src/0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2 +Source17: http://hg.services.openoffice.org/binaries/067201ea8b126597670b5eff72e1f66c-mythes-1.2.0.tar.gz %endif +Source18: http://dev-www.libreoffice.org/src/a8b25a0bf696fd126a08319d88998492-libvisio-0.0.11.tar.bz2 +Source19: http://dev-www.libreoffice.org/src/e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 +Source20: http://dev-www.libreoffice.org/src/7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz +# TODO: IIRC mysql-connector-cpp is in Fedora. Is it usable? +Source21: http://dev-www.libreoffice.org/src/0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz + BuildRequires: zip, findutils, autoconf, flex, bison, icu, gperf, gcc-c++ BuildRequires: binutils, java-devel <= 1.6.0, boost-devel, zlib-devel BuildRequires: python-devel, expat-devel, libxml2-devel, libxslt-devel, bc @@ -107,50 +98,21 @@ Patch3: openoffice.org-3.0.0.ooo88341.sc.verticalboxes.patch Patch4: openoffice.org-3.1.0.oooXXXXX.solenv.allowmissing.patch Patch5: openoffice.org-3.1.0.ooo101274.opening-a-directory.patch Patch6: openoffice.org-3.1.1.ooo105784.vcl.sniffscriptforsubs.patch -Patch7: openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch -Patch8: openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch -Patch9: libreoffice-installfix.patch -Patch10: 0001-helgrind-Related-rhbz-655686-get-order-of-shutdown-c.patch -Patch11: kde4configure.patch -Patch12: 0001-Resolves-rhbz-695509-crash-in-RefreshDocumentLB.patch -Patch13: 0001-bubble-down-configure-test-findings-on-visibility.patch -Patch14: vbahelper.visibility.patch -Patch15: 0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch -Patch16: 0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch -Patch17: 0001-Resolves-rhbz-713154-pdf-export-dialog-too-tall-to-f.patch -Patch18: 0001-Related-rhbz-702833-addEventListener-without-removeE.patch -Patch19: 0001-Related-rhbz-711087-band-aid.patch -Patch20: 0001-rhbz-667082-do-not-crash-importing-section-containin.patch -Patch21: 0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch -Patch22: 0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch -Patch23: 0001-Resolves-rhbz-693265-fix-crash-from-unhandled-except.patch -Patch24: 0001-Related-rhbz-730225-avoid-segv-in-ld-this-was-set-to.patch -Patch25: gdb-pretty-printers.patch -Patch26: 0001-Related-fdo-37195-migrationoo3-not-registered.patch -Patch27: 0001-Resolves-rhbz-738255-avoid-crash-on-NULL-pointer.patch -Patch28: 0001-avoid-using-com.sun.org-apis.patch -Patch29: 0001-add-Oracle-Java-1.7.0-recognition.patch -Patch30: 0001-Resolves-fdo-32665-handle-that-FreeSerif-lacks-some-.patch -Patch31: Backport-reading-AES-encrypted-ODF-1.2-documents.patch +Patch7: libreoffice-installfix.patch %if 0%{?rhel} -Patch32: libreoffice-libwpd08-1.patch -Patch33: libreoffice-libwpd08-2.patch -Patch34: 0001-wpsimport-writerperfect.diff-WPS-Import-filter-core-.patch -Patch35: libreoffice-gcj.patch -Patch36: libreoffice-rhel6poppler.patch +Patch8: libreoffice-libwpd08-1.patch +Patch9: libreoffice-libwpd08-2.patch +Patch10: 0001-wpsimport-writerperfect.diff-WPS-Import-filter-core-.patch +Patch11: libreoffice-gcj.patch +Patch12: libreoffice-rhel6poppler.patch %endif -Patch37: 0001-Related-i58612-don-t-crash-anyway.patch -Patch38: 0001-fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch -Patch39: 0001-Related-rhbz-753201-fedora-ant-java-1.5.0-gcj-won-t-.patch -Patch40: solenv.fix.mk.inheritance.patch -Patch41: libreoffice-ppc64.patch -Patch42: 0001-Resolves-rhbz-751290-KDE-black-on-dark-tooltips.patch -Patch43: 0001-gtk3-fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch +Patch13: solenv.fix.mk.inheritance.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice %define ureinstdir %{baseinstdir}/ure +# TODO: bin basisinstdir %define basisinstdir %{baseinstdir}/basis3.4 %define sdkinstdir %{baseinstdir}/basis3.4/sdk %define fontname opensymbol @@ -779,7 +741,7 @@ Rules for auto-correcting common %{langname} typing errors. \ %endif %prep -%setup -q -c -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 +%setup -q -c -a 1 -a 2 -a 3 for a in */*; do mv `pwd`/$a .; done #Customize Palette to remove Sun colours and add Red Hat colours (head -n -1 extras/source/palettes/standard.soc && \ @@ -791,55 +753,26 @@ for a in */*; do mv `pwd`/$a .; done tail -n 1 extras/source/palettes/standard.soc) > redhat.soc mv -f redhat.soc extras/source/palettes/standard.soc %patch1 -p1 +# TODO: fix patches %patch2 -p1 -b .ooo86080.unopkg.bodge.patch %patch3 -p1 -b .ooo88341.sc.verticalboxes.patch %patch4 -p1 -b .oooXXXXX.solenv.allowmissing.patch -%patch5 -p0 -b .ooo101274.opening-a-directory.patch -%patch6 -p0 -b .ooo105784.vcl.sniffscriptforsubs.patch -%patch7 -p1 -b .ooo108637.sfx2.uisavedir.patch -%patch8 -p0 -b .ooo113273.desktop.resolvelinks.patch -%patch9 -p1 -b .libreoffice-installfix.patch -%patch10 -p1 -b .rhbz655686-get-order-of-shutdown-c.patch -%patch11 -p0 -b .kde4configure.patch -%patch12 -p1 -b .rhbz695509-crash-in-RefreshDocumentLB.patch -%patch13 -p1 -b .bubble-down-configure-test-findings-on-visibility.patch -%patch14 -p0 -b .vbahelper.visibility.patch -%patch15 -p1 -b .rhbz702635-set-correct-page-number-when-exporting-s.patch -%patch16 -p1 -b .rhbz652604-better-survive-exceptions-thrown.patch -%patch17 -p1 -b .rhbz713154-pdf-export-dialog-too-tall-to-f.patch -%patch18 -p1 -b .rhbz702833-addEventListener-without-removeE.patch -%patch19 -p1 -b .rhbz711087-band-aid.patch -%patch20 -p1 -b .rhbz667082-do-not-crash-importing-section-containin.patch -%patch21 -p1 -b .rhbz718976-crash-in-SwTxtSizeInfo-GetMultiC.patch -%patch22 -p1 -b .rhbz715549-use-fontconfig-s-detected-forma.patch -%patch23 -p1 -b .rhbz693265-fix-crash-from-unhandled-except.patch -%patch24 -p1 -b .rhbz730225-avoid-segv-in-ld-this-was-set-to.patch -%patch25 -p1 -%patch26 -p1 -b .fdo37195-migrationoo3-not-registered.patch -%patch27 -p1 -b .rhbz738255-avoid-crash-on-NULL-pointer.patch -%patch28 -p1 -b .avoid-using-com.sun.org-apis.patch -%patch29 -p1 -b .add-Oracle-Java-1.7.0-recognition.patch -%patch30 -p1 -b .fdo32665-handle-that-FreeSerif-lacks-some-.patch -%patch31 -p1 -b .Backport-reading-AES-encrypted-ODF-1.2-documents.patch +#%patch5 -p0 -b .ooo101274.opening-a-directory.patch +#%patch6 -p0 -b .ooo105784.vcl.sniffscriptforsubs.patch +%patch7 -p1 -b .libreoffice-installfix.patch %if 0%{?rhel} -%patch32 -p1 -b .libwpd08-1.patch -%patch33 -p1 -R -b .libreoffice-libwpd08-2.patch -%patch34 -p1 -R -b .wpsimport -%patch35 -p1 -b .gcj.patch -%patch36 -p0 -b .rhel6poppler.patch +%patch8 -p1 -b .libwpd08-1.patch +%patch9 -p1 -R -b .libreoffice-libwpd08-2.patch +%patch10 -p1 -R -b .wpsimport +%patch11 -p1 -b .gcj.patch +%patch12 -p0 -b .rhel6poppler.patch %endif -%patch37 -p1 -b .i58612-don-t-crash-anyway.patch -%patch38 -p1 -b .fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch -%patch39 -p1 -b .rhbz753201-fedora-ant-java-1.5.0-gcj-won-t-.patch -%patch40 -p1 -b .solenv.fix.mk.inheritance.patch -%patch41 -p1 -b .libreoffice-ppc64.patch -%patch42 -p1 -b .rhbz751290-KDE-black-on-dark-tooltips.patch -%patch43 -p1 -b .fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch +#%patch13 -p1 -b .solenv.fix.mk.inheritance.patch +# TODO: check this # these are horribly incomplete--empty translations and copied english # strings with spattering of translated strings rm -rf translations/source/{gu,he,hr}/helpcontent2 -chmod +x solenv/bin/install-gdb-printers %build echo build start time is `date`, diskspace: `df -h . | tail -n 1` @@ -877,6 +810,8 @@ export CXXFLAGS=$ARCH_FLAGS %endif autoconf +# TODO: review the options +# TODO: --with-poor-help-localizations is gone, IIRC %configure \ %vendoroption --with-num-cpus=$NBUILDS --with-max-jobs=$NDMAKES \ --with-build-version="Ver: %{version}-%{release}" --with-unix-wrapper=%{name} \ @@ -887,7 +822,7 @@ autoconf --enable-ext-presenter-console --enable-ext-pdfimport \ --enable-ext-wiki-publisher --enable-ext-report-builder \ --enable-ext-scripting-beanshell --enable-ext-scripting-javascript \ - --enable-ext-scripting-python --with-system-libtextcat \ + --enable-ext-scripting-python --without-system-libexttextcat \ --with-system-jfreereport --with-vba-package-format="builtin" \ --with-system-libs --with-system-headers --with-system-mozilla \ --with-system-mythes --with-system-dicts --with-system-apache-commons \ @@ -896,23 +831,29 @@ autoconf %{with_lang} --with-poor-help-localizations="$POORHELPS" \ --with-external-tar=`pwd`/ext_sources --with-java-target-version=1.5 \ --with-external-libtextcat-data --without-system-translate-toolkit \ + --without-system-libcmis --without-system-libvisio \ + --without-system-mysql-cppconn \ %{distrooptions} mkdir -p ext_sources -cp %{SOURCE20} ext_sources -cp %{SOURCE23} ext_sources -cp %{SOURCE24} ext_sources -cp %{SOURCE25} ext_sources -cp %{SOURCE26} ext_sources -cp %{SOURCE27} ext_sources -cp %{SOURCE28} ext_sources -cp %{SOURCE29} ext_sources -cp %{SOURCE30} ext_sources -cp %{SOURCE31} ext_sources +cp %{SOURCE4} ext_sources +cp %{SOURCE7} ext_sources +cp %{SOURCE8} ext_sources +cp %{SOURCE9} ext_sources +cp %{SOURCE10} ext_sources +cp %{SOURCE11} ext_sources +cp %{SOURCE12} ext_sources +cp %{SOURCE13} ext_sources +cp %{SOURCE14} ext_sources +cp %{SOURCE15} ext_sources %if 0%{?rhel} -cp %{SOURCE32} ext_sources -cp %{SOURCE33} ext_sources +cp %{SOURCE16} ext_sources +cp %{SOURCE17} ext_sources %endif +cp %{SOURCE18} ext_sources +cp %{SOURCE19} ext_sources +cp %{SOURCE20} ext_sources +cp %{SOURCE21} ext_sources touch src.downloaded . ./*[Ee]nv.[Ss]et.sh @@ -993,6 +934,7 @@ cd ../../ %install_bundled_extension -n presentation-minimizer -f minimizer/presentation-minimizer.oxt %install_bundled_extension -n presenter-screen -f presenter/presenter-screen.oxt %install_bundled_extension -n report-builder +# TODO: these three are not extensions anymore %install_bundled_extension -n script-provider-for-beanshell %install_bundled_extension -n script-provider-for-javascript %install_bundled_extension -n script-provider-for-python @@ -1125,7 +1067,7 @@ xh nohelp western zh-CN help cjk \ zh-TW help cjk zu nohelp western \ ) -tar xzf %{SOURCE21} +tar xzf %{SOURCE5} i=0 while [ $i -lt ${#langpackdetails[@]} ]; do @@ -1241,12 +1183,12 @@ echo \#\!/bin/sh > $RPM_BUILD_ROOT/%{_bindir}/oobase echo exec libreoffice --base \"\$@\" >> $RPM_BUILD_ROOT/%{_bindir}/oobase chmod a+x $RPM_BUILD_ROOT/%{_bindir}/oobase -cp -f %{SOURCE22} $RPM_BUILD_ROOT/%{_bindir}/unopkg +cp -f %{SOURCE6} $RPM_BUILD_ROOT/%{_bindir}/unopkg sed -i -e "s/LAUNCHER/unopkg/g" $RPM_BUILD_ROOT/%{_bindir}/unopkg sed -i -e "s/BRAND/libreoffice/g" $RPM_BUILD_ROOT/%{_bindir}/unopkg chmod a+x $RPM_BUILD_ROOT/%{_bindir}/unopkg -cp -f %{SOURCE22} $RPM_BUILD_ROOT/%{_bindir}/libreoffice +cp -f %{SOURCE6} $RPM_BUILD_ROOT/%{_bindir}/libreoffice sed -i -e "s/LAUNCHER/soffice/g" $RPM_BUILD_ROOT/%{_bindir}/libreoffice sed -i -e "s/BRAND/libreoffice/g" $RPM_BUILD_ROOT/%{_bindir}/libreoffice chmod a+x $RPM_BUILD_ROOT/%{_bindir}/libreoffice @@ -1316,7 +1258,9 @@ cp -p psprint_config/configuration/ppds/SGENPRT.PS $RPM_BUILD_ROOT/%{basisinstdi sed -i -e "s#URE_MORE_JAVA_CLASSPATH_URLS.*#& file:///usr/share/java/lucene.jar file:///usr/share/java/lucene-contrib/lucene-analyzers.jar file:///usr/share/java/postgresql-jdbc.jar#" $RPM_BUILD_ROOT/%{basisinstdir}/program/fundamentalbasisrc export DESTDIR=$RPM_BUILD_ROOT +# TODO: the command's syntax has changed install-gdb-printers -a %{_datadir}/gdb/auto-load%{baseinstdir} -c -p %{_datadir}/libreoffice/gdb +# TODO: remove this # fix arch-dependent library suffix cd solenv/gdb cat < dllpostfix.mk @@ -1334,6 +1278,7 @@ done source ./Linux*Env.Set.sh cd test build && deliver -link +# TODO: smoketestdoc is gone cd ../smoketestdoc build && deliver -link cd ../smoketestoo_native @@ -2137,6 +2082,39 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Wed Nov 30 2011 David Tardon - 3.5.0.0-1 +- first attempt at 3.5 +- drop integrated 0001-Related-fdo-37195-migrationoo3-not-registered.patch +- drop integrated 0001-Related-i58612-don-t-crash-anyway.patch +- drop integrated 0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch +- drop integrated 0001-Related-rhbz-702833-addEventListener-without-removeE.patch +- drop integrated 0001-Related-rhbz-711087-band-aid.patch +- drop integrated 0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch +- drop integrated 0001-Related-rhbz-730225-avoid-segv-in-ld-this-was-set-to.patch +- drop integrated 0001-Related-rhbz-753201-fedora-ant-java-1.5.0-gcj-won-t-.patch +- drop integrated 0001-Resolves-fdo-32665-handle-that-FreeSerif-lacks-some-.patch +- drop integrated 0001-Resolves-rhbz-693265-fix-crash-from-unhandled-except.patch +- drop integrated 0001-Resolves-rhbz-695509-crash-in-RefreshDocumentLB.patch +- drop integrated 0001-Resolves-rhbz-713154-pdf-export-dialog-too-tall-to-f.patch +- drop integrated 0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch +- drop integrated 0001-Resolves-rhbz-738255-avoid-crash-on-NULL-pointer.patch +- drop integrated 0001-Resolves-rhbz-751290-KDE-black-on-dark-tooltips.patch +- drop integrated 0001-add-Oracle-Java-1.7.0-recognition.patch +- drop integrated 0001-avoid-using-com.sun.org-apis.patch +- drop integrated 0001-bubble-down-configure-test-findings-on-visibility.patch +- drop integrated 0001-fix-horizontal-scrollbars-with-KDE-oxygen-style-bnc-.patch +- drop integrated 0001-gtk3-fix-cairo-canvas-crash-for-non-X-or-svp-backend.patch +- drop integrated 0001-helgrind-Related-rhbz-655686-get-order-of-shutdown-c.patch +- drop integrated 0001-rhbz-667082-do-not-crash-importing-section-containin.patch +- drop integrated 0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch +- drop integrated Backport-reading-AES-encrypted-ODF-1.2-documents.patch +- drop integrated gdb-pretty-printers.patch +- drop integrated kde4configure.patch +- drop integrated libreoffice-ppc64.patch +- drop integrated openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch +- drop integrated openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch +- drop integrated vbahelper.visibility.patch + * Tue Nov 29 2011 Caolán McNamara - 3.4.4.2-5 - Resolves: rhbz#757653 fix headless crash with cairo canvas diff --git a/openoffice.org-2.4.0.ooo86080.unopkg.bodge.patch b/openoffice.org-2.4.0.ooo86080.unopkg.bodge.patch index 02ebe6b..afd33a4 100644 --- a/openoffice.org-2.4.0.ooo86080.unopkg.bodge.patch +++ b/openoffice.org-2.4.0.ooo86080.unopkg.bodge.patch @@ -38,8 +38,8 @@ # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS # execute binary --exec "$sd_prog/unopkg.bin" "$@" "$JVMFWKPARAMS" \ -+"$sd_prog/unopkg.bin" "$@" "$JVMFWKPARAMS" \ +-exec "$sd_prog/unopkg.bin" "$@" $JVMFWKPARAMS \ ++"$sd_prog/unopkg.bin" "$@" $JVMFWKPARAMS \ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc" - +if [ -n "$INSTDIR" ]; then diff --git a/openoffice.org-3.1.1.ooo105784.vcl.sniffscriptforsubs.patch b/openoffice.org-3.1.1.ooo105784.vcl.sniffscriptforsubs.patch index 0c73bfe..d66c4e7 100644 --- a/openoffice.org-3.1.1.ooo105784.vcl.sniffscriptforsubs.patch +++ b/openoffice.org-3.1.1.ooo105784.vcl.sniffscriptforsubs.patch @@ -1,6 +1,6 @@ diff -ru vcl.orig/unx/source/fontmanager/fontconfig.cxx vcl/unx/source/fontmanager/fontconfig.cxx --- vcl.orig/unx/source/fontmanager/fontconfig.cxx 2009-10-08 13:25:00.000000000 +0100 -+++ vcl/unx/source/fontmanager/fontconfig.cxx 2009-10-08 13:51:51.000000000 +0100 ++++ vcl/generic/fontmanager/fontconfig.cxx 2009-10-08 13:51:51.000000000 +0100 @@ -92,6 +92,9 @@ #include "sal/alloca.h" @@ -183,14 +183,3 @@ diff -ru vcl.orig/unx/source/fontmanager/fontconfig.cxx vcl/unx/source/fontmanag addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch); // query fontconfig for a substitute -diff -ru vcl.orig/util/makefile.mk vcl/util/makefile.mk ---- vcl.orig/util/makefile.mk 2009-10-08 13:25:00.000000000 +0100 -+++ vcl/util/makefile.mk 2009-10-08 13:25:09.000000000 +0100 -@@ -298,6 +298,7 @@ - # libs for generic plugin - SHL2STDLIBS=\ - $(VCLLIB)\ -+ $(I18NUTILLIB) \ - $(I18NPAPERLIB) \ - $(I18NISOLANGLIB) \ - $(TOOLSLIB) \ diff --git a/openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch b/openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch deleted file mode 100644 index 6ea6c1d..0000000 --- a/openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -r 3c24aa9a7810 sfx2/source/doc/guisaveas.cxx ---- a/sfx2/source/doc/guisaveas.cxx Sat Jan 23 16:31:03 2010 +0000 -+++ b/sfx2/source/doc/guisaveas.cxx Sun Jan 24 17:16:37 2010 +0000 -@@ -231,7 +231,7 @@ - sal_Bool bSetStandardName, - ::rtl::OUString& aSuggestedName, - sal_Bool bPreselectPassword, -- const ::rtl::OUString& aSuggestedDir, -+ ::rtl::OUString& aSuggestedDir, - sal_Int16 nDialog, - const ::rtl::OUString& rStandardDir, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList -@@ -731,7 +731,7 @@ - sal_Bool bSetStandardName, - ::rtl::OUString& aSuggestedName, - sal_Bool bPreselectPassword, -- const ::rtl::OUString& aSuggestedDir, -+ ::rtl::OUString& aSuggestedDir, - sal_Int16 nDialog, - const ::rtl::OUString& rStandardDir, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) -@@ -927,6 +927,7 @@ - INetURLObject aURL( pFileDlg->GetPath() ); - // the path should be provided outside since it might be used for further calls to the dialog - aSuggestedName = aURL.GetName( INetURLObject::DECODE_WITH_CHARSET ); -+ aSuggestedDir = pFileDlg->GetDisplayDirectory(); - - // old filter options should be cleared in case different filter is used - -@@ -1412,10 +1413,8 @@ - sal_Bool bExit = sal_False; - while ( !bExit ) - { -+ // in case the dialog is opened a second time the folder should be the same as previously navigated to by the user, not what was handed over by initial parameters - bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aBlackList ); -- -- // in case the dialog is opend a second time the folder should be the same as before, not what was handed over by parameters -- aSuggestedDir = ::rtl::OUString(); - if ( nStoreMode == SAVEAS_REQUESTED ) - { - // in case of saving check filter for possible alien warning diff --git a/openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch b/openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch deleted file mode 100644 index ca76130..0000000 --- a/openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -ru desktop.orig/source/deployment/misc/dp_misc.cxx desktop/source/deployment/misc/dp_misc.cxx ---- desktop.orig/source/deployment/misc/dp_misc.cxx 2010-07-20 08:31:24.000000000 +0100 -+++ desktop/source/deployment/misc/dp_misc.cxx 2010-07-20 09:12:23.000000000 +0100 -@@ -143,6 +143,23 @@ - return pipe.is(); - } - -+//get modification time -+static bool getModifyTimeTargetFile(const OUString &rFileURL, TimeValue &rTime) -+{ -+ ::osl::DirectoryItem item; -+ if (::osl::DirectoryItem::get(rFileURL, item) != ::osl::File::E_None) -+ return false; -+ -+ ::osl::FileStatus stat(FileStatusMask_ModifyTime|FileStatusMask_Type|FileStatusMask_LinkTargetURL); -+ if (item.getFileStatus(stat) != ::osl::File::E_None) -+ return false; -+ -+ if( stat.getFileType() == ::osl::FileStatus::Link ) -+ return getModifyTimeTargetFile(stat.getLinkTargetURL(), rTime); -+ -+ rTime = stat.getModifyTime(); -+ return true; -+} - - //Returns true if the Folder was more recently modified then - //the lastsynchronized file. That is the repository needs to -@@ -181,15 +198,12 @@ - - //compare the modification time of the extension folder and the last - //modified file -- ::osl::FileStatus statFolder(FileStatusMask_ModifyTime); -- ::osl::FileStatus statFile(FileStatusMask_ModifyTime); -- if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None) -+ TimeValue timeFolder; -+ if (getModifyTimeTargetFile(folderURL, timeFolder)) - { -- if (itemFile.getFileStatus(statFile) == ::osl::File::E_None) -+ TimeValue timeFile; -+ if (getModifyTimeTargetFile(fileURL, timeFile)) - { -- TimeValue timeFolder = statFolder.getModifyTime(); -- TimeValue timeFile = statFile.getModifyTime(); -- - if (timeFile.Seconds < timeFolder.Seconds) - bNeedsSync = true; - } -@@ -204,6 +218,7 @@ - OSL_ASSERT(0); - bNeedsSync = true; - } -+ - return bNeedsSync; - } - diff --git a/sources b/sources index e053514..f6bce70 100644 --- a/sources +++ b/sources @@ -1,34 +1,20 @@ -185d60944ea767075d27247c3162b3bc 185d60944ea767075d27247c3162b3bc-unowinreg.dll -0ff7d225d087793c8c2c680d77aac3e7 0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2 -067201ea8b126597670b5eff72e1f66c 067201ea8b126597670b5eff72e1f66c-mythes-1.2.0.tar.gz -fdb27bfe2dbe2e7b57ae194d9bf36bab fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz -a7983f859eafb2677d7ff386a023bc40 a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip -1f24ab1d39f4a51faf22244c94a6203f 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz +bf6ce92d8d69f1dec4836a7249e10436 libreoffice-core-3.5.0.0.tar.bz2 +346304e8699ca8d8d642072bff79909d libreoffice-binfilter-3.5.0.0.tar.bz2 798b2ffdc8bcfe7bca2cf92b62caf685 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip 35c94d2df8893241173de1d16b6034c0 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip ada24d37d8d638b3d8a9985e80bc2978 ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip 18f577b374d60b3c760a3a3350407632 18f577b374d60b3c760a3a3350407632-STLport-4.5.tar.gz 17410483b5b5f267aa18b7e00b65e6e0 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip b4cae0700aa1c2aef7eb7f345365e6f1 b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 -03c019658ec49050c8103ba0f10b5067 redhat-langpacks.tar.gz -f447fd4ffe54aab9561c6caa262754b3 libreoffice-calc-3.4.4.2.tar.bz2 +a8b25a0bf696fd126a08319d88998492 a8b25a0bf696fd126a08319d88998492-libvisio-0.0.11.tar.bz2 +e1c178b18f130b40494561f02bc1a948 e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 +a0b19441245d7627c299d7014d110b32 libreoffice-help-3.5.0.0.tar.bz2 +7c2549f6b0a8bb604e6c4c729ffdcfe6 7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz +0981bda6548a8c8233ffce2b6e4b2a23 0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz +b9dee0572120c87906ed6e2fb4696b69 libreoffice-translations-3.5.0.0.tar.bz2 +185d60944ea767075d27247c3162b3bc 185d60944ea767075d27247c3162b3bc-unowinreg.dll +1531d95e2d359f7fc2295f1b5d2a23cb redhat-langpacks.tar.gz 74939c9ea525374776f09bf972ede99f libreoffice-multiliblauncher.sh -97fe698737a35c8803712d4e08007620 libreoffice-components-3.4.4.2.tar.bz2 -acff44d97a5106d9b53c747dabeb0800 libreoffice-extensions-3.4.4.2.tar.bz2 -620d43a0b9f36388f423e030513864ef libreoffice-extras-3.4.4.2.tar.bz2 -4c5b1ed870363eca2602f0cb42a8415a libreoffice-filters-3.4.4.2.tar.bz2 -702c6ca31525d7d2c2ded86c77b0bd2e libreoffice-help-3.4.4.2.tar.bz2 -ac9b3acf78f43c1395d0e2dedc860f30 libreoffice-impress-3.4.4.2.tar.bz2 -be8b13f83045f0a53b69fe76d6d72e9c libreoffice-artwork-3.4.4.2.tar.bz2 -db423cbb1cee416b718138044a5de930 libreoffice-base-3.4.4.2.tar.bz2 -d8d2c41cb86bc8ba2a07e001a5317abb libreoffice-libs-core-3.4.4.2.tar.bz2 -4d4af2fc06dbe33ec2307df812f7abe1 libreoffice-libs-extern-3.4.4.2.tar.bz2 -1398a566eb76598bf3005e187fc2386c libreoffice-libs-extern-sys-3.4.4.2.tar.bz2 -dd962d2d57f88b9e07e665adad3cabbc libreoffice-libs-gui-3.4.4.2.tar.bz2 -fff0fc9cd16ef1eb2b2ed5d0a6e77f95 libreoffice-postprocess-3.4.4.2.tar.bz2 -e54d41d39e63d04ac4a88ce79e37af98 libreoffice-sdk-3.4.4.2.tar.bz2 -dbc71403040f447683bf55d1f0be3cad libreoffice-testing-3.4.4.2.tar.bz2 -69ce5b72f44b008d0e78767c5b1dbf39 libreoffice-ure-3.4.4.2.tar.bz2 -34a2e8ae6b81a042966740263c53e135 libreoffice-writer-3.4.4.2.tar.bz2 -882e7035b77c63b8aa6fd0039f3075c0 libreoffice-translations-3.4.4.2.tar.bz2 -31944d2139d6d81ef1131bd513530621 libreoffice-bootstrap-3.4.4.2.tar.bz2 +fdb27bfe2dbe2e7b57ae194d9bf36bab fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz +a7983f859eafb2677d7ff386a023bc40 a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip +1f24ab1d39f4a51faf22244c94a6203f 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz diff --git a/vbahelper.visibility.patch b/vbahelper.visibility.patch deleted file mode 100644 index 5739100..0000000 --- a/vbahelper.visibility.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2011-01-28 20:27:51.507604173 +0000 -+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2011-01-28 20:28:26.230045727 +0000 -@@ -238,7 +238,7 @@ - - // including a HelperInterface implementation - template< typename Ifc1 > --class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 > -+class VBAHELPER_DLLPUBLIC ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 > - { - typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase; - protected: ---- sc/Library_vbaobj.mk -+++ sc/Library_vbaobj.mk -@@ -118,7 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\ - sc/source/ui/vba/vbaquerytable \ - sc/source/ui/vba/vbarange \ - sc/source/ui/vba/vbasheetobject \ -- sc/source/ui/vba/vbasheetobjects \ - sc/source/ui/vba/vbastyle \ - sc/source/ui/vba/vbastyles \ - sc/source/ui/vba/vbatextboxshape \ -@@ -133,6 +132,11 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\ - sc/source/ui/vba/vbawsfunction \ - )) - -+$(eval $(call gb_Library_add_cxxobjects,vbaobj,\ -+ sc/source/ui/vba/vbasheetobjects \ -+ , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \ -+)) -+ - ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS))) - $(eval $(call gb_Library_set_ldflags,vbaobj,\ - $$(LDFLAGS) \