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: tagwindowasmodified.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 __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
32 #define __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/debug.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
44 //_________________________________________________________________________________________________________________
46 //_________________________________________________________________________________________________________________
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/lang/XInitialization.hpp>
49 #include <com/sun/star/frame/XFrame.hpp>
50 #include <com/sun/star/util/XModifyListener.hpp>
51 #include <com/sun/star/lang/XEventListener.hpp>
52 #include <com/sun/star/frame/XFrameActionListener.hpp>
54 //_________________________________________________________________________________________________________________
56 //_________________________________________________________________________________________________________________
57 #include <cppuhelper/weak.hxx>
59 //_________________________________________________________________________________________________________________
61 //_________________________________________________________________________________________________________________
63 //_________________________________________________________________________________________________________________
65 //_________________________________________________________________________________________________________________
69 //_________________________________________________________________________________________________________________
71 //_________________________________________________________________________________________________________________
73 /*-************************************************************************************************************//**
74 @short listen for modify events on model and tag frame container window so it can react accordingly
75 @descr Used e.g. by our MAC port where such state is shown seperately on some controls of the
79 guarantee right initialized lock member during startup of instances of this class.
82 implements ref counting for this class.
87 *//*-*************************************************************************************************************/
88 class TagWindowAsModified
: // interfaces
89 public css::lang::XTypeProvider
,
90 public css::lang::XInitialization
,
91 public css::frame::XFrameActionListener
, // => XEventListener
92 public css::util::XModifyListener
, // => XEventListener
93 // baseclasses (order neccessary for right initialization!)
94 private ThreadHelpBase
,
95 public ::cppu::OWeakObject
97 //________________________________
102 /// may we need an uno service manager to create own services
103 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
105 /// reference to the frame, where we listen for new loaded documents for updating our own xModel reference
106 css::uno::WeakReference
< css::frame::XFrame
> m_xFrame
;
108 /// reference to the frame container window, where we must set the tag
109 css::uno::WeakReference
< css::awt::XWindow
> m_xWindow
;
111 /// we list on the model for modify events
112 css::uno::WeakReference
< css::frame::XModel
> m_xModel
;
114 //________________________________
119 //____________________________
121 TagWindowAsModified(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
122 virtual ~TagWindowAsModified( );
124 //____________________________
125 // XInterface, XTypeProvider
126 FWK_DECLARE_XINTERFACE
127 FWK_DECLARE_XTYPEPROVIDER
129 //____________________________
131 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
>& lArguments
)
132 throw(css::uno::Exception
,
133 css::uno::RuntimeException
);
135 //____________________________
137 virtual void SAL_CALL
modified(const css::lang::EventObject
& aEvent
)
138 throw(css::uno::RuntimeException
);
140 //____________________________
141 // XFrameActionListener
142 virtual void SAL_CALL
frameAction(const css::frame::FrameActionEvent
& aEvent
)
143 throw(css::uno::RuntimeException
);
145 //____________________________
147 virtual void SAL_CALL
disposing(const css::lang::EventObject
& aEvent
)
148 throw(css::uno::RuntimeException
);
152 //____________________________
154 void impl_update(const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
156 }; // class TagWindowAsModified
158 } // namespace framework
160 #endif // #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_