xref: /trunk/main/framework/inc/helper/tagwindowasmodified.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
25 #define __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //  my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/debug.hxx>
33 #include <macros/xinterface.hxx>
34 #include <macros/xtypeprovider.hxx>
35 #include <general.h>
36 
37 //_________________________________________________________________________________________________________________
38 //  interface includes
39 //_________________________________________________________________________________________________________________
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include <com/sun/star/lang/XInitialization.hpp>
42 #include <com/sun/star/frame/XFrame.hpp>
43 #include <com/sun/star/util/XModifyListener.hpp>
44 #include <com/sun/star/lang/XEventListener.hpp>
45 #include <com/sun/star/frame/XFrameActionListener.hpp>
46 
47 //_________________________________________________________________________________________________________________
48 //  other includes
49 //_________________________________________________________________________________________________________________
50 #include <cppuhelper/weak.hxx>
51 
52 //_________________________________________________________________________________________________________________
53 //  const
54 //_________________________________________________________________________________________________________________
55 
56 //_________________________________________________________________________________________________________________
57 //  namespace
58 //_________________________________________________________________________________________________________________
59 
60 namespace framework{
61 
62 //_________________________________________________________________________________________________________________
63 //  declarations
64 //_________________________________________________________________________________________________________________
65 
66 /*-************************************************************************************************************//**
67     @short          listen for modify events on model and tag frame container window so it can react accordingly
68     @descr          Used e.g. by our MAC port where such state is shown separately on some controls of the
69                     title bar.
70 
71     @base           ThreadHelpBase
72                         guarantee right initialized lock member during startup of instances of this class.
73 
74     @base           OWeakObject
75                         implements ref counting for this class.
76 
77     @devstatus      draft
78     @threadsafe     yes
79     @modified       as96863
80 *//*-*************************************************************************************************************/
81 class TagWindowAsModified :   // interfaces
82                               public css::lang::XTypeProvider,
83                               public css::lang::XInitialization,
84                               public css::frame::XFrameActionListener, // => XEventListener
85                               public css::util::XModifyListener,       // => XEventListener
86                               // baseclasses (order necessary for right initialization!)
87                               private ThreadHelpBase,
88                               public  ::cppu::OWeakObject
89 {
90     //________________________________
91     // member
92 
93     private:
94 
95         /// may we need an uno service manager to create own services
96         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
97 
98         /// reference to the frame, where we listen for new loaded documents for updating our own xModel reference
99         css::uno::WeakReference< css::frame::XFrame > m_xFrame;
100 
101         /// reference to the frame container window, where we must set the tag
102         css::uno::WeakReference< css::awt::XWindow > m_xWindow;
103 
104         /// we list on the model for modify events
105         css::uno::WeakReference< css::frame::XModel > m_xModel;
106 
107     //________________________________
108     // interface
109 
110     public:
111 
112         //____________________________
113         // ctor/dtor
114                  TagWindowAsModified(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
115         virtual ~TagWindowAsModified(                                                                   );
116 
117         //____________________________
118         // XInterface, XTypeProvider
119         FWK_DECLARE_XINTERFACE
120         FWK_DECLARE_XTYPEPROVIDER
121 
122         //____________________________
123         // XInitialization
124         virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments);
125 
126         //____________________________
127         // XModifyListener
128         virtual void SAL_CALL modified(const css::lang::EventObject& aEvent);
129 
130         //____________________________
131         // XFrameActionListener
132         virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent);
133 
134         //____________________________
135         // XEventListener
136         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent);
137 
138     private:
139 
140         //____________________________
141         // @todo document me
142         void impl_update(const css::uno::Reference< css::frame::XFrame >& xFrame);
143 
144 }; // class TagWindowAsModified
145 
146 } // namespace framework
147 
148 #endif // #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_
149