diff options
61 files changed, 1060 insertions, 525 deletions
diff --git a/UnoControls/prj/build.lst b/UnoControls/prj/build.lst index de5d7fd81d33..775cb902f5ca 100644 --- a/UnoControls/prj/build.lst +++ b/UnoControls/prj/build.lst @@ -1,4 +1,4 @@ -us UnoControls : cppuhelper offuh tools NULL +us UnoControls : LIBXSLT:libxslt cppuhelper offuh tools NULL us UnoControls usr1 - all us_mkout NULL us UnoControls\source\base nmake - all us_base NULL us UnoControls\source\controls nmake - all us_ctrls NULL diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst index f410ece56d9b..4fbfe135137f 100755 --- a/accessibility/prj/build.lst +++ b/accessibility/prj/build.lst @@ -1,4 +1,4 @@ -ac accessibility : l10n tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools NULL +ac accessibility : l10n tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL ac accessibility usr1 - all ac_mkout NULL ac accessibility\inc nmake - all ac_inc NULL ac accessibility\bridge\org\openoffice\java\accessibility nmake - w ac_ooja ac_inc NULL diff --git a/basctl/prj/build.lst b/basctl/prj/build.lst index a48a698a99a7..0c5283ff0aec 100644 --- a/basctl/prj/build.lst +++ b/basctl/prj/build.lst @@ -1,4 +1,4 @@ -bc basctl : l10n svx NULL +bc basctl : LIBXSLT:libxslt l10n svx NULL bc basctl usr1 - all bc_mkout NULL bc basctl\inc nmake - all bc_inc NULL bc basctl\source\inc get - all bc_sinc NULL diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 782485b535a2..68cdbe9ad9ed 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1635,9 +1635,10 @@ void __EXPORT StackWindow::UpdateCalls() aEntry += pParam->aName; } aEntry += '='; - if( pVar->GetType() & SbxARRAY ) + SbxDataType eType = pVar->GetType(); + if( eType & SbxARRAY ) aEntry += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); - else + else if( eType != SbxOBJECT ) aEntry += pVar->GetString(); if ( nParam < ( pParams->Count() - 1 ) ) aEntry += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 55dec2566205..0af7b9dda920 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -161,8 +161,6 @@ SFX_IMPL_NAMED_VIEWFACTORY( BasicIDEShell, "Default" ) } -// MI: Prinzipiel IDL, aber ich lieber doch nicht? -// SFX_IMPL_ /*IDL_*/ INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) { SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); diff --git a/basctl/util/makefile.mk b/basctl/util/makefile.mk index b33fa3f1d721..e690a5a20a3b 100644 --- a/basctl/util/makefile.mk +++ b/basctl/util/makefile.mk @@ -91,8 +91,6 @@ SRSFILELIST=\ $(SRS)$/basicide.srs \ $(SRS)$/dlged.srs -SRSFILELIST+= $(SOLARCOMMONRESDIR)$/sfx.srs - RESLIB1NAME=basctl RESLIB1IMAGES =$(PRJ)$/res RESLIB1SRSFILES= $(SRSFILELIST) diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index de24ee12e98a..d1e46125d965 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -55,7 +55,6 @@ #include "boost/scoped_ptr.hpp" #include "boost/shared_ptr.hpp" #include "boost/spirit/core.hpp" -#include "bootstrp/sstring.hxx" #include "com/sun/star/accessibility/AccessibleEventId.hpp" #include "com/sun/star/accessibility/AccessibleEventObject.hpp" #include "com/sun/star/accessibility/AccessibleRelationType.hpp" @@ -754,7 +753,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index e074c0a19ff5..25ccabf2789b 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -40,6 +40,7 @@ #include <sfx2/app.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/minfitem.hxx> +#include <sfx2/sfxresid.hxx> #include <svl/stritem.hxx> #include "cuires.hrc" @@ -721,7 +722,6 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt , aResetButton (this , CUI_RES(BTN_RESET )) , aLoadAccelConfigStr ( CUI_RES( STR_LOADACCELCONFIG ) ) , aSaveAccelConfigStr ( CUI_RES( STR_SAVEACCELCONFIG ) ) - , aFilterAllStr ( CUI_RES( STR_SFX_FILTERNAME_ALL ) ) , aFilterCfgStr ( CUI_RES( STR_FILTERNAME_CFG ) ) , m_bStylesInfoInitialized(sal_False) , m_xGlobal () @@ -730,6 +730,8 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt { FreeResource(); + aFilterAllStr = String( SfxResId( STR_SFX_FILTERNAME_ALL ) ); + // install handler functions aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl )); aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl )); diff --git a/cui/source/customize/acccfg.src b/cui/source/customize/acccfg.src index b94ea163e0c7..de5d4b89f186 100644 --- a/cui/source/customize/acccfg.src +++ b/cui/source/customize/acccfg.src @@ -199,10 +199,6 @@ TabPage RID_SVXPAGE_KEYBOARD { Text [ en-US ] = "Save Keyboard Configuration" ; }; - String STR_SFX_FILTERNAME_ALL - { - Text [ en-US ] = "All files (*.*)" ; - }; String STR_FILTERNAME_CFG { Text [ en-US ] = "Configuration" ; diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index 9766a1b5130f..aea3e5a16ffb 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -31,7 +31,7 @@ #include <svx/orienthelper.hxx> #include <vcl/field.hxx> -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> #include <sfx2/tabdlg.hxx> diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx index 56aedff40de1..954866383c4b 100644 --- a/cui/source/inc/cuigaldlg.hxx +++ b/cui/source/inc/cuigaldlg.hxx @@ -46,7 +46,8 @@ #include <com/sun/star/media/XPlayer.hpp> #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> #include <svtools/dialogclosedlistener.hxx> -#include <bootstrp/sstring.hxx> + +DECLARE_LIST( StringList, String* ) // ------------ // - Forwards - diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx index 0a7b92438db4..701546225bf4 100644 --- a/cui/source/inc/postdlg.hxx +++ b/cui/source/inc/postdlg.hxx @@ -33,7 +33,7 @@ #include <vcl/group.hxx> #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #ifndef _EDIT_HXX //autogen #include <vcl/edit.hxx> diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx index fc1640fd1dea..4e08cebf2866 100644 --- a/cui/source/inc/splitcelldlg.hxx +++ b/cui/source/inc/splitcelldlg.hxx @@ -29,7 +29,7 @@ #include <vcl/fixed.hxx> #include <vcl/field.hxx> -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #include <vcl/button.hxx> #include <svx/stddlg.hxx> diff --git a/embedserv/prj/build.lst b/embedserv/prj/build.lst index 73e2b81de182..189479e4bca3 100755 --- a/embedserv/prj/build.lst +++ b/embedserv/prj/build.lst @@ -1,4 +1,4 @@ -es embedserv : offuh sal cppu cppuhelper comphelper NULL +es embedserv : offuh sal cppu cppuhelper comphelper LIBXSLT:libxslt NULL es embedserv usr1 - w es_mkout NULL es embedserv\source\embed nmake - w es_embed NULL es embedserv\source\inprocserv nmake - w es_inproc NULL diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst index c6f83f789b92..f283da39a4af 100644 --- a/extensions/prj/build.lst +++ b/extensions/prj/build.lst @@ -1,4 +1,4 @@ -ex extensions : officecfg l10n rdbmaker svx SANE:sane TWAIN:twain np_sdk offuh stoc ZLIB:zlib CURL:curl NULL +ex extensions : officecfg l10n rdbmaker svx SANE:sane TWAIN:twain np_sdk offuh stoc ZLIB:zlib CURL:curl LIBXSLT:libxslt NULL ex extensions usr1 - all ex_mkout NULL ex extensions\inc nmake - all ex_inc NULL diff --git a/extensions/source/bibliography/makefile.mk b/extensions/source/bibliography/makefile.mk index e24c32237533..b681c6c90b19 100644 --- a/extensions/source/bibliography/makefile.mk +++ b/extensions/source/bibliography/makefile.mk @@ -54,7 +54,6 @@ SRS1NAME=$(TARGET) SRC1FILES= bib.src \ datman.src \ sections.src \ - menu.src \ toolbar.src RESLIB1NAME=bib diff --git a/extensions/source/bibliography/menu.src b/extensions/source/bibliography/menu.src index 0ccc8a1c7f41..a2a41ed06def 100644 --- a/extensions/source/bibliography/menu.src +++ b/extensions/source/bibliography/menu.src @@ -27,14 +27,8 @@ #include <svl/solar.hrc> #include <svx/svxids.hrc> -#ifndef _GLOBLMN_HRC #include <svx/globlmn.hrc> -#endif -#ifndef _GLOBALACC_SRC -#include <svx/globlac.hrc> -#endif #include "bibliography.hrc" - #include "bib.hrc" /* diff --git a/extensions/source/macosx/spotlight/makefile.mk b/extensions/source/macosx/spotlight/makefile.mk index 3d1cb12d1dab..e7b15150bd03 100644 --- a/extensions/source/macosx/spotlight/makefile.mk +++ b/extensions/source/macosx/spotlight/makefile.mk @@ -74,8 +74,11 @@ ZIP1LIST = * .INCLUDE : target.mk +.IF "$(ZIP1TARGETN)"!="" $(ZIP1TARGETN) : $(plistfiles) $(binaries) $(resources) +.ENDIF # "$(ZIP1TARGETN)"!="" + # Info.plist is just versioned and copied into the bundle $(CONTENTS)$/%.plist : mdimporter/%.plist $(MKDIRHIER) $(@:d) diff --git a/extensions/source/nsplugin/source/makefile.mk b/extensions/source/nsplugin/source/makefile.mk index 4f9be74348ab..5a0870b47194 100644 --- a/extensions/source/nsplugin/source/makefile.mk +++ b/extensions/source/nsplugin/source/makefile.mk @@ -77,7 +77,7 @@ SHL1STDLIBS+=$(SOLARLIBDIR)$/npunix.o #.ENDIF #FREEBSD .ENDIF #UNX .IF "$(GUI)"=="WNT" -SHL1OBJS+=$(SOLARLIBDIR)$/pathutils-slo.obj +SHL1OBJS+=$(SOLARLIBDIR)$/pathutils-obj.obj STDLIBS+=$(SOLARLIBDIR)$/npwin.obj SHL1STDLIBS+= $(SHELL32LIB) $(SOLARLIBDIR)$/npwin.obj diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 89cb5625bca3..949fb6c7c9b2 100755 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -74,6 +74,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::bridge; using namespace com::sun::star::bridge::oleautomation; using namespace com::sun::star::bridge::ModelDependent; +using namespace ::com::sun::star; #define JSCRIPT_ID_PROPERTY L"_environment" #define JSCRIPT_ID L"jscript" @@ -155,8 +156,8 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t) if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) && !m_spDispatch) return Any(); - return WeakImplHelper6<XInvocation, XBridgeSupplier2, - XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>::queryInterface(t); + return WeakImplHelper7<XInvocation, XBridgeSupplier2, + XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation>::queryInterface(t); } Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void) @@ -1174,7 +1175,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, - // -------------------------- +// -------------------------- // XInitialization void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) { @@ -1257,6 +1258,274 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument } } +// -------------------------- +// XDirectInvocation +uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const ::rtl::OUString& aName, const uno::Sequence< uno::Any >& aParams ) + throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + Any aResult; + + if ( !m_spDispatch ) + { + throw RuntimeException( + OUSTR("[automation bridge] The object does not have an IDispatch interface"), + Reference<XInterface>()); + } + + o2u_attachCurrentThread(); + DISPID dispid; + if ( !getDispid( aName, &dispid ) ) + throw IllegalArgumentException( + OUSTR( "[automation bridge] The object does not have a function or property " ) + + aName, Reference<XInterface>(), 0); + + CComVariant varResult; + ExcepInfo excepinfo; + unsigned int uArgErr = 0; + INVOKEKIND pInvkinds[2]; + pInvkinds[0] = INVOKE_FUNC; + pInvkinds[1] = aParams.getLength() ? INVOKE_PROPERTYPUT : INVOKE_PROPERTYGET; + HRESULT hInvRes = E_FAIL; + + // try Invoke first, if it does not work, try put/get property + for ( sal_Int32 nStep = 0; FAILED( hInvRes ) && nStep < 2; nStep++ ) + { + DISPPARAMS dispparams = {NULL, NULL, 0, 0}; + + DISPID idPropertyPut = DISPID_PROPERTYPUT; + scoped_array<DISPID> arDispidNamedArgs; + scoped_array<CComVariant> ptrArgs; + scoped_array<CComVariant> ptrRefArgs; // referenced arguments + CComVariant * arArgs = NULL; + CComVariant * arRefArgs = NULL; + bool bVarargParam = false; + + dispparams.cArgs = aParams.getLength(); + + // Determine the number of named arguments + for ( sal_Int32 nInd = 0; nInd < aParams.getLength(); nInd++ ) + if ( aParams[nInd].getValueType() == getCppuType((NamedArgument*) 0) ) + dispparams.cNamedArgs ++; + + // fill the named arguments + if ( dispparams.cNamedArgs > 0 + && !( dispparams.cNamedArgs == 1 && pInvkinds[nStep] == INVOKE_PROPERTYPUT ) ) + { + int nSizeAr = dispparams.cNamedArgs + 1; + if ( pInvkinds[nStep] == INVOKE_PROPERTYPUT ) + nSizeAr = dispparams.cNamedArgs; + + scoped_array<OLECHAR*> saNames(new OLECHAR*[nSizeAr]); + OLECHAR ** pNames = saNames.get(); + pNames[0] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(aName.getStr())); + + int cNamedArg = 0; + for ( size_t nInd = 0; nInd < dispparams.cArgs; nInd++ ) + { + if ( aParams[nInd].getValueType() == getCppuType((NamedArgument*) 0)) + { + const NamedArgument& arg = *(NamedArgument const*)aParams[nInd].getValue(); + + //We put the parameter names in reverse order into the array, + //so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs + //The first name in the array is the method name + pNames[nSizeAr - 1 - cNamedArg++] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(arg.Name.getStr())); + } + } + + arDispidNamedArgs.reset( new DISPID[nSizeAr] ); + HRESULT hr = getTypeInfo()->GetIDsOfNames( pNames, nSizeAr, arDispidNamedArgs.get() ); + if ( hr == E_NOTIMPL ) + hr = m_spDispatch->GetIDsOfNames(IID_NULL, pNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() ); + + if ( SUCCEEDED( hr ) ) + { + if ( pInvkinds[nStep] == DISPATCH_PROPERTYPUT ) + { + DISPID* arIDs = arDispidNamedArgs.get(); + arIDs[0] = DISPID_PROPERTYPUT; + dispparams.rgdispidNamedArgs = arIDs; + } + else + { + DISPID* arIDs = arDispidNamedArgs.get(); + dispparams.rgdispidNamedArgs = & arIDs[1]; + } + } + else if (hr == DISP_E_UNKNOWNNAME) + { + throw IllegalArgumentException( + OUSTR("[automation bridge]One of the named arguments is wrong!"), + Reference<XInterface>(), 0); + } + else + { + throw InvocationTargetException( + OUSTR("[automation bridge] ITypeInfo::GetIDsOfNames returned error ") + + OUString::valueOf((sal_Int32) hr, 16), Reference<XInterface>(), Any()); + } + } + + //Convert arguments + ptrArgs.reset(new CComVariant[dispparams.cArgs]); + ptrRefArgs.reset(new CComVariant[dispparams.cArgs]); + arArgs = ptrArgs.get(); + arRefArgs = ptrRefArgs.get(); + + sal_Int32 nInd = 0; + try + { + sal_Int32 revIndex = 0; + for ( nInd = 0; nInd < sal_Int32(dispparams.cArgs); nInd++) + { + revIndex = dispparams.cArgs - nInd - 1; + arRefArgs[revIndex].byref = 0; + Any anyArg; + if ( nInd < aParams.getLength() ) + anyArg = aParams.getConstArray()[nInd]; + + // Property Put arguments + if ( anyArg.getValueType() == getCppuType((PropertyPutArgument*)0) ) + { + PropertyPutArgument arg; + anyArg >>= arg; + anyArg <<= arg.Value; + } + // named argument + if (anyArg.getValueType() == getCppuType((NamedArgument*) 0)) + { + NamedArgument aNamedArgument; + anyArg >>= aNamedArgument; + anyArg <<= aNamedArgument.Value; + } + + if ( nInd < aParams.getLength() && anyArg.getValueTypeClass() != TypeClass_VOID ) + { + anyToVariant( &arArgs[revIndex], anyArg, VT_VARIANT ); + } + else + { + arArgs[revIndex].vt = VT_ERROR; + arArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; + } + } + } + catch (IllegalArgumentException & e) + { + e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, sal_Int32 >( nInd ); + throw; + } + catch (CannotConvertException & e) + { + e.ArgumentIndex = nInd; + throw; + } + + dispparams.rgvarg = arArgs; + // invoking OLE method + DWORD localeId = LOCALE_USER_DEFAULT; + hInvRes = m_spDispatch->Invoke( dispid, + IID_NULL, + localeId, + ::sal::static_int_cast< WORD, INVOKEKIND >( pInvkinds[nStep] ), + &dispparams, + &varResult, + &excepinfo, + &uArgErr); + } + + // converting return value and out parameter back to UNO + if ( SUCCEEDED( hInvRes ) ) + variantToAny( &varResult, aResult, sal_False ); + else + { + // map error codes to exceptions + OUString message; + switch ( hInvRes ) + { + case S_OK: + break; + case DISP_E_BADPARAMCOUNT: + throw IllegalArgumentException(OUSTR("[automation bridge] Wrong " + "number of arguments. Object returned DISP_E_BADPARAMCOUNT."), + 0, 0); + break; + case DISP_E_BADVARTYPE: + throw RuntimeException(OUSTR("[automation bridge] One or more " + "arguments have the wrong type. Object returned " + "DISP_E_BADVARTYPE."), 0); + break; + case DISP_E_EXCEPTION: + message = OUSTR("[automation bridge]: "); + message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription), + ::SysStringLen(excepinfo.bstrDescription)); + throw InvocationTargetException(message, Reference<XInterface>(), Any()); + break; + case DISP_E_MEMBERNOTFOUND: + message = OUSTR("[automation bridge]: A function with the name \"") + + aName + OUSTR("\" is not supported. Object returned " + "DISP_E_MEMBERNOTFOUND."); + throw IllegalArgumentException(message, 0, 0); + break; + case DISP_E_NONAMEDARGS: + throw IllegalArgumentException(OUSTR("[automation bridge] Object " + "returned DISP_E_NONAMEDARGS"),0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); + break; + case DISP_E_OVERFLOW: + throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[automation bridge] Call failed.")), + static_cast<XInterface*>( + static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr); + break; + case DISP_E_PARAMNOTFOUND: + throw IllegalArgumentException(OUSTR("[automation bridge]Call failed." + "Object returned DISP_E_PARAMNOTFOUND."), + 0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); + break; + case DISP_E_TYPEMISMATCH: + throw CannotConvertException(OUSTR("[automation bridge] Call failed. " + "Object returned DISP_E_TYPEMISMATCH"), + static_cast<XInterface*>( + static_cast<XWeak*>(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr); + break; + case DISP_E_UNKNOWNINTERFACE: + throw RuntimeException(OUSTR("[automation bridge] Call failed. " + "Object returned DISP_E_UNKNOWNINTERFACE."),0); + break; + case DISP_E_UNKNOWNLCID: + throw RuntimeException(OUSTR("[automation bridge] Call failed. " + "Object returned DISP_E_UNKNOWNLCID."),0); + break; + case DISP_E_PARAMNOTOPTIONAL: + throw CannotConvertException(OUSTR("[automation bridge] Call failed." + "Object returned DISP_E_PARAMNOTOPTIONAL"), + static_cast<XInterface*>(static_cast<XWeak*>(this)), + TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr); + break; + default: + throw RuntimeException(); + break; + } + } + + return aResult; +} + +::sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMember( const ::rtl::OUString& aName ) + throw (uno::RuntimeException) +{ + if ( ! m_spDispatch ) + { + throw RuntimeException( + OUSTR("[automation bridge] The object does not have an IDispatch interface"), + Reference<XInterface>()); + } + + o2u_attachCurrentThread(); + DISPID dispid; + return getDispid( aName, &dispid ); +} + + // UnoConversionUtilities -------------------------------------------------------------------------------- Reference< XInterface > IUnknownWrapper_Impl::createUnoWrapperInstance() { @@ -1591,22 +1860,6 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName, throw IllegalArgumentException( buf.makeStringAndClear(), Reference<XInterface>(), (sal_Int16) i); } - //make sure we get no void any for an in parameter. In StarBasic - //this may be caused by - // Dim arg - // obj.func(arg) - //A void any is allowed if the parameter is optional - if ( ! (aFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOPT) - && (i < nUnoArgs) && (paramFlags & PARAMFLAG_FIN) && - Params.getConstArray()[i].getValueTypeClass() == TypeClass_VOID) - { - OUStringBuffer buf(256); - buf.appendAscii("ole automation bridge: The argument at position: "); - buf.append(OUString::valueOf((sal_Int32) i)); - buf.appendAscii(" (index starts with 0) is uninitialized."); - throw IllegalArgumentException( buf.makeStringAndClear(), - Reference<XInterface>(), (sal_Int16) i); - } // Property Put arguments if (anyArg.getValueType() == getCppuType((PropertyPutArgument*)0)) @@ -1719,12 +1972,16 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName, & aFuncDesc->lprgelemdescParam[i].paramdesc. pparamdescex->varDefaultValue); } - else + else if (paramFlags & PARAMFLAG_FOPT) { - OSL_ASSERT(paramFlags & PARAMFLAG_FOPT); arArgs[revIndex].vt = VT_ERROR; arArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; } + else + { + arArgs[revIndex].vt = VT_EMPTY; + arArgs[revIndex].lVal = 0; + } } } } diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index b990ac3af17d..fa796013946e 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -50,7 +50,7 @@ #endif #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx> -#include <cppuhelper/implbase6.hxx> +#include <cppuhelper/implbase7.hxx> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp> @@ -58,6 +58,7 @@ #include <com/sun/star/script/XDefaultProperty.hpp> #include <com/sun/star/script/XDefaultMethod.hpp> +#include <com/sun/star/script/XDirectInvocation.hpp> #include <typelib/typedescription.hxx> #include "unoconversionutilities.hxx" @@ -81,7 +82,7 @@ typedef hash_multimap<OUString, unsigned int, hashOUString_Impl, equalOUString_I // This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object. // If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component. // The interface is not a real interface in terms of an abstract class but is realized through IDispatch. -class IUnknownWrapper_Impl : public WeakImplHelper6<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>, +class IUnknownWrapper_Impl : public WeakImplHelper7< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation >, public UnoConversionUtilities<IUnknownWrapper_Impl> @@ -130,10 +131,18 @@ public: // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); + + // XDefaultProperty virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } -protected: + + // XDefaultMethod virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } + // XDirectInvocation + virtual ::com::sun::star::uno::Any SAL_CALL directInvoke( const ::rtl::OUString& aName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasMember( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + +protected: // ---------------------------------------------------------------------------- virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName, const Sequence< Any >& Params, diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index ca6e1090386f..b0dc9536d0e2 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -47,7 +47,7 @@ #include <svx/svxids.hrc> #endif #include <svx/drawitem.hxx> -#include <xtable.hxx> +#include <svx/xtable.hxx> //================================================================== #include <vcl/floatwin.hxx> #include <svtools/svmedit.hxx> diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 9f78b33270c2..cca69db6ff33 100755 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -32,10 +32,8 @@ #include "updatecheckconfig.hxx" #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertyState.hpp> - -#ifndef _COM_SUN_STAR_CONTAINER_CHANGESEVENT_HPP_ -#include <com/sun/star/beans/XPropertyState.hpp> -#endif +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <osl/security.hxx> #include <osl/time.h> @@ -78,6 +76,8 @@ namespace uno = com::sun::star::uno ; #define RELEASE_NOTE "ReleaseNote" #define EXTENSION_PREFIX "Extension_" +#define PROPERTY_VERSION UNISTRING("Version") + static const sal_Char * const aUpdateEntryProperties[] = { UPDATE_VERSION, UPDATE_BUILDID, @@ -246,19 +246,19 @@ rtl::OUString UpdateCheckConfig::getAllUsersDirectory() } //------------------------------------------------------------------------------ - -UpdateCheckConfig::UpdateCheckConfig( - const uno::Reference<container::XNameContainer>& xContainer, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener -) : m_xContainer(xContainer), m_rListener(rListener) -{ -} +UpdateCheckConfig::UpdateCheckConfig( const uno::Reference<container::XNameContainer>& xContainer, + const uno::Reference<container::XNameContainer>& xAvailableUpdates, + const uno::Reference<container::XNameContainer>& xIgnoredUpdates, + const ::rtl::Reference< UpdateCheckConfigListener >& rListener ) : + m_xContainer( xContainer ), + m_xAvailableUpdates( xAvailableUpdates ), + m_xIgnoredUpdates( xIgnoredUpdates ), + m_rListener( rListener ) +{} //------------------------------------------------------------------------------ - UpdateCheckConfig::~UpdateCheckConfig() -{ -} +{} //------------------------------------------------------------------------------ @@ -295,7 +295,15 @@ UpdateCheckConfig::get( UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), uno::UNO_QUERY_THROW ); - return new UpdateCheckConfig( xContainer, rListener ); + aProperty.Value = uno::makeAny( UNISTRING("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates") ); + aArgumentList[0] = uno::makeAny( aProperty ); + uno::Reference< container::XNameContainer > xIgnoredExt( xConfigProvider->createInstanceWithArguments( UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), uno::UNO_QUERY_THROW ); + + aProperty.Value = uno::makeAny( UNISTRING("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/AvailableUpdates") ); + aArgumentList[0] = uno::makeAny( aProperty ); + uno::Reference< container::XNameContainer > xUpdateAvail( xConfigProvider->createInstanceWithArguments( UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), uno::UNO_QUERY_THROW ); + + return new UpdateCheckConfig( xContainer, xUpdateAvail, xIgnoredExt, rListener ); } //------------------------------------------------------------------------------ @@ -627,6 +635,19 @@ UpdateCheckConfig::commitChanges() } } } + + xChangesBatch = uno::Reference< util::XChangesBatch > ( m_xAvailableUpdates, uno::UNO_QUERY ); + if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + { + util::ChangesSet aChangesSet = xChangesBatch->getPendingChanges(); + xChangesBatch->commitChanges(); + } + xChangesBatch = uno::Reference< util::XChangesBatch > ( m_xIgnoredUpdates, uno::UNO_QUERY ); + if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + { + util::ChangesSet aChangesSet = xChangesBatch->getPendingChanges(); + xChangesBatch->commitChanges(); + } } //------------------------------------------------------------------------------ @@ -654,40 +675,66 @@ UpdateCheckConfig::getPendingChanges( ) throw (uno::RuntimeException) } //------------------------------------------------------------------------------ -void UpdateCheckConfig::storeExtensionVersion( const rtl::OUString& rExtensionName, +bool UpdateCheckConfig::storeExtensionVersion( const rtl::OUString& rExtensionName, const rtl::OUString& rVersion ) { - const rtl::OUString aExtName = UNISTRING( EXTENSION_PREFIX ) + rExtensionName; - const uno::Any aValue = uno::makeAny( rVersion ); + bool bNotify = true; - if( m_xContainer->hasByName( aExtName ) ) - m_xContainer->replaceByName( aExtName, aValue ); + if ( m_xAvailableUpdates->hasByName( rExtensionName ) ) + uno::Reference< beans::XPropertySet >( m_xAvailableUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->setPropertyValue( PROPERTY_VERSION, uno::Any( rVersion ) ); else - m_xContainer->insertByName( aExtName, aValue ); + { + uno::Reference< beans::XPropertySet > elem( uno::Reference< lang::XSingleServiceFactory >( m_xAvailableUpdates, uno::UNO_QUERY_THROW )->createInstance(), uno::UNO_QUERY_THROW ); + elem->setPropertyValue( PROPERTY_VERSION, uno::Any( rVersion ) ); + m_xAvailableUpdates->insertByName( rExtensionName, uno::Any( elem ) ); + } + + if ( m_xIgnoredUpdates->hasByName( rExtensionName ) ) + { + ::rtl::OUString aIgnoredVersion; + uno::Any aValue( uno::Reference< beans::XPropertySet >( m_xIgnoredUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); + aValue >>= aIgnoredVersion; + if ( aIgnoredVersion.getLength() == 0 ) // no version means ignore all updates + bNotify = false; + else if ( aIgnoredVersion == rVersion ) // the user wanted to ignore this update + bNotify = false; + } commitChanges(); + + return bNotify; } //------------------------------------------------------------------------------ bool UpdateCheckConfig::checkExtensionVersion( const rtl::OUString& rExtensionName, const rtl::OUString& rVersion ) { - const rtl::OUString aExtName = UNISTRING( EXTENSION_PREFIX ) + rExtensionName; - - if( m_xContainer->hasByName( aExtName ) ) + if ( m_xAvailableUpdates->hasByName( rExtensionName ) ) { - uno::Any aValue = m_xContainer->getByName( aExtName ); - rtl::OUString aStoredVersion; + ::rtl::OUString aStoredVersion; + uno::Any aValue( uno::Reference< beans::XPropertySet >( m_xAvailableUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); aValue >>= aStoredVersion; + if ( m_xIgnoredUpdates->hasByName( rExtensionName ) ) + { + ::rtl::OUString aIgnoredVersion; + uno::Any aValue2( uno::Reference< beans::XPropertySet >( m_xIgnoredUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); + aValue2 >>= aIgnoredVersion; + if ( aIgnoredVersion.getLength() == 0 ) // no version means ignore all updates + return false; + else if ( aIgnoredVersion == aStoredVersion ) // the user wanted to ignore this update + return false; + // TODO: else delete ignored entry? + } if ( isVersionGreater( rVersion, aStoredVersion ) ) return true; else { - m_xContainer->removeByName( aExtName ); + m_xAvailableUpdates->removeByName( rExtensionName ); commitChanges(); } } + return false; } diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index bc1fd0987b18..cf55a0787488 100644..100755 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -93,8 +93,10 @@ class UpdateCheckConfig : public ::cppu::WeakImplHelper3< ::com::sun::star::util::XChangesBatch, ::com::sun::star::lang::XServiceInfo > { - UpdateCheckConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xContainer, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener ); + UpdateCheckConfig( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAvailableUpdates, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xIgnoredUpdates, + const ::rtl::Reference< UpdateCheckConfigListener >& rListener ); virtual ~UpdateCheckConfig(); @@ -154,7 +156,7 @@ public: static rtl::OUString getAllUsersDirectory(); // store and retrieve information about extensions - void storeExtensionVersion( const rtl::OUString& rExtensionName, + bool storeExtensionVersion( const rtl::OUString& rExtensionName, const rtl::OUString& rVersion ); bool checkExtensionVersion( const rtl::OUString& rExtensionName, const rtl::OUString& rVersion ); @@ -205,6 +207,8 @@ private: static bool isVersionGreater( const rtl::OUString& rVersion1, const rtl::OUString& rVersion2 ); const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xContainer; + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xAvailableUpdates; + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xIgnoredUpdates; const ::rtl::Reference< UpdateCheckConfigListener > m_rListener; }; diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 5d51ea14cc6f..fa460ace702c 100644..100755 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -255,16 +255,18 @@ checkForUpdates( bool storeExtensionUpdateInfos( const uno::Reference< uno::XComponentContext > & rxContext, const uno::Sequence< uno::Sequence< rtl::OUString > > &rUpdateInfos ) { + bool bNotify = false; + if ( rUpdateInfos.hasElements() ) { rtl::Reference< UpdateCheckConfig > aConfig = UpdateCheckConfig::get( rxContext ); for ( sal_Int32 i = rUpdateInfos.getLength() - 1; i >= 0; i-- ) { - aConfig->storeExtensionVersion( rUpdateInfos[i][0], rUpdateInfos[i][1] ); + bNotify |= aConfig->storeExtensionVersion( rUpdateInfos[i][0], rUpdateInfos[i][1] ); } } - return rUpdateInfos.hasElements(); + return bNotify; } //------------------------------------------------------------------------------ @@ -289,9 +291,9 @@ bool checkForExtensionUpdates( const uno::Reference< uno::XComponentContext > & if ( !xInfoProvider.is() ) return false; aUpdateList = xInfoProvider->isUpdateAvailable( ::rtl::OUString() ); - storeExtensionUpdateInfos( rxContext, aUpdateList ); + bool bNotify = storeExtensionUpdateInfos( rxContext, aUpdateList ); - return aUpdateList.hasElements(); + return bNotify; } //------------------------------------------------------------------------------ diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index a6fe8fb27d32..3456b58c778e 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -52,7 +52,7 @@ #include <vcl/outdev.hxx> #include <vcl/msgbox.hxx> #include <vcl/lineinfo.hxx> -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <sfx2/sfx.hrc> diff --git a/forms/prj/build.lst b/forms/prj/build.lst index 2d7c5f49c7e5..115c035edbbc 100644 --- a/forms/prj/build.lst +++ b/forms/prj/build.lst @@ -1,4 +1,4 @@ -fm forms : l10n oovbaapi svx sfx2 qadevOOo NULL +fm forms : l10n oovbaapi svx sfx2 qadevOOo LIBXSLT:libxslt NULL fm forms usr1 - all fm_mkofrm NULL fm forms\inc nmake - all fm_inc NULL fm forms\source\inc get - all fm_sinc NULL diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java index 8d43fb4d01f1..6ab7d690faf8 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java @@ -337,7 +337,9 @@ public class ModuleCtrl { } else { if ( isInstalled ) { - if ( packageData.isJavaPackage() ) { // only selected checks, because of performance reasons + // Maybe a required core module is installed in an older version from another product + boolean isRequiredCoreModule = checkRequiredCoreModule(packageData); + if (( packageData.isJavaPackage() ) || ( isRequiredCoreModule )) { // only selected checks, because of performance reasons boolean installedPackageIsOlder = installer.isInstalledPackageOlder(packageData, installData); if ( ! installedPackageIsOlder ) { // The package is already installed in the same or in a newer version @@ -345,6 +347,7 @@ public class ModuleCtrl { } else { // This is also something like migrating feature states packageData.setSelectionState(PackageDescription.INSTALL); + LogManager.addLogfileComment("<b>Adding required older installed package:</b> " + packageData.getPackageName() + "</br>"); } } else { // no version check done -> so what is a good setting for already installed packages? if ( installData.olderVersionExists() ) { // should never be the case in this function diff --git a/lingucomponent/prj/build.lst b/lingucomponent/prj/build.lst index 15ee595c67c0..23137e6209b9 100644 --- a/lingucomponent/prj/build.lst +++ b/lingucomponent/prj/build.lst @@ -1,4 +1,4 @@ -lc lingucomponent : linguistic LIBTEXTCAT:libtextcat LIBTEXTCATDATA:libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell MYTHES:mythes NULL +lc lingucomponent : linguistic LIBTEXTCAT:libtextcat LIBTEXTCATDATA:libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell MYTHES:mythes LIBXSLT:libxslt NULL lc lingucomponent usr1 - all lc_mkout NULL lc lingucomponent\inc nmake - all lc_inc NULL lc lingucomponent\source\lingutil nmake - all lc_util lc_inc NULL diff --git a/package/prj/build.lst b/package/prj/build.lst index 0b508271765c..6afa434558a4 100644 --- a/package/prj/build.lst +++ b/package/prj/build.lst @@ -1,4 +1,4 @@ -pk package : cppu cppuhelper comphelper ucbhelper sal ZLIB:zlib NULL +pk package : cppu cppuhelper comphelper ucbhelper sal ZLIB:zlib LIBXSLT:libxslt NULL pk package usr1 - all pk_mkout NULL pk package\inc nmake - all pk_inc NULL pk package\source\zipapi nmake - all pk_zipapi pk_inc NULL diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 8e22b2b3a093..32ebc7068ec3 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -29,7 +29,7 @@ #include "precompiled_package.hxx" #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp> +#include <com/sun/star/embed/XHierarchicalStorageAccess2.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include "ohierarchyholder.hxx" @@ -41,7 +41,7 @@ using namespace ::com::sun::star; //=============================================== //----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::rtl::OUString& aPass ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -49,7 +49,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream throw io::IOException(); uno::Reference< embed::XExtendedStorageStream > xResult = - m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aPass ); + m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); if ( !xResult.is() ) throw uno::RuntimeException(); @@ -88,7 +88,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const ::rtl::OUSt //=============================================== //----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::rtl::OUString& aPass ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -110,11 +110,16 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea if ( !aListPath.size() ) { - uno::Reference< embed::XHierarchicalStorageAccess > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); - if ( !aPass.getLength() ) + if ( !aEncryptionData.size() ) + { + uno::Reference< embed::XHierarchicalStorageAccess > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); xResult = xHStorage->openStreamElementByHierarchicalName( aNextName, nStreamMode ); + } else - xResult = xHStorage->openEncryptedStreamElementByHierarchicalName( aNextName, nStreamMode, aPass ); + { + uno::Reference< embed::XHierarchicalStorageAccess2 > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); + xResult = xHStorage->openEncryptedStreamByHierarchicalName( aNextName, nStreamMode, aEncryptionData.getAsConstNamedValueList() ); + } uno::Reference< embed::XTransactedObject > xTransact( xResult, uno::UNO_QUERY ); if ( xTransact.is() ) @@ -150,7 +155,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea aElement = new OHierarchyElement_Impl( NULL, xChildStorage ); } - xResult = aElement->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aPass ); + xResult = aElement->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); if ( !xResult.is() ) throw uno::RuntimeException(); diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 17c14d3a6001..d36d784ac839 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -33,6 +33,8 @@ #include <com/sun/star/embed/XExtendedStorageStream.hpp> #include <cppuhelper/implbase1.hxx> +#include <comphelper/sequenceashashmap.hxx> + #include <rtl/ref.hxx> #include <hash_map> @@ -90,10 +92,10 @@ public: void RemoveElement( const ::rtl::Reference< OHierarchyElement_Impl >& aRef ); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > - GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aPath, - sal_Int32 nStreamMode, - const ::rtl::OUString& aPassword = ::rtl::OUString() ); + GetStreamHierarchically( sal_Int32 nStorageMode, + OStringList_Impl& aPath, + sal_Int32 nStreamMode, + const ::comphelper::SequenceAsHashMap& aEncryptionData = ::comphelper::SequenceAsHashMap() ); void RemoveStreamHierarchically( OStringList_Impl& aListPath ); @@ -127,10 +129,10 @@ public: static OStringList_Impl GetListPathFromString( const ::rtl::OUString& aPath ); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > - GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aListPath, - sal_Int32 nStreamMode, - const ::rtl::OUString& aPassword = ::rtl::OUString() ); + GetStreamHierarchically( sal_Int32 nStorageMode, + OStringList_Impl& aListPath, + sal_Int32 nStreamMode, + const ::comphelper::SequenceAsHashMap& aEncryptionData = ::comphelper::SequenceAsHashMap() ); void RemoveStreamHierarchically( OStringList_Impl& aListPath ); }; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 2f58595ab4a3..9a5876b3e6df 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -65,29 +65,25 @@ using namespace ::com::sun::star; namespace package { //----------------------------------------------- -uno::Sequence< sal_Int8 > MakeKeyFromPass( const ::rtl::OUString& aPass, sal_Bool bUseUTF ) +bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ) { - // 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 - - ::rtl::OString aByteStrPass; - if ( bUseUTF ) - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_UTF8 ); - else - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_MS_1252 ); - - sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_SHA1]; - rtlDigestError nError = rtl_digest_SHA1( aByteStrPass.getStr(), - aByteStrPass.getLength(), - pBuffer, - RTL_DIGEST_LENGTH_SHA1 ); - - if ( nError != rtl_Digest_E_None ) - throw uno::RuntimeException(); - - return uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); + bool bResult = ( aHash1.size() && aHash1.size() == aHash2.size() ); + for ( ::comphelper::SequenceAsHashMap::const_iterator aIter = aHash1.begin(); + bResult && aIter != aHash1.end(); + aIter++ ) + { + uno::Sequence< sal_Int8 > aKey1; + bResult = ( ( aIter->second >>= aKey1 ) && aKey1.getLength() ); + if ( bResult ) + { + uno::Sequence< sal_Int8 > aKey2 = aHash2.getUnpackedValueOrDefault( aIter->first, uno::Sequence< sal_Int8 >() ); + bResult = ( aKey1.getLength() == aKey2.getLength() ); + for ( sal_Int32 nInd = 0; bResult && nInd < aKey1.getLength(); nInd++ ) + bResult = ( aKey1[nInd] == aKey2[nInd] ); + } + } + return bResult; } //----------------------------------------------- @@ -256,8 +252,8 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, , m_xFactory( xFactory ) , m_pParent( pParent ) , m_bForceEncrypted( bForceEncrypted ) -, m_bUseCommonPass( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE ) -, m_bHasCachedPassword( sal_False ) +, m_bUseCommonEncryption( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE ) +, m_bHasCachedEncryptionData( sal_False ) , m_bCompressedSetExplicit( !bDefaultCompress ) , m_xPackage( xPackage ) , m_bHasInsertedStreamOptimization( sal_False ) @@ -364,7 +360,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( m_nStorageType != embed::StorageFormats::PACKAGE ) return sal_False; - if ( m_bForceEncrypted || m_bHasCachedPassword ) + if ( m_bForceEncrypted || m_bHasCachedEncryptionData ) return sal_True; if ( m_aTempURL.getLength() || m_xCacheStream.is() ) @@ -411,7 +407,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( !bWasEncr && bToBeEncr && !aKey.getLength() ) { // the stream is intended to use common storage password - m_bUseCommonPass = sal_True; + m_bUseCommonEncryption = sal_True; return sal_False; } else @@ -433,8 +429,8 @@ void OWriteStream_Impl::SetDecrypted() // remove encryption m_bForceEncrypted = sal_False; - m_bHasCachedPassword = sal_False; - m_aPass = ::rtl::OUString(); + m_bHasCachedEncryptionData = sal_False; + m_aEncryptionData.clear(); for ( sal_Int32 nInd = 0; nInd < m_aProps.getLength(); nInd++ ) { @@ -444,12 +440,15 @@ void OWriteStream_Impl::SetDecrypted() } //----------------------------------------------- -void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) +void OWriteStream_Impl::SetEncrypted( const ::comphelper::SequenceAsHashMap& aEncryptionData ) { OSL_ENSURE( m_nStorageType == embed::StorageFormats::PACKAGE, "The encryption is supported only for package storages!\n" ); if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); + if ( !aEncryptionData.size() ) + throw uno::RuntimeException(); + GetStreamProperties(); // let the stream be modified @@ -463,10 +462,10 @@ void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) m_aProps[nInd].Value <<= sal_True; } - m_bUseCommonPass = sal_False; // very important to set it to false + m_bUseCommonEncryption = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + m_bHasCachedEncryptionData = sal_True; + m_aEncryptionData = aEncryptionData; } //----------------------------------------------- @@ -797,7 +796,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt xPropertySet->setPropertyValue( aProps[nInd].Name, aProps[nInd].Value ); } else if ( m_nStorageType == embed::StorageFormats::PACKAGE && aProps[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) - aProps[nInd].Value >>= m_bUseCommonPass; + aProps[nInd].Value >>= m_bUseCommonEncryption; else throw lang::IllegalArgumentException(); @@ -816,7 +815,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt m_bCompressedSetExplicit = sal_True; } - if ( m_bUseCommonPass ) + if ( m_bUseCommonEncryption ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); @@ -915,7 +914,7 @@ void OWriteStream_Impl::Commit() xPropertySet->setPropertyValue( m_aProps[nInd].Name, m_aProps[nInd].Value ); } - if ( m_bUseCommonPass ) + if ( m_bUseCommonEncryption ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); @@ -926,13 +925,13 @@ void OWriteStream_Impl::Commit() xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "Encrypted" ), uno::makeAny( sal_True ) ); } - else if ( m_bHasCachedPassword ) + else if ( m_bHasCachedEncryptionData ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "EncryptionKey" ), - uno::makeAny( ::package::MakeKeyFromPass( m_aPass, sal_True ) ) ); + uno::makeAny( m_aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) ); } // the stream should be free soon, after package is stored @@ -970,9 +969,9 @@ void OWriteStream_Impl::Revert() m_bHasDataToFlush = sal_False; - m_bUseCommonPass = sal_True; - m_bHasCachedPassword = sal_False; - m_aPass = ::rtl::OUString(); + m_bUseCommonEncryption = sal_True; + m_bHasCachedEncryptionData = sal_False; + m_aEncryptionData.clear(); if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -1008,7 +1007,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::GetStreamProperties() //----------------------------------------------- uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( const uno::Sequence< beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass ) + sal_Bool bUseCommonEncryption ) { uno::Sequence< beans::PropertyValue > aResult( aProps ); sal_Int32 nLen = aResult.getLength(); @@ -1018,13 +1017,13 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) if ( aResult[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) { - aResult[nInd].Value <<= bUseCommonPass; + aResult[nInd].Value <<= bUseCommonEncryption; return aResult; } aResult.realloc( ++nLen ); aResult[nLen - 1].Name = ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ); - aResult[nLen - 1].Value <<= bUseCommonPass; + aResult[nLen - 1].Value <<= bUseCommonEncryption; } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -1173,11 +1172,11 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper //----------------------------------------------- void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream >& xDestStream, - const ::rtl::OUString& aPass ) + const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; - OSL_ENSURE( !m_bUseCommonPass, "The stream can not be encrypted!" ); + OSL_ENSURE( !m_bUseCommonEncryption, "The stream can not be encrypted!" ); if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException(); @@ -1188,16 +1187,16 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream } else { - uno::Reference< io::XStream > xOwnStream = GetStream( embed::ElementModes::READ, aPass, sal_False ); + uno::Reference< io::XStream > xOwnStream = GetStream( embed::ElementModes::READ, aEncryptionData, sal_False ); if ( !xOwnStream.is() ) throw io::IOException(); // TODO OStorage_Impl::completeStorageStreamCopy_Impl( xOwnStream, xDestStream, m_nStorageType, GetAllRelationshipsIfAny() ); } - uno::Reference< embed::XEncryptionProtectedSource > xEncr( xDestStream, uno::UNO_QUERY ); + uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDestStream, uno::UNO_QUERY ); if ( xEncr.is() ) - xEncr->setEncryptionPassword( aPass ); + xEncr->setEncryptionData( aEncryptionData.getAsConstNamedValueList() ); } //----------------------------------------------- @@ -1237,7 +1236,7 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream } //----------------------------------------------- -uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, const ::rtl::OUString& aPass, sal_Bool bHierarchyAccess ) +uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData, sal_Bool bHierarchyAccess ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1255,9 +1254,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod if ( !xPropertySet.is() ) throw uno::RuntimeException(); - if ( m_bHasCachedPassword ) + if ( m_bHasCachedEncryptionData ) { - if ( !m_aPass.equals( aPass ) ) + if ( !::package::PackageEncryptionDatasEqual( m_aEncryptionData, aEncryptionData ) ) throw packages::WrongPasswordException(); // the correct key must be set already @@ -1265,26 +1264,26 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod } else { - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_True ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ); try { xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess ); - m_bUseCommonPass = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + m_bUseCommonEncryption = sal_False; // very important to set it to false + m_bHasCachedEncryptionData = sal_True; + m_aEncryptionData = aEncryptionData; } catch( packages::WrongPasswordException& ) { // retry with different encoding - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_False ) ); + 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_bUseCommonPass = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + 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 ) @@ -1344,10 +1343,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod if ( IsEncrypted() ) { - ::rtl::OUString aGlobalPass; + ::comphelper::SequenceAsHashMap aGlobalEncryptionData; try { - aGlobalPass = GetCommonRootPass(); + aGlobalEncryptionData = GetCommonRootEncryptionData(); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -1357,7 +1356,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod throw packages::WrongPasswordException(); } - xResultStream = GetStream( nStreamMode, aGlobalPass, bHierarchyAccess ); + xResultStream = GetStream( nStreamMode, aGlobalEncryptionData, bHierarchyAccess ); } else xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess ); @@ -1386,7 +1385,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( !xInStream.is() ) throw io::IOException(); - OInputCompStream* pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonPass ), m_nStorageType ); + OInputCompStream* pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType ); uno::Reference< io::XStream > xCompStream( static_cast< ::cppu::OWeakObject* >( pStream ), uno::UNO_QUERY ); @@ -1411,7 +1410,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( !xInStream.is() ) throw io::IOException(); - OInputSeekStream* pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonPass ), m_nStorageType ); + OInputSeekStream* pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType ); uno::Reference< io::XStream > xSeekStream( static_cast< ::cppu::OWeakObject* >( pStream ), uno::UNO_QUERY ); @@ -1513,7 +1512,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() } //----------------------------------------------- -::rtl::OUString OWriteStream_Impl::GetCommonRootPass() +::comphelper::SequenceAsHashMap OWriteStream_Impl::GetCommonRootEncryptionData() throw ( packages::NoEncryptionException ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1521,7 +1520,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() if ( m_nStorageType != embed::StorageFormats::PACKAGE || !m_pParent ) throw packages::NoEncryptionException(); - return m_pParent->GetCommonRootPass(); + return m_pParent->GetCommonRootEncryptionData(); } //----------------------------------------------- @@ -1560,11 +1559,11 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: if ( !xInStream.is() ) throw io::IOException(); - // TODO: remember last state of m_bUseCommonPass + // TODO: remember last state of m_bUseCommonEncryption if ( !xTargetStream.is() ) xTargetStream = uno::Reference< io::XStream > ( static_cast< ::cppu::OWeakObject* >( - new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonPass ), m_nStorageType ) ), + new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonEncryption ), m_nStorageType ) ), uno::UNO_QUERY_THROW ); } @@ -1581,10 +1580,10 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar if ( IsEncrypted() ) { // an encrypted stream must contain input stream - ::rtl::OUString aGlobalPass; + ::comphelper::SequenceAsHashMap aGlobalEncryptionData; try { - aGlobalPass = GetCommonRootPass(); + aGlobalEncryptionData = GetCommonRootEncryptionData(); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -1594,7 +1593,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar throw packages::WrongPasswordException(); } - GetCopyOfLastCommit( xTargetStream, aGlobalPass ); + GetCopyOfLastCommit( xTargetStream, aGlobalEncryptionData ); } else { @@ -1603,12 +1602,12 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar // in case of new inserted package stream it is possible that input stream still was not set GetStreamProperties(); - CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonPass, xTargetStream ); + CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonEncryption, xTargetStream ); } } //----------------------------------------------- -void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream, const ::rtl::OUString& aPass ) +void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); @@ -1621,12 +1620,12 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar uno::Reference< io::XInputStream > xDataToCopy; - if ( m_bHasCachedPassword ) + if ( m_bHasCachedEncryptionData ) { // 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 = ::package::MakeKeyFromPass( aPass, sal_True ); - uno::Sequence< sal_Int8 > aOldKey = ::package::MakeKeyFromPass( aPass, sal_False ); + 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::Reference< beans::XPropertySet > xProps( m_xPackageStream, uno::UNO_QUERY ); if ( !xProps.is() ) @@ -1648,7 +1647,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar else { uno::Reference< beans::XPropertySet > xPropertySet( m_xPackageStream, uno::UNO_QUERY ); - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_True ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ); try { xDataToCopy = m_xPackageStream->getDataStream(); @@ -1661,7 +1660,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar } catch( packages::WrongPasswordException& aWrongPasswordException ) { - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_False ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) ); try { xDataToCopy = m_xPackageStream->getDataStream(); @@ -1697,7 +1696,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar // in case of new inserted package stream it is possible that input stream still was not set GetStreamProperties(); - CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonPass, xTargetStream ); + CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonEncryption, xTargetStream ); } //----------------------------------------------- @@ -2029,6 +2028,7 @@ uno::Any SAL_CALL OWriteStream::queryInterface( const uno::Type& rType ) { aReturn <<= ::cppu::queryInterface ( rType + , static_cast<embed::XEncryptionProtectedSource2*> ( this ) , static_cast<embed::XEncryptionProtectedSource*> ( this ) ); } else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) @@ -2081,7 +2081,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() { if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { - m_pData->m_pTypeCollection = new ::cppu::OTypeCollection + ::cppu::OTypeCollection aTmpCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XOutputStream >* )NULL ) @@ -2089,11 +2089,15 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ) , ::getCppuType( ( const uno::Reference< lang::XComponent >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XExtendedStorageStream >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL ) - , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) - , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); + , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) ); + + m_pData->m_pTypeCollection = new ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) + , aTmpCollection.getTypes() ); } else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -2139,6 +2143,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ) , ::getCppuType( ( const uno::Reference< lang::XComponent >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } @@ -2703,7 +2708,7 @@ void SAL_CALL OWriteStream::setEncryptionPassword( const ::rtl::OUString& aPass OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); - m_pImpl->SetEncryptedWithPass( aPass ); + m_pImpl->SetEncrypted( ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); ModifyParentUnlockMutex_Impl( aGuard ); } @@ -2731,6 +2736,27 @@ void SAL_CALL OWriteStream::removeEncryption() } //----------------------------------------------- +void SAL_CALL OWriteStream::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw (io::IOException, uno::RuntimeException) +{ + ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + + CheckInitOnDemand(); + + if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException(); + } + + OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); + + m_pImpl->SetEncrypted( aEncryptionData ); + + ModifyParentUnlockMutex_Impl( aGuard ); +} + +//----------------------------------------------- sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) throw ( io::IOException, uno::RuntimeException ) @@ -3171,24 +3197,24 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) { - sal_Bool bUseCommonPass = sal_False; - if ( aValue >>= bUseCommonPass ) + sal_Bool bUseCommonEncryption = sal_False; + if ( aValue >>= bUseCommonEncryption ) { if ( m_bInitOnDemand && m_pImpl->m_bHasInsertedStreamOptimization ) { // the data stream is provided to the packagestream directly - m_pImpl->m_bUseCommonPass = bUseCommonPass; + m_pImpl->m_bUseCommonEncryption = bUseCommonEncryption; } - else if ( bUseCommonPass ) + else if ( bUseCommonEncryption ) { - if ( !m_pImpl->m_bUseCommonPass ) + if ( !m_pImpl->m_bUseCommonEncryption ) { m_pImpl->SetDecrypted(); - m_pImpl->m_bUseCommonPass = sal_True; + m_pImpl->m_bUseCommonEncryption = sal_True; } } else - m_pImpl->m_bUseCommonPass = sal_False; + m_pImpl->m_bUseCommonEncryption = sal_False; } else throw lang::IllegalArgumentException(); //TODO @@ -3283,7 +3309,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp ) } else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) - return uno::makeAny( m_pImpl->m_bUseCommonPass ); + return uno::makeAny( m_pImpl->m_bUseCommonEncryption ); else if ( aPropertyName.equalsAscii( "Size" ) ) { CheckInitOnDemand(); diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 0d4a29893887..08f862b22f6c 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -38,7 +38,7 @@ #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/embed/XEncryptionProtectedSource.hpp> +#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/XRelationshipAccess.hpp> #include <com/sun/star/embed/XExtendedStorageStream.hpp> @@ -53,6 +53,8 @@ #include <cppuhelper/weak.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/sequenceashashmap.hxx> + #include <list> #include "ocompinstream.hxx" @@ -75,7 +77,7 @@ namespace cppu { namespace package { void StaticAddLog( const ::rtl::OUString& aMessage ); - ::com::sun::star::uno::Sequence< sal_Int8 > MakeKeyFromPass( const ::rtl::OUString& aPass, sal_Bool bUseUTF ); + bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ); } struct WSInternalData_Impl @@ -127,9 +129,9 @@ struct OWriteStream_Impl : public PreCreationStruct sal_Bool m_bForceEncrypted; - sal_Bool m_bUseCommonPass; - sal_Bool m_bHasCachedPassword; - ::rtl::OUString m_aPass; + sal_Bool m_bUseCommonEncryption; + sal_Bool m_bHasCachedEncryptionData; + ::comphelper::SequenceAsHashMap m_aEncryptionData; sal_Bool m_bCompressedSetExplicit; @@ -161,12 +163,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream_Impl( sal_Int32 nStreamMode, sal_Bool bHierarchyAccess ); - ::rtl::OUString GetCommonRootPass() throw ( ::com::sun::star::packages::NoEncryptionException ); + ::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException ); ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > ReadPackageStreamProperties(); ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > InsertOwnProps( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass ); + sal_Bool bUseCommonEncryption ); public: OWriteStream_Impl( @@ -186,7 +188,7 @@ public: void AddLog( const ::rtl::OUString& aMessage ); - sal_Bool UsesCommonPass_Impl() { return m_bUseCommonPass; } + sal_Bool UsesCommonEncryption_Impl() { return m_bUseCommonEncryption; } sal_Bool HasTempFile_Impl() { return ( m_aTempURL.getLength() != 0 ); } sal_Bool IsTransacted(); @@ -198,13 +200,14 @@ public: void SetToBeCommited() { m_bFlushed = sal_True; } - sal_Bool HasCachedPassword() { return m_bHasCachedPassword; } - ::rtl::OUString GetCachedPassword() { return m_aPass; } + sal_Bool HasCachedEncryptionData() { return m_bHasCachedEncryptionData; } + ::comphelper::SequenceAsHashMap& GetCachedEncryptionData() { return m_aEncryptionData; } + sal_Bool IsModified() { return m_bHasDataToFlush || m_bFlushed; } sal_Bool IsEncrypted(); void SetDecrypted(); - void SetEncryptedWithPass( const ::rtl::OUString& aPass ); + void SetEncrypted( const ::comphelper::SequenceAsHashMap& aEncryptionData ); void DisposeWrappers(); @@ -226,12 +229,12 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetAllRelationshipsIfAny(); void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream, - const ::rtl::OUString& aPass ); + const ::comphelper::SequenceAsHashMap& aEncryptionData ); void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream ); ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( sal_Int32 nStreamMode, - const ::rtl::OUString& aPass, + const ::comphelper::SequenceAsHashMap& aEncryptionData, sal_Bool bHierarchyAccess ); ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( @@ -247,13 +250,13 @@ public: void CreateReadonlyCopyBasedOnData( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xDataToCopy, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass, + sal_Bool bUseCommonEncryption, ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); void GetCopyOfLastCommit( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); void GetCopyOfLastCommit( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream, - const ::rtl::OUString& aPass ); + const ::comphelper::SequenceAsHashMap& aEncryptionData ); void CommitStreamRelInfo( @@ -272,7 +275,7 @@ class OWriteStream : ::com::sun::star::lang::XTypeProvider , public ::com::sun::star::embed::XExtendedStorageStream , public ::com::sun::star::io::XSeekable , public ::com::sun::star::io::XTruncate - , public ::com::sun::star::embed::XEncryptionProtectedSource + , public ::com::sun::star::embed::XEncryptionProtectedSource2 , public ::com::sun::star::embed::XRelationshipAccess , public ::com::sun::star::embed::XTransactedObject , public ::com::sun::star::embed::XTransactionBroadcaster @@ -366,6 +369,9 @@ public: throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException ); + //XEncryptionProtectedSource2 + virtual void SAL_CALL setEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + //XRelationshipAccess virtual ::sal_Bool SAL_CALL hasByID( const ::rtl::OUString& sID ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getTargetByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 01489c5b4f5d..851fea6b086b 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -208,7 +208,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream, , m_bListCreated( sal_False ) , m_xFactory( xFactory ) , m_xProperties( xProperties ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -248,7 +248,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream, , m_bListCreated( sal_False ) , m_xFactory( xFactory ) , m_xProperties( xProperties ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -292,7 +292,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, , m_xPackageFolder( xPackageFolder ) , m_xPackage( xPackage ) , m_xFactory( xFactory ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( pParent ) // can be empty in case of temporary readonly substorages and relation storage , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -749,10 +749,9 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes { try { - ::rtl::OUString aCommonPass = GetCommonRootPass(); - uno::Reference< embed::XEncryptionProtectedSource > xEncr( xDest, uno::UNO_QUERY ); + uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDest, uno::UNO_QUERY ); if ( xEncr.is() ) - xEncr->setEncryptionPassword( aCommonPass ); + xEncr->setEncryptionData( GetCommonRootEncryptionData().getAsConstNamedValueList() ); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -856,7 +855,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, { aStrProps.realloc( ++nNum ); aStrProps[nNum-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); - aStrProps[nNum-1].Value <<= (sal_Bool)( pElement->m_pStream->UsesCommonPass_Impl() ); + aStrProps[nNum-1].Value <<= (sal_Bool)( pElement->m_pStream->UsesCommonEncryption_Impl() ); } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -914,15 +913,15 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, OSL_ENSURE( sal_False, "Encryption is only supported in package storage!\n" ); throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - else if ( pElement->m_pStream->HasCachedPassword() + else if ( pElement->m_pStream->HasCachedEncryptionData() && ( pElement->m_pStream->IsModified() || pElement->m_pStream->HasWriteOwner_Impl() ) ) { - ::rtl::OUString aCommonPass; - sal_Bool bHasCommonPass = sal_False; + ::comphelper::SequenceAsHashMap aCommonEncryptionData; + sal_Bool bHasCommonEncryptionData = sal_False; try { - aCommonPass = GetCommonRootPass(); - bHasCommonPass = sal_True; + aCommonEncryptionData = GetCommonRootEncryptionData(); + bHasCommonEncryptionData = sal_True; } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -930,7 +929,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Encryption" ) ) ); } - if ( bHasCommonPass && pElement->m_pStream->GetCachedPassword().equals( aCommonPass ) ) + if ( bHasCommonEncryptionData && ::package::PackageEncryptionDatasEqual( pElement->m_pStream->GetCachedEncryptionData(), aCommonEncryptionData ) ) { // If the stream can be opened with the common storage password // it must be stored with the common storage password as well @@ -948,13 +947,14 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, else { // the stream is already opened for writing or was changed + uno::Reference< embed::XStorage2 > xDest2( xDest, uno::UNO_QUERY_THROW ); uno::Reference< io::XStream > xSubStr = - xDest->openEncryptedStreamElement( aName, + xDest2->openEncryptedStream( aName, embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE, - pElement->m_pStream->GetCachedPassword() ); + pElement->m_pStream->GetCachedEncryptionData().getAsConstNamedValueList() ); OSL_ENSURE( xSubStr.is(), "No destination substream!\n" ); - pElement->m_pStream->CopyInternallyTo_Impl( xSubStr, pElement->m_pStream->GetCachedPassword() ); + pElement->m_pStream->CopyInternallyTo_Impl( xSubStr, pElement->m_pStream->GetCachedEncryptionData() ); } } else @@ -1361,7 +1361,7 @@ void OStorage_Impl::Revert() } //----------------------------------------------- -::rtl::OUString OStorage_Impl::GetCommonRootPass() +::comphelper::SequenceAsHashMap OStorage_Impl::GetCommonRootEncryptionData() throw ( packages::NoEncryptionException ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1371,17 +1371,17 @@ void OStorage_Impl::Revert() if ( m_bIsRoot ) { - if ( !m_bHasCommonPassword ) + if ( !m_bHasCommonEncryptionData ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return m_aCommonPassword; + return m_aCommonEncryptionData; } else { if ( !m_pParent ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return m_pParent->GetCommonRootPass(); + return m_pParent->GetCommonRootEncryptionData(); } } @@ -1680,8 +1680,8 @@ void OStorage_Impl::ClearElement( SotElement_Impl* pElement ) //----------------------------------------------- void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, - sal_Bool bPassProvided, - const ::rtl::OUString& aPass, + sal_Bool bEncryptionDataProvided, + const ::comphelper::SequenceAsHashMap& aEncryptionData, uno::Reference< io::XStream >& xTargetStream ) throw ( embed::InvalidStorageException, lang::IllegalArgumentException, @@ -1713,8 +1713,8 @@ void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, // storage. The only problem is that some package streams can be accessed from outside // at the same time ( now solwed by wrappers that remember own position ). - if ( bPassProvided ) - pElement->m_pStream->GetCopyOfLastCommit( xTargetStream, aPass ); + if ( bEncryptionDataProvided ) + pElement->m_pStream->GetCopyOfLastCommit( xTargetStream, aEncryptionData ); else pElement->m_pStream->GetCopyOfLastCommit( xTargetStream ); } @@ -2248,6 +2248,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) ( rType , static_cast<lang::XTypeProvider*> ( this ) , static_cast<embed::XStorage*> ( this ) + , static_cast<embed::XStorage2*> ( this ) , static_cast<embed::XTransactedObject*> ( this ) , static_cast<embed::XTransactionBroadcaster*> ( this ) , static_cast<util::XModifiable*> ( this ) @@ -2255,8 +2256,15 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) , static_cast<container::XElementAccess*> ( this ) , static_cast<lang::XComponent*> ( this ) , static_cast<beans::XPropertySet*> ( this ) - , static_cast<embed::XOptimizedStorage*> ( this ) - , static_cast<embed::XHierarchicalStorageAccess*> ( this ) ); + , static_cast<embed::XOptimizedStorage*> ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast<embed::XHierarchicalStorageAccess*> ( this ) + , static_cast<embed::XHierarchicalStorageAccess2*> ( this ) ); if ( aReturn.hasValue() == sal_True ) return aReturn ; @@ -2268,7 +2276,8 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) aReturn <<= ::cppu::queryInterface ( rType , static_cast<embed::XStorageRawAccess*> ( this ) - , static_cast<embed::XEncryptionProtectedSource*> ( this ) ); + , static_cast<embed::XEncryptionProtectedSource*> ( this ) + , static_cast<embed::XEncryptionProtectedSource2*> ( this ) ); } else { @@ -2323,10 +2332,12 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XStorage2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorageRawAccess >* )NULL ) , ::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::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } @@ -2335,6 +2346,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XStorage2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorageRawAccess >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) @@ -2566,100 +2578,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::openEncryptedStreamElement" ); - ::osl::ResettableMutexGuard 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 ) - packages::NoEncryptionException(); - - if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied - - if ( !aPass.getLength() ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); - - uno::Reference< io::XStream > xResult; - try - { - SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, nOpenMode, sal_True ); - OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); - - xResult = pElement->m_pStream->GetStream( nOpenMode, aPass, sal_False ); - OSL_ENSURE( xResult.is(), "The method must throw exception instead of removing empty result!\n" ); - - if ( m_pData->m_bReadOnlyWrap ) - { - // before the storage disposes the stream it must deregister itself as listener - uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); - if ( !xStreamComponent.is() ) - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - - MakeLinkToSubComponent_Impl( xStreamComponent ); - } - } - catch( embed::InvalidStorageException& aInvalidStorageException ) - { - m_pImpl->AddLog( aInvalidStorageException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( lang::IllegalArgumentException& aIllegalArgumentException ) - { - m_pImpl->AddLog( aIllegalArgumentException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::NoEncryptionException& aNoEncryptionException ) - { - m_pImpl->AddLog( aNoEncryptionException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::WrongPasswordException& aWrongPasswordException ) - { - m_pImpl->AddLog( aWrongPasswordException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) - { - m_pImpl->AddLog( aStorageWrappedTargetException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( io::IOException& aIOException ) - { - m_pImpl->AddLog( aIOException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - 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 embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open encrypted stream stream!" ) ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - aGuard.clear(); - - BroadcastModifiedIfNecessary(); - - return xResult; + return openEncryptedStream( aStreamName, nOpenMode, ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); } //----------------------------------------------- @@ -2846,7 +2765,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const ::rtl try { uno::Reference< io::XStream > xResult; - m_pImpl->CloneStreamElement( aStreamName, sal_False, ::rtl::OUString(), xResult ); + m_pImpl->CloneStreamElement( aStreamName, sal_False, ::comphelper::SequenceAsHashMap(), xResult ); if ( !xResult.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; @@ -2913,80 +2832,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStreamElement( { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::cloneEncryptedStreamElement" ); - ::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 ) - packages::NoEncryptionException(); - - if ( !aPass.getLength() ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); - - try - { - uno::Reference< io::XStream > xResult; - m_pImpl->CloneStreamElement( aStreamName, sal_True, aPass, xResult ); - if ( !xResult.is() ) - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return xResult; - } - catch( embed::InvalidStorageException& aInvalidStorageException ) - { - m_pImpl->AddLog( aInvalidStorageException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( lang::IllegalArgumentException& aIllegalArgumentException ) - { - m_pImpl->AddLog( aIllegalArgumentException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::NoEncryptionException& aNoEncryptionException ) - { - m_pImpl->AddLog( aNoEncryptionException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::WrongPasswordException& aWrongPasswordException ) - { - m_pImpl->AddLog( aWrongPasswordException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( io::IOException& aIOException ) - { - m_pImpl->AddLog( aIOException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) - { - m_pImpl->AddLog( aStorageWrappedTargetException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - 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 embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone encrypted stream!" ) ), - uno::Reference< io::XInputStream >(), - aCaught ); - } + return cloneEncryptedStream( aStreamName, ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); } //----------------------------------------------- @@ -3711,6 +3557,210 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, } //____________________________________________________________________________________________________ +// XStorage2 +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStream( + const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::openEncryptedStream" ); + + ::osl::ResettableMutexGuard 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 ) + packages::NoEncryptionException(); + + if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied + + if ( !aEncryptionData.getLength() ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); + + uno::Reference< io::XStream > xResult; + try + { + SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, nOpenMode, sal_True ); + OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); + + xResult = pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, sal_False ); + OSL_ENSURE( xResult.is(), "The method must throw exception instead of removing empty result!\n" ); + + if ( m_pData->m_bReadOnlyWrap ) + { + // before the storage disposes the stream it must deregister itself as listener + uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); + if ( !xStreamComponent.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + + MakeLinkToSubComponent_Impl( xStreamComponent ); + } + } + catch( embed::InvalidStorageException& aInvalidStorageException ) + { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( lang::IllegalArgumentException& aIllegalArgumentException ) + { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::WrongPasswordException& aWrongPasswordException ) + { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) + { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( io::IOException& aIOException ) + { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + 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 embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open encrypted stream stream!" ) ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + aGuard.clear(); + + BroadcastModifiedIfNecessary(); + + return xResult; +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStream( + const ::rtl::OUString& aStreamName, + const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::cloneEncryptedStream" ); + + ::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 ) + packages::NoEncryptionException(); + + if ( !aEncryptionData.getLength() ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); + + try + { + uno::Reference< io::XStream > xResult; + m_pImpl->CloneStreamElement( aStreamName, sal_True, aEncryptionData, xResult ); + if ( !xResult.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + return xResult; + } + catch( embed::InvalidStorageException& aInvalidStorageException ) + { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( lang::IllegalArgumentException& aIllegalArgumentException ) + { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::WrongPasswordException& aWrongPasswordException ) + { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( io::IOException& aIOException ) + { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) + { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + 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 embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone encrypted stream!" ) ), + uno::Reference< io::XInputStream >(), + aCaught ); + } +} + + +//____________________________________________________________________________________________________ // XStorageRawAccess //____________________________________________________________________________________________________ @@ -4598,6 +4648,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) io::IOException ) { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionPassword" ); + setEncryptionData( ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); +} + +//----------------------------------------------- +void SAL_CALL OStorage::removeEncryption() + throw ( uno::RuntimeException, + io::IOException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::removeEncryption" ); ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); @@ -4610,8 +4669,7 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) 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 - OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionPassword() method is not available for nonroot storages!\n" ); - + OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); if ( m_pData->m_bIsRoot ) { try { @@ -4629,12 +4687,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) 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" ) ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); } + // 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 >() ); @@ -4642,10 +4703,10 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) try { xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), - uno::makeAny( ::package::MakeKeyFromPass( aPass, sal_True ) ) ); + uno::makeAny( uno::Sequence< sal_Int8 >() ) ); - m_pImpl->m_bHasCommonPassword = sal_True; - m_pImpl->m_aCommonPassword = aPass; + m_pImpl->m_bHasCommonEncryptionData = sal_False; + m_pImpl->m_aCommonEncryptionData.clear(); } catch( uno::Exception& aException ) { @@ -4658,12 +4719,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) } } -//----------------------------------------------- -void SAL_CALL OStorage::removeEncryption() - throw ( uno::RuntimeException, - io::IOException ) +//____________________________________________________________________________________________________ +// XEncryptionProtectedSource2 +//____________________________________________________________________________________________________ + +void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( io::IOException, + uno::RuntimeException ) { - RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::removeEncryption" ); + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionData" ); ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); @@ -4676,8 +4740,10 @@ void SAL_CALL OStorage::removeEncryption() 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 - OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); + if ( !aEncryptionData.getLength() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected empty encryption data!") ), uno::Reference< uno::XInterface >() ); + OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionData() method is not available for nonroot storages!\n" ); if ( m_pData->m_bIsRoot ) { try { @@ -4695,38 +4761,37 @@ void SAL_CALL OStorage::removeEncryption() m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), + 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 ); } - // 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 >() ); try { + ::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData ); xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), - uno::makeAny( uno::Sequence< sal_Int8 >() ) ); + uno::makeAny( aEncryptionMap.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) ); - m_pImpl->m_bHasCommonPassword = sal_False; - m_pImpl->m_aCommonPassword = ::rtl::OUString(); + m_pImpl->m_bHasCommonEncryptionData = sal_True; + m_pImpl->m_aCommonEncryptionData = aEncryptionMap; } catch( uno::Exception& aException ) { m_pImpl->AddLog( aException.Message ); m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" ); throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } + } + //____________________________________________________________________________________________________ // XPropertySet //____________________________________________________________________________________________________ @@ -5944,7 +6009,7 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam try { uno::Reference< io::XStream > xNonconstRef = xTargetStream; - m_pImpl->CloneStreamElement( aStreamName, sal_False, ::rtl::OUString(), xNonconstRef ); + m_pImpl->CloneStreamElement( aStreamName, sal_False, ::comphelper::SequenceAsHashMap(), xNonconstRef ); OSL_ENSURE( xNonconstRef == xTargetStream, "The provided stream reference seems not be filled in correctly!\n" ); if ( xNonconstRef != xTargetStream ) @@ -6073,6 +6138,55 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted embed::StorageWrappedTargetException, uno::RuntimeException ) { + return openEncryptedStreamByHierarchicalName( aStreamPath, nOpenMode, ::comphelper::OStorageHelper::CreatePackageEncryptionData( sPassword ) ); +} + +//----------------------------------------------- +void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& aStreamPath ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::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 ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + + if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied + + OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); + OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); + + if ( !m_pData->m_rHierarchyHolder.is() ) + m_pData->m_rHierarchyHolder = new OHierarchyHolder_Impl( + uno::Reference< embed::XStorage >( static_cast< embed::XStorage* >( this ) ) ); + + m_pData->m_rHierarchyHolder->RemoveStreamHierarchically( aListPath ); +} + +//____________________________________________________________________________________________________ +// XHierarchicalStorageAccess2 +//____________________________________________________________________________________________________ + +uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncryptedStreamByHierarchicalName( const ::rtl::OUString& aStreamPath, ::sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) @@ -6087,7 +6201,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( !sPassword.getLength() ) + if ( !aEncryptionData.getLength() ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) @@ -6107,7 +6221,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); xResult = uno::Reference< embed::XExtendedStorageStream >( - pElement->m_pStream->GetStream( nOpenMode, sPassword, sal_True ), + pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, sal_True ), uno::UNO_QUERY_THROW ); } else @@ -6121,7 +6235,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted ( m_pImpl->m_nStorageMode & embed::ElementModes::READWRITE ), aListPath, nOpenMode, - sPassword ); + aEncryptionData ); } if ( !xResult.is() ) @@ -6130,36 +6244,4 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted return xResult; } -//----------------------------------------------- -void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& aStreamPath ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::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 ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - - if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied - - OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); - OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); - - if ( !m_pData->m_rHierarchyHolder.is() ) - m_pData->m_rHierarchyHolder = new OHierarchyHolder_Impl( - uno::Reference< embed::XStorage >( static_cast< embed::XStorage* >( this ) ) ); - - m_pData->m_rHierarchyHolder->RemoveStreamHierarchically( aListPath ); -} diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index f1c50e4d67bd..a49de3af6f3a 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -29,14 +29,14 @@ #define __XSTORAGE_HXX_ #include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XStorage2.hpp> #include <com/sun/star/embed/XOptimizedStorage.hpp> -#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp> +#include <com/sun/star/embed/XHierarchicalStorageAccess2.hpp> #include <com/sun/star/embed/XStorageRawAccess.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> #include <com/sun/star/embed/XClassifiedObject.hpp> -#include <com/sun/star/embed/XEncryptionProtectedSource.hpp> +#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/embed/XRelationshipAccess.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -52,8 +52,10 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/packages/NoEncryptionException.hpp> #include <com/sun/star/logging/XSimpleLogRing.hpp> + #include <cppuhelper/weak.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/sequenceashashmap.hxx> #include "mutexholder.hxx" @@ -157,8 +159,8 @@ struct OStorage_Impl ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; // ??? may be stored in properties ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; // ??? may be stored in properties ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_xProperties; - sal_Bool m_bHasCommonPassword; - ::rtl::OUString m_aCommonPassword; + sal_Bool m_bHasCommonEncryptionData; + ::comphelper::SequenceAsHashMap m_aCommonEncryptionData; // must be empty in case of root storage OStorage_Impl* m_pParent; @@ -231,7 +233,7 @@ struct OStorage_Impl void Commit(); void Revert(); - ::rtl::OUString GetCommonRootPass() throw ( ::com::sun::star::packages::NoEncryptionException ); + ::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException ); void CopyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, sal_Bool bDirect ); @@ -264,7 +266,7 @@ struct OStorage_Impl void CloneStreamElement( const ::rtl::OUString& aStreamName, sal_Bool bPassProvided, - const ::rtl::OUString& aPass, + const ::comphelper::SequenceAsHashMap& aEncryptionData, ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ) throw ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, @@ -289,18 +291,18 @@ struct OStorage_Impl class OStorage : public ::com::sun::star::lang::XTypeProvider - , public ::com::sun::star::embed::XStorage + , public ::com::sun::star::embed::XStorage2 , public ::com::sun::star::embed::XStorageRawAccess , public ::com::sun::star::embed::XTransactedObject , public ::com::sun::star::embed::XTransactionBroadcaster , public ::com::sun::star::util::XModifiable // , public ::com::sun::star::container::XNameAccess // , public ::com::sun::star::lang::XComponent - , public ::com::sun::star::embed::XEncryptionProtectedSource + , public ::com::sun::star::embed::XEncryptionProtectedSource2 , public ::com::sun::star::beans::XPropertySet , public ::com::sun::star::embed::XOptimizedStorage , public ::com::sun::star::embed::XRelationshipAccess - , public ::com::sun::star::embed::XHierarchicalStorageAccess + , public ::com::sun::star::embed::XHierarchicalStorageAccess2 , public ::cppu::OWeakObject { OStorage_Impl* m_pImpl; @@ -490,6 +492,28 @@ public: ::com::sun::star::uno::RuntimeException ); //____________________________________________________________________________________________________ + // XStorage2 + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStream( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStream( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + //____________________________________________________________________________________________________ // XStorageRawAccess //____________________________________________________________________________________________________ @@ -616,6 +640,16 @@ public: ::com::sun::star::io::IOException ); //____________________________________________________________________________________________________ + // XEncryptionProtectedSource2 + //____________________________________________________________________________________________________ + + virtual void SAL_CALL setEncryptionData( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::io::IOException, + ::com::sun::star::uno::RuntimeException ); + + + //____________________________________________________________________________________________________ // XPropertySet //____________________________________________________________________________________________________ @@ -800,6 +834,18 @@ public: ::com::sun::star::embed::StorageWrappedTargetException, ::com::sun::star::uno::RuntimeException); + //____________________________________________________________________________________________________ + // XHierarchicalStorageAccess2 + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); }; diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index c99cd22d3b4c..fca0e09f63bd 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1644,7 +1644,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) ) { - if (!( aValue >>= m_aEncryptionKey ) ) + if (!( aValue >>= m_aEncryptionKey ) || m_aEncryptionKey.getLength() == 0 ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) ) diff --git a/setup_native/scripts/osx_install_languagepack.applescript b/setup_native/scripts/osx_install_languagepack.applescript index 9fb4bdacbec1..68c31b709412 100644 --- a/setup_native/scripts/osx_install_languagepack.applescript +++ b/setup_native/scripts/osx_install_languagepack.applescript @@ -45,13 +45,38 @@ if (button returned of result) is AbortLabel then return 2 end if -set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLAPPPRODUCTNAME].app'\"") & " +set the found_ooos_all to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLAPPPRODUCTNAME].app'\"") & " " & chooseMyOwn +set found_ooos_all_paragraphs to paragraphs in found_ooos_all + +set found_ooos to {} +repeat with currentApp in found_ooos_all_paragraphs + if currentApp does not start with "/Volumes" then + copy currentApp to the end of found_ooos + end if +end repeat + +-- repeat with oneApp in found_ooos +-- display dialog oneApp +-- end repeat + -- the choice returned is of type "list" -- Show selection dialog only if more than one or no product was found -if (get first paragraph of found_ooos) is "" then - set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) +-- The first item is an empty string, if no app was found and no app started with "/Volumes" +-- The first item is chooseMyOwn, if no app was found and at least one app started with "/Volumes" +if (get first item of found_ooos as string) is "" then + set the choice to (choose from list found_ooos default items (get second item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get first item of found_ooos as string) is chooseMyOwn then + set the choice to (choose from list found_ooos default items (get first item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) if choice is false then -- do nothing, the user cancelled the installation return 2 --aborted by user @@ -60,11 +85,12 @@ if (get first paragraph of found_ooos) is "" then -- the user would not be able to select the .app set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) end if -else if (get second paragraph of found_ooos) is chooseMyOwn then +else if (get second item of found_ooos as string) is chooseMyOwn then -- set choice to found installation - set the choice to (get first paragraph of found_ooos) + -- set the choice to (get first paragraph of found_ooos) + set the choice to (get first item of found_ooos) else - set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + set the choice to (choose from list found_ooos default items (get first item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) if choice is false then -- do nothing, the user cancelled the installation return 2 --aborted by user diff --git a/setup_native/scripts/osx_install_patch.applescript b/setup_native/scripts/osx_install_patch.applescript index e9dbd442d3a7..fc12f20108a6 100644 --- a/setup_native/scripts/osx_install_patch.applescript +++ b/setup_native/scripts/osx_install_patch.applescript @@ -43,13 +43,38 @@ if (button returned of result) is AbortLabel then return 2 end if -set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLAPPPRODUCTNAME].app'\"") & " +set the found_ooos_all to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLAPPPRODUCTNAME].app'\"") & " " & chooseMyOwn +set found_ooos_all_paragraphs to paragraphs in found_ooos_all + +set found_ooos to {} +repeat with currentApp in found_ooos_all_paragraphs + if currentApp does not start with "/Volumes" then + copy currentApp to the end of found_ooos + end if +end repeat + +-- repeat with oneApp in found_ooos +-- display dialog oneApp +-- end repeat + -- the choice returned is of type "list" -- Show selection dialog only if more than one or no product was found -if (get first paragraph of found_ooos) is "" then - set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) +-- The first item is an empty string, if no app was found and no app started with "/Volumes" +-- The first item is chooseMyOwn, if no app was found and at least one app started with "/Volumes" +if (get first item of found_ooos as string) is "" then + set the choice to (choose from list found_ooos default items (get second item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get first item of found_ooos as string) is chooseMyOwn then + set the choice to (choose from list found_ooos default items (get first item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) if choice is false then -- do nothing, the user cancelled the installation return 2 --aborted by user @@ -58,11 +83,12 @@ if (get first paragraph of found_ooos) is "" then -- the user would not be able to select the .app set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) end if -else if (get second paragraph of found_ooos) is chooseMyOwn then +else if (get second item of found_ooos as string) is chooseMyOwn then -- set choice to found installation - set the choice to (get first paragraph of found_ooos) + -- set the choice to (get first paragraph of found_ooos) + set the choice to (get first item of found_ooos) else - set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + set the choice to (choose from list found_ooos default items (get first item of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) if choice is false then -- do nothing, the user cancelled the installation return 2 --aborted by user diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 26aa9d2d8486..50ee492f8c78 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -213,7 +213,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog try { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { e.printStackTrace(); } @@ -302,7 +302,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog try { sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user"); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { e.printStackTrace(); } @@ -484,7 +484,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document); - bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false, resources.resErrSaveTemplate ); + bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false ); } catch (Exception e) { SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "ErrBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate); //e.printStackTrace(); diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index 9d6f1c33ffcd..04dd385ddf60 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -134,7 +134,7 @@ public abstract class Configuration public static void set(boolean value, String name, Object parent) throws Exception { - if (value = true) + if (value == true) { set(Boolean.TRUE, name, parent); } diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index c9292b58c1b4..8902696c37b4 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -378,7 +378,7 @@ public class Desktop { TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/wizard/bitmap"); + BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/../wizard/bitmap"); WorkPath = FileAccess.getOfficePath(xMSF, "Work", "", ""); } catch (NoValidPathException nopathexception) @@ -417,7 +417,7 @@ public class Desktop { try { - String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/wizard/bitmap"); + String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); return sBitmapPath; } catch (NoValidPathException nopathexception) diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index cb183eb29c25..ccfbee303f98 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -134,7 +134,7 @@ public class NumberFormatter public double convertStringToNumber(int _nkey, String _sString)throws Exception { - return convertStringToNumber(_nkey, _sString); + return xNumberFormatter.convertStringToNumber(_nkey, _sString); } diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index 4cb78cd967c3..ea132453bb30 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -48,6 +48,7 @@ import com.sun.star.beans.PropertyVetoException; import com.sun.star.sheet.XCellRangeData; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.table.XCellRange; +import com.sun.star.task.XInteractionHandler; import com.sun.star.text.XTextDocument; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; @@ -288,7 +289,7 @@ public class OfficeDocument return oDocument; } - public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl, String sMsgSavingImpossible) + public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl) { try { @@ -296,10 +297,13 @@ public class OfficeDocument PropertyValue[] oStoreProperties; if (FilterName.length() > 0) { - oStoreProperties = new PropertyValue[1]; + oStoreProperties = new PropertyValue[2]; oStoreProperties[0] = new PropertyValue(); oStoreProperties[0].Name = "FilterName"; oStoreProperties[0].Value = FilterName; + oStoreProperties[1] = new PropertyValue(); + oStoreProperties[1].Name = "InteractionHandler"; + oStoreProperties[1].Value = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); } else { @@ -319,8 +323,6 @@ public class OfficeDocument { exception.printStackTrace(System.out); - //TODO make sure that the peer of the dialog is used when available - showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgSavingImpossible); return false; } } diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index f265aa701c47..8ee9f0472c57 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -246,7 +246,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog myFaxDoc.killEmptyFrames(); - bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to" + sPath); + bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false); if (bSaveSuccess) { saveConfiguration(); @@ -381,7 +381,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 7a19b31df875..8749f2ce39e8 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -297,7 +297,9 @@ public class FormDocument extends TextDocument public ControlForm[] getControlForms() { - return (ControlForm[]) oControlForms.toArray(); + ControlForm[] aResult = new ControlForm[oControlForms.size()]; + oControlForms.toArray( aResult ); + return aResult; } public boolean finalizeForms(DataEntrySetter _curDataEntrySetter, FieldLinker _curFieldLinker, FormConfiguration _curFormConfiguration) diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 5cc524839b1f..3ce766717c07 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -342,7 +342,7 @@ public class StyleApplier { String[] sPropList = JavaTools.ArrayoutofString(scurline, ":"); String sPropValue = sPropList[1]; - sPropValue.trim(); + sPropValue = sPropValue.trim(); if (sPropValue.indexOf("#") > 0) { sPropValue = JavaTools.replaceSubString(sPropValue, "", ";"); diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index a4ccb7d0fa18..295d900bdec6 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -306,7 +306,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog myLetterDoc.killEmptyFrames(); - bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to " + sPath); + bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false); if (bSaveSuccess) { @@ -1295,7 +1295,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index 2c8122d82df1..c95a060f167f 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -188,7 +188,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID publish = p; - imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "wizard/bitmap/"); + imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "../wizard/bitmap/"); //Load Resources resources = new FTPDialogResources(xmsf); diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index 8934b0a84731..26f518c4e6c8 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -1002,7 +1002,7 @@ public abstract class WWD_Events extends WWD_Startup //replace all '/' with '%2F' url1 = JavaTools.replaceSubString(url1, "%2F", "/"); - p.url = "vnd.sun.star.pkg://" + url1 + "/"; + p.url = "vnd.sun.star.zip://" + url1 + "/"; /* * and now ftp... diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java index f7ab537770bb..2a250c84c266 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java @@ -242,7 +242,7 @@ public abstract class WWD_Startup extends WWD_General String soTemplateDir = FileAccess.getOfficePath(xmsf, "Template", "share", "/wizard"); - String exclamationURL = FileAccess.connectURLs(soTemplateDir, "wizard/bitmap/caution_16.png"); + String exclamationURL = FileAccess.connectURLs(soTemplateDir, "../wizard/bitmap/caution_16.png"); this.drawNaviBar(); this.buildStep1(); this.buildStep2(); diff --git a/wizards/prj/build.lst b/wizards/prj/build.lst index c4d635a921a8..ca4e940d3527 100644 --- a/wizards/prj/build.lst +++ b/wizards/prj/build.lst @@ -1,4 +1,4 @@ -wz wizards : l10n rsc javaunohelper unoil NULL +wz wizards : l10n rsc javaunohelper unoil LIBXSLT:libxslt NULL wz wizards\util nmake - all wz_util NULL wz wizards\source\config nmake - all wz_config NULL wz wizards\source\configshare nmake - all wz_configshare NULL diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba index 45fdafdbafe5..2de1252c7e48 100644 --- a/wizards/source/euro/Init.xba +++ b/wizards/source/euro/Init.xba @@ -550,7 +550,7 @@ Dim Isthere as Boolean InitializeLocales(oLocale) InitializeCurrencies() InitializeControls() - BitmapDir = GetOfficeSubPath("Template", "wizard/bitmap") + BitmapDir = GetOfficeSubPath("Template", "../wizard/bitmap") If BitmapDir = "" Then Stop End If diff --git a/wizards/source/formwizard/tools.xba b/wizards/source/formwizard/tools.xba index 174987e35971..8b40b8379c10 100644 --- a/wizards/source/formwizard/tools.xba +++ b/wizards/source/formwizard/tools.xba @@ -304,7 +304,7 @@ End Function Function GetFormWizardPaths() as Boolean - FormPath = GetOfficeSubPath("Template","wizard/bitmap") + FormPath = GetOfficeSubPath("Template","../wizard/bitmap") If FormPath <> "" Then WebWizardPath = GetOfficeSubPath("Template","wizard/web") If WebWizardPath <> "" Then diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba index 2c25c6abebd0..3415d0ee8dd8 100644 --- a/wizards/source/importwizard/Main.xba +++ b/wizards/source/importwizard/Main.xba @@ -274,7 +274,7 @@ End Sub Function GetImportWizardPaths() as Boolean - SOBitmapPath = GetOfficeSubPath("Template", "wizard/bitmap") + SOBitmapPath = GetOfficeSubPath("Template", "../wizard/bitmap") If SOBitmapPath <> "" Then SOWorkPath = GetPathSettings("Work", False) If SOWorkPath <> "" Then diff --git a/wizards/source/schedule/CalendarMain.xba b/wizards/source/schedule/CalendarMain.xba index bfe49121dbd3..2deb51cca84d 100644 --- a/wizards/source/schedule/CalendarMain.xba +++ b/wizards/source/schedule/CalendarMain.xba @@ -82,7 +82,7 @@ Dim iThisMonth as Integer DlgCalModel = DlgCalendar.Model LoadLanguage(sCurLangLocale) CalInitGlobalVariablesDate() - BitmapDir = GetOfficeSubPath("Template","wizard/bitmap") + BitmapDir = GetOfficeSubPath("Template","../wizard/bitmap") DlgCalModel.imgCountry.ImageURL = BitmapDir & sBitmapFilename CalChoosenLand = -2 CalLoadOwnData() diff --git a/wizards/source/template/Samples.xba b/wizards/source/template/Samples.xba index b64ddc12db17..118fb37d0c49 100644 --- a/wizards/source/template/Samples.xba +++ b/wizards/source/template/Samples.xba @@ -86,7 +86,7 @@ Dim MaxIndex as Integer DialogModel = StylesDialog.Model TemplateDir = GetPathSettings("Template", False, 0) StylesDir = GetOfficeSubPath("Template", "wizard/styles/") - sQueryPath = GetOfficeSubPath("Template", "wizard/bitmap/") + sQueryPath = GetOfficeSubPath("Template", "../wizard/bitmap/") DialogModel.Title = GetResText(STYLES) DialogModel.cmdCancel.Label = GetResText(STYLES+2) DialogModel.cmdOk.Label = GetResText(STYLES+3) diff --git a/wizards/source/tutorials/Functions.xba b/wizards/source/tutorials/Functions.xba index 6524ec19338c..c1b464acaf9d 100644 --- a/wizards/source/tutorials/Functions.xba +++ b/wizards/source/tutorials/Functions.xba @@ -78,15 +78,15 @@ Sub setMaxMinImage(param As String) iPos = InStr(templatePath,"/") If(iPos > 0) Then If(param = "MAX") Then - bitmapPath = templatePath & "/wizard/bitmap/maximize.bmp" + bitmapPath = templatePath & "../wizard/bitmap/maximize.bmp" ElseIf(param = "MIN") Then - bitmapPath = templatePath & "/wizard/bitmap/minimize.bmp" + bitmapPath = templatePath & "../wizard/bitmap/minimize.bmp" End If Else If(param = "MAX") Then - bitmapPath = templatePath & "\wizard\bitmap\maximize.bmp" + bitmapPath = templatePath & "..\wizard\bitmap\maximize.bmp" ElseIf(param = "MIN") Then - bitmapPath = templatePath & "\wizard\bitmap\minimize.bmp" + bitmapPath = templatePath & "..\wizard\bitmap\minimize.bmp" End If End If 'printdbgInfo oCommandButton.Model diff --git a/wizards/source/tutorials/ShowInfoDialog.xba b/wizards/source/tutorials/ShowInfoDialog.xba index 4bb0f608d9b6..61c2ed96731f 100644 --- a/wizards/source/tutorials/ShowInfoDialog.xba +++ b/wizards/source/tutorials/ShowInfoDialog.xba @@ -148,9 +148,9 @@ sub setImage(whatever as Object) Dim bitmapPath As String iPos = InStr(templatePath,"/") if(iPos > 0) Then - bitmapPath = templatePath & "/wizard/bitmap/tutorial_background.gif" + bitmapPath = templatePath & "../wizard/bitmap/tutorial_background.gif" Else - bitmapPath = templatePath & "\wizard\bitmap\tutorial_background.gif" + bitmapPath = templatePath & "..\wizard\bitmap\tutorial_background.gif" End If dim props(0) as new com.sun.star.beans.PropertyValue diff --git a/wizards/source/webwizard/Language.xba b/wizards/source/webwizard/Language.xba index 1aa26fac30cb..1c6b8c194e98 100644 --- a/wizards/source/webwizard/Language.xba +++ b/wizards/source/webwizard/Language.xba @@ -30,7 +30,7 @@ Dim TemplatePath as String If PhotosDir <> "" Then TemplatePath = GetOfficeSubPath("Template", "wizard/web/") If TemplatePath <> "" Then - SOBitmapPath = GetOfficeSubPath("Template", "wizard/bitmap") + SOBitmapPath = GetOfficeSubPath("Template", "../wizard/bitmap") If SOBitmapPath <> "" Then GetWebwizardPaths() = True Exit Function diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst index cd438326bd00..3d70b9cb1181 100644 --- a/xmlsecurity/prj/build.lst +++ b/xmlsecurity/prj/build.lst @@ -1,4 +1,4 @@ -xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss NULL +xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL xs xmlsecurity usr1 - all xs_mkout NULL xs xmlsecurity\inc nmake - all xs_inc NULL xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL |