1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ShellStackGuard.hxx,v $
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 #ifndef SD_FRAMEWORK_SHELL_STACK_GUARD_HXX
32 #define SD_FRAMEWORK_SHELL_STACK_GUARD_HXX
34 #include <cppuhelper/basemutex.hxx>
36 #include "framework/ConfigurationController.hxx"
38 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
39 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
40 #include <com/sun/star/frame/XController.hpp>
42 #include <vcl/timer.hxx>
43 #include <cppuhelper/compbase1.hxx>
44 #include <boost/scoped_ptr.hpp>
47 namespace css
= ::com::sun::star
;
52 typedef ::cppu::WeakComponentImplHelper1
<
53 css::drawing::framework::XConfigurationChangeListener
54 > ShellStackGuardInterfaceBase
;
56 } // end of anonymous namespace.
67 namespace sd
{ namespace framework
{
69 /** This module locks updates of the current configuration in situations
70 when the shell stack must not be modified.
72 On every start of a configuration update the ShellStackGuard checks the
73 printer. If it is printing the configuration update is locked. It then
74 polls the printer and unlocks updates when printing finishes.
76 When in the future there are no resources left that use shells then this
77 module can be removed.
80 : private ::cppu::BaseMutex
,
81 public ShellStackGuardInterfaceBase
84 ShellStackGuard (css::uno::Reference
<css::frame::XController
>& rxController
);
85 virtual ~ShellStackGuard (void);
87 virtual void SAL_CALL
disposing (void);
90 // XConfigurationChangeListener
92 virtual void SAL_CALL
notifyConfigurationChange (
93 const css::drawing::framework::ConfigurationChangeEvent
& rEvent
)
94 throw (css::uno::RuntimeException
);
98 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
)
99 throw (css::uno::RuntimeException
);
102 css::uno::Reference
<css::drawing::framework::XConfigurationController
>
103 mxConfigurationController
;
104 ViewShellBase
* mpBase
;
105 ::boost::scoped_ptr
<ConfigurationController::Lock
> mpUpdateLock
;
106 Timer maPrinterPollingTimer
;
108 DECL_LINK(TimeoutHandler
, Timer
*);
110 /** Return <TRUE/> when the printer is printing. Return <FALSE/> when
111 the printer is not printing, or there is no printer, or someting
114 bool IsPrinting (void) const;
117 } } // end of namespace sd::framework