LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / helper / resettable.cxx
blob6eac1633d82d067ed0d133451a0f20465240caff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <resettable.hxx>
22 #include <cppuhelper/weak.hxx>
25 namespace frm
29 using ::com::sun::star::uno::Reference;
30 using ::com::sun::star::form::XResetListener;
31 using ::com::sun::star::lang::EventObject;
34 //= ResetHelper
37 void ResetHelper::addResetListener( const Reference< XResetListener >& _listener )
39 m_aResetListeners.addInterface( _listener );
43 void ResetHelper::removeResetListener( const Reference< XResetListener >& _listener )
45 m_aResetListeners.removeInterface( _listener );
49 bool ResetHelper::approveReset()
51 ::comphelper::OInterfaceIteratorHelper2 aIter( m_aResetListeners );
52 EventObject aResetEvent( m_rParent );
54 bool bContinue = true;
55 while ( aIter.hasMoreElements() && bContinue )
56 bContinue = static_cast< XResetListener* >( aIter.next() )->approveReset( aResetEvent );
58 return bContinue;
62 void ResetHelper::notifyResetted()
64 EventObject aResetEvent( m_rParent );
65 m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent );
69 void ResetHelper::disposing()
71 EventObject aEvent( m_rParent );
72 m_aResetListeners.disposeAndClear( aEvent );
76 } // namespace frm
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */