xref: /AOO41X/main/sw/source/ui/uiview/view.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
33*cdf0e10cSrcweir #include <stdlib.h>
34*cdf0e10cSrcweir #include <hintids.hxx>
35*cdf0e10cSrcweir #include <rtl/logfile.hxx>
36*cdf0e10cSrcweir #include <vcl/graph.hxx>
37*cdf0e10cSrcweir #include <vcl/inputctx.hxx>
38*cdf0e10cSrcweir #include <basic/sbxobj.hxx>
39*cdf0e10cSrcweir #include <svl/eitem.hxx>
40*cdf0e10cSrcweir #include <unotools/undoopt.hxx>
41*cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
42*cdf0e10cSrcweir #include <unotools/useroptions.hxx>
43*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
44*cdf0e10cSrcweir #include <sfx2/request.hxx>
45*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
46*cdf0e10cSrcweir #include <sfx2/printer.hxx>
47*cdf0e10cSrcweir #include <sfx2/app.hxx>
48*cdf0e10cSrcweir #include <svx/ruler.hxx>
49*cdf0e10cSrcweir #include <editeng/protitem.hxx>
50*cdf0e10cSrcweir #include <svx/fmshell.hxx>
51*cdf0e10cSrcweir #include <svx/extrusionbar.hxx>
52*cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
53*cdf0e10cSrcweir #include <unotxvw.hxx>
54*cdf0e10cSrcweir #include <cmdid.h>
55*cdf0e10cSrcweir #include <swhints.hxx>
56*cdf0e10cSrcweir #include <swmodule.hxx>
57*cdf0e10cSrcweir #include <inputwin.hxx>
58*cdf0e10cSrcweir #include <chartins.hxx>
59*cdf0e10cSrcweir #include <uivwimp.hxx>
60*cdf0e10cSrcweir #include <uitool.hxx>
61*cdf0e10cSrcweir #include <edtwin.hxx>
62*cdf0e10cSrcweir #include <textsh.hxx>
63*cdf0e10cSrcweir #include <listsh.hxx>
64*cdf0e10cSrcweir #include <tabsh.hxx>
65*cdf0e10cSrcweir #include <grfsh.hxx>
66*cdf0e10cSrcweir #include <mediash.hxx>
67*cdf0e10cSrcweir #include <docsh.hxx>
68*cdf0e10cSrcweir #include <frmsh.hxx>
69*cdf0e10cSrcweir #include <olesh.hxx>
70*cdf0e10cSrcweir #include <drawsh.hxx>
71*cdf0e10cSrcweir #include <drawbase.hxx>
72*cdf0e10cSrcweir #include <drformsh.hxx>
73*cdf0e10cSrcweir #include <drwtxtsh.hxx>
74*cdf0e10cSrcweir #include <beziersh.hxx>
75*cdf0e10cSrcweir #include <globdoc.hxx>
76*cdf0e10cSrcweir #include <scroll.hxx>
77*cdf0e10cSrcweir #include <navipi.hxx>
78*cdf0e10cSrcweir #include <gloshdl.hxx>
79*cdf0e10cSrcweir #include <usrpref.hxx>
80*cdf0e10cSrcweir #include <srcview.hxx>
81*cdf0e10cSrcweir #include <doc.hxx>
82*cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
83*cdf0e10cSrcweir #include <drawdoc.hxx>
84*cdf0e10cSrcweir #include <wdocsh.hxx>
85*cdf0e10cSrcweir #include <wview.hxx>
86*cdf0e10cSrcweir #include <workctrl.hxx>
87*cdf0e10cSrcweir #include <wrtsh.hxx>
88*cdf0e10cSrcweir #include <barcfg.hxx>
89*cdf0e10cSrcweir #include <pview.hxx>
90*cdf0e10cSrcweir #include <swdtflvr.hxx>
91*cdf0e10cSrcweir #include <view.hrc>
92*cdf0e10cSrcweir #include <globdoc.hrc>
93*cdf0e10cSrcweir #include <frmui.hrc>
94*cdf0e10cSrcweir #include <cfgitems.hxx>
95*cdf0e10cSrcweir #include <prtopt.hxx>
96*cdf0e10cSrcweir #include <linguistic/lngprops.hxx>
97*cdf0e10cSrcweir #include <editeng/unolingu.hxx>
98*cdf0e10cSrcweir //#include <sfx2/app.hxx>
99*cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
100*cdf0e10cSrcweir #include <com/sun/star/scanner/ScannerContext.hpp>
101*cdf0e10cSrcweir #include <com/sun/star/scanner/XScannerManager.hpp>
102*cdf0e10cSrcweir #include <toolkit/unohlp.hxx>
103*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
104*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir #include "formatclipboard.hxx"
107*cdf0e10cSrcweir #include <PostItMgr.hxx>
108*cdf0e10cSrcweir #include <annotsh.hxx>
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir #include <fldbas.hxx>
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir #include <unomid.h>
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp>
115*cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir using namespace ::com::sun::star;
119*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
120*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
121*cdf0e10cSrcweir using namespace ::com::sun::star::scanner;
122*cdf0e10cSrcweir using ::rtl::OUString;
123*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir extern sal_Bool bNoInterrupt;		// in mainwn.cxx
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir #define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT| 				\
129*cdf0e10cSrcweir 					  SFX_VIEW_HAS_PRINTOPTIONS)
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir /*--------------------------------------------------------------------
132*cdf0e10cSrcweir 	Beschreibung:	Statics
133*cdf0e10cSrcweir  --------------------------------------------------------------------*/
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir int bDocSzUpdated = 1;
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir SvxSearchItem*	SwView::pSrchItem 	= 0;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir sal_uInt16 			SwView::nInsertCtrlState 		= FN_INSERT_TABLE;
140*cdf0e10cSrcweir sal_uInt16 			SwView::nWebInsertCtrlState     = FN_INSERT_TABLE;
141*cdf0e10cSrcweir sal_uInt16 			SwView::nInsertObjectCtrlState 	= SID_INSERT_DIAGRAM;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir sal_Bool			SwView::bExtra		= sal_False;
144*cdf0e10cSrcweir sal_Bool			SwView::bFound		= sal_False;
145*cdf0e10cSrcweir sal_Bool			SwView::bJustOpened	= sal_False;
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir SvxSearchDialog*	SwView::pSrchDlg	= 0;
149*cdf0e10cSrcweir SearchAttrItemList* SwView::pSrchList	= 0;
150*cdf0e10cSrcweir SearchAttrItemList* SwView::pReplList	= 0;
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir DBG_NAME(viewhdl)
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir /*--------------------------------------------------------------------
155*cdf0e10cSrcweir 	Beschreibung:
156*cdf0e10cSrcweir  --------------------------------------------------------------------*/
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir inline SfxDispatcher &SwView::GetDispatcher()
159*cdf0e10cSrcweir {
160*cdf0e10cSrcweir 	return *GetViewFrame()->GetDispatcher();
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir /*--------------------------------------------------------------------
164*cdf0e10cSrcweir 	Beschreibung:
165*cdf0e10cSrcweir  --------------------------------------------------------------------*/
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir void SwView::ImpSetVerb( int nSelType )
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir 	sal_Bool bResetVerbs = bVerbsActive;
170*cdf0e10cSrcweir     if ( !GetViewFrame()->GetFrame().IsInPlace() &&
171*cdf0e10cSrcweir 		 (nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType )
172*cdf0e10cSrcweir 	{
173*cdf0e10cSrcweir 		if ( !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) )
174*cdf0e10cSrcweir 		{
175*cdf0e10cSrcweir 			if ( nSelType & nsSelectionType::SEL_OLE )
176*cdf0e10cSrcweir 			{
177*cdf0e10cSrcweir                 SetVerbs( GetWrtShell().GetOLEObject()->getSupportedVerbs() );
178*cdf0e10cSrcweir 				bVerbsActive = sal_True;
179*cdf0e10cSrcweir 				bResetVerbs = sal_False;
180*cdf0e10cSrcweir 			}
181*cdf0e10cSrcweir 		}
182*cdf0e10cSrcweir 	}
183*cdf0e10cSrcweir 	if ( bResetVerbs )
184*cdf0e10cSrcweir 	{
185*cdf0e10cSrcweir 		SetVerbs( Sequence< embed::VerbDescriptor >() );
186*cdf0e10cSrcweir 		bVerbsActive = sal_False;
187*cdf0e10cSrcweir 	}
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir /*--------------------------------------------------------------------
191*cdf0e10cSrcweir 	Description:
192*cdf0e10cSrcweir     called by the SwEditWin when it gets the focus
193*cdf0e10cSrcweir  --------------------------------------------------------------------*/
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir void SwView::GotFocus() const
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir     // if we got the focus, and the form shell *is* on the top of the dispatcher
198*cdf0e10cSrcweir     // stack, then we need to rebuild the stack (the form shell doesn't belong to
199*cdf0e10cSrcweir     // the top then)
200*cdf0e10cSrcweir     const SfxDispatcher& rDispatcher = const_cast< SwView* >( this )->GetDispatcher();
201*cdf0e10cSrcweir     SfxShell* pTopShell = rDispatcher.GetShell( 0 );
202*cdf0e10cSrcweir     FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell );
203*cdf0e10cSrcweir     if ( pAsFormShell )
204*cdf0e10cSrcweir     {
205*cdf0e10cSrcweir         pAsFormShell->ForgetActiveControl();
206*cdf0e10cSrcweir         const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
207*cdf0e10cSrcweir     }
208*cdf0e10cSrcweir 	else if ( mpPostItMgr )
209*cdf0e10cSrcweir 	{
210*cdf0e10cSrcweir 		SwAnnotationShell* pAsAnnotationShell = PTR_CAST( SwAnnotationShell, pTopShell );
211*cdf0e10cSrcweir 		if ( pAsAnnotationShell )
212*cdf0e10cSrcweir 		{
213*cdf0e10cSrcweir             mpPostItMgr->SetActiveSidebarWin(0);
214*cdf0e10cSrcweir 			const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
215*cdf0e10cSrcweir 		}
216*cdf0e10cSrcweir 	}
217*cdf0e10cSrcweir     if( GetWrtShellPtr() )
218*cdf0e10cSrcweir     {
219*cdf0e10cSrcweir         SwWrtShell& rWrtShell = GetWrtShell();
220*cdf0e10cSrcweir         rWrtShell.GetDoc()->SetCurrentViewShell( GetWrtShellPtr() );
221*cdf0e10cSrcweir         rWrtShell.GetDoc()->set( IDocumentSettingAccess::BROWSE_MODE,
222*cdf0e10cSrcweir                                  rWrtShell.GetViewOptions()->getBrowseMode() );
223*cdf0e10cSrcweir     }
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir /*--------------------------------------------------------------------
227*cdf0e10cSrcweir 	Description:
228*cdf0e10cSrcweir     called by the FormShell when a form control is focused. This is
229*cdf0e10cSrcweir     a request to put the form shell on the top of the dispatcher
230*cdf0e10cSrcweir     stack
231*cdf0e10cSrcweir  --------------------------------------------------------------------*/
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir IMPL_LINK( SwView, FormControlActivated, FmFormShell*, EMPTYARG )
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir     // if a form control has been activated, and the form shell is not on the top
236*cdf0e10cSrcweir     // of the dispatcher stack, then we need to activate it
237*cdf0e10cSrcweir     const SfxDispatcher& rDispatcher = GetDispatcher();
238*cdf0e10cSrcweir     const SfxShell* pTopShell = rDispatcher.GetShell( 0 );
239*cdf0e10cSrcweir     const FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell );
240*cdf0e10cSrcweir     if ( !pAsFormShell )
241*cdf0e10cSrcweir     {
242*cdf0e10cSrcweir         // if we're editing text currently, cancel this
243*cdf0e10cSrcweir         SdrView *pSdrView = pWrtShell ? pWrtShell->GetDrawView() : NULL;
244*cdf0e10cSrcweir         if ( pSdrView && pSdrView->IsTextEdit() )
245*cdf0e10cSrcweir             pSdrView->SdrEndTextEdit( sal_True );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir         const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
248*cdf0e10cSrcweir     }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     return 0L;
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir void SwView::SelectShell()
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
256*cdf0e10cSrcweir //
257*cdf0e10cSrcweir //		Achtung: SelectShell fuer die WebView mitpflegen
258*cdf0e10cSrcweir //
259*cdf0e10cSrcweir //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 		  if(bInDtor)
262*cdf0e10cSrcweir         return;
263*cdf0e10cSrcweir 	// Entscheidung, ob UpdateTable gerufen werden muss
264*cdf0e10cSrcweir 	sal_Bool bUpdateTable = sal_False;
265*cdf0e10cSrcweir 	const SwFrmFmt* pCurTableFmt = pWrtShell->GetTableFmt();
266*cdf0e10cSrcweir 	if(pCurTableFmt && pCurTableFmt != pLastTableFormat)
267*cdf0e10cSrcweir 	{
268*cdf0e10cSrcweir 		bUpdateTable = sal_True; // kann erst spaeter ausgefuehrt werden
269*cdf0e10cSrcweir 	}
270*cdf0e10cSrcweir 	pLastTableFormat = pCurTableFmt;
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 	//SEL_TBL und SEL_TBL_CELLS koennen verodert sein!
273*cdf0e10cSrcweir 	int nNewSelectionType = (pWrtShell->GetSelectionType()
274*cdf0e10cSrcweir 								& ~nsSelectionType::SEL_TBL_CELLS);
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     if ( pFormShell && pFormShell->IsActiveControl() )
277*cdf0e10cSrcweir         nNewSelectionType |= nsSelectionType::SEL_FOC_FRM_CTRL;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	if ( nNewSelectionType == nSelectionType )
280*cdf0e10cSrcweir 	{
281*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().InvalidateAll( sal_False );
282*cdf0e10cSrcweir 		if ( nSelectionType & nsSelectionType::SEL_OLE ||
283*cdf0e10cSrcweir 			 nSelectionType & nsSelectionType::SEL_GRF )
284*cdf0e10cSrcweir 			//Fuer Grafiken und OLE kann sich natuerlich das Verb aendern!
285*cdf0e10cSrcweir 			ImpSetVerb( nNewSelectionType );
286*cdf0e10cSrcweir 	}
287*cdf0e10cSrcweir 	else
288*cdf0e10cSrcweir 	{
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		SfxDispatcher &rDispatcher = GetDispatcher();
291*cdf0e10cSrcweir 		SwToolbarConfigItem *pBarCfg = SW_MOD()->GetToolbarConfig();
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 	//	DELETEZ(pxSelectionObj); //Selektionsobjekt loeschen
294*cdf0e10cSrcweir 		if ( pShell )
295*cdf0e10cSrcweir 		{
296*cdf0e10cSrcweir 			rDispatcher.Flush();		// alle gecachten Shells wirklich loeschen
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 			//Zur alten Selektion merken welche Toolbar sichtbar war
299*cdf0e10cSrcweir             sal_uInt16 nId = static_cast< sal_uInt16 >( rDispatcher.GetObjectBarId( SFX_OBJECTBAR_OBJECT ));
300*cdf0e10cSrcweir 			if ( nId )
301*cdf0e10cSrcweir 				pBarCfg->SetTopToolbar( nSelectionType, nId );
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 			SfxShell *pSfxShell;
304*cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; sal_True; ++i )
305*cdf0e10cSrcweir 			{
306*cdf0e10cSrcweir 				pSfxShell = rDispatcher.GetShell( i );
307*cdf0e10cSrcweir 				if  (  pSfxShell->ISA( SwBaseShell )
308*cdf0e10cSrcweir                     || pSfxShell->ISA( SwDrawTextShell )
309*cdf0e10cSrcweir                     || pSfxShell->ISA( svx::ExtrusionBar )
310*cdf0e10cSrcweir                     || pSfxShell->ISA( svx::FontworkBar )
311*cdf0e10cSrcweir                     || pSfxShell->ISA( SwAnnotationShell )
312*cdf0e10cSrcweir                     )
313*cdf0e10cSrcweir                 {
314*cdf0e10cSrcweir                     rDispatcher.Pop( *pSfxShell, SFX_SHELL_POP_DELETE );
315*cdf0e10cSrcweir                 }
316*cdf0e10cSrcweir                 else if ( pSfxShell->ISA( FmFormShell ) )
317*cdf0e10cSrcweir                 {
318*cdf0e10cSrcweir                     rDispatcher.Pop( *pSfxShell );
319*cdf0e10cSrcweir                 }
320*cdf0e10cSrcweir                 else
321*cdf0e10cSrcweir 					break;
322*cdf0e10cSrcweir 			}
323*cdf0e10cSrcweir 		}
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 		sal_Bool bInitFormShell = sal_False;
326*cdf0e10cSrcweir 		if (!pFormShell)
327*cdf0e10cSrcweir 		{
328*cdf0e10cSrcweir 			bInitFormShell = sal_True;
329*cdf0e10cSrcweir 			pFormShell = new FmFormShell( this );
330*cdf0e10cSrcweir             pFormShell->SetControlActivationHandler( LINK( this, SwView, FormControlActivated ) );
331*cdf0e10cSrcweir 			StartListening(*pFormShell);
332*cdf0e10cSrcweir 		}
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 		sal_Bool bSetExtInpCntxt = sal_False;
335*cdf0e10cSrcweir 		nSelectionType = nNewSelectionType;
336*cdf0e10cSrcweir 		ShellModes eShellMode;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir         if ( !( nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL ) )
339*cdf0e10cSrcweir             rDispatcher.Push( *pFormShell );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 		if ( nSelectionType & nsSelectionType::SEL_OLE )
342*cdf0e10cSrcweir 		{
343*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_OBJECT;
344*cdf0e10cSrcweir 			pShell = new SwOleShell( *this );
345*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
346*cdf0e10cSrcweir 		}
347*cdf0e10cSrcweir 		else if ( nSelectionType & nsSelectionType::SEL_FRM
348*cdf0e10cSrcweir 			|| nSelectionType & nsSelectionType::SEL_GRF)
349*cdf0e10cSrcweir 		{
350*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_FRAME;
351*cdf0e10cSrcweir 			pShell = new SwFrameShell( *this );
352*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
353*cdf0e10cSrcweir 			if(nSelectionType & nsSelectionType::SEL_GRF )
354*cdf0e10cSrcweir 			{
355*cdf0e10cSrcweir 				eShellMode = SHELL_MODE_GRAPHIC;
356*cdf0e10cSrcweir 				pShell = new SwGrfShell( *this );
357*cdf0e10cSrcweir 				rDispatcher.Push( *pShell );
358*cdf0e10cSrcweir 			}
359*cdf0e10cSrcweir 		}
360*cdf0e10cSrcweir 		else if ( nSelectionType & nsSelectionType::SEL_DRW )
361*cdf0e10cSrcweir 		{
362*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_DRAW;
363*cdf0e10cSrcweir 			pShell = new SwDrawShell( *this );
364*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 			if ( nSelectionType & nsSelectionType::SEL_BEZ )
367*cdf0e10cSrcweir 			{
368*cdf0e10cSrcweir 				eShellMode = SHELL_MODE_BEZIER;
369*cdf0e10cSrcweir 				pShell = new SwBezierShell( *this );
370*cdf0e10cSrcweir 				rDispatcher.Push( *pShell );
371*cdf0e10cSrcweir 			}
372*cdf0e10cSrcweir 			else if( nSelectionType & nsSelectionType::SEL_MEDIA )
373*cdf0e10cSrcweir 			{
374*cdf0e10cSrcweir 				eShellMode = SHELL_MODE_MEDIA;
375*cdf0e10cSrcweir 				pShell = new SwMediaShell( *this );
376*cdf0e10cSrcweir 				rDispatcher.Push( *pShell );
377*cdf0e10cSrcweir 			}
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir             if (nSelectionType & nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE)
380*cdf0e10cSrcweir             {
381*cdf0e10cSrcweir                 eShellMode = SHELL_MODE_EXTRUDED_CUSTOMSHAPE;
382*cdf0e10cSrcweir                 pShell = new svx::ExtrusionBar(this);
383*cdf0e10cSrcweir                 rDispatcher.Push( *pShell );
384*cdf0e10cSrcweir             }
385*cdf0e10cSrcweir             if (nSelectionType & nsSelectionType::SEL_FONTWORK)
386*cdf0e10cSrcweir             {
387*cdf0e10cSrcweir                 eShellMode = SHELL_MODE_FONTWORK;
388*cdf0e10cSrcweir                 pShell = new svx::FontworkBar(this);
389*cdf0e10cSrcweir                 rDispatcher.Push( *pShell );
390*cdf0e10cSrcweir             }
391*cdf0e10cSrcweir 		}
392*cdf0e10cSrcweir 		else if ( nSelectionType & nsSelectionType::SEL_DRW_FORM )
393*cdf0e10cSrcweir 		{
394*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_DRAW_FORM;
395*cdf0e10cSrcweir 			pShell = new SwDrawFormShell( *this );
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
398*cdf0e10cSrcweir 		}
399*cdf0e10cSrcweir 		else if ( nSelectionType & nsSelectionType::SEL_DRW_TXT )
400*cdf0e10cSrcweir 		{
401*cdf0e10cSrcweir             bSetExtInpCntxt = sal_True;
402*cdf0e10cSrcweir             eShellMode = SHELL_MODE_DRAWTEXT;
403*cdf0e10cSrcweir 			rDispatcher.Push( *(new SwBaseShell( *this )) );
404*cdf0e10cSrcweir 			pShell = new SwDrawTextShell( *this );
405*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
406*cdf0e10cSrcweir 		}
407*cdf0e10cSrcweir 		else if ( nSelectionType & nsSelectionType::SEL_POSTIT )
408*cdf0e10cSrcweir 		{
409*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_POSTIT;
410*cdf0e10cSrcweir 			pShell = new SwAnnotationShell( *this );
411*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
412*cdf0e10cSrcweir 		}
413*cdf0e10cSrcweir 		else
414*cdf0e10cSrcweir 		{
415*cdf0e10cSrcweir 			bSetExtInpCntxt = sal_True;
416*cdf0e10cSrcweir 			eShellMode = SHELL_MODE_TEXT;
417*cdf0e10cSrcweir 			sal_uInt32 nHelpId = 0;
418*cdf0e10cSrcweir 			if ( nSelectionType & nsSelectionType::SEL_NUM )
419*cdf0e10cSrcweir 			{
420*cdf0e10cSrcweir 				eShellMode = SHELL_MODE_LIST_TEXT;
421*cdf0e10cSrcweir 				pShell = new SwListShell( *this );
422*cdf0e10cSrcweir 				nHelpId = pShell->GetHelpId();
423*cdf0e10cSrcweir 				rDispatcher.Push( *pShell );
424*cdf0e10cSrcweir 			}
425*cdf0e10cSrcweir 			pShell = new SwTextShell(*this);
426*cdf0e10cSrcweir 			if(nHelpId)
427*cdf0e10cSrcweir 				pShell->SetHelpId(nHelpId);
428*cdf0e10cSrcweir 			rDispatcher.Push( *pShell );
429*cdf0e10cSrcweir 			if ( nSelectionType & nsSelectionType::SEL_TBL )
430*cdf0e10cSrcweir 			{
431*cdf0e10cSrcweir 				eShellMode = eShellMode == SHELL_MODE_LIST_TEXT ? SHELL_MODE_TABLE_LIST_TEXT
432*cdf0e10cSrcweir 														: SHELL_MODE_TABLE_TEXT;
433*cdf0e10cSrcweir 				pShell = new SwTableShell( *this );
434*cdf0e10cSrcweir 				rDispatcher.Push( *pShell );
435*cdf0e10cSrcweir 			}
436*cdf0e10cSrcweir 		}
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir         if ( nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL )
439*cdf0e10cSrcweir             rDispatcher.Push( *pFormShell );
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 		pViewImpl->SetShellMode(eShellMode);
442*cdf0e10cSrcweir 		ImpSetVerb( nSelectionType );
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 		if( !GetDocShell()->IsReadOnly() )
445*cdf0e10cSrcweir 		{
446*cdf0e10cSrcweir 			if( bSetExtInpCntxt && GetWrtShell().HasReadonlySel() )
447*cdf0e10cSrcweir 				bSetExtInpCntxt = sal_False;
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 			InputContext aCntxt( GetEditWin().GetInputContext() );
450*cdf0e10cSrcweir 			aCntxt.SetOptions( bSetExtInpCntxt
451*cdf0e10cSrcweir 								? (aCntxt.GetOptions() |
452*cdf0e10cSrcweir 										( INPUTCONTEXT_TEXT |
453*cdf0e10cSrcweir 											INPUTCONTEXT_EXTTEXTINPUT ))
454*cdf0e10cSrcweir 								: (aCntxt.GetOptions() & ~
455*cdf0e10cSrcweir 										( INPUTCONTEXT_TEXT |
456*cdf0e10cSrcweir 											INPUTCONTEXT_EXTTEXTINPUT )) );
457*cdf0e10cSrcweir 			GetEditWin().SetInputContext( aCntxt );
458*cdf0e10cSrcweir 		}
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 		//Zur neuen Selektion die Toolbar aktivieren, die auch beim letzten Mal
461*cdf0e10cSrcweir 		//aktiviert war
462*cdf0e10cSrcweir 		//Vorher muss ein Flush() sein, betrifft aber lt. MBA nicht das UI und ist
463*cdf0e10cSrcweir 		//kein Performance-Problem
464*cdf0e10cSrcweir         // TODO/LATER: maybe now the Flush() command is superfluous?!
465*cdf0e10cSrcweir 		rDispatcher.Flush();
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 		Point aPnt = GetEditWin().OutputToScreenPixel(GetEditWin().GetPointerPosPixel());
468*cdf0e10cSrcweir 		aPnt = GetEditWin().PixelToLogic(aPnt);
469*cdf0e10cSrcweir 		GetEditWin().UpdatePointer(aPnt);
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 		SdrView* pDView = GetWrtShell().GetDrawView();
472*cdf0e10cSrcweir 		if ( bInitFormShell && pDView )
473*cdf0e10cSrcweir 			pFormShell->SetView(PTR_CAST(FmFormView, pDView));
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 	}
476*cdf0e10cSrcweir 	//Guenstiger Zeitpunkt fuer die Kommunikation mit OLE-Objekten?
477*cdf0e10cSrcweir 	if ( GetDocShell()->GetDoc()->IsOLEPrtNotifyPending() )
478*cdf0e10cSrcweir 		GetDocShell()->GetDoc()->PrtOLENotify( sal_False );
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 	//jetzt das Tabellen-Update
481*cdf0e10cSrcweir 	if(bUpdateTable)
482*cdf0e10cSrcweir 		pWrtShell->UpdateTable();
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 	GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
485*cdf0e10cSrcweir }
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir //Zusammenspiel: AttrChangedNotify() und TimeoutHdl.
488*cdf0e10cSrcweir //Falls noch Actions offen sind keine Aktualisierung, da der
489*cdf0e10cSrcweir //Cursor auf der Core-Seite im Wald stehen kann.
490*cdf0e10cSrcweir //Da wir aber keine Stati mehr liefern koennen und wollen locken wir
491*cdf0e10cSrcweir //stattdessen den Dispatcher.
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir extern "C"
496*cdf0e10cSrcweir {
497*cdf0e10cSrcweir 	int lcl_CmpIds( const void *pFirst, const void *pSecond)
498*cdf0e10cSrcweir 	{
499*cdf0e10cSrcweir 		return (*(sal_uInt16*)pFirst) - (*(sal_uInt16*)pSecond);
500*cdf0e10cSrcweir 	}
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir IMPL_LINK( SwView, AttrChangedNotify, SwWrtShell *, EMPTYARG )
506*cdf0e10cSrcweir {
507*cdf0e10cSrcweir  	if ( GetEditWin().IsChainMode() )
508*cdf0e10cSrcweir 		GetEditWin().SetChainMode( sal_False );
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir     //Opt: Nicht wenn PaintLocked. Beim Unlock wird dafuer nocheinmal ein
511*cdf0e10cSrcweir 	//Notify ausgeloest.
512*cdf0e10cSrcweir 	if( !pWrtShell->IsPaintLocked() && !bNoInterrupt &&
513*cdf0e10cSrcweir 		GetDocShell()->IsReadOnly() )
514*cdf0e10cSrcweir 		_CheckReadonlyState();
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir 	// JP 19.01.99: Cursor in Readonly Bereichen
517*cdf0e10cSrcweir 	if( !pWrtShell->IsPaintLocked() && !bNoInterrupt )
518*cdf0e10cSrcweir 		_CheckReadonlySelection();
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 	if( !bAttrChgNotified )
521*cdf0e10cSrcweir 	{
522*cdf0e10cSrcweir 		if ( pWrtShell->BasicActionPend() || bNoInterrupt ||
523*cdf0e10cSrcweir 			 GetDispatcher().IsLocked() ||				 //do not confuse the SFX
524*cdf0e10cSrcweir 			 GetViewFrame()->GetBindings().IsInUpdate() )//do not confuse the SFX
525*cdf0e10cSrcweir 		{
526*cdf0e10cSrcweir 			bAttrChgNotified = sal_True;
527*cdf0e10cSrcweir 			aTimer.Start();
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir 			const SfxPoolItem *pItem;
530*cdf0e10cSrcweir 			if ( SFX_ITEM_SET != GetObjectShell()->GetMedium()->GetItemSet()->
531*cdf0e10cSrcweir 									GetItemState( SID_HIDDEN, sal_False, &pItem ) ||
532*cdf0e10cSrcweir 				 !((SfxBoolItem*)pItem)->GetValue() )
533*cdf0e10cSrcweir 			{
534*cdf0e10cSrcweir 				GetViewFrame()->GetBindings().ENTERREGISTRATIONS();
535*cdf0e10cSrcweir 				bAttrChgNotifiedWithRegistrations = sal_True;
536*cdf0e10cSrcweir 			}
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir 		}
539*cdf0e10cSrcweir 		else
540*cdf0e10cSrcweir 			SelectShell();
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir 	}
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir 	//#i6193#, change ui if cursor is at a SwPostItField
545*cdf0e10cSrcweir 	if (mpPostItMgr)
546*cdf0e10cSrcweir 	{
547*cdf0e10cSrcweir         // --> OD 2008-06-19 #i90516#
548*cdf0e10cSrcweir         // only perform the code that is needed to determine, if at the
549*cdf0e10cSrcweir         // actual cursor position is a post-it field
550*cdf0e10cSrcweir //        SwRect aFldRect;
551*cdf0e10cSrcweir //        SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD);
552*cdf0e10cSrcweir //        if( pWrtShell->GetContentAtPos( pWrtShell->GetCrsrDocPos(), aCntntAtPos, sal_False, &aFldRect ) )
553*cdf0e10cSrcweir //        {
554*cdf0e10cSrcweir //            const SwField* pFld = aCntntAtPos.aFnd.pFld;
555*cdf0e10cSrcweir //            if (pFld->Which()== RES_POSTITFLD)
556*cdf0e10cSrcweir //            {
557*cdf0e10cSrcweir //                mpPostItMgr->SetShadowState(reinterpret_cast<const SwPostItField*>(pFld));
558*cdf0e10cSrcweir //            }
559*cdf0e10cSrcweir //            else
560*cdf0e10cSrcweir //                mpPostItMgr->SetShadowState(0);
561*cdf0e10cSrcweir //        }
562*cdf0e10cSrcweir //        else
563*cdf0e10cSrcweir //            mpPostItMgr->SetShadowState(0);
564*cdf0e10cSrcweir         mpPostItMgr->SetShadowState( pWrtShell->GetPostItFieldAtCursor() );
565*cdf0e10cSrcweir 	}
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 	return 0;
568*cdf0e10cSrcweir }
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir IMPL_LINK( SwView, TimeoutHdl, Timer *, EMPTYARG )
573*cdf0e10cSrcweir {
574*cdf0e10cSrcweir 	DBG_PROFSTART(viewhdl);
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir 	if( pWrtShell->BasicActionPend() || bNoInterrupt )
577*cdf0e10cSrcweir 	{
578*cdf0e10cSrcweir 		aTimer.Start();
579*cdf0e10cSrcweir 		DBG_PROFSTOP(viewhdl);
580*cdf0e10cSrcweir 		return 0;
581*cdf0e10cSrcweir 	}
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir 	if ( bAttrChgNotifiedWithRegistrations )
584*cdf0e10cSrcweir 	{
585*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
586*cdf0e10cSrcweir 		bAttrChgNotifiedWithRegistrations = sal_False;
587*cdf0e10cSrcweir 	}
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir 	_CheckReadonlyState();
590*cdf0e10cSrcweir 	_CheckReadonlySelection();
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir     sal_Bool bOldUndo = pWrtShell->DoesUndo();
593*cdf0e10cSrcweir     pWrtShell->DoUndo( sal_False );
594*cdf0e10cSrcweir 	SelectShell();
595*cdf0e10cSrcweir     pWrtShell->DoUndo( bOldUndo );
596*cdf0e10cSrcweir 	bAttrChgNotified = sal_False;
597*cdf0e10cSrcweir     GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 	DBG_PROFSTOP(viewhdl);
600*cdf0e10cSrcweir 	return 0;
601*cdf0e10cSrcweir }
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir void SwView::_CheckReadonlyState()
604*cdf0e10cSrcweir {
605*cdf0e10cSrcweir 	SfxDispatcher &rDis = GetDispatcher();
606*cdf0e10cSrcweir 	//Um erkennen zu koennen ob bereits disabled ist!
607*cdf0e10cSrcweir 	SfxItemState eStateRO, eStateProtAll;
608*cdf0e10cSrcweir 	const SfxPoolItem *pItem;
609*cdf0e10cSrcweir 	// JP 29.04.97: von einem nur uns bekannten Slot den Status abfragen.
610*cdf0e10cSrcweir 	//				Ansonsten kennen andere den Slot; wie z.B. die BasidIde
611*cdf0e10cSrcweir 	eStateRO = rDis.QueryState( FN_INSERT_BOOKMARK, pItem );
612*cdf0e10cSrcweir 	eStateProtAll = rDis.QueryState( FN_EDIT_REGION, pItem );
613*cdf0e10cSrcweir 	sal_Bool bChgd = sal_False;
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 	if ( !pWrtShell->IsCrsrReadonly() )
616*cdf0e10cSrcweir 	{
617*cdf0e10cSrcweir 		static sal_uInt16 aROIds[] =
618*cdf0e10cSrcweir 		{
619*cdf0e10cSrcweir 			SID_DELETE, 				FN_BACKSPACE,				FN_SHIFT_BACKSPACE,
620*cdf0e10cSrcweir 			SID_UNDO,
621*cdf0e10cSrcweir 			SID_REDO,					SID_REPEAT,					SID_PASTE,
622*cdf0e10cSrcweir             SID_PASTE_UNFORMATTED,
623*cdf0e10cSrcweir             SID_PASTE_SPECIAL,            SID_SBA_BRW_INSERT,
624*cdf0e10cSrcweir 			SID_BACKGROUND_COLOR,       FN_INSERT_BOOKMARK,
625*cdf0e10cSrcweir 			SID_CHARMAP,				FN_INSERT_SOFT_HYPHEN,
626*cdf0e10cSrcweir 			FN_INSERT_HARDHYPHEN,		FN_INSERT_HARD_SPACE,		FN_INSERT_BREAK,
627*cdf0e10cSrcweir 			FN_INSERT_LINEBREAK,		FN_INSERT_COLUMN_BREAK,		FN_INSERT_BREAK_DLG,
628*cdf0e10cSrcweir 			FN_DELETE_SENT,				FN_DELETE_BACK_SENT,		FN_DELETE_WORD,
629*cdf0e10cSrcweir 			FN_DELETE_BACK_WORD,		FN_DELETE_LINE,				FN_DELETE_BACK_LINE,
630*cdf0e10cSrcweir 			FN_DELETE_PARA,				FN_DELETE_BACK_PARA,		FN_DELETE_WHOLE_LINE,
631*cdf0e10cSrcweir 			FN_CALCULATE,				FN_FORMAT_RESET,
632*cdf0e10cSrcweir 			FN_POSTIT,			   		FN_JAVAEDIT,				SID_ATTR_PARA_ADJUST_LEFT,
633*cdf0e10cSrcweir 			SID_ATTR_PARA_ADJUST_RIGHT,	SID_ATTR_PARA_ADJUST_CENTER,SID_ATTR_PARA_ADJUST_BLOCK,
634*cdf0e10cSrcweir 			SID_ATTR_PARA_LINESPACE_10,	SID_ATTR_PARA_LINESPACE_15,	SID_ATTR_PARA_LINESPACE_20,
635*cdf0e10cSrcweir 			SID_ATTR_CHAR_FONT,			SID_ATTR_CHAR_FONTHEIGHT,	SID_ATTR_CHAR_COLOR_BACKGROUND,
636*cdf0e10cSrcweir 			SID_ATTR_CHAR_COLOR_BACKGROUND_EXT,						SID_ATTR_CHAR_COLOR_EXT,
637*cdf0e10cSrcweir 			SID_ATTR_CHAR_COLOR,		SID_ATTR_CHAR_WEIGHT,		SID_ATTR_CHAR_POSTURE,
638*cdf0e10cSrcweir 			SID_ATTR_CHAR_OVERLINE,
639*cdf0e10cSrcweir 			SID_ATTR_CHAR_UNDERLINE,	SID_ATTR_FLASH,				SID_ATTR_CHAR_STRIKEOUT,
640*cdf0e10cSrcweir 			FN_UNDERLINE_DOUBLE,		SID_ATTR_CHAR_CONTOUR,		SID_ATTR_CHAR_SHADOWED,
641*cdf0e10cSrcweir 			SID_ATTR_CHAR_AUTOKERN,		SID_ATTR_CHAR_ESCAPEMENT,	FN_SET_SUPER_SCRIPT,
642*cdf0e10cSrcweir 			FN_SET_SUB_SCRIPT,			SID_ATTR_CHAR_CASEMAP,		SID_ATTR_CHAR_LANGUAGE,
643*cdf0e10cSrcweir 			SID_ATTR_CHAR_KERNING,		SID_CHAR_DLG,				SID_ATTR_CHAR_WORDLINEMODE,
644*cdf0e10cSrcweir 			FN_GROW_FONT_SIZE,			FN_SHRINK_FONT_SIZE,		FN_TXTATR_INET,
645*cdf0e10cSrcweir 			FN_FORMAT_DROPCAPS,			SID_ATTR_PARA_ADJUST,		SID_ATTR_PARA_LINESPACE,
646*cdf0e10cSrcweir 			SID_ATTR_PARA_SPLIT,		SID_ATTR_PARA_KEEP,			SID_ATTR_PARA_WIDOWS,
647*cdf0e10cSrcweir 			SID_ATTR_PARA_ORPHANS,
648*cdf0e10cSrcweir 			SID_ATTR_PARA_MODEL,		SID_PARA_DLG,
649*cdf0e10cSrcweir 			FN_SELECT_PARA,				SID_DEC_INDENT,
650*cdf0e10cSrcweir 			SID_INC_INDENT
651*cdf0e10cSrcweir 		};
652*cdf0e10cSrcweir 		static sal_Bool bFirst = sal_True;
653*cdf0e10cSrcweir 		if ( bFirst )
654*cdf0e10cSrcweir 		{
655*cdf0e10cSrcweir 			qsort( (void*)aROIds, sizeof(aROIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds );
656*cdf0e10cSrcweir 			bFirst = sal_False;
657*cdf0e10cSrcweir 		}
658*cdf0e10cSrcweir 		if ( SFX_ITEM_DISABLED == eStateRO )
659*cdf0e10cSrcweir 		{
660*cdf0e10cSrcweir 			rDis.SetSlotFilter( sal_Bool(2), sizeof(aROIds)/sizeof(sal_uInt16), aROIds );
661*cdf0e10cSrcweir 			bChgd = sal_True;
662*cdf0e10cSrcweir 		}
663*cdf0e10cSrcweir 	}
664*cdf0e10cSrcweir 	else if( pWrtShell->IsAllProtect() )
665*cdf0e10cSrcweir 	{
666*cdf0e10cSrcweir 		if ( SFX_ITEM_DISABLED == eStateProtAll )
667*cdf0e10cSrcweir 		{
668*cdf0e10cSrcweir 			static sal_uInt16 aAllProtIds[] = { SID_SAVEDOC, FN_EDIT_REGION };
669*cdf0e10cSrcweir 			static sal_Bool bAllProtFirst = sal_True;
670*cdf0e10cSrcweir 			if ( bAllProtFirst )
671*cdf0e10cSrcweir 			{
672*cdf0e10cSrcweir 				qsort( (void*)aAllProtIds, sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds );
673*cdf0e10cSrcweir 				bAllProtFirst = sal_False;
674*cdf0e10cSrcweir 			}
675*cdf0e10cSrcweir 			rDis.SetSlotFilter( sal_Bool(2),
676*cdf0e10cSrcweir 								sizeof(aAllProtIds)/sizeof(sal_uInt16),
677*cdf0e10cSrcweir 								aAllProtIds );
678*cdf0e10cSrcweir 			bChgd = sal_True;
679*cdf0e10cSrcweir 		}
680*cdf0e10cSrcweir 	}
681*cdf0e10cSrcweir 	else if ( SFX_ITEM_DISABLED != eStateRO ||
682*cdf0e10cSrcweir 				SFX_ITEM_DISABLED != eStateProtAll )
683*cdf0e10cSrcweir 	{
684*cdf0e10cSrcweir 		bChgd = sal_True;
685*cdf0e10cSrcweir 		rDis.SetSlotFilter();
686*cdf0e10cSrcweir 	}
687*cdf0e10cSrcweir 	if ( bChgd )
688*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().InvalidateAll(sal_True);
689*cdf0e10cSrcweir }
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir void SwView::_CheckReadonlySelection()
692*cdf0e10cSrcweir {
693*cdf0e10cSrcweir 	sal_uInt32 nDisableFlags = 0;
694*cdf0e10cSrcweir 	SfxDispatcher &rDis = GetDispatcher();
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 	if( pWrtShell->HasReadonlySel() &&
697*cdf0e10cSrcweir 		( !pWrtShell->GetDrawView() ||
698*cdf0e10cSrcweir 			!pWrtShell->GetDrawView()->GetMarkedObjectList().GetMarkCount() ))
699*cdf0e10cSrcweir 		nDisableFlags |= SW_DISABLE_ON_PROTECTED_CURSOR;
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir 	if( (SW_DISABLE_ON_PROTECTED_CURSOR & nDisableFlags ) !=
702*cdf0e10cSrcweir 		(SW_DISABLE_ON_PROTECTED_CURSOR & rDis.GetDisableFlags() ) )
703*cdf0e10cSrcweir 	{
704*cdf0e10cSrcweir 		// zusaetzlich am Window den InputContext umsetzen, damit in
705*cdf0e10cSrcweir 		// japanischen / chinesischen Versionen die externe Eingabe
706*cdf0e10cSrcweir 		// ab-/angeschaltet wird. Das aber nur wenn auch die richtige
707*cdf0e10cSrcweir 		// Shell auf dem Stack steht.
708*cdf0e10cSrcweir 		switch( pViewImpl->GetShellMode() )
709*cdf0e10cSrcweir 		{
710*cdf0e10cSrcweir 		case SHELL_MODE_TEXT:
711*cdf0e10cSrcweir 		case SHELL_MODE_LIST_TEXT:
712*cdf0e10cSrcweir 		case SHELL_MODE_TABLE_TEXT:
713*cdf0e10cSrcweir 		case SHELL_MODE_TABLE_LIST_TEXT:
714*cdf0e10cSrcweir 			{
715*cdf0e10cSrcweir //JP 22.01.99: temporaere Loesung!!! Sollte bei jeder Cursorbewegung
716*cdf0e10cSrcweir //			den Font von der akt. Einfuegeposition setzen, also ausserhalb
717*cdf0e10cSrcweir // 			dieses if's. Aber TH wertet den Font zur Zeit nicht aus und
718*cdf0e10cSrcweir //			das besorgen erscheint mir hier zu teuer zu sein.
719*cdf0e10cSrcweir //			Ausserdem haben wir keinen Font, sondern nur Attribute aus denen
720*cdf0e10cSrcweir //			die Textformatierung dann den richtigen Font zusammen baut.
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir 				InputContext aCntxt( GetEditWin().GetInputContext() );
723*cdf0e10cSrcweir 				aCntxt.SetOptions( SW_DISABLE_ON_PROTECTED_CURSOR & nDisableFlags
724*cdf0e10cSrcweir 									? (aCntxt.GetOptions() & ~
725*cdf0e10cSrcweir 											( INPUTCONTEXT_TEXT |
726*cdf0e10cSrcweir 												INPUTCONTEXT_EXTTEXTINPUT ))
727*cdf0e10cSrcweir 									: (aCntxt.GetOptions() |
728*cdf0e10cSrcweir 											( INPUTCONTEXT_TEXT |
729*cdf0e10cSrcweir 												INPUTCONTEXT_EXTTEXTINPUT )) );
730*cdf0e10cSrcweir 				GetEditWin().SetInputContext( aCntxt );
731*cdf0e10cSrcweir 			}
732*cdf0e10cSrcweir 			break;
733*cdf0e10cSrcweir 		default:
734*cdf0e10cSrcweir 			;
735*cdf0e10cSrcweir 		}
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 	}
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 	if( nDisableFlags != rDis.GetDisableFlags() )
740*cdf0e10cSrcweir 	{
741*cdf0e10cSrcweir 		rDis.SetDisableFlags( nDisableFlags );
742*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().InvalidateAll( sal_True );
743*cdf0e10cSrcweir 	}
744*cdf0e10cSrcweir }
745*cdf0e10cSrcweir 
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
748*cdf0e10cSrcweir 	: SfxViewShell( _pFrame, SWVIEWFLAGS ),
749*cdf0e10cSrcweir 	aPageStr( SW_RES( STR_PAGE )),
750*cdf0e10cSrcweir     nNewPage(USHRT_MAX),
751*cdf0e10cSrcweir     pNumRuleNodeFromDoc(0), // #i23726#
752*cdf0e10cSrcweir 	pEditWin( new SwEditWin( &_pFrame->GetWindow(), *this ) ),
753*cdf0e10cSrcweir 	pWrtShell(0),
754*cdf0e10cSrcweir 	pShell(0),
755*cdf0e10cSrcweir 	pFormShell(0),
756*cdf0e10cSrcweir 	pHScrollbar(0),
757*cdf0e10cSrcweir 	pVScrollbar(0),
758*cdf0e10cSrcweir     pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
759*cdf0e10cSrcweir     pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
760*cdf0e10cSrcweir 					SVXRULER_SUPPORT_TABS |
761*cdf0e10cSrcweir 					SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
762*cdf0e10cSrcweir 					SVXRULER_SUPPORT_BORDERS |
763*cdf0e10cSrcweir                     SVXRULER_SUPPORT_NEGATIVE_MARGINS|
764*cdf0e10cSrcweir                     SVXRULER_SUPPORT_REDUCED_METRIC,
765*cdf0e10cSrcweir 					GetViewFrame()->GetBindings(),
766*cdf0e10cSrcweir                     WB_STDRULER | WB_EXTRAFIELD | WB_BORDER)),
767*cdf0e10cSrcweir     pVRuler(new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
768*cdf0e10cSrcweir                             SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL|
769*cdf0e10cSrcweir                                 SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC,
770*cdf0e10cSrcweir 							GetViewFrame()->GetBindings(),
771*cdf0e10cSrcweir                             WB_VSCROLL |  WB_EXTRAFIELD | WB_BORDER )),
772*cdf0e10cSrcweir     pTogglePageBtn(0),
773*cdf0e10cSrcweir 	pPageUpBtn(0),
774*cdf0e10cSrcweir 	pPageDownBtn(0),
775*cdf0e10cSrcweir 	pNaviBtn(0),
776*cdf0e10cSrcweir 	pGlosHdl(0),
777*cdf0e10cSrcweir 	pDrawActual(0),
778*cdf0e10cSrcweir 	pLastTableFormat(0),
779*cdf0e10cSrcweir     pFormatClipboard(new SwFormatClipboard()),
780*cdf0e10cSrcweir 	mpPostItMgr(0),
781*cdf0e10cSrcweir 	nSelectionType( INT_MAX ),
782*cdf0e10cSrcweir 	nPageCnt(0),
783*cdf0e10cSrcweir 	nDrawSfxId( USHRT_MAX ),
784*cdf0e10cSrcweir 	nFormSfxId( USHRT_MAX ),
785*cdf0e10cSrcweir     nLastPasteDestination( 0xFFFF ),
786*cdf0e10cSrcweir     nLeftBorderDistance( 0 ),
787*cdf0e10cSrcweir     nRightBorderDistance( 0 ),
788*cdf0e10cSrcweir     bInMailMerge(sal_False),
789*cdf0e10cSrcweir     bInDtor(sal_False),
790*cdf0e10cSrcweir     bOldShellWasPagePreView(sal_False),
791*cdf0e10cSrcweir     bIsPreviewDoubleClick(sal_False)
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir     // OD 18.12.2002 #103492# - According to discussion with MBA and further
794*cdf0e10cSrcweir     // investigations, no old SfxViewShell will be set as parameter <pOldSh>,
795*cdf0e10cSrcweir     // if function "New Window" is performed to open an additional view beside
796*cdf0e10cSrcweir     // an already existing one.
797*cdf0e10cSrcweir     // If the view is switch from one to another, the 'old' view is given by
798*cdf0e10cSrcweir     // parameter <pOldSh>.
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwView::SwView" );
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir     bCenterCrsr = bTopCrsr = bAllwaysShowSel = bTabColFromDoc = bTabRowFromDoc =
803*cdf0e10cSrcweir     bSetTabColFromDoc = bSetTabRowFromDoc = bAttrChgNotified = bAttrChgNotifiedWithRegistrations =
804*cdf0e10cSrcweir     bVerbsActive = bDrawRotate = bInOuterResizePixel = bInInnerResizePixel =
805*cdf0e10cSrcweir     bPasteState = bPasteSpecialState = bMakeSelectionVisible = sal_False;
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir 	bShowAtResize = bDrawSelMode = bDocSzUpdated = sal_True;
808*cdf0e10cSrcweir 
809*cdf0e10cSrcweir     _CreateScrollbar( sal_True );
810*cdf0e10cSrcweir     _CreateScrollbar( sal_False );
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir 	pViewImpl = new SwView_Impl(this);
813*cdf0e10cSrcweir 	SetName(C2S("View"));
814*cdf0e10cSrcweir 	SetWindow( pEditWin );
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 	aTimer.SetTimeout( 120 );
817*cdf0e10cSrcweir 
818*cdf0e10cSrcweir 	SwDocShell* pDocSh = PTR_CAST( SwDocShell, _pFrame->GetObjectShell() );
819*cdf0e10cSrcweir 	sal_Bool bOldModifyFlag = pDocSh->IsEnableSetModified();
820*cdf0e10cSrcweir     if(bOldModifyFlag)
821*cdf0e10cSrcweir         pDocSh->EnableSetModified( sal_False );
822*cdf0e10cSrcweir 	ASSERT( pDocSh, "View ohne DocShell." );
823*cdf0e10cSrcweir 	SwWebDocShell* pWebDShell = PTR_CAST( SwWebDocShell, pDocSh );
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir     const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(0 != pWebDShell);
826*cdf0e10cSrcweir     SwViewOption aUsrPref( *pUsrPref);
827*cdf0e10cSrcweir 
828*cdf0e10cSrcweir     //! get lingu options without loading lingu DLL
829*cdf0e10cSrcweir     SvtLinguOptions aLinguOpt;
830*cdf0e10cSrcweir     SvtLinguConfig().GetOptions( aLinguOpt );
831*cdf0e10cSrcweir     aUsrPref.SetOnlineSpell( aLinguOpt.bIsSpellAuto );
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir 	sal_Bool bOldShellWasSrcView = sal_False;
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir     // OD 18.12.2002 #103492# - determine, if there is an existing view for
836*cdf0e10cSrcweir     // document
837*cdf0e10cSrcweir     SfxViewShell* pExistingSh = 0;
838*cdf0e10cSrcweir     if ( pOldSh )
839*cdf0e10cSrcweir     {
840*cdf0e10cSrcweir         pExistingSh = pOldSh;
841*cdf0e10cSrcweir         // determine type of existing view
842*cdf0e10cSrcweir         if( pExistingSh->IsA( TYPE( SwPagePreView ) ) )
843*cdf0e10cSrcweir         {
844*cdf0e10cSrcweir             sSwViewData = ((SwPagePreView*)pExistingSh)->GetPrevSwViewData();
845*cdf0e10cSrcweir             sNewCrsrPos = ((SwPagePreView*)pExistingSh)->GetNewCrsrPos();
846*cdf0e10cSrcweir             nNewPage = ((SwPagePreView*)pExistingSh)->GetNewPage();
847*cdf0e10cSrcweir             bOldShellWasPagePreView = sal_True;
848*cdf0e10cSrcweir             bIsPreviewDoubleClick = sNewCrsrPos.Len() > 0 || nNewPage != USHRT_MAX;
849*cdf0e10cSrcweir         }
850*cdf0e10cSrcweir         else if( pExistingSh->IsA( TYPE( SwSrcView ) ) )
851*cdf0e10cSrcweir             bOldShellWasSrcView = sal_True;
852*cdf0e10cSrcweir     }
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create WrtShell" );
855*cdf0e10cSrcweir     if(PTR_CAST( SwView, pExistingSh))
856*cdf0e10cSrcweir 	{
857*cdf0e10cSrcweir         pWrtShell = new SwWrtShell( *((SwView*)pExistingSh)->pWrtShell,
858*cdf0e10cSrcweir 									pEditWin, *this);
859*cdf0e10cSrcweir 	}
860*cdf0e10cSrcweir 	else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->GetCurrentViewShell() ) )
861*cdf0e10cSrcweir 	{
862*cdf0e10cSrcweir 		pWrtShell = new SwWrtShell( *(SwWrtShell*)pDocSh->GetDoc()->GetCurrentViewShell(),
863*cdf0e10cSrcweir 									pEditWin, *this);
864*cdf0e10cSrcweir 	}
865*cdf0e10cSrcweir 	else
866*cdf0e10cSrcweir 	{
867*cdf0e10cSrcweir 		SwDoc& rDoc = *((SwDocShell*)pDocSh)->GetDoc();
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir         if( !bOldShellWasSrcView && pWebDShell && !bOldShellWasPagePreView )
870*cdf0e10cSrcweir 			aUsrPref.setBrowseMode( sal_True );
871*cdf0e10cSrcweir         else if( rDoc.IsLoaded() )
872*cdf0e10cSrcweir             aUsrPref.setBrowseMode( rDoc.get(IDocumentSettingAccess::BROWSE_MODE) );
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir 		//Fuer den BrowseMode wollen wir keinen Factor uebernehmen.
875*cdf0e10cSrcweir 		if( aUsrPref.getBrowseMode() && aUsrPref.GetZoomType() != SVX_ZOOM_PERCENT )
876*cdf0e10cSrcweir 		{
877*cdf0e10cSrcweir 			aUsrPref.SetZoomType( SVX_ZOOM_PERCENT );
878*cdf0e10cSrcweir 			aUsrPref.SetZoom( 100 );
879*cdf0e10cSrcweir 		}
880*cdf0e10cSrcweir         if(pDocSh->IsPreview())
881*cdf0e10cSrcweir         {
882*cdf0e10cSrcweir             aUsrPref.SetZoomType( SVX_ZOOM_WHOLEPAGE );
883*cdf0e10cSrcweir             aUsrPref.SetViewLayoutBookMode( false );
884*cdf0e10cSrcweir             aUsrPref.SetViewLayoutColumns( 1 );
885*cdf0e10cSrcweir         }
886*cdf0e10cSrcweir 		pWrtShell = new SwWrtShell( rDoc, pEditWin, *this, &aUsrPref );
887*cdf0e10cSrcweir         //#97610# creating an SwView from a SwPagePreView needs to
888*cdf0e10cSrcweir         // add the ViewShell to the ring of the other ViewShell(s)
889*cdf0e10cSrcweir         if(bOldShellWasPagePreView)
890*cdf0e10cSrcweir 		{
891*cdf0e10cSrcweir             ViewShell& rPreviewViewShell = *((SwPagePreView*)pExistingSh)->GetViewShell();
892*cdf0e10cSrcweir             pWrtShell->MoveTo(&rPreviewViewShell);
893*cdf0e10cSrcweir             //#95521# to update the field command et.al. if necessary
894*cdf0e10cSrcweir             const SwViewOption* pPreViewOpt = rPreviewViewShell.GetViewOptions();
895*cdf0e10cSrcweir             if( pPreViewOpt->IsFldName() != aUsrPref.IsFldName() ||
896*cdf0e10cSrcweir                     pPreViewOpt->IsShowHiddenField() != aUsrPref.IsShowHiddenField() ||
897*cdf0e10cSrcweir                     pPreViewOpt->IsShowHiddenPara() != aUsrPref.IsShowHiddenPara() ||
898*cdf0e10cSrcweir                     pPreViewOpt->IsShowHiddenChar() != aUsrPref.IsShowHiddenChar() )
899*cdf0e10cSrcweir                 rPreviewViewShell.ApplyViewOptions(aUsrPref);
900*cdf0e10cSrcweir             // OD 09.01.2003 #106334# - reset design mode at draw view for form
901*cdf0e10cSrcweir             // shell, if needed.
902*cdf0e10cSrcweir             if ( ((SwPagePreView*)pExistingSh)->ResetFormDesignMode() &&
903*cdf0e10cSrcweir                  pWrtShell->HasDrawView() )
904*cdf0e10cSrcweir             {
905*cdf0e10cSrcweir                 SdrView* pDrawView = pWrtShell->GetDrawView();
906*cdf0e10cSrcweir                 pDrawView->SetDesignMode( ((SwPagePreView*)pExistingSh)->FormDesignModeToReset() );
907*cdf0e10cSrcweir             }
908*cdf0e10cSrcweir         }
909*cdf0e10cSrcweir 	}
910*cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create WrtShell" );
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir     // --> OD 2005-02-11 #i38810# - assure that modified state of document
913*cdf0e10cSrcweir     // isn't reset, if document is already modified.
914*cdf0e10cSrcweir     const bool bIsDocModified = pWrtShell->GetDoc()->IsModified();
915*cdf0e10cSrcweir     // <--
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir     // JP 05.02.99: Bug 61495 - damit unter anderem das HLineal im
918*cdf0e10cSrcweir 	//				ReadonlyFall nicht angezeigt wird
919*cdf0e10cSrcweir 	aUsrPref.SetReadonly( pWrtShell->GetViewOptions()->IsReadonly() );
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir 	//Kein Margin fuer OLE!
922*cdf0e10cSrcweir 	Size aBrwsBorder;
923*cdf0e10cSrcweir 	if( SFX_CREATE_MODE_EMBEDDED != pDocSh->GetCreateMode() )
924*cdf0e10cSrcweir 		aBrwsBorder = GetMargin();
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 	pWrtShell->SetBrowseBorder( aBrwsBorder );
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir 	// Im CTOR duerfen keine Shell wechsel erfolgen, die muessen ueber
929*cdf0e10cSrcweir 	// den Timer "zwischen gespeichert" werden. Sonst raeumt der SFX
930*cdf0e10cSrcweir 	// sie wieder vom Stack!
931*cdf0e10cSrcweir 	sal_Bool bOld = bNoInterrupt;
932*cdf0e10cSrcweir 	bNoInterrupt = sal_True;
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir     pHRuler->SetActive( sal_True );
935*cdf0e10cSrcweir     pVRuler->SetActive( sal_True );
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 	SfxViewFrame* pViewFrame = GetViewFrame();
938*cdf0e10cSrcweir 	if( pViewFrame->GetFrame().GetParentFrame())
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir         aUsrPref.SetViewHRuler(sal_False);
941*cdf0e10cSrcweir         aUsrPref.SetViewVRuler(sal_False);
942*cdf0e10cSrcweir 	}
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir     StartListening( *pViewFrame, sal_True );
945*cdf0e10cSrcweir     StartListening( *pDocSh, sal_True );
946*cdf0e10cSrcweir 
947*cdf0e10cSrcweir 	// Vom HLineal den ZOOM-Faktor einstellen
948*cdf0e10cSrcweir     Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
949*cdf0e10cSrcweir     pHRuler->SetZoom( aZoomFract );
950*cdf0e10cSrcweir     pVRuler->SetZoom( aZoomFract );
951*cdf0e10cSrcweir     pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
952*cdf0e10cSrcweir     FieldUnit eMetric = pUsrPref->GetHScrollMetric();
953*cdf0e10cSrcweir     pHRuler->SetUnit( eMetric );
954*cdf0e10cSrcweir     eMetric = pUsrPref->GetVScrollMetric();
955*cdf0e10cSrcweir     pVRuler->SetUnit( eMetric );
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir 	// DocShell setzen
958*cdf0e10cSrcweir 	pDocSh->SetView( this );
959*cdf0e10cSrcweir 	SW_MOD()->SetView( this );
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir 	mpPostItMgr = new SwPostItMgr(this);
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir 	// Die DocSize erfragen und verarbeiten. Ueber die Handler konnte
964*cdf0e10cSrcweir 	// die Shell nicht gefunden werden, weil die Shell innerhalb CTOR-Phase
965*cdf0e10cSrcweir 	// nicht in der SFX-Verwaltung bekannt ist.
966*cdf0e10cSrcweir 	DocSzChgd( pWrtShell->GetDocSize() );
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir 		// AttrChangedNotify Link setzen
969*cdf0e10cSrcweir 	pWrtShell->SetChgLnk(LINK(this, SwView, AttrChangedNotify));
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir 	if( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED &&
972*cdf0e10cSrcweir         //TODO/LATER: why a cast here?
973*cdf0e10cSrcweir         //!((SvEmbeddedObject *)pDocSh)->GetVisArea().IsEmpty() )
974*cdf0e10cSrcweir         //SetVisArea( ((SvEmbeddedObject *)pDocSh)->GetVisArea(),sal_False);
975*cdf0e10cSrcweir         !pDocSh->GetVisArea(ASPECT_CONTENT).IsEmpty() )
976*cdf0e10cSrcweir         SetVisArea( pDocSh->GetVisArea(ASPECT_CONTENT),sal_False);
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir     pWrtShell->DoUndo( 0 != SW_MOD()->GetUndoOptions().GetUndoCount() );
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir     const sal_Bool bBrowse = pWrtShell->GetViewOptions()->getBrowseMode();
981*cdf0e10cSrcweir     // Disable "multiple window"
982*cdf0e10cSrcweir 	SetNewWindowAllowed(!bBrowse);
983*cdf0e10cSrcweir     // End of disabled multiple window
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir     ShowVScrollbar(aUsrPref.IsViewVScrollBar());
986*cdf0e10cSrcweir     ShowHScrollbar(aUsrPref.IsViewHScrollBar());
987*cdf0e10cSrcweir     pHScrollbar->SetAuto(bBrowse);
988*cdf0e10cSrcweir     if( aUsrPref.IsViewHRuler() )
989*cdf0e10cSrcweir         CreateTab();
990*cdf0e10cSrcweir     if( aUsrPref.IsViewVRuler() )
991*cdf0e10cSrcweir         CreateVLineal();
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir 	pWrtShell->SetUIOptions( aUsrPref );
994*cdf0e10cSrcweir 	pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() );
995*cdf0e10cSrcweir     pWrtShell->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir 	if( pWrtShell->GetDoc()->IsUpdateExpFld() )
998*cdf0e10cSrcweir 	{
999*cdf0e10cSrcweir 		SET_CURR_SHELL( pWrtShell );
1000*cdf0e10cSrcweir 		pWrtShell->StartAction();
1001*cdf0e10cSrcweir 		pWrtShell->CalcLayout();
1002*cdf0e10cSrcweir 		pWrtShell->GetDoc()->UpdateFlds(NULL, false);
1003*cdf0e10cSrcweir 		pWrtShell->EndAction();
1004*cdf0e10cSrcweir 		pWrtShell->GetDoc()->SetUpdateExpFldStat( sal_False );
1005*cdf0e10cSrcweir 	}
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir 	// ggfs. alle Verzeichnisse updaten:
1008*cdf0e10cSrcweir 	if( pWrtShell->GetDoc()->IsUpdateTOX() )
1009*cdf0e10cSrcweir 	{
1010*cdf0e10cSrcweir 		SfxRequest aSfxRequest( FN_UPDATE_TOX, SFX_CALLMODE_SLOT, GetPool() );
1011*cdf0e10cSrcweir 		Execute( aSfxRequest );
1012*cdf0e10cSrcweir 		pWrtShell->GetDoc()->SetUpdateTOX( sal_False );		// wieder zurueck setzen
1013*cdf0e10cSrcweir 		pWrtShell->SttEndDoc(sal_True);
1014*cdf0e10cSrcweir 	}
1015*cdf0e10cSrcweir 
1016*cdf0e10cSrcweir 	// kein ResetModified, wenn es schone eine View auf dieses Doc gibt
1017*cdf0e10cSrcweir 	SfxViewFrame* pVFrame = GetViewFrame();
1018*cdf0e10cSrcweir 	SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
1019*cdf0e10cSrcweir 	// zur Zeit(360) wird die View erst nach dem Ctor eingetragen
1020*cdf0e10cSrcweir 	// der folgende Ausdruck funktioniert auch, wenn sich das aendert
1021*cdf0e10cSrcweir 	//JP 27.07.98: wenn per Undo nicht mehr die Modifizierung aufhebar ist,
1022*cdf0e10cSrcweir 	//				so setze das Modified NICHT zurueck.
1023*cdf0e10cSrcweir     // --> OD 2005-02-11 #i38810# - no reset of modified state, if document
1024*cdf0e10cSrcweir     // was already modified.
1025*cdf0e10cSrcweir     if (!pWrtShell->GetDoc()->GetIDocumentUndoRedo().IsUndoNoResetModified() &&
1026*cdf0e10cSrcweir          ( !pFirst || pFirst == pVFrame ) &&
1027*cdf0e10cSrcweir          !bIsDocModified )
1028*cdf0e10cSrcweir     // <--
1029*cdf0e10cSrcweir     {
1030*cdf0e10cSrcweir 		pWrtShell->ResetModified();
1031*cdf0e10cSrcweir     }
1032*cdf0e10cSrcweir 
1033*cdf0e10cSrcweir 	bNoInterrupt = bOld;
1034*cdf0e10cSrcweir 
1035*cdf0e10cSrcweir 	// wird ein GlobalDoc neu angelegt, soll auch der Navigator erzeugt werden
1036*cdf0e10cSrcweir 	if( pDocSh->IsA(SwGlobalDocShell::StaticType()) &&
1037*cdf0e10cSrcweir 		!pVFrame->GetChildWindow( SID_NAVIGATOR ))
1038*cdf0e10cSrcweir 	{
1039*cdf0e10cSrcweir 		SfxBoolItem aNavi(SID_NAVIGATOR, sal_True);
1040*cdf0e10cSrcweir 		GetDispatcher().Execute(SID_NAVIGATOR, SFX_CALLMODE_ASYNCHRON, &aNavi, 0L);
1041*cdf0e10cSrcweir 	}
1042*cdf0e10cSrcweir 
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir    uno::Reference< frame::XFrame >  xFrame = pVFrame->GetFrame().GetFrameInterface();
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir     uno::Reference< frame::XFrame >  xBeamerFrame = xFrame->findFrame(
1047*cdf0e10cSrcweir             OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN);
1048*cdf0e10cSrcweir     if(xBeamerFrame.is())
1049*cdf0e10cSrcweir     {
1050*cdf0e10cSrcweir         SwDBData aData = pWrtShell->GetDBData();
1051*cdf0e10cSrcweir         SW_MOD()->ShowDBObj( *this, aData );
1052*cdf0e10cSrcweir     }
1053*cdf0e10cSrcweir 
1054*cdf0e10cSrcweir 	// has anybody calls the attrchanged handler in the constructor?
1055*cdf0e10cSrcweir 	if( bAttrChgNotifiedWithRegistrations )
1056*cdf0e10cSrcweir 	{
1057*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1058*cdf0e10cSrcweir 	    if( aTimer.IsActive() )
1059*cdf0e10cSrcweir 			aTimer.Stop();
1060*cdf0e10cSrcweir 	}
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir 	aTimer.SetTimeoutHdl(LINK(this, SwView, TimeoutHdl));
1063*cdf0e10cSrcweir 	bAttrChgNotified = bAttrChgNotifiedWithRegistrations = sal_False;
1064*cdf0e10cSrcweir     if(bOldModifyFlag)
1065*cdf0e10cSrcweir         pDocSh->EnableSetModified( sal_True );
1066*cdf0e10cSrcweir     InvalidateBorder();
1067*cdf0e10cSrcweir }
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir SwView::~SwView()
1070*cdf0e10cSrcweir {
1071*cdf0e10cSrcweir     delete mpPostItMgr;
1072*cdf0e10cSrcweir     // --> OD 2009-03-10 #i100035#
1073*cdf0e10cSrcweir     mpPostItMgr = 0;
1074*cdf0e10cSrcweir     // <--
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir     bInDtor = sal_True;
1077*cdf0e10cSrcweir     pEditWin->Hide(); // damit kein Paint Aerger machen kann!
1078*cdf0e10cSrcweir 	// An der SwDocShell den Pointer auf die View ruecksetzen
1079*cdf0e10cSrcweir 	SwDocShell* pDocSh = GetDocShell();
1080*cdf0e10cSrcweir 	if( pDocSh && pDocSh->GetView() == this )
1081*cdf0e10cSrcweir 		pDocSh->SetView( 0 );
1082*cdf0e10cSrcweir 	if ( SW_MOD()->GetView() == this )
1083*cdf0e10cSrcweir 		SW_MOD()->SetView( 0 );
1084*cdf0e10cSrcweir 
1085*cdf0e10cSrcweir 	if( aTimer.IsActive() && bAttrChgNotifiedWithRegistrations )
1086*cdf0e10cSrcweir 		GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1087*cdf0e10cSrcweir 
1088*cdf0e10cSrcweir 	//JP 27.11.00: Bug 80631 - the last view must end the text edit
1089*cdf0e10cSrcweir 	SdrView *pSdrView = pWrtShell ? pWrtShell->GetDrawView() : 0;
1090*cdf0e10cSrcweir 	if( pSdrView && pSdrView->IsTextEdit() )
1091*cdf0e10cSrcweir 		pSdrView->SdrEndTextEdit( sal_True );
1092*cdf0e10cSrcweir 
1093*cdf0e10cSrcweir 	SetWindow( 0 );
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir     pViewImpl->Invalidate();
1096*cdf0e10cSrcweir 	EndListening(*GetViewFrame());
1097*cdf0e10cSrcweir 	EndListening(*GetDocShell());
1098*cdf0e10cSrcweir 	delete pScrollFill;
1099*cdf0e10cSrcweir 	delete pWrtShell;
1100*cdf0e10cSrcweir 	pWrtShell = 0;		// Auf 0 setzen, damit folgende DToren nicht drauf zugreifen
1101*cdf0e10cSrcweir 	pShell = 0;
1102*cdf0e10cSrcweir 	delete pHScrollbar;
1103*cdf0e10cSrcweir 	delete pVScrollbar;
1104*cdf0e10cSrcweir     delete pHRuler;
1105*cdf0e10cSrcweir     delete pVRuler;
1106*cdf0e10cSrcweir 	delete pTogglePageBtn;
1107*cdf0e10cSrcweir 	delete pPageUpBtn;
1108*cdf0e10cSrcweir 	delete pNaviBtn;
1109*cdf0e10cSrcweir 	delete pPageDownBtn;
1110*cdf0e10cSrcweir 	delete pGlosHdl;
1111*cdf0e10cSrcweir 	delete pViewImpl;
1112*cdf0e10cSrcweir 	delete pEditWin;
1113*cdf0e10cSrcweir     delete pFormatClipboard;
1114*cdf0e10cSrcweir }
1115*cdf0e10cSrcweir 
1116*cdf0e10cSrcweir SwDocShell* SwView::GetDocShell()
1117*cdf0e10cSrcweir {
1118*cdf0e10cSrcweir 	SfxObjectShell* pDocShell = GetViewFrame()->GetObjectShell();
1119*cdf0e10cSrcweir 	return PTR_CAST(SwDocShell, pDocShell);
1120*cdf0e10cSrcweir }
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir /*--------------------------------------------------------------------
1123*cdf0e10cSrcweir 	Beschreibung:	CursorPos merken
1124*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1125*cdf0e10cSrcweir 
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir void SwView::WriteUserData( String &rUserData, sal_Bool bBrowse )
1128*cdf0e10cSrcweir {
1129*cdf0e10cSrcweir 	//Das Browse-Flag wird vom Sfx durchgereicht, wenn Dokumente gebrowsed
1130*cdf0e10cSrcweir 	//werden (nicht zu verwechseln mit dem BrowseMode).
1131*cdf0e10cSrcweir 	//Die dann gespeicherten Daten sind nicht persistent!!
1132*cdf0e10cSrcweir 
1133*cdf0e10cSrcweir 	const SwRect& rRect = pWrtShell->GetCharRect();
1134*cdf0e10cSrcweir 	const Rectangle& rVis = GetVisArea();
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir 	rUserData = String::CreateFromInt32( rRect.Left() );
1137*cdf0e10cSrcweir 	rUserData += ';';
1138*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( rRect.Top() );
1139*cdf0e10cSrcweir 	rUserData += ';';
1140*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( pWrtShell->GetViewOptions()->GetZoom() );
1141*cdf0e10cSrcweir 	rUserData += ';';
1142*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( rVis.Left() );
1143*cdf0e10cSrcweir 	rUserData += ';';
1144*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( rVis.Top() );
1145*cdf0e10cSrcweir 	rUserData += ';';
1146*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( bBrowse ? LONG_MIN : rVis.Right());
1147*cdf0e10cSrcweir 	rUserData += ';';
1148*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32( bBrowse ? LONG_MIN : rVis.Bottom());
1149*cdf0e10cSrcweir 	rUserData += ';';
1150*cdf0e10cSrcweir 	rUserData += String::CreateFromInt32(
1151*cdf0e10cSrcweir 			(sal_uInt16)pWrtShell->GetViewOptions()->GetZoomType());//eZoom;
1152*cdf0e10cSrcweir 	rUserData += ';';
1153*cdf0e10cSrcweir 	rUserData += FRMTYPE_NONE == pWrtShell->GetSelFrmType() ? '0' : '1';
1154*cdf0e10cSrcweir }
1155*cdf0e10cSrcweir /*--------------------------------------------------------------------
1156*cdf0e10cSrcweir 	Beschreibung: CursorPos setzen
1157*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1158*cdf0e10cSrcweir //#i43146# go to the last editing position when opening own files
1159*cdf0e10cSrcweir bool lcl_IsOwnDocument( SwView& rView )
1160*cdf0e10cSrcweir {
1161*cdf0e10cSrcweir     uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1162*cdf0e10cSrcweir         rView.GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
1163*cdf0e10cSrcweir     uno::Reference<document::XDocumentProperties> xDocProps
1164*cdf0e10cSrcweir         = xDPS->getDocumentProperties();
1165*cdf0e10cSrcweir     String Created = xDocProps->getAuthor();
1166*cdf0e10cSrcweir     String Changed = xDocProps->getModifiedBy();
1167*cdf0e10cSrcweir     String FullName = SW_MOD()->GetUserOptions().GetFullName();
1168*cdf0e10cSrcweir     return (FullName.Len() &&
1169*cdf0e10cSrcweir             (Changed.Len() && Changed == FullName )) ||
1170*cdf0e10cSrcweir             (!Changed.Len() && Created.Len() && Created == FullName );
1171*cdf0e10cSrcweir }
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir void SwView::ReadUserData( const String &rUserData, sal_Bool bBrowse )
1175*cdf0e10cSrcweir {
1176*cdf0e10cSrcweir 	if ( rUserData.GetTokenCount() > 1 &&
1177*cdf0e10cSrcweir 		//Fuer Dokumente ohne Layout nur im OnlineLayout oder beim
1178*cdf0e10cSrcweir 		//Forward/Backward
1179*cdf0e10cSrcweir 		 (!pWrtShell->IsNewLayout() || pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse) )
1180*cdf0e10cSrcweir 	{
1181*cdf0e10cSrcweir         //#i43146# go to the last editing position when opening own files
1182*cdf0e10cSrcweir         bool bIsOwnDocument = lcl_IsOwnDocument( *this );
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir         SET_CURR_SHELL(pWrtShell);
1185*cdf0e10cSrcweir 
1186*cdf0e10cSrcweir 		sal_uInt16 nPos = 0;
1187*cdf0e10cSrcweir 
1188*cdf0e10cSrcweir 		// Nein, es ist *keine* gute Idee GetToken gleich im Point-Konstr.
1189*cdf0e10cSrcweir 		// aufzurufen, denn welcher Parameter wird zuerst ausgewertet?
1190*cdf0e10cSrcweir 		long nX = rUserData.GetToken( 0, ';', nPos ).ToInt32(),
1191*cdf0e10cSrcweir 			 nY = rUserData.GetToken( 0, ';', nPos ).ToInt32();
1192*cdf0e10cSrcweir 		Point aCrsrPos( nX, nY );
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir 		sal_uInt16 nZoomFactor =
1195*cdf0e10cSrcweir 			static_cast< sal_uInt16 >( rUserData.GetToken(0, ';', nPos ).ToInt32() );
1196*cdf0e10cSrcweir 
1197*cdf0e10cSrcweir 		long nLeft	= rUserData.GetToken(0, ';', nPos ).ToInt32(),
1198*cdf0e10cSrcweir 			 nTop	= rUserData.GetToken(0, ';', nPos ).ToInt32(),
1199*cdf0e10cSrcweir 			 nRight = rUserData.GetToken(0, ';', nPos ).ToInt32(),
1200*cdf0e10cSrcweir 			 nBottom= rUserData.GetToken(0, ';', nPos ).ToInt32();
1201*cdf0e10cSrcweir 
1202*cdf0e10cSrcweir 		const long nAdd = pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
1203*cdf0e10cSrcweir 		if ( nBottom <= (pWrtShell->GetDocSize().Height()+nAdd) )
1204*cdf0e10cSrcweir 		{
1205*cdf0e10cSrcweir 			pWrtShell->EnableSmooth( sal_False );
1206*cdf0e10cSrcweir 
1207*cdf0e10cSrcweir 			const Rectangle aVis( nLeft, nTop, nRight, nBottom );
1208*cdf0e10cSrcweir 
1209*cdf0e10cSrcweir 			sal_uInt16 nOff = 0;
1210*cdf0e10cSrcweir 			SvxZoomType eZoom;
1211*cdf0e10cSrcweir 			if( !pWrtShell->GetViewOptions()->getBrowseMode() )
1212*cdf0e10cSrcweir 				eZoom = (SvxZoomType) (sal_uInt16)rUserData.GetToken(nOff, ';', nPos ).ToInt32();
1213*cdf0e10cSrcweir 			else
1214*cdf0e10cSrcweir 			{
1215*cdf0e10cSrcweir 				eZoom = SVX_ZOOM_PERCENT;
1216*cdf0e10cSrcweir 				++nOff;
1217*cdf0e10cSrcweir 			}
1218*cdf0e10cSrcweir 
1219*cdf0e10cSrcweir 			sal_Bool bSelectObj = (0 != rUserData.GetToken( nOff, ';', nPos ).ToInt32())
1220*cdf0e10cSrcweir 								&& pWrtShell->IsObjSelectable( aCrsrPos );
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir             //#i33307# restore editing position
1223*cdf0e10cSrcweir             pViewImpl->SetRestorePosition(aCrsrPos, bSelectObj);
1224*cdf0e10cSrcweir             // OD 11.02.2003 #100556# - set flag value to avoid macro execution.
1225*cdf0e10cSrcweir             bool bSavedFlagValue = pWrtShell->IsMacroExecAllowed();
1226*cdf0e10cSrcweir             pWrtShell->SetMacroExecAllowed( false );
1227*cdf0e10cSrcweir //!!! pb (11.08.2004): #i32536#
1228*cdf0e10cSrcweir // os: changed: The user data has to be read if the view is switched back from page preview
1229*cdf0e10cSrcweir //#i43146# go to the last editing position when opening own files
1230*cdf0e10cSrcweir             if(bOldShellWasPagePreView || bIsOwnDocument)
1231*cdf0e10cSrcweir             {
1232*cdf0e10cSrcweir                 pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
1233*cdf0e10cSrcweir             	if( bSelectObj )
1234*cdf0e10cSrcweir             	{
1235*cdf0e10cSrcweir             		pWrtShell->SelectObj( aCrsrPos );
1236*cdf0e10cSrcweir             		pWrtShell->EnterSelFrmMode( &aCrsrPos );
1237*cdf0e10cSrcweir             	}
1238*cdf0e10cSrcweir             }
1239*cdf0e10cSrcweir 
1240*cdf0e10cSrcweir             // OD 11.02.2003 #100556# - reset flag value
1241*cdf0e10cSrcweir             pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
1242*cdf0e10cSrcweir 
1243*cdf0e10cSrcweir             // OD 08.04.2003 #108693# - set visible area before applying
1244*cdf0e10cSrcweir             // information from print preview. Otherwise, the applied information
1245*cdf0e10cSrcweir             // is lost.
1246*cdf0e10cSrcweir //!!! pb (11.08.2004): #i32536#
1247*cdf0e10cSrcweir // os: changed: The user data has to be read if the view is switched back from page preview
1248*cdf0e10cSrcweir //#i43146# go to the last editing position when opening own files
1249*cdf0e10cSrcweir             if(bOldShellWasPagePreView || bIsOwnDocument )
1250*cdf0e10cSrcweir             {
1251*cdf0e10cSrcweir                 if ( bBrowse )
1252*cdf0e10cSrcweir                     SetVisArea( aVis.TopLeft() );
1253*cdf0e10cSrcweir                 else
1254*cdf0e10cSrcweir                     SetVisArea( aVis );
1255*cdf0e10cSrcweir             }
1256*cdf0e10cSrcweir 
1257*cdf0e10cSrcweir             //apply information from print preview - if available
1258*cdf0e10cSrcweir 			if( sNewCrsrPos.Len() )
1259*cdf0e10cSrcweir 			{
1260*cdf0e10cSrcweir 				long nXTmp = sNewCrsrPos.GetToken( 0, ';' ).ToInt32(),
1261*cdf0e10cSrcweir 				 	 nYTmp = sNewCrsrPos.GetToken( 1, ';' ).ToInt32();
1262*cdf0e10cSrcweir                 Point aCrsrPos2( nXTmp, nYTmp );
1263*cdf0e10cSrcweir                 bSelectObj = pWrtShell->IsObjSelectable( aCrsrPos2 );
1264*cdf0e10cSrcweir 
1265*cdf0e10cSrcweir                 pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos2, sal_False );
1266*cdf0e10cSrcweir                 if( bSelectObj )
1267*cdf0e10cSrcweir                 {
1268*cdf0e10cSrcweir                     pWrtShell->SelectObj( aCrsrPos2 );
1269*cdf0e10cSrcweir                     pWrtShell->EnterSelFrmMode( &aCrsrPos2 );
1270*cdf0e10cSrcweir                 }
1271*cdf0e10cSrcweir                 pWrtShell->MakeSelVisible();
1272*cdf0e10cSrcweir                 sNewCrsrPos.Erase();
1273*cdf0e10cSrcweir 			}
1274*cdf0e10cSrcweir             else if(USHRT_MAX != nNewPage)
1275*cdf0e10cSrcweir             {
1276*cdf0e10cSrcweir                 pWrtShell->GotoPage(nNewPage, sal_True);
1277*cdf0e10cSrcweir                 nNewPage = USHRT_MAX;
1278*cdf0e10cSrcweir             }
1279*cdf0e10cSrcweir 
1280*cdf0e10cSrcweir 			SelectShell();
1281*cdf0e10cSrcweir 
1282*cdf0e10cSrcweir 			pWrtShell->StartAction();
1283*cdf0e10cSrcweir 			const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
1284*cdf0e10cSrcweir 			if( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom )
1285*cdf0e10cSrcweir 				SetZoom( eZoom, nZoomFactor);
1286*cdf0e10cSrcweir 
1287*cdf0e10cSrcweir 			pWrtShell->LockView( sal_True );
1288*cdf0e10cSrcweir 			pWrtShell->EndAction();
1289*cdf0e10cSrcweir 			pWrtShell->LockView( sal_False );
1290*cdf0e10cSrcweir 			pWrtShell->EnableSmooth( sal_True );
1291*cdf0e10cSrcweir 		}
1292*cdf0e10cSrcweir 	}
1293*cdf0e10cSrcweir }
1294*cdf0e10cSrcweir 
1295*cdf0e10cSrcweir void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& rSequence, sal_Bool bBrowse )
1296*cdf0e10cSrcweir {
1297*cdf0e10cSrcweir     if(GetDocShell()->IsPreview()||bIsPreviewDoubleClick)
1298*cdf0e10cSrcweir         return;
1299*cdf0e10cSrcweir     //#i43146# go to the last editing position when opening own files
1300*cdf0e10cSrcweir     bool bIsOwnDocument = lcl_IsOwnDocument( *this );
1301*cdf0e10cSrcweir     sal_Int32 nLength = rSequence.getLength();
1302*cdf0e10cSrcweir     if (nLength && (!pWrtShell->IsNewLayout() || pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse) )
1303*cdf0e10cSrcweir     {
1304*cdf0e10cSrcweir 		SET_CURR_SHELL(pWrtShell);
1305*cdf0e10cSrcweir         const beans::PropertyValue *pValue = rSequence.getConstArray();
1306*cdf0e10cSrcweir 		const SwRect& rRect = pWrtShell->GetCharRect();
1307*cdf0e10cSrcweir 		const Rectangle &rVis = GetVisArea();
1308*cdf0e10cSrcweir         const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
1309*cdf0e10cSrcweir 
1310*cdf0e10cSrcweir         long nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top();
1311*cdf0e10cSrcweir 		long nRight = bBrowse ? LONG_MIN : rVis.Right(), nBottom = bBrowse ? LONG_MIN : rVis.Bottom();
1312*cdf0e10cSrcweir         sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType());
1313*cdf0e10cSrcweir         sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
1314*cdf0e10cSrcweir         bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
1315*cdf0e10cSrcweir         sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
1316*cdf0e10cSrcweir 
1317*cdf0e10cSrcweir         sal_Bool bSelectedFrame = ( pWrtShell->GetSelFrmType() != FRMTYPE_NONE ),
1318*cdf0e10cSrcweir 				 bGotViewLeft = sal_False, bGotViewTop = sal_False, bGotVisibleLeft = sal_False,
1319*cdf0e10cSrcweir 				 bGotVisibleTop = sal_False, bGotVisibleRight = sal_False,
1320*cdf0e10cSrcweir 				 bGotVisibleBottom = sal_False, bGotZoomType = sal_False,
1321*cdf0e10cSrcweir 				 bGotZoomFactor = sal_False, bGotIsSelectedFrame = sal_False,
1322*cdf0e10cSrcweir                  bGotViewLayoutColumns = sal_False, bGotViewLayoutBookMode = sal_False;
1323*cdf0e10cSrcweir 
1324*cdf0e10cSrcweir         for (sal_Int16 i = 0 ; i < nLength; i++)
1325*cdf0e10cSrcweir         {
1326*cdf0e10cSrcweir             if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLeft" ) ) )
1327*cdf0e10cSrcweir             {
1328*cdf0e10cSrcweir                pValue->Value >>= nX;
1329*cdf0e10cSrcweir 			   nX = MM100_TO_TWIP( nX );
1330*cdf0e10cSrcweir 			   bGotViewLeft = sal_True;
1331*cdf0e10cSrcweir             }
1332*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewTop" ) ) )
1333*cdf0e10cSrcweir             {
1334*cdf0e10cSrcweir                pValue->Value >>= nY;
1335*cdf0e10cSrcweir 			   nY = MM100_TO_TWIP( nY );
1336*cdf0e10cSrcweir 			   bGotViewTop = sal_True;
1337*cdf0e10cSrcweir             }
1338*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleLeft" ) ) )
1339*cdf0e10cSrcweir             {
1340*cdf0e10cSrcweir                pValue->Value >>= nLeft;
1341*cdf0e10cSrcweir 			   nLeft = MM100_TO_TWIP( nLeft );
1342*cdf0e10cSrcweir 			   bGotVisibleLeft = sal_True;
1343*cdf0e10cSrcweir             }
1344*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleTop" ) ) )
1345*cdf0e10cSrcweir             {
1346*cdf0e10cSrcweir                pValue->Value >>= nTop;
1347*cdf0e10cSrcweir 			   nTop = MM100_TO_TWIP( nTop );
1348*cdf0e10cSrcweir 			   bGotVisibleTop = sal_True;
1349*cdf0e10cSrcweir             }
1350*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleRight" ) ) )
1351*cdf0e10cSrcweir             {
1352*cdf0e10cSrcweir                pValue->Value >>= nRight;
1353*cdf0e10cSrcweir 			   nRight = MM100_TO_TWIP( nRight );
1354*cdf0e10cSrcweir 			   bGotVisibleRight = sal_True;
1355*cdf0e10cSrcweir             }
1356*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleBottom" ) ) )
1357*cdf0e10cSrcweir             {
1358*cdf0e10cSrcweir                pValue->Value >>= nBottom;
1359*cdf0e10cSrcweir 			   nBottom = MM100_TO_TWIP( nBottom );
1360*cdf0e10cSrcweir 			   bGotVisibleBottom = sal_True;
1361*cdf0e10cSrcweir             }
1362*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ZoomType" ) ) )
1363*cdf0e10cSrcweir             {
1364*cdf0e10cSrcweir                pValue->Value >>= nZoomType;
1365*cdf0e10cSrcweir 			   bGotZoomType = sal_True;
1366*cdf0e10cSrcweir             }
1367*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ZoomFactor" ) ) )
1368*cdf0e10cSrcweir             {
1369*cdf0e10cSrcweir                pValue->Value >>= nZoomFactor;
1370*cdf0e10cSrcweir 			   bGotZoomFactor = sal_True;
1371*cdf0e10cSrcweir             }
1372*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLayoutColumns" ) ) )
1373*cdf0e10cSrcweir             {
1374*cdf0e10cSrcweir                pValue->Value >>= nViewLayoutColumns;
1375*cdf0e10cSrcweir 			   bGotViewLayoutColumns = sal_True;
1376*cdf0e10cSrcweir             }
1377*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLayoutBookMode" ) ) )
1378*cdf0e10cSrcweir             {
1379*cdf0e10cSrcweir                bViewLayoutBookMode = * (sal_Bool *) pValue->Value.getValue();
1380*cdf0e10cSrcweir 			   bGotViewLayoutBookMode = sal_True;
1381*cdf0e10cSrcweir             }
1382*cdf0e10cSrcweir             else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsSelectedFrame" ) ) )
1383*cdf0e10cSrcweir             {
1384*cdf0e10cSrcweir                pValue->Value >>= bSelectedFrame;
1385*cdf0e10cSrcweir                bGotIsSelectedFrame = sal_True;
1386*cdf0e10cSrcweir             }
1387*cdf0e10cSrcweir             pValue++;
1388*cdf0e10cSrcweir         }
1389*cdf0e10cSrcweir 		if (bGotVisibleBottom)
1390*cdf0e10cSrcweir 		{
1391*cdf0e10cSrcweir 			Point aCrsrPos( nX, nY );
1392*cdf0e10cSrcweir 			const long nAdd = pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
1393*cdf0e10cSrcweir 			if (nBottom <= (pWrtShell->GetDocSize().Height()+nAdd) )
1394*cdf0e10cSrcweir 			{
1395*cdf0e10cSrcweir 				pWrtShell->EnableSmooth( sal_False );
1396*cdf0e10cSrcweir 				const Rectangle aVis( nLeft, nTop, nRight, nBottom );
1397*cdf0e10cSrcweir 
1398*cdf0e10cSrcweir 				sal_uInt16 nOff = 0;
1399*cdf0e10cSrcweir 				SvxZoomType eZoom;
1400*cdf0e10cSrcweir                 if ( !pWrtShell->GetViewOptions()->getBrowseMode() )
1401*cdf0e10cSrcweir 					eZoom = static_cast < SvxZoomType > ( nZoomType );
1402*cdf0e10cSrcweir 				else
1403*cdf0e10cSrcweir 				{
1404*cdf0e10cSrcweir 					eZoom = SVX_ZOOM_PERCENT;
1405*cdf0e10cSrcweir 					++nOff;
1406*cdf0e10cSrcweir 				}
1407*cdf0e10cSrcweir 				if (bGotIsSelectedFrame)
1408*cdf0e10cSrcweir 				{
1409*cdf0e10cSrcweir 					sal_Bool bSelectObj = (sal_False != bSelectedFrame )
1410*cdf0e10cSrcweir 										&& pWrtShell->IsObjSelectable( aCrsrPos );
1411*cdf0e10cSrcweir 
1412*cdf0e10cSrcweir                     // OD 11.02.2003 #100556# - set flag value to avoid macro execution.
1413*cdf0e10cSrcweir                     bool bSavedFlagValue = pWrtShell->IsMacroExecAllowed();
1414*cdf0e10cSrcweir                     pWrtShell->SetMacroExecAllowed( false );
1415*cdf0e10cSrcweir //!!! pb (11.08.2004): #i32536#
1416*cdf0e10cSrcweir // os: changed: The user data has to be read if the view is switched back from page preview
1417*cdf0e10cSrcweir //#i43146# go to the last editing position when opening own files
1418*cdf0e10cSrcweir                     //#i33307# restore editing position
1419*cdf0e10cSrcweir                     pViewImpl->SetRestorePosition(aCrsrPos, bSelectObj);
1420*cdf0e10cSrcweir                     if(bOldShellWasPagePreView|| bIsOwnDocument)
1421*cdf0e10cSrcweir                     {
1422*cdf0e10cSrcweir 					    pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
1423*cdf0e10cSrcweir 					    if( bSelectObj )
1424*cdf0e10cSrcweir     					{
1425*cdf0e10cSrcweir 						    pWrtShell->SelectObj( aCrsrPos );
1426*cdf0e10cSrcweir 						    pWrtShell->EnterSelFrmMode( &aCrsrPos );
1427*cdf0e10cSrcweir     					}
1428*cdf0e10cSrcweir     				}
1429*cdf0e10cSrcweir 
1430*cdf0e10cSrcweir                     // OD 11.02.2003 #100556# - reset flag value
1431*cdf0e10cSrcweir                     pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
1432*cdf0e10cSrcweir 				}
1433*cdf0e10cSrcweir 				SelectShell();
1434*cdf0e10cSrcweir 
1435*cdf0e10cSrcweir                 // Set ViewLayoutSettings
1436*cdf0e10cSrcweir                 const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
1437*cdf0e10cSrcweir                                                     ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir                 const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
1440*cdf0e10cSrcweir                                               ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir                 // In case we have a 'fixed' view layout of 2 or more columns,
1443*cdf0e10cSrcweir                 // we have to apply the view options *before* starting the action.
1444*cdf0e10cSrcweir                 // Otherwsie the SetZoom function cannot work correctly, because
1445*cdf0e10cSrcweir                 // the view layout hasn't been calculated.
1446*cdf0e10cSrcweir                 const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
1447*cdf0e10cSrcweir                                                   1 < nViewLayoutColumns &&
1448*cdf0e10cSrcweir                                                   bSetViewSettings &&
1449*cdf0e10cSrcweir                                                   eZoom != SVX_ZOOM_PERCENT;
1450*cdf0e10cSrcweir 
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir                 if ( !bZoomNeedsViewLayout )
1453*cdf0e10cSrcweir                     pWrtShell->StartAction();
1454*cdf0e10cSrcweir 
1455*cdf0e10cSrcweir                 if ( bSetViewLayoutSettings )
1456*cdf0e10cSrcweir                     SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, sal_True );
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir                 if ( bZoomNeedsViewLayout )
1459*cdf0e10cSrcweir                     pWrtShell->StartAction();
1460*cdf0e10cSrcweir 
1461*cdf0e10cSrcweir 				if ( bSetViewSettings )
1462*cdf0e10cSrcweir                     SetZoom( eZoom, nZoomFactor, sal_True );
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir //!!! pb (11.08.2004): #i32536#
1465*cdf0e10cSrcweir // os: changed: The user data has to be read if the view is switched back from page preview
1466*cdf0e10cSrcweir //#i43146# go to the last editing position when opening own files
1467*cdf0e10cSrcweir                 if(bOldShellWasPagePreView||bIsOwnDocument)
1468*cdf0e10cSrcweir                 {
1469*cdf0e10cSrcweir     				if ( bBrowse && bGotVisibleLeft && bGotVisibleTop )
1470*cdf0e10cSrcweir                     {
1471*cdf0e10cSrcweir                         Point aTopLeft(aVis.TopLeft());
1472*cdf0e10cSrcweir                         //#i76699# make sure the document is still centered
1473*cdf0e10cSrcweir                         const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
1474*cdf0e10cSrcweir                         SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
1475*cdf0e10cSrcweir                         if(nEditWidth > (aDocSz.Width() + lBorder ))
1476*cdf0e10cSrcweir                             aTopLeft.X() = ( aDocSz.Width() + lBorder - nEditWidth  ) / 2;
1477*cdf0e10cSrcweir                         else
1478*cdf0e10cSrcweir                         {
1479*cdf0e10cSrcweir                             //check if the values are possible
1480*cdf0e10cSrcweir                             long nXMax = pHScrollbar->GetRangeMax() - pHScrollbar->GetVisibleSize();
1481*cdf0e10cSrcweir                             if( aTopLeft.X() > nXMax )
1482*cdf0e10cSrcweir                                 aTopLeft.X() = nXMax < 0 ? 0 : nXMax;
1483*cdf0e10cSrcweir                         }
1484*cdf0e10cSrcweir                         SetVisArea( aTopLeft );
1485*cdf0e10cSrcweir                     }
1486*cdf0e10cSrcweir 				    else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
1487*cdf0e10cSrcweir     					SetVisArea( aVis );
1488*cdf0e10cSrcweir 	    	    }
1489*cdf0e10cSrcweir 
1490*cdf0e10cSrcweir 				pWrtShell->LockView( sal_True );
1491*cdf0e10cSrcweir 				pWrtShell->EndAction();
1492*cdf0e10cSrcweir 				pWrtShell->LockView( sal_False );
1493*cdf0e10cSrcweir 				pWrtShell->EnableSmooth( sal_True );
1494*cdf0e10cSrcweir 			}
1495*cdf0e10cSrcweir 		}
1496*cdf0e10cSrcweir     }
1497*cdf0e10cSrcweir }
1498*cdf0e10cSrcweir #define NUM_VIEW_SETTINGS 12
1499*cdf0e10cSrcweir void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence, sal_Bool bBrowse )
1500*cdf0e10cSrcweir {
1501*cdf0e10cSrcweir 	const SwRect& rRect = pWrtShell->GetCharRect();
1502*cdf0e10cSrcweir 	const Rectangle& rVis = GetVisArea();
1503*cdf0e10cSrcweir     Any aAny;
1504*cdf0e10cSrcweir 
1505*cdf0e10cSrcweir     rSequence.realloc ( NUM_VIEW_SETTINGS );
1506*cdf0e10cSrcweir     sal_Int16 nIndex = 0;
1507*cdf0e10cSrcweir     beans::PropertyValue *pValue = rSequence.getArray();
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir     sal_uInt16 nViewID( GetViewFrame()->GetCurViewId());
1510*cdf0e10cSrcweir 	pValue->Name = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ViewId" ) );
1511*cdf0e10cSrcweir 	OUStringBuffer sBuffer ( OUString(RTL_CONSTASCII_USTRINGPARAM( "view" ) ) );
1512*cdf0e10cSrcweir 	SvXMLUnitConverter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID));
1513*cdf0e10cSrcweir 	pValue->Value <<= sBuffer.makeStringAndClear();
1514*cdf0e10cSrcweir     pValue++;nIndex++;
1515*cdf0e10cSrcweir 
1516*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLeft" ) );
1517*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( rRect.Left() );
1518*cdf0e10cSrcweir     pValue++;nIndex++;
1519*cdf0e10cSrcweir 
1520*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewTop" ) );
1521*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( rRect.Top() );
1522*cdf0e10cSrcweir     pValue++;nIndex++;
1523*cdf0e10cSrcweir 
1524*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleLeft" ) );
1525*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( rVis.Left() );
1526*cdf0e10cSrcweir     pValue++;nIndex++;
1527*cdf0e10cSrcweir 
1528*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleTop" ) );
1529*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( rVis.Top() );
1530*cdf0e10cSrcweir     pValue++;nIndex++;
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleRight" ) );
1533*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Right() );
1534*cdf0e10cSrcweir     pValue++;nIndex++;
1535*cdf0e10cSrcweir 
1536*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleBottom" ) );
1537*cdf0e10cSrcweir     pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Bottom() );
1538*cdf0e10cSrcweir     pValue++;nIndex++;
1539*cdf0e10cSrcweir 
1540*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZoomType" ) );
1541*cdf0e10cSrcweir     const sal_Int16 nZoomType = static_cast< sal_Int16 >(pWrtShell->GetViewOptions()->GetZoomType());
1542*cdf0e10cSrcweir     pValue->Value <<= nZoomType;
1543*cdf0e10cSrcweir     pValue++;nIndex++;
1544*cdf0e10cSrcweir 
1545*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLayoutColumns" ) );
1546*cdf0e10cSrcweir     const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(pWrtShell->GetViewOptions()->GetViewLayoutColumns());
1547*cdf0e10cSrcweir     pValue->Value <<= nViewLayoutColumns;
1548*cdf0e10cSrcweir     pValue++;nIndex++;
1549*cdf0e10cSrcweir 
1550*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLayoutBookMode" ) );
1551*cdf0e10cSrcweir     const sal_Bool bIsViewLayoutBookMode = pWrtShell->GetViewOptions()->IsViewLayoutBookMode();
1552*cdf0e10cSrcweir     pValue->Value.setValue( &bIsViewLayoutBookMode, ::getBooleanCppuType() );
1553*cdf0e10cSrcweir     pValue++;nIndex++;
1554*cdf0e10cSrcweir 
1555*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZoomFactor" ) );
1556*cdf0e10cSrcweir     pValue->Value <<= static_cast < sal_Int16 > (pWrtShell->GetViewOptions()->GetZoom());
1557*cdf0e10cSrcweir     pValue++;nIndex++;
1558*cdf0e10cSrcweir 
1559*cdf0e10cSrcweir     pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "IsSelectedFrame" ) );
1560*cdf0e10cSrcweir 	const sal_Bool bIsSelected = FRMTYPE_NONE == pWrtShell->GetSelFrmType() ? sal_False : sal_True;
1561*cdf0e10cSrcweir     pValue->Value.setValue ( &bIsSelected, ::getBooleanCppuType() );
1562*cdf0e10cSrcweir 	nIndex++;
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir     if ( nIndex < NUM_VIEW_SETTINGS )
1565*cdf0e10cSrcweir         rSequence.realloc ( nIndex );
1566*cdf0e10cSrcweir }
1567*cdf0e10cSrcweir #undef NUM_VIEW_SETTINGS
1568*cdf0e10cSrcweir 
1569*cdf0e10cSrcweir 
1570*cdf0e10cSrcweir 
1571*cdf0e10cSrcweir void SwView::ShowCursor( FASTBOOL bOn )
1572*cdf0e10cSrcweir {
1573*cdf0e10cSrcweir 	//JP 10.10.2001: Bug 90461 - don't scroll the cursor into the visible area
1574*cdf0e10cSrcweir 	sal_Bool bUnlockView = !pWrtShell->IsViewLocked();
1575*cdf0e10cSrcweir 	pWrtShell->LockView( sal_True );	//lock visible section
1576*cdf0e10cSrcweir 
1577*cdf0e10cSrcweir 	if( !bOn )
1578*cdf0e10cSrcweir 		pWrtShell->HideCrsr();
1579*cdf0e10cSrcweir 	else if( !pWrtShell->IsFrmSelected() && !pWrtShell->IsObjSelected() )
1580*cdf0e10cSrcweir 		pWrtShell->ShowCrsr();
1581*cdf0e10cSrcweir 
1582*cdf0e10cSrcweir 	if( bUnlockView )
1583*cdf0e10cSrcweir 		pWrtShell->LockView( sal_False );
1584*cdf0e10cSrcweir }
1585*cdf0e10cSrcweir 
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir 
1588*cdf0e10cSrcweir ErrCode SwView::DoVerb( long nVerb )
1589*cdf0e10cSrcweir {
1590*cdf0e10cSrcweir     if ( !GetViewFrame()->GetFrame().IsInPlace() )
1591*cdf0e10cSrcweir 	{
1592*cdf0e10cSrcweir 		SwWrtShell &rSh = GetWrtShell();
1593*cdf0e10cSrcweir 		const int nSel = rSh.GetSelectionType();
1594*cdf0e10cSrcweir 		if ( nSel & nsSelectionType::SEL_OLE )
1595*cdf0e10cSrcweir 			rSh.LaunchOLEObj( nVerb );
1596*cdf0e10cSrcweir 	}
1597*cdf0e10cSrcweir 	return ERRCODE_NONE;
1598*cdf0e10cSrcweir }
1599*cdf0e10cSrcweir 
1600*cdf0e10cSrcweir /*-----------------17.02.98 13:33-------------------
1601*cdf0e10cSrcweir 	nur sal_True fuer eine Textselektion zurueck geben
1602*cdf0e10cSrcweir --------------------------------------------------*/
1603*cdf0e10cSrcweir sal_Bool SwView::HasSelection( sal_Bool  bText ) const
1604*cdf0e10cSrcweir {
1605*cdf0e10cSrcweir 	return bText ? GetWrtShell().SwCrsrShell::HasSelection()
1606*cdf0e10cSrcweir 				 : GetWrtShell().HasSelection();
1607*cdf0e10cSrcweir }
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir /*-----------------09/16/97 09:50am-----------------
1610*cdf0e10cSrcweir 
1611*cdf0e10cSrcweir --------------------------------------------------*/
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir String SwView::GetSelectionText( sal_Bool bCompleteWrds )
1614*cdf0e10cSrcweir {
1615*cdf0e10cSrcweir 	return GetSelectionTextParam( bCompleteWrds, sal_True );
1616*cdf0e10cSrcweir }
1617*cdf0e10cSrcweir 
1618*cdf0e10cSrcweir /*-----------------09/16/97 09:50am-----------------
1619*cdf0e10cSrcweir 
1620*cdf0e10cSrcweir --------------------------------------------------*/
1621*cdf0e10cSrcweir String	SwView::GetSelectionTextParam( sal_Bool bCompleteWrds,
1622*cdf0e10cSrcweir 									   sal_Bool bEraseTrail )
1623*cdf0e10cSrcweir {
1624*cdf0e10cSrcweir 	String sReturn;
1625*cdf0e10cSrcweir 	if( bCompleteWrds && !GetWrtShell().HasSelection() )
1626*cdf0e10cSrcweir 		GetWrtShell().SelWrd();
1627*cdf0e10cSrcweir 
1628*cdf0e10cSrcweir 	GetWrtShell().GetSelectedText( sReturn );
1629*cdf0e10cSrcweir 	if( bEraseTrail )
1630*cdf0e10cSrcweir 		sReturn.EraseTrailingChars();
1631*cdf0e10cSrcweir 	return sReturn;
1632*cdf0e10cSrcweir }
1633*cdf0e10cSrcweir 
1634*cdf0e10cSrcweir /*--------------------------------------------------------------------
1635*cdf0e10cSrcweir 	Beschreibung:
1636*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1637*cdf0e10cSrcweir 
1638*cdf0e10cSrcweir 
1639*cdf0e10cSrcweir 
1640*cdf0e10cSrcweir SwGlossaryHdl* SwView::GetGlosHdl()
1641*cdf0e10cSrcweir {
1642*cdf0e10cSrcweir 	if(!pGlosHdl)
1643*cdf0e10cSrcweir 		pGlosHdl = new SwGlossaryHdl(GetViewFrame(), pWrtShell);
1644*cdf0e10cSrcweir 	return pGlosHdl;
1645*cdf0e10cSrcweir }
1646*cdf0e10cSrcweir 
1647*cdf0e10cSrcweir /*-----------------05.09.96 15.50-------------------
1648*cdf0e10cSrcweir 
1649*cdf0e10cSrcweir --------------------------------------------------*/
1650*cdf0e10cSrcweir 
1651*cdf0e10cSrcweir 
1652*cdf0e10cSrcweir 
1653*cdf0e10cSrcweir void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
1654*cdf0e10cSrcweir {
1655*cdf0e10cSrcweir 	sal_Bool bCallBase = sal_True;
1656*cdf0e10cSrcweir 	if ( rHint.ISA(SfxSimpleHint) )
1657*cdf0e10cSrcweir 	{
1658*cdf0e10cSrcweir 		sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId();
1659*cdf0e10cSrcweir 		switch ( nId )
1660*cdf0e10cSrcweir 		{
1661*cdf0e10cSrcweir             // --> OD 2005-03-03 #i43775# - sub shells will be destroyed by the
1662*cdf0e10cSrcweir             // dispatcher, if the view frame is dying. Thus, reset member <pShell>.
1663*cdf0e10cSrcweir             case SFX_HINT_DYING:
1664*cdf0e10cSrcweir                 {
1665*cdf0e10cSrcweir                     if ( &rBC == GetViewFrame() )
1666*cdf0e10cSrcweir                     {
1667*cdf0e10cSrcweir                         ResetSubShell();
1668*cdf0e10cSrcweir                     }
1669*cdf0e10cSrcweir                 }
1670*cdf0e10cSrcweir                 break;
1671*cdf0e10cSrcweir             // <--
1672*cdf0e10cSrcweir             case SFX_HINT_MODECHANGED:
1673*cdf0e10cSrcweir 				{
1674*cdf0e10cSrcweir 					// Modalmodus-Umschaltung?
1675*cdf0e10cSrcweir 					sal_Bool bModal = GetDocShell()->IsInModalMode();
1676*cdf0e10cSrcweir                     pHRuler->SetActive( !bModal );
1677*cdf0e10cSrcweir                     pVRuler->SetActive( !bModal );
1678*cdf0e10cSrcweir 				}
1679*cdf0e10cSrcweir 
1680*cdf0e10cSrcweir 				/* kein break hier */
1681*cdf0e10cSrcweir 
1682*cdf0e10cSrcweir 			case SFX_HINT_TITLECHANGED:
1683*cdf0e10cSrcweir 				if ( GetDocShell()->IsReadOnly() != GetWrtShell().GetViewOptions()->IsReadonly() )
1684*cdf0e10cSrcweir 				{
1685*cdf0e10cSrcweir 					SwWrtShell &rSh = GetWrtShell();
1686*cdf0e10cSrcweir 					rSh.SetReadonlyOption( GetDocShell()->IsReadOnly() );
1687*cdf0e10cSrcweir 
1688*cdf0e10cSrcweir                     if ( rSh.GetViewOptions()->IsViewVRuler() )
1689*cdf0e10cSrcweir                         CreateVLineal();
1690*cdf0e10cSrcweir 					else
1691*cdf0e10cSrcweir                         KillVLineal();
1692*cdf0e10cSrcweir                     if ( rSh.GetViewOptions()->IsViewHRuler() )
1693*cdf0e10cSrcweir                         CreateTab();
1694*cdf0e10cSrcweir 					else
1695*cdf0e10cSrcweir                         KillTab();
1696*cdf0e10cSrcweir 					bool bReadonly = GetDocShell()->IsReadOnly();
1697*cdf0e10cSrcweir                     //#i76332# if document is to be opened in alive-mode then this has to be regarded while switching from readonly-mode to edit-mode
1698*cdf0e10cSrcweir                     if( !bReadonly )
1699*cdf0e10cSrcweir                     {
1700*cdf0e10cSrcweir                         SwDrawDocument * pDrawDoc = 0;
1701*cdf0e10cSrcweir                         if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->GetDrawModel() ) ) )
1702*cdf0e10cSrcweir                         {
1703*cdf0e10cSrcweir 				            if( !pDrawDoc->GetOpenInDesignMode() )
1704*cdf0e10cSrcweir                                 break;// don't touch the design mode
1705*cdf0e10cSrcweir                         }
1706*cdf0e10cSrcweir                     }
1707*cdf0e10cSrcweir                     SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadonly);
1708*cdf0e10cSrcweir                     GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_ASYNCHRON,
1709*cdf0e10cSrcweir 												&aItem, 0L );
1710*cdf0e10cSrcweir 				}
1711*cdf0e10cSrcweir 				break;
1712*cdf0e10cSrcweir 
1713*cdf0e10cSrcweir 			case SW_BROADCAST_DRAWVIEWS_CREATED:
1714*cdf0e10cSrcweir 				{
1715*cdf0e10cSrcweir 					bCallBase = sal_False;
1716*cdf0e10cSrcweir 					if ( GetFormShell() )
1717*cdf0e10cSrcweir 					{
1718*cdf0e10cSrcweir 						GetFormShell()->SetView(
1719*cdf0e10cSrcweir 							PTR_CAST(FmFormView, GetWrtShell().GetDrawView()) );
1720*cdf0e10cSrcweir 						SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly());
1721*cdf0e10cSrcweir                         GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON,
1722*cdf0e10cSrcweir 												  &aItem, 0L );
1723*cdf0e10cSrcweir 					}
1724*cdf0e10cSrcweir 				}
1725*cdf0e10cSrcweir 				break;
1726*cdf0e10cSrcweir 		}
1727*cdf0e10cSrcweir 	}
1728*cdf0e10cSrcweir 	else if(rHint.ISA(FmDesignModeChangedHint))
1729*cdf0e10cSrcweir 	{
1730*cdf0e10cSrcweir 		sal_Bool bDesignMode = ((FmDesignModeChangedHint&)rHint).GetDesignMode();
1731*cdf0e10cSrcweir 		if (!bDesignMode && GetDrawFuncPtr())
1732*cdf0e10cSrcweir 		{
1733*cdf0e10cSrcweir 			GetDrawFuncPtr()->Deactivate();
1734*cdf0e10cSrcweir 			SetDrawFuncPtr(NULL);
1735*cdf0e10cSrcweir 			LeaveDrawCreate();
1736*cdf0e10cSrcweir 			AttrChangedNotify(pWrtShell);
1737*cdf0e10cSrcweir 		}
1738*cdf0e10cSrcweir 	}
1739*cdf0e10cSrcweir 
1740*cdf0e10cSrcweir 	if ( bCallBase )
1741*cdf0e10cSrcweir 		SfxViewShell::Notify(rBC, rHint);
1742*cdf0e10cSrcweir }
1743*cdf0e10cSrcweir 
1744*cdf0e10cSrcweir /*-----------------02.12.96 12:36-------------------
1745*cdf0e10cSrcweir 
1746*cdf0e10cSrcweir --------------------------------------------------*/
1747*cdf0e10cSrcweir #if defined WNT || defined UNX
1748*cdf0e10cSrcweir 
1749*cdf0e10cSrcweir void SwView::ScannerEventHdl( const EventObject& /*rEventObject*/ )
1750*cdf0e10cSrcweir {
1751*cdf0e10cSrcweir 	uno::Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
1752*cdf0e10cSrcweir 	if( xScanMgr.is() )
1753*cdf0e10cSrcweir 	{
1754*cdf0e10cSrcweir 		const ScannerContext	aContext( xScanMgr->getAvailableScanners().getConstArray()[ 0 ] );
1755*cdf0e10cSrcweir 		const ScanError			eError = xScanMgr->getError( aContext );
1756*cdf0e10cSrcweir 
1757*cdf0e10cSrcweir 		if( ScanError_ScanErrorNone == eError )
1758*cdf0e10cSrcweir 		{
1759*cdf0e10cSrcweir 			const uno::Reference< awt::XBitmap > xBitmap( xScanMgr->getBitmap( aContext ) );
1760*cdf0e10cSrcweir 
1761*cdf0e10cSrcweir 			if( xBitmap.is() )
1762*cdf0e10cSrcweir 			{
1763*cdf0e10cSrcweir 				const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
1764*cdf0e10cSrcweir 
1765*cdf0e10cSrcweir 				if( !!aScanBmp )
1766*cdf0e10cSrcweir 				{
1767*cdf0e10cSrcweir 					Graphic aGrf(aScanBmp);
1768*cdf0e10cSrcweir 					pWrtShell->Insert( aEmptyStr, aEmptyStr, aGrf );
1769*cdf0e10cSrcweir 				}
1770*cdf0e10cSrcweir 			}
1771*cdf0e10cSrcweir 		}
1772*cdf0e10cSrcweir 	}
1773*cdf0e10cSrcweir 	SfxBindings& rBind = GetViewFrame()->GetBindings();
1774*cdf0e10cSrcweir 	rBind.Invalidate( SID_TWAIN_SELECT );
1775*cdf0e10cSrcweir 	rBind.Invalidate( SID_TWAIN_TRANSFER );
1776*cdf0e10cSrcweir }
1777*cdf0e10cSrcweir #endif
1778*cdf0e10cSrcweir 
1779*cdf0e10cSrcweir /*-----------------04.03.97 15:07-------------------
1780*cdf0e10cSrcweir 
1781*cdf0e10cSrcweir --------------------------------------------------*/
1782*cdf0e10cSrcweir 
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir void	SwView::StopShellTimer()
1785*cdf0e10cSrcweir {
1786*cdf0e10cSrcweir 	if(aTimer.IsActive())
1787*cdf0e10cSrcweir 	{
1788*cdf0e10cSrcweir 		aTimer.Stop();
1789*cdf0e10cSrcweir 		if ( bAttrChgNotifiedWithRegistrations )
1790*cdf0e10cSrcweir 		{
1791*cdf0e10cSrcweir 			GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
1792*cdf0e10cSrcweir 			bAttrChgNotifiedWithRegistrations = sal_False;
1793*cdf0e10cSrcweir 		}
1794*cdf0e10cSrcweir 		SelectShell();
1795*cdf0e10cSrcweir 		bAttrChgNotified = sal_False;
1796*cdf0e10cSrcweir 	}
1797*cdf0e10cSrcweir }
1798*cdf0e10cSrcweir 
1799*cdf0e10cSrcweir /*-----------------09/03/97 04:12pm-----------------
1800*cdf0e10cSrcweir 
1801*cdf0e10cSrcweir --------------------------------------------------*/
1802*cdf0e10cSrcweir sal_uInt16  SwView::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
1803*cdf0e10cSrcweir {
1804*cdf0e10cSrcweir 	SfxViewFrame* pVFrame = GetViewFrame();
1805*cdf0e10cSrcweir 	pVFrame->SetChildWindow( SwInputChild::GetChildWindowId(), sal_False );
1806*cdf0e10cSrcweir     if( pVFrame->GetDispatcher()->IsLocked() )
1807*cdf0e10cSrcweir         pVFrame->GetDispatcher()->Lock(sal_False);
1808*cdf0e10cSrcweir 
1809*cdf0e10cSrcweir 	sal_uInt16 nRet;
1810*cdf0e10cSrcweir 	if ( pFormShell &&
1811*cdf0e10cSrcweir 		 sal_True != (nRet = pFormShell->PrepareClose( bUI, bForBrowsing )) )
1812*cdf0e10cSrcweir 
1813*cdf0e10cSrcweir 	{
1814*cdf0e10cSrcweir 		return nRet;
1815*cdf0e10cSrcweir 	}
1816*cdf0e10cSrcweir 	return SfxViewShell::PrepareClose( bUI, bForBrowsing );
1817*cdf0e10cSrcweir }
1818*cdf0e10cSrcweir 
1819*cdf0e10cSrcweir 
1820*cdf0e10cSrcweir 
1821*cdf0e10cSrcweir 	// status methods for clipboard.
1822*cdf0e10cSrcweir 	// Status changes now notified from the clipboard.
1823*cdf0e10cSrcweir sal_Bool SwView::IsPasteAllowed()
1824*cdf0e10cSrcweir {
1825*cdf0e10cSrcweir 	sal_uInt16 nPasteDestination = SwTransferable::GetSotDestination( *pWrtShell );
1826*cdf0e10cSrcweir 	if( nLastPasteDestination != nPasteDestination )
1827*cdf0e10cSrcweir 	{
1828*cdf0e10cSrcweir 		TransferableDataHelper aDataHelper(
1829*cdf0e10cSrcweir 						TransferableDataHelper::CreateFromSystemClipboard(
1830*cdf0e10cSrcweir 														&GetEditWin()) );
1831*cdf0e10cSrcweir 		if( aDataHelper.GetXTransferable().is() )
1832*cdf0e10cSrcweir 		{
1833*cdf0e10cSrcweir 			bPasteState = SwTransferable::IsPaste( *pWrtShell, aDataHelper );
1834*cdf0e10cSrcweir 			bPasteSpecialState = SwTransferable::IsPasteSpecial(
1835*cdf0e10cSrcweir 													*pWrtShell, aDataHelper );
1836*cdf0e10cSrcweir 		}
1837*cdf0e10cSrcweir 		else
1838*cdf0e10cSrcweir 			bPasteState = bPasteSpecialState = sal_False;
1839*cdf0e10cSrcweir 
1840*cdf0e10cSrcweir 		if( 0xFFFF == nLastPasteDestination )  // the init value
1841*cdf0e10cSrcweir 			pViewImpl->AddClipboardListener();
1842*cdf0e10cSrcweir 		nLastPasteDestination = nPasteDestination;
1843*cdf0e10cSrcweir 	}
1844*cdf0e10cSrcweir 	return bPasteState;
1845*cdf0e10cSrcweir }
1846*cdf0e10cSrcweir 
1847*cdf0e10cSrcweir sal_Bool SwView::IsPasteSpecialAllowed()
1848*cdf0e10cSrcweir {
1849*cdf0e10cSrcweir     if ( pFormShell && pFormShell->IsActiveControl() )
1850*cdf0e10cSrcweir         return sal_False;
1851*cdf0e10cSrcweir 
1852*cdf0e10cSrcweir 	sal_uInt16 nPasteDestination = SwTransferable::GetSotDestination( *pWrtShell );
1853*cdf0e10cSrcweir 	if( nLastPasteDestination != nPasteDestination )
1854*cdf0e10cSrcweir 	{
1855*cdf0e10cSrcweir 		TransferableDataHelper aDataHelper(
1856*cdf0e10cSrcweir 						TransferableDataHelper::CreateFromSystemClipboard(
1857*cdf0e10cSrcweir 														&GetEditWin()) );
1858*cdf0e10cSrcweir 		if( aDataHelper.GetXTransferable().is() )
1859*cdf0e10cSrcweir 		{
1860*cdf0e10cSrcweir 			bPasteState = SwTransferable::IsPaste( *pWrtShell, aDataHelper );
1861*cdf0e10cSrcweir 			bPasteSpecialState = SwTransferable::IsPasteSpecial(
1862*cdf0e10cSrcweir 													*pWrtShell, aDataHelper );
1863*cdf0e10cSrcweir 		}
1864*cdf0e10cSrcweir 		else
1865*cdf0e10cSrcweir 			bPasteState = bPasteSpecialState = sal_False;
1866*cdf0e10cSrcweir 
1867*cdf0e10cSrcweir 		if( 0xFFFF == nLastPasteDestination )  // the init value
1868*cdf0e10cSrcweir 			pViewImpl->AddClipboardListener();
1869*cdf0e10cSrcweir 	}
1870*cdf0e10cSrcweir 	return bPasteSpecialState;
1871*cdf0e10cSrcweir }
1872*cdf0e10cSrcweir /* -----------------------------12.07.01 13:25--------------------------------
1873*cdf0e10cSrcweir 
1874*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1875*cdf0e10cSrcweir void SwView::NotifyDBChanged()
1876*cdf0e10cSrcweir {
1877*cdf0e10cSrcweir     GetViewImpl()->GetUNOObject_Impl()->NotifyDBChanged();
1878*cdf0e10cSrcweir }
1879*cdf0e10cSrcweir 
1880*cdf0e10cSrcweir /*--------------------------------------------------------------------
1881*cdf0e10cSrcweir     Beschreibung:   Drucken
1882*cdf0e10cSrcweir  --------------------------------------------------------------------*/
1883*cdf0e10cSrcweir 
1884*cdf0e10cSrcweir /* -----------------------------28.10.02 13:25--------------------------------
1885*cdf0e10cSrcweir 
1886*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1887*cdf0e10cSrcweir SfxObjectShellLock & SwView::GetTmpSelectionDoc()
1888*cdf0e10cSrcweir {
1889*cdf0e10cSrcweir     return GetViewImpl()->GetTmpSelectionDoc();
1890*cdf0e10cSrcweir }
1891*cdf0e10cSrcweir /* -----------------------------31.10.02 13:25--------------------------------
1892*cdf0e10cSrcweir 
1893*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1894*cdf0e10cSrcweir SfxObjectShellLock & SwView::GetOrCreateTmpSelectionDoc()
1895*cdf0e10cSrcweir {
1896*cdf0e10cSrcweir     SfxObjectShellLock &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc();
1897*cdf0e10cSrcweir     if (!rxTmpDoc.Is())
1898*cdf0e10cSrcweir     {
1899*cdf0e10cSrcweir         SwXTextView *pImpl = GetViewImpl()->GetUNOObject_Impl();
1900*cdf0e10cSrcweir         rxTmpDoc = pImpl->BuildTmpSelectionDoc();
1901*cdf0e10cSrcweir     }
1902*cdf0e10cSrcweir     return rxTmpDoc;
1903*cdf0e10cSrcweir }
1904*cdf0e10cSrcweir /* -----------------3/31/2003 12:39PM----------------
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir  --------------------------------------------------*/
1907*cdf0e10cSrcweir void SwView::AddTransferable(SwTransferable& rTransferable)
1908*cdf0e10cSrcweir {
1909*cdf0e10cSrcweir     GetViewImpl()->AddTransferable(rTransferable);
1910*cdf0e10cSrcweir }
1911*cdf0e10cSrcweir 
1912*cdf0e10cSrcweir /* --------------------------------------------------*/
1913*cdf0e10cSrcweir 
1914*cdf0e10cSrcweir namespace sw {
1915*cdf0e10cSrcweir 
1916*cdf0e10cSrcweir void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb)
1917*cdf0e10cSrcweir {
1918*cdf0e10cSrcweir     o_rData = *SW_MOD()->GetPrtOptions(bWeb);
1919*cdf0e10cSrcweir }
1920*cdf0e10cSrcweir 
1921*cdf0e10cSrcweir } // namespace sw
1922*cdf0e10cSrcweir 
1923