1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 32 33 #include <hintids.hxx> 34 #include <vcl/settings.hxx> 35 #include <svx/ruler.hxx> 36 #include <viewopt.hxx> 37 #include "view.hxx" 38 #include "wrtsh.hxx" 39 #include "basesh.hxx" 40 #include "pview.hxx" 41 #include "mdiexp.hxx" 42 #include "edtwin.hxx" 43 #include "swmodule.hxx" 44 #include "modcfg.hxx" 45 #include "swtable.hxx" 46 #include "docsh.hxx" 47 #include "pagedesc.hxx" // Aktuelles Seitenformat 48 #include <frmatr.hxx> 49 #include <editeng/frmdiritem.hxx> 50 51 52 /*-------------------------------------------------------------------- 53 Beschreibung: Core-Notify 54 --------------------------------------------------------------------*/ 55 56 57 58 void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect, 59 sal_uInt16 nRangeX, sal_uInt16 nRangeY) 60 { 61 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 62 if (pSfxVwSh && pSfxVwSh->ISA(SwView)) 63 ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY ); 64 } 65 66 /*-------------------------------------------------------------------- 67 Beschreibung: Docmdi - verschiebbar 68 --------------------------------------------------------------------*/ 69 70 71 72 sal_Bool IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect ) 73 { 74 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 75 if (pSfxVwSh && pSfxVwSh->ISA(SwView)) 76 return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect())); 77 return sal_False; 78 } 79 80 /*-------------------------------------------------------------------- 81 Beschreibung: Notify fuer Groessen-Aenderung 82 --------------------------------------------------------------------*/ 83 84 85 86 void SizeNotify(ViewShell* pVwSh, const Size &rSize) 87 { 88 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 89 if (pSfxVwSh) 90 { 91 if (pSfxVwSh->ISA(SwView)) 92 ((SwView *)pSfxVwSh)->DocSzChgd(rSize); 93 else if (pSfxVwSh->ISA(SwPagePreView)) 94 ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize ); 95 } 96 } 97 98 /*-------------------------------------------------------------------- 99 Beschreibung: Notify fuer Seitenzahl-Update 100 --------------------------------------------------------------------*/ 101 102 103 104 void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, 105 const String& rPgStr) 106 { 107 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 108 if ( pSfxVwSh && pSfxVwSh->ISA(SwView) && 109 ((SwView*)pSfxVwSh)->GetCurShell() ) 110 ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr); 111 } 112 113 /****************************************************************************** 114 * Methode : void FrameNotify( DocMDIBase *pWin, FlyMode eMode ) 115 * Beschreibung: 116 * Erstellt : OK 08.02.94 13:49 117 * Aenderung : 118 ******************************************************************************/ 119 120 121 122 void FrameNotify( ViewShell* pVwSh, FlyMode eMode ) 123 { 124 if ( pVwSh->ISA(SwCrsrShell) ) 125 SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh ); 126 } 127 128 /*-------------------------------------------------------------------- 129 Beschreibung: Notify fuer Seitenzahl-Update 130 --------------------------------------------------------------------*/ 131 sal_Bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode) 132 { 133 SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal(); 134 return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) && 135 !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) && 136 !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2)); 137 } 138 139 // #i23726# 140 // --> OD 2005-02-18 #i42921# - add 3rd parameter <bVerticalMode> in order 141 // to consider vertical layout 142 sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt, 143 const bool bVerticalMode ) 144 { 145 SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal(); 146 return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT); 147 } 148 // <-- 149 150 LAYOUT_NS Dialog* GetSearchDialog() 151 { 152 return SwView::GetSearchDialog(); 153 } 154 155 TblChgMode GetTblChgDefaultMode() 156 { 157 SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig(); 158 return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS; 159 } 160 161 void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect ) 162 { 163 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 164 if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView )) 165 ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect ); 166 } 167 168 sal_Bool JumpToSwMark( ViewShell* pVwSh, const String& rMark ) 169 { 170 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 171 if( pSfxVwSh && pSfxVwSh->ISA( SwView ) ) 172 return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark ); 173 return sal_False; 174 } 175 176 void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt ) 177 { 178 Window::DataChanged( rDCEvt ); 179 180 SwWrtShell* pSh = GetView().GetWrtShellPtr(); 181 //#99906# DataChanged() is sometimes called prior to creating 182 // the SwWrtShell 183 if(!pSh) 184 return; 185 sal_Bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = sal_False; 186 pSh->LockView( sal_True ); 187 switch( rDCEvt.GetType() ) 188 { 189 case DATACHANGED_SETTINGS: 190 // ScrollBars neu anordnen bzw. Resize ausloesen, da sich 191 // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im 192 // Resize-Handler aber auch die Groesse der ScrollBars aus 193 // den Settings abgefragt werden. 194 if( rDCEvt.GetFlags() & SETTINGS_STYLE ) 195 { 196 pSh->LockPaint(); 197 bUnlockPaint = sal_True; 198 ViewShell::DeleteReplacementBitmaps(); 199 GetView().InvalidateBorder(); //Scrollbarbreiten 200 } 201 break; 202 203 case DATACHANGED_PRINTER: 204 case DATACHANGED_DISPLAY: 205 case DATACHANGED_FONTS: 206 case DATACHANGED_FONTSUBSTITUTION: 207 pSh->LockPaint(); 208 bUnlockPaint = sal_True; 209 GetView().GetDocShell()->UpdateFontList(); //z.B. Druckerwechsel 210 break; 211 } 212 pSh->LockView( bViewWasLocked ); 213 if( bUnlockPaint ) 214 pSh->UnlockPaint(); 215 } 216 217