1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
21 #define __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/debug.hxx>
25 #include <macros/xinterface.hxx>
26 #include <macros/xtypeprovider.hxx>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 #include <com/sun/star/frame/XFrame.hpp>
32 #include <com/sun/star/util/XModifyListener.hpp>
33 #include <com/sun/star/lang/XEventListener.hpp>
34 #include <com/sun/star/frame/XFrameActionListener.hpp>
36 #include <cppuhelper/weak.hxx>
40 /*-************************************************************************************************************//**
41 @short listen for modify events on model and tag frame container window so it can react accordingly
42 @descr Used e.g. by our MAC port where such state is shown separately on some controls of the
46 guarantee right initialized lock member during startup of instances of this class.
49 implements ref counting for this class.
53 *//*-*************************************************************************************************************/
54 class TagWindowAsModified
: // interfaces
55 public css::lang::XTypeProvider
,
56 public css::lang::XInitialization
,
57 public css::frame::XFrameActionListener
, // => XEventListener
58 public css::util::XModifyListener
, // => XEventListener
59 // baseclasses (order necessary for right initialization!)
60 private ThreadHelpBase
,
61 public ::cppu::OWeakObject
63 //________________________________
68 /// may we need an uno service manager to create own services
69 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
71 /// reference to the frame, where we listen for new loaded documents for updating our own xModel reference
72 css::uno::WeakReference
< css::frame::XFrame
> m_xFrame
;
74 /// reference to the frame container window, where we must set the tag
75 css::uno::WeakReference
< css::awt::XWindow
> m_xWindow
;
77 /// we list on the model for modify events
78 css::uno::WeakReference
< css::frame::XModel
> m_xModel
;
80 //________________________________
85 //____________________________
87 TagWindowAsModified(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
88 virtual ~TagWindowAsModified( );
90 //____________________________
91 // XInterface, XTypeProvider
92 FWK_DECLARE_XINTERFACE
93 FWK_DECLARE_XTYPEPROVIDER
95 //____________________________
97 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
>& lArguments
)
98 throw(css::uno::Exception
,
99 css::uno::RuntimeException
);
101 //____________________________
103 virtual void SAL_CALL
modified(const css::lang::EventObject
& aEvent
)
104 throw(css::uno::RuntimeException
);
106 //____________________________
107 // XFrameActionListener
108 virtual void SAL_CALL
frameAction(const css::frame::FrameActionEvent
& aEvent
)
109 throw(css::uno::RuntimeException
);
111 //____________________________
113 virtual void SAL_CALL
disposing(const css::lang::EventObject
& aEvent
)
114 throw(css::uno::RuntimeException
);
118 //____________________________
120 void impl_update(const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
122 }; // class TagWindowAsModified
124 } // namespace framework
126 #endif // #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */