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