xref: /aoo42x/main/sd/source/ui/docshell/docshell.cxx (revision c7be74b1)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "DrawDocShell.hxx"
28cdf0e10cSrcweir #include <tools/pstm.hxx>
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <sfx2/docfac.hxx>
32cdf0e10cSrcweir #include <sfx2/objface.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef _SVXIDS_HRC
35cdf0e10cSrcweir #include <svx/svxids.hrc>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <svl/srchitem.hxx>
38cdf0e10cSrcweir #include <svx/srchdlg.hxx>
39cdf0e10cSrcweir #include <editeng/flstitem.hxx>
40cdf0e10cSrcweir #include <svl/eitem.hxx>
41cdf0e10cSrcweir #include <svl/intitem.hxx>
42cdf0e10cSrcweir #include <sfx2/printer.hxx>
43cdf0e10cSrcweir #ifndef _SFX_DOCFILE_HXX //autogen
44cdf0e10cSrcweir #include <sfx2/docfile.hxx>
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir #include <svx/drawitem.hxx>
47cdf0e10cSrcweir #include <editeng/flstitem.hxx>
48cdf0e10cSrcweir #include <svx/drawitem.hxx>
49cdf0e10cSrcweir #include <svx/srchdlg.hxx>
50cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
51cdf0e10cSrcweir #include <svl/whiter.hxx>
52cdf0e10cSrcweir #include <svl/itempool.hxx>
53cdf0e10cSrcweir #include <svtools/ctrltool.hxx>
54cdf0e10cSrcweir #include <svtools/filter.hxx>
55cdf0e10cSrcweir #ifndef _SO_CLSIDS_HXX
56cdf0e10cSrcweir #include <sot/clsids.hxx>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
59cdf0e10cSrcweir #include <svl/visitem.hxx>
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #include <svx/svdoutl.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #include "app.hrc"
66cdf0e10cSrcweir #include "app.hxx"
67cdf0e10cSrcweir #include "strmname.h"
68cdf0e10cSrcweir #include "stlpool.hxx"
69cdf0e10cSrcweir #include "strings.hrc"
70cdf0e10cSrcweir #include "View.hxx"
71cdf0e10cSrcweir #include "drawdoc.hxx"
72cdf0e10cSrcweir #include "sdpage.hxx"
73cdf0e10cSrcweir #include "glob.hrc"
74cdf0e10cSrcweir #include "res_bmp.hrc"
75cdf0e10cSrcweir #include "fupoor.hxx"
76cdf0e10cSrcweir #include "fusearch.hxx"
77cdf0e10cSrcweir #include "ViewShell.hxx"
78cdf0e10cSrcweir #include "sdresid.hxx"
79cdf0e10cSrcweir #ifndef SD_FU_SLIDE_SHOW_DLG_HXX
80cdf0e10cSrcweir #include "slideshow.hxx"
81cdf0e10cSrcweir #endif
82cdf0e10cSrcweir #include "drawview.hxx"
83cdf0e10cSrcweir #ifndef SD_FRAMW_VIEW_HXX
84cdf0e10cSrcweir #include "FrameView.hxx"
85cdf0e10cSrcweir #endif
86cdf0e10cSrcweir #include "unomodel.hxx"
87cdf0e10cSrcweir #include "undo/undomanager.hxx"
88cdf0e10cSrcweir #include "undo/undofactory.hxx"
89cdf0e10cSrcweir #include "OutlineView.hxx"
90cdf0e10cSrcweir #include "ViewShellBase.hxx"
91cdf0e10cSrcweir 
92cdf0e10cSrcweir using namespace sd;
93cdf0e10cSrcweir #define DrawDocShell
94cdf0e10cSrcweir #include "sdslots.hxx"
95cdf0e10cSrcweir 
96cdf0e10cSrcweir SFX_IMPL_INTERFACE(DrawDocShell, SfxObjectShell, SdResId(0))
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
99cdf0e10cSrcweir         SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_INSERT);
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir namespace sd {
104cdf0e10cSrcweir 
105cdf0e10cSrcweir #define POOL_BUFFER_SIZE				(sal_uInt16)32768
106cdf0e10cSrcweir #define BASIC_BUFFER_SIZE				(sal_uInt16)8192
107cdf0e10cSrcweir #define DOCUMENT_BUFFER_SIZE            (sal_uInt16)32768
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 
110cdf0e10cSrcweir GraphicFilter* GetGrfFilter();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir /*************************************************************************
113cdf0e10cSrcweir |*
114cdf0e10cSrcweir |* SFX-Slotmaps und -Definitionen
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir \************************************************************************/
117cdf0e10cSrcweir TYPEINIT1( DrawDocShell, SfxObjectShell );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir SFX_IMPL_OBJECTFACTORY(
120cdf0e10cSrcweir     DrawDocShell,
121cdf0e10cSrcweir     SvGlobalName(SO3_SIMPRESS_CLASSID),
122cdf0e10cSrcweir     SFXOBJECTSHELL_STD_NORMAL,
123cdf0e10cSrcweir     "simpress" )
124cdf0e10cSrcweir 
125cdf0e10cSrcweir /*************************************************************************
126cdf0e10cSrcweir |*
127cdf0e10cSrcweir |* Construct
128cdf0e10cSrcweir |*
129cdf0e10cSrcweir \************************************************************************/
130cdf0e10cSrcweir 
131cdf0e10cSrcweir void DrawDocShell::Construct( bool bClipboard )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	mbInDestruction = sal_False;
134cdf0e10cSrcweir 	SetSlotFilter();     // setzt Filter zurueck
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	mbOwnDocument = mpDoc == 0;
137cdf0e10cSrcweir 	if( mbOwnDocument )
138cdf0e10cSrcweir 		mpDoc = new SdDrawDocument(meDocType, this);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     // The document has been created so we can call UpdateRefDevice() to set
141cdf0e10cSrcweir     // the document's ref device.
142cdf0e10cSrcweir     UpdateRefDevice();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	SetBaseModel( new SdXImpressDocument( this, bClipboard ) );
145cdf0e10cSrcweir 	SetPool( &mpDoc->GetItemPool() );
146cdf0e10cSrcweir 	mpUndoManager = new sd::UndoManager;
147cdf0e10cSrcweir 	mpDoc->SetSdrUndoManager( mpUndoManager );
148cdf0e10cSrcweir 	mpDoc->SetSdrUndoFactory( new sd::UndoFactory );
149cdf0e10cSrcweir 	UpdateTablePointers();
150cdf0e10cSrcweir 	SetStyleFamily(5);       //CL: eigentlich SFX_STYLE_FAMILY_PSEUDO
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir /*************************************************************************
154cdf0e10cSrcweir |*
155cdf0e10cSrcweir |* Konstruktor 1
156cdf0e10cSrcweir |*
157cdf0e10cSrcweir \************************************************************************/
158cdf0e10cSrcweir 
159cdf0e10cSrcweir DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode,
160cdf0e10cSrcweir 							   sal_Bool bDataObject,
161cdf0e10cSrcweir 							   DocumentType eDocumentType) :
162cdf0e10cSrcweir     SfxObjectShell( eMode == SFX_CREATE_MODE_INTERNAL ?  SFX_CREATE_MODE_EMBEDDED : eMode),
163cdf0e10cSrcweir 	mpDoc(NULL),
164cdf0e10cSrcweir 	mpUndoManager(NULL),
165cdf0e10cSrcweir 	mpPrinter(NULL),
166cdf0e10cSrcweir 	mpViewShell(NULL),
167cdf0e10cSrcweir 	mpFontList(NULL),
168cdf0e10cSrcweir 	meDocType(eDocumentType),
169cdf0e10cSrcweir 	mpFilterSIDs(0),
170cdf0e10cSrcweir 	mbSdDataObj(bDataObject),
171cdf0e10cSrcweir 	mbOwnPrinter(sal_False),
172cdf0e10cSrcweir     mbNewDocument( sal_True )
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	Construct( eMode == SFX_CREATE_MODE_INTERNAL );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir /*************************************************************************
178cdf0e10cSrcweir |*
179cdf0e10cSrcweir |* Konstruktor 2
180cdf0e10cSrcweir |*
181cdf0e10cSrcweir \************************************************************************/
182cdf0e10cSrcweir 
183cdf0e10cSrcweir DrawDocShell::DrawDocShell( const sal_uInt64 nModelCreationFlags, sal_Bool bDataObject, DocumentType eDocumentType ) :
184cdf0e10cSrcweir     SfxObjectShell( nModelCreationFlags ),
185cdf0e10cSrcweir 	mpDoc(NULL),
186cdf0e10cSrcweir 	mpUndoManager(NULL),
187cdf0e10cSrcweir 	mpPrinter(NULL),
188cdf0e10cSrcweir 	mpViewShell(NULL),
189cdf0e10cSrcweir 	mpFontList(NULL),
190cdf0e10cSrcweir 	meDocType(eDocumentType),
191cdf0e10cSrcweir 	mpFilterSIDs(0),
192cdf0e10cSrcweir 	mbSdDataObj(bDataObject),
193cdf0e10cSrcweir 	mbOwnPrinter(sal_False),
194cdf0e10cSrcweir     mbNewDocument( sal_True )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	Construct( sal_False );
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir /*************************************************************************
200cdf0e10cSrcweir |*
201cdf0e10cSrcweir |* Konstruktor 3
202cdf0e10cSrcweir |*
203cdf0e10cSrcweir \************************************************************************/
204cdf0e10cSrcweir 
205cdf0e10cSrcweir DrawDocShell::DrawDocShell(SdDrawDocument* pDoc, SfxObjectCreateMode eMode,
206cdf0e10cSrcweir 							   sal_Bool bDataObject,
207cdf0e10cSrcweir 							   DocumentType eDocumentType) :
208cdf0e10cSrcweir 	SfxObjectShell(eMode == SFX_CREATE_MODE_INTERNAL ?  SFX_CREATE_MODE_EMBEDDED : eMode),
209cdf0e10cSrcweir 	mpDoc(pDoc),
210cdf0e10cSrcweir 	mpUndoManager(NULL),
211cdf0e10cSrcweir 	mpPrinter(NULL),
212cdf0e10cSrcweir 	mpViewShell(NULL),
213cdf0e10cSrcweir 	mpFontList(NULL),
214cdf0e10cSrcweir 	meDocType(eDocumentType),
215cdf0e10cSrcweir 	mpFilterSIDs(0),
216cdf0e10cSrcweir 	mbSdDataObj(bDataObject),
217cdf0e10cSrcweir 	mbOwnPrinter(sal_False),
218cdf0e10cSrcweir     mbNewDocument( sal_True )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir 	Construct( eMode == SFX_CREATE_MODE_INTERNAL );
221cdf0e10cSrcweir }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir /*************************************************************************
224cdf0e10cSrcweir |*
225cdf0e10cSrcweir |* Destruktor
226cdf0e10cSrcweir |*
227cdf0e10cSrcweir \************************************************************************/
228cdf0e10cSrcweir 
229cdf0e10cSrcweir DrawDocShell::~DrawDocShell()
230cdf0e10cSrcweir {
231cdf0e10cSrcweir     // Tell all listeners that the doc shell is about to be
232cdf0e10cSrcweir     // destroyed.  This has been introduced for the PreviewRenderer to
233cdf0e10cSrcweir     // free its view (that uses the item poll of the doc shell) but
234cdf0e10cSrcweir     // may be usefull in other places as well.
235cdf0e10cSrcweir 	Broadcast(SfxSimpleHint(SFX_HINT_DYING));
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	mbInDestruction = sal_True;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	SetDocShellFunction(0);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	delete mpFontList;
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 	if( mpDoc )
244cdf0e10cSrcweir 		mpDoc->SetSdrUndoManager( 0 );
245cdf0e10cSrcweir 	delete mpUndoManager;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	if (mbOwnPrinter)
248cdf0e10cSrcweir 		delete mpPrinter;
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 	if( mbOwnDocument )
251cdf0e10cSrcweir 		delete mpDoc;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	// damit der Navigator das Verschwinden des Dokuments mitbekommt
254cdf0e10cSrcweir 	SfxBoolItem		aItem(SID_NAVIGATOR_INIT, sal_True);
255cdf0e10cSrcweir 	SfxViewFrame*	pFrame = mpViewShell ? mpViewShell->GetFrame() : GetFrame();
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	if( !pFrame )
258cdf0e10cSrcweir 		pFrame = SfxViewFrame::GetFirst( this );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	if( pFrame )
261cdf0e10cSrcweir 		pFrame->GetDispatcher()->Execute(
262cdf0e10cSrcweir 			SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L);
263cdf0e10cSrcweir }
264cdf0e10cSrcweir 
265cdf0e10cSrcweir /*************************************************************************
266cdf0e10cSrcweir |*
267cdf0e10cSrcweir |* Slot-Stati setzen
268cdf0e10cSrcweir |*
269cdf0e10cSrcweir \************************************************************************/
270cdf0e10cSrcweir 
271cdf0e10cSrcweir void DrawDocShell::GetState(SfxItemSet &rSet)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
275cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	while ( nWhich )
278cdf0e10cSrcweir 	{
279cdf0e10cSrcweir 		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
280cdf0e10cSrcweir 			? GetPool().GetSlotId(nWhich)
281cdf0e10cSrcweir 			: nWhich;
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 		switch ( nSlotId )
284cdf0e10cSrcweir 		{
285cdf0e10cSrcweir 			case SID_SEARCH_ITEM:
286cdf0e10cSrcweir 			{
287cdf0e10cSrcweir 				rSet.Put( *SD_MOD()->GetSearchItem() );
288cdf0e10cSrcweir 			}
289cdf0e10cSrcweir 			break;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 			case SID_CLOSEDOC:
292cdf0e10cSrcweir 			{
293cdf0e10cSrcweir 				sal_Bool bDisabled = sal_False;
294cdf0e10cSrcweir 				if (bDisabled)
295cdf0e10cSrcweir 				{
296cdf0e10cSrcweir 					rSet.DisableItem(SID_CLOSEDOC);
297cdf0e10cSrcweir 				}
298cdf0e10cSrcweir 				else
299cdf0e10cSrcweir 				{
300cdf0e10cSrcweir 					GetSlotState(SID_CLOSEDOC, SfxObjectShell::GetInterface(), &rSet);
301cdf0e10cSrcweir 				}
302cdf0e10cSrcweir 			}
303cdf0e10cSrcweir 			break;
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 			case SID_SEARCH_OPTIONS:
306cdf0e10cSrcweir 			{
307cdf0e10cSrcweir 				sal_uInt16 nOpt = SEARCH_OPTIONS_SEARCH 	 |
308cdf0e10cSrcweir 							  SEARCH_OPTIONS_WHOLE_WORDS |
309cdf0e10cSrcweir 							  SEARCH_OPTIONS_BACKWARDS	 |
310cdf0e10cSrcweir 							  SEARCH_OPTIONS_REG_EXP	 |
311cdf0e10cSrcweir 							  SEARCH_OPTIONS_EXACT		 |
312cdf0e10cSrcweir 							  SEARCH_OPTIONS_SIMILARITY  |
313cdf0e10cSrcweir 							  SEARCH_OPTIONS_SELECTION;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 				if (!IsReadOnly())
316cdf0e10cSrcweir 				{
317cdf0e10cSrcweir 					nOpt |= SEARCH_OPTIONS_REPLACE;
318cdf0e10cSrcweir 					nOpt |= SEARCH_OPTIONS_REPLACE_ALL;
319cdf0e10cSrcweir 				}
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 				rSet.Put(SfxUInt16Item(nWhich, nOpt));
322cdf0e10cSrcweir 			}
323cdf0e10cSrcweir 			break;
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 			case SID_VERSION:
326cdf0e10cSrcweir 			{
327cdf0e10cSrcweir 				GetSlotState( SID_VERSION, SfxObjectShell::GetInterface(), &rSet );
328cdf0e10cSrcweir 			}
329cdf0e10cSrcweir 			break;
330cdf0e10cSrcweir 
331cdf0e10cSrcweir             case SID_CHINESE_CONVERSION:
332cdf0e10cSrcweir 			case SID_HANGUL_HANJA_CONVERSION:
333cdf0e10cSrcweir 			{
334cdf0e10cSrcweir                 rSet.Put(SfxVisibilityItem(nWhich, SvtCJKOptions().IsAnyEnabled()));
335cdf0e10cSrcweir 			}
336cdf0e10cSrcweir 			break;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 			default:
339cdf0e10cSrcweir 			break;
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
342cdf0e10cSrcweir 	}
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     SfxViewFrame* pFrame = SfxViewFrame::Current();
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	if (pFrame)
347cdf0e10cSrcweir 	{
348cdf0e10cSrcweir 		if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
349cdf0e10cSrcweir 		{
350cdf0e10cSrcweir 			pFrame->GetSlotState(SID_RELOAD,
351cdf0e10cSrcweir 								 pFrame->GetInterface(), &rSet);
352cdf0e10cSrcweir 		}
353cdf0e10cSrcweir 	}
354cdf0e10cSrcweir }
355cdf0e10cSrcweir 
356cdf0e10cSrcweir void DrawDocShell::InPlaceActivate( sal_Bool bActive )
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	if( !bActive )
359cdf0e10cSrcweir 	{
360cdf0e10cSrcweir 		FrameView* pFrameView = NULL;
361cdf0e10cSrcweir 		List* pFrameViewList = mpDoc->GetFrameViewList();
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 		DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
364cdf0e10cSrcweir 		if( pFrameViewList )
365cdf0e10cSrcweir 		{
366cdf0e10cSrcweir 			sal_uInt32 i;
367cdf0e10cSrcweir 			for ( i = 0; i < pFrameViewList->Count(); i++)
368cdf0e10cSrcweir 			{
369cdf0e10cSrcweir 				// Ggf. FrameViews loeschen
370cdf0e10cSrcweir 				pFrameView = (FrameView*) pFrameViewList->GetObject(i);
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 				if (pFrameView)
373cdf0e10cSrcweir 					delete pFrameView;
374cdf0e10cSrcweir 			}
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 			pFrameViewList->Clear();
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 			ViewShell* pViewSh = NULL;
379cdf0e10cSrcweir 			SfxViewShell* pSfxViewSh = NULL;
380cdf0e10cSrcweir 			SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 			while (pSfxViewFrame)
383cdf0e10cSrcweir 			{
384cdf0e10cSrcweir 				// Anzahl FrameViews ermitteln
385cdf0e10cSrcweir 				pSfxViewSh = pSfxViewFrame->GetViewShell();
386cdf0e10cSrcweir 				pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 				if ( pViewSh && pViewSh->GetFrameView() )
389cdf0e10cSrcweir 				{
390cdf0e10cSrcweir 					pViewSh->WriteFrameViewData();
391cdf0e10cSrcweir 					pFrameViewList->Insert( new FrameView( mpDoc, pViewSh->GetFrameView() ) );
392cdf0e10cSrcweir 				}
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 				pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
395cdf0e10cSrcweir 			}
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 	}
398cdf0e10cSrcweir 
399cdf0e10cSrcweir     SfxObjectShell::InPlaceActivate( bActive );
400cdf0e10cSrcweir 
401cdf0e10cSrcweir 	if( bActive )
402cdf0e10cSrcweir 	{
403cdf0e10cSrcweir 		List* pFrameViewList = mpDoc->GetFrameViewList();
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 		DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
406cdf0e10cSrcweir 		if( pFrameViewList )
407cdf0e10cSrcweir 		{
408cdf0e10cSrcweir 			ViewShell* pViewSh = NULL;
409cdf0e10cSrcweir 			SfxViewShell* pSfxViewSh = NULL;
410cdf0e10cSrcweir 			SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 			sal_uInt32 i;
413cdf0e10cSrcweir 			for( i = 0; pSfxViewFrame && (i < pFrameViewList->Count()); i++ )
414cdf0e10cSrcweir 			{
415cdf0e10cSrcweir 				// Anzahl FrameViews ermitteln
416cdf0e10cSrcweir 				pSfxViewSh = pSfxViewFrame->GetViewShell();
417cdf0e10cSrcweir 				pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 				if ( pViewSh )
420cdf0e10cSrcweir 				{
421cdf0e10cSrcweir 					pViewSh->ReadFrameViewData( (FrameView*)pFrameViewList->GetObject(i) );
422cdf0e10cSrcweir 				}
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 				pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 		}
427cdf0e10cSrcweir 	}
428cdf0e10cSrcweir }
429cdf0e10cSrcweir 
430cdf0e10cSrcweir /*************************************************************************
431cdf0e10cSrcweir |*
432cdf0e10cSrcweir |* SFX-Aktivierung
433cdf0e10cSrcweir |*
434cdf0e10cSrcweir \************************************************************************/
435cdf0e10cSrcweir 
436cdf0e10cSrcweir void DrawDocShell::Activate( sal_Bool bMDI)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir 	if (bMDI)
439cdf0e10cSrcweir 	{
440cdf0e10cSrcweir 		ApplySlotFilter();
441cdf0e10cSrcweir 		mpDoc->StartOnlineSpelling();
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir /*************************************************************************
446cdf0e10cSrcweir |*
447cdf0e10cSrcweir |* SFX-Deaktivierung
448cdf0e10cSrcweir |*
449cdf0e10cSrcweir \************************************************************************/
450cdf0e10cSrcweir 
451cdf0e10cSrcweir void DrawDocShell::Deactivate( sal_Bool )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir /*************************************************************************
456cdf0e10cSrcweir |*
457cdf0e10cSrcweir |* SFX-Undomanager zurueckgeben
458cdf0e10cSrcweir |*
459cdf0e10cSrcweir \************************************************************************/
460cdf0e10cSrcweir 
461cdf0e10cSrcweir ::svl::IUndoManager* DrawDocShell::GetUndoManager()
462cdf0e10cSrcweir {
463cdf0e10cSrcweir 	return mpUndoManager;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 
468cdf0e10cSrcweir /*************************************************************************
469cdf0e10cSrcweir |*
470cdf0e10cSrcweir |* Tabellenzeiger auffrischen
471cdf0e10cSrcweir |*
472cdf0e10cSrcweir \************************************************************************/
473cdf0e10cSrcweir 
474cdf0e10cSrcweir void DrawDocShell::UpdateTablePointers()
475cdf0e10cSrcweir {
476*c7be74b1SArmin Le Grand     PutItem( SvxColorTableItem( mpDoc->GetColorTableFromSdrModel(), SID_COLOR_TABLE ) );
477*c7be74b1SArmin Le Grand     PutItem( SvxGradientListItem( mpDoc->GetGradientListFromSdrModel(), SID_GRADIENT_LIST ) );
478*c7be74b1SArmin Le Grand     PutItem( SvxHatchListItem( mpDoc->GetHatchListFromSdrModel(), SID_HATCH_LIST ) );
479*c7be74b1SArmin Le Grand     PutItem( SvxBitmapListItem( mpDoc->GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) );
480*c7be74b1SArmin Le Grand     PutItem( SvxDashListItem( mpDoc->GetDashListFromSdrModel(), SID_DASH_LIST ) );
481*c7be74b1SArmin Le Grand     PutItem( SvxLineEndListItem( mpDoc->GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) );
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 	UpdateFontList();
484cdf0e10cSrcweir }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir /*************************************************************************
487cdf0e10cSrcweir |*
488cdf0e10cSrcweir |*
489cdf0e10cSrcweir |*
490cdf0e10cSrcweir \************************************************************************/
491cdf0e10cSrcweir 
492cdf0e10cSrcweir void DrawDocShell::CancelSearching()
493cdf0e10cSrcweir {
494cdf0e10cSrcweir 	if( dynamic_cast<FuSearch*>( mxDocShellFunction.get() ) )
495cdf0e10cSrcweir 	{
496cdf0e10cSrcweir 		SetDocShellFunction(0);
497cdf0e10cSrcweir 	}
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir /*************************************************************************
501cdf0e10cSrcweir |*
502cdf0e10cSrcweir |*  den eingestellten SlotFilter anwenden
503cdf0e10cSrcweir |*
504cdf0e10cSrcweir \************************************************************************/
505cdf0e10cSrcweir 
506cdf0e10cSrcweir void DrawDocShell::ApplySlotFilter() const
507cdf0e10cSrcweir {
508cdf0e10cSrcweir     SfxViewShell* pTestViewShell = SfxViewShell::GetFirst();
509cdf0e10cSrcweir 
510cdf0e10cSrcweir     while( pTestViewShell )
511cdf0e10cSrcweir     {
512cdf0e10cSrcweir         if( pTestViewShell->GetObjectShell()
513cdf0e10cSrcweir             == const_cast<DrawDocShell*>( this )
514cdf0e10cSrcweir             && pTestViewShell->GetViewFrame()
515cdf0e10cSrcweir             && pTestViewShell->GetViewFrame()->GetDispatcher() )
516cdf0e10cSrcweir         {
517cdf0e10cSrcweir 	        SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher();
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	        if( mpFilterSIDs )
520cdf0e10cSrcweir 		        pDispatcher->SetSlotFilter( mbFilterEnable, mnFilterCount, mpFilterSIDs );
521cdf0e10cSrcweir 	        else
522cdf0e10cSrcweir 		        pDispatcher->SetSlotFilter();
523cdf0e10cSrcweir 
524cdf0e10cSrcweir             if( pDispatcher->GetBindings() )
525cdf0e10cSrcweir                 pDispatcher->GetBindings()->InvalidateAll( sal_True );
526cdf0e10cSrcweir         }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir         pTestViewShell = SfxViewShell::GetNext( *pTestViewShell );
529cdf0e10cSrcweir     }
530cdf0e10cSrcweir }
531cdf0e10cSrcweir 
532cdf0e10cSrcweir void DrawDocShell::SetModified( sal_Bool bSet /* = sal_True */ )
533cdf0e10cSrcweir {
534cdf0e10cSrcweir     SfxObjectShell::SetModified( bSet );
535cdf0e10cSrcweir 
536cdf0e10cSrcweir     // #100237# change model state, too
537cdf0e10cSrcweir     // #103182# only set the changed state if modification is enabled
538cdf0e10cSrcweir     if( IsEnableSetModified() )
539cdf0e10cSrcweir 	{
540cdf0e10cSrcweir 		if ( mpDoc )
541cdf0e10cSrcweir         	mpDoc->NbcSetChanged( bSet );
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 		Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) );
544cdf0e10cSrcweir 	}
545cdf0e10cSrcweir }
546cdf0e10cSrcweir 
547cdf0e10cSrcweir /*************************************************************************
548cdf0e10cSrcweir |*
549cdf0e10cSrcweir |* Callback fuer ExecuteSpellPopup()
550cdf0e10cSrcweir |*
551cdf0e10cSrcweir \************************************************************************/
552cdf0e10cSrcweir 
553cdf0e10cSrcweir // #91457# ExecuteSpellPopup now handled by DrawDocShell. This is necessary
554cdf0e10cSrcweir // to get hands on the outliner and the text object.
555cdf0e10cSrcweir IMPL_LINK(DrawDocShell, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
556cdf0e10cSrcweir {
557cdf0e10cSrcweir 	SdrObject* pObj = NULL;
558cdf0e10cSrcweir 	SdrOutliner* pOutl = NULL;
559cdf0e10cSrcweir 
560cdf0e10cSrcweir 	if(GetViewShell())
561cdf0e10cSrcweir 	{
562cdf0e10cSrcweir 		pOutl = GetViewShell()->GetView()->GetTextEditOutliner();
563cdf0e10cSrcweir 		pObj = GetViewShell()->GetView()->GetTextEditObject();
564cdf0e10cSrcweir 	}
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	mpDoc->ImpOnlineSpellCallback(pInfo, pObj, pOutl);
567cdf0e10cSrcweir 	return(0);
568cdf0e10cSrcweir }
569cdf0e10cSrcweir 
570cdf0e10cSrcweir void DrawDocShell::ClearUndoBuffer()
571cdf0e10cSrcweir {
572cdf0e10cSrcweir 	// clear possible undo buffers of outliners
573cdf0e10cSrcweir 	SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
574cdf0e10cSrcweir 	while(pSfxViewFrame)
575cdf0e10cSrcweir 	{
576cdf0e10cSrcweir 		ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pSfxViewFrame->GetViewShell() );
577cdf0e10cSrcweir 		if( pViewShellBase )
578cdf0e10cSrcweir 		{
579cdf0e10cSrcweir 			::boost::shared_ptr<ViewShell> pViewSh( pViewShellBase->GetMainViewShell() );
580cdf0e10cSrcweir 			if( pViewSh.get() )
581cdf0e10cSrcweir 			{
582cdf0e10cSrcweir 				::sd::View* pView = pViewSh->GetView();
583cdf0e10cSrcweir 				if( pView )
584cdf0e10cSrcweir 				{
585cdf0e10cSrcweir 					pView->SdrEndTextEdit();
586cdf0e10cSrcweir 					sd::OutlineView* pOutlView = dynamic_cast< sd::OutlineView* >( pView );
587cdf0e10cSrcweir 					if( pOutlView )
588cdf0e10cSrcweir 					{
589cdf0e10cSrcweir 						SdrOutliner* pOutliner = pOutlView->GetOutliner();
590cdf0e10cSrcweir 						if( pOutliner )
591cdf0e10cSrcweir 							pOutliner->GetUndoManager().Clear();
592cdf0e10cSrcweir 					}
593cdf0e10cSrcweir 				}
594cdf0e10cSrcweir 			}
595cdf0e10cSrcweir 		}
596cdf0e10cSrcweir 		pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false);
597cdf0e10cSrcweir 	}
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = GetUndoManager();
600cdf0e10cSrcweir     if(pUndoManager && pUndoManager->GetUndoActionCount())
601cdf0e10cSrcweir         pUndoManager->Clear();
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir } // end of namespace sd
605