xref: /AOO41X/main/extensions/source/update/ui/updatecheckui.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_extensions.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <list>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
34*cdf0e10cSrcweir #include <cppuhelper/implementationentry.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/document/XEventListener.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/document/XEventBroadcaster.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/task/XJob.hpp>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #include <vos/mutex.hxx>
46*cdf0e10cSrcweir #include <osl/mutex.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <vcl/window.hxx>
49*cdf0e10cSrcweir #include <vcl/floatwin.hxx>
50*cdf0e10cSrcweir #include <vcl/timer.hxx>
51*cdf0e10cSrcweir #include <vcl/menu.hxx>
52*cdf0e10cSrcweir #include <vcl/outdev.hxx>
53*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
54*cdf0e10cSrcweir #include <vcl/lineinfo.hxx>
55*cdf0e10cSrcweir #include <vcl/button.hxx>
56*cdf0e10cSrcweir #include <vcl/settings.hxx>
57*cdf0e10cSrcweir #include <vcl/svapp.hxx>
58*cdf0e10cSrcweir #include <sfx2/sfx.hrc>
59*cdf0e10cSrcweir #include "rtl/ustrbuf.hxx"
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #include "updatecheckui.hrc"
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir #define MSG_ERR_NO_WEBBROWSER_FOUND  (RID_SFX_APP_START + 7)
66*cdf0e10cSrcweir #define DEFAULT_MENUBAR_HEIGHT 24
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #define PROPERTY_TITLE          RTL_CONSTASCII_STRINGPARAM("BubbleHeading")
69*cdf0e10cSrcweir #define PROPERTY_TEXT           RTL_CONSTASCII_STRINGPARAM("BubbleText")
70*cdf0e10cSrcweir #define PROPERTY_IMAGE          RTL_CONSTASCII_STRINGPARAM("BubbleImageURL")
71*cdf0e10cSrcweir #define PROPERTY_SHOW_BUBBLE    RTL_CONSTASCII_STRINGPARAM("BubbleVisible")
72*cdf0e10cSrcweir #define PROPERTY_CLICK_HDL      RTL_CONSTASCII_STRINGPARAM("MenuClickHDL")
73*cdf0e10cSrcweir #define PROPERTY_SHOW_MENUICON  RTL_CONSTASCII_STRINGPARAM("MenuIconVisible")
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #define START_TIMER 1
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir using namespace ::com::sun::star;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir //------------------------------------------------------------------------------
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir static uno::Sequence< rtl::OUString > getServiceNames()
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir     uno::Sequence< rtl::OUString > aServiceList(1);
84*cdf0e10cSrcweir     aServiceList[0] = UNISTRING( "com.sun.star.setup.UpdateCheckUI");
85*cdf0e10cSrcweir     return aServiceList;
86*cdf0e10cSrcweir }
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir //------------------------------------------------------------------------------
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir static rtl::OUString getImplementationName()
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir     return UNISTRING( "vnd.sun.UpdateCheckUI");
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir //------------------------------------------------------------------------------
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir namespace
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir //------------------------------------------------------------------------------
101*cdf0e10cSrcweir class BubbleWindow : public FloatingWindow
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     Point           maTipPos;
104*cdf0e10cSrcweir     Region          maBounds;
105*cdf0e10cSrcweir     Polygon         maRectPoly;
106*cdf0e10cSrcweir     Polygon         maTriPoly;
107*cdf0e10cSrcweir     XubString       maBubbleTitle;
108*cdf0e10cSrcweir     XubString       maBubbleText;
109*cdf0e10cSrcweir     Image           maBubbleImage;
110*cdf0e10cSrcweir     Size            maMaxTextSize;
111*cdf0e10cSrcweir     Rectangle       maTitleRect;
112*cdf0e10cSrcweir     Rectangle       maTextRect;
113*cdf0e10cSrcweir     long            mnTipOffset;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir private:
116*cdf0e10cSrcweir     void            RecalcTextRects();
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir public:
119*cdf0e10cSrcweir                     BubbleWindow( Window* pParent, const XubString& rTitle,
120*cdf0e10cSrcweir                                   const XubString& rText, const Image& rImage );
121*cdf0e10cSrcweir                    ~BubbleWindow();
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
124*cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
125*cdf0e10cSrcweir     void            Resize();
126*cdf0e10cSrcweir     void            Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = SHOW_NOACTIVATE );
127*cdf0e10cSrcweir     void            SetTipPosPixel( const Point& rTipPos ) { maTipPos = rTipPos; }
128*cdf0e10cSrcweir     void            SetTitleAndText( const XubString& rTitle, const XubString& rText,
129*cdf0e10cSrcweir                                      const Image& rImage );
130*cdf0e10cSrcweir };
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir //------------------------------------------------------------------------------
133*cdf0e10cSrcweir class UpdateCheckUI : public ::cppu::WeakImplHelper3
134*cdf0e10cSrcweir                         < lang::XServiceInfo, document::XEventListener, beans::XPropertySet >
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir     uno::Reference< uno::XComponentContext > m_xContext;
137*cdf0e10cSrcweir     uno::Reference< task::XJob > mrJob;
138*cdf0e10cSrcweir     rtl::OUString       maBubbleTitle;
139*cdf0e10cSrcweir     rtl::OUString       maBubbleText;
140*cdf0e10cSrcweir     rtl::OUString       maBubbleImageURL;
141*cdf0e10cSrcweir     Image               maBubbleImage;
142*cdf0e10cSrcweir     BubbleWindow*       mpBubbleWin;
143*cdf0e10cSrcweir     SystemWindow*       mpIconSysWin;
144*cdf0e10cSrcweir     MenuBar*            mpIconMBar;
145*cdf0e10cSrcweir     ResMgr*             mpUpdResMgr;
146*cdf0e10cSrcweir     ResMgr*             mpSfxResMgr;
147*cdf0e10cSrcweir     Timer               maWaitTimer;
148*cdf0e10cSrcweir     Timer               maTimeoutTimer;
149*cdf0e10cSrcweir     Link                maWindowEventHdl;
150*cdf0e10cSrcweir     Link                maApplicationEventHdl;
151*cdf0e10cSrcweir     bool                mbShowBubble;
152*cdf0e10cSrcweir     bool                mbShowMenuIcon;
153*cdf0e10cSrcweir     bool                mbBubbleChanged;
154*cdf0e10cSrcweir     sal_uInt16              mnIconID;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir private:
157*cdf0e10cSrcweir 				    DECL_LINK( ClickHdl, sal_uInt16* );
158*cdf0e10cSrcweir 				    DECL_LINK( HighlightHdl, MenuBar::MenuBarButtonCallbackArg* );
159*cdf0e10cSrcweir                     DECL_LINK( WaitTimeOutHdl, Timer* );
160*cdf0e10cSrcweir                     DECL_LINK( TimeOutHdl, Timer* );
161*cdf0e10cSrcweir                     DECL_LINK( UserEventHdl, UpdateCheckUI* );
162*cdf0e10cSrcweir                     DECL_LINK( WindowEventHdl, VclWindowEvent* );
163*cdf0e10cSrcweir                     DECL_LINK( ApplicationEventHdl, VclSimpleEvent* );
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     BubbleWindow*   GetBubbleWindow();
166*cdf0e10cSrcweir     void            RemoveBubbleWindow( bool bRemoveIcon );
167*cdf0e10cSrcweir     Image           GetMenuBarIcon( MenuBar* pMBar );
168*cdf0e10cSrcweir     void            AddMenuBarIcon( SystemWindow* pSysWin, bool bAddEventHdl );
169*cdf0e10cSrcweir     Image           GetBubbleImage( ::rtl::OUString &rURL );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     uno::Reference< document::XEventBroadcaster > getGlobalEventBroadcaster() const
172*cdf0e10cSrcweir          throw (uno::RuntimeException);
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir public:
175*cdf0e10cSrcweir                     UpdateCheckUI(const uno::Reference<uno::XComponentContext>&);
176*cdf0e10cSrcweir     virtual        ~UpdateCheckUI();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir     // XServiceInfo
179*cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getImplementationName()
180*cdf0e10cSrcweir         throw (uno::RuntimeException);
181*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName)
182*cdf0e10cSrcweir         throw (uno::RuntimeException);
183*cdf0e10cSrcweir     virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
184*cdf0e10cSrcweir         throw (uno::RuntimeException);
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     // XEventListener
187*cdf0e10cSrcweir     virtual void SAL_CALL notifyEvent(const document::EventObject& Event)
188*cdf0e10cSrcweir         throw (uno::RuntimeException);
189*cdf0e10cSrcweir     virtual void SAL_CALL disposing(const lang::EventObject& Event)
190*cdf0e10cSrcweir         throw (uno::RuntimeException);
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	//XPropertySet
193*cdf0e10cSrcweir 	virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(void)
194*cdf0e10cSrcweir         throw ( uno::RuntimeException );
195*cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const uno::Any& aValue)
196*cdf0e10cSrcweir         throw( beans::UnknownPropertyException, beans::PropertyVetoException,
197*cdf0e10cSrcweir                lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException );
198*cdf0e10cSrcweir 	virtual uno::Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName)
199*cdf0e10cSrcweir         throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException );
200*cdf0e10cSrcweir 	virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName,
201*cdf0e10cSrcweir                                                     const uno::Reference< beans::XPropertyChangeListener > & aListener)
202*cdf0e10cSrcweir         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException );
203*cdf0e10cSrcweir 	virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName,
204*cdf0e10cSrcweir                                                        const uno::Reference< beans::XPropertyChangeListener > & aListener)
205*cdf0e10cSrcweir         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException );
206*cdf0e10cSrcweir 	virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName,
207*cdf0e10cSrcweir                                                     const uno::Reference< beans::XVetoableChangeListener > & aListener)
208*cdf0e10cSrcweir         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException );
209*cdf0e10cSrcweir 	virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName,
210*cdf0e10cSrcweir                                                        const uno::Reference< beans::XVetoableChangeListener > & aListener)
211*cdf0e10cSrcweir         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException );
212*cdf0e10cSrcweir };
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir //------------------------------------------------------------------------------
215*cdf0e10cSrcweir UpdateCheckUI::UpdateCheckUI(const uno::Reference<uno::XComponentContext>& xContext) :
216*cdf0e10cSrcweir       m_xContext(xContext)
217*cdf0e10cSrcweir     , mpBubbleWin( NULL )
218*cdf0e10cSrcweir     , mpIconSysWin( NULL )
219*cdf0e10cSrcweir     , mpIconMBar( NULL )
220*cdf0e10cSrcweir     , mbShowBubble( false )
221*cdf0e10cSrcweir     , mbShowMenuIcon( false )
222*cdf0e10cSrcweir     , mbBubbleChanged( false )
223*cdf0e10cSrcweir     , mnIconID( 0 )
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir     mpUpdResMgr = ResMgr::CreateResMgr( "updchk" );
226*cdf0e10cSrcweir     mpSfxResMgr = ResMgr::CreateResMgr( "sfx" );
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     maBubbleImage = GetBubbleImage( maBubbleImageURL );
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir     maWaitTimer.SetTimeout( 400 );
231*cdf0e10cSrcweir     maWaitTimer.SetTimeoutHdl( LINK( this, UpdateCheckUI, WaitTimeOutHdl ) );
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     maTimeoutTimer.SetTimeout( 10000 );
234*cdf0e10cSrcweir     maTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateCheckUI, TimeOutHdl ) );
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     uno::Reference< document::XEventBroadcaster > xBroadcaster( getGlobalEventBroadcaster() );
237*cdf0e10cSrcweir     xBroadcaster->addEventListener( this );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir     maWindowEventHdl = LINK( this, UpdateCheckUI, WindowEventHdl );
240*cdf0e10cSrcweir     maApplicationEventHdl = LINK( this, UpdateCheckUI, ApplicationEventHdl );
241*cdf0e10cSrcweir     Application::AddEventListener( maApplicationEventHdl );
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir //------------------------------------------------------------------------------
245*cdf0e10cSrcweir UpdateCheckUI::~UpdateCheckUI()
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir     Application::RemoveEventListener( maApplicationEventHdl );
248*cdf0e10cSrcweir     RemoveBubbleWindow( true );
249*cdf0e10cSrcweir     delete mpUpdResMgr;
250*cdf0e10cSrcweir     delete mpSfxResMgr;
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir //------------------------------------------------------------------------------
254*cdf0e10cSrcweir uno::Reference<document::XEventBroadcaster>
255*cdf0e10cSrcweir UpdateCheckUI::getGlobalEventBroadcaster() const throw (uno::RuntimeException)
256*cdf0e10cSrcweir {
257*cdf0e10cSrcweir     if( !m_xContext.is() )
258*cdf0e10cSrcweir         throw uno::RuntimeException(
259*cdf0e10cSrcweir             UNISTRING( "UpdateCheckUI: empty component context" ),
260*cdf0e10cSrcweir                 uno::Reference< uno::XInterface >() );
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir     uno::Reference< lang::XMultiComponentFactory > xServiceManager(m_xContext->getServiceManager());
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     if( !xServiceManager.is() )
265*cdf0e10cSrcweir         throw uno::RuntimeException(
266*cdf0e10cSrcweir             UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ),
267*cdf0e10cSrcweir                 uno::Reference< uno::XInterface >() );
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir     return uno::Reference<document::XEventBroadcaster> (
270*cdf0e10cSrcweir         xServiceManager->createInstanceWithContext(
271*cdf0e10cSrcweir             UNISTRING( "com.sun.star.frame.GlobalEventBroadcaster" ),
272*cdf0e10cSrcweir             m_xContext),
273*cdf0e10cSrcweir         uno::UNO_QUERY_THROW);
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir //------------------------------------------------------------------------------
277*cdf0e10cSrcweir rtl::OUString SAL_CALL
278*cdf0e10cSrcweir UpdateCheckUI::getImplementationName() throw (uno::RuntimeException)
279*cdf0e10cSrcweir {
280*cdf0e10cSrcweir     return ::getImplementationName();
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir //------------------------------------------------------------------------------
284*cdf0e10cSrcweir uno::Sequence< rtl::OUString > SAL_CALL
285*cdf0e10cSrcweir UpdateCheckUI::getSupportedServiceNames() throw (uno::RuntimeException)
286*cdf0e10cSrcweir {
287*cdf0e10cSrcweir     return ::getServiceNames();
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir //------------------------------------------------------------------------------
291*cdf0e10cSrcweir sal_Bool SAL_CALL
292*cdf0e10cSrcweir UpdateCheckUI::supportsService( rtl::OUString const & serviceName ) throw (uno::RuntimeException)
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir     uno::Sequence< rtl::OUString > aServiceNameList = ::getServiceNames();
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     for( sal_Int32 n=0; n < aServiceNameList.getLength(); n++ )
297*cdf0e10cSrcweir         if( aServiceNameList[n].equals(serviceName) )
298*cdf0e10cSrcweir             return sal_True;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     return sal_False;
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir //------------------------------------------------------------------------------
304*cdf0e10cSrcweir Image UpdateCheckUI::GetMenuBarIcon( MenuBar* pMBar )
305*cdf0e10cSrcweir {
306*cdf0e10cSrcweir     sal_uInt32 nResID;
307*cdf0e10cSrcweir     Window *pMBarWin = pMBar->GetWindow();
308*cdf0e10cSrcweir     sal_uInt32 nMBarHeight = 20;
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir     if ( pMBarWin )
311*cdf0e10cSrcweir         nMBarHeight = pMBarWin->GetOutputSizePixel().getHeight();
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir     if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) {
314*cdf0e10cSrcweir         if ( nMBarHeight >= 35 )
315*cdf0e10cSrcweir             nResID = RID_UPDATE_AVAILABLE_26_HC;
316*cdf0e10cSrcweir         else
317*cdf0e10cSrcweir             nResID = RID_UPDATE_AVAILABLE_16_HC;
318*cdf0e10cSrcweir     } else {
319*cdf0e10cSrcweir         if ( nMBarHeight >= 35 )
320*cdf0e10cSrcweir             nResID = RID_UPDATE_AVAILABLE_26;
321*cdf0e10cSrcweir         else
322*cdf0e10cSrcweir             nResID = RID_UPDATE_AVAILABLE_16;
323*cdf0e10cSrcweir     }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir     return Image( ResId( nResID, *mpUpdResMgr ) );
326*cdf0e10cSrcweir }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir //------------------------------------------------------------------------------
329*cdf0e10cSrcweir Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL )
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir     Image aImage;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     if ( maBubbleImageURL.getLength() != 0 )
334*cdf0e10cSrcweir     {
335*cdf0e10cSrcweir     	uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir         if( !xServiceManager.is() )
338*cdf0e10cSrcweir             throw uno::RuntimeException(
339*cdf0e10cSrcweir                 UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ),
340*cdf0e10cSrcweir                     uno::Reference< uno::XInterface >() );
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir         try
343*cdf0e10cSrcweir 		{
344*cdf0e10cSrcweir             uno::Reference< graphic::XGraphicProvider > xGraphProvider(
345*cdf0e10cSrcweir                     xServiceManager->createInstance(
346*cdf0e10cSrcweir                             ::rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ),
347*cdf0e10cSrcweir                     uno::UNO_QUERY );
348*cdf0e10cSrcweir             if ( xGraphProvider.is() )
349*cdf0e10cSrcweir             {
350*cdf0e10cSrcweir                 uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
351*cdf0e10cSrcweir                 aMediaProps[0].Name = ::rtl::OUString::createFromAscii( "URL" );
352*cdf0e10cSrcweir                 aMediaProps[0].Value <<= rURL;
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir                 uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps );
355*cdf0e10cSrcweir                 if ( xGraphic.is() )
356*cdf0e10cSrcweir                 {
357*cdf0e10cSrcweir                     aImage = Image( xGraphic );
358*cdf0e10cSrcweir                 }
359*cdf0e10cSrcweir             }
360*cdf0e10cSrcweir         }
361*cdf0e10cSrcweir         catch( uno::Exception& )
362*cdf0e10cSrcweir         {
363*cdf0e10cSrcweir         }
364*cdf0e10cSrcweir     }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir     if ( aImage.GetSizePixel().Width() == 0 )
367*cdf0e10cSrcweir         aImage = InfoBox::GetStandardImage();
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir     return aImage;
370*cdf0e10cSrcweir }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir //------------------------------------------------------------------------------
373*cdf0e10cSrcweir void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin, bool bAddEventHdl )
374*cdf0e10cSrcweir {
375*cdf0e10cSrcweir     if ( ! mbShowMenuIcon )
376*cdf0e10cSrcweir         return;
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir     MenuBar *pActiveMBar = pSysWin->GetMenuBar();
381*cdf0e10cSrcweir     if ( ( pSysWin != mpIconSysWin ) || ( pActiveMBar != mpIconMBar ) )
382*cdf0e10cSrcweir     {
383*cdf0e10cSrcweir         if ( bAddEventHdl && mpIconSysWin )
384*cdf0e10cSrcweir             mpIconSysWin->RemoveEventListener( maWindowEventHdl );
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir         RemoveBubbleWindow( true );
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir         if ( pActiveMBar )
389*cdf0e10cSrcweir         {
390*cdf0e10cSrcweir             rtl::OUStringBuffer aBuf;
391*cdf0e10cSrcweir             if( maBubbleTitle.getLength() )
392*cdf0e10cSrcweir                 aBuf.append( maBubbleTitle );
393*cdf0e10cSrcweir             if( maBubbleText.getLength() )
394*cdf0e10cSrcweir             {
395*cdf0e10cSrcweir                 if( maBubbleTitle.getLength() )
396*cdf0e10cSrcweir                     aBuf.appendAscii( "\n\n" );
397*cdf0e10cSrcweir                 aBuf.append( maBubbleText );
398*cdf0e10cSrcweir             }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir             Image aImage = GetMenuBarIcon( pActiveMBar );
401*cdf0e10cSrcweir             mnIconID = pActiveMBar->AddMenuBarButton( aImage,
402*cdf0e10cSrcweir                                     LINK( this, UpdateCheckUI, ClickHdl ),
403*cdf0e10cSrcweir                                     aBuf.makeStringAndClear()
404*cdf0e10cSrcweir                                     );
405*cdf0e10cSrcweir             pActiveMBar->SetMenuBarButtonHighlightHdl( mnIconID,
406*cdf0e10cSrcweir                                     LINK( this, UpdateCheckUI, HighlightHdl ) );
407*cdf0e10cSrcweir         }
408*cdf0e10cSrcweir         mpIconMBar = pActiveMBar;
409*cdf0e10cSrcweir         mpIconSysWin = pSysWin;
410*cdf0e10cSrcweir         if ( bAddEventHdl && mpIconSysWin )
411*cdf0e10cSrcweir             mpIconSysWin->AddEventListener( maWindowEventHdl );
412*cdf0e10cSrcweir     }
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir     if ( mbShowBubble && pActiveMBar )
415*cdf0e10cSrcweir     {
416*cdf0e10cSrcweir         mpBubbleWin = GetBubbleWindow();
417*cdf0e10cSrcweir         if ( mpBubbleWin )
418*cdf0e10cSrcweir         {
419*cdf0e10cSrcweir             mpBubbleWin->Show( sal_True );
420*cdf0e10cSrcweir             maTimeoutTimer.Start();
421*cdf0e10cSrcweir         }
422*cdf0e10cSrcweir         mbShowBubble = false;
423*cdf0e10cSrcweir     }
424*cdf0e10cSrcweir }
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir //------------------------------------------------------------------------------
427*cdf0e10cSrcweir void SAL_CALL UpdateCheckUI::notifyEvent(const document::EventObject& rEvent)
428*cdf0e10cSrcweir     throw (uno::RuntimeException)
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir 	vos::OGuard aGuard( Application::GetSolarMutex() );
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 	if( rEvent.EventName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("OnPrepareViewClosing") ) == 0 )
433*cdf0e10cSrcweir     {
434*cdf0e10cSrcweir         RemoveBubbleWindow( true );
435*cdf0e10cSrcweir     }
436*cdf0e10cSrcweir }
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir //------------------------------------------------------------------------------
439*cdf0e10cSrcweir void SAL_CALL UpdateCheckUI::disposing(const lang::EventObject&)
440*cdf0e10cSrcweir     throw (uno::RuntimeException)
441*cdf0e10cSrcweir {
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir //------------------------------------------------------------------------------
445*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > UpdateCheckUI::getPropertySetInfo(void)
446*cdf0e10cSrcweir     throw ( uno::RuntimeException )
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir 	return NULL;
449*cdf0e10cSrcweir }
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir //------------------------------------------------------------------------------
452*cdf0e10cSrcweir void UpdateCheckUI::setPropertyValue(const rtl::OUString& rPropertyName,
453*cdf0e10cSrcweir 									 const uno::Any& rValue)
454*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, beans::PropertyVetoException,
455*cdf0e10cSrcweir 		   lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
456*cdf0e10cSrcweir {
457*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir     rtl::OUString aString;
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 	if( rPropertyName.compareToAscii( PROPERTY_TITLE ) == 0 ) {
462*cdf0e10cSrcweir         rValue >>= aString;
463*cdf0e10cSrcweir         if ( aString != maBubbleTitle ) {
464*cdf0e10cSrcweir             maBubbleTitle = aString;
465*cdf0e10cSrcweir             mbBubbleChanged = true;
466*cdf0e10cSrcweir         }
467*cdf0e10cSrcweir     }
468*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_TEXT ) == 0 ) {
469*cdf0e10cSrcweir         rValue >>= aString;
470*cdf0e10cSrcweir         if ( aString != maBubbleText ) {
471*cdf0e10cSrcweir             maBubbleText = aString;
472*cdf0e10cSrcweir             mbBubbleChanged = true;
473*cdf0e10cSrcweir         }
474*cdf0e10cSrcweir     }
475*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_IMAGE ) == 0 ) {
476*cdf0e10cSrcweir         rValue >>= aString;
477*cdf0e10cSrcweir         if ( aString != maBubbleImageURL ) {
478*cdf0e10cSrcweir             maBubbleImageURL = aString;
479*cdf0e10cSrcweir             maBubbleImage = GetBubbleImage( maBubbleImageURL );
480*cdf0e10cSrcweir             mbBubbleChanged = true;
481*cdf0e10cSrcweir         }
482*cdf0e10cSrcweir     }
483*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_SHOW_BUBBLE ) == 0 ) {
484*cdf0e10cSrcweir         rValue >>= mbShowBubble;
485*cdf0e10cSrcweir 		if ( mbShowBubble )
486*cdf0e10cSrcweir             Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) );
487*cdf0e10cSrcweir         else if ( mpBubbleWin )
488*cdf0e10cSrcweir             mpBubbleWin->Show( sal_False );
489*cdf0e10cSrcweir     }
490*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_CLICK_HDL ) == 0 ) {
491*cdf0e10cSrcweir         uno::Reference< task::XJob > aJob;
492*cdf0e10cSrcweir         rValue >>= aJob;
493*cdf0e10cSrcweir         if ( aJob.is() )
494*cdf0e10cSrcweir             mrJob = aJob;
495*cdf0e10cSrcweir         else
496*cdf0e10cSrcweir             throw lang::IllegalArgumentException();
497*cdf0e10cSrcweir     }
498*cdf0e10cSrcweir     else if (rPropertyName.compareToAscii( PROPERTY_SHOW_MENUICON ) == 0) {
499*cdf0e10cSrcweir         bool bShowMenuIcon = sal_False;
500*cdf0e10cSrcweir         rValue >>= bShowMenuIcon;
501*cdf0e10cSrcweir         if ( bShowMenuIcon != mbShowMenuIcon )
502*cdf0e10cSrcweir         {
503*cdf0e10cSrcweir             mbShowMenuIcon = bShowMenuIcon;
504*cdf0e10cSrcweir             if ( bShowMenuIcon )
505*cdf0e10cSrcweir                 Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) );
506*cdf0e10cSrcweir             else
507*cdf0e10cSrcweir                 RemoveBubbleWindow( true );
508*cdf0e10cSrcweir         }
509*cdf0e10cSrcweir     }
510*cdf0e10cSrcweir     else
511*cdf0e10cSrcweir         throw beans::UnknownPropertyException();
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir     if ( mbBubbleChanged && mpBubbleWin )
514*cdf0e10cSrcweir         mpBubbleWin->Show( sal_False );
515*cdf0e10cSrcweir }
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir //------------------------------------------------------------------------------
518*cdf0e10cSrcweir uno::Any UpdateCheckUI::getPropertyValue(const rtl::OUString& rPropertyName)
519*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
520*cdf0e10cSrcweir {
521*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir 	uno::Any aRet;
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir     if( rPropertyName.compareToAscii( PROPERTY_TITLE ) == 0 )
526*cdf0e10cSrcweir         aRet = uno::makeAny( maBubbleTitle );
527*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_TEXT ) == 0 )
528*cdf0e10cSrcweir         aRet = uno::makeAny( maBubbleText );
529*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_SHOW_BUBBLE ) == 0 )
530*cdf0e10cSrcweir         aRet = uno::makeAny( mbShowBubble );
531*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_IMAGE ) == 0 )
532*cdf0e10cSrcweir         aRet = uno::makeAny( maBubbleImageURL );
533*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_CLICK_HDL ) == 0 )
534*cdf0e10cSrcweir         aRet = uno::makeAny( mrJob );
535*cdf0e10cSrcweir     else if( rPropertyName.compareToAscii( PROPERTY_SHOW_MENUICON ) == 0 )
536*cdf0e10cSrcweir         aRet = uno::makeAny( mbShowMenuIcon );
537*cdf0e10cSrcweir     else
538*cdf0e10cSrcweir         throw beans::UnknownPropertyException();
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 	return aRet;
541*cdf0e10cSrcweir }
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir //------------------------------------------------------------------------------
544*cdf0e10cSrcweir void UpdateCheckUI::addPropertyChangeListener( const rtl::OUString& /*aPropertyName*/,
545*cdf0e10cSrcweir                                                const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
546*cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
547*cdf0e10cSrcweir {
548*cdf0e10cSrcweir 	//no bound properties
549*cdf0e10cSrcweir }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir //------------------------------------------------------------------------------
552*cdf0e10cSrcweir void UpdateCheckUI::removePropertyChangeListener( const rtl::OUString& /*aPropertyName*/,
553*cdf0e10cSrcweir                                                   const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
554*cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
555*cdf0e10cSrcweir {
556*cdf0e10cSrcweir 	//no bound properties
557*cdf0e10cSrcweir }
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir //------------------------------------------------------------------------------
560*cdf0e10cSrcweir void UpdateCheckUI::addVetoableChangeListener( const rtl::OUString& /*aPropertyName*/,
561*cdf0e10cSrcweir                                                const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
562*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
563*cdf0e10cSrcweir {
564*cdf0e10cSrcweir 	//no vetoable properties
565*cdf0e10cSrcweir }
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir //------------------------------------------------------------------------------
568*cdf0e10cSrcweir void UpdateCheckUI::removeVetoableChangeListener( const rtl::OUString& /*aPropertyName*/,
569*cdf0e10cSrcweir                                                   const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
570*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
571*cdf0e10cSrcweir {
572*cdf0e10cSrcweir 	//no vetoable properties
573*cdf0e10cSrcweir }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir //------------------------------------------------------------------------------
577*cdf0e10cSrcweir //------------------------------------------------------------------------------
578*cdf0e10cSrcweir //------------------------------------------------------------------------------
579*cdf0e10cSrcweir BubbleWindow * UpdateCheckUI::GetBubbleWindow()
580*cdf0e10cSrcweir {
581*cdf0e10cSrcweir     if ( !mpIconSysWin )
582*cdf0e10cSrcweir         return NULL;
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir     Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID );
585*cdf0e10cSrcweir     if( aIconRect.IsEmpty() )
586*cdf0e10cSrcweir         return NULL;
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir     BubbleWindow* pBubbleWin = mpBubbleWin;
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir     if ( !pBubbleWin ) {
591*cdf0e10cSrcweir         pBubbleWin = new BubbleWindow( mpIconSysWin,
592*cdf0e10cSrcweir 		  					           XubString( maBubbleTitle ),
593*cdf0e10cSrcweir                                        XubString( maBubbleText ),
594*cdf0e10cSrcweir                                        maBubbleImage );
595*cdf0e10cSrcweir         mbBubbleChanged = false;
596*cdf0e10cSrcweir     }
597*cdf0e10cSrcweir     else if ( mbBubbleChanged ) {
598*cdf0e10cSrcweir         pBubbleWin->SetTitleAndText( XubString( maBubbleTitle ),
599*cdf0e10cSrcweir                                      XubString( maBubbleText ),
600*cdf0e10cSrcweir                                      maBubbleImage );
601*cdf0e10cSrcweir         mbBubbleChanged = false;
602*cdf0e10cSrcweir     }
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir     Point aWinPos = aIconRect.BottomCenter();
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir     pBubbleWin->SetTipPosPixel( aWinPos );
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir     return pBubbleWin;
609*cdf0e10cSrcweir }
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir //------------------------------------------------------------------------------
612*cdf0e10cSrcweir void UpdateCheckUI::RemoveBubbleWindow( bool bRemoveIcon )
613*cdf0e10cSrcweir {
614*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir     maWaitTimer.Stop();
617*cdf0e10cSrcweir     maTimeoutTimer.Stop();
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir     if ( mpBubbleWin )
620*cdf0e10cSrcweir     {
621*cdf0e10cSrcweir         delete mpBubbleWin;
622*cdf0e10cSrcweir         mpBubbleWin = NULL;
623*cdf0e10cSrcweir     }
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir     if ( bRemoveIcon )
626*cdf0e10cSrcweir     {
627*cdf0e10cSrcweir         try {
628*cdf0e10cSrcweir             if ( mpIconMBar && ( mnIconID != 0 ) )
629*cdf0e10cSrcweir             {
630*cdf0e10cSrcweir                 mpIconMBar->RemoveMenuBarButton( mnIconID );
631*cdf0e10cSrcweir                 mpIconMBar = NULL;
632*cdf0e10cSrcweir                 mnIconID = 0;
633*cdf0e10cSrcweir             }
634*cdf0e10cSrcweir         }
635*cdf0e10cSrcweir         catch ( ... ) {
636*cdf0e10cSrcweir             mpIconMBar = NULL;
637*cdf0e10cSrcweir             mnIconID = 0;
638*cdf0e10cSrcweir         }
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir         mpIconSysWin = NULL;
641*cdf0e10cSrcweir     }
642*cdf0e10cSrcweir }
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir // -----------------------------------------------------------------------
645*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, ClickHdl, sal_uInt16*, EMPTYARG )
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir     maWaitTimer.Stop();
650*cdf0e10cSrcweir     if ( mpBubbleWin )
651*cdf0e10cSrcweir         mpBubbleWin->Show( sal_False );
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir     if ( mrJob.is() )
654*cdf0e10cSrcweir     {
655*cdf0e10cSrcweir         try {
656*cdf0e10cSrcweir             uno::Sequence<beans::NamedValue> aEmpty;
657*cdf0e10cSrcweir             mrJob->execute( aEmpty );
658*cdf0e10cSrcweir         }
659*cdf0e10cSrcweir         catch(const uno::Exception&) {
660*cdf0e10cSrcweir             ErrorBox( NULL, ResId( MSG_ERR_NO_WEBBROWSER_FOUND, *mpSfxResMgr )).Execute();
661*cdf0e10cSrcweir         }
662*cdf0e10cSrcweir     }
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir     return 0;
665*cdf0e10cSrcweir }
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir // -----------------------------------------------------------------------
668*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, HighlightHdl, MenuBar::MenuBarButtonCallbackArg*, pData )
669*cdf0e10cSrcweir {
670*cdf0e10cSrcweir 	if ( pData->bHighlight )
671*cdf0e10cSrcweir         maWaitTimer.Start();
672*cdf0e10cSrcweir     else
673*cdf0e10cSrcweir         RemoveBubbleWindow( false );
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir 	return 0;
676*cdf0e10cSrcweir }
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir // -----------------------------------------------------------------------
679*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, WaitTimeOutHdl, Timer*, EMPTYARG )
680*cdf0e10cSrcweir {
681*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir     mpBubbleWin = GetBubbleWindow();
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir     if ( mpBubbleWin )
686*cdf0e10cSrcweir     {
687*cdf0e10cSrcweir         mpBubbleWin->Show();
688*cdf0e10cSrcweir     }
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 	return 0;
691*cdf0e10cSrcweir }
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir // -----------------------------------------------------------------------
694*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, TimeOutHdl, Timer*, EMPTYARG )
695*cdf0e10cSrcweir {
696*cdf0e10cSrcweir     RemoveBubbleWindow( false );
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir 	return 0;
699*cdf0e10cSrcweir }
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir // -----------------------------------------------------------------------
702*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, UserEventHdl, UpdateCheckUI*, EMPTYARG )
703*cdf0e10cSrcweir {
704*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir     Window *pTopWin = Application::GetFirstTopLevelWindow();
707*cdf0e10cSrcweir     Window *pActiveWin = Application::GetActiveTopWindow();
708*cdf0e10cSrcweir 	SystemWindow *pActiveSysWin = NULL;
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir     Window *pBubbleWin = NULL;
711*cdf0e10cSrcweir     if ( mpBubbleWin )
712*cdf0e10cSrcweir         pBubbleWin = mpBubbleWin;
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir 	if ( pActiveWin && ( pActiveWin != pBubbleWin ) && pActiveWin->IsTopWindow() )
715*cdf0e10cSrcweir 		pActiveSysWin = pActiveWin->GetSystemWindow();
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir     if ( pActiveWin == pBubbleWin )
718*cdf0e10cSrcweir         pActiveSysWin = NULL;
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir     while ( !pActiveSysWin && pTopWin )
721*cdf0e10cSrcweir     {
722*cdf0e10cSrcweir         if ( ( pTopWin != pBubbleWin ) && pTopWin->IsTopWindow() )
723*cdf0e10cSrcweir             pActiveSysWin = pTopWin->GetSystemWindow();
724*cdf0e10cSrcweir         if ( !pActiveSysWin )
725*cdf0e10cSrcweir             pTopWin = Application::GetNextTopLevelWindow( pTopWin );
726*cdf0e10cSrcweir     }
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir 	if ( pActiveSysWin )
729*cdf0e10cSrcweir         AddMenuBarIcon( pActiveSysWin, true );
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir     return 0;
732*cdf0e10cSrcweir }
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir // -----------------------------------------------------------------------
735*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent )
736*cdf0e10cSrcweir {
737*cdf0e10cSrcweir     sal_uLong nEventID = pEvent->GetId();
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir     if ( VCLEVENT_OBJECT_DYING == nEventID )
740*cdf0e10cSrcweir     {
741*cdf0e10cSrcweir         vos::OGuard aGuard( Application::GetSolarMutex() );
742*cdf0e10cSrcweir         if ( mpIconSysWin == pEvent->GetWindow() )
743*cdf0e10cSrcweir         {
744*cdf0e10cSrcweir             mpIconSysWin->RemoveEventListener( maWindowEventHdl );
745*cdf0e10cSrcweir             RemoveBubbleWindow( true );
746*cdf0e10cSrcweir         }
747*cdf0e10cSrcweir     }
748*cdf0e10cSrcweir     else if ( VCLEVENT_WINDOW_MENUBARADDED == nEventID )
749*cdf0e10cSrcweir     {
750*cdf0e10cSrcweir         vos::OGuard aGuard( Application::GetSolarMutex() );
751*cdf0e10cSrcweir         Window *pWindow = pEvent->GetWindow();
752*cdf0e10cSrcweir         if ( pWindow )
753*cdf0e10cSrcweir         {
754*cdf0e10cSrcweir             SystemWindow *pSysWin = pWindow->GetSystemWindow();
755*cdf0e10cSrcweir             if ( pSysWin )
756*cdf0e10cSrcweir             {
757*cdf0e10cSrcweir                 AddMenuBarIcon( pSysWin, false );
758*cdf0e10cSrcweir             }
759*cdf0e10cSrcweir         }
760*cdf0e10cSrcweir     }
761*cdf0e10cSrcweir     else if ( VCLEVENT_WINDOW_MENUBARREMOVED == nEventID )
762*cdf0e10cSrcweir     {
763*cdf0e10cSrcweir         vos::OGuard aGuard( Application::GetSolarMutex() );
764*cdf0e10cSrcweir         MenuBar *pMBar = (MenuBar*) pEvent->GetData();
765*cdf0e10cSrcweir         if ( pMBar && ( pMBar == mpIconMBar ) )
766*cdf0e10cSrcweir             RemoveBubbleWindow( true );
767*cdf0e10cSrcweir     }
768*cdf0e10cSrcweir     else if ( ( nEventID == VCLEVENT_WINDOW_MOVE ) ||
769*cdf0e10cSrcweir               ( nEventID == VCLEVENT_WINDOW_RESIZE ) )
770*cdf0e10cSrcweir     {
771*cdf0e10cSrcweir         vos::OGuard aGuard( Application::GetSolarMutex() );
772*cdf0e10cSrcweir         if ( ( mpIconSysWin == pEvent->GetWindow() ) &&
773*cdf0e10cSrcweir              ( mpBubbleWin != NULL ) && ( mpIconMBar != NULL ) )
774*cdf0e10cSrcweir         {
775*cdf0e10cSrcweir             Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID );
776*cdf0e10cSrcweir             Point aWinPos = aIconRect.BottomCenter();
777*cdf0e10cSrcweir             mpBubbleWin->SetTipPosPixel( aWinPos );
778*cdf0e10cSrcweir             if ( mpBubbleWin->IsVisible() )
779*cdf0e10cSrcweir                 mpBubbleWin->Show();    // This will recalc the screen positon of the bubble
780*cdf0e10cSrcweir         }
781*cdf0e10cSrcweir     }
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir     return 0;
784*cdf0e10cSrcweir }
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir //------------------------------------------------------------------------------
787*cdf0e10cSrcweir IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent)
788*cdf0e10cSrcweir {
789*cdf0e10cSrcweir     switch (pEvent->GetId())
790*cdf0e10cSrcweir     {
791*cdf0e10cSrcweir         case VCLEVENT_WINDOW_SHOW:
792*cdf0e10cSrcweir         case VCLEVENT_WINDOW_ACTIVATE:
793*cdf0e10cSrcweir         case VCLEVENT_WINDOW_GETFOCUS: {
794*cdf0e10cSrcweir             vos::OGuard aGuard( Application::GetSolarMutex() );
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir             Window *pWindow = static_cast< VclWindowEvent * >(pEvent)->GetWindow();
797*cdf0e10cSrcweir             if ( pWindow && pWindow->IsTopWindow() )
798*cdf0e10cSrcweir             {
799*cdf0e10cSrcweir                 SystemWindow *pSysWin = pWindow->GetSystemWindow();
800*cdf0e10cSrcweir                 MenuBar      *pMBar   = pSysWin->GetMenuBar();
801*cdf0e10cSrcweir                 if ( pSysWin && pMBar )
802*cdf0e10cSrcweir                 {
803*cdf0e10cSrcweir                     AddMenuBarIcon( pSysWin, true );
804*cdf0e10cSrcweir                 }
805*cdf0e10cSrcweir             }
806*cdf0e10cSrcweir             break;
807*cdf0e10cSrcweir         }
808*cdf0e10cSrcweir     }
809*cdf0e10cSrcweir     return 0;
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir //------------------------------------------------------------------------------
812*cdf0e10cSrcweir //------------------------------------------------------------------------------
813*cdf0e10cSrcweir //------------------------------------------------------------------------------
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir #define TIP_HEIGHT             15
816*cdf0e10cSrcweir #define TIP_WIDTH               7
817*cdf0e10cSrcweir #define TIP_RIGHT_OFFSET       18
818*cdf0e10cSrcweir #define BUBBLE_BORDER          10
819*cdf0e10cSrcweir #define TEXT_MAX_WIDTH        300
820*cdf0e10cSrcweir #define TEXT_MAX_HEIGHT       200
821*cdf0e10cSrcweir #define INITIAL_SHOW_TIME   10000
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir //------------------------------------------------------------------------------
824*cdf0e10cSrcweir BubbleWindow::BubbleWindow( Window* pParent, const XubString& rTitle,
825*cdf0e10cSrcweir                             const XubString& rText, const Image& rImage )
826*cdf0e10cSrcweir     : FloatingWindow( pParent, WB_SYSTEMWINDOW
827*cdf0e10cSrcweir                                | WB_OWNERDRAWDECORATION
828*cdf0e10cSrcweir                                | WB_NOBORDER
829*cdf0e10cSrcweir                     )
830*cdf0e10cSrcweir     , maBubbleTitle( rTitle )
831*cdf0e10cSrcweir     , maBubbleText( rText )
832*cdf0e10cSrcweir     , maBubbleImage( rImage )
833*cdf0e10cSrcweir     , maMaxTextSize( TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT )
834*cdf0e10cSrcweir     , mnTipOffset( 0 )
835*cdf0e10cSrcweir {
836*cdf0e10cSrcweir     SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetHelpColor() ) );
837*cdf0e10cSrcweir }
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir //------------------------------------------------------------------------------
840*cdf0e10cSrcweir BubbleWindow::~BubbleWindow()
841*cdf0e10cSrcweir {
842*cdf0e10cSrcweir }
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir //------------------------------------------------------------------------------
845*cdf0e10cSrcweir void BubbleWindow::Resize()
846*cdf0e10cSrcweir {
847*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir 	FloatingWindow::Resize();
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir     Size aSize = GetSizePixel();
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir     if ( ( aSize.Height() < 20 ) || ( aSize.Width() < 60 ) )
854*cdf0e10cSrcweir         return;
855*cdf0e10cSrcweir 
856*cdf0e10cSrcweir     Rectangle aRect( 0, TIP_HEIGHT, aSize.Width(), aSize.Height() - TIP_HEIGHT );
857*cdf0e10cSrcweir 	maRectPoly = Polygon( aRect, 6, 6 );
858*cdf0e10cSrcweir     Region aRegion( maRectPoly );
859*cdf0e10cSrcweir     long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset;
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir     Point aPointArr[4];
862*cdf0e10cSrcweir     aPointArr[0] = Point( nTipOffset, TIP_HEIGHT );
863*cdf0e10cSrcweir     aPointArr[1] = Point( nTipOffset, 0 );
864*cdf0e10cSrcweir     aPointArr[2] = Point( nTipOffset + TIP_WIDTH , TIP_HEIGHT );
865*cdf0e10cSrcweir     aPointArr[3] = Point( nTipOffset, TIP_HEIGHT );
866*cdf0e10cSrcweir  	maTriPoly = Polygon( 4, aPointArr );
867*cdf0e10cSrcweir     Region aTriRegion( maTriPoly );
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir     aRegion.Union( aTriRegion);
870*cdf0e10cSrcweir     maBounds = aRegion;
871*cdf0e10cSrcweir 
872*cdf0e10cSrcweir 	SetWindowRegionPixel( maBounds );
873*cdf0e10cSrcweir }
874*cdf0e10cSrcweir 
875*cdf0e10cSrcweir //------------------------------------------------------------------------------
876*cdf0e10cSrcweir void BubbleWindow::SetTitleAndText( const XubString& rTitle,
877*cdf0e10cSrcweir                                     const XubString& rText,
878*cdf0e10cSrcweir                                     const Image& rImage )
879*cdf0e10cSrcweir {
880*cdf0e10cSrcweir     maBubbleTitle = rTitle;
881*cdf0e10cSrcweir     maBubbleText = rText;
882*cdf0e10cSrcweir     maBubbleImage = rImage;
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir     Resize();
885*cdf0e10cSrcweir }
886*cdf0e10cSrcweir 
887*cdf0e10cSrcweir //------------------------------------------------------------------------------
888*cdf0e10cSrcweir void BubbleWindow::Paint( const Rectangle& )
889*cdf0e10cSrcweir {
890*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir     LineInfo aThickLine( LINE_SOLID, 2 );
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir     DrawPolyLine( maRectPoly, aThickLine );
895*cdf0e10cSrcweir     DrawPolyLine( maTriPoly );
896*cdf0e10cSrcweir 
897*cdf0e10cSrcweir     Color aOldLine = GetLineColor();
898*cdf0e10cSrcweir     Size aSize = GetSizePixel();
899*cdf0e10cSrcweir     long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset;
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir     SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() );
902*cdf0e10cSrcweir     DrawLine( Point( nTipOffset+2, TIP_HEIGHT ),
903*cdf0e10cSrcweir               Point( nTipOffset + TIP_WIDTH -1 , TIP_HEIGHT ),
904*cdf0e10cSrcweir               aThickLine );
905*cdf0e10cSrcweir     SetLineColor( aOldLine );
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir 	//Image aImage = InfoBox::GetStandardImage();
908*cdf0e10cSrcweir 	Size aImgSize = maBubbleImage.GetSizePixel();
909*cdf0e10cSrcweir 
910*cdf0e10cSrcweir 	DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage );
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir 	Font aOldFont = GetFont();
913*cdf0e10cSrcweir 	Font aBoldFont = aOldFont;
914*cdf0e10cSrcweir 	aBoldFont.SetWeight( WEIGHT_BOLD );
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir     SetFont( aBoldFont );
917*cdf0e10cSrcweir     Rectangle aTitleRect = maTitleRect;
918*cdf0e10cSrcweir 	aTitleRect.Move( aImgSize.Width(), 0 );
919*cdf0e10cSrcweir     DrawText( aTitleRect, maBubbleTitle, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir     SetFont( aOldFont );
922*cdf0e10cSrcweir     Rectangle aTextRect = maTextRect;
923*cdf0e10cSrcweir 	aTextRect.Move( aImgSize.Width(), 0 );
924*cdf0e10cSrcweir     DrawText( aTextRect, maBubbleText, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
925*cdf0e10cSrcweir }
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir //------------------------------------------------------------------------------
928*cdf0e10cSrcweir void BubbleWindow::MouseButtonDown( const MouseEvent& )
929*cdf0e10cSrcweir {
930*cdf0e10cSrcweir     Show( sal_False );
931*cdf0e10cSrcweir }
932*cdf0e10cSrcweir 
933*cdf0e10cSrcweir //------------------------------------------------------------------------------
934*cdf0e10cSrcweir void BubbleWindow::Show( sal_Bool bVisible, sal_uInt16 nFlags )
935*cdf0e10cSrcweir {
936*cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir 	if ( !bVisible )
939*cdf0e10cSrcweir     {
940*cdf0e10cSrcweir         FloatingWindow::Show( bVisible );
941*cdf0e10cSrcweir         return;
942*cdf0e10cSrcweir     }
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir     // don't show bubbles without a text
945*cdf0e10cSrcweir     if ( ( maBubbleTitle.Len() == 0 ) && ( maBubbleText.Len() == 0 ) )
946*cdf0e10cSrcweir         return;
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir 	Size aWindowSize = GetSizePixel();
949*cdf0e10cSrcweir 
950*cdf0e10cSrcweir 	// Image aImage = InfoBox::GetStandardImage();
951*cdf0e10cSrcweir 	Size aImgSize = maBubbleImage.GetSizePixel();
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir 	RecalcTextRects();
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir 	aWindowSize.setHeight( maTitleRect.GetHeight() * 7 / 4+ maTextRect.GetHeight() +
956*cdf0e10cSrcweir 						   3 * BUBBLE_BORDER + TIP_HEIGHT );
957*cdf0e10cSrcweir 
958*cdf0e10cSrcweir 	if ( maTitleRect.GetWidth() > maTextRect.GetWidth() )
959*cdf0e10cSrcweir 		aWindowSize.setWidth( maTitleRect.GetWidth() );
960*cdf0e10cSrcweir 	else
961*cdf0e10cSrcweir 		aWindowSize.setWidth( maTextRect.GetWidth() );
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir 	aWindowSize.setWidth( aWindowSize.Width() + 3 * BUBBLE_BORDER + aImgSize.Width() );
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 	if ( aWindowSize.Height() < aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER )
966*cdf0e10cSrcweir 		aWindowSize.setHeight( aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER );
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir 	Point aPos;
969*cdf0e10cSrcweir 	aPos.X() = maTipPos.X() - aWindowSize.Width() + TIP_RIGHT_OFFSET;
970*cdf0e10cSrcweir     aPos.Y() = maTipPos.Y();
971*cdf0e10cSrcweir     Point aScreenPos = GetParent()->OutputToAbsoluteScreenPixel( aPos );
972*cdf0e10cSrcweir     if ( aScreenPos.X() < 0 )
973*cdf0e10cSrcweir     {
974*cdf0e10cSrcweir         mnTipOffset = aScreenPos.X();
975*cdf0e10cSrcweir         aPos.X() -= mnTipOffset;
976*cdf0e10cSrcweir     }
977*cdf0e10cSrcweir 	SetPosSizePixel( aPos, aWindowSize );
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir 	FloatingWindow::Show( bVisible, nFlags );
980*cdf0e10cSrcweir }
981*cdf0e10cSrcweir 
982*cdf0e10cSrcweir //------------------------------------------------------------------------------
983*cdf0e10cSrcweir void BubbleWindow::RecalcTextRects()
984*cdf0e10cSrcweir {
985*cdf0e10cSrcweir     Size aTotalSize;
986*cdf0e10cSrcweir     sal_Bool bFinished = sal_False;
987*cdf0e10cSrcweir 	Font aOldFont = GetFont();
988*cdf0e10cSrcweir 	Font aBoldFont = aOldFont;
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir 	aBoldFont.SetWeight( WEIGHT_BOLD );
991*cdf0e10cSrcweir 
992*cdf0e10cSrcweir     while ( !bFinished )
993*cdf0e10cSrcweir     {
994*cdf0e10cSrcweir         SetFont( aBoldFont );
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir         maTitleRect = GetTextRect( Rectangle( Point( 0, 0 ), maMaxTextSize ),
997*cdf0e10cSrcweir                                    maBubbleTitle,
998*cdf0e10cSrcweir 								   TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir         SetFont( aOldFont );
1001*cdf0e10cSrcweir         maTextRect = GetTextRect( Rectangle( Point( 0, 0 ), maMaxTextSize ),
1002*cdf0e10cSrcweir                                   maBubbleText,
1003*cdf0e10cSrcweir                                   TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir         if ( maTextRect.GetHeight() < 10 )
1006*cdf0e10cSrcweir             maTextRect.setHeight( 10 );
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir 	    aTotalSize.setHeight( maTitleRect.GetHeight() +
1009*cdf0e10cSrcweir 							  aBoldFont.GetHeight() * 3 / 4 +
1010*cdf0e10cSrcweir 							  maTextRect.GetHeight() +
1011*cdf0e10cSrcweir 						      3 * BUBBLE_BORDER + TIP_HEIGHT );
1012*cdf0e10cSrcweir         if ( aTotalSize.Height() > maMaxTextSize.Height() )
1013*cdf0e10cSrcweir         {
1014*cdf0e10cSrcweir             maMaxTextSize.Width() = maMaxTextSize.Width() * 3 / 2;
1015*cdf0e10cSrcweir             maMaxTextSize.Height() = maMaxTextSize.Height() * 3 / 2;
1016*cdf0e10cSrcweir         }
1017*cdf0e10cSrcweir         else
1018*cdf0e10cSrcweir             bFinished = sal_True;
1019*cdf0e10cSrcweir     }
1020*cdf0e10cSrcweir     maTitleRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT );
1021*cdf0e10cSrcweir 	maTextRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT + maTitleRect.GetHeight() + aBoldFont.GetHeight() * 3 / 4 );
1022*cdf0e10cSrcweir }
1023*cdf0e10cSrcweir //------------------------------------------------------------------------------
1024*cdf0e10cSrcweir //------------------------------------------------------------------------------
1025*cdf0e10cSrcweir //------------------------------------------------------------------------------
1026*cdf0e10cSrcweir 
1027*cdf0e10cSrcweir } // anonymous namespace
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir //------------------------------------------------------------------------------
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir static uno::Reference<uno::XInterface> SAL_CALL
1032*cdf0e10cSrcweir createInstance(const uno::Reference<uno::XComponentContext>& xContext)
1033*cdf0e10cSrcweir {
1034*cdf0e10cSrcweir     return  *new UpdateCheckUI(xContext);
1035*cdf0e10cSrcweir }
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir //------------------------------------------------------------------------------
1038*cdf0e10cSrcweir 
1039*cdf0e10cSrcweir static const cppu::ImplementationEntry kImplementations_entries[] =
1040*cdf0e10cSrcweir {
1041*cdf0e10cSrcweir     {
1042*cdf0e10cSrcweir         createInstance,
1043*cdf0e10cSrcweir         getImplementationName,
1044*cdf0e10cSrcweir         getServiceNames,
1045*cdf0e10cSrcweir         cppu::createSingleComponentFactory,
1046*cdf0e10cSrcweir         NULL,
1047*cdf0e10cSrcweir         0
1048*cdf0e10cSrcweir     },
1049*cdf0e10cSrcweir 	{ NULL, NULL, NULL, NULL, NULL, 0 }
1050*cdf0e10cSrcweir } ;
1051*cdf0e10cSrcweir 
1052*cdf0e10cSrcweir //------------------------------------------------------------------------------
1053*cdf0e10cSrcweir 
1054*cdf0e10cSrcweir extern "C" void SAL_CALL
1055*cdf0e10cSrcweir component_getImplementationEnvironment( const sal_Char **aEnvTypeName, uno_Environment **)
1056*cdf0e10cSrcweir {
1057*cdf0e10cSrcweir     *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
1058*cdf0e10cSrcweir }
1059*cdf0e10cSrcweir 
1060*cdf0e10cSrcweir //------------------------------------------------------------------------------
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir extern "C" void *
1063*cdf0e10cSrcweir component_getFactory(const sal_Char *pszImplementationName, void *pServiceManager, void *pRegistryKey)
1064*cdf0e10cSrcweir {
1065*cdf0e10cSrcweir     return cppu::component_getFactoryHelper(
1066*cdf0e10cSrcweir         pszImplementationName,
1067*cdf0e10cSrcweir         pServiceManager,
1068*cdf0e10cSrcweir         pRegistryKey,
1069*cdf0e10cSrcweir         kImplementations_entries) ;
1070*cdf0e10cSrcweir }
1071*cdf0e10cSrcweir 
1072