update dev300-m58
[ooovba.git] / sfx2 / source / doc / docstoragemodifylistener.cxx
blob5d3ebf483d42ee27f6eeab7a14288cdaa7000be2
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: docstoragemodifylistener.cxx,v $
10 * $Revision: 1.4.28.1 $
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 "sfx2/docstoragemodifylistener.hxx"
35 #include <vos/mutex.hxx>
37 /** === begin UNO includes === **/
38 /** === end UNO includes === **/
40 //........................................................................
41 namespace sfx2
43 //........................................................................
45 /** === begin UNO using === **/
46 using ::com::sun::star::uno::Reference;
47 using ::com::sun::star::uno::XInterface;
48 using ::com::sun::star::uno::UNO_QUERY;
49 using ::com::sun::star::uno::UNO_QUERY_THROW;
50 using ::com::sun::star::uno::UNO_SET_THROW;
51 using ::com::sun::star::uno::Exception;
52 using ::com::sun::star::uno::RuntimeException;
53 using ::com::sun::star::uno::Any;
54 using ::com::sun::star::uno::makeAny;
55 using ::com::sun::star::lang::EventObject;
56 /** === end UNO using === **/
58 //====================================================================
59 //=
60 //====================================================================
61 //--------------------------------------------------------------------
62 DocumentStorageModifyListener::DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::vos::IMutex& _rMutex )
63 :m_pDocument( &_rDocument )
64 ,m_rMutex( _rMutex )
68 //--------------------------------------------------------------------
69 DocumentStorageModifyListener::~DocumentStorageModifyListener()
73 //--------------------------------------------------------------------
74 void DocumentStorageModifyListener::dispose()
76 ::vos::OGuard aGuard( m_rMutex );
77 m_pDocument = NULL;
80 //--------------------------------------------------------------------
81 void SAL_CALL DocumentStorageModifyListener::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
83 ::vos::OGuard aGuard( m_rMutex );
84 // storageIsModified must not contain any locking!
85 if ( m_pDocument )
86 m_pDocument->storageIsModified();
89 //--------------------------------------------------------------------
90 void SAL_CALL DocumentStorageModifyListener::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
92 // not interested in. In particular, we do *not* dispose ourself when a storage we're
93 // listening at is disposed. The reason here is that this listener instance is *reused*
94 // in case the document is re-based to another storage.
97 //........................................................................
98 } // namespace sfx2
99 //........................................................................