Update ooo320-m1
[ooovba.git] / sfx2 / source / bastyp / fltlst.cxx
blob0ec1bd03f815bbbf412d04e8433d82ea1d98cd13
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fltlst.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
34 #include "fltlst.hxx"
36 //*****************************************************************************************************************
37 // includes
38 //*****************************************************************************************************************
39 #include <com/sun/star/uno/Sequence.hxx>
40 #include <com/sun/star/uno/Any.hxx>
41 #include <comphelper/processfactory.hxx>
43 #include <sfx2/sfxuno.hxx>
44 #include <sfx2/docfac.hxx>
46 #include <vcl/svapp.hxx>
47 #include <vos/mutex.hxx>
49 //*****************************************************************************************************************
50 // namespaces
51 //*****************************************************************************************************************
52 using namespace ::com::sun::star;
54 //*****************************************************************************************************************
55 // definitions
56 //*****************************************************************************************************************
58 /*-************************************************************************************************************//**
59 @short ctor
60 @descr These initialize an instance of a SfxFilterListener class. Created object listen automaticly
61 on right FilterFactory-Service for all changes and synchronize right SfxFilterContainer with
62 corresponding framework-cache.
63 We use given "sFactory" value to decide which query must be used to fill "pContainer" with new values.
64 Given "pContainer" hold us alive as uno reference and we use it to syschronize it with framework caches.
65 We will die, if he die! see dtor for further informations.
67 @seealso dtor
68 @seealso class framework::FilterCache
69 @seealso service ::document::FilterFactory
71 @param "sFactory" , short name of module which contains filter container
72 @param "pContainer", pointer to filter container which will be informed
73 @return -
75 @onerror We show some assertions in non product version.
76 Otherwise we do nothing!
77 @threadsafe yes
79 @last_change 17.10.2001 10:27
80 *//*-*************************************************************************************************************/
81 SfxFilterListener::SfxFilterListener()
83 uno::Reference< lang::XMultiServiceFactory > xSmgr = ::comphelper::getProcessServiceFactory();
84 if( xSmgr.is() == sal_True )
86 uno::Reference< util::XRefreshable > xNotifier( xSmgr->createInstance( DEFINE_CONST_OUSTRING("com.sun.star.document.FilterConfigRefresh") ), uno::UNO_QUERY );
87 if( xNotifier.is() == sal_True )
89 m_xFilterCache = xNotifier;
90 m_xFilterCache->addRefreshListener( this );
95 SfxFilterListener::~SfxFilterListener()
99 void SAL_CALL SfxFilterListener::refreshed( const lang::EventObject& aSource ) throw( uno::RuntimeException )
101 ::vos::OGuard aGuard( Application::GetSolarMutex() );
102 uno::Reference< util::XRefreshable > xContainer( aSource.Source, uno::UNO_QUERY );
104 (xContainer.is() ) &&
105 (xContainer==m_xFilterCache)
108 SfxFilterContainer::ReadFilters_Impl( TRUE );
112 void SAL_CALL SfxFilterListener::disposing( const lang::EventObject& aSource ) throw( uno::RuntimeException )
114 ::vos::OGuard aGuard( Application::GetSolarMutex() );
115 uno::Reference< util::XRefreshable > xNotifier( aSource.Source, uno::UNO_QUERY );
116 if (!xNotifier.is())
117 return;
119 if (xNotifier == m_xFilterCache)
120 m_xFilterCache.clear();