[ooo-build-commit] Branch 'ooo/master' - 3 commits - basic/inc basic/source desktop/inc desktop/source desktop/util officecfg/registry sfx2/source svx/inc svx/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Thu Aug 6 18:09:56 PDT 2009
basic/inc/basic/sbstar.hxx | 1
basic/source/classes/sb.cxx | 6
basic/source/classes/sb.src | 2
basic/source/classes/sbunoobj.cxx | 315 +
basic/source/classes/sbxmod.cxx | 1
basic/source/comp/exprtree.cxx | 6
basic/source/comp/scanner.cxx | 12
basic/source/inc/runtime.hxx | 37
basic/source/inc/sbunoobj.hxx | 53
basic/source/runtime/runtime.cxx | 42
basic/source/runtime/step2.cxx | 10
basic/source/sbx/sbxvalue.cxx | 16
desktop/inc/app.hxx | 1
desktop/source/app/app.cxx | 4
desktop/source/app/check_ext_deps.cxx | 256 +
desktop/source/app/makefile.mk | 1
desktop/source/deployment/gui/dp_gui.h | 1
desktop/source/deployment/gui/dp_gui.hrc | 82
desktop/source/deployment/gui/dp_gui_dialog.src | 227 -
desktop/source/deployment/gui/dp_gui_dialog2.cxx | 2054 ++++------
desktop/source/deployment/gui/dp_gui_dialog2.hxx | 167
desktop/source/deployment/gui/dp_gui_dialog2.src | 60
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 161
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx | 21
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 1175 +++++
desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 271 +
desktop/source/deployment/gui/dp_gui_service.cxx | 26
desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 147
desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 19
desktop/source/deployment/gui/dp_gui_updatedata.hxx | 15
desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 77
desktop/source/deployment/gui/dp_gui_updatedialog.hxx | 15
desktop/source/deployment/gui/makefile.mk | 1
desktop/source/deployment/registry/dp_backend.cxx | 11
desktop/source/deployment/registry/help/dp_help.src | 2
desktop/source/deployment/registry/inc/dp_backend.h | 6
desktop/source/deployment/registry/package/dp_package.cxx | 22
desktop/source/inc/helpid.hrc | 6
desktop/util/hidother.src | 4
officecfg/registry/schema/org/openoffice/Setup.xcs | 7
sfx2/source/control/unoctitm.cxx | 11
svx/inc/optgenrl.hrc | 2
svx/inc/svx/fntctrl.hxx | 1
svx/source/cui/commonlingui.src | 20
svx/source/cui/hangulhanjadlg.src | 38
svx/source/cui/svuidlg.src | 24
svx/source/cui/zoom.src | 44
svx/source/dialog/fntctrl.cxx | 8
svx/source/dialog/srchdlg.cxx | 2
svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src | 2
50 files changed, 3587 insertions(+), 1905 deletions(-)
New commits:
commit c33ac5da565ad455bdfbb9e4fa9e3c027ab48ddd
Author: Release Engineers <releng at openoffice.org>
Date: Thu Aug 6 12:44:16 2009 +0000
CWS-TOOLING: integrate CWS os132
2009-07-21 15:24:18 +0200 os r274201 : #i103696# SwXTextPortion/SwXParagraph excluded
2009-07-15 13:19:17 +0200 os r274007 : #i103564# typo
2009-07-15 13:09:30 +0200 os r274005 : #i103564# SwFrames::hasElements
2009-07-15 13:02:16 +0200 os r274003 : #i103564# SwXBookmark::getPropertySetInfo fixed
2009-06-26 10:11:00 +0200 os r273395 : CWS-TOOLING: rebase CWS os132 to trunk at 272827 (milestone: DEV300:m50)
2009-06-23 08:52:24 +0200 os r273256 : #i102764# patch: attribute ListBoxes correctly handled in ::Reset()
2009-06-23 08:51:31 +0200 os r273255 : #i102764# ResetColor() added to remove background color
2009-06-22 14:57:38 +0200 os r273233 : #i102619# prevent access to already destroyed shell
2009-06-18 13:26:51 +0200 os r273112 : #i99508# ::insertTextContent: re-route to ::attach()
2009-06-18 10:59:53 +0200 os r273107 : #i85405# patch to enable 'Print grid' CheckBox correctly
2009-06-18 10:54:02 +0200 os r273106 : #i85133# dispose connection in GetColumnFmt to prevent connection locking
2009-06-18 10:24:31 +0200 os r273104 : #99535# ExportGraphic changed
2009-06-18 10:24:03 +0200 os r273103 : #99535# ExportGraphic changed
2009-06-18 10:23:11 +0200 os r273102 : #i102841# redlining mode switches to insert mode (cmc)
2009-06-17 14:05:42 +0200 os r273070 : #i102111# do not save already saved HTML documents before switching to source veiw
2009-06-17 13:18:20 +0200 os r273063 : #i101825# set rembered start position at the real start not at the initial start
2009-06-17 08:24:10 +0200 os r273048 : #99535# no dierect access to the file picker interface
2009-06-16 15:00:12 +0200 os r273020 : #i99937# notification of user options changes re-introduced
2009-06-15 14:36:03 +0200 os r272987 : #i98032# unreplaced text in protected areas must not be attributed either
2009-06-15 14:20:26 +0200 os r272985 : #i98032# replace list has to be initialised
2009-06-04 13:29:02 +0200 os r272624 : #i97810# set focus into column page
2009-06-04 11:01:14 +0200 os r272617 : #i98164# dialog resize to ease localisation
2009-06-04 10:59:44 +0200 os r272616 : #i98164# dialog resize to ease localisation
2009-05-28 16:05:03 +0200 os r272413 : #i98172# ConvertFieldsToText: take care of tabs with attributes
2009-05-28 11:12:45 +0200 os r272385 : #i59361# dialog controls resized
2009-05-28 11:03:14 +0200 os r272383 : #i59174# dialog controls moved
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index b57cdd9..11e9fd3 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -765,6 +765,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
sal_Bool bFailure = sal_False;
const SfxPoolItem* pItem = NULL;
SfxShell* pShell( 0 );
+ // #i102619# Retrieve metric from shell before execution - the shell could be destroyed after execution
+ SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM );
if ( pDispatcher->GetBindings() )
{
if ( !pDispatcher->IsLocked( GetId() ) )
@@ -783,6 +785,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
lNewArgs[nIndex].Value = makeAny( SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ));
}
+ eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() );
SfxAllItemSet aSet( pShell->GetPool() );
TransformParameters( GetId(), lNewArgs, aSet, pSlot );
if ( aSet.Count() )
@@ -811,6 +814,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
}
else
{
+ eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() );
// AppDispatcher
SfxAllItemSet aSet( SFX_APP()->GetPool() );
TransformParameters( GetId(), lNewArgs, aSet );
@@ -850,13 +854,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch;
if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) )
{
- // Retrieve metric from pool to have correct sub ID when calling QueryValue
- SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM );
- if ( pShell )
- eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() );
- else
- eMapUnit = GetCoreMetric( SFX_APP()->GetPool(), GetId() );
-
USHORT nSubId( 0 );
if ( eMapUnit == SFX_MAPUNIT_TWIP )
nSubId |= CONVERT_TWIPS;
diff --git a/svx/inc/optgenrl.hrc b/svx/inc/optgenrl.hrc
index 8156494..a0d0687 100644
--- a/svx/inc/optgenrl.hrc
+++ b/svx/inc/optgenrl.hrc
@@ -74,7 +74,7 @@
#define LINEH 12
#define FLINEH 8
#define LEFT 12
-#define MID 96
+#define MID 100
#define RIGHT 248
#define TOP 10
#define LINE(y) (14+y*15)
diff --git a/svx/inc/svx/fntctrl.hxx b/svx/inc/svx/fntctrl.hxx
index 955d871..31422c8 100644
--- a/svx/inc/svx/fntctrl.hxx
+++ b/svx/inc/svx/fntctrl.hxx
@@ -71,6 +71,7 @@ public:
SvxFont& GetCJKFont();
SvxFont& GetCTLFont();
void SetColor( const Color& rColor );
+ void ResetColor();
void SetBackColor( const Color& rColor );
void UseResourceText( BOOL bUse = TRUE );
void Paint( const Rectangle& );
diff --git a/svx/source/cui/commonlingui.src b/svx/source/cui/commonlingui.src
index 59fbb6b..f3d3c05 100644
--- a/svx/source/cui/commonlingui.src
+++ b/svx/source/cui/commonlingui.src
@@ -47,7 +47,7 @@ Window RID_SVX_WND_COMMON_LINGU
{
HelpId=HID_SPELLDLG_SETWORD;
Pos = MAP_APPFONT( 51, 9 );
- Size = MAP_APPFONT( 149, 10 );
+ Size = MAP_APPFONT( 164, 10 );
Border =FALSE;
TabStop = TRUE;
};
@@ -62,7 +62,7 @@ Window RID_SVX_WND_COMMON_LINGU
Edit ED_NEWWORD
{
Pos = MAP_APPFONT( 51, 24 );
- Size = MAP_APPFONT( 122, 12 );
+ Size = MAP_APPFONT( 137, 12 );
Border = TRUE;
};
@@ -75,21 +75,21 @@ Window RID_SVX_WND_COMMON_LINGU
PushButton BTN_IGNORE
{
- Pos = MAP_APPFONT( 209, 6 );
+ Pos = MAP_APPFONT( 224, 6 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Ignore" ;
};
PushButton BTN_IGNOREALL
{
- Pos = MAP_APPFONT( 209, 22 );
+ Pos = MAP_APPFONT( 224, 22 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "Always I~gnore" ;
};
PushButton BTN_CHANGE
{
- Pos = MAP_APPFONT( 209, 40 );
+ Pos = MAP_APPFONT( 224, 40 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "~Replace" ;
DefButton = TRUE ;
@@ -97,14 +97,14 @@ Window RID_SVX_WND_COMMON_LINGU
PushButton BTN_CHANGEALL
{
- Pos = MAP_APPFONT( 209, 56 );
+ Pos = MAP_APPFONT( 224, 56 );
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "Always R~eplace" ;
};
PushButton BTN_OPTIONS
{
- Pos = MAP_APPFONT( 209, 129 );
+ Pos = MAP_APPFONT( 224, 129 );
Size = MAP_APPFONT( 55, 14 );
Hide = TRUE ;
Text [ en-US ] = "Options..." ;
@@ -119,19 +119,19 @@ Window RID_SVX_WND_COMMON_LINGU
GroupBox GB_AUDIT
{
Pos = MAP_APPFONT( 1, 1 );
- Size = MAP_APPFONT( 268, 148 );
+ Size = MAP_APPFONT( 283, 148 );
Hide=TRUE;
};
HelpButton BTN_SPL_HELP
{
- Pos = MAP_APPFONT( 145, 153 );
+ Pos = MAP_APPFONT( 160, 153 );
Size = MAP_APPFONT( 55, 14 );
};
CancelButton BTN_SPL_CANCEL
{
- Pos = MAP_APPFONT ( 209 , 153 ) ;
+ Pos = MAP_APPFONT ( 224 , 153 ) ;
Size = MAP_APPFONT ( 55 , 14 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Close" ;
diff --git a/svx/source/cui/hangulhanjadlg.src b/svx/source/cui/hangulhanjadlg.src
index 603a28e..0d0041b 100644
--- a/svx/source/cui/hangulhanjadlg.src
+++ b/svx/source/cui/hangulhanjadlg.src
@@ -37,7 +37,7 @@
ModalDialog RID_SVX_MDLG_HANGULHANJA
{
HelpId = HID_DIALOG_HANGULHANJA;
- Size = MAP_APPFONT( 287, 175 );
+ Size = MAP_APPFONT( 302, 175 );
OutputSize = TRUE;
Closeable = TRUE ;
Moveable = TRUE ;
@@ -47,7 +47,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
PushButton PB_FIND
{
- Pos = MAP_APPFONT( 192, 23 );
+ Pos = MAP_APPFONT( 207, 23 );
Size = MAP_APPFONT( 30, 14 );
Text [ en-US ] = "~Find";
@@ -56,7 +56,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
Control CTL_SUGGESTIONS
{
Pos = MAP_APPFONT( 51, 46 );
- Size = MAP_APPFONT( 171, 30 );
+ Size = MAP_APPFONT( 186, 30 );
TabStop = TRUE ;
};
@@ -71,7 +71,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_SIMPLE_CONVERSION
{
Pos = MAP_APPFONT( 51, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Size = MAP_APPFONT( 60, 8 );
Group = TRUE;
@@ -80,16 +80,16 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_BRACKETED
{
- Pos = MAP_APPFONT( 109, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Pos = MAP_APPFONT( 114, 81 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hanja (Han~gul)";
};
RadioButton RB_HANGUL_HANJA_BRACKETED
{
- Pos = MAP_APPFONT( 167, 81 );
- Size = MAP_APPFONT( 55, 8 );
+ Pos = MAP_APPFONT( 177, 81 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hang~ul (Hanja)";
};
@@ -97,7 +97,7 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANGUL_HANJA_ABOVE
{
Pos = MAP_APPFONT( 51, 95 );
- Size = MAP_APPFONT( 55, 16 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Hangu~l";
@@ -105,8 +105,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANGUL_HANJA_BELOW
{
- Pos = MAP_APPFONT( 109, 95 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 114, 95 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Hang~ul";
@@ -114,8 +114,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_ABOVE
{
- Pos = MAP_APPFONT( 51, 114 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 56, 114 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Han~ja";
@@ -123,8 +123,8 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
RadioButton RB_HANJA_HANGUL_BELOW
{
- Pos = MAP_APPFONT( 109, 114 );
- Size = MAP_APPFONT( 55, 16 );
+ Pos = MAP_APPFONT( 114, 114 );
+ Size = MAP_APPFONT( 60, 16 );
// this is the _primary_ text
Text [ en-US ] = "Ha~nja";
@@ -141,14 +141,14 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
CheckBox CB_HANGUL_ONLY
{
Pos = MAP_APPFONT( 51, 134 );
- Size = MAP_APPFONT( 55, 8 );
+ Size = MAP_APPFONT( 60, 8 );
Text [ en-US ] = "Hangul ~only";
};
CheckBox CB_HANJA_ONLY
{
- Pos = MAP_APPFONT( 109, 134 );
+ Pos = MAP_APPFONT( 114, 134 );
Size = MAP_APPFONT( 55, 8 );
Text [ en-US ] = "Hanja onl~y";
@@ -157,12 +157,12 @@ ModalDialog RID_SVX_MDLG_HANGULHANJA
// this element is only for determining where our radio button group ends (in both directions)
FixedText FT_RESIZE_ANCHOR
{
- Pos = MAP_APPFONT( 226, 133 );
+ Pos = MAP_APPFONT( 241, 133 );
};
CheckBox CB_REPLACE_BY_CHARACTER
{
- Pos = MAP_APPFONT( 226, 81 );
+ Pos = MAP_APPFONT( 241, 81 );
Size = MAP_APPFONT( 55, 24 );
WordBreak = TRUE;
diff --git a/svx/source/cui/svuidlg.src b/svx/source/cui/svuidlg.src
index 11a0fd9..eeff7e3 100644
--- a/svx/source/cui/svuidlg.src
+++ b/svx/source/cui/svuidlg.src
@@ -156,37 +156,37 @@ ModalDialog MD_UPDATE_BASELINKS
};
CancelButton 1
{
- Pos = MAP_APPFONT ( 275 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Close" ;
};
HelpButton 1
{
- Pos = MAP_APPFONT ( 275 , 26 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 26 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
};
PushButton PB_UPDATE_NOW
{
- Pos = MAP_APPFONT ( 275 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 43 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Update" ;
};
PushButton PB_OPEN_SOURCE
{
- Pos = MAP_APPFONT ( 275 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 60 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Open" ;
};
PushButton PB_CHANGE_SOURCE
{
- Pos = MAP_APPFONT ( 275 , 77 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 77 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Modify..." ;
};
PushButton PB_BREAK_LINK
{
- Pos = MAP_APPFONT ( 275 , 94 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 270 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
Text [ en-US ] = "~Break Link" ;
};
FixedText FT_FILES2
diff --git a/svx/source/cui/zoom.src b/svx/source/cui/zoom.src
index dca3226..197d1e2 100644
--- a/svx/source/cui/zoom.src
+++ b/svx/source/cui/zoom.src
@@ -37,48 +37,48 @@ ModalDialog RID_SVXDLG_ZOOM
HelpId = SID_ATTR_ZOOM ;
OutputSize = TRUE ;
SvLook = TRUE ;
- Size = MAP_APPFONT ( 218 , 112 ) ;
+ Size = MAP_APPFONT ( 242 , 112 ) ;
Moveable = TRUE ;
Text [ en-US ] = "Zoom & View Layout";
FixedLine FL_ZOOM
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 100 , 8 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
Text [ en-US ] = "Zoom factor";
};
RadioButton BTN_OPTIMAL
{
Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
Text [ en-US ] = "~Optimal" ;
};
RadioButton BTN_WHOLE_PAGE
{
Pos = MAP_APPFONT ( 12 , 27 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
Text [ en-US ] = "~Fit width and height" ;
};
RadioButton BTN_PAGE_WIDTH
{
Pos = MAP_APPFONT ( 12 , 40 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
Text [ en-US ] = "Fit ~width" ;
};
RadioButton BTN_100
{
Pos = MAP_APPFONT ( 12 , 53 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
Text = "~100 %" ;
};
RadioButton BTN_USER
{
Pos = MAP_APPFONT ( 12 , 67 ) ;
- Size = MAP_APPFONT ( 59 , 10 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
Text [ en-US ] = "~Variable" ;
};
MetricField ED_USER
{
- Pos = MAP_APPFONT ( 74 , 66 ) ;
+ Pos = MAP_APPFONT ( 86 , 66 ) ;
Size = MAP_APPFONT ( 32 , 12 ) ;
Border = TRUE ;
Group = TRUE ;
@@ -91,31 +91,31 @@ ModalDialog RID_SVXDLG_ZOOM
};
FixedLine FL_VIEWLAYOUT
{
- Pos = MAP_APPFONT ( 112 , 3 ) ;
- Size = MAP_APPFONT ( 100 , 8 ) ;
+ Pos = MAP_APPFONT ( 124 , 3 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
Text [ en-US ] = "View layout";
};
RadioButton BTN_AUTOMATIC
{
- Pos = MAP_APPFONT ( 118 , 14 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
Text [ en-US ] = "~Automatic" ;
};
RadioButton BTN_SINGLE
{
- Pos = MAP_APPFONT ( 118 , 27 ) ;
- Size = MAP_APPFONT ( 91 , 10 ) ;
+ Pos = MAP_APPFONT ( 130, 27 ) ;
+ Size = MAP_APPFONT ( 106, 10 ) ;
Text [ en-US ] = "~Single page" ;
};
RadioButton BTN_COLUMNS
{
- Pos = MAP_APPFONT ( 118 , 41 ) ;
- Size = MAP_APPFONT ( 64 , 10 ) ;
+ Pos = MAP_APPFONT ( 130, 41 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
Text [ en-US ] = "~Columns" ;
};
MetricField ED_COLUMNS
{
- Pos = MAP_APPFONT ( 185 , 40 ) ;
+ Pos = MAP_APPFONT ( 209 , 40 ) ;
Size = MAP_APPFONT ( 24 , 12 ) ;
Border = TRUE ;
Group = TRUE ;
@@ -128,29 +128,29 @@ ModalDialog RID_SVXDLG_ZOOM
};
CheckBox CHK_BOOK
{
- Pos = MAP_APPFONT ( 124 , 55 ) ;
+ Pos = MAP_APPFONT ( 136 , 55 ) ;
Size = MAP_APPFONT ( 85 , 10 ) ;
Text [ en-US ] = "~Book mode" ;
};
FixedLine FL_BOTTOM
{
Pos = MAP_APPFONT ( 6 , 81 ) ;
- Size = MAP_APPFONT ( 206 , 8 ) ;
+ Size = MAP_APPFONT ( 230 , 8 ) ;
};
OKButton BTN_ZOOM_OK
{
- Pos = MAP_APPFONT ( 53 , 92 ) ;
+ Pos = MAP_APPFONT ( 77 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE ;
};
CancelButton BTN_ZOOM_CANCEL
{
- Pos = MAP_APPFONT ( 106 , 92 ) ;
+ Pos = MAP_APPFONT ( 130 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton BTN_ZOOM_HELP
{
- Pos = MAP_APPFONT ( 162 , 92 ) ;
+ Pos = MAP_APPFONT ( 186 , 92 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
};
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index ff0c706..de3b9df 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -604,6 +604,14 @@ void SvxFontPrevWindow::SetColor(const Color &rColor)
pImpl->pColor = new Color( rColor );
Invalidate();
}
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::ResetColor()
+{
+ delete pImpl->pColor;
+ pImpl->pColor = 0;
+ Invalidate();
+}
// -----------------------------------------------------------------------
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index fa49e6e..670264a 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -394,7 +394,7 @@ void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \
pImpl ( NULL ), \
pSearchList ( NULL ), \
- pReplaceList ( NULL ), \
+ pReplaceList ( new SearchAttrItemList ), \
pSearchItem ( NULL ), \
pSearchController ( NULL ), \
pOptionsController ( NULL ), \
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
index 9bd251b..dcc74b9 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
@@ -40,7 +40,7 @@
#define FULL_WIDTH (220)
#define FULL_HEIGHT (120)
-#define EDITBUTTON_WIDTH (70)
+#define EDITBUTTON_WIDTH (75)
#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
#define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X)
commit 52a01c51751442da2b0b7d982ead3e8295963952
Author: Release Engineers <releng at openoffice.org>
Date: Thu Aug 6 11:03:20 2009 +0000
CWS-TOOLING: integrate CWS ab72
2009-08-03 14:57:25 +0200 jsk r274581 : #i103969 - fixed f_windowfunctions.bas
2009-08-03 13:29:21 +0200 jsk r274577 : #i103969 - minor stability improvements and a rewrite to use GUI function to install extension (CLI version fails for some unknown reason)
2009-07-16 10:43:48 +0200 ab r274033 : #i82918# Added support to pass context explicitely to service ctors
2009-07-08 16:24:05 +0200 ab r273839 : CWS-TOOLING: rebase CWS ab72 to trunk at 273468 (milestone: DEV300:m51)
2009-07-02 13:09:22 +0200 ab r273641 : #i89740# Fixed resource typos
2009-07-02 12:21:49 +0200 ab r273635 : #i99461# Applied patch
2009-06-23 15:56:08 +0200 ab r273284 : #i100578# applied patch
2009-06-23 11:52:45 +0200 ab r273271 : #i100600# applied patch
2009-06-22 14:35:15 +0200 ab r273231 : #i101603# applied patch
2009-06-22 13:24:22 +0200 ab r273227 : #i100540# applied patch to remove unused code
2009-06-10 13:33:20 +0200 ab r272806 : #i82918# New style service ctor support
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index 9bc79b7..f71d1ff 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -121,6 +121,7 @@ public:
static void Error( SbError );
static void Error( SbError, const String& rMsg );
static void FatalError( SbError );
+ static void FatalError( SbError, const String& rMsg );
static BOOL IsRunning();
static SbError GetErrBasic();
// #66536 make additional message accessible by RTL function Error
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 6dedae6..4f123c2 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1357,6 +1357,12 @@ void StarBASIC::FatalError( SbError n )
pINST->FatalError( n );
}
+void StarBASIC::FatalError( SbError _errCode, const String& _details )
+{
+ if( pINST )
+ pINST->FatalError( _errCode, _details );
+}
+
SbError StarBASIC::GetErrBasic()
{
if( pINST )
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src
index 4daa8e0..5b1454d 100644
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -341,7 +341,7 @@ Resource RID_BASIC_START
};
String SbERR_NO_METHOD & ERRCODE_RES_MASK
{
- Text [ en-US ] = "Property or method not found." ;
+ Text [ en-US ] = "Property or method not found: $(ARG1)." ;
};
String SbERR_NEEDS_OBJECT & ERRCODE_RES_MASK
{
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index dcd51ce..96794c0 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -68,7 +68,7 @@
#include <com/sun/star/reflection/XIdlArray.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
#include <com/sun/star/reflection/XIdlClassProvider.hpp>
-#include <com/sun/star/reflection/XTypeDescription.hpp>
+#include <com/sun/star/reflection/XServiceConstructorDescription.hpp>
#include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
#include <com/sun/star/bridge/oleautomation/Date.hpp>
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
@@ -104,6 +104,8 @@ TYPEINIT1(SbUnoMethod,SbxMethod)
TYPEINIT1(SbUnoProperty,SbxProperty)
TYPEINIT1(SbUnoObject,SbxObject)
TYPEINIT1(SbUnoClass,SbxObject)
+TYPEINIT1(SbUnoService,SbxObject)
+TYPEINIT1(SbUnoServiceCtor,SbxMethod)
typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper;
@@ -2496,35 +2498,7 @@ SbUnoProperty::~SbUnoProperty()
{}
-// #72732 Spezielle SbxVariable, die beim put/get prueft,
-// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst
-// liegt eventuell ein Schreibfehler im Basic-Source vor.
-BOOL UnoClassMemberVariable::Get( SbxValues& rRes ) const
-{
- // Zugriff auf den Member einer UnoClass mit Parametern ist unsinnig
- if( GetParameters() )
- {
- if( mpRuntime )
- mpRuntime->Error( SbERR_NO_METHOD );
- }
- return SbxVariable::Get( rRes );
-}
-
-BOOL UnoClassMemberVariable::Put( const SbxValues& rRes )
-{
- if( bInternalUse )
- {
- return SbxVariable::Put( rRes );
- }
- // Schreibzugriff auf den Member einer UnoClass ist immer falsch
- mpRuntime->Error( SbERR_NO_METHOD );
- return FALSE;
-}
-
-TYPEINIT1(UnoClassMemberVariable,SbxVariable)
-
-
-SbxVariable* SbUnoObject::Find( const XubString& rName, SbxClassType t )
+SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
static Reference< XIdlMethod > xDummyMethod;
static Property aDummyProp;
@@ -3201,16 +3175,16 @@ SbxVariable* getVBAConstant( const String& rName )
// Funktion, um einen globalen Bezeichner im
// UnoScope zu suchen und fuer Sbx zu wrappen
-SbxVariable* findUnoClass( const String& rName )
+SbUnoClass* findUnoClass( const String& rName )
{
// #105550 Check if module exists
SbUnoClass* pUnoClass = NULL;
Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
- Reference< XTypeDescription > xTypeDesc;
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
+ Reference< XTypeDescription > xTypeDesc;
aRet >>= xTypeDesc;
if( xTypeDesc.is() )
@@ -3287,7 +3261,6 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = (SbxObject*)new SbUnoClass( aNewName, xClass );
pRes->PutObject( xWrapper );
-
}
}
else
@@ -3305,15 +3278,26 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
// Sonst wieder als Klasse annehmen
if( !pRes )
{
- SbxVariable* pNewClass = findUnoClass( aNewName );
+ SbUnoClass* pNewClass = findUnoClass( aNewName );
if( pNewClass )
{
- Reference< XIdlClass > xClass;
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = (SbxObject*)pNewClass;
pRes->PutObject( xWrapper );
}
}
+
+ // An UNO service?
+ if( !pRes )
+ {
+ SbUnoService* pUnoService = findUnoService( aNewName );
+ if( pUnoService )
+ {
+ pRes = new SbxVariable( SbxVARIANT );
+ SbxObjectRef xWrapper = (SbxObject*)pUnoService;
+ pRes->PutObject( xWrapper );
+ }
+ }
}
}
@@ -3334,6 +3318,266 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
+SbUnoService* findUnoService( const String& rName )
+{
+ SbUnoService* pSbUnoService = NULL;
+
+ Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ if( xTypeAccess->hasByHierarchicalName( rName ) )
+ {
+ Any aRet = xTypeAccess->getByHierarchicalName( rName );
+ Reference< XTypeDescription > xTypeDesc;
+ aRet >>= xTypeDesc;
+
+ if( xTypeDesc.is() )
+ {
+ TypeClass eTypeClass = xTypeDesc->getTypeClass();
+ if( eTypeClass == TypeClass_SERVICE )
+ {
+ Reference< XServiceTypeDescription2 > xServiceTypeDesc( xTypeDesc, UNO_QUERY );
+ if( xServiceTypeDesc.is() )
+ pSbUnoService = new SbUnoService( rName, xServiceTypeDesc );
+ }
+ }
+ }
+ return pSbUnoService;
+}
+
+SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
+{
+ SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_METHOD );
+
+ if( !pRes )
+ {
+ // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ if( m_bNeedsInit && m_xServiceTypeDesc.is() )
+ {
+ m_bNeedsInit = false;
+
+ Sequence< Reference< XServiceConstructorDescription > > aSCDSeq = m_xServiceTypeDesc->getConstructors();
+ const Reference< XServiceConstructorDescription >* pCtorSeq = aSCDSeq.getConstArray();
+ int nCtorCount = aSCDSeq.getLength();
+ for( int i = 0 ; i < nCtorCount ; ++i )
+ {
+ Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
+
+ String aName( xCtor->getName() );
+ if( !aName.Len() )
+ {
+ if( xCtor->isDefaultConstructor() )
+ aName = String::CreateFromAscii( "create" );
+ }
+
+ if( aName.Len() )
+ {
+ // Create and insert SbUnoServiceCtor
+ SbxVariableRef xSbCtorRef = new SbUnoServiceCtor( aName, xCtor );
+ QuickInsert( (SbxVariable*)xSbCtorRef );
+ pRes = xSbCtorRef;
+ }
+ }
+ }
+ }
+
+ return pRes;
+}
+
+void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType )
+{
+ const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
+ if( pHint )
+ {
+ SbxVariable* pVar = pHint->GetVar();
+ SbxArray* pParams = pVar->GetParameters();
+ SbUnoServiceCtor* pUnoCtor = PTR_CAST(SbUnoServiceCtor,pVar);
+ if( pUnoCtor && pHint->GetId() == SBX_HINT_DATAWANTED )
+ {
+ // Parameter count -1 because of Param0 == this
+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
+ Sequence<Any> args;
+ BOOL bOutParams = FALSE;
+
+ Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc();
+ Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters();
+ const Reference< XParameter >* pParameterSeq = aParameterSeq.getConstArray();
+ UINT32 nUnoParamCount = aParameterSeq.getLength();
+
+ // Default: Ignore not needed parameters
+ bool bParameterError = false;
+
+ // Is the last parameter a rest parameter?
+ bool bRestParameterMode = false;
+ if( nUnoParamCount > 0 )
+ {
+ Reference< XParameter > xLastParam = pParameterSeq[ nUnoParamCount - 1 ];
+ if( xLastParam.is() )
+ {
+ if( xLastParam->isRestParameter() )
+ bRestParameterMode = true;
+ }
+ }
+
+ // Too many parameters with context as first parameter?
+ USHORT nSbxParameterOffset = 1;
+ USHORT nParameterOffsetByContext = 0;
+ Reference < XComponentContext > xFirstParamContext;
+ if( nParamCount > nUnoParamCount )
+ {
+ // Check if first parameter is a context and use it
+ // then in createInstanceWithArgumentsAndContext
+ Any aArg0 = sbxToUnoValue( pParams->Get( nSbxParameterOffset ) );
+ if( (aArg0 >>= xFirstParamContext) && xFirstParamContext.is() )
+ nParameterOffsetByContext = 1;
+ }
+
+ UINT32 nEffectiveParamCount = nParamCount - nParameterOffsetByContext;
+ UINT32 nAllocParamCount = nEffectiveParamCount;
+ if( nEffectiveParamCount > nUnoParamCount )
+ {
+ if( !bRestParameterMode )
+ {
+ nEffectiveParamCount = nUnoParamCount;
+ nAllocParamCount = nUnoParamCount;
+ }
+ }
+ // Not enough parameters?
+ else if( nUnoParamCount > nEffectiveParamCount )
+ {
+ // RestParameterMode only helps if one (the last) parameter is missing
+ int nDiff = nUnoParamCount - nEffectiveParamCount;
+ if( !bRestParameterMode || nDiff > 1 )
+ {
+ bParameterError = true;
+ StarBASIC::Error( SbERR_NOT_OPTIONAL );
+ }
+ }
+
+ if( !bParameterError )
+ {
+ if( nAllocParamCount > 0 )
+ {
+ args.realloc( nAllocParamCount );
+ Any* pAnyArgs = args.getArray();
+ for( UINT32 i = 0 ; i < nEffectiveParamCount ; i++ )
+ {
+ USHORT iSbx = (USHORT)(i + nSbxParameterOffset + nParameterOffsetByContext);
+
+ // bRestParameterMode allows nEffectiveParamCount > nUnoParamCount
+ Reference< XParameter > xParam;
+ if( i < nUnoParamCount )
+ {
+ xParam = pParameterSeq[i];
+ if( !xParam.is() )
+ continue;
+
+ Reference< XTypeDescription > xParamTypeDesc = xParam->getType();
+ if( !xParamTypeDesc.is() )
+ continue;
+ com::sun::star::uno::Type aType( xParamTypeDesc->getTypeClass(), xParamTypeDesc->getName() );
+
+ // sbx paramter needs offset 1
+ pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ), aType );
+
+ // Check for out parameter if not already done
+ if( !bOutParams )
+ {
+ if( xParam->isOut() )
+ bOutParams = TRUE;
+ }
+ }
+ else
+ {
+ pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ) );
+ }
+ }
+ }
+
+ // "Call" ctor using createInstanceWithArgumentsAndContext
+ Reference < XComponentContext > xContext;
+ if( xFirstParamContext.is() )
+ {
+ xContext = xFirstParamContext;
+ }
+ else
+ {
+ Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ xContext.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
+ }
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+
+ Any aRetAny;
+ if( xServiceMgr.is() )
+ {
+ String aServiceName = GetName();
+ Reference < XInterface > xRet;
+ try
+ {
+ xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
+ }
+ catch( const Exception& )
+ {
+ implHandleAnyException( ::cppu::getCaughtException() );
+ }
+ aRetAny <<= xRet;
+ }
+ unoToSbxValue( pVar, aRetAny );
+
+ // Copy back out parameters?
+ if( bOutParams )
+ {
+ const Any* pAnyArgs = args.getConstArray();
+
+ for( UINT32 j = 0 ; j < nUnoParamCount ; j++ )
+ {
+ Reference< XParameter > xParam = pParameterSeq[j];
+ if( !xParam.is() )
+ continue;
+
+ if( xParam->isOut() )
+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pAnyArgs[ j ] );
+ }
+ }
+ }
+ }
+ else
+ SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ }
+}
+
+
+
+static SbUnoServiceCtor* pFirstCtor = NULL;
+
+void clearUnoServiceCtors( void )
+{
+ SbUnoServiceCtor* pCtor = pFirstCtor;
+ while( pCtor )
+ {
+ pCtor->SbxValue::Clear();
+ pCtor = pCtor->pNext;
+ }
+}
+
+SbUnoServiceCtor::SbUnoServiceCtor( const String& aName_, Reference< XServiceConstructorDescription > xServiceCtorDesc )
+ : SbxMethod( aName_, SbxOBJECT )
+ , m_xServiceCtorDesc( xServiceCtorDesc )
+{
+}
+
+SbUnoServiceCtor::~SbUnoServiceCtor()
+{
+}
+
+SbxInfo* SbUnoServiceCtor::GetInfo()
+{
+ SbxInfo* pRet = NULL;
+
+ return pRet;
+}
+
+
+
//========================================================================
//========================================================================
//========================================================================
@@ -3703,7 +3947,6 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite
//========================================================================
// Creates a Basic wrapper object for a strongly typed Uno value
// 1. parameter: Uno type as full qualified type name, e.g. "byte[]"
-// void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
(void)pBasic;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 0d16ded..21b3102 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -531,6 +531,7 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
{
// #67781 Rueckgabewerte der Uno-Methoden loeschen
clearUnoMethods();
+ clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic );
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index f22ef6c..b40ae4d 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -701,12 +701,6 @@ SbiExprNode* SbiExpression::Comp()
pNd = new SbiExprNode( pParser, pNd, eTok, Cat() );
nCount++;
}
- // Mehrere Operatoren hintereinander gehen nicht
- if( nCount > 1 )
- {
- pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
- }
}
return pNd;
}
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index ee487ba..07033cd 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -479,7 +479,17 @@ PrevLineCommentLbl:
eoln:
if( nCol && *--pLine == '_' )
{
- pLine = NULL; return NextSym();
+ pLine = NULL;
+ bool bRes = NextSym();
+ if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
+ {
+ // object _
+ // .Method
+ // ^^^ <- spaces is legal in MSO VBA
+ OSL_TRACE("*** resetting bSpaces***");
+ bSpaces = FALSE;
+ }
+ return bRes;
}
else
{
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 2564f83..409f0d7 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -220,10 +220,11 @@ public:
SbiInstance( StarBASIC* );
~SbiInstance();
- void Error( SbError ); // trappable Error
+ void Error( SbError ); // trappable Error
void Error( SbError, const String& rMsg ); // trappable Error mit Message
- void FatalError( SbError ); // non-trappable Error
- void Abort(); // Abbruch mit aktuellem Fehlercode
+ void FatalError( SbError ); // non-trappable Error
+ void FatalError( SbError, const String& ); // non-trappable Error
+ void Abort(); // Abbruch mit aktuellem Fehlercode
void Stop();
SbError GetErr() { return nErr; }
@@ -270,30 +271,6 @@ struct RefSaveItem
};
-// #72732 Spezielle SbxVariable, die beim put/get prueft,
-// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst
-// liegt eventuell ein Schreibfehler im Basic-Source vor.
-class UnoClassMemberVariable : public SbxVariable
-{
- SbiRuntime* mpRuntime;
- BOOL bInternalUse;
-
-public:
- UnoClassMemberVariable( SbiRuntime* pRuntime_, const SbxObjectRef& xWrapper )
- : SbxVariable( SbxVARIANT ), mpRuntime( pRuntime_ )
- {
- bInternalUse = TRUE;
- PutObject( xWrapper );
- bInternalUse = FALSE;
- }
-
- virtual BOOL Get( SbxValues& ) const;
- virtual BOOL Put( const SbxValues& );
-
- TYPEINFO();
-};
-
-
// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm
// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt
// nur lokale Daten.
@@ -467,8 +444,10 @@ public:
SbiRuntime( SbModule*, SbMethod*, UINT32 );
~SbiRuntime();
- void Error( SbError ); // Fehler setzen, falls != 0
- void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
+ void Error( SbError ); // Fehler setzen, falls != 0
+ void Error( SbError, const String& ); // Fehler setzen, falls != 0
+ void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
+ void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
void DumpPCode();
BOOL Step(); // Einzelschritt (ein Opcode)
void Stop() { bRun = FALSE; }
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index dc2cfef..5780113 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <rtl/ustring.hxx>
class SbUnoObject: public SbxObject
@@ -149,7 +150,7 @@ public:
};
// Wrapper fuer eine Uno-Klasse
-class SbUnoClass: public SbxObject
+class SbUnoClass : public SbxObject
{
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > m_xClass;
@@ -177,9 +178,57 @@ SV_DECL_IMPL_REF(SbUnoClass);
// Funktion, um einen globalen Bezeichner im
// UnoScope zu suchen und fuer Sbx zu wrappen
-SbxVariable* findUnoClass( const String& rName );
+SbUnoClass* findUnoClass( const String& rName );
+// Wrapper for UNO Service
+class SbUnoService : public SbxObject
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
+ bool m_bNeedsInit;
+
+public:
+ TYPEINFO();
+ SbUnoService( const String& aName_,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 >& xServiceTypeDesc )
+ : SbxObject( aName_ )
+ , m_xServiceTypeDesc( xServiceTypeDesc )
+ , m_bNeedsInit( true )
+ {}
+
+ virtual SbxVariable* Find( const String&, SbxClassType );
+
+ void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoService);
+
+SbUnoService* findUnoService( const String& rName );
+
+
+void clearUnoServiceCtors( void );
+
+class SbUnoServiceCtor : public SbxMethod
+{
+ friend class SbUnoService;
+ friend void clearUnoServiceCtors( void );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > m_xServiceCtorDesc;
+
+ SbUnoServiceCtor* pPrev;
+ SbUnoServiceCtor* pNext;
+
+public:
+ TYPEINFO();
+
+ SbUnoServiceCtor( const String& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc );
+ virtual ~SbUnoServiceCtor();
+ virtual SbxInfo* GetInfo();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > getServiceCtorDesc( void )
+ { return m_xServiceCtorDesc; }
+};
+
+
// #105565 Special Object to wrap a strongly typed Uno Any
class SbUnoAnyObject: public SbxObject
{
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index aee7bc2..87f88ea 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -430,6 +430,11 @@ void SbiInstance::FatalError( SbError n )
pRun->FatalError( n );
}
+void SbiInstance::FatalError( SbError _errCode, const String& _details )
+{
+ pRun->FatalError( _errCode, _details );
+}
+
void SbiInstance::Abort()
{
// Basic suchen, in dem der Fehler auftrat
@@ -721,7 +726,7 @@ BOOL SbiRuntime::Step()
pCode = pError;
else
bLetParentHandleThis = true;
- }
+ }
else
{
bLetParentHandleThis = true;
@@ -795,12 +800,35 @@ void SbiRuntime::Error( SbError n )
nError = n;
}
+void SbiRuntime::Error( SbError _errCode, const String& _details )
+{
+ if ( _errCode )
+ {
+ OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
+ if ( pInst->pRun == this )
+ {
+ pInst->Error( _errCode, _details );
+ OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
+ }
+ else
+ {
+ nError = _errCode;
+ }
+ }
+}
+
void SbiRuntime::FatalError( SbError n )
{
StepSTDERROR();
Error( n );
}
+void SbiRuntime::FatalError( SbError _errCode, const String& _details )
+{
+ StepSTDERROR();
+ Error( _errCode, _details );
+}
+
//////////////////////////////////////////////////////////////////////////
//
// Parameter, Locals, Caller
@@ -859,21 +887,13 @@ SbxVariableRef SbiRuntime::PopVar()
BOOL SbiRuntime::ClearExprStack()
{
- // #74732 Hier kann ein Fehler gesetzt werden
- BOOL bErrorSet = FALSE;
-
// Achtung: Clear() reicht nicht, da Methods geloescht werden muessen
while ( nExprLvl )
{
- SbxVariableRef xVar = PopVar();
- if( !nError && xVar->ISA( UnoClassMemberVariable ) )
- {
- Error( SbERR_NO_METHOD );
- bErrorSet = TRUE;
- }
+ PopVar();
}
refExprStk->Clear();
- return bErrorSet;
+ return FALSE;
}
// Variable auf dem Expression-Stack holen, ohne sie zu entfernen
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 097712a..2589207 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -199,7 +199,7 @@ SbxVariable* SbiRuntime::FindElement
}
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
// Modulen IMMER ein Ergebnis!
- SbxVariable* pUnoClass = findUnoClass( aName );
+ SbUnoClass* pUnoClass = findUnoClass( aName );
if( pUnoClass )
{
pElem = new SbxVariable( t );
@@ -255,7 +255,7 @@ SbxVariable* SbiRuntime::FindElement
ClearArgvStack();
// Normalen Error setzen
- Error( nNotFound );
+ Error( nNotFound, aName );
}
else
{
@@ -832,6 +832,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt,
// hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist!
BOOL bFatalExpr = FALSE;
+ String sUnknownMethodName;
if( nExprLvl > 1 )
bFatalExpr = TRUE;
else if( nExprLvl )
@@ -839,7 +840,10 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
SbxVariable* p = refExprStk->Get( 0 );
if( p->GetRefCount() > 1
&& refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) )
+ {
+ sUnknownMethodName = p->GetName();
bFatalExpr = TRUE;
+ }
}
// Der Expr-Stack ist nun nicht mehr notwendig
ClearExprStack();
@@ -854,7 +858,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// stimmen!
if( bFatalExpr)
{
- StarBASIC::FatalError( SbERR_NO_METHOD );
+ StarBASIC::FatalError( SbERR_NO_METHOD, sUnknownMethodName );
return;
}
pStmnt = pCode - 9;
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 5c2105d..e746f3d 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1572,7 +1572,10 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
else
{
aL.eType = aR.eType = SbxDOUBLE;
- if( Get( aL ) && rOp.Get( aR ) )
+ //if( Get( aL ) && rOp.Get( aR ) )
+ bool bGetL = Get( aL );
+ bool bGetR = rOp.Get( aR );
+ if( bGetL && bGetR )
switch( eOp )
{
case SbxEQ:
@@ -1590,6 +1593,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
default:
SetError( SbxERR_NOTIMP );
}
+ // at least one value was got
+ // if this is VBA then a conversion error for one
+ // side will yield a false result of an equality test
+ else if ( bGetR || bGetL )
+ {
+ if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
+ {
+ ResetError();
+ bRes = FALSE;
+ }
+ }
}
}
if( eOld != SbxERR_OK )
diff --git a/desktop/source/deployment/registry/help/dp_help.src b/desktop/source/deployment/registry/help/dp_help.src
index a3d154c..4d1ccfa 100644
--- a/desktop/source/deployment/registry/help/dp_help.src
+++ b/desktop/source/deployment/registry/help/dp_help.src
@@ -42,6 +42,6 @@ String RID_STR_HELPPROCESSING_GENERAL_ERROR
String RID_STR_HELPPROCESSING_XMLPARSING_ERROR
{
- Text [ en-US ] = "The extension will not be installed because an error occured in the Help files:\n";
+ Text [ en-US ] = "The extension will not be installed because an error occurred in the Help files:\n";
};
commit 2a8a76d4ac72a31df30bf4200ce68d2df07c80c6
Author: Release Engineers <releng at openoffice.org>
Date: Thu Aug 6 09:32:55 2009 +0000
CWS-TOOLING: integrate CWS extmgr01
2009-07-28 15:37:52 +0200 dv r274410 : #i103856# Create dialog before using it
2009-07-27 15:24:42 +0200 dv r274368 : #i103831# Made selectEntry virtual so the correct function will be used from the listbox with buttons
2009-07-27 14:17:08 +0200 dv r274366 : #i103831# Made selectEntry virtual so the correct function will be used from the listbox with buttons
2009-07-07 08:23:17 +0200 dv r273765 : #i102666# Extension check on startup after office update -> fixed repaint problem
2009-07-06 11:28:28 +0200 dv r273729 : #i102666# Extension check on startup after office update -> fixed Mac OS X issues
2009-07-02 15:01:35 +0200 dv r273654 : #i102666# Extension check on startup after office update -> set last checked to never when aborting
2009-07-01 12:18:52 +0200 dv r273564 : Removed unused variable
2009-07-01 07:25:01 +0200 dv r273542 : #i102666# Extension check on startup after office update -> better layout
2009-06-30 14:56:16 +0200 dv r273506 : #i102666# Extension check on startup after office update -> mark incompatible extensions in extension manager
2009-06-30 12:43:55 +0200 dv r273502 : CWS-TOOLING: rebase CWS extmgr01 to trunk at 273468 (milestone: DEV300:m51)
2009-06-29 13:26:54 +0200 dv r273469 : Now with newline at the end
2009-06-29 11:54:07 +0200 dv r273462 : #i102666# Extension check on startup after office update -> exit button of dialog disables extensions, too
2009-06-26 16:26:02 +0200 dv r273428 : #i102666# Extension check on startup after office update -> better progress handling
2009-06-26 14:50:34 +0200 dv r273417 : fixed crash when shutting down while initial waiting
2009-06-26 14:46:40 +0200 dv r273416 : #i102666# Extension check on startup after office update
2009-06-24 07:30:57 +0200 dv r273306 : #i102666# Extension check on startup after update
2009-06-11 12:03:10 +0200 dv r272863 : #i102666# Extension check on startup after update
2009-06-11 11:59:29 +0200 dv r272862 : #i102666# Extension check on startup after update
2009-06-09 15:50:05 +0200 dv r272773 : CWS-TOOLING: rebase CWS extmgr01 to trunk at 272291 (milestone: DEV300:m49)
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 72d34d0..432006a 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -134,6 +134,7 @@ class Desktop : public Application
static rtl::OUString GetLicensePath();
static sal_Bool LicenseNeedsAcceptance();
static sal_Bool IsFirstStartWizardNeeded();
+ static sal_Bool CheckExtensionDependencies();
private:
// Bootstrap methods
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index e9fad3f..f893ed0 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1387,6 +1387,10 @@ void Desktop::Main()
tools::InitTestToolLib();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" );
+ bool bAbort = CheckExtensionDependencies();
+ if ( bAbort )
+ return;
+
// First Start Wizard allowed ?
if ( ! pCmdLineArgs->IsNoFirstStartWizard())
{
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
new file mode 100644
index 0000000..f61f577
--- /dev/null
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_desktop.hxx"
+
+#include <rtl/bootstrap.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/configmgr.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+
+#include "app.hxx"
+
+using rtl::OUString;
+using namespace desktop;
+using namespace com::sun::star;
+
+#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
+static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
+
+//------------------------------------------------------------------------------
+static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > &xContext )
+{
+ rtl::OUString sServiceName = UNISTRING("com.sun.star.deployment.ui.UpdateRequiredDialog");
+ uno::Reference< uno::XInterface > xService;
+ sal_Int16 nRet = 0;
+
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( xContext->getServiceManager() );
+ if( !xServiceManager.is() )
+ throw uno::RuntimeException(
+ UNISTRING( "impl_showExtensionDialog(): unable to obtain service manager from component context" ), uno::Reference< uno::XInterface > () );
+
+ xService = xServiceManager->createInstanceWithContext( sServiceName, xContext );
+ uno::Reference< ui::dialogs::XExecutableDialog > xExecuteable( xService, uno::UNO_QUERY );
+ if ( xExecuteable.is() )
+ nRet = xExecuteable->execute();
+
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+// Check dependencies of all packages
+//------------------------------------------------------------------------------
+static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ uno::Sequence< uno::Reference< deployment::XPackage > > packages;
+
+ try {
+ packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ }
+ catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ }
+ catch ( ucb::CommandAbortedException & ) {}
+ catch ( lang::IllegalArgumentException & e ) {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+
+ for ( sal_Int32 i = 0; i < packages.getLength(); ++i )
+ {
+ bool bRegistered = false;
+ try {
+ beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() ) );
+ if ( option.IsPresent )
+ {
+ ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
+ if ( reg.IsAmbiguous )
+ bRegistered = false;
+ else
+ bRegistered = reg.Value ? true : false;
+ }
+ else
+ bRegistered = false;
+ }
+ catch ( uno::RuntimeException & ) { throw; }
+ catch ( uno::Exception & exc) {
+ (void) exc;
+ OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ bRegistered = false;
+ }
+
+ if ( bRegistered )
+ {
+ bool bDependenciesValid = false;
+ try {
+ bDependenciesValid = packages[i]->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) {}
+ if ( ! bDependenciesValid )
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+//------------------------------------------------------------------------------
+// resets the 'check needed' flag (needed, if aborted)
+//------------------------------------------------------------------------------
+static void impl_setNeedsCompatCheck()
+{
+ try {
+ Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ // get configuration provider
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
+ xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+
+ Sequence< Any > theArgs(1);
+ beans::NamedValue v( OUString::createFromAscii("NodePath"),
+ makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) );
+ theArgs[0] <<= v;
+ Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >(
+ theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+
+ Any value = makeAny( OUString::createFromAscii("never") );
+
+ pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), value );
+ Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
+ }
+ catch (const Exception&) {}
+}
+
+//------------------------------------------------------------------------------
+static bool impl_check()
+{
+ uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
+ uno::Reference< deployment::XPackageManager > xManager;
+ bool bDependenciesValid = true;
+
+ try {
+ xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") );
+ }
+ catch ( ucb::CommandFailedException & ){}
+ catch ( uno::RuntimeException & ) {}
+
+ if ( xManager.is() )
+ bDependenciesValid = impl_checkDependencies( xManager );
+
+ if ( bDependenciesValid )
+ {
+ try {
+ xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") );
+ }
+ catch ( ucb::CommandFailedException & ){}
+ catch ( uno::RuntimeException & ) {}
+
+ if ( xManager.is() )
+ bDependenciesValid = impl_checkDependencies( xManager );
+ }
+
+ short nRet = 0;
+ if ( !bDependenciesValid )
+ nRet = impl_showExtensionDialog( xContext );
+
+ if ( nRet == -1 )
+ {
+ impl_setNeedsCompatCheck();
+ return true;
+ }
+ else
+ return false;
+}
+
+//------------------------------------------------------------------------------
+// to check, if we need checking the dependencies of the extensions again, we compare
+// the build id of the office with the one of the last check
+//------------------------------------------------------------------------------
+static bool impl_needsCompatCheck()
+{
+ bool bNeedsCheck = false;
+ rtl::OUString aLastCheckBuildID;
+ rtl::OUString aCurrentBuildID( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
+ rtl::Bootstrap::expandMacros( aCurrentBuildID );
+
+ try {
+ Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ // get configuration provider
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
+ xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+
+ Sequence< Any > theArgs(1);
+ beans::NamedValue v( OUString::createFromAscii("NodePath"),
+ makeAny( OUString::createFromAscii("org.openoffice.Setup/Office") ) );
+ theArgs[0] <<= v;
+ Reference< beans::XPropertySet > pset = Reference< beans::XPropertySet >(
+ theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+
+ Any result = pset->getPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID") );
+
+ result >>= aLastCheckBuildID;
+ if ( aLastCheckBuildID != aCurrentBuildID )
+ {
+ bNeedsCheck = true;
+ result <<= aCurrentBuildID;
+ pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result );
+ Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
+ }
+ }
+ catch (const Exception&) {}
+
+ return bNeedsCheck;
+}
+
+//------------------------------------------------------------------------------
+// Do we need to check the dependencies of the extensions?
+// When there are unresolved issues, we can't continue with startup
+sal_Bool Desktop::CheckExtensionDependencies()
+{
+ sal_Bool bAbort = false;
+
+ if ( impl_needsCompatCheck() )
+ bAbort = impl_check();
+
+ return bAbort;
+}
+
diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk
index 18c2170..36993bf 100644
--- a/desktop/source/app/makefile.mk
+++ b/desktop/source/app/makefile.mk
@@ -56,6 +56,7 @@ SHL1OBJS = \
$(SLO)$/appsys.obj \
$(SLO)$/cfgfilter.obj \
$(SLO)$/checkinstall.obj \
+ $(SLO)$/check_ext_deps.obj \
$(SLO)$/cmdlineargs.obj \
$(SLO)$/cmdlinehelp.obj \
$(SLO)$/configinit.obj \
diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h
index 1a41fdf..cf4bcb9 100644
--- a/desktop/source/deployment/gui/dp_gui.h
+++ b/desktop/source/deployment/gui/dp_gui.h
@@ -82,6 +82,7 @@ enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE };
class SelectedPackage: public salhelper::SimpleReferenceObject {
public:
+ SelectedPackage() {}
SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> &xPackageManager )
: m_xPackage( xPackage ),
diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc
index fae3b16..9a3e294 100644
--- a/desktop/source/deployment/gui/dp_gui.hrc
+++ b/desktop/source/deployment/gui/dp_gui.hrc
@@ -32,7 +32,8 @@
#include "helpid.hrc"
// Package Manager Dialog:
-#define RID_DLG_PACKAGE_MANAGER RID_DEPLOYMENT_GUI_START
+#define RID_DLG_EXTENSION_MANAGER RID_DEPLOYMENT_GUI_START
+#define RID_DLG_UPDATE_REQUIRED (RID_DEPLOYMENT_GUI_START + 11)
#define RID_EM_BTN_CLOSE 10
#define RID_EM_BTN_HELP 11
@@ -42,27 +43,9 @@
#define RID_EM_BTN_CANCEL 15
#define RID_EM_FT_GET_EXTENSIONS 20
#define RID_EM_FT_PROGRESS 21
+#define RID_EM_FT_MSG 22
// local RIDs:
-#define RID_FT_PACKAGES 5
-
-#define RID_BTN_CLOSE 10
-#define RID_BTN_HELP 11
-
-#define RID_BTN_ADD 20
-#define RID_BTN_REMOVE 21
-#define RID_BTN_ENABLE 22
-#define RID_BTN_DISABLE 23
-#define RID_BTN_EXPORT 24
-#define RID_BTN_CHECK_UPDATES 25
-#define RID_BTN_OPTIONS 26
-#define RID_BTN_GET_EXTENSIONS 27
-
-#define RID_IMG_PLUS 41
-#define RID_IMG_PLUS_HC 42
-#define RID_IMG_MINUS 43
-#define RID_IMG_MINUS_HC 44
-
#define PB_LICENSE_DOWN 50
#define ML_LICENSE 51
#define BTN_LICENSE_DECLINE 53
@@ -145,18 +128,10 @@
#define RID_DLG_UPDATE_NOUPDATE 30
#define RID_DLG_UPDATE_VERSION 31
-#define RID_DLG_EXTENSION_MANAGER (RID_DEPLOYMENT_GUI_START + 6)
-
#define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20)
#define RID_INFOBOX_UPDATE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START + 21)
-#define RID_IMG_DEF_INSTALLATION (RID_DEPLOYMENT_GUI_START+50)
-#define RID_IMG_DEF_INSTALLATION_HC (RID_DEPLOYMENT_GUI_START+51)
-#define RID_IMG_DEF_DOCUMENT (RID_DEPLOYMENT_GUI_START+52)
-#define RID_IMG_DEF_DOCUMENT_HC (RID_DEPLOYMENT_GUI_START+53)
-#define RID_IMG_DEF_PACKAGE (RID_DEPLOYMENT_GUI_START+54)
-#define RID_IMG_DEF_PACKAGE_HC (RID_DEPLOYMENT_GUI_START+55)
#define RID_IMG_WARNING (RID_DEPLOYMENT_GUI_START+56)
#define RID_IMG_WARNING_HC (RID_DEPLOYMENT_GUI_START+57)
#define RID_IMG_LOCKED (RID_DEPLOYMENT_GUI_START+58)
@@ -164,39 +139,26 @@
#define RID_IMG_EXTENSION (RID_DEPLOYMENT_GUI_START+60)
#define RID_IMG_EXTENSION_HC (RID_DEPLOYMENT_GUI_START+61)
-
-#define RID_STR_USER_INSTALLATION (RID_DEPLOYMENT_GUI_START+60)
-#define RID_STR_SHARED_INSTALLATION (RID_DEPLOYMENT_GUI_START+61)
-#define RID_STR_ENABLED (RID_DEPLOYMENT_GUI_START+62)
-#define RID_STR_DISABLED (RID_DEPLOYMENT_GUI_START+63)
-#define RID_STR_UNKNOWN (RID_DEPLOYMENT_GUI_START+64)
-#define RID_STR_PACKAGE (RID_DEPLOYMENT_GUI_START+65)
-#define RID_STR_PACKAGE_STATUS (RID_DEPLOYMENT_GUI_START+66)
-#define RID_STR_EXTENSION_VERSION (RID_DEPLOYMENT_GUI_START+67)
-
-
#define RID_STR_ADD_PACKAGES (RID_DEPLOYMENT_GUI_START+70)
-#define RID_STR_EXPORT_PACKAGE (RID_DEPLOYMENT_GUI_START+71)
-#define RID_STR_EXPORT_PACKAGES (RID_DEPLOYMENT_GUI_START+72)
-
-#define RID_CTX_ITEM_ADD (RID_DEPLOYMENT_GUI_START+80)
-#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+81)
-#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+82)
-#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+83)
-#define RID_CTX_ITEM_EXPORT (RID_DEPLOYMENT_GUI_START+84)
-#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+85)
-#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+86)
-
-#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+90)
-#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+91)
-#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+92)
-#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+93)
-#define RID_STR_EXPORTING_PACKAGES (RID_DEPLOYMENT_GUI_START+94)
-
-#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+95)
-#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+96)
-#define RID_STR_PUBLISHER_LINK (RID_DEPLOYMENT_GUI_START+97)
-#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+98)
+
+#define RID_CTX_ITEM_REMOVE (RID_DEPLOYMENT_GUI_START+80)
+#define RID_CTX_ITEM_ENABLE (RID_DEPLOYMENT_GUI_START+81)
+#define RID_CTX_ITEM_DISABLE (RID_DEPLOYMENT_GUI_START+82)
+#define RID_CTX_ITEM_CHECK_UPDATE (RID_DEPLOYMENT_GUI_START+83)
+#define RID_CTX_ITEM_OPTIONS (RID_DEPLOYMENT_GUI_START+84)
+
+#define RID_STR_ADDING_PACKAGES (RID_DEPLOYMENT_GUI_START+85)
+#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86)
+#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+87)
+#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+88)
+
+#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+90)
+#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+91)
+#define RID_STR_ERROR_UNKNOWN_STATUS (RID_DEPLOYMENT_GUI_START+92)
+#define RID_STR_CLOSE_BTN (RID_DEPLOYMENT_GUI_START+93)
+#define RID_STR_EXIT_BTN (RID_DEPLOYMENT_GUI_START+94)
+#define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95)
+#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96)
#define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100)
diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src
index 07bca99..b46d97e 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog.src
@@ -30,192 +30,10 @@
#include "svtools/controldims.hrc"
#include "dp_gui.hrc"
-ModelessDialog RID_DLG_PACKAGE_MANAGER
-{
- HelpId = HID_PACKAGE_MANAGER;
- Text [ en-US ] = "Extension Manager";
-
- Size = MAP_APPFONT( 300, 200 );
- OutputSize = TRUE;
- SVLook = TRUE;
- Moveable = TRUE;
- Closeable = TRUE;
- Sizeable = TRUE;
- Hide = TRUE;
-
- FixedText RID_FT_PACKAGES
- {
- Group = TRUE;
- Left = TRUE;
- NoLabel = TRUE;
- Text [ en-US ] = "Browse extensions";
- };
-
- PushButton RID_BTN_ADD
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Add...";
- };
- PushButton RID_BTN_REMOVE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Remove";
- };
- PushButton RID_BTN_ENABLE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Enable";
- };
- PushButton RID_BTN_DISABLE
- {
- TabStop = TRUE;
- Text [ en-US ] = "~Disable";
- };
- PushButton RID_BTN_EXPORT
- {
- TabStop = TRUE;
- Text [ en-US ] = "E~xport...";
- };
- PushButton RID_BTN_CHECK_UPDATES
- {
- Disable = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "~Updates...";
- };
- PushButton RID_BTN_OPTIONS
- {
- Disable = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "~Options...";
- };
-
-
-
- FixedText RID_BTN_GET_EXTENSIONS
- {
- NoLabel = TRUE;
- TabStop = TRUE;
- Text [ en-US ] = "Get more extensions here...";
- };
-
- OKButton RID_BTN_CLOSE
- {
- TabStop = TRUE;
- DefButton = TRUE;
- Text [ en-US ] = "Close";
- };
- HelpButton RID_BTN_HELP
- {
- TabStop = TRUE;
- };
-
- Image RID_IMG_PLUS
- {
- ImageBitmap = Bitmap { File = "plus.bmp"; };
- MASKCOLOR
- };
-
- Image RID_IMG_PLUS_HC
- {
- ImageBitmap = Bitmap { File = "plus_sch.bmp"; };
- MASKCOLOR
- };
- Image RID_IMG_MINUS
- {
- ImageBitmap = Bitmap { File = "minus.bmp"; };
- MASKCOLOR
- };
- Image RID_IMG_MINUS_HC
- {
- ImageBitmap = Bitmap { File = "minus_sch.bmp"; };
- MASKCOLOR
- };
-};
-
-
-Image RID_IMG_DEF_INSTALLATION
-{
- ImageBitmap = Bitmap { File = "harddisk_16.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_INSTALLATION_HC
-{
- ImageBitmap = Bitmap { File = "harddisk_16_h.bmp"; };
- MASKCOLOR
-};
-
-Image RID_IMG_DEF_DOCUMENT
-{
- ImageBitmap = Bitmap { File = "sc05500.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_DOCUMENT_HC
-{
- ImageBitmap = Bitmap { File = "sch05500.bmp"; };
- MASKCOLOR
-};
-
-Image RID_IMG_DEF_PACKAGE
-{
- ImageBitmap = Bitmap { File = "puzzleslice_16.bmp"; };
- MASKCOLOR
-};
-Image RID_IMG_DEF_PACKAGE_HC
-{
- ImageBitmap = Bitmap { File = "puzzleslice_16_h.bmp"; };
- MASKCOLOR
-};
-
-
-String RID_STR_USER_INSTALLATION
-{
- Text [ en-US ] = "My Extensions";
-};
-
-String RID_STR_SHARED_INSTALLATION
-{
- Text [ en-US ] = "%PRODUCTNAME Extensions";
-};
-
-String RID_STR_PACKAGE
-{
- Text [ en-US ] = "Extension";
-};
-
-String RID_STR_PACKAGE_STATUS
-{
- Text [ en-US ] = "Status";
-};
-
-String RID_STR_EXTENSION_VERSION
-{
- Text [ en-US ] = "Version";
-};
-
String RID_STR_ADD_PACKAGES
{
Text [ en-US ] = "Add Extension(s)";
};
-
-String RID_STR_ENABLED
-{
- Text [ en-US ] = "Enabled";
-};
-
-String RID_STR_DISABLED
-{
- Text [ en-US ] = "Disabled";
-};
-
-String RID_STR_UNKNOWN
-{
- Text [ en-US ] = "Unknown";
-};
-
-String RID_CTX_ITEM_ADD
-{
- Text [ en-US ] = "~Add...";
-};
String RID_CTX_ITEM_REMOVE
{
Text [ en-US ] = "~Remove";
@@ -228,30 +46,15 @@ String RID_CTX_ITEM_DISABLE
{
Text [ en-US ] = "~Disable";
};
-String RID_CTX_ITEM_EXPORT
-{
- Text [ en-US ] = "E~xport...";
-};
String RID_CTX_ITEM_CHECK_UPDATE
{
Text [ en-US ] = "~Update...";
};
-
String RID_CTX_ITEM_OPTIONS
{
Text [ en-US ] = "~Options...";
};
-String RID_STR_EXPORT_PACKAGE
-{
- Text [ en-US ] = "Export Extension";
-};
-
-String RID_STR_EXPORT_PACKAGES
-{
- Text [ en-US ] = "Export Extensions to...";
-};
-
String RID_STR_ADDING_PACKAGES
{
Text [ en-US ] = "Adding %EXTENSION_NAME";
@@ -272,11 +75,6 @@ String RID_STR_DISABLING_PACKAGES
Text [ en-US ] = "Disabling %EXTENSION_NAME";
};
-String RID_STR_EXPORTING_PACKAGES
-{
- Text [ en-US ] = "Exporting Extension(s)";
-};
-
String RID_STR_INSTALL_FOR_ALL
{
Text [ en-US ] = "~For all users";
@@ -287,14 +85,31 @@ String RID_STR_INSTALL_FOR_ME
Text [ en-US ] = "~Only for me";
};
-String RID_STR_PUBLISHER_LINK
+String RID_STR_ERROR_UNKNOWN_STATUS
{
- Text [ en-US ] = "Publisher";
+ Text [ en-US ] = "Error: The status of this extension is unknown";
};
-String RID_STR_ERROR_UNKNOWN_STATUS
+String RID_STR_CLOSE_BTN
{
- Text [ en-US ] = "Error: The status of this extension is unknown";
+ Text [ en-US ] = "Close";
+};
+
+String RID_STR_EXIT_BTN
+{
+ Text [ en-US ] = "Quit";
+};
+
+String RID_STR_NO_ADMIN_PRIVILEGE
+{
+ Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. "
+ "Some shared %PRODUCTNAME extensions are not compatible with this version and need to be updated before %PRODUCTNAME can be started.\n\n"
+ "Updating of shared extension requires administrator privileges. Contact your system administrator to update the following shared extensions:";
+};
+
+String RID_STR_ERROR_MISSING_DEPENDENCIES
+{
+ Text [ en-US ] = "The extension cannot be enabled as the following system dependencies are not fulfilled:";
};
// Dialog layout
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 7aec6dd..4430b5b 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -36,7 +36,9 @@
#include "svtools/controldims.hrc"
#include "svtools/svtools.hrc"
+#include "dp_gui.h"
#include "dp_gui_dialog2.hxx"
+#include "dp_gui_extlistbox.hxx"
#include "dp_gui_shared.hxx"
#include "dp_gui_theextmgr.hxx"
#include "dp_misc.h"
@@ -55,7 +57,7 @@
#include "comphelper/anytostring.hxx"
#include "cppuhelper/exc_hlp.hxx"
-#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/bootstrap.hxx"
#include "comphelper/processfactory.hxx"
#include "ucbhelper/content.hxx"
@@ -76,6 +78,8 @@
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
@@ -91,11 +95,7 @@ using ::rtl::OUString;
namespace dp_gui {
#define ICON_OFFSET 50
-#define ICON_HEIGHT 42
-#define SMALL_ICON_SIZE 16
-#define RIGHT_ICON_OFFSET 5
#define TOP_OFFSET 3
-#define SPACE_BETWEEN 3
#define LINE_SIZE 4
#define PROGRESS_WIDTH 60
#define PROGRESS_HEIGHT 14
@@ -113,112 +113,18 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles >
};
//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-struct Entry_Impl;
-
-typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
-
-struct Entry_Impl
-{
- bool m_bActive;
- bool m_bLocked;
- bool m_bHasOptions;
- bool m_bShared;
- bool m_bNew;
- bool m_bChecked;
- PackageState m_eState;
- String m_sTitle;
- String m_sVersion;
- String m_sDescription;
- String m_sPublisher;
- String m_sPublisherURL;
- String m_sErrorText;
- Image m_aIcon;
- Image m_aIconHC;
- svt::FixedHyperlink *m_pPublisher;
-
- uno::Reference< deployment::XPackage> m_xPackage;
- uno::Reference< deployment::XPackageManager> m_xPackageManager;
-
- Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState );
- ~Entry_Impl();
-
- StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
-};
-
-//------------------------------------------------------------------------------
-Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState ) :
- m_bActive( false ),
- m_bLocked( false ),
- m_bHasOptions( false ),
- m_bShared( false ),
- m_bNew( false ),
- m_bChecked( false ),
- m_eState( eState ),
- m_pPublisher( NULL ),
+UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager ) :
m_xPackage( xPackage ),
m_xPackageManager( xPackageManager )
-{
- m_sTitle = xPackage->getDisplayName();
- m_sVersion = xPackage->getVersion();
- m_sDescription = xPackage->getDescription();
-
- beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
- m_sPublisher = aInfo.First;
- m_sPublisherURL = aInfo.Second;
-
- // get the icons for the package if there are any
- uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
- if ( xGraphic.is() )
- m_aIcon = Image( xGraphic );
-
- xGraphic = xPackage->getIcon( true );
- if ( xGraphic.is() )
- m_aIconHC = Image( xGraphic );
- else
- m_aIconHC = m_aIcon;
-
- m_bLocked = m_xPackageManager->isReadOnly();
-
- if ( eState == AMBIGUOUS )
- m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
-}
+{}
//------------------------------------------------------------------------------
-Entry_Impl::~Entry_Impl()
-{
- delete m_pPublisher;
-}
+UpdateListEntry::~UpdateListEntry()
+{}
//------------------------------------------------------------------------------
-StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
-{
- StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
- if ( eCompare == COMPARE_EQUAL )
- {
- eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
- if ( eCompare == COMPARE_EQUAL )
- {
- if ( m_xPackageManager != pEntry->m_xPackageManager )
- {
- sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
- if ( nCompare < 0 )
- eCompare = COMPARE_LESS;
- else if ( nCompare > 0 )
- eCompare = COMPARE_GREATER;
- }
- }
- }
- return eCompare;
-}
-
-//------------------------------------------------------------------------------
-// ExtensionBox_Impl
+// ExtBoxWithBtns_Impl
//------------------------------------------------------------------------------
enum MENU_COMMAND
@@ -230,63 +136,21 @@ enum MENU_COMMAND
CMD_UPDATE
};
-class ExtensionBox_Impl : public ::svt::IExtensionListBox,
- public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
{
- bool m_bHasScrollBar;
- bool m_bHasActive;
- bool m_bNeedsRecalc;
- bool m_bHasNew;
- bool m_bInCheckMode;
- bool m_bInterfaceLocked;
- //Must be guarded together with m_vEntries to ensure a valid index at all times.
- //Use m_entriesMutex as guard.
- long m_nActive;
- long m_nTopIndex;
- long m_nStdHeight;
- long m_nActiveHeight;
- long m_nBtnHeight;
Size m_aOutputSize;
- Image m_aLockedImage;
- Image m_aLockedImageHC;
- Image m_aWarningImage;
- Image m_aWarningImageHC;
- Image m_aDefaultImage;
- Image m_aDefaultImageHC;
+ bool m_bInterfaceLocked;
PushButton *m_pOptionsBtn;
PushButton *m_pEnableBtn;
PushButton *m_pRemoveBtn;
- ScrollBar *m_pScrollBar;
-
- ExtMgrDialog *m_pParent;
- TheExtensionManager *m_pManager;
- //This mutex is used for synchronizing access to m_vEntries.
- //Currently it is used to synchronize adding, removing entries and
- //functions like getItemName, getItemDescription, etc. to prevent
- //that m_vEntries is accessed at an invalid index.
- //ToDo: There are many more places where m_vEntries is read and which may
- //fail. For example the Paint method is probable called from the main thread
- //while new entries are added / removed in a separate thread.
- mutable ::osl::Mutex m_entriesMutex;
- std::vector< TEntry_Impl > m_vEntries;
-
- lang::Locale *m_pLocale;
- CollatorWrapper *m_pCollator;
-
- void CalcActiveHeight( const long nPos );
- long GetTotalHeight() const;
- Rectangle GetEntryRect( const long nPos ) const;
+
+ ExtMgrDialog *m_pParent;
+
void SetButtonPos( const Rectangle& rRect );
void SetButtonStatus( const TEntry_Impl pEntry );
- void SetupScrollBar();
- void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
bool HandleTabKey( bool bReverse );
- bool HandleCursorKey( USHORT nKeyCode );
MENU_COMMAND ShowPopupMenu( const Point &rPos, const long nPos );
- void RecalcAll();
- bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
- bool isHCMode();
//-----------------
DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
@@ -296,115 +160,29 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox,
DECL_DLLPRIVATE_LINK( HandleRemoveBtn, void * );
DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * );
- //Index starts with 1.
- //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
- void checkIndex(sal_Int32 pos) const;
-
-
public:
- ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager );
- ~ExtensionBox_Impl();
+ ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager );
+ ~ExtBoxWithBtns_Impl();
virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Paint( const Rectangle &rPaintRect );
- virtual void Resize();
virtual long Notify( NotifyEvent& rNEvt );
const Size GetMinOutputSizePixel() const;
+ virtual void RecalcAll();
+ virtual void selectEntry( const long nPos );
//-----------------
- long addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager );
- void selectEntry( const long nPos );
void enableButtons( bool bEnable );
-
- void updateEntry( const uno::Reference< deployment::XPackage > &xPackage );
-
- void prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr );
- void checkEntries();
-
- TheExtensionManager* getExtensionManager() const { return m_pManager; }
-
- //===================================================================================
- //These functions are used for automatic testing
-
- /** @return The count of the entries in the list box. */
- virtual sal_Int32 getItemCount() const;
-
- /** @return The index of the first selected entry in the list box.
- When nothing is selected, which is the case when getItemCount returns '0',
- then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
- virtual sal_Int32 getSelIndex() const;
-
- /** @return The item name of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemName( sal_Int32 index ) const;
-
- /** @return The version string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemVersion( sal_Int32 index ) const;
-
- /** @return The description string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual OUString getItemDescription( sal_Int32 index ) const;
-
- /** @return The publisher string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
-
- /** @return The link behind the publisher text of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
-
- /** The entry at the given position will be selected
- Index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual void select( sal_Int32 pos );
-
- /** The first found entry with the given name will be selected
- When there was no entry found with the name, the selection doesn't change.
- Please note that there might be more than one entry with the same
- name, because:
- 1. the name is not unique
- 2. one extension can be installed as user and shared extension.
- */
- virtual void select( const OUString & sName );
-
- //===================================================================================
- // XEventListener
- virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
- throw (::com::sun::star::uno::RuntimeException);
};
//------------------------------------------------------------------------------
-ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) :
- IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
- m_bHasScrollBar( false ),
- m_bHasActive( false ),
- m_bNeedsRecalc( true ),
- m_bHasNew( false ),
- m_bInCheckMode( false ),
+ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) :
+ ExtensionBox_Impl( pParent, pManager ),
m_bInterfaceLocked( false ),
- m_nActive( 0 ),
- m_nTopIndex( 0 ),
- m_nActiveHeight( 0 ),
- m_aLockedImage( ExtMgrDialog::getResId( RID_IMG_LOCKED ) ),
- m_aLockedImageHC( ExtMgrDialog::getResId( RID_IMG_LOCKED_HC ) ),
- m_aWarningImage( ExtMgrDialog::getResId( RID_IMG_WARNING ) ),
- m_aWarningImageHC( ExtMgrDialog::getResId( RID_IMG_WARNING_HC ) ),
- m_aDefaultImage( ExtMgrDialog::getResId( RID_IMG_EXTENSION ) ),
- m_aDefaultImageHC( ExtMgrDialog::getResId( RID_IMG_EXTENSION_HC ) ),
m_pOptionsBtn( NULL ),
m_pEnableBtn( NULL ),
m_pRemoveBtn( NULL ),
- m_pScrollBar( NULL ),
- m_pParent( pParent ),
- m_pManager( pManager )
+ m_pParent( pParent )
{
m_pOptionsBtn = new PushButton( this, WB_TABSTOP );
m_pEnableBtn = new PushButton( this, WB_TABSTOP );
@@ -415,17 +193,13 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
m_pRemoveBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_REMOVE );
- m_pOptionsBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleOptionsBtn ) );
- m_pEnableBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleEnableBtn ) );
- m_pRemoveBtn->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleRemoveBtn ) );
+ m_pOptionsBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleOptionsBtn ) );
+ m_pEnableBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleEnableBtn ) );
+ m_pRemoveBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleRemoveBtn ) );
- m_pScrollBar = new ScrollBar( this, WB_VERT );
- m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
- m_pScrollBar->EnableDrag();
-
- m_pOptionsBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_OPTIONS ) );
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
- m_pRemoveBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ m_pOptionsBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_OPTIONS ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ m_pRemoveBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
Size aSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ),
MapMode( MAP_APPFONT ) );
@@ -433,288 +207,69 @@ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager
m_pEnableBtn->SetSizePixel( aSize );
m_pRemoveBtn->SetSizePixel( aSize );
- SetPaintTransparent( true );
- SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- m_nStdHeight = nTitleHeight;
- else
- m_nStdHeight = nIconHeight;
- m_nStdHeight += GetTextHeight() + TOP_OFFSET;
+ SetExtraSize( aSize.Height() + 2 * TOP_OFFSET );
- nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
- if ( m_nStdHeight < nIconHeight )
- m_nStdHeight = nIconHeight;
-
- m_nActiveHeight = m_nStdHeight;
- m_nBtnHeight = aSize.Height() + 2 * TOP_OFFSET;
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
- m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
-
- Show();
+ SetScrollHdl( LINK( this, ExtBoxWithBtns_Impl, ScrollHdl ) );
}
//------------------------------------------------------------------------------
-ExtensionBox_Impl::~ExtensionBox_Impl()
+ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl()
{
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
-// for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
-// (*iIndex)->m_xPackage->removeEventListener( this );
-
- m_vEntries.clear();
-
delete m_pOptionsBtn;
delete m_pEnableBtn;
delete m_pRemoveBtn;
- delete m_pScrollBar;
-
- delete m_pLocale;
- delete m_pCollator;
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getItemCount() const
-{
- return static_cast< sal_Int32 >( m_vEntries.size() );
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getSelIndex() const
-{
- if ( m_bHasActive )
- {
- OSL_ASSERT( m_nActive >= -1);
- return static_cast< sal_Int32 >( m_nActive );
- }
- else
- return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
-{
- if ( nIndex < 0 )
- throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
- if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
- throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
- "The position exceeds the number of available list entries"),0, 0 );
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sTitle;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sVersion;
-}
-
-//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sDescription;
}
//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisher;
-}
-
//------------------------------------------------------------------------------
-OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisherURL;
-}
-
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( sal_Int32 nIndex )
+const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const
{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- selectEntry( nIndex );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( const OUString & sName )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- typedef ::std::vector< TEntry_Impl >::const_iterator It;
-
- for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
- {
- if ( sName.equals( (*iIter)->m_sTitle ) )
- {
- long nPos = iIter - m_vEntries.begin();
- selectEntry( nPos );
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-// Title + description + buttons height
-void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
-{
- // get title height
- long aTextHeight;
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // calc description height
- Size aSize = GetOutputSizePixel();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- aSize.Width() -= ICON_OFFSET;
- aSize.Height() = 10000;
-
- Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ),
- m_vEntries[ nPos ]->m_sDescription,
- TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- aTextHeight += aRect.GetHeight();
-
- if ( aTextHeight < m_nStdHeight )
- aTextHeight = m_nStdHeight;
-
- m_nActiveHeight = aTextHeight + m_nBtnHeight; // button bar height
-}
-
-//------------------------------------------------------------------------------
-const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
-{
- long nHeight = m_nStdHeight;
+ Size aMinSize( ExtensionBox_Impl::GetMinOutputSizePixel() );
+ long nHeight = aMinSize.Height();
nHeight += m_pOptionsBtn->GetSizePixel().Height();
nHeight += 2 * TOP_OFFSET;
long nWidth = m_pOptionsBtn->GetSizePixel().Width();
nWidth *= 3;
- nWidth += 5*TOP_OFFSET;
- nWidth += m_pScrollBar->GetSizePixel().Width();
+ nWidth += 5*TOP_OFFSET + 20;
return Size( nWidth, nHeight );
}
-//------------------------------------------------------------------------------
-Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+// -----------------------------------------------------------------------
+void ExtBoxWithBtns_Impl::RecalcAll()
{
- Size aSize( GetOutputSizePixel() );
+ ExtensionBox_Impl::RecalcAll();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+ const sal_Int32 nActive = getSelIndex();
- if ( m_vEntries[ nPos ]->m_bActive )
- aSize.Height() = m_nActiveHeight;
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
+ SetButtonPos( GetEntryRect( nActive ) );
else
- aSize.Height() = m_nStdHeight;
-
- Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
- if ( m_bHasActive && ( nPos < m_nActive ) )
- aPos.Y() += m_nActiveHeight - m_nStdHeight;
-
- return Rectangle( aPos, aSize );
+ {
+ m_pOptionsBtn->Hide();
+ m_pEnableBtn->Hide();
+ m_pRemoveBtn->Hide();
+ }
}
+
//------------------------------------------------------------------------------
//This function may be called with nPos < 0
-void ExtensionBox_Impl::selectEntry( long nPos )
+void ExtBoxWithBtns_Impl::selectEntry( const long nPos )
{
- //ToDo whe should not use the guard at such a big scope here.
- //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
- //modified in this function.
- //It would be probably best to always use a copy of m_vEntries
- //and some other state variables from ExtensionBox_Impl for
- //the whole painting operation. See issue i86993
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
-
- if ( m_bInCheckMode )
+ if ( HasActive() && ( nPos == getSelIndex() ) )
return;
- if ( m_bHasActive )
- {
- if ( nPos == m_nActive )
- return;
+ ExtensionBox_Impl::selectEntry( nPos );
- m_bHasActive = false;
- m_vEntries[ m_nActive ]->m_bActive = false;
-
- if ( IsReallyVisible() )
- Invalidate();
- }
-
- if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ if ( ( nPos >= 0 ) && ( nPos < GetEntryCount() ) )
{
- m_bHasActive = true;
- m_nActive = nPos;
- m_vEntries[ nPos ]->m_bActive = true;
-
if ( IsReallyVisible() )
{
- Invalidate();
- CalcActiveHeight( nPos );
- SetupScrollBar();
- Rectangle aEntryRect = GetEntryRect( nPos );
-
- // If the top of the selected entry isn't visible, make it visible
- if ( aEntryRect.Top() < 0 )
- {
- m_nTopIndex += aEntryRect.Top();
- aEntryRect.Move( 0, -aEntryRect.Top() );
- }
-
- // If the bottom of the selected entry isn't visible, make it visible even if now the top
- // isn't visible any longer ( the buttons are more important )
- Size aOutputSize = GetOutputSizePixel();
- if ( aEntryRect.Bottom() > aOutputSize.Height() )
- {
- m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
- aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
- }
-
- // If there is unused space below the last entry but all entries don't fit into the box,
- // move the content down to use the whole space
- const long nTotalHeight = GetTotalHeight();
- if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
- {
- long nOffset = m_nTopIndex;
- m_nTopIndex = nTotalHeight - aOutputSize.Height();
- nOffset -= m_nTopIndex;
- aEntryRect.Move( 0, nOffset );
- }
-
- if ( m_bHasScrollBar )
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- SetButtonPos( aEntryRect );
+ SetButtonPos( GetEntryRect( nPos ) );
}
- SetButtonStatus( m_vEntries[ nPos ] ); //dv
+ SetButtonStatus( GetEntryData( nPos) );
}
else
{
@@ -722,12 +277,10 @@ void ExtensionBox_Impl::selectEntry( long nPos )
m_pEnableBtn->Hide();
m_pRemoveBtn->Hide();
}
- guard.clear();
-
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect )
+void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect )
{
Size aBtnSize( m_pOptionsBtn->GetSizePixel() );
Point aBtnPos( rRect.Left() + ICON_OFFSET,
@@ -741,20 +294,20 @@ void ExtensionBox_Impl::SetButtonPos( const Rectangle& rRect )
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry )
+void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry )
{
if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) )
{
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
}
else
{
- m_pEnableBtn->SetText( ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) );
+ m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
}
- if ( pEntry->m_eState == NOT_AVAILABLE )
+ if ( ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps )
m_pEnableBtn->Hide();
else
{
@@ -775,183 +328,23 @@ void ExtensionBox_Impl::SetButtonStatus( const TEntry_Impl pEntry )
}
// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( pEntry->m_bActive )
- SetTextColor( rStyleSettings.GetHighlightTextColor() );
- else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
- SetTextColor( rStyleSettings.GetDisableColor() );
- else if ( IsControlForeground() )
- SetTextColor( GetControlForeground() );
- else
- SetTextColor( rStyleSettings.GetFieldTextColor() );
-
- if ( pEntry->m_bActive )
- {
- SetLineColor();
- SetFillColor( rStyleSettings.GetHighlightColor() );
- DrawRect( rRect );
- }
- else
- {
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
+ sal_Int32 nIndex = getSelIndex();
- SetTextFillColor();
- Erase( rRect );
- }
-
- // Draw extension icon
- Point aPos( rRect.TopLeft() );
- aPos += Point( TOP_OFFSET, TOP_OFFSET );
- Image aImage;
- if ( ! pEntry->m_aIcon )
- aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
- else
- aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
- Size aImageSize = aImage.GetSizePixel();
- if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
- DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
- else
- DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
-
- // Setup fonts
- Font aStdFont( GetFont() );
- Font aBoldFont( aStdFont );
- aBoldFont.SetWeight( WEIGHT_BOLD );
- SetFont( aBoldFont );
- long aTextHeight = GetTextHeight();
-
- // Init publisher link here
- if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
- {
- pEntry->m_pPublisher = new svt::FixedHyperlink( this );
- pEntry->m_pPublisher->SetBackground();
- pEntry->m_pPublisher->SetPaintTransparent( true );
- pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
- pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
- Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
- pEntry->m_pPublisher->SetSizePixel( aSize );
- pEntry->m_pPublisher->SetClickHdl( LINK( this, ExtensionBox_Impl, HandleHyperlink ) );
- }
-
- // Get max title width
- long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
- nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- if ( pEntry->m_pPublisher )
- {
- nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
- }
-
- long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
- long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
-
- aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
-
- if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
- {
- aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
- String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
- DrawText( aPos, aShortTitle );
- aTitleWidth += (aTextHeight / 3);
- }
- else
- DrawText( aPos, pEntry->m_sTitle );
-
- SetFont( aStdFont );
- DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
-
- long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // draw description
- String sDescription;
- if ( pEntry->m_sErrorText.Len() )
- {
- if ( pEntry->m_bActive )
- sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
- else
- sDescription = pEntry->m_sErrorText;
- }
- else
- sDescription = pEntry->m_sDescription;
-
- aPos.Y() += aTextHeight;
- if ( pEntry->m_bActive )
- {
- DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nBtnHeight ),
- sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- }
- else
- {
- const long nWidth = GetTextWidth( sDescription );
- if ( nWidth > rRect.GetWidth() - aPos.X() )
- sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
- DrawText( aPos, sDescription );
- }
-
- // Draw publisher link
- if ( pEntry->m_pPublisher )
- {
- pEntry->m_pPublisher->Show();
- aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
- pEntry->m_pPublisher->SetPosPixel( aPos );
- }
-
- // Draw status icons
- if ( pEntry->m_bShared )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
- }
- if ( pEntry->m_eState == AMBIGUOUS )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
- }
-
- SetLineColor( Color( COL_LIGHTGRAY ) );
- DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::RecalcAll()
-{
- if ( m_bHasActive )
- CalcActiveHeight( m_nActive );
-
- SetupScrollBar();
-
- if ( m_bHasActive )
- SetButtonPos( GetEntryRect( m_nActive ) );
-
- m_bNeedsRecalc = false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
-{
- if ( ! m_bHasActive )
+ if ( nIndex == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
return false;
PushButton *pNext = NULL;
if ( m_pOptionsBtn->HasFocus() ) {
- if ( !bReverse && !m_vEntries[ m_nActive ]->m_bLocked )
+ if ( !bReverse && !GetEntryData( nIndex )->m_bLocked )
pNext = m_pEnableBtn;
}
else if ( m_pEnableBtn->HasFocus() ) {
if ( !bReverse )
pNext = m_pRemoveBtn;
- else if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ else if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
}
else if ( m_pRemoveBtn->HasFocus() ) {
@@ -960,14 +353,14 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
}
else {
if ( !bReverse ) {
- if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
- else if ( ! m_vEntries[ m_nActive ]->m_bLocked )
+ else if ( ! GetEntryData( nIndex )->m_bLocked )
pNext = m_pEnableBtn;
} else {
- if ( ! m_vEntries[ m_nActive ]->m_bLocked )
+ if ( ! GetEntryData( nIndex )->m_bLocked )
pNext = m_pRemoveBtn;
- else if ( m_vEntries[ m_nActive ]->m_bHasOptions )
+ else if ( GetEntryData( nIndex )->m_bHasOptions )
pNext = m_pOptionsBtn;
}
}
@@ -982,194 +375,67 @@ bool ExtensionBox_Impl::HandleTabKey( bool bReverse )
}
// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
-{
- if ( m_vEntries.empty() )
- return true;
-
- long nSelect = 0;
-
- if ( m_bHasActive )
- {
- long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
- if ( nPageSize < 2 )
- nPageSize = 2;
-
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
- nSelect = m_nActive + 1;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
- nSelect = m_nActive - 1;
- else if ( nKeyCode == KEY_HOME )
- nSelect = 0;
- else if ( nKeyCode == KEY_END )
- nSelect = m_vEntries.size() - 1;
- else if ( nKeyCode == KEY_PAGEUP )
- nSelect = m_nActive - nPageSize + 1;
- else if ( nKeyCode == KEY_PAGEDOWN )
- nSelect = m_nActive + nPageSize - 1;
- }
- else // when there is no selected entry, we will select the first or the last.
- {
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
- nSelect = 0;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
- nSelect = m_vEntries.size() - 1;
- }
-
- if ( nSelect < 0 )
- nSelect = 0;
- if ( nSelect >= (long) m_vEntries.size() )
- nSelect = m_vEntries.size() - 1;
-
- selectEntry( nSelect );
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-MENU_COMMAND ExtensionBox_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
+MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
{
- if ( nPos >= (long) m_vEntries.size() )
+ if ( nPos >= (long) getItemCount() )
return CMD_NONE;
PopupMenu aPopup;
- aPopup.InsertItem( CMD_UPDATE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
+ aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
- if ( ! m_vEntries[ nPos ]->m_bLocked )
+ if ( ! GetEntryData( nPos )->m_bLocked )
{
- if ( m_vEntries[ nPos ]->m_eState == REGISTERED )
- aPopup.InsertItem( CMD_DISABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_DISABLE ) );
- else if ( m_vEntries[ nPos ]->m_eState != NOT_AVAILABLE )
- aPopup.InsertItem( CMD_ENABLE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_ENABLE ) );
+ if ( GetEntryData( nPos )->m_eState == REGISTERED )
+ aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
+ aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
- aPopup.InsertItem( CMD_REMOVE, ExtMgrDialog::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
}
return (MENU_COMMAND) aPopup.Execute( this, rPos );
}
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
-{
- if ( m_bNeedsRecalc )
- RecalcAll();
-
- Point aStart( 0, -m_nTopIndex );
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
- Rectangle aEntryRect( aStart, aSize );
-// if ( aEntryRect.IsOver( rPaintRect ) )
- DrawRow( aEntryRect, *iIndex );
- aStart.Y() += aSize.Height();
- }
-}
-
-// -----------------------------------------------------------------------
-long ExtensionBox_Impl::GetTotalHeight() const
-{
- long nHeight = m_vEntries.size() * m_nStdHeight;
-
- if ( m_bHasActive )
- {
- nHeight += m_nActiveHeight - m_nStdHeight;
- }
-
- return nHeight;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetupScrollBar()
-{
- const Size aSize = GetOutputSizePixel();
- const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
- const long nTotalHeight = GetTotalHeight();
- const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
-
- if ( bNeedsScrollBar )
- {
- if ( m_nTopIndex + aSize.Height() > nTotalHeight )
- m_nTopIndex = nTotalHeight - aSize.Height();
-
- m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
- Size( nScrBarSize, aSize.Height() ) );
- m_pScrollBar->SetRangeMax( nTotalHeight );
- m_pScrollBar->SetVisibleSize( aSize.Height() );
- m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
- m_pScrollBar->SetLineSize( m_nStdHeight );
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- if ( !m_bHasScrollBar )
- m_pScrollBar->Show();
- }
- else if ( m_bHasScrollBar )
- {
- m_pScrollBar->Hide();
- m_nTopIndex = 0;
- }
-
- m_bHasScrollBar = bNeedsScrollBar;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Resize()
-{
- RecalcAll();
-}
-
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( m_bInterfaceLocked )
return;
const Point aMousePos( rMEvt.GetPosPixel() );
- long nPos = ( aMousePos.Y() + m_nTopIndex ) / m_nStdHeight;
- if ( m_bHasActive && ( nPos > m_nActive ) )
- {
- if ( aMousePos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
- nPos = m_nActive;
- else
- nPos = ( aMousePos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
- }
+ const long nPos = PointToPos( aMousePos );
if ( rMEvt.IsRight() )
{
switch( ShowPopupMenu( aMousePos, nPos ) )
{
case CMD_NONE: break;
- case CMD_ENABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage, true );
+ case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage, true );
break;
- case CMD_DISABLE: m_pParent->enablePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage, false );
+ case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage, false );
break;
- case CMD_UPDATE: m_pParent->updatePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage );
+ case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage );
break;
- case CMD_REMOVE: m_pParent->removePackage( m_vEntries[ nPos ]->m_xPackageManager,
- m_vEntries[ nPos ]->m_xPackage );
+ case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackageManager,
+ GetEntryData( nPos )->m_xPackage );
break;
}
}
else if ( rMEvt.IsLeft() )
{
- if ( rMEvt.IsMod1() && m_bHasActive )
- selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ if ( rMEvt.IsMod1() && HasActive() )
+ selectEntry( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); // Selecting an not existing entry will deselect the current one
else
selectEntry( nPos );
}
}
//------------------------------------------------------------------------------
-long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+long ExtBoxWithBtns_Impl::Notify( NotifyEvent& rNEvt )
{
bool bHandled = false;
@@ -1181,364 +447,259 @@ long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
if ( nKeyCode == KEY_TAB )
bHandled = HandleTabKey( aKeyCode.IsShift() );
- else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
- bHandled = HandleCursorKey( nKeyCode );
- }
-
- if ( rNEvt.GetType() == EVENT_COMMAND )
- {
- if ( m_bHasScrollBar &&
- ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
- {
- const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
- {
- long nThumbPos = m_pScrollBar->GetThumbPos();
- if ( pData->GetDelta() < 0 )
- m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
- else
- m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
- bHandled = true;
- }
- }
}
if ( !bHandled )
- return Control::Notify( rNEvt );
+ return ExtensionBox_Impl::Notify( rNEvt );
else
return true;
}
//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
- const long nEnd, long &nPos )
+void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
{
- nPos = nStart;
- if ( nStart > nEnd )
- return false;
-
- StringCompare eCompare;
+ m_bInterfaceLocked = ! bEnable;
- if ( nStart == nEnd )
+ if ( bEnable )
{
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
- if ( eCompare == COMPARE_LESS )
- return false;
- else if ( eCompare == COMPARE_EQUAL )
- {
- //Workaround. See i86963.
- if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nStart ]->m_bChecked = true;
- return true;
- }
- else
- {
- nPos = nStart + 1;
- return false;
- }
+ sal_Int32 nIndex = getSelIndex();
+ if ( nIndex != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
+ SetButtonStatus( GetEntryData( nIndex ) );
}
-
- const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
-
- if ( eCompare == COMPARE_LESS )
- return FindEntryPos( pEntry, nStart, nMid-1, nPos );
- else if ( eCompare == COMPARE_GREATER )
- return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
else
{
- //Workaround.See i86963.
- if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nMid ]->m_bChecked = true;
- nPos = nMid;
- return true;
+ m_pOptionsBtn->Enable( false );
+ m_pRemoveBtn->Enable( false );
+ m_pEnableBtn->Enable( false );
}
}
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, ScrollHdl, ScrollBar*, pScrBar )
{
- long nPos = 0;
- PackageState eState = m_pManager->getPackageState( xPackage );
+ long nDelta = pScrBar->GetDelta();
+
+ Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) );
+ Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) );
+ Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) );
- TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
- xPackage->addEventListener( this );
+ DoScroll( nDelta );
+
+ m_pOptionsBtn->SetPosPixel( aNewOptPt );
+ m_pRemoveBtn->SetPosPixel( aNewRemPt );
+ m_pEnableBtn->SetPosPixel( aNewEnPt );
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- if ( m_vEntries.empty() )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.push_back( pEntry );
- }
- else
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleOptionsBtn, void*, EMPTYARG )
+{
+ const sal_Int32 nActive = getSelIndex();
+
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
- }
- else if ( !m_bInCheckMode )
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+
+ if ( pFact )
{
- OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
+ OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
+ VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() );
+
+ pDlg->Execute();
+
+ delete pDlg;
}
}
- //access to m_nActive must be guarded
- if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
- m_nActive += 1;
-
- guard.clear();
- if ( IsReallyVisible() )
- Invalidate();
-
- m_bNeedsRecalc = true;
-
- return nPos;
+ return 1;
}
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG )
{
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ const sal_Int32 nActive = getSelIndex();
+
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- PackageState eState = m_pManager->getPackageState( xPackage );
- (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- (*iIndex)->m_eState = eState;
- (*iIndex)->m_sTitle = xPackage->getDisplayName();
- (*iIndex)->m_sVersion = xPackage->getVersion();
- (*iIndex)->m_sDescription = xPackage->getDescription();
-
- if ( eState == AMBIGUOUS )
- (*iIndex)->m_sErrorText = ExtMgrDialog::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else
- (*iIndex)->m_sErrorText = String();
+ TEntry_Impl pEntry = GetEntryData( nActive );
+ const bool bEnable( pEntry->m_eState != REGISTERED );
- if ( IsReallyVisible() )
- Invalidate();
- break;
- }
+ m_pParent->enablePackage( pEntry->m_xPackageManager,
+ pEntry->m_xPackage,
+ bEnable );
}
+
+ return 1;
}
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtBoxWithBtns_Impl, HandleRemoveBtn, void*, EMPTYARG )
{
- m_bInCheckMode = true;
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ const sal_Int32 nActive = getSelIndex();
+
+ if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
- if ( (*iIndex)->m_xPackageManager == xPackageMgr )
- (*iIndex)->m_bChecked = false;
- else
- (*iIndex)->m_bChecked = true;
- (*iIndex)->m_bNew = false;
+ TEntry_Impl pEntry = GetEntryData( nActive );
+ m_pParent->removePackage( pEntry->m_xPackageManager,
+ pEntry->m_xPackage );
}
+
+ return 1;
}
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkEntries()
+// DialogHelper
+//------------------------------------------------------------------------------
+DialogHelper::DialogHelper( const uno::Reference< uno::XComponentContext > &xContext,
+ Dialog *pWindow ) :
+ m_pVCLWindow( pWindow ),
+ m_nEventID( 0 ),
+ m_bIsBusy( false )
{
- long nNewPos = -1;
- long nPos = 0;
- bool bNeedsUpdate = false;
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- typedef std::vector< TEntry_Impl >::iterator ITER;
- ITER iIndex = m_vEntries.begin();
- while ( iIndex < m_vEntries.end() )
- {
- if ( (*iIndex)->m_bChecked == false )
- {
- bNeedsUpdate = true;
- nPos = iIndex-m_vEntries.begin();
- if ( (*iIndex)->m_bNew )
- {
- if ( nNewPos == - 1)
- nNewPos = nPos;
- if ( nPos <= m_nActive )
- m_nActive += 1;
- }
- }
- iIndex++;
- }
- guard.clear();
+ m_xContext = xContext;
+}
- m_bInCheckMode = false;
+//------------------------------------------------------------------------------
+DialogHelper::~DialogHelper()
+{
+ if ( m_nEventID )
+ Application::RemoveUserEvent( m_nEventID );
+}
- if ( nNewPos != - 1)
- selectEntry( nNewPos );
+//------------------------------------------------------------------------------
+ResId DialogHelper::getResId( USHORT nId )
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ return ResId( nId, *DeploymentGuiResMgr::get() );
+}
- if ( bNeedsUpdate )
- {
- m_bNeedsRecalc = true;
- if ( IsReallyVisible() )
- Invalidate();
+//------------------------------------------------------------------------------
+String DialogHelper::getResourceString( USHORT id )
+{
+ // init with non-acquired solar mutex:
+ BrandName::get();
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
+ if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
+ ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
}
+ return ret;
}
+
//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::isHCMode()
+bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager )
{
- return (bool)GetDisplayBackground().GetColor().IsDark();
+ if ( xPackageManager->getContext().equals( OUSTR("shared") ) )
+ return true;
+ else
+ return false;
}
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::enableButtons( bool bEnable )
+bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ Window *pParent,
+ const USHORT nResID,
+ bool &bHadWarning )
{
- m_bInterfaceLocked = ! bEnable;
-
- if ( bEnable )
+ if ( !bHadWarning && IsSharedPkgMgr( xPackageManager ) )
{
- if ( m_bHasActive )
- SetButtonStatus( m_vEntries[ m_nActive ] );
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ WarningBox aInfoBox( pParent, getResId( nResID ) );
+ String aMsgText = aInfoBox.GetMessText();
+ aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ aInfoBox.SetMessText( aMsgText );
+
+ bHadWarning = true;
+
+ if ( RET_OK == aInfoBox.Execute() )
+ return true;
+ else
+ return false;
}
else
- {
- m_pOptionsBtn->Enable( false );
- m_pRemoveBtn->Enable( false );
- m_pEnableBtn->Enable( false );
- }
+ return true;
}
//------------------------------------------------------------------------------
-// XEventListener
-void ExtensionBox_Impl::disposing( lang::EventObject const & rEvt )
- throw ( uno::RuntimeException )
+void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle ) const
{
- uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+ if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
+ return;
- if ( xPackage.is() )
+ try
{
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- long nPos = iIndex - m_vEntries.begin();
-
- m_vEntries.erase( iIndex );
-
- if ( IsReallyVisible() )
- Invalidate();
-
- if ( m_bHasActive )
- {
- if ( nPos < m_nActive )
- m_nActive -= 1;
- else if ( ( nPos == m_nActive ) &&
- ( nPos == (long) m_vEntries.size() ) )
- m_nActive -= 1;
-
- m_bHasActive = false;
- //clear before calling out of this method
- aGuard.clear();
- selectEntry( m_nActive );
- }
- break;
- }
- }
+ uno::Reference< XSystemShellExecute > xSystemShellExecute(
+ m_xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), m_xContext), uno::UNO_QUERY_THROW);
+ //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
+ xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ catch ( uno::Exception& )
+ {
+ uno::Any exc( ::cppu::getCaughtException() );
+ OUString msg( ::comphelper::anyToString( exc ) );
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ ErrorBox aErrorBox( NULL, WB_OK, msg );
+ aErrorBox.SetText( sTitle );
+ aErrorBox.Execute();
}
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+//------------------------------------------------------------------------------
+bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
{
- long nDelta = pScrBar->GetDelta();
-
- m_nTopIndex += nDelta;
- Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) );
- Point aNewSBPt( m_pScrollBar->GetPosPixel() );
-
- Rectangle aScrRect( Point(), GetOutputSizePixel() );
- aScrRect.Right() -= pScrBar->GetSizePixel().Width();
- Scroll( 0, -nDelta, aScrRect );
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
- m_pOptionsBtn->SetPosPixel( aNewOptPt );
- m_pRemoveBtn->SetPosPixel( aNewRemPt );
- m_pEnableBtn->SetPosPixel( aNewEnPt );
- m_pScrollBar->SetPosPixel( aNewSBPt );
+ String sText( aInfo.GetMessText() );
+ sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
+ aInfo.SetMessText( sText );
- return 1;
+ return ( RET_OK == aInfo.Execute() );
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleOptionsBtn, void*, EMPTYARG )
+//------------------------------------------------------------------------------
+bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
{
- if ( m_bHasActive )
- {
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
-
- if ( pFact )
- {
- OUString sExtensionId = m_vEntries[ m_nActive ]->m_xPackage->getIdentifier().Value;
- VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() );
-
- pDlg->Execute();
-
- delete pDlg;
- }
- }
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
- return 1;
-}
+ String sMsgText = aQuery.GetMessText();
+ sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ aQuery.SetMessText( sMsgText );
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleEnableBtn, void*, EMPTYARG )
-{
- if ( m_bHasActive )
- {
- const bool bEnable( m_vEntries[ m_nActive ]->m_eState != REGISTERED );
+ USHORT nYesBtnID = aQuery.GetButtonId( 0 );
+ USHORT nNoBtnID = aQuery.GetButtonId( 1 );
- m_pParent->enablePackage( m_vEntries[ m_nActive ]->m_xPackageManager,
- m_vEntries[ m_nActive ]->m_xPackage,
- bEnable );
- }
+ if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
+ aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) );
+ if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
+ aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) );
- return 1;
-}
+ short nRet = aQuery.Execute();
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleRemoveBtn, void*, EMPTYARG )
-{
- if ( m_bHasActive )
- {
- m_pParent->removePackage( m_vEntries[ m_nActive ]->m_xPackageManager,
- m_vEntries[ m_nActive ]->m_xPackage );
- }
+ if ( nRet == RET_CANCEL )
+ return false;
- return 1;
+ bInstallForAll = ( nRet == RET_NO );
+ return true;
}
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
+//------------------------------------------------------------------------------
+void DialogHelper::PostUserEvent( const Link& rLink, void* pCaller )
{
- m_pParent->openWebBrowser( pHyperlink->GetURL() );
- return 1;
-}
+ if ( m_nEventID )
+ Application::RemoveUserEvent( m_nEventID );
+ m_nEventID = Application::PostUserEvent( rLink, pCaller );
+}
//------------------------------------------------------------------------------
// ExtMgrDialog
//------------------------------------------------------------------------------
ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) :
ModelessDialog( pParent, getResId( RID_DLG_EXTENSION_MANAGER ) ),
+ DialogHelper( pManager->getContext(), (Dialog*) this ),
m_aAddBtn( this, getResId( RID_EM_BTN_ADD ) ),
m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
@@ -1557,14 +718,14 @@ ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) :
m_bEnableWarning( false ),
m_bDisableWarning( false ),
m_bDeleteWarning( false ),
- m_bIsBusy( false ),
m_nProgress( 0 ),
m_pManager( pManager )
{
// free local resources (RID < 256):
FreeResource();
- m_pExtensionBox = new ExtensionBox_Impl( this, pManager );
+ m_pExtensionBox = new ExtBoxWithBtns_Impl( this, pManager );
+ m_pExtensionBox->SetHyperlinkHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
m_aAddBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) );
m_aUpdateBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
@@ -1608,35 +769,6 @@ ExtMgrDialog::~ExtMgrDialog()
}
//------------------------------------------------------------------------------
-ResId ExtMgrDialog::getResId( USHORT id )
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- return ResId( id, *DeploymentGuiResMgr::get() );
-}
-
-//------------------------------------------------------------------------------
-String ExtMgrDialog::getResourceString( USHORT id )
-{
- // init with non-acquired solar mutex:
- BrandName::get();
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
- if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
- ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- }
- return ret;
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager )
-{
- if ( xPackageManager->getContext().equals( OUSTR("shared") ) )
- return true;
- else
- return false;
-}
-
-//------------------------------------------------------------------------------
void ExtMgrDialog::selectEntry( long nPos )
{
m_pExtensionBox->selectEntry( nPos );
@@ -1671,96 +803,6 @@ void ExtMgrDialog::checkEntries()
}
//------------------------------------------------------------------------------
-bool ExtMgrDialog::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const USHORT nResID,
- bool &bHadWarning ) const
-{
- if ( IsSharedPkgMgr( xPackageManager ) && !bHadWarning )
- {
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- WarningBox aInfoBox( const_cast< ExtMgrDialog* >(this), getResId( nResID ) );
- String aMsgText = aInfoBox.GetMessText();
- aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- aInfoBox.SetMessText( aMsgText );
-
- bHadWarning = true;
-
- if ( RET_OK == aInfoBox.Execute() )
- return true;
- else
- return false;
- }
- else
- return true;
-}
-
-//------------------------------------------------------------------------------
-void ExtMgrDialog::openWebBrowser( OUString const & sURL ) const
-{
- if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
- return;
-
- try
- {
- uno::Reference< uno::XComponentContext > xContext = m_pManager->getContext();
-
- uno::Reference< XSystemShellExecute > xSystemShellExecute(
- xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), xContext), uno::UNO_QUERY_THROW);
- //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
- xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::DEFAULTS );
- }
- catch ( uno::Exception& )
- {
- uno::Any exc( ::cppu::getCaughtException() );
- OUString msg( ::comphelper::anyToString( exc ) );
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- ErrorBox aErrorBox( const_cast< ExtMgrDialog* >(this), WB_OK, msg );
- aErrorBox.SetText( GetText() );
- aErrorBox.Execute();
- }
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::installForAllUsers( bool &bInstallForAll ) const
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- QueryBox aQuery( const_cast< ExtMgrDialog* >(this), getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
-
- String sMsgText = aQuery.GetMessText();
- sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- aQuery.SetMessText( sMsgText );
-
- USHORT nYesBtnID = aQuery.GetButtonId( 0 );
- USHORT nNoBtnID = aQuery.GetButtonId( 1 );
-
- if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
- aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) );
- if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
- aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) );
-
- short nRet = aQuery.Execute();
-
- if ( nRet == RET_CANCEL )
- return false;
-
- bInstallForAll = ( nRet == RET_NO );
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool ExtMgrDialog::installExtensionWarn( const OUString &rExtensionName ) const
-{
- const ::vos::OGuard guard( Application::GetSolarMutex() );
- WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
-
- String sText( aInfo.GetMessText() );
- sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
- aInfo.SetMessText( sText );
-
- return ( RET_OK == aInfo.Execute() );
-}
-
-//------------------------------------------------------------------------------
bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
@@ -1783,12 +825,12 @@ bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageMana
if ( bEnable )
{
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
return false;
}
else
{
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
return false;
}
@@ -1810,7 +852,7 @@ bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackageMana
return false;
}
- if ( ! continueOnSharedExtension( xPackageManager, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
+ if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
return false;
m_pManager->removePackage( xPackageManager, xPackage );
@@ -1825,7 +867,11 @@ bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageMana
if ( !xPackageManager.is() || !xPackage.is() )
return false;
- m_pManager->updatePackage( xPackageManager, xPackage );
+ std::vector< TUpdateListEntry > vEntries;
+ TUpdateListEntry pEntry( new UpdateListEntry( xPackage, xPackageManager ) );
+ vEntries.push_back( pEntry );
+
+ m_pManager->updatePackages( vEntries );
return true;
}
@@ -1932,7 +978,7 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface )
if ( m_aProgressBar.IsVisible() )
m_aProgressBar.SetValue( 100 );
m_xAbortChannel.clear();
-// bLockInterface = false;
+
OSL_TRACE( " startProgress handler: stop\n" );
}
else
@@ -1945,7 +991,8 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface )
m_aUpdateBtn.Enable( !bLockInterface && m_pExtensionBox->getItemCount() );
m_pExtensionBox->enableButtons( !bLockInterface );
-// pCond->set();
+ clearEventID();
+
return 0;
}
@@ -1969,10 +1016,7 @@ void ExtMgrDialog::showProgress( bool _bStart )
OSL_TRACE( "showProgress stop!\n" );
}
- Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart );
-// ::osl::Condition cond;
-// Application::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), &cond );
-// cond.wait();
+ DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart );
}
// -----------------------------------------------------------------------
@@ -2003,7 +1047,7 @@ void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage
// -----------------------------------------------------------------------
IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG )
{
- m_bIsBusy = true;
+ setBusy( true );
uno::Reference< deployment::XPackageManager > xUserPkgMgr = m_pManager->getUserPkgMgr();
uno::Sequence< OUString > aFileList = raiseAddPicker( xUserPkgMgr );
@@ -2013,7 +1057,7 @@ IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG )
m_pManager->installPackage( aFileList[0] );
}
- m_bIsBusy = false;
+ setBusy( false );
return 1;
}
@@ -2028,7 +1072,7 @@ IMPL_LINK( ExtMgrDialog, HandleUpdateBtn, void*, EMPTYARG )
// -----------------------------------------------------------------------
IMPL_LINK( ExtMgrDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
{
- openWebBrowser( pHyperlink->GetURL() );
+ openWebBrowser( pHyperlink->GetURL(), GetText() );
return 1;
}
@@ -2191,6 +1235,554 @@ BOOL ExtMgrDialog::Close()
return bRet;
}
+//------------------------------------------------------------------------------
+// UpdateRequiredDialog
+//------------------------------------------------------------------------------
+UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager *pManager ) :
+ ModalDialog( pParent, getResId( RID_DLG_UPDATE_REQUIRED ) ),
+ DialogHelper( pManager->getContext(), (Dialog*) this ),
+ m_aUpdateNeeded( this, getResId( RID_EM_FT_MSG ) ),
+ m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
+ m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
+ m_aHelpBtn( this, getResId( RID_EM_BTN_HELP ) ),
+ m_aCancelBtn( this, getResId( RID_EM_BTN_CANCEL ) ),
+ m_aDivider( this ),
+ m_aProgressText( this, getResId( RID_EM_FT_PROGRESS ) ),
+ m_aProgressBar( this, WB_BORDER + WB_3DLOOK ),
+ m_sAddPackages( getResourceString( RID_STR_ADD_PACKAGES ) ),
+ m_sCloseText( getResourceString( RID_STR_CLOSE_BTN ) ),
+ m_bHasProgress( false ),
+ m_bProgressChanged( false ),
+ m_bStartProgress( false ),
+ m_bStopProgress( false ),
+ m_bUpdateWarning( false ),
+ m_bDisableWarning( false ),
+ m_bHasLockedEntries( false ),
+ m_nProgress( 0 ),
+ m_pManager( pManager )
+{
+ // free local resources (RID < 256):
+ FreeResource();
+
+ m_pExtensionBox = new ExtensionBox_Impl( this, pManager );
+ m_pExtensionBox->SetHyperlinkHdl( LINK( this, UpdateRequiredDialog, HandleHyperlink ) );
+
+ m_aUpdateBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
+ m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
+
+ String aText = m_aUpdateNeeded.GetText();
+ aText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
+ m_aUpdateNeeded.SetText( aText );
+
+ // resize update button
+ Size aBtnSize = m_aUpdateBtn.GetSizePixel();
+ String sTitle = m_aUpdateBtn.GetText();
+ long nWidth = m_aUpdateBtn.GetCtrlTextWidth( sTitle );
+ nWidth += 2 * m_aUpdateBtn.GetTextHeight();
+ if ( nWidth > aBtnSize.Width() )
+ m_aUpdateBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
+
+ // resize update button
+ aBtnSize = m_aCloseBtn.GetSizePixel();
+ sTitle = m_aCloseBtn.GetText();
+ nWidth = m_aCloseBtn.GetCtrlTextWidth( sTitle );
+ nWidth += 2 * m_aCloseBtn.GetTextHeight();
+ if ( nWidth > aBtnSize.Width() )
+ m_aCloseBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
+
+ // minimum size:
+ SetMinOutputSizePixel(
+ Size( // width:
+ (5 * m_aHelpBtn.GetSizePixel().Width()) +
+ (5 * RSC_SP_DLG_INNERBORDER_LEFT ),
+ // height:
+ (1 * m_aHelpBtn.GetSizePixel().Height()) +
+ (1 * m_aUpdateNeeded.GetSizePixel().Height()) +
+ (1 * m_pExtensionBox->GetMinOutputSizePixel().Height()) +
+ (3 * RSC_SP_DLG_INNERBORDER_LEFT) ) );
+
+ m_aDivider.Show();
+ m_aProgressBar.Hide();
+ m_aUpdateBtn.Enable( false );
+ m_aCloseBtn.GrabFocus();
+
+ m_aTimeoutTimer.SetTimeout( 50 ); // mSec
+ m_aTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
+}
+
+//------------------------------------------------------------------------------
+UpdateRequiredDialog::~UpdateRequiredDialog()
+{
+ m_aTimeoutTimer.Stop();
+
+ delete m_pExtensionBox;
+}
+
+//------------------------------------------------------------------------------
+long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ // We will only add entries to the list with unsatisfied dependencies
+ if ( !checkDependencies( xPackage ) )
+ {
+ m_bHasLockedEntries |= (bool) xPackageManager->isReadOnly();
+ m_aUpdateBtn.Enable( true );
+ return m_pExtensionBox->addEntry( xPackage, xPackageManager );
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ if ( xPackageManager.is() )
+ m_pExtensionBox->prepareChecking( xPackageManager );
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::checkEntries()
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+ m_pExtensionBox->checkEntries();
+
+ if ( ! hasActiveEntries() )
+ {
+ m_aCloseBtn.SetText( m_sCloseText );
+ m_aCloseBtn.GrabFocus();
+ }
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &,
+ const uno::Reference< deployment::XPackage > &xPackage,
+ bool bEnable )
+{
+ m_pManager->enablePackage( xPackage, bEnable );
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleCancelBtn, void*, EMPTYARG )
+{
+ // m_dialog->m_cmdEnv->m_aborted = true;
+ if ( m_xAbortChannel.is() )
+ {
+ try
+ {
+ m_xAbortChannel->sendAbort();
+ }
+ catch ( uno::RuntimeException & )
+ {
+ OSL_ENSURE( 0, "### unexpected RuntimeException!" );
+ }
+ }
+ return 1;
+}
+
+// ------------------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ bool bLockInterface = (bool) _bLockInterface;
+
+ if ( m_bStartProgress && !m_bHasProgress )
+ m_aTimeoutTimer.Start();
+
+ if ( m_bStopProgress )
+ {
+ if ( m_aProgressBar.IsVisible() )
+ m_aProgressBar.SetValue( 100 );
+ m_xAbortChannel.clear();
+ OSL_TRACE( " startProgress handler: stop\n" );
+ }
+ else
+ {
+ OSL_TRACE( " startProgress handler: start\n" );
+ }
+
+ m_aCancelBtn.Enable( bLockInterface );
+ m_aUpdateBtn.Enable( false );
+ clearEventID();
+
+ return 0;
+}
+
+// ------------------------------------------------------------------------------
+void UpdateRequiredDialog::showProgress( bool _bStart )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ bool bStart = _bStart;
+
+ if ( bStart )
+ {
+ m_nProgress = 0;
+ m_bStartProgress = true;
+ OSL_TRACE( "showProgress start\n" );
+ }
+ else
+ {
+ m_nProgress = 100;
+ m_bStopProgress = true;
+ OSL_TRACE( "showProgress stop!\n" );
+ }
+
+ DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), (void*) bStart );
+}
+
+// -----------------------------------------------------------------------
+void UpdateRequiredDialog::updateProgress( const long nProgress )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_nProgress = nProgress;
+}
+
+// -----------------------------------------------------------------------
+void UpdateRequiredDialog::updateProgress( const OUString &rText,
+ const uno::Reference< task::XAbortChannel > &xAbortChannel)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_xAbortChannel = xAbortChannel;
+ m_sProgressText = rText;
+ m_bProgressChanged = true;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ // We will remove all updated packages with satisfied dependencies, but
+ // we will show all disabled entries so the user sees the result
+ // of the 'disable all' button
+ if ( isEnabled( xPackage ) && checkDependencies( xPackage ) )
+ m_pExtensionBox->removeEntry( xPackage );
+ else
+ m_pExtensionBox->updateEntry( xPackage );
+
+ if ( ! hasActiveEntries() )
+ {
+ m_aCloseBtn.SetText( m_sCloseText );
+ m_aCloseBtn.GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG )
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ std::vector< TUpdateListEntry > vUpdateEntries;
+ sal_Int32 nCount = m_pExtensionBox->GetEntryCount();
+
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i );
+ TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage,
+ pEntry->m_xPackageManager ) );
+ vUpdateEntries.push_back( pUpdateEntry );
+ }
+
+ aGuard.clear();
+
+ m_pManager->updatePackages( vUpdateEntries );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleCloseBtn, void*, EMPTYARG )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !isBusy() )
+ {
+ if ( m_bHasLockedEntries )
+ EndDialog( -1 );
+ else if ( hasActiveEntries() )
+ disableAllEntries();
+ else
+ EndDialog( 0 );
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
+{
+ openWebBrowser( pHyperlink->GetURL(), GetText() );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( UpdateRequiredDialog, TimeOutHdl, Timer*, EMPTYARG )
+{
+ if ( m_bStopProgress )
+ {
+ m_bHasProgress = false;
+ m_bStopProgress = false;
+ m_aProgressText.Hide();
+ m_aProgressBar.Hide();
+ m_aCancelBtn.Hide();
+ }
+ else
+ {
+ if ( m_bProgressChanged )
+ {
+ m_bProgressChanged = false;
+ m_aProgressText.SetText( m_sProgressText );
+ }
+
+ if ( m_bStartProgress )
+ {
+ m_bStartProgress = false;
+ m_bHasProgress = true;
+ m_aProgressBar.Show();
+ m_aProgressText.Show();
+ m_aCancelBtn.Enable();
+ m_aCancelBtn.Show();
+ }
+
+ if ( m_aProgressBar.IsVisible() )
+ m_aProgressBar.SetValue( (USHORT) m_nProgress );
+
+ m_aTimeoutTimer.Start();
+ }
+
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+// VCL::Window / Dialog
+void UpdateRequiredDialog::Resize()
+{
+ Size aTotalSize( GetOutputSizePixel() );
+ Size aBtnSize( m_aHelpBtn.GetSizePixel() );
+
+ Point aPos( RSC_SP_DLG_INNERBORDER_LEFT,
+ aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM - aBtnSize.Height() );
+
+ m_aHelpBtn.SetPosPixel( aPos );
+
+ aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - m_aCloseBtn.GetSizePixel().Width();
+ m_aCloseBtn.SetPosPixel( aPos );
+
+ aPos.X() -= ( RSC_SP_CTRL_X + m_aUpdateBtn.GetSizePixel().Width() );
+ m_aUpdateBtn.SetPosPixel( aPos );
+
+ Size aDivSize( aTotalSize.Width(), LINE_SIZE );
+ aPos = Point( 0, aPos.Y() - LINE_SIZE - RSC_SP_DLG_INNERBORDER_BOTTOM );
+ m_aDivider.SetPosSizePixel( aPos, aDivSize );
+
+ // Calc fixed text size
+ aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP );
+ Size aFTSize = m_aUpdateNeeded.CalcMinimumSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_SP_DLG_INNERBORDER_LEFT );
+ m_aUpdateNeeded.SetPosSizePixel( aPos, aFTSize );
+
+ // Calc list box size
+ Size aSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
+ aTotalSize.Height() - 2*aBtnSize.Height() - LINE_SIZE -
+ 2*RSC_SP_DLG_INNERBORDER_TOP - 3*RSC_SP_DLG_INNERBORDER_BOTTOM - aFTSize.Height() );
+ aPos.Y() += aFTSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
+
+ m_pExtensionBox->SetPosSizePixel( aPos, aSize );
+
+ aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width();
+ aPos.Y() += aSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
+ m_aCancelBtn.SetPosPixel( aPos );
+
+ // Calc progress height
+ aFTSize = m_aProgressText.GetSizePixel();
+ long nProgressHeight = aFTSize.Height();
+
+ if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aValue;
+ bool bNativeOK;
+ Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) );
+ Region aNativeControlRegion, aNativeContentRegion;
+ if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString(),
+ aNativeControlRegion, aNativeContentRegion ) ) != FALSE )
+ {
+ nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ }
+ }
+
+ if ( nProgressHeight < PROGRESS_HEIGHT )
+ nProgressHeight = PROGRESS_HEIGHT;
+
+ aPos.X() -= ( RSC_SP_CTRL_GROUP_Y + PROGRESS_WIDTH );
+ m_aProgressBar.SetPosSizePixel( Point( aPos.X(), aPos.Y() + ((aBtnSize.Height()-nProgressHeight)/2) ),
+ Size( PROGRESS_WIDTH, nProgressHeight ) );
+
+ aFTSize.Width() = aPos.X() - 2*RSC_SP_DLG_INNERBORDER_LEFT;
+ aPos.X() = RSC_SP_DLG_INNERBORDER_LEFT;
+ aPos.Y() += ( aBtnSize.Height() - aFTSize.Height() - 1 ) / 2;
+ m_aProgressText.SetPosSizePixel( aPos, aFTSize );
+}
+
+//------------------------------------------------------------------------------
+// VCL::Dialog
+short UpdateRequiredDialog::Execute()
+{
+ if ( m_bHasLockedEntries )
+ {
+ // Set other text, disable update btn, remove not shared entries from list;
+ m_aUpdateNeeded.SetText( DialogHelper::getResourceString( RID_STR_NO_ADMIN_PRIVILEGE ) );
+ m_aCloseBtn.SetText( DialogHelper::getResourceString( RID_STR_EXIT_BTN ) );
+ m_aUpdateBtn.Enable( false );
+ m_pExtensionBox->RemoveUnlocked();
+ Resize();
+ }
+
+ return Dialog::Execute();
+}
+
+//------------------------------------------------------------------------------
+// VCL::Dialog
+BOOL UpdateRequiredDialog::Close()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !isBusy() )
+ {
+ if ( m_bHasLockedEntries )
+ EndDialog( -1 );
+ else if ( hasActiveEntries() )
+ disableAllEntries();
+ else
+ EndDialog( 0 );
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+// Check dependencies of all packages
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage ) const
+{
+ bool bRegistered = false;
+ try {
+ beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() ) );
+ if ( option.IsPresent )
+ {
+ ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
+ if ( reg.IsAmbiguous )
+ bRegistered = false;
+ else
+ bRegistered = reg.Value ? true : false;
+ }
+ else
+ bRegistered = false;
+ }
+ catch ( uno::RuntimeException & ) { throw; }
+ catch ( uno::Exception & exc) {
+ (void) exc;
+ OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ bRegistered = false;
+ }
+
+ return bRegistered;
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::XPackage > &xPackage ) const
+{
+ if ( isEnabled( xPackage ) )
+ {
+ bool bDependenciesValid = false;
+ try {
+ bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) {}
+ if ( ! bDependenciesValid )
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool UpdateRequiredDialog::hasActiveEntries()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ bool bRet = false;
+ long nCount = m_pExtensionBox->GetEntryCount();
+ for ( long nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+
+ if ( !checkDependencies( pEntry->m_xPackage ) )
+ {
+ bRet = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+//------------------------------------------------------------------------------
+void UpdateRequiredDialog::disableAllEntries()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ setBusy( true );
+
+ long nCount = m_pExtensionBox->GetEntryCount();
+ for ( long nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+ enablePackage( pEntry->m_xPackageManager, pEntry->m_xPackage, false );
+ }
+
+ setBusy( false );
+
+ if ( ! hasActiveEntries() )
+ m_aCloseBtn.SetText( m_sCloseText );
+}
+
+//=================================================================================
+// UpdateRequiredDialogService
+//=================================================================================
+UpdateRequiredDialogService::UpdateRequiredDialogService( uno::Sequence< uno::Any > const&,
+ uno::Reference< uno::XComponentContext > const& xComponentContext )
+ : m_xComponentContext( xComponentContext )
+{
+}
+
+//------------------------------------------------------------------------------
+// XExecutableDialog
+//------------------------------------------------------------------------------
+void UpdateRequiredDialogService::setTitle( OUString const & ) throw ( uno::RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 UpdateRequiredDialogService::execute() throw ( uno::RuntimeException )
+{
+ ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get(
+ m_xComponentContext,
+ uno::Reference< awt::XWindow >(),
+ OUString() ) );
+ xManager->createDialog( true );
+ sal_Int16 nRet = xManager->execute();
+
+ return nRet;
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
SelectedPackage::~SelectedPackage() {}
} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index a00183f..de8982a 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -46,20 +46,71 @@
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
+#include "cppuhelper/implbase1.hxx"
+
+#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
#include "com/sun/star/util/XModifyListener.hpp"
namespace dp_gui {
//==============================================================================
+class ExtBoxWithBtns_Impl;
class ExtensionBox_Impl;
class TheExtensionManager;
//==============================================================================
-class ExtMgrDialog : public ModelessDialog
+class DialogHelper
{
- ExtensionBox_Impl *m_pExtensionBox;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ Dialog* m_pVCLWindow;
+ ULONG m_nEventID;
+ bool m_bIsBusy;
+
+public:
+ DialogHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &,
+ Dialog *pWindow );
+ virtual ~DialogHelper();
+
+ void openWebBrowser( const ::rtl::OUString & sURL, const ::rtl::OUString & sTitle ) const;
+ Dialog* getWindow() const { return m_pVCLWindow; };
+ void PostUserEvent( const Link& rLink, void* pCaller );
+ void clearEventID() { m_nEventID = 0; }
+
+ virtual void showProgress( bool bStart ) = 0;
+ virtual void updateProgress( const ::rtl::OUString &rText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) = 0;
+ virtual void updateProgress( const long nProgress ) = 0;
+
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0;
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0;
+
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ) = 0;
+ virtual void checkEntries() = 0;
+
+ static ResId getResId( USHORT nId );
+ static String getResourceString( USHORT id );
+ static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &);
+ static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &,
+ Window *pParent,
+ const USHORT nResID,
+ bool &bHadWarning );
+
+ void setBusy( const bool bBusy ) { m_bIsBusy = bBusy; }
+ bool isBusy() const { return m_bIsBusy; }
+ bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
+ bool installForAllUsers( bool &bInstallForAll ) const;
+};
+
+//==============================================================================
+class ExtMgrDialog : public ModelessDialog,
+ public DialogHelper
+{
+ ExtBoxWithBtns_Impl *m_pExtensionBox;
PushButton m_aAddBtn;
PushButton m_aUpdateBtn;
OKButton m_aCloseBtn;
@@ -81,16 +132,12 @@ class ExtMgrDialog : public ModelessDialog
bool m_bEnableWarning;
bool m_bDisableWarning;
bool m_bDeleteWarning;
- bool m_bIsBusy;
long m_nProgress;
Timer m_aTimeoutTimer;
TheExtensionManager *m_pManager;
::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
- bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &,
- const USHORT nResID,
- bool &bHadWarning ) const;
bool removeExtensionWarn( const ::rtl::OUString &rExtensionTitle ) const;
DECL_DLLPRIVATE_LINK( HandleAddBtn, void * );
@@ -108,9 +155,16 @@ public:
virtual long Notify( NotifyEvent& rNEvt );
virtual BOOL Close();
+ virtual void showProgress( bool bStart );
+ virtual void updateProgress( const ::rtl::OUString &rText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel);
+ virtual void updateProgress( const long nProgress );
+
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
void setGetExtensionsURL( const ::rtl::OUString &rURL );
void selectEntry( long nPos );
- long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
@@ -120,27 +174,102 @@ public:
bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- bool isBusy() { return m_bIsBusy; }
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void checkEntries();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+};
+
+//==============================================================================
+class UpdateRequiredDialog : public ModalDialog,
+ public DialogHelper
+{
+ ExtensionBox_Impl *m_pExtensionBox;
+ FixedText m_aUpdateNeeded;
+ PushButton m_aUpdateBtn;
+ PushButton m_aCloseBtn;
+ HelpButton m_aHelpBtn;
+ CancelButton m_aCancelBtn;
+ FixedLine m_aDivider;
+ FixedText m_aProgressText;
+ ProgressBar m_aProgressBar;
+ const String m_sAddPackages;
+ const String m_sCloseText;
+ String m_sProgressText;
+ ::osl::Mutex m_aMutex;
+ bool m_bHasProgress;
+ bool m_bProgressChanged;
+ bool m_bStartProgress;
+ bool m_bStopProgress;
+ bool m_bUpdateWarning;
+ bool m_bDisableWarning;
+ bool m_bHasLockedEntries;
+ long m_nProgress;
+ Timer m_aTimeoutTimer;
+ TheExtensionManager *m_pManager;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
+
+ DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * );
+ DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * );
+ DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * );
+ DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer* );
+ DECL_DLLPRIVATE_LINK( startProgress, void * );
+ DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * );
- void showProgress( bool bStart );
- void updateProgress( const ::rtl::OUString &rText,
+ bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
+ bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
+ bool hasActiveEntries();
+ void disableAllEntries();
+
+public:
+ UpdateRequiredDialog( Window * pParent, TheExtensionManager *pManager );
+ virtual ~UpdateRequiredDialog();
+
+ virtual short Execute();
+ virtual void Resize();
+ virtual BOOL Close();
+// virtual long Notify( NotifyEvent& rNEvt );
+
+ virtual void showProgress( bool bStart );
+ virtual void updateProgress( const ::rtl::OUString &rText,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel);
- void updateProgress( const long nProgress );
- void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ virtual void updateProgress( const long nProgress );
- void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
- void checkEntries();
+ virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void selectEntry( long nPos );
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
+ bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ bool bEnable );
+ bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- void openWebBrowser( ::rtl::OUString const &sURL ) const;
+ virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void checkEntries();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
bool installForAllUsers( bool &bInstallForAll ) const;
bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
+};
- static ResId getResId( USHORT id );
- static String getResourceString( USHORT id );
- static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &);
+//==============================================================================
+class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParent;
+ ::rtl::OUString m_sInitialTitle;
+
+public:
+ UpdateRequiredDialogService( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xComponentContext );
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( rtl::OUString const & title ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL execute() throw ( ::com::sun::star::uno::RuntimeException );
};
} // namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src
index 949c396..bac9299 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.src
@@ -97,6 +97,66 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER
};
};
+ModalDialog RID_DLG_UPDATE_REQUIRED
+{
+ HelpId = HID_PACKAGE_MANAGER_UPD_REQ;
+ Text [ en-US ] = "Extension Update Required";
+
+ Size = MAP_APPFONT( 300, 200 );
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = TRUE;
+ Sizeable = TRUE;
+ Hide = TRUE;
+
+ FixedText RID_EM_FT_MSG
+ {
+ Text [ en-US ] = "%PRODUCTNAME has been updated to a new version. Some installed %PRODUCTNAME extensions are not compatible with this version and need to be updated before they can be used.";
+ WordBreak = TRUE;
+ NoLabel = TRUE;
+ Size = MAP_APPFONT( 280, 3*RSC_BS_CHARHEIGHT );
+ Pos = MAP_APPFONT( 5, 5 );
+ };
+
+ FixedText RID_EM_FT_PROGRESS
+ {
+ Hide = TRUE;
+ Right = TRUE;
+ Text [ en-US ] = "Adding %EXTENSION_NAME";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ };
+
+ HelpButton RID_EM_BTN_HELP
+ {
+ TabStop = TRUE;
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ PushButton RID_EM_BTN_CHECK_UPDATES
+ {
+ TabStop = TRUE;
+ Text [ en-US ] = "Check for ~Updates...";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ PushButton RID_EM_BTN_CLOSE
+ {
+ TabStop = TRUE;
+ DefButton = TRUE;
+ Text [ en-US ] = "Disable all";
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+ CancelButton RID_EM_BTN_CANCEL
+ {
+ TabStop = TRUE;
+ Hide = TRUE;
+ Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+
+};
+
Image RID_IMG_WARNING
{
ImageBitmap = Bitmap { File = "caution_16.png"; };
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index c5ad877..f31d63a 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -136,7 +136,7 @@ class ProgressCmdEnv
uno::Reference< uno::XComponentContext > m_xContext;
uno::Reference< task::XAbortChannel> m_xAbortChannel;
- ExtMgrDialog *m_pDialog;
+ DialogHelper *m_pDialogHelper;
OUString m_sTitle;
bool m_bAborted;
bool m_bWarnUser;
@@ -157,16 +157,16 @@ public:
*/
ProgressCmdEnv( const uno::Reference< uno::XComponentContext > rContext,
- ExtMgrDialog *pDialog,
+ DialogHelper *pDialogHelper,
const OUString &rTitle )
: m_xContext( rContext ),
- m_pDialog( pDialog ),
+ m_pDialogHelper( pDialogHelper ),
m_sTitle( rTitle ),
m_bAborted( false ),
m_bWarnUser( false )
{}
- Dialog * activeDialog() { return m_pDialog; }
+ Dialog * activeDialog() { return m_pDialogHelper->getWindow(); }
void setTitle( const OUString& rNewTitle ) { m_sTitle = rNewTitle; }
void startProgress();
@@ -197,14 +197,14 @@ public:
//------------------------------------------------------------------------------
struct ExtensionCmd
{
- enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATE, CHECK_FOR_UPDATES };
+ enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES };
E_CMD_TYPE m_eCmdType;
bool m_bWarnUser;
OUString m_sExtensionURL;
uno::Reference< deployment::XPackageManager > m_xPackageManager;
uno::Reference< deployment::XPackage > m_xPackage;
- uno::Sequence< uno::Reference< deployment::XPackageManager > > m_xPackageManagers;
+ std::vector< TUpdateListEntry > m_vExtensionList;
ExtensionCmd( const E_CMD_TYPE eCommand,
const uno::Reference< deployment::XPackageManager > &rPackageManager,
@@ -227,10 +227,10 @@ struct ExtensionCmd
m_bWarnUser( false ),
m_xPackage( rPackage ) {};
ExtensionCmd( const E_CMD_TYPE eCommand,
- const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
+ const std::vector< TUpdateListEntry > &vExtensionList )
: m_eCmdType( eCommand ),
m_bWarnUser( false ),
- m_xPackageManagers( rPackageManagers ) {};
+ m_vExtensionList( vExtensionList ) {};
};
typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd;
@@ -239,7 +239,7 @@ typedef ::boost::shared_ptr< ExtensionCmd > TExtensionCmd;
class ExtensionCmdQueue::Thread: public dp_gui::Thread
{
public:
- Thread( ExtMgrDialog *pDialog,
+ Thread( DialogHelper *pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > & rContext );
@@ -250,9 +250,7 @@ public:
const uno::Reference< deployment::XPackage > &rPackage );
void enableExtension( const uno::Reference< deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers );
- void checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage );
+ void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
void stop();
bool hasTerminated();
bool isBusy();
@@ -280,16 +278,14 @@ private:
const uno::Reference< deployment::XPackage > &xPackage );
void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
const uno::Reference< deployment::XPackage > &xPackage );
- void _checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage );
+ void _checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
enum Input { NONE, START, STOP };
uno::Reference< uno::XComponentContext > m_xContext;
std::queue< TExtensionCmd > m_queue;
- ExtMgrDialog *m_pDialog;
+ DialogHelper *m_pDialogHelper;
TheExtensionManager *m_pManager;
const OUString m_sEnablingPackages;
@@ -310,13 +306,15 @@ void ProgressCmdEnv::startProgress()
{
m_nCurrentProgress = 0;
- m_pDialog->showProgress( true );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->showProgress( true );
}
//------------------------------------------------------------------------------
void ProgressCmdEnv::stopProgress()
{
- m_pDialog->showProgress( false );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->showProgress( false );
}
//------------------------------------------------------------------------------
@@ -327,8 +325,11 @@ void ProgressCmdEnv::progressSection( const OUString &rText,
if (! m_bAborted)
{
m_nCurrentProgress = 0;
- m_pDialog->updateProgress( rText, xAbortChannel );
- m_pDialog->updateProgress( 5 );
+ if ( m_pDialogHelper )
+ {
+ m_pDialogHelper->updateProgress( rText, xAbortChannel );
+ m_pDialogHelper->updateProgress( 5 );
+ }
}
}
@@ -338,7 +339,8 @@ void ProgressCmdEnv::updateProgress()
if ( ! m_bAborted )
{
long nProgress = ((m_nCurrentProgress*5) % 100) + 5;
- m_pDialog->updateProgress( nProgress );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updateProgress( nProgress );
}
}
@@ -434,7 +436,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
}
{
vos::OGuard guard(Application::GetSolarMutex());
- short n = DependencyDialog( m_pDialog, deps ).Execute();
+ short n = DependencyDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, deps ).Execute();
// Distinguish between closing the dialog and programatically
// canceling the dialog (headless VCL):
approve = n == RET_OK
@@ -445,19 +447,19 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
ResId warnId(WARNINGBOX_NOSHAREDALLOWED, *DeploymentGuiResMgr::get());
- WarningBox warn( m_pDialog, warnId);
+ WarningBox warn( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, warnId);
String msgText = warn.GetMessText();
msgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
msgText.SearchAndReplaceAllAscii("%NAME", licAgreementExc.ExtensionName);
warn.SetMessText(msgText);
warn.Execute();
- abort = true;
+ abort = true;
}
else if (request >>= licExc)
{
uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
deployment::ui::LicenseDialog::create(
- m_xContext, VCLUnoHelper::GetInterface( m_pDialog ), licExc.Text ) );
+ m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), licExc.Text ) );
sal_Int16 res = xDialog->execute();
if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
abort = true;
@@ -488,7 +490,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
verExc.Deployed->getDisplayName());
{
vos::OGuard guard(Application::GetSolarMutex());
- WarningBox box( m_pDialog, ResId(id, *DeploymentGuiResMgr::get()));
+ WarningBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get()));
String s;
if (bEqualNames)
{
@@ -526,9 +528,14 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
}
else
{
- vos::OGuard guard(Application::GetSolarMutex());
-
- approve = m_pDialog->installExtensionWarn( instExc.New->getDisplayName() );
+ if ( m_pDialogHelper )
+ {
+ vos::OGuard guard(Application::GetSolarMutex());
+
+ approve = m_pDialogHelper->installExtensionWarn( instExc.New->getDisplayName() );
+ }
+ else
+ approve = false;
abort = !approve;
}
}
@@ -537,7 +544,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
vos::OGuard guard( Application::GetSolarMutex() );
String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get() ) );
sMsg.SearchAndReplaceAllAscii( "%Name", platExc.package->getDisplayName() );
- ErrorBox box( m_pDialog, WB_OK, sMsg );
+ ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, sMsg );
box.Execute();
approve = true;
}
@@ -609,7 +616,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
text = ::comphelper::anyToString( rStatus ); // fallback
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
- const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialog, WB_OK, text ) );
+ const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, text ) );
aBox->Execute();
}
++m_nCurrentProgress;
@@ -631,23 +638,23 @@ void ProgressCmdEnv::pop()
}
//------------------------------------------------------------------------------
-ExtensionCmdQueue::Thread::Thread( ExtMgrDialog *pDialog,
+ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > & rContext ) :
m_xContext( rContext ),
- m_pDialog( pDialog ),
+ m_pDialogHelper( pDialogHelper ),
m_pManager( pManager ),
- m_sEnablingPackages( ExtMgrDialog::getResourceString( RID_STR_ENABLING_PACKAGES ) ),
- m_sDisablingPackages( ExtMgrDialog::getResourceString( RID_STR_DISABLING_PACKAGES ) ),
- m_sAddingPackages( ExtMgrDialog::getResourceString( RID_STR_ADDING_PACKAGES ) ),
- m_sRemovingPackages( ExtMgrDialog::getResourceString( RID_STR_REMOVING_PACKAGES ) ),
- m_sDefaultCmd( ExtMgrDialog::getResourceString( RID_STR_ADD_PACKAGES ) ),
+ m_sEnablingPackages( DialogHelper::getResourceString( RID_STR_ENABLING_PACKAGES ) ),
+ m_sDisablingPackages( DialogHelper::getResourceString( RID_STR_DISABLING_PACKAGES ) ),
+ m_sAddingPackages( DialogHelper::getResourceString( RID_STR_ADDING_PACKAGES ) ),
+ m_sRemovingPackages( DialogHelper::getResourceString( RID_STR_REMOVING_PACKAGES ) ),
+ m_sDefaultCmd( DialogHelper::getResourceString( RID_STR_ADD_PACKAGES ) ),
m_eInput( NONE ),
m_bTerminated( false ),
m_bStopped( false ),
m_bWorking( false )
{
- OSL_ASSERT( pDialog );
+ OSL_ASSERT( pDialogHelper );
}
//------------------------------------------------------------------------------
@@ -713,41 +720,21 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
+void ExtensionCmdQueue::Thread::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
::osl::MutexGuard aGuard( m_mutex );
- //If someone called stop then we do not remove the extension -> game over!
+ //If someone called stop then we do not update the extension -> game over!
if ( m_bStopped )
return;
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, rPackageManagers ) );
+ TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATES, vExtensionList ) );
m_queue.push( pEntry );
m_eInput = START;
m_wakeup.set();
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
-{
- ::osl::MutexGuard aGuard( m_mutex );
-
- //If someone called stop then we do not remove the extension -> game over!
- if ( m_bStopped )
- return;
-
- if ( rPackageManager.is() && rPackage.is() )
- {
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::CHECK_FOR_UPDATE, rPackageManager, rPackage ) );
-
- m_queue.push( pEntry );
- m_eInput = START;
- m_wakeup.set();
- }
-}
-
-//------------------------------------------------------------------------------
//Stopping this thread will not abort the installation of extensions.
void ExtensionCmdQueue::Thread::stop()
{
@@ -779,7 +766,7 @@ void ExtensionCmdQueue::Thread::execute()
{
#ifdef WNT
//Needed for use of the service "com.sun.star.system.SystemShellExecute" in
- //ExtMgrDialog::openWebBrowser
+ //DialogHelper::openWebBrowser
CoUninitialize();
HRESULT r = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
#endif
@@ -813,7 +800,7 @@ void ExtensionCmdQueue::Thread::execute()
if ( eInput == STOP )
break;
- ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialog, m_sDefaultCmd ) );
+ ::rtl::Reference< ProgressCmdEnv > currentCmdEnv( new ProgressCmdEnv( m_xContext, m_pDialogHelper, m_sDefaultCmd ) );
// Do not lock the following part with addExtension. addExtension may be called in the main thread.
// If the message box "Do you want to install the extension (or similar)" is shown and then
@@ -836,8 +823,7 @@ void ExtensionCmdQueue::Thread::execute()
m_queue.pop();
}
- if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATE ) &&
- ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) )
+ if ( bStartProgress && ( pEntry->m_eCmdType != ExtensionCmd::CHECK_FOR_UPDATES ) )
{
currentCmdEnv->startProgress();
bStartProgress = false;
@@ -856,9 +842,8 @@ void ExtensionCmdQueue::Thread::execute()
case ExtensionCmd::DISABLE :
_disableExtension( currentCmdEnv, pEntry->m_xPackage );
break;
- case ExtensionCmd::CHECK_FOR_UPDATE :
case ExtensionCmd::CHECK_FOR_UPDATES :
- _checkForUpdates( pEntry->m_xPackageManagers, pEntry->m_xPackageManager, pEntry->m_xPackage );
+ _checkForUpdates( pEntry->m_vExtensionList );
break;
}
}
@@ -908,7 +893,8 @@ void ExtensionCmdQueue::Thread::execute()
const ::vos::OGuard guard( Application::GetSolarMutex() );
::std::auto_ptr<ErrorBox> box(
new ErrorBox( currentCmdEnv->activeDialog(), WB_OK, msg ) );
- box->SetText( m_pDialog->GetText() );
+ if ( m_pDialogHelper )
+ box->SetText( m_pDialogHelper->getWindow()->GetText() );
box->Execute();
//Continue with installation of the remaining extensions
}
@@ -1009,21 +995,14 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
UpdateDialog* pUpdateDialog;
std::vector< UpdateData > vData;
const ::vos::OGuard guard( Application::GetSolarMutex() );
- if ( xPackageManager.is() && xPackage.is() )
- pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, new SelectedPackage( xPackage, xPackageManager ),
- uno::Sequence< uno::Reference< deployment::XPackageManager > >(), &vData );
- else
- pUpdateDialog = new UpdateDialog( m_xContext, m_pDialog, rtl::Reference< SelectedPackage >(),
- rPackageManagers, &vData );
+ pUpdateDialog = new UpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, vExtensionList, &vData );
pUpdateDialog->notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon
@@ -1046,7 +1025,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe
short nDialogResult = RET_OK;
if ( !dataDownload.empty() )
{
- nDialogResult = UpdateInstallDialog( m_pDialog, dataDownload, m_xContext ).Execute();
+ nDialogResult = UpdateInstallDialog( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, dataDownload, m_xContext ).Execute();
pUpdateDialog->notifyMenubar( false, true ); // Check, if there are still pending updates to be notified via menu bar icon
}
else
@@ -1057,8 +1036,8 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( const uno::Sequence< uno::Refe
{
for ( cit i = vData.begin(); i < vData.end(); i++ )
{
- if ( i->sWebsiteURL.getLength() > 0 )
- m_pDialog->openWebBrowser( i->sWebsiteURL );
+ if ( m_pDialogHelper && ( i->sWebsiteURL.getLength() > 0 ) )
+ m_pDialogHelper->openWebBrowser( i->sWebsiteURL, m_pDialogHelper->getWindow()->GetText() );
}
}
}
@@ -1082,7 +1061,8 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE
try
{
xPackage->registerPackage( xAbortChannel, rCmdEnv.get() );
- m_pDialog->updatePackageInfo( xPackage );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updatePackageInfo( xPackage );
}
catch ( ::ucb::CommandAbortedException & )
{}
@@ -1102,7 +1082,8 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd
try
{
xPackage->revokePackage( xAbortChannel, rCmdEnv.get() );
- m_pDialog->updatePackageInfo( xPackage );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updatePackageInfo( xPackage );
}
catch ( ::ucb::CommandAbortedException & )
{}
@@ -1139,10 +1120,10 @@ OUString ExtensionCmdQueue::Thread::searchAndReplaceAll( const OUString &rSource
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-ExtensionCmdQueue::ExtensionCmdQueue( ExtMgrDialog * pDialog,
+ExtensionCmdQueue::ExtensionCmdQueue( DialogHelper * pDialogHelper,
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > &rContext )
- : m_thread( new Thread( pDialog, pManager, rContext ) )
+ : m_thread( new Thread( pDialogHelper, pManager, rContext ) )
{
m_thread->launch();
}
@@ -1170,15 +1151,9 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack
m_thread->enableExtension( rPackage, bEnable );
}
-void ExtensionCmdQueue::checkForUpdates( const uno::Sequence< uno::Reference< deployment::XPackageManager > > &rPackageManagers )
-{
- m_thread->checkForUpdates( rPackageManagers );
-}
-
-void ExtensionCmdQueue::checkForUpdate( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
+void ExtensionCmdQueue::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
{
- m_thread->checkForUpdate( rPackageManager, rPackage );
+ m_thread->checkForUpdates( vExtensionList );
}
void ExtensionCmdQueue::stop()
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
index 08c4eae..853ce94 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
@@ -32,19 +32,14 @@
#ifndef INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX
#define INCLUDED_DP_GUI_EXTENSIONCMDQUEUE_HXX
-#ifndef _SAL_CONFIG_H_
#include "sal/config.h"
-#endif
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include "com/sun/star/uno/Reference.hxx"
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
-#include "com/sun/star/uno/Sequence.hxx"
-#endif
-#ifndef _RTL_REF_HXX_
#include "rtl/ref.hxx"
-#endif
+
+#include <vector>
+
+#include "dp_gui_updatedata.hxx"
/// @HTML
@@ -56,7 +51,7 @@ namespace com { namespace sun { namespace star {
namespace dp_gui {
-class ExtMgrDialog;
+class DialogHelper;
class TheExtensionManager;
/**
@@ -79,7 +74,7 @@ public:
/**
Create an instance.
*/
- ExtensionCmdQueue( ExtMgrDialog * pDialog,
+ ExtensionCmdQueue( DialogHelper * pDialogHelper,
TheExtensionManager *pManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext);
@@ -94,9 +89,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > > &rPackageManagers );
- void checkForUpdate( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
+ void checkForUpdates( const std::vector< TUpdateListEntry > &vList );
/**
This call does not block. It signals the internal thread
that it should install the remaining extensions and then terminate.
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
new file mode 100644
index 0000000..f4473c2
--- /dev/null
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -0,0 +1,1175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_desktop.hxx"
+
+#include "svtools/controldims.hrc"
+
+#include "dp_gui.h"
+#include "dp_gui_extlistbox.hxx"
+#include "dp_gui_theextmgr.hxx"
+#include "dp_gui_dialog2.hxx"
+#include "dp_dependencies.hxx"
+
+#include "comphelper/processfactory.hxx"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/deployment/DependencyException.hpp"
+#include "com/sun/star/deployment/DeploymentException.hpp"
+
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+using namespace ::com::sun::star;
+
+namespace dp_gui {
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager,
+ PackageState eState ) :
+ m_bActive( false ),
+ m_bLocked( false ),
+ m_bHasOptions( false ),
+ m_bShared( false ),
+ m_bNew( false ),
+ m_bChecked( false ),
+ m_bMissingDeps( false ),
+ m_eState( eState ),
+ m_pPublisher( NULL ),
+ m_xPackage( xPackage ),
+ m_xPackageManager( xPackageManager )
+{
+ m_sTitle = xPackage->getDisplayName();
+ m_sVersion = xPackage->getVersion();
+ m_sDescription = xPackage->getDescription();
+
+ beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
+ m_sPublisher = aInfo.First;
+ m_sPublisherURL = aInfo.Second;
+
+ // get the icons for the package if there are any
+ uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
+ if ( xGraphic.is() )
+ m_aIcon = Image( xGraphic );
+
+ xGraphic = xPackage->getIcon( true );
+ if ( xGraphic.is() )
+ m_aIconHC = Image( xGraphic );
+ else
+ m_aIconHC = m_aIcon;
+
+ m_bLocked = m_xPackageManager->isReadOnly();
+
+ if ( eState == AMBIGUOUS )
+ m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else if ( eState == NOT_REGISTERED )
+ checkDependencies();
+}
+
+//------------------------------------------------------------------------------
+Entry_Impl::~Entry_Impl()
+{}
+
+//------------------------------------------------------------------------------
+StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
+{
+ StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
+ if ( eCompare == COMPARE_EQUAL )
+ {
+ if ( m_xPackageManager != pEntry->m_xPackageManager )
+ {
+ sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
+ if ( nCompare < 0 )
+ eCompare = COMPARE_LESS;
+ else if ( nCompare > 0 )
+ eCompare = COMPARE_GREATER;
+ }
+ }
+ }
+ return eCompare;
+}
+
+//------------------------------------------------------------------------------
+void Entry_Impl::checkDependencies()
+{
+ try {
+ m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException &e )
+ {
+ deployment::DependencyException depExc;
+ if ( e.Cause >>= depExc )
+ {
+ rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
+ for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
+ {
+ aMissingDep += OUSTR("\n");
+ aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
+ }
+ aMissingDep += OUSTR("\n");
+ m_sErrorText = aMissingDep;
+ m_bMissingDeps = true;
+ }
+ }
+}
+//------------------------------------------------------------------------------
+// ExtensionRemovedListener
+//------------------------------------------------------------------------------
+void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
+
+ if ( xPackage.is() )
+ {
+ m_pParent->removeEntry( xPackage );
+ }
+}
+
+//------------------------------------------------------------------------------
+ExtensionRemovedListener::~ExtensionRemovedListener()
+{
+}
+
+//------------------------------------------------------------------------------
+// ExtensionBox_Impl
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
+ IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
+ m_bHasScrollBar( false ),
+ m_bHasActive( false ),
+ m_bNeedsRecalc( true ),
+ m_bHasNew( false ),
+ m_bInCheckMode( false ),
+ m_bAdjustActive( false ),
+ m_bInDelete( false ),
+ m_nActive( 0 ),
+ m_nTopIndex( 0 ),
+ m_nActiveHeight( 0 ),
+ m_nExtraHeight( 2 ),
+ m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
+ m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
+ m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
+ m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
+ m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
+ m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
+ m_pScrollBar( NULL ),
+ m_pManager( pManager )
+{
+ SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
+
+ m_pScrollBar = new ScrollBar( this, WB_VERT );
+ m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
+ m_pScrollBar->EnableDrag();
+
+ SetPaintTransparent( true );
+ SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ m_nStdHeight = nTitleHeight;
+ else
+ m_nStdHeight = nIconHeight;
+ m_nStdHeight += GetTextHeight() + TOP_OFFSET;
+
+ nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
+ if ( m_nStdHeight < nIconHeight )
+ m_nStdHeight = nIconHeight;
+
+ m_nActiveHeight = m_nStdHeight;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ m_xRemoveListener = new ExtensionRemovedListener( this );
+
+ m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
+ m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ Show();
+}
+
+//------------------------------------------------------------------------------
+ExtensionBox_Impl::~ExtensionBox_Impl()
+{
+ if ( ! m_bInDelete )
+ DeleteRemoved();
+
+ m_bInDelete = true;
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+ }
+
+ m_vEntries.clear();
+
+ delete m_pScrollBar;
+
+ m_xRemoveListener.clear();
+
+ delete m_pLocale;
+ delete m_pCollator;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getItemCount() const
+{
+ return static_cast< sal_Int32 >( m_vEntries.size() );
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 ExtensionBox_Impl::getSelIndex() const
+{
+ if ( m_bHasActive )
+ {
+ OSL_ASSERT( m_nActive >= -1);
+ return static_cast< sal_Int32 >( m_nActive );
+ }
+ else
+ return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
+{
+ if ( nIndex < 0 )
+ throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
+ if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
+ throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
+ "The position exceeds the number of available list entries"),0, 0 );
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sTitle;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sVersion;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sDescription;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisher;
+}
+
+//------------------------------------------------------------------------------
+rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ return m_vEntries[ nIndex ]->m_sPublisherURL;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( sal_Int32 nIndex )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ checkIndex( nIndex );
+ selectEntry( nIndex );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::select( const rtl::OUString & sName )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+ typedef ::std::vector< TEntry_Impl >::const_iterator It;
+
+ for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
+ {
+ if ( sName.equals( (*iIter)->m_sTitle ) )
+ {
+ long nPos = iIter - m_vEntries.begin();
+ selectEntry( nPos );
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+// Title + description
+void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ // get title height
+ long aTextHeight;
+ long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // calc description height
+ Size aSize = GetOutputSizePixel();
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ aSize.Width() -= ICON_OFFSET;
+ aSize.Height() = 10000;
+
+ rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
+ aText += m_vEntries[ nPos ]->m_sDescription;
+
+ Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
+ TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ aTextHeight += aRect.GetHeight();
+
+ if ( aTextHeight < m_nStdHeight )
+ aTextHeight = m_nStdHeight;
+
+ m_nActiveHeight = aTextHeight + m_nExtraHeight;
+}
+
+//------------------------------------------------------------------------------
+const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
+{
+ return Size( 200, 80 );
+}
+
+//------------------------------------------------------------------------------
+Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ if ( m_vEntries[ nPos ]->m_bActive )
+ aSize.Height() = m_nActiveHeight;
+ else
+ aSize.Height() = m_nStdHeight;
+
+ Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
+ if ( m_bHasActive && ( nPos < m_nActive ) )
+ aPos.Y() += m_nActiveHeight - m_nStdHeight;
+
+ return Rectangle( aPos, aSize );
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::DeleteRemoved()
+{
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ m_bInDelete = true;
+
+ if ( ! m_vRemovedEntries.empty() )
+ {
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_pPublisher )
+ {
+ delete (*iIndex)->m_pPublisher;
+ (*iIndex)->m_pPublisher = NULL;
+ }
+ }
+
+ m_vRemovedEntries.clear();
+ }
+
+ m_bInDelete = false;
+}
+
+//------------------------------------------------------------------------------
+//This function may be called with nPos < 0
+void ExtensionBox_Impl::selectEntry( const long nPos )
+{
+ //ToDo whe should not use the guard at such a big scope here.
+ //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
+ //modified in this function.
+ //It would be probably best to always use a copy of m_vEntries
+ //and some other state variables from ExtensionBox_Impl for
+ //the whole painting operation. See issue i86993
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+
+ if ( m_bInCheckMode )
+ return;
+
+ if ( m_bHasActive )
+ {
+ if ( nPos == m_nActive )
+ return;
+
+ m_bHasActive = false;
+ m_vEntries[ m_nActive ]->m_bActive = false;
+ }
+
+ if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
+ {
+ m_bHasActive = true;
+ m_nActive = nPos;
+ m_vEntries[ nPos ]->m_bActive = true;
+
+ if ( IsReallyVisible() )
+ {
+ m_bNeedsRecalc = true;
+ m_bAdjustActive = true;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ guard.clear();
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( pEntry->m_bActive )
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ else if ( IsControlForeground() )
+ SetTextColor( GetControlForeground() );
+ else
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+
+ if ( pEntry->m_bActive )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( rRect );
+ }
+ else
+ {
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFieldColor() );
+
+ SetTextFillColor();
+ Erase( rRect );
+ }
+
+ // Draw extension icon
+ Point aPos( rRect.TopLeft() );
+ aPos += Point( TOP_OFFSET, TOP_OFFSET );
+ Image aImage;
+ if ( ! pEntry->m_aIcon )
+ aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
+ else
+ aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
+ Size aImageSize = aImage.GetSizePixel();
+ if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
+ DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
+ else
+ DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
+
+ // Setup fonts
+ Font aStdFont( GetFont() );
+ Font aBoldFont( aStdFont );
+ aBoldFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aBoldFont );
+ long aTextHeight = GetTextHeight();
+
+ // Init publisher link here
+ if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
+ {
+ pEntry->m_pPublisher = new svt::FixedHyperlink( this );
+ pEntry->m_pPublisher->SetBackground();
+ pEntry->m_pPublisher->SetPaintTransparent( true );
+ pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
+ pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
+ Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
+ pEntry->m_pPublisher->SetSizePixel( aSize );
+
+ if ( m_aClickHdl.IsSet() )
+ pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
+ }
+
+ // Get max title width
+ long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
+ nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
+ if ( pEntry->m_pPublisher )
+ {
+ nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
+ }
+
+ long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
+ long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
+
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
+
+ if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
+ {
+ aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
+ String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
+ DrawText( aPos, aShortTitle );
+ aTitleWidth += (aTextHeight / 3);
+ }
+ else
+ DrawText( aPos, pEntry->m_sTitle );
+
+ SetFont( aStdFont );
+ DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
+
+ long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
+ long nTitleHeight = TOP_OFFSET + GetTextHeight();
+ if ( nIconHeight < nTitleHeight )
+ aTextHeight = nTitleHeight;
+ else
+ aTextHeight = nIconHeight;
+
+ // draw description
+ String sDescription;
+ if ( pEntry->m_sErrorText.Len() )
+ {
+ if ( pEntry->m_bActive )
+ sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
+ else
+ sDescription = pEntry->m_sErrorText;
+ }
+ else
+ sDescription = pEntry->m_sDescription;
+
+ aPos.Y() += aTextHeight;
+ if ( pEntry->m_bActive )
+ {
+ DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
+ sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ }
+ else
+ {
+ const long nWidth = GetTextWidth( sDescription );
+ if ( nWidth > rRect.GetWidth() - aPos.X() )
+ sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
+ DrawText( aPos, sDescription );
+ }
+
+ // Draw publisher link
+ if ( pEntry->m_pPublisher )
+ {
+ pEntry->m_pPublisher->Show();
+ aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
+ pEntry->m_pPublisher->SetPosPixel( aPos );
+ }
+
+ // Draw status icons
+ if ( pEntry->m_bShared )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
+ }
+ if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
+ {
+ aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
+ DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
+ }
+
+ SetLineColor( Color( COL_LIGHTGRAY ) );
+ DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::RecalcAll()
+{
+ if ( m_bHasActive )
+ CalcActiveHeight( m_nActive );
+
+ SetupScrollBar();
+
+ if ( m_bHasActive )
+ {
+ Rectangle aEntryRect = GetEntryRect( m_nActive );
+
+ if ( m_bAdjustActive )
+ {
+ m_bAdjustActive = false;
+
+ // If the top of the selected entry isn't visible, make it visible
+ if ( aEntryRect.Top() < 0 )
+ {
+ m_nTopIndex += aEntryRect.Top();
+ aEntryRect.Move( 0, -aEntryRect.Top() );
+ }
+
+ // If the bottom of the selected entry isn't visible, make it visible even if now the top
+ // isn't visible any longer ( the buttons are more important )
+ Size aOutputSize = GetOutputSizePixel();
+ if ( aEntryRect.Bottom() > aOutputSize.Height() )
+ {
+ m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
+ aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
+ }
+
+ // If there is unused space below the last entry but all entries don't fit into the box,
+ // move the content down to use the whole space
+ const long nTotalHeight = GetTotalHeight();
+ if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
+ {
+ long nOffset = m_nTopIndex;
+ m_nTopIndex = nTotalHeight - aOutputSize.Height();
+ nOffset -= m_nTopIndex;
+ aEntryRect.Move( 0, nOffset );
+ }
+
+ if ( m_bHasScrollBar )
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+ }
+ }
+
+ m_bNeedsRecalc = false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleTabKey( bool )
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------
+bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
+{
+ if ( m_vEntries.empty() )
+ return true;
+
+ long nSelect = 0;
+
+ if ( m_bHasActive )
+ {
+ long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
+ if ( nPageSize < 2 )
+ nPageSize = 2;
+
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
+ nSelect = m_nActive + 1;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
+ nSelect = m_nActive - 1;
+ else if ( nKeyCode == KEY_HOME )
+ nSelect = 0;
+ else if ( nKeyCode == KEY_END )
+ nSelect = m_vEntries.size() - 1;
+ else if ( nKeyCode == KEY_PAGEUP )
+ nSelect = m_nActive - nPageSize + 1;
+ else if ( nKeyCode == KEY_PAGEDOWN )
+ nSelect = m_nActive + nPageSize - 1;
+ }
+ else // when there is no selected entry, we will select the first or the last.
+ {
+ if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
+ nSelect = 0;
+ else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
+ nSelect = m_vEntries.size() - 1;
+ }
+
+ if ( nSelect < 0 )
+ nSelect = 0;
+ if ( nSelect >= (long) m_vEntries.size() )
+ nSelect = m_vEntries.size() - 1;
+
+ selectEntry( nSelect );
+
+ return true;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ if ( m_bNeedsRecalc )
+ RecalcAll();
+
+ Point aStart( 0, -m_nTopIndex );
+ Size aSize( GetOutputSizePixel() );
+
+ if ( m_bHasScrollBar )
+ aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
+
+ const ::osl::MutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
+ Rectangle aEntryRect( aStart, aSize );
+ DrawRow( aEntryRect, *iIndex );
+ aStart.Y() += aSize.Height();
+ }
+}
+
+// -----------------------------------------------------------------------
+long ExtensionBox_Impl::GetTotalHeight() const
+{
+ long nHeight = m_vEntries.size() * m_nStdHeight;
+
+ if ( m_bHasActive )
+ {
+ nHeight += m_nActiveHeight - m_nStdHeight;
+ }
+
+ return nHeight;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::SetupScrollBar()
+{
+ const Size aSize = GetOutputSizePixel();
+ const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ const long nTotalHeight = GetTotalHeight();
+ const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
+
+ if ( bNeedsScrollBar )
+ {
+ if ( m_nTopIndex + aSize.Height() > nTotalHeight )
+ m_nTopIndex = nTotalHeight - aSize.Height();
+
+ m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+ Size( nScrBarSize, aSize.Height() ) );
+ m_pScrollBar->SetRangeMax( nTotalHeight );
+ m_pScrollBar->SetVisibleSize( aSize.Height() );
+ m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+ m_pScrollBar->SetLineSize( m_nStdHeight );
+ m_pScrollBar->SetThumbPos( m_nTopIndex );
+
+ if ( !m_bHasScrollBar )
+ m_pScrollBar->Show();
+ }
+ else if ( m_bHasScrollBar )
+ {
+ m_pScrollBar->Hide();
+ m_nTopIndex = 0;
+ }
+
+ m_bHasScrollBar = bNeedsScrollBar;
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::Resize()
+{
+ RecalcAll();
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::PointToPos( const Point& rPos )
+{
+ long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
+
+ if ( m_bHasActive && ( nPos > m_nActive ) )
+ {
+ if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
+ nPos = m_nActive;
+ else
+ nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
+ }
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ long nPos = PointToPos( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.IsMod1() && m_bHasActive )
+ selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
+ else
+ selectEntry( nPos );
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if ( !m_bInDelete )
+ DeleteRemoved();
+
+ bool bHandled = false;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( nKeyCode == KEY_TAB )
+ bHandled = HandleTabKey( aKeyCode.IsShift() );
+ else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
+ bHandled = HandleCursorKey( nKeyCode );
+ }
+
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ if ( m_bHasScrollBar &&
+ ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ long nThumbPos = m_pScrollBar->GetThumbPos();
+ if ( pData->GetDelta() < 0 )
+ m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
+ else
+ m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
+ bHandled = true;
+ }
+ }
+ }
+
+ if ( !bHandled )
+ return Control::Notify( rNEvt );
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
+ const long nEnd, long &nPos )
+{
+ nPos = nStart;
+ if ( nStart > nEnd )
+ return false;
+
+ StringCompare eCompare;
+
+ if ( nStart == nEnd )
+ {
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+ if ( eCompare == COMPARE_LESS )
+ return false;
+ else if ( eCompare == COMPARE_EQUAL )
+ {
+ //Workaround. See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nStart ]->m_bChecked = true;
+ return true;
+ }
+ else
+ {
+ nPos = nStart + 1;
+ return false;
+ }
+ }
+
+ const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
+ eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+
+ if ( eCompare == COMPARE_LESS )
+ return FindEntryPos( pEntry, nStart, nMid-1, nPos );
+ else if ( eCompare == COMPARE_GREATER )
+ return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
+ else
+ {
+ //Workaround.See i86963.
+ if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
+ return false;
+
+ if ( m_bInCheckMode )
+ m_vEntries[ nMid ]->m_bChecked = true;
+ nPos = nMid;
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------------
+long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
+ const uno::Reference< deployment::XPackageManager > &xPackageManager )
+{
+ long nPos = 0;
+ PackageState eState = m_pManager->getPackageState( xPackage );
+
+ TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
+ xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ if ( m_vEntries.empty() )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.push_back( pEntry );
+ }
+ else
+ {
+ if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
+ {
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
+ pEntry->m_bNew = m_bInCheckMode;
+ m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
+ }
+ else if ( !m_bInCheckMode )
+ {
+ OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
+ }
+ }
+ //access to m_nActive must be guarded
+ if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
+ m_nActive += 1;
+
+ guard.clear();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ m_bNeedsRecalc = true;
+
+ return nPos;
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ PackageState eState = m_pManager->getPackageState( xPackage );
+ (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ (*iIndex)->m_eState = eState;
+ (*iIndex)->m_sTitle = xPackage->getDisplayName();
+ (*iIndex)->m_sVersion = xPackage->getVersion();
+ (*iIndex)->m_sDescription = xPackage->getDescription();
+
+ if ( eState == AMBIGUOUS )
+ (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+ else
+ (*iIndex)->m_sErrorText = String();
+
+ if ( IsReallyVisible() )
+ Invalidate();
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( ! m_bInDelete )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackage == xPackage )
+ {
+ long nPos = iIndex - m_vEntries.begin();
+
+ // Entries mustn't removed here, because they contain a hyperlink control
+ // which can only be deleted when the thread has the solar mutex. Therefor
+ // the entry will be moved into the m_vRemovedEntries list which will be
+ // cleared on the next paint event
+ m_vRemovedEntries.push_back( *iIndex );
+ m_vEntries.erase( iIndex );
+
+ m_bNeedsRecalc = true;
+
+ if ( IsReallyVisible() )
+ Invalidate();
+
+ if ( m_bHasActive )
+ {
+ if ( nPos < m_nActive )
+ m_nActive -= 1;
+ else if ( ( nPos == m_nActive ) &&
+ ( nPos == (long) m_vEntries.size() ) )
+ m_nActive -= 1;
+
+ m_bHasActive = false;
+ //clear before calling out of this method
+ aGuard.clear();
+ selectEntry( m_nActive );
+ }
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::RemoveUnlocked()
+{
+ bool bAllRemoved = false;
+
+ while ( ! bAllRemoved )
+ {
+ bAllRemoved = true;
+
+ ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
+
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( !(*iIndex)->m_bLocked )
+ {
+ bAllRemoved = false;
+ uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
+ aGuard.clear();
+ removeEntry( xPackage );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+{
+ m_bInCheckMode = true;
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
+ {
+ if ( (*iIndex)->m_xPackageManager == xPackageMgr )
+ (*iIndex)->m_bChecked = false;
+ else
+ (*iIndex)->m_bChecked = true;
+ (*iIndex)->m_bNew = false;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::checkEntries()
+{
+ long nNewPos = -1;
+ long nPos = 0;
+ bool bNeedsUpdate = false;
+
+ ::osl::ClearableMutexGuard guard(m_entriesMutex);
+ typedef std::vector< TEntry_Impl >::iterator ITER;
+ ITER iIndex = m_vEntries.begin();
+ while ( iIndex < m_vEntries.end() )
+ {
+ if ( (*iIndex)->m_bChecked == false )
+ {
+ bNeedsUpdate = true;
+ nPos = iIndex-m_vEntries.begin();
+ if ( (*iIndex)->m_bNew )
+ {
+ if ( nNewPos == - 1)
+ nNewPos = nPos;
+ if ( nPos <= m_nActive )
+ m_nActive += 1;
+ }
+ }
+ iIndex++;
+ }
+ guard.clear();
+
+ m_bInCheckMode = false;
+
+ if ( nNewPos != - 1)
+ selectEntry( nNewPos );
+
+ if ( bNeedsUpdate )
+ {
+ m_bNeedsRecalc = true;
+ if ( IsReallyVisible() )
+ Invalidate();
+ }
+}
+//------------------------------------------------------------------------------
+bool ExtensionBox_Impl::isHCMode()
+{
+ return (bool)GetDisplayBackground().GetColor().IsDark();
+}
+
+//------------------------------------------------------------------------------
+void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
+{
+ if ( m_pScrollBar )
+ m_pScrollBar->SetScrollHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+void ExtensionBox_Impl::DoScroll( long nDelta )
+{
+ m_nTopIndex += nDelta;
+ Point aNewSBPt( m_pScrollBar->GetPosPixel() );
+
+ Rectangle aScrRect( Point(), GetOutputSizePixel() );
+ aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
+ Scroll( 0, -nDelta, aScrRect );
+
+ m_pScrollBar->SetPosPixel( aNewSBPt );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
+{
+ DoScroll( pScrBar->GetDelta() );
+
+ return 1;
+}
+
+} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
new file mode 100644
index 0000000..e1a17bb
--- /dev/null
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_gui_dialog2.cxx,v $
+ *
+ * $Revision: 1.8.4.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "rtl/ustring.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/dialog.hxx"
+
+#include "svtools/extensionlistbox.hxx"
+#include "svtools/fixedhyper.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "unotools/collatorwrapper.hxx"
+
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+
+#include <boost/shared_ptr.hpp>
+
+namespace dp_gui {
+
+#define SMALL_ICON_SIZE 16
+#define TOP_OFFSET 3
+#define ICON_HEIGHT 42
+#define ICON_OFFSET 50
+#define RIGHT_ICON_OFFSET 5
+#define SPACE_BETWEEN 3
+
+class TheExtensionManager;
+
+typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
+
+//------------------------------------------------------------------------------
+// struct Entry_Impl
+//------------------------------------------------------------------------------
+struct Entry_Impl;
+
+typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
+
+struct Entry_Impl
+{
+ bool m_bActive;
+ bool m_bLocked;
+ bool m_bHasOptions;
+ bool m_bShared;
+ bool m_bNew;
+ bool m_bChecked;
+ bool m_bMissingDeps;
+ PackageState m_eState;
+ String m_sTitle;
+ String m_sVersion;
+ String m_sDescription;
+ String m_sPublisher;
+ String m_sPublisherURL;
+ String m_sErrorText;
+ Image m_aIcon;
+ Image m_aIconHC;
+ svt::FixedHyperlink *m_pPublisher;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
+ PackageState eState );
+ ~Entry_Impl();
+
+ StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
+ void checkDependencies();
+};
+
+//------------------------------------------------------------------------------
+// class ExtensionBox_Impl
+//------------------------------------------------------------------------------
+
+class ExtensionBox_Impl;
+
+//------------------------------------------------------------------------------
+class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+ ExtensionBox_Impl *m_pParent;
+
+public:
+
+ ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
+ ~ExtensionRemovedListener();
+
+ //===================================================================================
+ // XEventListener
+ virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//------------------------------------------------------------------------------
+class ExtensionBox_Impl : public ::svt::IExtensionListBox
+{
+ bool m_bHasScrollBar;
+ bool m_bHasActive;
+ bool m_bNeedsRecalc;
+ bool m_bHasNew;
+ bool m_bInCheckMode;
+ bool m_bAdjustActive;
+ bool m_bInDelete;
+ //Must be guarded together with m_vEntries to ensure a valid index at all times.
+ //Use m_entriesMutex as guard.
+ long m_nActive;
+ long m_nTopIndex;
+ long m_nStdHeight;
+ long m_nActiveHeight;
+ long m_nExtraHeight;
+ Size m_aOutputSize;
+ Image m_aLockedImage;
+ Image m_aLockedImageHC;
+ Image m_aWarningImage;
+ Image m_aWarningImageHC;
+ Image m_aDefaultImage;
+ Image m_aDefaultImageHC;
+ Link m_aClickHdl;
+
+ ScrollBar *m_pScrollBar;
+
+ com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
+
+ TheExtensionManager *m_pManager;
+ //This mutex is used for synchronizing access to m_vEntries.
+ //Currently it is used to synchronize adding, removing entries and
+ //functions like getItemName, getItemDescription, etc. to prevent
+ //that m_vEntries is accessed at an invalid index.
+ //ToDo: There are many more places where m_vEntries is read and which may
+ //fail. For example the Paint method is probable called from the main thread
+ //while new entries are added / removed in a separate thread.
+ mutable ::osl::Mutex m_entriesMutex;
+ std::vector< TEntry_Impl > m_vEntries;
+ std::vector< TEntry_Impl > m_vRemovedEntries;
+
+ ::com::sun::star::lang::Locale *m_pLocale;
+ CollatorWrapper *m_pCollator;
+
+ void CalcActiveHeight( const long nPos );
+ long GetTotalHeight() const;
+ void SetupScrollBar();
+ void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
+ bool HandleTabKey( bool bReverse );
+ bool HandleCursorKey( USHORT nKeyCode );
+ bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
+ bool isHCMode();
+ void DeleteRemoved();
+
+ //-----------------
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+
+ //Index starts with 1.
+ //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
+ void checkIndex(sal_Int32 pos) const;
+
+
+public:
+ ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
+ ~ExtensionBox_Impl();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle &rPaintRect );
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ const Size GetMinOutputSizePixel() const;
+ void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
+ TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
+ long GetEntryCount() { return (long) m_vEntries.size(); }
+ Rectangle GetEntryRect( const long nPos ) const;
+ bool HasActive() { return m_bHasActive; }
+ long PointToPos( const Point& rPos );
+ void SetScrollHdl( const Link& rLink );
+ void DoScroll( long nDelta );
+ void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
+ virtual void RecalcAll();
+ void RemoveUnlocked();
+
+ //-----------------
+ virtual void selectEntry( const long nPos );
+ long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+
+ void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
+ void checkEntries();
+
+ TheExtensionManager* getExtensionManager() const { return m_pManager; }
+
+ //===================================================================================
+ //These functions are used for automatic testing
+
+ /** @return The count of the entries in the list box. */
+ virtual sal_Int32 getItemCount() const;
+
+ /** @return The index of the first selected entry in the list box.
+ When nothing is selected, which is the case when getItemCount returns '0',
+ then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
+ virtual sal_Int32 getSelIndex() const;
+
+ /** @return The item name of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
+
+ /** @return The version string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
+
+ /** @return The description string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
+
+ /** @return The publisher string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
+
+ /** @return The link behind the publisher text of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
+
+ /** The entry at the given position will be selected
+ Index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual void select( sal_Int32 pos );
+
+ /** The first found entry with the given name will be selected
+ When there was no entry found with the name, the selection doesn't change.
+ Please note that there might be more than one entry with the same
+ name, because:
+ 1. the name is not unique
+ 2. one extension can be installed as user and shared extension.
+ */
+ virtual void select( const ::rtl::OUString & sName );
+};
+
+}
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 32b80b7..7425c14 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -48,6 +48,7 @@
#include "boost/bind.hpp"
#include "license_dialog.hxx"
+#include "dp_gui_dialog2.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -271,27 +272,28 @@ void ServiceImpl::startExecuteModal(
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- ::rtl::Reference< ::dp_gui::TheExtensionManager > dialog(
+ ::rtl::Reference< ::dp_gui::TheExtensionManager > myExtMgr(
::dp_gui::TheExtensionManager::get(
m_xComponentContext,
m_parent ? *m_parent : Reference<awt::XWindow>(),
m_extensionURL ? *m_extensionURL : OUString() ) );
+ myExtMgr->createDialog( false );
if (m_initialTitle.getLength() > 0) {
- dialog->SetText( m_initialTitle );
+ myExtMgr->SetText( m_initialTitle );
m_initialTitle = OUString();
}
if ( m_bShowUpdateOnly )
{
- dialog->checkUpdates( true, !bCloseDialog );
+ myExtMgr->checkUpdates( true, !bCloseDialog );
if ( bCloseDialog )
- dialog->Close();
+ myExtMgr->Close();
else
- dialog->ToTop( TOTOP_RESTOREWHENMIN );
+ myExtMgr->ToTop( TOTOP_RESTOREWHENMIN );
}
else
{
- dialog->Show();
- dialog->ToTop( TOTOP_RESTOREWHENMIN );
+ myExtMgr->Show();
+ myExtMgr->ToTop( TOTOP_RESTOREWHENMIN );
}
}
@@ -331,6 +333,12 @@ sdecl::ServiceDecl const licenseDecl(
licenseSI,
"com.sun.star.comp.deployment.ui.LicenseDialog",
"com.sun.star.deployment.ui.LicenseDialog" );
+
+sdecl::class_<UpdateRequiredDialogService, sdecl::with_args<true> > updateSI;
+sdecl::ServiceDecl const updateDecl(
+ updateSI,
+ "com.sun.star.comp.deployment.ui.UpdateRequiredDialog",
+ "com.sun.star.deployment.ui.UpdateRequiredDialog" );
} // namespace dp_gui
extern "C" {
@@ -346,7 +354,7 @@ sal_Bool SAL_CALL component_writeInfo(
registry::XRegistryKey * pRegistryKey )
{
return component_writeInfoHelper(
- pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl );
+ pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl );
}
void * SAL_CALL component_getFactory(
@@ -355,7 +363,7 @@ void * SAL_CALL component_getFactory(
registry::XRegistryKey * pRegistryKey )
{
return component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl );
+ pImplName, pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl );
}
} // extern "C"
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index e5bdb36..82577c6 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -66,7 +66,10 @@ namespace dp_gui {
TheExtensionManager::TheExtensionManager( Window *pParent,
const uno::Reference< uno::XComponentContext > &xContext ) :
- m_xContext( xContext )
+ m_xContext( xContext ),
+ m_pParent( pParent ),
+ m_pExtMgrDialog( NULL ),
+ m_pUpdReqDialog( NULL )
{
if ( dp_misc::office_is_running() )
{
@@ -76,10 +79,6 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
m_xDesktop->addTerminateListener( this );
}
- m_pDialog = new ExtMgrDialog( pParent, this );
-
- m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pDialog, this, xContext ) );
-
m_sPackageManagers.realloc(2);
m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") );
m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );;
@@ -110,21 +109,43 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
uno::Sequence< uno::Any >( args, 1 )), uno::UNO_QUERY_THROW);
try
{ //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
- OUString sURL;
uno::Any value = xNameAccessRepositories->getByName( OUSTR( "WebsiteLink" ) );
- sURL = value.get< OUString > ();
- m_pDialog->setGetExtensionsURL( sURL );
+ m_sGetExtensionsURL = value.get< OUString > ();
}
catch ( uno::Exception& )
{}
-
- createPackageList();
}
//------------------------------------------------------------------------------
TheExtensionManager::~TheExtensionManager()
{
- delete m_pDialog;
+ if ( m_pUpdReqDialog )
+ delete m_pUpdReqDialog;
+ if ( m_pExtMgrDialog )
+ delete m_pExtMgrDialog;
+}
+
+//------------------------------------------------------------------------------
+void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
+{
+ const ::vos::OGuard guard( Application::GetSolarMutex() );
+
+ if ( bCreateUpdDlg )
+ {
+ if ( !m_pUpdReqDialog )
+ {
+ m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this );
+ m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ) );
+ createPackageList();
+ }
+ }
+ else if ( !m_pExtMgrDialog )
+ {
+ m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this );
+ m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ) );
+ m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
+ createPackageList();
+ }
}
//------------------------------------------------------------------------------
@@ -132,7 +153,7 @@ void TheExtensionManager::Show()
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->Show();
+ getDialog()->Show();
}
//------------------------------------------------------------------------------
@@ -140,7 +161,7 @@ void TheExtensionManager::SetText( const ::rtl::OUString &rTitle )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->SetText( rTitle );
+ getDialog()->SetText( rTitle );
}
//------------------------------------------------------------------------------
@@ -148,25 +169,69 @@ void TheExtensionManager::ToTop( USHORT nFlags )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- m_pDialog->ToTop( nFlags );
+ getDialog()->ToTop( nFlags );
}
//------------------------------------------------------------------------------
bool TheExtensionManager::Close()
{
- return m_pDialog->Close();
+ if ( m_pExtMgrDialog )
+ return m_pExtMgrDialog->Close();
+ else if ( m_pUpdReqDialog )
+ return m_pUpdReqDialog->Close();
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 TheExtensionManager::execute()
+{
+ sal_Int16 nRet = 0;
+
+ if ( m_pUpdReqDialog )
+ {
+ nRet = m_pUpdReqDialog->Execute();
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
+ }
+
+ return nRet;
}
//------------------------------------------------------------------------------
bool TheExtensionManager::isVisible()
{
- return m_pDialog->IsVisible();
+ return getDialog()->IsVisible();
}
//------------------------------------------------------------------------------
bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ )
{
- m_pExecuteCmdQueue->checkForUpdates( m_sPackageManagers );
+ std::vector< TUpdateListEntry > vEntries;
+
+ for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i )
+ {
+ uno::Sequence< uno::Reference< deployment::XPackage > > xPackages;
+ try {
+ xPackages = m_sPackageManagers[i]->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
+ for ( sal_Int32 k = 0; k < xPackages.getLength(); ++k )
+ {
+ TUpdateListEntry pEntry( new UpdateListEntry( xPackages[k], m_sPackageManagers[i] ) );
+ vEntries.push_back( pEntry );
+ }
+ } catch ( deployment::DeploymentException & ) {
+ continue;
+ } catch ( ucb::CommandFailedException & ) {
+ continue;
+ } catch ( ucb::CommandAbortedException & ) {
+ return true;
+ } catch ( lang::IllegalArgumentException & e ) {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+ }
+
+ m_pExecuteCmdQueue->checkForUpdates( vEntries );
return true;
}
@@ -189,10 +254,9 @@ bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPack
}
//------------------------------------------------------------------------------
-bool TheExtensionManager::updatePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+bool TheExtensionManager::updatePackages( const std::vector< TUpdateListEntry > &vList )
{
- m_pExecuteCmdQueue->checkForUpdate( xPackageManager, xPackage );
+ m_pExecuteCmdQueue->checkForUpdates( vList );
return true;
}
@@ -203,6 +267,8 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
if ( rPackageURL.getLength() == 0 )
return false;
+ createDialog( false );
+
uno::Reference< deployment::XPackageManager > xUserPkgMgr = getUserPkgMgr();
uno::Reference< deployment::XPackageManager > xSharedPkgMgr = getSharedPkgMgr();
@@ -210,7 +276,7 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
bool bInstallForAll = false;
if ( !bWarnUser && ! xSharedPkgMgr->isReadOnly() )
- bInstall = m_pDialog->installForAllUsers( bInstallForAll );
+ bInstall = getDialogHelper()->installForAllUsers( bInstallForAll );
if ( !bInstall )
return false;
@@ -239,8 +305,10 @@ void TheExtensionManager::terminateDialog()
if ( ! dp_misc::office_is_running() )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- delete m_pDialog;
- m_pDialog = NULL;
+ delete m_pExtMgrDialog;
+ m_pExtMgrDialog = NULL;
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
Application::Quit();
}
}
@@ -252,7 +320,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X
try {
packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() );
+ uno::Reference< ucb::XCommandEnvironment >() );
} catch ( deployment::DeploymentException & ) {
//handleGeneralError(e.Cause);
return true;
@@ -267,7 +335,7 @@ bool TheExtensionManager::createPackageList( const uno::Reference< deployment::X
for ( sal_Int32 j = 0; j < packages.getLength(); ++j )
{
- m_pDialog->addPackageToList( packages[j], xPackageManager );
+ getDialogHelper()->addPackageToList( packages[j], xPackageManager );
}
return true;
@@ -381,8 +449,10 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
if ( dp_misc::office_is_running() )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
- delete m_pDialog;
- m_pDialog = NULL;
+ delete m_pExtMgrDialog;
+ m_pExtMgrDialog = NULL;
+ delete m_pUpdReqDialog;
+ m_pUpdReqDialog = NULL;
}
s_ExtMgr.clear();
}
@@ -393,15 +463,22 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
void TheExtensionManager::queryTermination( ::lang::EventObject const & )
throw ( frame::TerminationVetoException, uno::RuntimeException )
{
- if ( m_pExecuteCmdQueue->isBusy() || ( m_pDialog && m_pDialog->isBusy() ) )
+ DialogHelper *pDialogHelper = getDialogHelper();
+
+ if ( m_pExecuteCmdQueue->isBusy() || ( pDialogHelper && pDialogHelper->isBusy() ) )
{
ToTop( TOTOP_RESTOREWHENMIN );
throw frame::TerminationVetoException(
OUSTR("The office cannot be closed while the Extension Manager is running"),
uno::Reference<XInterface>(static_cast<frame::XTerminateListener*>(this), uno::UNO_QUERY));
}
- else if ( m_pDialog )
- m_pDialog->Close();
+ else
+ {
+ if ( m_pExtMgrDialog )
+ m_pExtMgrDialog->Close();
+ if ( m_pUpdReqDialog )
+ m_pUpdReqDialog->Close();
+ }
}
//------------------------------------------------------------------------------
@@ -419,9 +496,9 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY );
if ( xPackageManager.is() )
{
- m_pDialog->prepareChecking( xPackageManager );
+ getDialogHelper()->prepareChecking( xPackageManager );
createPackageList( xPackageManager );
- m_pDialog->checkEntries();
+ getDialogHelper()->checkEntries();
}
}
@@ -433,7 +510,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
if ( s_ExtMgr.is() )
{
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- s_ExtMgr->installPackage( extensionURL, true );
+ if ( extensionURL.getLength() )
+ s_ExtMgr->installPackage( extensionURL, true );
return s_ExtMgr;
}
@@ -450,7 +528,8 @@ void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
s_ExtMgr = that;
}
- s_ExtMgr->installPackage( extensionURL, true );
+ if ( extensionURL.getLength() )
+ s_ExtMgr->installPackage( extensionURL, true );
return s_ExtMgr;
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index d2e9a5a..982fb00 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -44,12 +44,13 @@
#include "com/sun/star/util/XModifyListener.hpp"
#include "dp_gui.h"
+#include "dp_gui_dialog2.hxx"
+#include "dp_gui_updatedata.hxx"
//==============================================================================
namespace dp_gui {
//------------------------------------------------------------------------------
-class ExtMgrDialog;
class ExtensionCmdQueue;
//------------------------------------------------------------------------------
@@ -65,7 +66,11 @@ private:
::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue;
- ExtMgrDialog *m_pDialog;
+ Window *m_pParent;
+ ExtMgrDialog *m_pExtMgrDialog;
+ UpdateRequiredDialog *m_pUpdReqDialog;
+
+ ::rtl::OUString m_sGetExtensionsURL;
// liste der packages ( xpackage?, mit parent manager, ... )
@@ -79,6 +84,12 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext );
~TheExtensionManager();
+ void createDialog( const bool bCreateUpdDlg );
+ sal_Int16 execute();
+
+ Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; }
+ DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; }
+
void SetText( const ::rtl::OUString &rTitle );
void Show();
void ToTop( USHORT nFlags );
@@ -87,12 +98,12 @@ public:
//-----------------
bool checkUpdates( bool showUpdateOnly, bool parentVisible );
+ bool updatePackages( const std::vector< TUpdateListEntry > &vList );
+
bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
bool bEnable );
bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false );
bool queryTermination();
diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
index 8678bb9..a764c63 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
@@ -34,6 +34,8 @@
#include "rtl/ustring.hxx"
#include "com/sun/star/uno/Reference.hxx"
+#include <boost/shared_ptr.hpp>
+
namespace com { namespace sun { namespace star { namespace deployment {
class XPackageManager;
@@ -46,6 +48,19 @@ namespace com { namespace sun { namespace star { namespace xml { namespace dom {
namespace dp_gui {
+struct UpdateListEntry
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
+
+ UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ ~UpdateListEntry();
+};
+
+typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry;
+
+
struct UpdateData
{
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index c26284a..ea05a73 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -229,9 +229,7 @@ public:
Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers);
+ const std::vector< TUpdateListEntry > &vExtensionList);
void stop();
@@ -285,9 +283,7 @@ private:
css::uno::Reference< css::uno::XComponentContext > m_context;
UpdateDialog & m_dialog;
- rtl::Reference< dp_gui::SelectedPackage > m_selectedPackage;
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > m_packageManagers;
+ std::vector< dp_gui::TUpdateListEntry > m_vExtensionList;
css::uno::Reference< css::deployment::XUpdateInformationProvider >
m_updateInformation;
@@ -299,13 +295,10 @@ private:
UpdateDialog::Thread::Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers):
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList):
m_context(context),
m_dialog(dialog),
- m_selectedPackage(selectedPackage),
- m_packageManagers(packageManagers),
+ m_vExtensionList(vExtensionList),
m_updateInformation(
css::deployment::UpdateInformationProvider::create(context)),
m_stop(false)
@@ -336,55 +329,28 @@ UpdateDialog::Thread::Entry::Entry(
UpdateDialog::Thread::~Thread() {}
-void UpdateDialog::Thread::execute() {
- OSL_ASSERT(m_selectedPackage.is() != (m_packageManagers.getLength() != 0));
+void UpdateDialog::Thread::execute()
+{
+ OSL_ASSERT( ! m_vExtensionList.empty() );
Map map;
- if (m_selectedPackage.is()) {
- css::uno::Reference< css::deployment::XPackage > p = m_selectedPackage->getPackage();
- css::uno::Reference< css::deployment::XPackageManager > m= m_selectedPackage->getPackageManager();
+
+ typedef std::vector< TUpdateListEntry >::const_iterator ITER;
+ for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex )
+ {
+ css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage;
+ css::uno::Reference< css::deployment::XPackageManager > m = (*iIndex)->m_xPackageManager;
if ( p.is() )
{
- handle(p, m, &map);
- }
- } else {
- for (sal_Int32 i = 0; i < m_packageManagers.getLength(); ++i) {
- css::uno::Reference< css::task::XAbortChannel > abort(
- m_packageManagers[i]->createAbortChannel());
{
- vos::OGuard g(Application::GetSolarMutex());
- if (m_stop) {
+ vos::OGuard g( Application::GetSolarMutex() );
+ if ( m_stop ) {
return;
}
- m_abort = abort;
- }
- css::uno::Sequence<
- css::uno::Reference< css::deployment::XPackage > > ps;
- try {
- ps = m_packageManagers[i]->getDeployedPackages(
- abort,
- css::uno::Reference< css::ucb::XCommandEnvironment >());
- } catch (css::deployment::DeploymentException & e) {
- handleGeneralError(e.Cause);
- continue;
- } catch (css::ucb::CommandFailedException & e) {
- handleGeneralError(e.Reason);
- continue;
- } catch (css::ucb::CommandAbortedException &) {
- return;
- } catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(e.Message, e.Context);
- }
- for (sal_Int32 j = 0; j < ps.getLength(); ++j) {
- {
- vos::OGuard g(Application::GetSolarMutex());
- if (m_stop) {
- return;
- }
- }
- handle(ps[j], m_packageManagers[i], &map);
}
+ handle( p, m, &map );
}
}
+
if (!map.empty()) {
const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL());
if (sDefaultURL.getLength())
@@ -597,9 +563,7 @@ bool UpdateDialog::Thread::update(
UpdateDialog::UpdateDialog(
css::uno::Reference< css::uno::XComponentContext > const & context,
Window * parent,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- css::uno::Sequence< css::uno::Reference<
- css::deployment::XPackageManager > > const & packageManagers,
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData):
ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)),
m_context(context),
@@ -636,14 +600,12 @@ UpdateDialog::UpdateDialog(
m_updateData(*updateData),
m_thread(
new UpdateDialog::Thread(
- context, *this, selectedPackage,
- packageManagers)),
+ context, *this, vExtensionList)),
m_nFirstLineDelta(0),
m_nOneLineMissing(0)
// TODO: check!
// ,
// m_extensionManagerDialog(extensionManagerDialog)
-
{
OSL_ASSERT(updateData != NULL);
css::uno::Reference< css::awt::XToolkit > toolkit;
@@ -1310,4 +1272,3 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink )
return 1;
}
-
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 8251e91..0801481 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -48,6 +48,7 @@
#include <svtools/fixedhyper.hxx>
#include "descedit.hxx"
+#include "dp_gui_updatedata.hxx"
/// @HTML
@@ -56,18 +57,14 @@ class KeyEvent;
class MouseEvent;
class ResId;
class Window;
+
namespace com { namespace sun { namespace star {
namespace awt { class XThrobber; }
namespace deployment { class XPackageManager; }
namespace uno { class XComponentContext; }
} } }
-namespace dp_gui {
- class SelectedPackage;
- struct UpdateData;
-}
namespace dp_gui {
-
/**
The modal “Check for Updates” dialog.
*/
@@ -92,13 +89,9 @@ public:
if non-null, check for updates for all managed packages
*/
UpdateDialog(
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
- const & context,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
Window * parent,
- rtl::Reference< dp_gui::SelectedPackage > const & selectedPackage,
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
- com::sun::star::deployment::XPackageManager > > const &
- packageManagers,
+ const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData);
~UpdateDialog();
diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk
index e3211ab..4d563ae 100644
--- a/desktop/source/deployment/gui/makefile.mk
+++ b/desktop/source/deployment/gui/makefile.mk
@@ -50,6 +50,7 @@ DLLPRE =
SLOFILES = \
$(SLO)$/dp_gui_service.obj \
+ $(SLO)$/dp_gui_extlistbox.obj \
$(SLO)$/dp_gui_dialog2.obj \
$(SLO)$/dp_gui_theextmgr.obj \
$(SLO)$/license_dialog.obj \
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 5bdb990..f37a9d5 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -296,6 +296,7 @@ sal_Bool Package::isBundle() throw (RuntimeException)
return false; // default
}
+//______________________________________________________________________________
::sal_Bool Package::checkPrerequisites(
const css::uno::Reference< css::task::XAbortChannel >&,
const css::uno::Reference< css::ucb::XCommandEnvironment >&,
@@ -308,6 +309,16 @@ sal_Bool Package::isBundle() throw (RuntimeException)
return true;
}
+//______________________________________________________________________________
+::sal_Bool Package::checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException)
+{
+ return true;
+}
+
//______________________________________________________________________________
Sequence< Reference<deployment::XPackage> > Package::getBundle(
diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h
index 95d56c2..5ce311d 100644
--- a/desktop/source/deployment/registry/inc/dp_backend.h
+++ b/desktop/source/deployment/registry/inc/dp_backend.h
@@ -177,6 +177,12 @@ public:
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException);
+
virtual void SAL_CALL registerPackage(
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 2f6a009..98f80df 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -205,6 +205,12 @@ class BackendImpl : public ImplBaseT
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException);
+
virtual beans::Optional<OUString> SAL_CALL getIdentifier()
throw (RuntimeException);
@@ -702,6 +708,22 @@ bool BackendImpl::PackageImpl::checkDependencies(
&& checkLicense(xCmdEnv, *spDescription, bInstalled, aContextName);
}
+::sal_Bool BackendImpl::PackageImpl::checkDependencies(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException)
+{
+ std::auto_ptr<ExtensionDescription> spDescription;
+ try {
+ spDescription.reset(
+ new ExtensionDescription( getMyBackend()->getComponentContext(), m_url_expanded, xCmdEnv ));
+ } catch (NoDescriptionException& ) {
+ return sal_True;
+ }
+ return checkDependencies(xCmdEnv, *spDescription);
+}
+
beans::Optional<OUString> BackendImpl::PackageImpl::getIdentifier()
throw (RuntimeException)
{
diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc
index 86759a4..6532e16 100644
--- a/desktop/source/inc/helpid.hrc
+++ b/desktop/source/inc/helpid.hrc
@@ -66,7 +66,11 @@
#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE (HID_DESKTOP_START + 26)
#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE (HID_DESKTOP_START + 27)
-#define ACT_DESKTOP_HID_END HID_EXTENSION_MANAGER_LISTBOX_REMOVE
+#define HID_EXTENSION_DEPENDENCIES (HID_DESKTOP_START + 28)
+
+#define HID_PACKAGE_MANAGER_UPD_REQ (HID_DESKTOP_START + 29)
+
+#define ACT_DESKTOP_HID_END HID_PACKAGE_MANAGER_UPD_REQ
// check bounds:
#if ACT_DESKTOP_HID_END > HID_DESKTOP_END
diff --git a/desktop/util/hidother.src b/desktop/util/hidother.src
index 52f03c6..1f5939b 100644
--- a/desktop/util/hidother.src
+++ b/desktop/util/hidother.src
@@ -36,6 +36,8 @@ hidspecial HID_PACKAGE_MANAGER_TREELISTBOX { HelpID = HID_PACKAGE_MANAGER_TREELI
hidspecial HID_PACKAGE_MANAGER_PROGRESS { HelpID = HID_PACKAGE_MANAGER_PROGRESS; };
hidspecial HID_PACKAGE_MANAGER_PROGRESS_CANCEL { HelpID = HID_PACKAGE_MANAGER_PROGRESS_CANCEL; };
+hidspecial HID_PACKAGE_MANAGER_UPD_REQ { HelpID = HID_PACKAGE_MANAGER_UPD_REQ; };
+
hidspecial HID_FIRSTSTART_PREV { HelpId = HID_FIRSTSTART_PREV;};
hidspecial HID_FIRSTSTART_NEXT { HelpId = HID_FIRSTSTART_NEXT;};
hidspecial HID_FIRSTSTART_CANCEL { HelpId = HID_FIRSTSTART_CANCEL;};
@@ -45,7 +47,7 @@ hidspecial UID_FIRSTSTART_HELP { HelpId = UID_FIRSTSTART_HELP;};
hidspecial UID_BTN_LICENSE_ACCEPT { HelpId = UID_BTN_LICENSE_ACCEPT;};
hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATE;};
-hidspecial HID_DEPLOYMENT_GUI_UPDATE { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;};
+hidspecial HID_DEPLOYMENT_GUI_UPDATEINSTALL { HelpId = HID_DEPLOYMENT_GUI_UPDATEINSTALL;};
hidspecial HID_EXTENSION_MANAGER_LISTBOX { HelpId = HID_EXTENSION_MANAGER_LISTBOX; };
hidspecial HID_EXTENSION_MANAGER_LISTBOX_OPTIONS { HelpId = HID_EXTENSION_MANAGER_LISTBOX_OPTIONS; };
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 7572879..ad6b4d9 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -352,6 +352,13 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="LastCompatibilityCheckID" oor:type="xs:string">
+ <info>
+ <author>DV</author>
+ <desc>The build ID of the office. On startup the office will compare this ID with the current build id to decide if the extensions dependencies need to be checked.</desc>
+ </info>
+ <value>not checked</value>
+ </prop>
<set oor:name="Factories" oor:node-type="Factory">
<info>
<author>AS</author>
More information about the ooo-build-commit
mailing list