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