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