diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
commit | 4446d50fc7278c1ca21dfe5852b86acd8a8cba05 (patch) | |
tree | d01c6525c9c3c0d4468559fb81250022d94a3990 | |
parent | ecf66d8aa3b1792e53d8b691a7b679fd47133ac9 (diff) | |
parent | fcb659ae5ba83fe354842cf7bdefbdfb95894872 (diff) |
removetooltypes01: rebase to DEV300_m96
99 files changed, 1257 insertions, 698 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/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 24bc5beacb30..996e98f52ce4 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -121,9 +121,10 @@ MacroChooser::MacroChooser( Window* pParnt, BOOL bCreateEntries ) : aMacroBox.SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) ); aBasicBox.SetMode( BROWSEMODE_MODULES ); - aBasicBox.SetWindowBits( WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); + aBasicBox.SetStyle( WB_TABSTOP | WB_BORDER | + WB_HASLINES | WB_HASLINESATROOT | + WB_HASBUTTONS | WB_HASBUTTONSATROOT | + WB_HSCROLL ); BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 714fc6656941..35bc94e24fca 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -521,7 +521,7 @@ LibPage::LibPage( Window * pParent ) aLibBox.SetMode( LIBMODE_MANAGER ); aLibBox.EnableInplaceEditing( TRUE ); - aLibBox.SetWindowBits( WB_HSCROLL ); + aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP ); aCloseButton.GrabFocus(); long aTabs[] = { 2, 30, 120 }; diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 0f66a6ebe120..c877b2f35bb2 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -596,9 +596,10 @@ ObjectPage::ObjectPage( Window * pParent, const ResId& rResId, USHORT nMode ) : aBasicBox.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY ); aBasicBox.EnableInplaceEditing( TRUE ); aBasicBox.SetMode( nMode ); - aBasicBox.SetWindowBits( WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); + aBasicBox.SetStyle( WB_BORDER | WB_TABSTOP | + WB_HASLINES | WB_HASLINESATROOT | + WB_HASBUTTONS | WB_HASBUTTONSATROOT | + WB_HSCROLL ); aBasicBox.ScanAllEntries(); aEditButton.GrabFocus(); diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index ac7a2c28531d..82030adfccee 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -102,9 +102,10 @@ ObjectCatalog::ObjectCatalog( Window * pParent ) aToolBox.SetSizePixel( aToolBox.CalcWindowSizePixel() ); aToolBox.SetSelectHdl( LINK( this, ObjectCatalog, ToolBoxHdl ) ); - aMacroTreeList.SetWindowBits( WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); + aMacroTreeList.SetStyle( WB_BORDER | WB_TABSTOP | + WB_HASLINES | WB_HASLINESATROOT | + WB_HASBUTTONS | WB_HASBUTTONSATROOT | + WB_HSCROLL ); aMacroTreeList.SetSelectHdl( LINK( this, ObjectCatalog, TreeListHighlightHdl ) ); 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/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp index f3d19ca98790..abca528dc987 100755 --- a/crashrep/source/win32/soreport.cpp +++ b/crashrep/source/win32/soreport.cpp @@ -1847,7 +1847,7 @@ bool WriteChecksumFile( FILE *fchksum, const hash_map< string, string >& rLibrar for ( int i = 0; i < sizeof(checksum); fprintf( fchksum, "%02X", checksum[i++] ) ); fprintf( fchksum, "\" bytes=\"%d\" file=\"%s\"/>\n", nBytesProcessed, - GetFileName( iter->first ) ); + GetFileName( iter->first ).c_str() ); } } 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 c0869ce94f30..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 )); @@ -744,7 +746,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); // initialize Entriesbox - aEntriesBox.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aEntriesBox.SetStyle(aEntriesBox.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); aEntriesBox.SetSelectionMode(SINGLE_SELECTION); aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT); aEntriesBox.Resize(); // OS: Hack for right selection @@ -768,7 +770,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxIt pGroupLBox->SetFunctionListBox(pFunctionBox); // initialize KeyBox - aKeyBox.SetWindowBits(WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); + aKeyBox.SetStyle(aKeyBox.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); } //----------------------------------------------- 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/customize/cfg.cxx b/cui/source/customize/cfg.cxx index a2ee0d977f67..858564af4e40 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1465,7 +1465,7 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox( , pPage( (SvxMenuConfigPage*) pParent ) , m_bIsInternalDrag( FALSE ) { - SetWindowBits( + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HIDESELECTION ); SetSpaceBetweenEntries( 3 ); diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index da294a4526b0..b85ec24adee2 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -287,7 +287,7 @@ SfxConfigFunctionListBox_Impl::SfxConfigFunctionListBox_Impl( Window* pParent, c , pCurEntry( 0 ) , pStylesInfo( 0 ) { - SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); GetModel()->SetSortMode( SortAscending ); // Timer f"ur die BallonHelp @@ -488,7 +488,7 @@ SfxConfigGroupListBox_Impl::SfxConfigGroupListBox_Impl( : SvTreeListBox( pParent, rResId ) , pImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(0), nMode( nConfigMode ), bShowSF( FALSE ), bShowBasic( TRUE ), pStylesInfo(0) { - SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); SetNodeBitmaps( pImp->m_collapsedImage, pImp->m_expandedImage, BMP_COLOR_NORMAL ); SetNodeBitmaps( pImp->m_collapsedImage_hc, pImp->m_expandedImage_hc, BMP_COLOR_HIGHCONTRAST ); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 833dc0f32c82..3defe910f5a5 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -90,7 +90,7 @@ SvxConfigFunctionListBox_Impl::SvxConfigFunctionListBox_Impl( Window* pParent, c , pCurEntry( 0 ) , m_pDraggingEntry( 0 ) { - SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); GetModel()->SetSortMode( SortAscending ); // Timer f"ur die BallonHelp @@ -226,7 +226,7 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( m_xFrame.set( xFrame ); } - SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) ); diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index 32e62d3e7f80..169c88aebe71 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -1158,7 +1158,7 @@ namespace svx ,m_pCheckButtonData ( NULL ) ,m_xConversionDictionaryList( NULL ) { - m_aDictsLB.SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + m_aDictsLB.SetStyle( m_aDictsLB.GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); m_aDictsLB.SetSelectionMode( SINGLE_SELECTION ); m_aDictsLB.SetHighlightRange(); // m_aDictsLB.SetHelpId( xxx ); diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index e7f40766d836..5d29e652a7d2 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -145,9 +145,9 @@ SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent ) maLbTree.SetDoubleClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) ); // Tree-ListBox mit Linien versehen - maLbTree.SetWindowBits( WinBits( WB_TABSTOP | WB_BORDER | WB_HASLINES | + maLbTree.SetStyle( maLbTree.GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | WB_HASBUTTONS | //WB_HASLINESATROOT | - WB_HSCROLL | WB_HASBUTTONSATROOT ) ); + WB_HSCROLL | WB_HASBUTTONSATROOT ); } SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd() diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 62ec77c3c26a..139ef0071d37 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -99,7 +99,7 @@ SFTreeListBox::SFTreeListBox( Window* pParent, const ResId& rResId ) : FreeResource(); SetSelectionMode( SINGLE_SELECTION ); - SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_HASLINES | WB_HASLINESATROOT ); SetNodeDefaultImages(); diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx index dafec167af2c..6c670fc08e69 100644 --- a/cui/source/dialogs/srchxtra.cxx +++ b/cui/source/dialogs/srchxtra.cxx @@ -151,7 +151,7 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent, { FreeResource(); - aAttrLB.SetWindowBits( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); + aAttrLB.SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); aAttrLB.GetModel()->SetSortMode( SortAscending ); aOKBtn.SetClickHdl( LINK( this, SvxSearchAttributeDialog, OKHdl ) ); diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index c1811b196895..5ad431567a72 100755 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -180,7 +180,7 @@ ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), m_rDialogImpl( rImpl ) { - SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); SetHighlightRange(); } 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/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 7bfc72d1181e..cc199054d131 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -159,7 +159,7 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const Sfx Size aHeadSize = pHeaderBar->GetSizePixel(); aPathCtrl.SetFocusControl( pPathBox ); - pPathBox->SetWindowBits( nBits ); + pPathBox->SetStyle( pPathBox->GetStyle()|nBits ); pPathBox->SetDoubleClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) ); pPathBox->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, PathSelect_Impl ) ); pPathBox->SetSelectionMode( SINGLE_SELECTION ); diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 36e43a88ecce..749b92ed54cc 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -98,7 +98,7 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent, aNewDelTBX.SetPosPixel( aNewPnt ); aCheckLB.SetHelpId(HID_OFA_FONT_SUBST_CLB); - aCheckLB.SetWindowBits(aCheckLB.GetStyle()|WB_HSCROLL|WB_VSCROLL); + aCheckLB.SetStyle(aCheckLB.GetStyle()|WB_HSCROLL|WB_VSCROLL); aCheckLB.SetSelectionMode(MULTIPLE_SELECTION); aCheckLB.SortByCol(2); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index c9ee53ca13fb..7867c5de68b0 100755 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -256,7 +256,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog( aWordsLB.SetTabs(nStaticTabs); //! we use an algorithm of our own to insert elements sorted - aWordsLB.SetWindowBits(/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN); + aWordsLB.SetStyle(aWordsLB.GetStyle()|/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN); nWidth=aWordED.GetSizePixel().Width(); diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 637230587e6b..811a421223e9 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -165,7 +165,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent, HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED ); aCheckLB.SetHelpId( HID_OFAPAGE_MSFLTR2_CLB ); - aCheckLB.SetWindowBits( WB_HSCROLL| WB_VSCROLL ); + aCheckLB.SetStyle( aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL ); } OfaMSFilterTabPage2::~OfaMSFilterTabPage2() diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index f5bfd351ae45..dd7f3ddb840f 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1140,7 +1140,7 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent, { pCheckButtonData = NULL; - aLinguModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); + aLinguModulesCLB.SetStyle( aLinguModulesCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); aLinguModulesCLB.SetHelpId(HID_CLB_LINGU_MODULES ); aLinguModulesCLB.SetHighlightRange(); aLinguModulesCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); @@ -1150,7 +1150,7 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent, aLinguModulesEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); aLinguOptionsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - aLinguDicsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); + aLinguDicsCLB.SetStyle( aLinguDicsCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); aLinguDicsCLB.SetHelpId(HID_CLB_EDIT_MODULES_DICS ); aLinguDicsCLB.SetHighlightRange(); aLinguDicsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); @@ -1160,7 +1160,7 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent, aLinguDicsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); aLinguDicsDelPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - aLinguOptionsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); + aLinguOptionsCLB.SetStyle( aLinguOptionsCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); aLinguOptionsCLB.SetHelpId(HID_CLB_LINGU_OPTIONS ); aLinguOptionsCLB.SetHighlightRange(); aLinguOptionsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); @@ -2050,7 +2050,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData) pDefaultLinguData = new SvxLinguData_Impl( rLinguData ); - aModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); + aModulesCLB.SetStyle( aModulesCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); aModulesCLB.SetHighlightRange(); aModulesCLB.SetHelpId(HID_CLB_EDIT_MODULES_MODULES ); aModulesCLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, SelectHdl_Impl )); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index d4997cc6f4f9..3a7bb6328bdf 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -253,7 +253,6 @@ SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) : WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP; pPathBox = new svx::OptHeaderTabListBox( &aPathCtrl, nBits ); aPathCtrl.SetFocusControl( pPathBox ); - pPathBox->SetWindowBits( nBits ); pPathBox->SetDoubleClickHdl( aLink ); pPathBox->SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) ); pPathBox->SetSelectionMode( MULTIPLE_SELECTION ); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 581ab33ad467..ee82e89b93b3 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -891,9 +891,9 @@ void OfaTreeOptionsDialog::InitTreeAndHandler() delete pIsoRes; aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX ); - aTreeLB.SetWindowBits( WB_HASBUTTONS | WB_HASBUTTONSATROOT | + aTreeLB.SetStyle( aTreeLB.GetStyle()|WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HASLINES | WB_HASLINESATROOT | - WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE | WB_QUICK_SEARCH ); aTreeLB.SetSpaceBetweenEntries( 0 ); aTreeLB.SetSelectionMode( SINGLE_SELECTION ); aTreeLB.SetSublistOpenWithLeftRight( TRUE ); diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index c52168fb1ab6..dc59e4ce986d 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -52,7 +52,7 @@ namespace svx PasswordTable::PasswordTable( Window* pParent, const ResId& rResId ) : SvxSimpleTable( pParent, rResId ) { - SetWindowBits( GetStyle() | WB_NOINITIALSELECTION ); + SetStyle( GetStyle() | WB_NOINITIALSELECTION ); } void PasswordTable::InsertHeaderItem( USHORT nColumn, const String& rText, HeaderBarItemBits nBits ) diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 0ee3c38c1e1d..05ec88e5aa7f 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -493,7 +493,7 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent, SvtSysLocale aSysLcl; aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB); - aCheckLB.SetWindowBits(WB_HSCROLL| WB_VSCROLL); + aCheckLB.SetStyle(aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL); aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl)); aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); @@ -1022,7 +1022,7 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); - aReplaceTLB.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aReplaceTLB.SetStyle(aReplaceTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl)); aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl)); aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); @@ -2076,7 +2076,7 @@ OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) : 3, 0, 20, 40 }; - aSwCheckLB.SetWindowBits(WB_HSCROLL| WB_VSCROLL); + aSwCheckLB.SetStyle(aSwCheckLB.GetStyle() | WB_HSCROLL| WB_VSCROLL); aSwCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); String sHeader( sHeader1 ); @@ -2647,7 +2647,7 @@ OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent, FreeResource(); // some options for the list box: - m_aSmartTagTypesLB.SetWindowBits( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); + m_aSmartTagTypesLB.SetStyle( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); m_aSmartTagTypesLB.SetHighlightRange(); // set the handlers: 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 e6a4e02a8096..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 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/datman.cxx b/extensions/source/bibliography/datman.cxx index e338eeff3b2e..e903707a74ec 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -646,7 +646,7 @@ DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) aSelectionHB.Show(); aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL ); - aSelectionLB.SetWindowBits(WB_CLIPCHILDREN|WB_SORT); + aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); aSelectionLB.GetModel()->SetSortMode(SortAscending); ::rtl::OUString sActiveSource = pDatMan->getActiveDataSource(); 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/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 99eabba56275..7ad5d944ce43 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -1342,7 +1342,7 @@ namespace pcr if ( nPropId == PROPERTY_ID_MAXTEXTLEN ) aMinValue.Value = -1; - else if ( ( nPropId == PROPERTY_ID_BOUNDCOLUMN ) || ( nPropId == PROPERTY_ID_VISIBLESIZE ) ) + else if ( nPropId == PROPERTY_ID_VISIBLESIZE ) aMinValue.Value = 1; else aMinValue.Value = 0; diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx index 8beb5c557785..5fbbe57dc11b 100644 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ b/extensions/source/propctrlr/selectlabeldialog.cxx @@ -79,7 +79,7 @@ namespace pcr m_aControlTree.SetSelectionMode( SINGLE_SELECTION ); m_aControlTree.SetDragDropMode( 0 ); m_aControlTree.EnableInplaceEditing( sal_False ); - m_aControlTree.SetWindowBits(WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HSCROLL); + m_aControlTree.SetStyle(m_aControlTree.GetStyle() | WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HSCROLL); m_aControlTree.SetNodeBitmaps( m_aModelImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ), m_aModelImages.GetImage( RID_SVXIMG_EXPANDEDNODE ) ); m_aControlTree.SetSelectHdl(LINK(this, OSelectLabelDialog, OnEntrySelected)); 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/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 2889257a1f1c..7b4b258ea43f 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -120,12 +120,13 @@ SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) : Bitmap( SaneResId( RID_SCAN_BITMAP_PLUS ) ), Bitmap( SaneResId( RID_SCAN_BITMAP_MINUS ) ) ); - maOptionBox.SetWindowBits( WB_HASLINES | - WB_HASBUTTONS | - WB_NOINITIALSELECTION | - WB_HASBUTTONSATROOT | - WB_HASLINESATROOT - ); + maOptionBox.SetStyle( maOptionBox.GetStyle()| + WB_HASLINES | + WB_HASBUTTONS | + WB_NOINITIALSELECTION | + WB_HASBUTTONSATROOT | + WB_HASLINESATROOT + ); FreeResource(); } 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/forms/qa/integration/forms/ListSelection.java b/forms/qa/integration/forms/ListSelection.java index 24a5290dc1d4..17026c09906e 100644 --- a/forms/qa/integration/forms/ListSelection.java +++ b/forms/qa/integration/forms/ListSelection.java @@ -136,8 +136,8 @@ public class ListSelection extends integration.forms.TestCase } catch( com.sun.star.uno.Exception e ) { - System.err.println( e ); e.printStackTrace( System.err ); + failed( "caught an exception: " + e.toString() ); } } @@ -183,6 +183,7 @@ public class ListSelection extends integration.forms.TestCase catch( com.sun.star.uno.Exception e ) { e.printStackTrace( System.err ); + failed( "caught an exception: " + e.toString() ); } } @@ -217,6 +218,7 @@ public class ListSelection extends integration.forms.TestCase catch( com.sun.star.uno.Exception e ) { e.printStackTrace( System.err ); + failed( "caught an exception: " + e.toString() ); } } @@ -275,6 +277,7 @@ public class ListSelection extends integration.forms.TestCase catch( java.lang.Throwable e ) { e.printStackTrace(); + failed( "caught an exception: " + e.toString() ); } } diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl index eb8efe91b4f0..66e02dc8d8c4 100644 --- a/forms/qa/unoapi/knownissues.xcl +++ b/forms/qa/unoapi/knownissues.xcl @@ -121,10 +121,6 @@ forms.OComboBoxModel::com::sun::star::form::XUpdateBroadcaster forms.OFileControlModel::com::sun::star::beans::XFastPropertySet forms.OFileControlModel::com::sun::star::form::FormControlModel -### i111148 ### -forms.OImageControlModel::com::sun::star::beans::XMultiPropertySet -forms.OImageControlModel::com::sun::star::beans::XPropertySet - ### i113201 ### forms.OEditModel::com::sun::star::form::validation::XValidatableFormComponent diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 9cbc5237cf95..d664be8e4a86 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/awt/XItemList.hpp> /** === end UNO includes === **/ #include <comphelper/numbers.hxx> @@ -342,11 +343,28 @@ namespace frm case FormComponentType::LISTBOX: { - Sequence< ::rtl::OUString> aValueSelection; - Reference< XPropertySet > aPropertyPointer(getModel(), UNO_QUERY); - aPropertyPointer->getPropertyValue(PROPERTY_VALUE_SEQ) >>= aValueSelection; - if (rEvent.Selected <= aValueSelection.getLength()) - aText.append( aValueSelection[ rEvent.Selected ] ); + try + { + const Reference< XItemList > xItemList( getModel(), UNO_QUERY_THROW ); + ::rtl::OUString sItemText( xItemList->getItemText( rEvent.Selected ) ); + + const MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( sItemText ); + if ( itemPos != m_aDisplayItemToValueItem.end() ) + { + sItemText = itemPos->second; + if ( sItemText.getLength() ) + { + ::dbtools::OPredicateInputController aPredicateInput( m_aContext.getLegacyServiceFactory(), m_xConnection, getParseContext() ); + ::rtl::OUString sErrorMessage; + OSL_VERIFY( aPredicateInput.normalizePredicateString( sItemText, m_xField, &sErrorMessage ) ); + } + } + aText.append( sItemText ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } break; @@ -614,6 +632,16 @@ namespace frm { m_aText = aText; xListBox->selectItem(m_aText, sal_True); + if ( xListBox->getSelectedItemPos() >= 0 ) + { + const bool isQuoted = ( aText.getLength() > 0 ) + && ( aText[0] == '\'' ) + && ( aText[aText.getLength() - 1] == '\'' ); + if ( isQuoted ) + { + xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True ); + } + } } } break; default: @@ -804,6 +832,16 @@ namespace frm case FormComponentType::LISTBOX: case FormComponentType::COMBOBOX: m_nControlClass = nClassId; + if ( FormComponentType::LISTBOX == nClassId ) + { + Sequence< ::rtl::OUString > aDisplayItems; + OSL_VERIFY( xControlModel->getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aDisplayItems ); + Sequence< ::rtl::OUString > aValueItems; + OSL_VERIFY( xControlModel->getPropertyValue( PROPERTY_VALUE_SEQ ) >>= aValueItems ); + OSL_ENSURE( aDisplayItems.getLength() == aValueItems.getLength(), "OFilterControl::initialize: inconsistent item lists!" ); + for ( sal_Int32 i=0; i < ::std::min( aDisplayItems.getLength(), aValueItems.getLength() ); ++i ) + m_aDisplayItemToValueItem[ aDisplayItems[i] ] = aValueItems[i]; + } break; default: m_bMultiLine = ::comphelper::hasProperty( PROPERTY_MULTILINE, xControlModel ) && ::comphelper::getBOOL( xControlModel->getPropertyValue( PROPERTY_MULTILINE ) ); diff --git a/forms/source/component/Filter.hxx b/forms/source/component/Filter.hxx index 8e2933e93158..99c621d6cdf6 100644 --- a/forms/source/component/Filter.hxx +++ b/forms/source/component/Filter.hxx @@ -45,7 +45,7 @@ #include <connectivity/sqlparse.hxx> #include <svx/ParseContext.hxx> -class Window; +#include <hash_map> //......................................................................... namespace frm @@ -75,6 +75,9 @@ namespace frm ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMessageParent; + typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > MapString2String; + MapString2String m_aDisplayItemToValueItem; + ::rtl::OUString m_aText; ::connectivity::OSQLParser m_aParser; sal_Int16 m_nControlClass; // which kind of control do we use? diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index f9d3ffab9709..de2dda9ca388 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -296,11 +296,11 @@ Sequence< ::rtl::OUString > SAL_CALL OControl::getSupportedServiceNames_Static() //------------------------------------------------------------------------------ void SAL_CALL OControl::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException) { - InterfaceRef xAggAsIface; + Reference< XInterface > xAggAsIface; query_aggregation(m_xAggregate, xAggAsIface); // does the disposing come from the aggregate ? - if (xAggAsIface != InterfaceRef(_rEvent.Source, UNO_QUERY)) + if (xAggAsIface != Reference< XInterface >(_rEvent.Source, UNO_QUERY)) { // no -> forward it Reference<com::sun::star::lang::XEventListener> xListener; if (query_aggregation(m_xAggregate, xListener)) @@ -310,16 +310,16 @@ void SAL_CALL OControl::disposing(const com::sun::star::lang::EventObject& _rEve // XControl //------------------------------------------------------------------------------ -void SAL_CALL OControl::setContext(const InterfaceRef& Context) throw (RuntimeException) +void SAL_CALL OControl::setContext(const Reference< XInterface >& Context) throw (RuntimeException) { if (m_xControl.is()) m_xControl->setContext(Context); } //------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControl::getContext() throw (RuntimeException) +Reference< XInterface > SAL_CALL OControl::getContext() throw (RuntimeException) { - return m_xControl.is() ? m_xControl->getContext() : InterfaceRef(); + return m_xControl.is() ? m_xControl->getContext() : Reference< XInterface >(); } //------------------------------------------------------------------------------ @@ -711,13 +711,13 @@ void OControlModel::doSetDelegator() // XChild //------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControlModel::getParent() throw(RuntimeException) +Reference< XInterface > SAL_CALL OControlModel::getParent() throw(RuntimeException) { return m_xParent; } //------------------------------------------------------------------------------ -void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) +void SAL_CALL OControlModel::setParent(const Reference< XInterface >& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) { osl::MutexGuard aGuard(m_aMutex); @@ -1867,30 +1867,24 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co throw com::sun::star::lang::IllegalArgumentException(); case PROPERTY_ID_CONTROLLABEL: { - DBG_ASSERT(!rValue.hasValue() || (rValue.getValueType().getTypeClass() == TypeClass_INTERFACE), - "OBoundControlModel::setFastPropertyValue_NoBroadcast : invalid argument !"); - if (!rValue.hasValue()) + if ( rValue.hasValue() && ( rValue.getValueTypeClass() != TypeClass_INTERFACE ) ) + throw com::sun::star::lang::IllegalArgumentException(); + + Reference< XInterface > xNewValue( rValue, UNO_QUERY ); + if ( !xNewValue.is() ) { // set property to "void" - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); + Reference< XComponent > xComp( m_xLabelControl, UNO_QUERY ); + if ( xComp.is() ) + xComp->removeEventListener( static_cast< XPropertyChangeListener* >( this ) ); m_xLabelControl = NULL; break; } - InterfaceRef xNewValue; - rValue >>= xNewValue; - - Reference<XControlModel> xAsModel(xNewValue, UNO_QUERY); - Reference<com::sun::star::lang::XServiceInfo> xAsServiceInfo(xNewValue, UNO_QUERY); - Reference<XPropertySet> xAsPropSet(xNewValue, UNO_QUERY); - Reference<XChild> xAsChild(xNewValue, UNO_QUERY); - if (!xAsModel.is() || !xAsServiceInfo.is() || !xAsPropSet.is() || !xAsChild.is()) - { - throw com::sun::star::lang::IllegalArgumentException(); - } - - if (!xAsServiceInfo->supportsService(m_aLabelServiceName)) + Reference< XControlModel > xAsModel ( xNewValue, UNO_QUERY ); + Reference< XServiceInfo > xAsServiceInfo ( xAsModel, UNO_QUERY ); + Reference< XPropertySet > xAsPropSet ( xAsServiceInfo, UNO_QUERY ); + Reference< XChild > xAsChild ( xAsPropSet, UNO_QUERY ); + if ( !xAsChild.is() || !xAsServiceInfo->supportsService( m_aLabelServiceName ) ) { throw com::sun::star::lang::IllegalArgumentException(); } @@ -1898,7 +1892,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co // check if weself and the given model have a common anchestor (up to the forms collection) Reference<XChild> xCont; query_interface(static_cast<XWeak*>(this), xCont); - InterfaceRef xMyTopLevel = xCont->getParent(); + Reference< XInterface > xMyTopLevel = xCont->getParent(); while (xMyTopLevel.is()) { Reference<XForm> xAsForm(xMyTopLevel, UNO_QUERY); @@ -1907,9 +1901,9 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co break; Reference<XChild> xLoopAsChild(xMyTopLevel, UNO_QUERY); - xMyTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : InterfaceRef(); + xMyTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : Reference< XInterface >(); } - InterfaceRef xNewTopLevel = xAsChild->getParent(); + Reference< XInterface > xNewTopLevel = xAsChild->getParent(); while (xNewTopLevel.is()) { Reference<XForm> xAsForm(xNewTopLevel, UNO_QUERY); @@ -1917,7 +1911,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co break; Reference<XChild> xLoopAsChild(xNewTopLevel, UNO_QUERY); - xNewTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : InterfaceRef(); + xNewTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : Reference< XInterface >(); } if (xNewTopLevel != xMyTopLevel) { diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index da335308933e..909cc1f23659 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -64,6 +64,8 @@ #include <unotools/sharedunocomponent.hxx> #include <vcl/svapp.hxx> +#include <boost/optional.hpp> + #include <algorithm> #include <functional> @@ -677,9 +679,13 @@ namespace frm return; } - sal_Int16 nBoundColumn = 0; - if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT) + ::boost::optional< sal_Int16 > aBoundColumn; + if ( m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT ) + { + sal_Int16 nBoundColumn( 0 ); m_aBoundColumn >>= nBoundColumn; + aBoundColumn.reset( nBoundColumn ); + } ::utl::SharedUNOComponent< XResultSet > xListCursor; try @@ -703,14 +709,14 @@ namespace frm ::rtl::OUString aFieldName; ::rtl::OUString aBoundFieldName; - if ((nBoundColumn > 0) && xFieldsByIndex.is()) + if ( !!aBoundColumn && ( *aBoundColumn >= 0 ) && xFieldsByIndex.is() ) { - if (xFieldsByIndex->getCount() <= nBoundColumn) + if ( *aBoundColumn >= xFieldsByIndex->getCount() ) break; - Reference<XPropertySet> xFieldAsSet(xFieldsByIndex->getByIndex(nBoundColumn),UNO_QUERY); + Reference<XPropertySet> xFieldAsSet(xFieldsByIndex->getByIndex( *aBoundColumn ),UNO_QUERY); xFieldAsSet->getPropertyValue(PROPERTY_NAME) >>= aBoundFieldName; - nBoundColumn = 1; + aBoundColumn.reset( 1 ); xFieldAsSet.set(xFieldsByIndex->getByIndex(0),UNO_QUERY); xFieldAsSet->getPropertyValue(PROPERTY_NAME) >>= aFieldName; @@ -840,11 +846,11 @@ namespace frm // Feld der BoundColumn des ResultSets holen m_nBoundColumnType = DataType::SQLNULL; - if ( ( nBoundColumn > 0 ) && m_xColumn.is() ) + if ( !!aBoundColumn && ( *aBoundColumn >= 0 ) && m_xColumn.is() ) { // don't look for a bound column if we're not connected to a field try { - Reference< XPropertySet > xBoundField( xColumns->getByIndex( nBoundColumn ), UNO_QUERY_THROW ); + Reference< XPropertySet > xBoundField( xColumns->getByIndex( *aBoundColumn ), UNO_QUERY_THROW ); OSL_VERIFY( xBoundField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= m_nBoundColumnType ); } catch( const Exception& ) @@ -868,7 +874,7 @@ namespace frm if ( impl_hasBoundComponent() ) { - aBoundValue.fill( nBoundColumn + 1, m_nBoundColumnType, xCursorRow ); + aBoundValue.fill( *aBoundColumn + 1, m_nBoundColumnType, xCursorRow ); aValueList.push_back( aBoundValue ); } diff --git a/forms/source/helper/windowstateguard.cxx b/forms/source/helper/windowstateguard.cxx index c4bb6154a4d5..1bbc8e4242f6 100644 --- a/forms/source/helper/windowstateguard.cxx +++ b/forms/source/helper/windowstateguard.cxx @@ -98,7 +98,7 @@ namespace frm @precond our mutex is locked */ - void impl_ensureEnabledState_nothrow() const; + void impl_ensureEnabledState_nothrow_nolck(); }; //-------------------------------------------------------------------- @@ -129,16 +129,24 @@ namespace frm } //-------------------------------------------------------------------- - void WindowStateGuard_Impl::impl_ensureEnabledState_nothrow() const + void WindowStateGuard_Impl::impl_ensureEnabledState_nothrow_nolck() { try { - sal_Bool bEnabled = m_xWindow->isEnabled(); + Reference< XWindow2 > xWindow; + sal_Bool bEnabled = sal_False; sal_Bool bShouldBeEnabled = sal_False; - OSL_VERIFY( m_xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= bShouldBeEnabled ); - - if ( !bShouldBeEnabled && bEnabled ) - m_xWindow->setEnable( sal_False ); + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() || !m_xModelProps.is() ) + return; + xWindow = m_xWindow; + bEnabled = xWindow->isEnabled(); + OSL_VERIFY( m_xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= bShouldBeEnabled ); + } + + if ( !bShouldBeEnabled && bEnabled && xWindow.is() ) + xWindow->setEnable( sal_False ); } catch( const Exception& ) { @@ -149,15 +157,13 @@ namespace frm //-------------------------------------------------------------------- void SAL_CALL WindowStateGuard_Impl::windowEnabled( const EventObject& /*e*/ ) throw (RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_ensureEnabledState_nothrow(); + impl_ensureEnabledState_nothrow_nolck(); } //-------------------------------------------------------------------- void SAL_CALL WindowStateGuard_Impl::windowDisabled( const EventObject& /*e*/ ) throw (RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_ensureEnabledState_nothrow(); + impl_ensureEnabledState_nothrow_nolck(); } //-------------------------------------------------------------------- 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/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index 89414f18ce65..037c27f1fdd7 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -53,8 +53,6 @@ class ZipPackageFolder : public cppu::ImplInheritanceHelper2 ::com::sun::star::container::XEnumerationAccess > { - static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId; - protected: ContentHash maContents; const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory; @@ -82,10 +80,7 @@ public: throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource); - static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId() - { - return aImplementationId; - } + static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId(); void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; } void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; } 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 be11586bc4fb..9a5876b3e6df 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -54,6 +54,7 @@ #include <rtl/digest.h> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> // since the copying uses 32000 blocks usually, it makes sense to have a smaller size #define MAX_STORCACHE_SIZE 30000 @@ -64,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; } //----------------------------------------------- @@ -255,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 ) @@ -363,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() ) @@ -410,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 @@ -432,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++ ) { @@ -443,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 @@ -462,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; } //----------------------------------------------- @@ -796,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(); @@ -815,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(); @@ -914,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(); @@ -925,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 @@ -969,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 ) { @@ -1007,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(); @@ -1017,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 ) { @@ -1172,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(); @@ -1187,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() ); } //----------------------------------------------- @@ -1236,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() ) ; @@ -1254,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 @@ -1264,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 ) @@ -1343,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 ) { @@ -1356,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 ); @@ -1385,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 ); @@ -1410,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 ); @@ -1512,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() ) ; @@ -1520,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(); } //----------------------------------------------- @@ -1559,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 ); } @@ -1580,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 ) { @@ -1593,7 +1593,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar throw packages::WrongPasswordException(); } - GetCopyOfLastCommit( xTargetStream, aGlobalPass ); + GetCopyOfLastCommit( xTargetStream, aGlobalEncryptionData ); } else { @@ -1602,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() ); @@ -1620,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() ) @@ -1647,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(); @@ -1660,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(); @@ -1696,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 ); } //----------------------------------------------- @@ -2028,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 ) @@ -2080,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 ) @@ -2088,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 ) { @@ -2138,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 ) ); } @@ -2173,25 +2179,14 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() return m_pData->m_pTypeCollection->getTypes() ; } +namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //----------------------------------------------- uno::Sequence< sal_Int8 > SAL_CALL OWriteStream::getImplementationId() throw( uno::RuntimeException ) { - static ::cppu::OImplementationId* pID = NULL ; - - if ( pID == NULL ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pID == NULL ) - { - static ::cppu::OImplementationId aID( sal_False ) ; - pID = &aID ; - } - } - - return pID->getImplementationId() ; - + ::cppu::OImplementationId &rId = lcl_ImplId::get(); + return rId.getImplementationId(); } //----------------------------------------------- @@ -2713,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 ); } @@ -2741,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 ) @@ -3181,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 @@ -3293,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 9c90c4ce35dd..851fea6b086b 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -49,6 +49,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> @@ -207,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 ) @@ -247,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 ) @@ -291,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 ) @@ -748,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 ) { @@ -855,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 ) { @@ -913,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 ) { @@ -929,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 @@ -947,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 @@ -1360,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() ) ; @@ -1370,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(); } } @@ -1679,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, @@ -1712,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 ); } @@ -2247,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 ) @@ -2254,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 ; @@ -2267,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 { @@ -2322,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 ) ); } @@ -2334,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 ) @@ -2368,25 +2381,14 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() return m_pData->m_pTypeCollection->getTypes() ; } +namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //----------------------------------------------- uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId() throw( uno::RuntimeException ) { - static ::cppu::OImplementationId* pID = NULL ; - - if ( pID == NULL ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pID == NULL ) - { - static ::cppu::OImplementationId aID( sal_False ) ; - pID = &aID ; - } - } - - return pID->getImplementationId() ; - + ::cppu::OImplementationId &rID = lcl_ImplId::get(); + return rID.getImplementationId(); } //____________________________________________________________________________________________________ @@ -2576,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 ) ); } //----------------------------------------------- @@ -2856,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; @@ -2923,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 ) ); } //----------------------------------------------- @@ -3721,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 //____________________________________________________________________________________________________ @@ -4608,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() ); @@ -4620,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 { @@ -4639,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 >() ); @@ -4652,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 ) { @@ -4668,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() ); @@ -4686,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 { @@ -4705,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 //____________________________________________________________________________________________________ @@ -5954,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 ) @@ -6083,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 ) @@ -6097,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 ) @@ -6117,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 @@ -6131,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() ) @@ -6140,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 9ba26e0100c5..fca0e09f63bd 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -69,6 +69,7 @@ #include <rtl/uri.hxx> #include <rtl/random.h> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include <osl/time.h> #include <osl/file.hxx> #include "com/sun/star/io/XAsyncOutputMonitor.hpp" @@ -1607,21 +1608,14 @@ uno::Reference < XSingleServiceFactory > ZipPackage::createServiceFactory( uno:: static_getSupportedServiceNames()); } +namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + // XUnoTunnel Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void ) throw (RuntimeException) { - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + ::cppu::OImplementationId &rId = lcl_ImplId::get(); + return rId.getImplementationId(); } sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier ) @@ -1650,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/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index f0c4a11d22f4..903191deb6be 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/io/XSeekable.hpp> #include <EncryptedDataHeader.hxx> #include <rtl/random.h> +#include <rtl/instance.hxx> #include <memory> using namespace com::sun::star::packages::zip::ZipConstants; @@ -59,7 +60,7 @@ using namespace std; using namespace ::com::sun::star; using vos::ORef; -Sequence < sal_Int8 > ZipPackageFolder::aImplementationId = Sequence < sal_Int8 > (); +namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; } ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory, sal_Int32 nFormat, @@ -80,10 +81,9 @@ ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xF aEntry.nCompressedSize = 0; aEntry.nSize = 0; aEntry.nOffset = -1; - if ( !aImplementationId.getLength() ) - { - aImplementationId = getImplementationId(); - } + Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get(); + if ( !rCachedImplId.getLength() ) + rCachedImplId = getImplementationId(); } @@ -187,6 +187,11 @@ void ZipPackageFolder::copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource) rDest.nExtraLen = rSource.nExtraLen; } +const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_getImplementationId() +{ + return lcl_CachedImplId::get(); +} + // XNameContainer void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 6343607c8711..da44dafa000b 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -46,6 +46,8 @@ #include <comphelper/seekableinput.hxx> #include <comphelper/storagehelper.hxx> +#include <rtl/instance.hxx> + #include <PackageConstants.hxx> using namespace com::sun::star::packages::zip::ZipConstants; @@ -56,8 +58,12 @@ using namespace com::sun::star; using namespace cppu; using namespace rtl; -Sequence < sal_Int8 > ZipPackageStream::aImplementationId = Sequence < sal_Int8 > (); +namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; } +const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_getImplementationId() +{ + return lcl_CachedImplId::get(); +} ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage, const Reference< XMultiServiceFactory >& xFactory, @@ -92,10 +98,9 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage, aEntry.nPathLen = -1; aEntry.nExtraLen = -1; - if ( !aImplementationId.getLength() ) - { - aImplementationId = getImplementationId(); - } + Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get(); + if ( !rCachedImplId.getLength() ) + rCachedImplId = getImplementationId(); } ZipPackageStream::~ZipPackageStream( void ) diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/source/zippackage/ZipPackageStream.hxx index a0d5fad6e4da..38301d5e7d12 100644 --- a/package/source/zippackage/ZipPackageStream.hxx +++ b/package/source/zippackage/ZipPackageStream.hxx @@ -55,7 +55,6 @@ class ZipPackageStream : public cppu::ImplInheritanceHelper2 ::com::sun::star::packages::XDataSinkEncrSupport > { - static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId; protected: com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream; const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory; @@ -146,10 +145,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData() throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId() - { - return aImplementationId; - } + static const ::com::sun::star::uno::Sequence < sal_Int8 >& static_getImplementationId(); // XActiveDataSink virtual void SAL_CALL setInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aStream ) diff --git a/setup_native/scripts/install_solaris.sh b/setup_native/scripts/install_solaris.sh index 624999f44f37..bb792bcf2618 100644 --- a/setup_native/scripts/install_solaris.sh +++ b/setup_native/scripts/install_solaris.sh @@ -244,7 +244,7 @@ else CMD=/tmp/userinstall.$$; echo "" > $CMD fi -sed -e 's|"/|"${PKG_INSTALL_ROOT}/|g' > $CMD +sed -e 's|/opt/|${PKG_INSTALL_ROOT}/opt/|g' > $CMD /bin/sh -e $CMD rm -f $CMD EOF 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 103fdc5848a2..cbe724335cf8 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 0cc5268accc0..892505baa85b 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 ae1a795368e4..0070fed3ada1 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 56337202a213..e1b27c05e7aa 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -341,7 +341,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 f992ef98b56b..9fb6c2e4b2e7 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -305,7 +305,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) { @@ -1294,7 +1294,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 2085704cf359..ca6f70add7b6 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -187,7 +187,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 e3927f188460..6e8d0f2e614e 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -1001,7 +1001,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 818781cd0bf3..200f70a32383 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java @@ -241,7 +241,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 |