1*d119d52dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d119d52dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d119d52dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d119d52dSAndrew Rist  * distributed with this work for additional information
6*d119d52dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d119d52dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d119d52dSAndrew Rist  * "License"); you may not use this file except in compliance
9*d119d52dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d119d52dSAndrew Rist  *
11*d119d52dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d119d52dSAndrew Rist  *
13*d119d52dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d119d52dSAndrew Rist  * software distributed under the License is distributed on an
15*d119d52dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d119d52dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*d119d52dSAndrew Rist  * specific language governing permissions and limitations
18*d119d52dSAndrew Rist  * under the License.
19*d119d52dSAndrew Rist  *
20*d119d52dSAndrew Rist  *************************************************************/
21*d119d52dSAndrew Rist 
22*d119d52dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <time.h>
32cdf0e10cSrcweir #include <sfx2/sfxbasecontroller.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //________________________________________________________________________________________________________
35cdf0e10cSrcweir //	include of other projects
36cdf0e10cSrcweir //________________________________________________________________________________________________________
37cdf0e10cSrcweir #include <com/sun/star/awt/KeyEvent.hpp>
38cdf0e10cSrcweir #include <com/sun/star/awt/KeyModifier.hpp>
39cdf0e10cSrcweir #include <com/sun/star/awt/MouseEvent.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/MouseButton.hpp>
41cdf0e10cSrcweir #include <com/sun/star/util/XCloseable.hpp>
42cdf0e10cSrcweir #include <com/sun/star/util/XCloseBroadcaster.hpp>
43cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp>
44cdf0e10cSrcweir #include <com/sun/star/util/CloseVetoException.hpp>
45cdf0e10cSrcweir #include <com/sun/star/document/XViewDataSupplier.hpp>
46cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
47cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
48cdf0e10cSrcweir #include <com/sun/star/frame/FrameActionEvent.hpp>
49cdf0e10cSrcweir #include <com/sun/star/frame/FrameAction.hpp>
50cdf0e10cSrcweir #include <com/sun/star/frame/CommandGroup.hpp>
51cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
52cdf0e10cSrcweir #include <com/sun/star/frame/XBorderResizeListener.hpp>
53cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
54cdf0e10cSrcweir #include <com/sun/star/lang/EventObject.hpp>
55cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
56cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
57cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
58cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
59cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
60cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
61cdf0e10cSrcweir #include <basic/sbstar.hxx>
62cdf0e10cSrcweir #include <uno/mapping.hxx>
63cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
64cdf0e10cSrcweir #include <sfx2/docfac.hxx>
65cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
66cdf0e10cSrcweir #include <sfx2/objsh.hxx>
67cdf0e10cSrcweir #include <sfx2/app.hxx>
68cdf0e10cSrcweir #include <sfx2/msgpool.hxx>
69cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
70cdf0e10cSrcweir #include <sfx2/userinputinterception.hxx>
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #include <viewimp.hxx>
73cdf0e10cSrcweir #include <sfx2/unoctitm.hxx>
74cdf0e10cSrcweir #include <sfx2/childwin.hxx>
75cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
76cdf0e10cSrcweir #include <workwin.hxx>
77cdf0e10cSrcweir #include <sfx2/objface.hxx>
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #include <vos/mutex.hxx>
80cdf0e10cSrcweir #include <osl/mutex.hxx>
81cdf0e10cSrcweir #include <tools/diagnose_ex.h>
82cdf0e10cSrcweir #include <comphelper/sequence.hxx>
83cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
84cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
85cdf0e10cSrcweir #include <framework/titlehelper.hxx>
86cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
87cdf0e10cSrcweir #include <tools/diagnose_ex.h>
88cdf0e10cSrcweir 
89cdf0e10cSrcweir #include <hash_map>
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #include <sfx2/event.hxx>
92cdf0e10cSrcweir #include "sfx2/viewfac.hxx"
93cdf0e10cSrcweir 
94cdf0e10cSrcweir #define	OMULTITYPEINTERFACECONTAINERHELPER		::cppu::OMultiTypeInterfaceContainerHelper
95cdf0e10cSrcweir #define OINTERFACECONTAINERHELPER               ::cppu::OInterfaceContainerHelper
96cdf0e10cSrcweir #define	XFRAMEACTIONLISTENER					::com::sun::star::frame::XFrameActionListener
97cdf0e10cSrcweir #define	XCLOSELISTENER							::com::sun::star::util::XCloseListener
98cdf0e10cSrcweir #define	FRAMEACTIONEVENT						::com::sun::star::frame::FrameActionEvent
99cdf0e10cSrcweir #define	EVENTOBJECT								::com::sun::star::lang::EventObject
100cdf0e10cSrcweir #define OTYPECOLLECTION							::cppu::OTypeCollection
101cdf0e10cSrcweir #define OIMPLEMENTATIONID						::cppu::OImplementationId
102cdf0e10cSrcweir #define	MUTEXGUARD								::osl::MutexGuard
103cdf0e10cSrcweir #define	UNOQUERY								::com::sun::star::uno::UNO_QUERY
104cdf0e10cSrcweir #define	MAPPING									::com::sun::star::uno::Mapping
105cdf0e10cSrcweir #define XSTATUSINDICATORSUPPLIER                ::com::sun::star::task::XStatusIndicatorSupplier
106cdf0e10cSrcweir #define XCOMPONENT                              ::com::sun::star::lang::XComponent
107cdf0e10cSrcweir #define	XINTERFACE								::com::sun::star::uno::XInterface
108cdf0e10cSrcweir #define XKEYHANDLER								::com::sun::star::awt::XKeyHandler
109cdf0e10cSrcweir #define XMOUSECLICKHANDLER						::com::sun::star::awt::XMouseClickHandler
110cdf0e10cSrcweir 
111cdf0e10cSrcweir #define TIMEOUT_START_RESCHEDULE	10L	/* 10th s */
112cdf0e10cSrcweir 
113cdf0e10cSrcweir using namespace ::com::sun::star;
114cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
115cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException;
116cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW;
117cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW;
118cdf0e10cSrcweir using ::com::sun::star::lang::DisposedException;
119cdf0e10cSrcweir using ::com::sun::star::awt::XWindow;
120cdf0e10cSrcweir using ::com::sun::star::frame::XController;
121cdf0e10cSrcweir using ::com::sun::star::frame::XDispatchProvider;
122cdf0e10cSrcweir using ::com::sun::star::document::XViewDataSupplier;
123cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess;
124cdf0e10cSrcweir using ::com::sun::star::beans::PropertyValue;
125cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
126cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY;
127cdf0e10cSrcweir using ::com::sun::star::uno::Exception;
128cdf0e10cSrcweir using ::com::sun::star::frame::XFrame;
129cdf0e10cSrcweir using ::com::sun::star::frame::XFrameActionListener;
130cdf0e10cSrcweir using ::com::sun::star::util::XCloseListener;
131cdf0e10cSrcweir using ::com::sun::star::task::XStatusIndicator;
132cdf0e10cSrcweir using ::com::sun::star::frame::XTitle;
133cdf0e10cSrcweir namespace css = ::com::sun::star;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir struct GroupIDToCommandGroup
136cdf0e10cSrcweir {
137cdf0e10cSrcweir     sal_Int16   nGroupID;
138cdf0e10cSrcweir     sal_Int16   nCommandGroup;
139cdf0e10cSrcweir };
140cdf0e10cSrcweir 
141cdf0e10cSrcweir // Please update when a new command group is added
142cdf0e10cSrcweir const sal_Int16 MAX_COMMANDGROUP = com::sun::star::frame::CommandGroup::CONTROLS;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir static sal_Bool                 bGroupIDMapInitialized = sal_False;
145cdf0e10cSrcweir static GroupIDToCommandGroup    GroupIDCommandGroupMap[] =
146cdf0e10cSrcweir {
147cdf0e10cSrcweir     { GID_INTERN        ,   com::sun::star::frame::CommandGroup::INTERNAL       },
148cdf0e10cSrcweir     { GID_APPLICATION   ,   com::sun::star::frame::CommandGroup::APPLICATION    },
149cdf0e10cSrcweir     { GID_DOCUMENT      ,   com::sun::star::frame::CommandGroup::DOCUMENT       },
150cdf0e10cSrcweir     { GID_VIEW		    ,   com::sun::star::frame::CommandGroup::VIEW           },
151cdf0e10cSrcweir     { GID_EDIT          ,   com::sun::star::frame::CommandGroup::EDIT           },
152cdf0e10cSrcweir     { GID_MACRO         ,   com::sun::star::frame::CommandGroup::MACRO          },
153cdf0e10cSrcweir     { GID_OPTIONS       ,   com::sun::star::frame::CommandGroup::OPTIONS        },
154cdf0e10cSrcweir     { GID_MATH  		,   com::sun::star::frame::CommandGroup::MATH           },
155cdf0e10cSrcweir     { GID_NAVIGATOR	    ,   com::sun::star::frame::CommandGroup::NAVIGATOR      },
156cdf0e10cSrcweir     { GID_INSERT		,   com::sun::star::frame::CommandGroup::INSERT         },
157cdf0e10cSrcweir     { GID_FORMAT        ,   com::sun::star::frame::CommandGroup::FORMAT         },
158cdf0e10cSrcweir     { GID_TEMPLATE      ,   com::sun::star::frame::CommandGroup::TEMPLATE       },
159cdf0e10cSrcweir     { GID_TEXT          ,   com::sun::star::frame::CommandGroup::TEXT           },
160cdf0e10cSrcweir     { GID_FRAME         ,   com::sun::star::frame::CommandGroup::FRAME          },
161cdf0e10cSrcweir     { GID_GRAPHIC       ,   com::sun::star::frame::CommandGroup::GRAPHIC        },
162cdf0e10cSrcweir     { GID_TABLE         ,   com::sun::star::frame::CommandGroup::TABLE          },
163cdf0e10cSrcweir     { GID_ENUMERATION   ,   com::sun::star::frame::CommandGroup::ENUMERATION    },
164cdf0e10cSrcweir     { GID_DATA          ,   com::sun::star::frame::CommandGroup::DATA           },
165cdf0e10cSrcweir     { GID_SPECIAL       ,   com::sun::star::frame::CommandGroup::SPECIAL        },
166cdf0e10cSrcweir     { GID_IMAGE         ,   com::sun::star::frame::CommandGroup::IMAGE          },
167cdf0e10cSrcweir     { GID_CHART         ,   com::sun::star::frame::CommandGroup::CHART          },
168cdf0e10cSrcweir     { GID_EXPLORER      ,   com::sun::star::frame::CommandGroup::EXPLORER       },
169cdf0e10cSrcweir     { GID_CONNECTOR     ,   com::sun::star::frame::CommandGroup::CONNECTOR      },
170cdf0e10cSrcweir     { GID_MODIFY        ,   com::sun::star::frame::CommandGroup::MODIFY         },
171cdf0e10cSrcweir     { GID_DRAWING       ,   com::sun::star::frame::CommandGroup::DRAWING        },
172cdf0e10cSrcweir     { GID_CONTROLS      ,   com::sun::star::frame::CommandGroup::CONTROLS       },
173cdf0e10cSrcweir     { 0                 ,   0                                                   }
174cdf0e10cSrcweir };
175cdf0e10cSrcweir 
176cdf0e10cSrcweir typedef std::hash_map< sal_Int16, sal_Int16 > GroupHashMap;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 
MapGroupIDToCommandGroup(sal_Int16 nGroupID)179cdf0e10cSrcweir sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID )
180cdf0e10cSrcweir {
181cdf0e10cSrcweir     static GroupHashMap mHashMap;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     if ( !bGroupIDMapInitialized )
184cdf0e10cSrcweir     {
185cdf0e10cSrcweir         sal_Int32 i = 0;
186cdf0e10cSrcweir         while ( GroupIDCommandGroupMap[i].nGroupID != 0 )
187cdf0e10cSrcweir         {
188cdf0e10cSrcweir             mHashMap.insert( GroupHashMap::value_type(
189cdf0e10cSrcweir                 GroupIDCommandGroupMap[i].nGroupID,
190cdf0e10cSrcweir                 GroupIDCommandGroupMap[i].nCommandGroup ));
191cdf0e10cSrcweir             ++i;
192cdf0e10cSrcweir         }
193cdf0e10cSrcweir     }
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     GroupHashMap::const_iterator pIter = mHashMap.find( nGroupID );
196cdf0e10cSrcweir     if ( pIter != mHashMap.end() )
197cdf0e10cSrcweir         return pIter->second;
198cdf0e10cSrcweir     else
199cdf0e10cSrcweir         return com::sun::star::frame::CommandGroup::INTERNAL;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
MapCommandGroupToGroupID(sal_Int16 nCommandGroup)202cdf0e10cSrcweir sal_Int16 MapCommandGroupToGroupID( sal_Int16 nCommandGroup )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir     sal_Int32 i = 0;
205cdf0e10cSrcweir     while ( GroupIDCommandGroupMap[i].nGroupID != 0 )
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         if ( GroupIDCommandGroupMap[i].nCommandGroup == nCommandGroup )
208cdf0e10cSrcweir             return GroupIDCommandGroupMap[i].nGroupID;
209cdf0e10cSrcweir         ++i;
210cdf0e10cSrcweir     }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     return -1;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
SupportsCommandGroup(sal_Int16 nCommandGroup)215cdf0e10cSrcweir sal_Bool SupportsCommandGroup( sal_Int16 nCommandGroup )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir     if (( nCommandGroup >= 0 ) && ( nCommandGroup <= MAX_COMMANDGROUP ))
218cdf0e10cSrcweir         return sal_True;
219cdf0e10cSrcweir     else
220cdf0e10cSrcweir         return sal_False;
221cdf0e10cSrcweir }
222cdf0e10cSrcweir 
Get10ThSec()223cdf0e10cSrcweir sal_uInt32 Get10ThSec()
224cdf0e10cSrcweir {
225cdf0e10cSrcweir 	sal_uInt32 n10Ticks = 10 * (sal_uInt32)clock();
226cdf0e10cSrcweir 	return n10Ticks / CLOCKS_PER_SEC;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
229cdf0e10cSrcweir sal_Int32 m_nInReschedule = 0;	///	static counter for rescheduling
230cdf0e10cSrcweir 
reschedule()231cdf0e10cSrcweir void reschedule()
232cdf0e10cSrcweir {
233cdf0e10cSrcweir 	if ( m_nInReschedule == 0 )
234cdf0e10cSrcweir 	{
235cdf0e10cSrcweir 		++m_nInReschedule;
236cdf0e10cSrcweir 		Application::Reschedule();
237cdf0e10cSrcweir 		--m_nInReschedule;
238cdf0e10cSrcweir 	}
239cdf0e10cSrcweir }
240cdf0e10cSrcweir 
241cdf0e10cSrcweir class SfxStatusIndicator : public ::cppu::WeakImplHelper2< ::com::sun::star::task::XStatusIndicator, ::com::sun::star::lang::XEventListener >
242cdf0e10cSrcweir {
243cdf0e10cSrcweir friend class SfxBaseController;
244cdf0e10cSrcweir     ::com::sun::star::uno::Reference < XController > xOwner;
245cdf0e10cSrcweir     ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xProgress;
246cdf0e10cSrcweir     SfxWorkWindow*          pWorkWindow;
247cdf0e10cSrcweir     sal_Int32               _nRange;
248cdf0e10cSrcweir     sal_Int32               _nValue;
249cdf0e10cSrcweir 	long					_nStartTime;
250cdf0e10cSrcweir public:
SfxStatusIndicator(SfxBaseController * pController,SfxWorkWindow * pWork)251cdf0e10cSrcweir                             SfxStatusIndicator(SfxBaseController* pController, SfxWorkWindow* pWork)
252cdf0e10cSrcweir                                 : xOwner( pController )
253cdf0e10cSrcweir                                 , pWorkWindow( pWork )
254cdf0e10cSrcweir                             {
255cdf0e10cSrcweir 								++m_refCount;
256cdf0e10cSrcweir 								::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent(
257cdf0e10cSrcweir 									SAL_STATIC_CAST(::cppu::OWeakObject*, pController ), ::com::sun::star::uno::UNO_QUERY );
258cdf0e10cSrcweir 								if (xComponent.is())
259cdf0e10cSrcweir 									xComponent->addEventListener(this);
260cdf0e10cSrcweir 								--m_refCount;
261cdf0e10cSrcweir 							}
262cdf0e10cSrcweir 
263cdf0e10cSrcweir     virtual void SAL_CALL   start(const ::rtl::OUString& aText, sal_Int32 nRange) throw(::com::sun::star::uno::RuntimeException);
264cdf0e10cSrcweir     virtual void SAL_CALL   end(void) throw(::com::sun::star::uno::RuntimeException);
265cdf0e10cSrcweir     virtual void SAL_CALL   setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException);
266cdf0e10cSrcweir     virtual void SAL_CALL   setValue(sal_Int32 nValue) throw(::com::sun::star::uno::RuntimeException);
267cdf0e10cSrcweir     virtual void SAL_CALL   reset() throw(::com::sun::star::uno::RuntimeException);
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	virtual void SAL_CALL	disposing( const com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
270cdf0e10cSrcweir };
271cdf0e10cSrcweir 
start(const::rtl::OUString & aText,sal_Int32 nRange)272cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::start(const ::rtl::OUString& aText, sal_Int32 nRange) throw(::com::sun::star::uno::RuntimeException)
273cdf0e10cSrcweir {
274cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
275cdf0e10cSrcweir     if ( xOwner.is() )
276cdf0e10cSrcweir 	{
277cdf0e10cSrcweir 		_nRange = nRange;
278cdf0e10cSrcweir 		_nValue = 0;
279cdf0e10cSrcweir 
280cdf0e10cSrcweir         if ( !xProgress.is() )
281cdf0e10cSrcweir             xProgress = pWorkWindow->GetStatusIndicator();
282cdf0e10cSrcweir 
283cdf0e10cSrcweir         if ( xProgress.is() )
284cdf0e10cSrcweir             xProgress->start( aText, nRange );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 		_nStartTime = Get10ThSec();
287cdf0e10cSrcweir     	reschedule();
288cdf0e10cSrcweir 	}
289cdf0e10cSrcweir }
290cdf0e10cSrcweir 
end(void)291cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::end(void) throw(::com::sun::star::uno::RuntimeException)
292cdf0e10cSrcweir {
293cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
294cdf0e10cSrcweir     if ( xOwner.is() )
295cdf0e10cSrcweir 	{
296cdf0e10cSrcweir         if ( !xProgress.is() )
297cdf0e10cSrcweir             xProgress = pWorkWindow->GetStatusIndicator();
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         if ( xProgress.is() )
300cdf0e10cSrcweir             xProgress->end();
301cdf0e10cSrcweir 
302cdf0e10cSrcweir         reschedule();
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir }
305cdf0e10cSrcweir 
setText(const::rtl::OUString & aText)306cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
309cdf0e10cSrcweir     if ( xOwner.is() )
310cdf0e10cSrcweir 	{
311cdf0e10cSrcweir         if ( !xProgress.is() )
312cdf0e10cSrcweir             xProgress = pWorkWindow->GetStatusIndicator();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir         if ( xProgress.is() )
315cdf0e10cSrcweir             xProgress->setText( aText );
316cdf0e10cSrcweir 
317cdf0e10cSrcweir     	reschedule();
318cdf0e10cSrcweir 	}
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
setValue(sal_Int32 nValue)321cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
322cdf0e10cSrcweir {
323cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
324cdf0e10cSrcweir     if ( xOwner.is() )
325cdf0e10cSrcweir 	{
326cdf0e10cSrcweir 		_nValue = nValue;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir         if ( !xProgress.is() )
329cdf0e10cSrcweir             xProgress = pWorkWindow->GetStatusIndicator();
330cdf0e10cSrcweir 
331cdf0e10cSrcweir         if ( xProgress.is() )
332cdf0e10cSrcweir             xProgress->setValue( nValue );
333cdf0e10cSrcweir 
334cdf0e10cSrcweir         sal_Bool bReschedule = (( Get10ThSec() - _nStartTime ) > TIMEOUT_START_RESCHEDULE );
335cdf0e10cSrcweir 		if ( bReschedule )
336cdf0e10cSrcweir 			reschedule();
337cdf0e10cSrcweir 	}
338cdf0e10cSrcweir }
339cdf0e10cSrcweir 
reset()340cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::reset() throw(::com::sun::star::uno::RuntimeException)
341cdf0e10cSrcweir {
342cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
343cdf0e10cSrcweir     if ( xOwner.is() )
344cdf0e10cSrcweir 	{
345cdf0e10cSrcweir         if ( !xProgress.is() )
346cdf0e10cSrcweir             xProgress = pWorkWindow->GetStatusIndicator();
347cdf0e10cSrcweir 
348cdf0e10cSrcweir         if ( xProgress.is() )
349cdf0e10cSrcweir             xProgress->reset();
350cdf0e10cSrcweir 
351cdf0e10cSrcweir         reschedule();
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
disposing(const com::sun::star::lang::EventObject &)355cdf0e10cSrcweir void SAL_CALL SfxStatusIndicator::disposing( const com::sun::star::lang::EventObject& /*Source*/ ) throw(::com::sun::star::uno::RuntimeException)
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
358cdf0e10cSrcweir 	xOwner = 0;
359cdf0e10cSrcweir     xProgress.clear();
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir //________________________________________________________________________________________________________
363cdf0e10cSrcweir //________________________________________________________________________________________________________
364cdf0e10cSrcweir //	declaration IMPL_SfxBaseController_ListenerHelper
365cdf0e10cSrcweir //________________________________________________________________________________________________________
366cdf0e10cSrcweir 
367cdf0e10cSrcweir class IMPL_SfxBaseController_ListenerHelper : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XFrameActionListener >
368cdf0e10cSrcweir {
369cdf0e10cSrcweir public:
370cdf0e10cSrcweir 	IMPL_SfxBaseController_ListenerHelper(	MUTEX&				aMutex		,
371cdf0e10cSrcweir 											SfxBaseController*	pController	) ;
372cdf0e10cSrcweir 	virtual ~IMPL_SfxBaseController_ListenerHelper() ;
373cdf0e10cSrcweir     virtual void SAL_CALL frameAction( const FRAMEACTIONEVENT& aEvent ) throw (RUNTIMEEXCEPTION) ;
374cdf0e10cSrcweir 	virtual void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw (RUNTIMEEXCEPTION) ;
375cdf0e10cSrcweir 
376cdf0e10cSrcweir private:
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 	MUTEX&					m_aMutex		;
379cdf0e10cSrcweir 	SfxBaseController*		m_pController	;
380cdf0e10cSrcweir 
381cdf0e10cSrcweir } ;	// class IMPL_SfxBaseController_ListenerContainer
382cdf0e10cSrcweir 
383cdf0e10cSrcweir class IMPL_SfxBaseController_CloseListenerHelper : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener >
384cdf0e10cSrcweir {
385cdf0e10cSrcweir public:
386cdf0e10cSrcweir 	IMPL_SfxBaseController_CloseListenerHelper(	MUTEX&				aMutex		,
387cdf0e10cSrcweir 											SfxBaseController*	pController	) ;
388cdf0e10cSrcweir 	virtual ~IMPL_SfxBaseController_CloseListenerHelper() ;
389cdf0e10cSrcweir     virtual void SAL_CALL queryClosing( const EVENTOBJECT& aEvent, sal_Bool bDeliverOwnership )
390cdf0e10cSrcweir         throw (RUNTIMEEXCEPTION, com::sun::star::util::CloseVetoException) ;
391cdf0e10cSrcweir     virtual void SAL_CALL notifyClosing( const EVENTOBJECT& aEvent ) throw (RUNTIMEEXCEPTION) ;
392cdf0e10cSrcweir 	virtual void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw (RUNTIMEEXCEPTION) ;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir private:
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 	MUTEX&					m_aMutex;
397cdf0e10cSrcweir 	SfxBaseController*		m_pController;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir } ;	// class IMPL_SfxBaseController_ListenerContainer
400cdf0e10cSrcweir 
IMPL_SfxBaseController_CloseListenerHelper(MUTEX & aMutex,SfxBaseController * pController)401cdf0e10cSrcweir IMPL_SfxBaseController_CloseListenerHelper::IMPL_SfxBaseController_CloseListenerHelper(	MUTEX&				aMutex		,
402cdf0e10cSrcweir 																				SfxBaseController*	pController	)
403cdf0e10cSrcweir 		: m_aMutex		( aMutex		)
404cdf0e10cSrcweir 		, m_pController	( pController	)
405cdf0e10cSrcweir {
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
~IMPL_SfxBaseController_CloseListenerHelper()408cdf0e10cSrcweir IMPL_SfxBaseController_CloseListenerHelper::~IMPL_SfxBaseController_CloseListenerHelper()
409cdf0e10cSrcweir {
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
disposing(const EVENTOBJECT &)412cdf0e10cSrcweir void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::disposing( const EVENTOBJECT& /*aEvent*/ ) throw( ::com::sun::star::uno::RuntimeException )
413cdf0e10cSrcweir {
414cdf0e10cSrcweir }
415cdf0e10cSrcweir 
queryClosing(const EVENTOBJECT & aEvent,sal_Bool bDeliverOwnership)416cdf0e10cSrcweir void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const EVENTOBJECT& aEvent, sal_Bool bDeliverOwnership )
417cdf0e10cSrcweir     throw (RUNTIMEEXCEPTION, com::sun::star::util::CloseVetoException)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
420cdf0e10cSrcweir     SfxViewShell* pShell = m_pController->GetViewShell_Impl();
421cdf0e10cSrcweir     if  ( m_pController !=  NULL &&  pShell )
422cdf0e10cSrcweir 	{
423cdf0e10cSrcweir         sal_Bool bCanClose = (sal_Bool) pShell->PrepareClose( sal_False );
424cdf0e10cSrcweir 		if ( !bCanClose )
425cdf0e10cSrcweir 		{
426cdf0e10cSrcweir             if ( bDeliverOwnership && ( !pShell->GetWindow() || !pShell->GetWindow()->IsReallyVisible() ) )
427cdf0e10cSrcweir             {
428cdf0e10cSrcweir                 // ignore OwnerShip in case of visible frame (will be closed by user)
429cdf0e10cSrcweir                 uno::Reference < frame::XModel > xModel( aEvent.Source, uno::UNO_QUERY );
430cdf0e10cSrcweir                 if ( xModel.is() )
431cdf0e10cSrcweir                     pShell->TakeOwnerShip_Impl();
432cdf0e10cSrcweir                 else
433cdf0e10cSrcweir                     pShell->TakeFrameOwnerShip_Impl();
434cdf0e10cSrcweir             }
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 			throw com::sun::star::util::CloseVetoException(::rtl::OUString::createFromAscii("Controller disagree ..."),static_cast< ::cppu::OWeakObject*>(this));
437cdf0e10cSrcweir 		}
438cdf0e10cSrcweir 	}
439cdf0e10cSrcweir }
440cdf0e10cSrcweir 
notifyClosing(const EVENTOBJECT &)441cdf0e10cSrcweir void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::notifyClosing( const EVENTOBJECT& /*aEvent*/ ) throw (RUNTIMEEXCEPTION)
442cdf0e10cSrcweir {
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir //________________________________________________________________________________________________________
446cdf0e10cSrcweir //	declaration IMPL_SfxBaseController_DataContainer
447cdf0e10cSrcweir //________________________________________________________________________________________________________
448cdf0e10cSrcweir 
449cdf0e10cSrcweir struct IMPL_SfxBaseController_DataContainer
450cdf0e10cSrcweir {
451cdf0e10cSrcweir     Reference< XFrame >                     m_xFrame                ;
452cdf0e10cSrcweir     Reference< XFrameActionListener >       m_xListener             ;
453cdf0e10cSrcweir     Reference< XCloseListener >             m_xCloseListener        ;
454cdf0e10cSrcweir     ::sfx2::UserInputInterception           m_aUserInputInterception;
455cdf0e10cSrcweir 	OMULTITYPEINTERFACECONTAINERHELPER		m_aListenerContainer	;
456cdf0e10cSrcweir     OINTERFACECONTAINERHELPER               m_aInterceptorContainer ;
457cdf0e10cSrcweir     Reference< XStatusIndicator >           m_xIndicator            ;
458cdf0e10cSrcweir 	SfxViewShell*							m_pViewShell			;
459cdf0e10cSrcweir 	SfxBaseController*						m_pController			;
460cdf0e10cSrcweir 	sal_Bool								m_bDisposing			;
461cdf0e10cSrcweir 	sal_Bool                                m_bSuspendState         ;
462cdf0e10cSrcweir     Reference< XTitle >                     m_xTitleHelper          ;
463cdf0e10cSrcweir     Sequence< PropertyValue >               m_aCreationArgs         ;
464cdf0e10cSrcweir 
IMPL_SfxBaseController_DataContainerIMPL_SfxBaseController_DataContainer465cdf0e10cSrcweir 	IMPL_SfxBaseController_DataContainer(	MUTEX&				aMutex		,
466cdf0e10cSrcweir 											SfxViewShell*		pViewShell	,
467cdf0e10cSrcweir 											SfxBaseController*	pController	)
468cdf0e10cSrcweir             :   m_xListener                     ( new IMPL_SfxBaseController_ListenerHelper( aMutex, pController ) )
469cdf0e10cSrcweir             ,   m_xCloseListener                ( new IMPL_SfxBaseController_CloseListenerHelper( aMutex, pController ) )
470cdf0e10cSrcweir             ,   m_aUserInputInterception        ( *pController, aMutex                                  )
471cdf0e10cSrcweir             ,   m_aListenerContainer            ( aMutex												)
472cdf0e10cSrcweir             ,   m_aInterceptorContainer         ( aMutex                                                )
473cdf0e10cSrcweir             ,   m_pViewShell			( pViewShell											)
474cdf0e10cSrcweir             ,   m_pController			( pController											)
475cdf0e10cSrcweir             ,   m_bDisposing			( sal_False												)
476cdf0e10cSrcweir             ,   m_bSuspendState                 ( sal_False                                              )
477cdf0e10cSrcweir 	{
478cdf0e10cSrcweir 	}
479cdf0e10cSrcweir 
480cdf0e10cSrcweir } ;	// struct IMPL_SfxBaseController_DataContainer
481cdf0e10cSrcweir 
482cdf0e10cSrcweir //________________________________________________________________________________________________________
483cdf0e10cSrcweir //	IMPL_SfxBaseController_ListenerHelper constructor
484cdf0e10cSrcweir //________________________________________________________________________________________________________
485cdf0e10cSrcweir 
IMPL_SfxBaseController_ListenerHelper(MUTEX & aMutex,SfxBaseController * pController)486cdf0e10cSrcweir IMPL_SfxBaseController_ListenerHelper::IMPL_SfxBaseController_ListenerHelper(	MUTEX&				aMutex		,
487cdf0e10cSrcweir 																				SfxBaseController*	pController	)
488cdf0e10cSrcweir 		: m_aMutex		( aMutex		)
489cdf0e10cSrcweir 		, m_pController	( pController	)
490cdf0e10cSrcweir {
491cdf0e10cSrcweir }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir //________________________________________________________________________________________________________
494cdf0e10cSrcweir //	IMPL_SfxBaseController_ListenerHelper destructor
495cdf0e10cSrcweir //________________________________________________________________________________________________________
496cdf0e10cSrcweir 
~IMPL_SfxBaseController_ListenerHelper()497cdf0e10cSrcweir IMPL_SfxBaseController_ListenerHelper::~IMPL_SfxBaseController_ListenerHelper()
498cdf0e10cSrcweir {
499cdf0e10cSrcweir }
500cdf0e10cSrcweir 
frameAction(const FRAMEACTIONEVENT & aEvent)501cdf0e10cSrcweir void SAL_CALL IMPL_SfxBaseController_ListenerHelper::frameAction( const FRAMEACTIONEVENT& aEvent ) throw( RUNTIMEEXCEPTION )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
504cdf0e10cSrcweir 	if	(
505cdf0e10cSrcweir 			( m_pController	!=	NULL ) &&
506cdf0e10cSrcweir 			( aEvent.Frame	==	m_pController->getFrame() )	&&
507cdf0e10cSrcweir             ( m_pController->GetViewShell_Impl() && m_pController->GetViewShell_Impl()->GetWindow() !=  NULL                                                    )
508cdf0e10cSrcweir 		)
509cdf0e10cSrcweir 	{
510cdf0e10cSrcweir         if ( aEvent.Action == ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED )
511cdf0e10cSrcweir 		{
512cdf0e10cSrcweir             if ( !m_pController->GetViewShell_Impl()->GetUIActiveIPClient_Impl() )
513cdf0e10cSrcweir                 m_pController->GetViewShell_Impl()->GetViewFrame()->MakeActive_Impl( sal_False );
514cdf0e10cSrcweir 		}
515cdf0e10cSrcweir         else if ( aEvent.Action == ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED )
516cdf0e10cSrcweir 		{
517cdf0e10cSrcweir 			m_pController->GetViewShell_Impl()->GetViewFrame()->GetBindings().ContextChanged_Impl();
518cdf0e10cSrcweir 		}
519cdf0e10cSrcweir 	}
520cdf0e10cSrcweir }
521cdf0e10cSrcweir 
522cdf0e10cSrcweir //________________________________________________________________________________________________________
523cdf0e10cSrcweir //	IMPL_SfxBaseController_ListenerHelper -> XEventListener
524cdf0e10cSrcweir //________________________________________________________________________________________________________
525cdf0e10cSrcweir 
disposing(const EVENTOBJECT &)526cdf0e10cSrcweir void SAL_CALL IMPL_SfxBaseController_ListenerHelper::disposing( const EVENTOBJECT& /*aEvent*/ ) throw( ::com::sun::star::uno::RuntimeException )
527cdf0e10cSrcweir {
528cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
529cdf0e10cSrcweir     if ( m_pController && m_pController->getFrame().is() )
530cdf0e10cSrcweir 		m_pController->getFrame()->removeFrameActionListener( this ) ;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir //________________________________________________________________________________________________________
534cdf0e10cSrcweir //	SfxBaseController -> constructor
535cdf0e10cSrcweir //________________________________________________________________________________________________________
DBG_NAME(sfx2_SfxBaseController)536cdf0e10cSrcweir DBG_NAME(sfx2_SfxBaseController)
537cdf0e10cSrcweir SfxBaseController::SfxBaseController( SfxViewShell* pViewShell )
538cdf0e10cSrcweir     :   m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this ))
539cdf0e10cSrcweir {
540cdf0e10cSrcweir     DBG_CTOR(sfx2_SfxBaseController,NULL);
541cdf0e10cSrcweir     m_pData->m_pViewShell->SetController( this );
542cdf0e10cSrcweir }
543cdf0e10cSrcweir 
544cdf0e10cSrcweir //________________________________________________________________________________________________________
545cdf0e10cSrcweir //	SfxBaseController -> destructor
546cdf0e10cSrcweir //________________________________________________________________________________________________________
547cdf0e10cSrcweir 
~SfxBaseController()548cdf0e10cSrcweir SfxBaseController::~SfxBaseController()
549cdf0e10cSrcweir {
550cdf0e10cSrcweir     DBG_DTOR(sfx2_SfxBaseController,NULL);
551cdf0e10cSrcweir 	delete m_pData;
552cdf0e10cSrcweir }
553cdf0e10cSrcweir 
554cdf0e10cSrcweir //________________________________________________________________________________________________________
555cdf0e10cSrcweir //	SfxBaseController -> XController2
556cdf0e10cSrcweir //________________________________________________________________________________________________________
557cdf0e10cSrcweir 
getComponentWindow()558cdf0e10cSrcweir Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (RuntimeException)
559cdf0e10cSrcweir {
560cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
561cdf0e10cSrcweir     if ( !m_pData->m_pViewShell )
562cdf0e10cSrcweir         throw DisposedException();
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW );
565cdf0e10cSrcweir }
566cdf0e10cSrcweir 
getViewControllerName()567cdf0e10cSrcweir ::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException)
568cdf0e10cSrcweir {
569cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
570cdf0e10cSrcweir     if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() )
571cdf0e10cSrcweir         throw DisposedException();
572cdf0e10cSrcweir 
573cdf0e10cSrcweir     const SfxObjectFactory& rDocFac( m_pData->m_pViewShell->GetObjectShell()->GetFactory() );
574cdf0e10cSrcweir     sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl().GetCurViewId(), rDocFac.GetViewFactoryCount() );
575cdf0e10cSrcweir     OSL_ENSURE( nViewNo < rDocFac.GetViewFactoryCount(), "SfxBaseController::getViewControllerName: view ID not found in view factories!" );
576cdf0e10cSrcweir 
577cdf0e10cSrcweir     ::rtl::OUString sViewName;
578cdf0e10cSrcweir     if ( nViewNo < rDocFac.GetViewFactoryCount() )
579cdf0e10cSrcweir         sViewName = rDocFac.GetViewFactory( nViewNo ).GetAPIViewName();
580cdf0e10cSrcweir 
581cdf0e10cSrcweir     return sViewName;
582cdf0e10cSrcweir }
583cdf0e10cSrcweir 
getCreationArguments()584cdf0e10cSrcweir Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() throw (RuntimeException)
585cdf0e10cSrcweir {
586cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
587cdf0e10cSrcweir     if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() )
588cdf0e10cSrcweir         throw DisposedException();
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     return m_pData->m_aCreationArgs;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir 
SetCreationArguments_Impl(const Sequence<PropertyValue> & i_rCreationArgs)593cdf0e10cSrcweir void SfxBaseController::SetCreationArguments_Impl( const Sequence< PropertyValue >& i_rCreationArgs )
594cdf0e10cSrcweir {
595cdf0e10cSrcweir     OSL_ENSURE( m_pData->m_aCreationArgs.getLength() == 0, "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" );
596cdf0e10cSrcweir     m_pData->m_aCreationArgs = i_rCreationArgs;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir 
GetViewFrame_Impl() const599cdf0e10cSrcweir SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const
600cdf0e10cSrcweir {
601cdf0e10cSrcweir     ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" );
602cdf0e10cSrcweir     SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame();
603cdf0e10cSrcweir     ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" );
604cdf0e10cSrcweir     return *pActFrame;
605cdf0e10cSrcweir }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir //________________________________________________________________________________________________________
608cdf0e10cSrcweir //	SfxBaseController -> XController2 -> XController
609cdf0e10cSrcweir //________________________________________________________________________________________________________
610cdf0e10cSrcweir 
attachFrame(const REFERENCE<XFRAME> & xFrame)611cdf0e10cSrcweir void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame ) throw( ::com::sun::star::uno::RuntimeException )
612cdf0e10cSrcweir {
613cdf0e10cSrcweir     REFERENCE< XFRAME > xTemp( getFrame() ) ;
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
616cdf0e10cSrcweir 	if ( xTemp.is() )
617cdf0e10cSrcweir 	{
618cdf0e10cSrcweir         xTemp->removeFrameActionListener( m_pData->m_xListener ) ;
619cdf0e10cSrcweir 		REFERENCE < ::com::sun::star::util::XCloseBroadcaster > xCloseable( xTemp, com::sun::star::uno::UNO_QUERY );
620cdf0e10cSrcweir 		if ( xCloseable.is() )
621cdf0e10cSrcweir 			xCloseable->removeCloseListener( m_pData->m_xCloseListener );
622cdf0e10cSrcweir 	}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir     m_pData->m_xFrame = xFrame;
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 	if ( xFrame.is() )
627cdf0e10cSrcweir 	{
628cdf0e10cSrcweir         xFrame->addFrameActionListener( m_pData->m_xListener ) ;
629cdf0e10cSrcweir 		REFERENCE < ::com::sun::star::util::XCloseBroadcaster > xCloseable( xFrame, com::sun::star::uno::UNO_QUERY );
630cdf0e10cSrcweir 		if ( xCloseable.is() )
631cdf0e10cSrcweir 			xCloseable->addCloseListener( m_pData->m_xCloseListener );
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 		if ( m_pData->m_pViewShell )
634cdf0e10cSrcweir 		{
635cdf0e10cSrcweir             ConnectSfxFrame_Impl( E_CONNECT );
636cdf0e10cSrcweir 
637cdf0e10cSrcweir             // attaching the frame to the controller is the last step in the creation of a new view, so notify this
638cdf0e10cSrcweir             SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), uno::Reference< frame::XController2 >( this ) );
639cdf0e10cSrcweir             SFX_APP()->NotifyEvent( aHint );
640cdf0e10cSrcweir 		}
641cdf0e10cSrcweir 	}
642cdf0e10cSrcweir }
643cdf0e10cSrcweir 
644cdf0e10cSrcweir //________________________________________________________________________________________________________
645cdf0e10cSrcweir //	SfxBaseController -> XController
646cdf0e10cSrcweir //________________________________________________________________________________________________________
647cdf0e10cSrcweir 
attachModel(const REFERENCE<XMODEL> & xModel)648cdf0e10cSrcweir sal_Bool SAL_CALL SfxBaseController::attachModel( const REFERENCE< XMODEL >& xModel ) throw( ::com::sun::star::uno::RuntimeException )
649cdf0e10cSrcweir {
650cdf0e10cSrcweir 	if ( m_pData->m_pViewShell && xModel.is() && xModel != m_pData->m_pViewShell->GetObjectShell()->GetModel() )
651cdf0e10cSrcweir 	{
652cdf0e10cSrcweir 		// don't allow to reattach a model!
653cdf0e10cSrcweir 		DBG_ERROR("Can't reattach model!");
654cdf0e10cSrcweir 		return sal_False;
655cdf0e10cSrcweir 	}
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 	REFERENCE < ::com::sun::star::util::XCloseBroadcaster > xCloseable( xModel, com::sun::star::uno::UNO_QUERY );
658cdf0e10cSrcweir 	if ( xCloseable.is() )
659cdf0e10cSrcweir 		xCloseable->addCloseListener( m_pData->m_xCloseListener );
660cdf0e10cSrcweir 	return sal_True;
661cdf0e10cSrcweir }
662cdf0e10cSrcweir 
663cdf0e10cSrcweir //________________________________________________________________________________________________________
664cdf0e10cSrcweir //	SfxBaseController -> XController
665cdf0e10cSrcweir //________________________________________________________________________________________________________
666cdf0e10cSrcweir 
suspend(sal_Bool bSuspend)667cdf0e10cSrcweir sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com::sun::star::uno::RuntimeException )
668cdf0e10cSrcweir {
669cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 	// ignore dublicate calls, which doesnt change anything real
672cdf0e10cSrcweir 	if (bSuspend == m_pData->m_bSuspendState)
673cdf0e10cSrcweir 	   return sal_True;
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 	if ( bSuspend == sal_True )
676cdf0e10cSrcweir 	{
677cdf0e10cSrcweir         if ( !m_pData->m_pViewShell )
678cdf0e10cSrcweir         {
679cdf0e10cSrcweir             m_pData->m_bSuspendState = sal_True;
680cdf0e10cSrcweir             return sal_True;
681cdf0e10cSrcweir         }
682cdf0e10cSrcweir 
683cdf0e10cSrcweir 		if ( !m_pData->m_pViewShell->PrepareClose() )
684cdf0e10cSrcweir             return sal_False;
685cdf0e10cSrcweir 
686cdf0e10cSrcweir         if ( getFrame().is() )
687cdf0e10cSrcweir             getFrame()->removeFrameActionListener( m_pData->m_xListener ) ;
688cdf0e10cSrcweir         SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ;
689cdf0e10cSrcweir 
690cdf0e10cSrcweir         // weitere View auf dasselbe Doc?
691cdf0e10cSrcweir         SfxObjectShell*	pDocShell	=	m_pData->m_pViewShell->GetObjectShell()	;
692cdf0e10cSrcweir         sal_Bool		bOther		=	sal_False								;
693cdf0e10cSrcweir 
694cdf0e10cSrcweir         for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );	!bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ) )
695cdf0e10cSrcweir             bOther = (pFrame != pActFrame);
696cdf0e10cSrcweir 
697cdf0e10cSrcweir         sal_Bool bRet = bOther || pDocShell->PrepareClose();
698cdf0e10cSrcweir         if ( bRet )
699cdf0e10cSrcweir         {
700cdf0e10cSrcweir             ConnectSfxFrame_Impl( E_DISCONNECT );
701cdf0e10cSrcweir             m_pData->m_bSuspendState = sal_True;
702cdf0e10cSrcweir         }
703cdf0e10cSrcweir 
704cdf0e10cSrcweir         return bRet;
705cdf0e10cSrcweir 	}
706cdf0e10cSrcweir 	else
707cdf0e10cSrcweir 	{
708cdf0e10cSrcweir 		if ( getFrame().is() )
709cdf0e10cSrcweir         	getFrame()->addFrameActionListener( m_pData->m_xListener ) ;
710cdf0e10cSrcweir 
711cdf0e10cSrcweir 		if ( m_pData->m_pViewShell )
712cdf0e10cSrcweir 		{
713cdf0e10cSrcweir             ConnectSfxFrame_Impl( E_RECONNECT );
714cdf0e10cSrcweir 		}
715cdf0e10cSrcweir 
716cdf0e10cSrcweir         m_pData->m_bSuspendState = sal_False;
717cdf0e10cSrcweir 		return sal_True ;
718cdf0e10cSrcweir 	}
719cdf0e10cSrcweir }
720cdf0e10cSrcweir 
721cdf0e10cSrcweir //________________________________________________________________________________________________________
722cdf0e10cSrcweir //	SfxBaseController -> XController
723cdf0e10cSrcweir //________________________________________________________________________________________________________
724cdf0e10cSrcweir 
getViewData()725cdf0e10cSrcweir ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeException )
726cdf0e10cSrcweir {
727cdf0e10cSrcweir     ANY         aAny;
728cdf0e10cSrcweir 	String		sData1;
729cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
730cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
731cdf0e10cSrcweir     {
732cdf0e10cSrcweir         m_pData->m_pViewShell->WriteUserData( sData1 ) ;
733cdf0e10cSrcweir         ::rtl::OUString    sData( sData1 );
734cdf0e10cSrcweir         aAny <<= sData ;
735cdf0e10cSrcweir     }
736cdf0e10cSrcweir 
737cdf0e10cSrcweir 	return aAny ;
738cdf0e10cSrcweir }
739cdf0e10cSrcweir 
740cdf0e10cSrcweir //________________________________________________________________________________________________________
741cdf0e10cSrcweir //	SfxBaseController -> XController
742cdf0e10cSrcweir //________________________________________________________________________________________________________
743cdf0e10cSrcweir 
restoreViewData(const ANY & aValue)744cdf0e10cSrcweir void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::com::sun::star::uno::RuntimeException )
745cdf0e10cSrcweir {
746cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
747cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
748cdf0e10cSrcweir     {
749cdf0e10cSrcweir         ::rtl::OUString sData;
750cdf0e10cSrcweir         aValue >>= sData ;
751cdf0e10cSrcweir         m_pData->m_pViewShell->ReadUserData( sData ) ;
752cdf0e10cSrcweir     }
753cdf0e10cSrcweir }
754cdf0e10cSrcweir 
755cdf0e10cSrcweir //________________________________________________________________________________________________________
756cdf0e10cSrcweir //	SfxBaseController -> XController
757cdf0e10cSrcweir //________________________________________________________________________________________________________
758cdf0e10cSrcweir 
getFrame()759cdf0e10cSrcweir REFERENCE< XFRAME > SAL_CALL SfxBaseController::getFrame() throw( ::com::sun::star::uno::RuntimeException )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
762cdf0e10cSrcweir     return m_pData->m_xFrame;
763cdf0e10cSrcweir }
764cdf0e10cSrcweir 
765cdf0e10cSrcweir //________________________________________________________________________________________________________
766cdf0e10cSrcweir //	SfxBaseController -> XController
767cdf0e10cSrcweir //________________________________________________________________________________________________________
768cdf0e10cSrcweir 
getModel()769cdf0e10cSrcweir REFERENCE< XMODEL > SAL_CALL SfxBaseController::getModel() throw( ::com::sun::star::uno::RuntimeException )
770cdf0e10cSrcweir {
771cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
772cdf0e10cSrcweir     return m_pData->m_pViewShell ? m_pData->m_pViewShell->GetObjectShell()->GetModel() : REFERENCE < XMODEL > () ;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir 
775cdf0e10cSrcweir //________________________________________________________________________________________________________
776cdf0e10cSrcweir //	SfxBaseController -> XDispatchProvider
777cdf0e10cSrcweir //________________________________________________________________________________________________________
778cdf0e10cSrcweir 
queryDispatch(const UNOURL & aURL,const::rtl::OUString & sTargetFrameName,sal_Int32 eSearchFlags)779cdf0e10cSrcweir REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch(	const	UNOURL&				aURL			,
780cdf0e10cSrcweir 																	const	::rtl::OUString&			sTargetFrameName,
781cdf0e10cSrcweir 																			sal_Int32			eSearchFlags	) throw( RUNTIMEEXCEPTION )
782cdf0e10cSrcweir {
783cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
784cdf0e10cSrcweir     REFERENCE< XDISPATCH >  xDisp;
785cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
786cdf0e10cSrcweir     {
787cdf0e10cSrcweir         SfxViewFrame*           pAct    = m_pData->m_pViewShell->GetViewFrame() ;
788cdf0e10cSrcweir         if ( !m_pData->m_bDisposing )
789cdf0e10cSrcweir         {
790cdf0e10cSrcweir             if ( sTargetFrameName.compareToAscii( "_beamer" ) == COMPARE_EQUAL )
791cdf0e10cSrcweir             {
792cdf0e10cSrcweir                 SfxViewFrame *pFrame = m_pData->m_pViewShell->GetViewFrame();
793cdf0e10cSrcweir                 if ( eSearchFlags & ( ::com::sun::star::frame::FrameSearchFlag::CREATE ))
794cdf0e10cSrcweir                     pFrame->SetChildWindow( SID_BROWSER, sal_True );
795cdf0e10cSrcweir                 SfxChildWindow* pChildWin = pFrame->GetChildWindow( SID_BROWSER );
796cdf0e10cSrcweir                 REFERENCE < XFRAME > xFrame;
797cdf0e10cSrcweir                 if ( pChildWin )
798cdf0e10cSrcweir                     xFrame = ( pChildWin->GetFrame() );
799cdf0e10cSrcweir                 if ( xFrame.is() )
800cdf0e10cSrcweir                     xFrame->setName( sTargetFrameName );
801cdf0e10cSrcweir 
802cdf0e10cSrcweir                 Reference< XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY );
803cdf0e10cSrcweir                 if ( xProv.is() )
804cdf0e10cSrcweir                     return xProv->queryDispatch( aURL, sTargetFrameName, ::com::sun::star::frame::FrameSearchFlag::SELF );
805cdf0e10cSrcweir             }
806cdf0e10cSrcweir 
807cdf0e10cSrcweir             if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL )
808cdf0e10cSrcweir             {
809cdf0e10cSrcweir                 rtl::OUString aMasterCommand = SfxOfficeDispatch::GetMasterUnoCommand( aURL );
810cdf0e10cSrcweir                 sal_Bool      bMasterCommand( aMasterCommand.getLength() > 0 );
811cdf0e10cSrcweir 
812cdf0e10cSrcweir                 pAct = m_pData->m_pViewShell->GetViewFrame() ;
813cdf0e10cSrcweir                 SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct );
814cdf0e10cSrcweir 
815cdf0e10cSrcweir                 const SfxSlot* pSlot( 0 );
816cdf0e10cSrcweir                 if ( bMasterCommand )
817cdf0e10cSrcweir                     pSlot = rSlotPool.GetUnoSlot( aMasterCommand );
818cdf0e10cSrcweir                 else
819cdf0e10cSrcweir                     pSlot = rSlotPool.GetUnoSlot( aURL.Path );
820cdf0e10cSrcweir                 if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) )
821cdf0e10cSrcweir                     return pAct->GetBindings().GetDispatch( pSlot, aURL, bMasterCommand );
822cdf0e10cSrcweir 				else
823cdf0e10cSrcweir 				{
824cdf0e10cSrcweir 					// try to find parent SfxViewFrame
825cdf0e10cSrcweir 					uno::Reference< frame::XFrame > xParentFrame;
826cdf0e10cSrcweir 					uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface();
827cdf0e10cSrcweir 					if ( xOwnFrame.is() )
828cdf0e10cSrcweir 						xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY );
829cdf0e10cSrcweir 
830cdf0e10cSrcweir 					if ( xParentFrame.is() )
831cdf0e10cSrcweir 					{
832cdf0e10cSrcweir 						// TODO/LATER: in future probably SfxViewFrame hirarchy should be the same as XFrame hirarchy
833cdf0e10cSrcweir 						// SfxViewFrame* pParentFrame = pAct->GetParentViewFrame();
834cdf0e10cSrcweir 
835cdf0e10cSrcweir 						// search the related SfxViewFrame
836cdf0e10cSrcweir 						SfxViewFrame* pParentFrame = NULL;
837cdf0e10cSrcweir 						for ( SfxViewFrame* pFrame = SfxViewFrame::GetFirst();
838cdf0e10cSrcweir 								pFrame;
839cdf0e10cSrcweir 								pFrame = SfxViewFrame::GetNext( *pFrame ) )
840cdf0e10cSrcweir 						{
841cdf0e10cSrcweir 							if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame )
842cdf0e10cSrcweir 							{
843cdf0e10cSrcweir 								pParentFrame = pFrame;
844cdf0e10cSrcweir 								break;
845cdf0e10cSrcweir 							}
846cdf0e10cSrcweir 						}
847cdf0e10cSrcweir 
848cdf0e10cSrcweir 						if ( pParentFrame )
849cdf0e10cSrcweir 						{
850cdf0e10cSrcweir                             SfxSlotPool& rFrameSlotPool = SfxSlotPool::GetSlotPool( pParentFrame );
851cdf0e10cSrcweir                             const SfxSlot* pSlot2( 0 );
852cdf0e10cSrcweir                             if ( bMasterCommand )
853cdf0e10cSrcweir                                 pSlot2 = rFrameSlotPool.GetUnoSlot( aMasterCommand );
854cdf0e10cSrcweir                             else
855cdf0e10cSrcweir                                 pSlot2 = rFrameSlotPool.GetUnoSlot( aURL.Path );
856cdf0e10cSrcweir 
857cdf0e10cSrcweir                             if ( pSlot2 )
858cdf0e10cSrcweir                                 return pParentFrame->GetBindings().GetDispatch( pSlot2, aURL, bMasterCommand );
859cdf0e10cSrcweir 						}
860cdf0e10cSrcweir 					}
861cdf0e10cSrcweir 				}
862cdf0e10cSrcweir             }
863cdf0e10cSrcweir             else if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL )
864cdf0e10cSrcweir             {
865cdf0e10cSrcweir                 sal_uInt16 nId = (sal_uInt16) aURL.Path.toInt32();
866cdf0e10cSrcweir 
867cdf0e10cSrcweir                 pAct = m_pData->m_pViewShell->GetViewFrame() ;
868cdf0e10cSrcweir                 if (nId >= SID_VERB_START && nId <= SID_VERB_END)
869cdf0e10cSrcweir                 {
870cdf0e10cSrcweir                     const SfxSlot* pSlot = m_pData->m_pViewShell->GetVerbSlot_Impl(nId);
871cdf0e10cSrcweir                     if ( pSlot )
872cdf0e10cSrcweir                         return pAct->GetBindings().GetDispatch( pSlot, aURL, sal_False );
873cdf0e10cSrcweir                 }
874cdf0e10cSrcweir 
875cdf0e10cSrcweir                 SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct );
876cdf0e10cSrcweir                 const SfxSlot* pSlot = rSlotPool.GetSlot( nId );
877cdf0e10cSrcweir                 if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) )
878cdf0e10cSrcweir                     return pAct->GetBindings().GetDispatch( pSlot, aURL, sal_False );
879cdf0e10cSrcweir 				else
880cdf0e10cSrcweir 				{
881cdf0e10cSrcweir 					// try to find parent SfxViewFrame
882cdf0e10cSrcweir 					uno::Reference< frame::XFrame > xParentFrame;
883cdf0e10cSrcweir 					uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface();
884cdf0e10cSrcweir 					if ( xOwnFrame.is() )
885cdf0e10cSrcweir 						xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY );
886cdf0e10cSrcweir 
887cdf0e10cSrcweir 					if ( xParentFrame.is() )
888cdf0e10cSrcweir 					{
889cdf0e10cSrcweir 						// TODO/LATER: in future probably SfxViewFrame hirarchy should be the same as XFrame hirarchy
890cdf0e10cSrcweir 						// SfxViewFrame* pParentFrame = pAct->GetParentViewFrame();
891cdf0e10cSrcweir 
892cdf0e10cSrcweir 						// search the related SfxViewFrame
893cdf0e10cSrcweir 						SfxViewFrame* pParentFrame = NULL;
894cdf0e10cSrcweir 						for ( SfxViewFrame* pFrame = SfxViewFrame::GetFirst();
895cdf0e10cSrcweir 								pFrame;
896cdf0e10cSrcweir 								pFrame = SfxViewFrame::GetNext( *pFrame ) )
897cdf0e10cSrcweir 						{
898cdf0e10cSrcweir 							if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame )
899cdf0e10cSrcweir 							{
900cdf0e10cSrcweir 								pParentFrame = pFrame;
901cdf0e10cSrcweir 								break;
902cdf0e10cSrcweir 							}
903cdf0e10cSrcweir 						}
904cdf0e10cSrcweir 
905cdf0e10cSrcweir 						if ( pParentFrame )
906cdf0e10cSrcweir 						{
907cdf0e10cSrcweir                             SfxSlotPool& rSlotPool2 = SfxSlotPool::GetSlotPool( pParentFrame );
908cdf0e10cSrcweir                 			const SfxSlot* pSlot2 = rSlotPool2.GetUnoSlot( aURL.Path );
909cdf0e10cSrcweir                 			if ( pSlot2 )
910cdf0e10cSrcweir                                 return pParentFrame->GetBindings().GetDispatch( pSlot2, aURL, sal_False );
911cdf0e10cSrcweir 						}
912cdf0e10cSrcweir 					}
913cdf0e10cSrcweir 				}
914cdf0e10cSrcweir             }
915cdf0e10cSrcweir             else if( sTargetFrameName.compareToAscii( "_self" )==COMPARE_EQUAL || sTargetFrameName.getLength()==0 )
916cdf0e10cSrcweir             {
917cdf0e10cSrcweir                 // check for already loaded URL ... but with additional jumpmark!
918cdf0e10cSrcweir                 REFERENCE< XMODEL > xModel = getModel();
919cdf0e10cSrcweir                 if( xModel.is() && aURL.Mark.getLength() )
920cdf0e10cSrcweir                 {
921cdf0e10cSrcweir                     SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct );
922cdf0e10cSrcweir                     const SfxSlot* pSlot = rSlotPool.GetSlot( SID_JUMPTOMARK );
923cdf0e10cSrcweir                     if( aURL.Main.getLength() && aURL.Main == xModel->getURL() && pSlot )
924cdf0e10cSrcweir                         return REFERENCE< XDISPATCH >( new SfxOfficeDispatch( pAct->GetBindings(), pAct->GetDispatcher(), pSlot, aURL) );
925cdf0e10cSrcweir                 }
926cdf0e10cSrcweir             }
927cdf0e10cSrcweir         }
928cdf0e10cSrcweir     }
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 	return xDisp;
931cdf0e10cSrcweir }
932cdf0e10cSrcweir 
933cdf0e10cSrcweir //________________________________________________________________________________________________________
934cdf0e10cSrcweir //	SfxBaseController -> XDispatchProvider
935cdf0e10cSrcweir //________________________________________________________________________________________________________
936cdf0e10cSrcweir 
queryDispatches(const uno::Sequence<DISPATCHDESCRIPTOR> & seqDescripts)937cdf0e10cSrcweir uno::Sequence< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const uno::Sequence< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
938cdf0e10cSrcweir {
939cdf0e10cSrcweir     // Create return list - which must have same size then the given descriptor
940cdf0e10cSrcweir     // It's not allowed to pack it!
941cdf0e10cSrcweir     sal_Int32 nCount = seqDescripts.getLength();
942cdf0e10cSrcweir     uno::Sequence< REFERENCE< XDISPATCH > > lDispatcher( nCount );
943cdf0e10cSrcweir 
944cdf0e10cSrcweir     for( sal_Int32 i=0; i<nCount; ++i )
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir         lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL  ,
947cdf0e10cSrcweir                                         seqDescripts[i].FrameName   ,
948cdf0e10cSrcweir                                         seqDescripts[i].SearchFlags );
949cdf0e10cSrcweir     }
950cdf0e10cSrcweir 
951cdf0e10cSrcweir     return lDispatcher;
952cdf0e10cSrcweir }
953cdf0e10cSrcweir 
954cdf0e10cSrcweir //________________________________________________________________________________________________________
955cdf0e10cSrcweir //	SfxBaseController -> XControllerBorder
956cdf0e10cSrcweir //________________________________________________________________________________________________________
957cdf0e10cSrcweir 
getBorder()958cdf0e10cSrcweir frame::BorderWidths SAL_CALL SfxBaseController::getBorder()
959cdf0e10cSrcweir 	throw ( uno::RuntimeException )
960cdf0e10cSrcweir {
961cdf0e10cSrcweir 	frame::BorderWidths aResult;
962cdf0e10cSrcweir 
963cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
964cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
965cdf0e10cSrcweir 	{
966cdf0e10cSrcweir 		SvBorder aBorder = m_pData->m_pViewShell->GetBorderPixel();
967cdf0e10cSrcweir 		aResult.Left = aBorder.Left();
968cdf0e10cSrcweir 		aResult.Top = aBorder.Top();
969cdf0e10cSrcweir 		aResult.Right = aBorder.Right();
970cdf0e10cSrcweir 		aResult.Bottom = aBorder.Bottom();
971cdf0e10cSrcweir 	}
972cdf0e10cSrcweir 
973cdf0e10cSrcweir 	return aResult;
974cdf0e10cSrcweir }
975cdf0e10cSrcweir 
addBorderResizeListener(const uno::Reference<frame::XBorderResizeListener> & xListener)976cdf0e10cSrcweir void SAL_CALL SfxBaseController::addBorderResizeListener( const uno::Reference< frame::XBorderResizeListener >& xListener )
977cdf0e10cSrcweir 	throw ( uno::RuntimeException )
978cdf0e10cSrcweir {
979cdf0e10cSrcweir 	m_pData->m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< frame::XBorderResizeListener >*)0),
980cdf0e10cSrcweir 												xListener );
981cdf0e10cSrcweir }
982cdf0e10cSrcweir 
removeBorderResizeListener(const uno::Reference<frame::XBorderResizeListener> & xListener)983cdf0e10cSrcweir void SAL_CALL SfxBaseController::removeBorderResizeListener( const uno::Reference< frame::XBorderResizeListener >& xListener )
984cdf0e10cSrcweir 	throw ( uno::RuntimeException )
985cdf0e10cSrcweir {
986cdf0e10cSrcweir 	m_pData->m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< frame::XBorderResizeListener >*)0),
987cdf0e10cSrcweir 												xListener );
988cdf0e10cSrcweir }
989cdf0e10cSrcweir 
queryBorderedArea(const awt::Rectangle & aPreliminaryRectangle)990cdf0e10cSrcweir awt::Rectangle SAL_CALL SfxBaseController::queryBorderedArea( const awt::Rectangle& aPreliminaryRectangle )
991cdf0e10cSrcweir 	throw ( uno::RuntimeException )
992cdf0e10cSrcweir {
993cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
994cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
995cdf0e10cSrcweir 	{
996cdf0e10cSrcweir 		Rectangle aTmpRect = VCLRectangle( aPreliminaryRectangle );
997cdf0e10cSrcweir 		m_pData->m_pViewShell->QueryObjAreaPixel( aTmpRect );
998cdf0e10cSrcweir 		return AWTRectangle( aTmpRect );
999cdf0e10cSrcweir 	}
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir 	return aPreliminaryRectangle;
1002cdf0e10cSrcweir }
1003cdf0e10cSrcweir 
BorderWidthsChanged_Impl()1004cdf0e10cSrcweir void SfxBaseController::BorderWidthsChanged_Impl()
1005cdf0e10cSrcweir {
1006cdf0e10cSrcweir    	::cppu::OInterfaceContainerHelper* pContainer = m_pData->m_aListenerContainer.getContainer(
1007cdf0e10cSrcweir 						::getCppuType( ( const uno::Reference< frame::XBorderResizeListener >*) NULL ) );
1008cdf0e10cSrcweir     if ( pContainer )
1009cdf0e10cSrcweir 	{
1010cdf0e10cSrcweir 		frame::BorderWidths aBWidths = getBorder();
1011cdf0e10cSrcweir 		uno::Reference< uno::XInterface > xThis( static_cast< ::cppu::OWeakObject* >(this), uno::UNO_QUERY );
1012cdf0e10cSrcweir 
1013cdf0e10cSrcweir 	    ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
1014cdf0e10cSrcweir 	    while (pIterator.hasMoreElements())
1015cdf0e10cSrcweir 	    {
1016cdf0e10cSrcweir 	        try
1017cdf0e10cSrcweir 	        {
1018cdf0e10cSrcweir 	            ((frame::XBorderResizeListener*)pIterator.next())->borderWidthsChanged( xThis, aBWidths );
1019cdf0e10cSrcweir 	        }
1020cdf0e10cSrcweir 	        catch( uno::RuntimeException& )
1021cdf0e10cSrcweir 	        {
1022cdf0e10cSrcweir 	            pIterator.remove();
1023cdf0e10cSrcweir 	        }
1024cdf0e10cSrcweir 	    }
1025cdf0e10cSrcweir 	}
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir //________________________________________________________________________________________________________
1029cdf0e10cSrcweir //	SfxBaseController -> XComponent
1030cdf0e10cSrcweir //________________________________________________________________________________________________________
1031cdf0e10cSrcweir 
dispose()1032cdf0e10cSrcweir void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException )
1033cdf0e10cSrcweir {
1034cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1035cdf0e10cSrcweir     Reference< XController > xTmp( this );
1036cdf0e10cSrcweir 	m_pData->m_bDisposing = sal_True ;
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir 	EVENTOBJECT aEventObject;
1039cdf0e10cSrcweir     aEventObject.Source = *this ;
1040cdf0e10cSrcweir 	m_pData->m_aListenerContainer.disposeAndClear( aEventObject ) ;
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir     if ( m_pData->m_pController && m_pData->m_pController->getFrame().is() )
1043cdf0e10cSrcweir         m_pData->m_pController->getFrame()->removeFrameActionListener( m_pData->m_xListener ) ;
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
1046cdf0e10cSrcweir     {
1047cdf0e10cSrcweir         SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ;
1048cdf0e10cSrcweir         if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell )
1049cdf0e10cSrcweir             pFrame->GetFrame().SetIsClosing_Impl();
1050cdf0e10cSrcweir         m_pData->m_pViewShell->DiscardClients_Impl();
1051cdf0e10cSrcweir         m_pData->m_pViewShell->pImp->m_bControllerSet = false;
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir         if ( pFrame )
1054cdf0e10cSrcweir         {
1055cdf0e10cSrcweir             EVENTOBJECT aObject;
1056cdf0e10cSrcweir             aObject.Source = *this ;
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir             SfxObjectShell* pDoc = pFrame->GetObjectShell() ;
1059cdf0e10cSrcweir             SfxViewFrame *pView = SfxViewFrame::GetFirst(pDoc);
1060cdf0e10cSrcweir             while( pView )
1061cdf0e10cSrcweir             {
1062cdf0e10cSrcweir                 // if there is another ViewFrame or currently the ViewShell in my ViewFrame is switched (PagePreview)
1063cdf0e10cSrcweir                 if ( pView != pFrame || pView->GetViewShell() != m_pData->m_pViewShell )
1064cdf0e10cSrcweir                     break;
1065cdf0e10cSrcweir                 pView = SfxViewFrame::GetNext( *pView, pDoc );
1066cdf0e10cSrcweir             }
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir             SFX_APP()->NotifyEvent( SfxViewEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc, uno::Reference< frame::XController2 >( this ) ) );
1069cdf0e10cSrcweir             if ( !pView )
1070cdf0e10cSrcweir                 SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) );
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir             REFERENCE< XMODEL > xModel = pDoc->GetModel();
1073cdf0e10cSrcweir 			REFERENCE < ::com::sun::star::util::XCloseable > xCloseable( xModel, com::sun::star::uno::UNO_QUERY );
1074cdf0e10cSrcweir             if ( xModel.is() )
1075cdf0e10cSrcweir 			{
1076cdf0e10cSrcweir                 xModel->disconnectController( this );
1077cdf0e10cSrcweir 				if ( xCloseable.is() )
1078cdf0e10cSrcweir 					xCloseable->removeCloseListener( m_pData->m_xCloseListener );
1079cdf0e10cSrcweir 			}
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir             REFERENCE < XFRAME > aXFrame;
1082cdf0e10cSrcweir 			attachFrame( aXFrame );
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir             m_pData->m_xListener->disposing( aObject );
1085cdf0e10cSrcweir             SfxViewShell *pShell = m_pData->m_pViewShell;
1086cdf0e10cSrcweir             m_pData->m_pViewShell = NULL;
1087cdf0e10cSrcweir             if ( pFrame->GetViewShell() == pShell )
1088cdf0e10cSrcweir             {
1089cdf0e10cSrcweir                 // Enter registrations only allowed if we are the owner!
1090cdf0e10cSrcweir                 if ( pFrame->GetFrame().OwnsBindings_Impl() )
1091cdf0e10cSrcweir                     pFrame->GetBindings().ENTERREGISTRATIONS();
1092cdf0e10cSrcweir                 pFrame->GetFrame().SetFrameInterface_Impl(  aXFrame );
1093cdf0e10cSrcweir                 pFrame->GetFrame().DoClose_Impl();
1094cdf0e10cSrcweir             }
1095cdf0e10cSrcweir         }
1096cdf0e10cSrcweir     }
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir //________________________________________________________________________________________________________
1100cdf0e10cSrcweir //	SfxBaseController -> XComponent
1101cdf0e10cSrcweir //________________________________________________________________________________________________________
1102cdf0e10cSrcweir 
addEventListener(const REFERENCE<XEVENTLISTENER> & aListener)1103cdf0e10cSrcweir void SAL_CALL SfxBaseController::addEventListener( const REFERENCE< XEVENTLISTENER >& aListener ) throw( ::com::sun::star::uno::RuntimeException )
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir 	m_pData->m_aListenerContainer.addInterface( ::getCppuType((const REFERENCE< XEVENTLISTENER >*)0), aListener );
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir //________________________________________________________________________________________________________
1109cdf0e10cSrcweir //	SfxBaseController -> XComponent
1110cdf0e10cSrcweir //________________________________________________________________________________________________________
1111cdf0e10cSrcweir 
removeEventListener(const REFERENCE<XEVENTLISTENER> & aListener)1112cdf0e10cSrcweir void SAL_CALL SfxBaseController::removeEventListener( const REFERENCE< XEVENTLISTENER >& aListener ) throw( ::com::sun::star::uno::RuntimeException )
1113cdf0e10cSrcweir {
1114cdf0e10cSrcweir 	m_pData->m_aListenerContainer.removeInterface( ::getCppuType((const REFERENCE< XEVENTLISTENER >*)0), aListener );
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir 
ReleaseShell_Impl()1117cdf0e10cSrcweir void SfxBaseController::ReleaseShell_Impl()
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1120cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
1121cdf0e10cSrcweir     {
1122cdf0e10cSrcweir         SfxObjectShell* pDoc = m_pData->m_pViewShell->GetObjectShell() ;
1123cdf0e10cSrcweir         REFERENCE< XMODEL > xModel = pDoc->GetModel();
1124cdf0e10cSrcweir         REFERENCE < ::com::sun::star::util::XCloseable > xCloseable( xModel, com::sun::star::uno::UNO_QUERY );
1125cdf0e10cSrcweir         if ( xModel.is() )
1126cdf0e10cSrcweir         {
1127cdf0e10cSrcweir             xModel->disconnectController( this );
1128cdf0e10cSrcweir             if ( xCloseable.is() )
1129cdf0e10cSrcweir                 xCloseable->removeCloseListener( m_pData->m_xCloseListener );
1130cdf0e10cSrcweir         }
1131cdf0e10cSrcweir         m_pData->m_pViewShell = 0;
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir         REFERENCE < XFRAME > aXFrame;
1134cdf0e10cSrcweir 		attachFrame( aXFrame );
1135cdf0e10cSrcweir     }
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir 
GetViewShell_Impl() const1138cdf0e10cSrcweir SfxViewShell* SfxBaseController::GetViewShell_Impl() const
1139cdf0e10cSrcweir {
1140cdf0e10cSrcweir     return m_pData->m_pViewShell;
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir 
getStatusIndicator()1143cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL SfxBaseController::getStatusIndicator(  ) throw (::com::sun::star::uno::RuntimeException)
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1146cdf0e10cSrcweir     if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() )
1147cdf0e10cSrcweir         m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() );
1148cdf0e10cSrcweir     return m_pData->m_xIndicator;
1149cdf0e10cSrcweir }
1150cdf0e10cSrcweir 
registerContextMenuInterceptor(const REFERENCE<XCONTEXTMENUINTERCEPTOR> & xInterceptor)1151cdf0e10cSrcweir void SAL_CALL SfxBaseController::registerContextMenuInterceptor( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) throw( RUNTIMEEXCEPTION )
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir     m_pData->m_aInterceptorContainer.addInterface( xInterceptor );
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1157cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
1158cdf0e10cSrcweir         m_pData->m_pViewShell->AddContextMenuInterceptor_Impl( xInterceptor );
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir 
releaseContextMenuInterceptor(const REFERENCE<XCONTEXTMENUINTERCEPTOR> & xInterceptor)1161cdf0e10cSrcweir void SAL_CALL SfxBaseController::releaseContextMenuInterceptor( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) throw( RUNTIMEEXCEPTION )
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir {
1164cdf0e10cSrcweir     m_pData->m_aInterceptorContainer.removeInterface( xInterceptor );
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1167cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
1168cdf0e10cSrcweir         m_pData->m_pViewShell->RemoveContextMenuInterceptor_Impl( xInterceptor );
1169cdf0e10cSrcweir }
1170cdf0e10cSrcweir 
addKeyHandler(const::com::sun::star::uno::Reference<XKEYHANDLER> & xHandler)1171cdf0e10cSrcweir void SAL_CALL SfxBaseController::addKeyHandler( const ::com::sun::star::uno::Reference< XKEYHANDLER >& xHandler ) throw (::com::sun::star::uno::RuntimeException)
1172cdf0e10cSrcweir {
1173cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1174cdf0e10cSrcweir     m_pData->m_aUserInputInterception.addKeyHandler( xHandler );
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir 
removeKeyHandler(const::com::sun::star::uno::Reference<XKEYHANDLER> & xHandler)1177cdf0e10cSrcweir void SAL_CALL SfxBaseController::removeKeyHandler( const ::com::sun::star::uno::Reference< XKEYHANDLER >& xHandler ) throw (::com::sun::star::uno::RuntimeException)
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1180cdf0e10cSrcweir     m_pData->m_aUserInputInterception.removeKeyHandler( xHandler );
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir 
addMouseClickHandler(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseClickHandler> & xHandler)1183cdf0e10cSrcweir void SAL_CALL SfxBaseController::addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException)
1184cdf0e10cSrcweir {
1185cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1186cdf0e10cSrcweir     m_pData->m_aUserInputInterception.addMouseClickHandler( xHandler );
1187cdf0e10cSrcweir }
1188cdf0e10cSrcweir 
removeMouseClickHandler(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseClickHandler> & xHandler)1189cdf0e10cSrcweir void SAL_CALL SfxBaseController::removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException)
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
1192cdf0e10cSrcweir     m_pData->m_aUserInputInterception.removeMouseClickHandler( xHandler );
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir 
getSupportedCommandGroups()1195cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL SfxBaseController::getSupportedCommandGroups()
1196cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
1197cdf0e10cSrcweir {
1198cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1199cdf0e10cSrcweir 
1200cdf0e10cSrcweir     std::list< sal_Int16 > aGroupList;
1201cdf0e10cSrcweir     SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() );
1202cdf0e10cSrcweir     SfxSlotPool*  pPool = &SfxSlotPool::GetSlotPool( pViewFrame );
1203cdf0e10cSrcweir 
1204cdf0e10cSrcweir     SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
1205cdf0e10cSrcweir     const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir     // Gruppe anw"ahlen ( Gruppe 0 ist intern )
1208cdf0e10cSrcweir     for ( sal_uInt16 i=0; i<pSlotPool->GetGroupCount(); i++ )
1209cdf0e10cSrcweir 	{
1210cdf0e10cSrcweir 		String aName = pSlotPool->SeekGroup( i );
1211cdf0e10cSrcweir         const SfxSlot* pSfxSlot = pSlotPool->FirstSlot();
1212cdf0e10cSrcweir         while ( pSfxSlot )
1213cdf0e10cSrcweir 		{
1214cdf0e10cSrcweir             if ( pSfxSlot->GetMode() & nMode )
1215cdf0e10cSrcweir 			{
1216cdf0e10cSrcweir                 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
1217cdf0e10cSrcweir                 aGroupList.push_back( nCommandGroup );
1218cdf0e10cSrcweir                 break;
1219cdf0e10cSrcweir 			}
1220cdf0e10cSrcweir 			pSfxSlot = pSlotPool->NextSlot();
1221cdf0e10cSrcweir 		}
1222cdf0e10cSrcweir     }
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< sal_Int16 > aSeq =
1225cdf0e10cSrcweir         comphelper::containerToSequence< sal_Int16 >( aGroupList );
1226cdf0e10cSrcweir     return aSeq;
1227cdf0e10cSrcweir }
1228cdf0e10cSrcweir 
getConfigurableDispatchInformation(sal_Int16 nCmdGroup)1229cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL SfxBaseController::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
1230cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
1231cdf0e10cSrcweir {
1232cdf0e10cSrcweir     std::list< ::com::sun::star::frame::DispatchInformation > aCmdList;
1233cdf0e10cSrcweir 
1234cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1235cdf0e10cSrcweir     if ( m_pData->m_pViewShell )
1236cdf0e10cSrcweir     {
1237cdf0e10cSrcweir         const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir         SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() );
1240cdf0e10cSrcweir         SfxSlotPool*  pPool( &SfxSlotPool::GetSlotPool( pViewFrame ));
1241cdf0e10cSrcweir         rtl::OUString aCmdPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ));
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir         SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
1244cdf0e10cSrcweir         for ( sal_uInt16 i=0; i<pSlotPool->GetGroupCount(); i++ )
1245cdf0e10cSrcweir 		{
1246cdf0e10cSrcweir 			String aName = pSlotPool->SeekGroup( i );
1247cdf0e10cSrcweir 			const SfxSlot* pSfxSlot = pSlotPool->FirstSlot();
1248cdf0e10cSrcweir 			if ( pSfxSlot )
1249cdf0e10cSrcweir 			{
1250cdf0e10cSrcweir                 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
1251cdf0e10cSrcweir                 if ( nCommandGroup == nCmdGroup )
1252cdf0e10cSrcweir                 {
1253cdf0e10cSrcweir                     while ( pSfxSlot )
1254cdf0e10cSrcweir 				    {
1255cdf0e10cSrcweir                         if ( pSfxSlot->GetMode() & nMode )
1256cdf0e10cSrcweir 					    {
1257cdf0e10cSrcweir                             ::com::sun::star::frame::DispatchInformation aCmdInfo;
1258cdf0e10cSrcweir                             ::rtl::OUStringBuffer aBuf( aCmdPrefix );
1259cdf0e10cSrcweir                             aBuf.appendAscii( pSfxSlot->GetUnoName() );
1260cdf0e10cSrcweir                             aCmdInfo.Command = aBuf.makeStringAndClear();
1261cdf0e10cSrcweir                             aCmdInfo.GroupId = nCommandGroup;
1262cdf0e10cSrcweir                             aCmdList.push_back( aCmdInfo );
1263cdf0e10cSrcweir 					    }
1264cdf0e10cSrcweir 					    pSfxSlot = pSlotPool->NextSlot();
1265cdf0e10cSrcweir 				    }
1266cdf0e10cSrcweir                 }
1267cdf0e10cSrcweir 		    }
1268cdf0e10cSrcweir         }
1269cdf0e10cSrcweir     }
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq =
1272cdf0e10cSrcweir         comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aCmdList );
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir     return aSeq;
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir 
HandleEvent_Impl(NotifyEvent & rEvent)1277cdf0e10cSrcweir sal_Bool SfxBaseController::HandleEvent_Impl( NotifyEvent& rEvent )
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir     return m_pData->m_aUserInputInterception.handleNotifyEvent( rEvent );
1280cdf0e10cSrcweir }
1281cdf0e10cSrcweir 
HasKeyListeners_Impl()1282cdf0e10cSrcweir sal_Bool SfxBaseController::HasKeyListeners_Impl()
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir     return m_pData->m_aUserInputInterception.hasKeyHandlers();
1285cdf0e10cSrcweir }
1286cdf0e10cSrcweir 
HasMouseClickListeners_Impl()1287cdf0e10cSrcweir sal_Bool SfxBaseController::HasMouseClickListeners_Impl()
1288cdf0e10cSrcweir {
1289cdf0e10cSrcweir     return m_pData->m_aUserInputInterception.hasMouseClickListeners();
1290cdf0e10cSrcweir }
1291cdf0e10cSrcweir 
ConnectSfxFrame_Impl(const ConnectSfxFrame i_eConnect)1292cdf0e10cSrcweir void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir     ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" );
1295cdf0e10cSrcweir     SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
1296cdf0e10cSrcweir     ENSURE_OR_THROW( pViewFrame, "a view shell without a view frame is pretty pathological" );
1297cdf0e10cSrcweir 
1298cdf0e10cSrcweir     const bool bConnect = ( i_eConnect != E_DISCONNECT );
1299cdf0e10cSrcweir 
1300cdf0e10cSrcweir     // disable window and dispatcher
1301cdf0e10cSrcweir     pViewFrame->Enable( bConnect );
1302cdf0e10cSrcweir     pViewFrame->GetDispatcher()->Lock( !bConnect );
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir     if ( bConnect )
1305cdf0e10cSrcweir     {
1306cdf0e10cSrcweir         if ( i_eConnect == E_CONNECT )
1307cdf0e10cSrcweir         {
1308cdf0e10cSrcweir             if  (   ( m_pData->m_pViewShell->GetObjectShell() != NULL )
1309cdf0e10cSrcweir                 &&  ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
1310cdf0e10cSrcweir                 )
1311cdf0e10cSrcweir             {
1312cdf0e10cSrcweir                 SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame();
1313cdf0e10cSrcweir                 if ( !pViewFrm->GetFrame().IsInPlace() )
1314cdf0e10cSrcweir                 {
1315cdf0e10cSrcweir                     // for outplace embedded objects, we want the layout manager to keep the content window
1316cdf0e10cSrcweir                     // size constant, if possible
1317cdf0e10cSrcweir                     try
1318cdf0e10cSrcweir                     {
1319cdf0e10cSrcweir                         uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW );
1320cdf0e10cSrcweir                         uno::Reference< beans::XPropertySet > xLayouterProps(
1321cdf0e10cSrcweir                             xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW );
1322cdf0e10cSrcweir                         xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) );
1323cdf0e10cSrcweir                     }
1324cdf0e10cSrcweir                     catch( const uno::Exception& )
1325cdf0e10cSrcweir                     {
1326cdf0e10cSrcweir                 	    DBG_UNHANDLED_EXCEPTION();
1327cdf0e10cSrcweir                     }
1328cdf0e10cSrcweir                 }
1329cdf0e10cSrcweir             }
1330cdf0e10cSrcweir         }
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir         // upon DISCONNECT, we did *not* pop the shells from the stack (this is done elsewhere), so upon
1333cdf0e10cSrcweir         // RECONNECT, we're not allowed to push them
1334cdf0e10cSrcweir         if ( i_eConnect != E_RECONNECT )
1335cdf0e10cSrcweir         {
1336cdf0e10cSrcweir             pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell );
1337cdf0e10cSrcweir             if ( m_pData->m_pViewShell->GetSubShell() )
1338cdf0e10cSrcweir                 pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() );
1339cdf0e10cSrcweir 	        m_pData->m_pViewShell->PushSubShells_Impl();
1340cdf0e10cSrcweir             pViewFrame->GetDispatcher()->Flush();
1341cdf0e10cSrcweir         }
1342cdf0e10cSrcweir 
1343cdf0e10cSrcweir         Window* pEditWin = m_pData->m_pViewShell->GetWindow();
1344cdf0e10cSrcweir         if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() )
1345cdf0e10cSrcweir             pEditWin->Show();
1346cdf0e10cSrcweir 
1347cdf0e10cSrcweir         if ( SfxViewFrame::Current() == pViewFrame )
1348cdf0e10cSrcweir             pViewFrame->GetDispatcher()->Update_Impl( sal_True );
1349cdf0e10cSrcweir 
1350cdf0e10cSrcweir         Window* pFrameWin = &pViewFrame->GetWindow();
1351cdf0e10cSrcweir         if ( pFrameWin != &pViewFrame->GetFrame().GetWindow() )
1352cdf0e10cSrcweir 	        pFrameWin->Show();
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir         if ( i_eConnect == E_CONNECT )
1355cdf0e10cSrcweir         {
1356cdf0e10cSrcweir             ::comphelper::NamedValueCollection aDocumentArgs( getModel()->getArgs() );
1357cdf0e10cSrcweir 
1358cdf0e10cSrcweir             const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) );
1359cdf0e10cSrcweir             const bool bHasPluginMode = ( nPluginMode != 0 );
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir             SfxFrame& rFrame = pViewFrame->GetFrame();
1362cdf0e10cSrcweir             SfxObjectShell& rDoc = *m_pData->m_pViewShell->GetObjectShell();
1363cdf0e10cSrcweir             if ( !rFrame.IsMarkedHidden_Impl() )
1364cdf0e10cSrcweir 	        {
1365cdf0e10cSrcweir                 if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) )
1366cdf0e10cSrcweir                     pViewFrame->GetDispatcher()->HideUI( sal_True );
1367cdf0e10cSrcweir                 else
1368cdf0e10cSrcweir                     pViewFrame->GetDispatcher()->HideUI( sal_False );
1369cdf0e10cSrcweir 
1370cdf0e10cSrcweir                 if ( rFrame.IsInPlace() )
1371cdf0e10cSrcweir                     pViewFrame->LockAdjustPosSizePixel();
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir                 if ( nPluginMode == 3 )
1374cdf0e10cSrcweir                     rFrame.GetWorkWindow_Impl()->SetInternalDockingAllowed( sal_False );
1375cdf0e10cSrcweir 
1376cdf0e10cSrcweir                 if ( !rFrame.IsInPlace() )
1377cdf0e10cSrcweir 			        pViewFrame->GetDispatcher()->Update_Impl();
1378cdf0e10cSrcweir 		        pViewFrame->Show();
1379cdf0e10cSrcweir                 rFrame.GetWindow().Show();
1380cdf0e10cSrcweir                 if ( !rFrame.IsInPlace() || ( nPluginMode == 3 ) )
1381cdf0e10cSrcweir                     pViewFrame->MakeActive_Impl( rFrame.GetFrameInterface()->isActive() );
1382cdf0e10cSrcweir 
1383cdf0e10cSrcweir                 if ( rFrame.IsInPlace() )
1384cdf0e10cSrcweir                 {
1385cdf0e10cSrcweir                     pViewFrame->UnlockAdjustPosSizePixel();
1386cdf0e10cSrcweir                     // force resize for OLE server to fix layout problems of writer and math
1387cdf0e10cSrcweir                     // see i53651
1388cdf0e10cSrcweir                     if ( nPluginMode == 3 )
1389cdf0e10cSrcweir                         pViewFrame->Resize( sal_True );
1390cdf0e10cSrcweir                 }
1391cdf0e10cSrcweir 	        }
1392cdf0e10cSrcweir             else
1393cdf0e10cSrcweir             {
1394cdf0e10cSrcweir                 DBG_ASSERT( !rFrame.IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" );
1395cdf0e10cSrcweir                 rFrame.GetWindow().Show();
1396cdf0e10cSrcweir             }
1397cdf0e10cSrcweir 
1398cdf0e10cSrcweir 	        // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen!
1399cdf0e10cSrcweir 	        pViewFrame->UpdateTitle();
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir             if ( !rFrame.IsInPlace() )
1402cdf0e10cSrcweir                 pViewFrame->Resize( sal_True );
1403cdf0e10cSrcweir 
1404cdf0e10cSrcweir             // if there's a JumpMark given, then, well, jump to it
1405cdf0e10cSrcweir             ::comphelper::NamedValueCollection aViewArgs( getCreationArguments() );
1406cdf0e10cSrcweir             const ::rtl::OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", ::rtl::OUString() );
1407cdf0e10cSrcweir             const bool bHasJumpMark = ( sJumpMark.getLength() > 0 );
1408cdf0e10cSrcweir             OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() )
1409cdf0e10cSrcweir                     ||  ( !sJumpMark.getLength() ),
1410cdf0e10cSrcweir                 "SfxBaseController::ConnectSfxFrame_Impl: so this code wasn't dead?" );
1411cdf0e10cSrcweir                 // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time
1412cdf0e10cSrcweir                 // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method
1413cdf0e10cSrcweir                 // here is never called before the load process finished. At least not with a non-empty jump mark
1414cdf0e10cSrcweir             if ( sJumpMark.getLength() )
1415cdf0e10cSrcweir 		        m_pData->m_pViewShell->JumpToMark( sJumpMark );
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir             // if no plugin mode and no jump mark was supplied, check whether the document itself can provide view data, and
1418cdf0e10cSrcweir             // if so, forward it to the view/shell.
1419cdf0e10cSrcweir             if ( !bHasPluginMode && !bHasJumpMark )
1420cdf0e10cSrcweir             {
1421cdf0e10cSrcweir                 // Note that this might not be the ideal place here. Restoring view data should, IMO, be the
1422cdf0e10cSrcweir                 // responsibility of the loader, not an implementation detail burried here deep within the controller's
1423cdf0e10cSrcweir                 // implementation.
1424cdf0e10cSrcweir                 // What I think should be done to replace the below code:
1425cdf0e10cSrcweir                 // - change SfxBaseController::restoreViewData to also accept a PropertyValue[] (it currently accepts
1426cdf0e10cSrcweir                 //   a string only), and forward it to its ViewShell's ReadUserDataSequence
1427cdf0e10cSrcweir                 // - change the frame loader so that when a new document is loaded (as opposed to an existing
1428cdf0e10cSrcweir                 //   document being loaded into a new frame), the model's view data is examine the very same
1429cdf0e10cSrcweir                 //   way as below, and the proper view data is set via XController::restoreViewData
1430cdf0e10cSrcweir                 // - extend SfxViewFrame::SwitchToViewShell_Impl. Currently, it cares for the case where a non-PrintPreview
1431cdf0e10cSrcweir                 //   view is exchanged, and sets the old view's data at the model. It should also care for the other
1432cdf0e10cSrcweir                 //   way, were the PrintPreview view is left: in this case, the new view should also be initialized
1433cdf0e10cSrcweir                 //   with the model's view data
1434cdf0e10cSrcweir                 try
1435cdf0e10cSrcweir                 {
1436cdf0e10cSrcweir                     Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW );
1437cdf0e10cSrcweir                     Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData() );
1438cdf0e10cSrcweir 
1439cdf0e10cSrcweir                     // find the view data item whose ViewId matches the ID of the view we're just connecting to
1440cdf0e10cSrcweir                     const SfxObjectFactory& rDocFactory( rDoc.GetFactory() );
1441cdf0e10cSrcweir                     const sal_Int32 nCount = xViewData.is() ? xViewData->getCount() : 0;
1442cdf0e10cSrcweir                     sal_Int32 nViewDataIndex = 0;
1443cdf0e10cSrcweir                     for ( sal_Int32 i=0; i<nCount; ++i )
1444cdf0e10cSrcweir                     {
1445cdf0e10cSrcweir                         const ::comphelper::NamedValueCollection aViewData( xViewData->getByIndex(i) );
1446cdf0e10cSrcweir                         ::rtl::OUString sViewId( aViewData.getOrDefault( "ViewId", ::rtl::OUString() ) );
1447cdf0e10cSrcweir                         if ( sViewId.getLength() == 0 )
1448cdf0e10cSrcweir                             continue;
1449cdf0e10cSrcweir 
1450cdf0e10cSrcweir                         const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId );
1451cdf0e10cSrcweir                         if ( pViewFactory == NULL )
1452cdf0e10cSrcweir                             continue;
1453cdf0e10cSrcweir 
1454cdf0e10cSrcweir                         if ( pViewFactory->GetOrdinal() == pViewFrame->GetCurViewId() )
1455cdf0e10cSrcweir                         {
1456cdf0e10cSrcweir                             nViewDataIndex = i;
1457cdf0e10cSrcweir                             break;
1458cdf0e10cSrcweir                         }
1459cdf0e10cSrcweir                     }
1460cdf0e10cSrcweir                     if ( nViewDataIndex < nCount )
1461cdf0e10cSrcweir                     {
1462cdf0e10cSrcweir                         Sequence< PropertyValue > aViewData;
1463cdf0e10cSrcweir                         OSL_VERIFY( xViewData->getByIndex( nViewDataIndex ) >>= aViewData );
1464cdf0e10cSrcweir                         if ( aViewData.getLength() > 0 )
1465cdf0e10cSrcweir                             m_pData->m_pViewShell->ReadUserDataSequence( aViewData, sal_True );
1466cdf0e10cSrcweir                     }
1467cdf0e10cSrcweir                 }
1468cdf0e10cSrcweir                 catch( const Exception& )
1469cdf0e10cSrcweir                 {
1470cdf0e10cSrcweir         	        DBG_UNHANDLED_EXCEPTION();
1471cdf0e10cSrcweir                 }
1472cdf0e10cSrcweir             }
1473cdf0e10cSrcweir         }
1474cdf0e10cSrcweir     }
1475cdf0e10cSrcweir 
1476cdf0e10cSrcweir     // invalidate slot corresponding to the view shell
1477cdf0e10cSrcweir     const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pViewFrame->GetCurViewId(), USHRT_MAX );
1478cdf0e10cSrcweir     DBG_ASSERT( nViewNo != USHRT_MAX, "view shell id not found" );
1479cdf0e10cSrcweir     if ( nViewNo != USHRT_MAX )
1480cdf0e10cSrcweir         pViewFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 );
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir 
1483cdf0e10cSrcweir //=============================================================================
impl_getTitleHelper()1484cdf0e10cSrcweir css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper ()
1485cdf0e10cSrcweir {
1486cdf0e10cSrcweir     ::vos::OGuard aGuard( Application::GetSolarMutex() );
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir     if ( ! m_pData->m_xTitleHelper.is ())
1489cdf0e10cSrcweir     {
1490cdf0e10cSrcweir         css::uno::Reference< css::frame::XModel >           xModel           = getModel ();
1491cdf0e10cSrcweir         css::uno::Reference< css::frame::XUntitledNumbers > xUntitledProvider(xModel                                       , css::uno::UNO_QUERY      );
1492cdf0e10cSrcweir         css::uno::Reference< css::frame::XController >      xThis            (static_cast< css::frame::XController* >(this), css::uno::UNO_QUERY_THROW);
1493cdf0e10cSrcweir 
1494cdf0e10cSrcweir         ::framework::TitleHelper* pHelper                 = new ::framework::TitleHelper(::comphelper::getProcessServiceFactory());
1495cdf0e10cSrcweir                                   m_pData->m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), css::uno::UNO_QUERY_THROW);
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir         pHelper->setOwner                   (xThis            );
1498cdf0e10cSrcweir         pHelper->connectWithUntitledNumbers (xUntitledProvider);
1499cdf0e10cSrcweir     }
1500cdf0e10cSrcweir 
1501cdf0e10cSrcweir     return m_pData->m_xTitleHelper;
1502cdf0e10cSrcweir }
1503cdf0e10cSrcweir 
1504cdf0e10cSrcweir //=============================================================================
1505cdf0e10cSrcweir // css::frame::XTitle
getTitle()1506cdf0e10cSrcweir ::rtl::OUString SAL_CALL SfxBaseController::getTitle()
1507cdf0e10cSrcweir     throw (css::uno::RuntimeException)
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir     return impl_getTitleHelper()->getTitle ();
1510cdf0e10cSrcweir }
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir //=============================================================================
1513cdf0e10cSrcweir // css::frame::XTitle
setTitle(const::rtl::OUString & sTitle)1514cdf0e10cSrcweir void SAL_CALL SfxBaseController::setTitle(const ::rtl::OUString& sTitle)
1515cdf0e10cSrcweir     throw (css::uno::RuntimeException)
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir     impl_getTitleHelper()->setTitle (sTitle);
1518cdf0e10cSrcweir }
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir //=============================================================================
1521cdf0e10cSrcweir // css::frame::XTitleChangeBroadcaster
addTitleChangeListener(const css::uno::Reference<css::frame::XTitleChangeListener> & xListener)1522cdf0e10cSrcweir void SAL_CALL SfxBaseController::addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
1523cdf0e10cSrcweir     throw (css::uno::RuntimeException)
1524cdf0e10cSrcweir {
1525cdf0e10cSrcweir     css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY);
1526cdf0e10cSrcweir     if (xBroadcaster.is ())
1527cdf0e10cSrcweir         xBroadcaster->addTitleChangeListener (xListener);
1528cdf0e10cSrcweir }
1529cdf0e10cSrcweir 
1530cdf0e10cSrcweir //=============================================================================
1531cdf0e10cSrcweir // css::frame::XTitleChangeBroadcaster
removeTitleChangeListener(const css::uno::Reference<css::frame::XTitleChangeListener> & xListener)1532cdf0e10cSrcweir void SAL_CALL SfxBaseController::removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
1533cdf0e10cSrcweir     throw (css::uno::RuntimeException)
1534cdf0e10cSrcweir {
1535cdf0e10cSrcweir     css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY);
1536cdf0e10cSrcweir     if (xBroadcaster.is ())
1537cdf0e10cSrcweir         xBroadcaster->removeTitleChangeListener (xListener);
1538cdf0e10cSrcweir }
1539