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