1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sw.hxx" 26 27 28 29 #include <hintids.hxx> 30 #include <vcl/settings.hxx> 31 #include <svx/ruler.hxx> 32 #include <viewopt.hxx> 33 #include "view.hxx" 34 #include "wrtsh.hxx" 35 #include "basesh.hxx" 36 #include "pview.hxx" 37 #include "mdiexp.hxx" 38 #include "edtwin.hxx" 39 #include "swmodule.hxx" 40 #include "modcfg.hxx" 41 #include "swtable.hxx" 42 #include "docsh.hxx" 43 #include "pagedesc.hxx" // Aktuelles Seitenformat 44 #include <frmatr.hxx> 45 #include <editeng/frmdiritem.hxx> 46 47 48 /*-------------------------------------------------------------------- 49 Beschreibung: Core-Notify 50 --------------------------------------------------------------------*/ 51 52 53 54 void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect, 55 sal_uInt16 nRangeX, sal_uInt16 nRangeY) 56 { 57 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 58 if (pSfxVwSh && pSfxVwSh->ISA(SwView)) 59 ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY ); 60 } 61 62 /*-------------------------------------------------------------------- 63 Beschreibung: Docmdi - verschiebbar 64 --------------------------------------------------------------------*/ 65 66 67 68 sal_Bool IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect ) 69 { 70 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 71 if (pSfxVwSh && pSfxVwSh->ISA(SwView)) 72 return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect())); 73 return sal_False; 74 } 75 76 /*-------------------------------------------------------------------- 77 Beschreibung: Notify fuer Groessen-Aenderung 78 --------------------------------------------------------------------*/ 79 80 81 82 void SizeNotify(ViewShell* pVwSh, const Size &rSize) 83 { 84 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 85 if (pSfxVwSh) 86 { 87 if (pSfxVwSh->ISA(SwView)) 88 ((SwView *)pSfxVwSh)->DocSzChgd(rSize); 89 else if (pSfxVwSh->ISA(SwPagePreView)) 90 ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize ); 91 } 92 } 93 94 /*-------------------------------------------------------------------- 95 Beschreibung: Notify fuer Seitenzahl-Update 96 --------------------------------------------------------------------*/ 97 98 99 100 void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, 101 const String& rPgStr) 102 { 103 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 104 if ( pSfxVwSh && pSfxVwSh->ISA(SwView) && 105 ((SwView*)pSfxVwSh)->GetCurShell() ) 106 ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr); 107 } 108 109 /****************************************************************************** 110 * Methode : void FrameNotify( DocMDIBase *pWin, FlyMode eMode ) 111 * Beschreibung: 112 * Erstellt : OK 08.02.94 13:49 113 * Aenderung : 114 ******************************************************************************/ 115 116 117 118 void FrameNotify( ViewShell* pVwSh, FlyMode eMode ) 119 { 120 if ( pVwSh->ISA(SwCrsrShell) ) 121 SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh ); 122 } 123 124 /*-------------------------------------------------------------------- 125 Beschreibung: Notify fuer Seitenzahl-Update 126 --------------------------------------------------------------------*/ 127 sal_Bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode) 128 { 129 SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal(); 130 return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) && 131 !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) && 132 !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2)); 133 } 134 135 // #i23726# 136 // --> OD 2005-02-18 #i42921# - add 3rd parameter <bVerticalMode> in order 137 // to consider vertical layout 138 sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt, 139 const bool bVerticalMode ) 140 { 141 SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal(); 142 return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT); 143 } 144 // <-- 145 146 LAYOUT_NS Dialog* GetSearchDialog() 147 { 148 return SwView::GetSearchDialog(); 149 } 150 151 TblChgMode GetTblChgDefaultMode() 152 { 153 SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig(); 154 return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS; 155 } 156 157 void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect ) 158 { 159 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 160 if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView )) 161 ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect ); 162 } 163 164 sal_Bool JumpToSwMark( ViewShell* pVwSh, const String& rMark ) 165 { 166 SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell(); 167 if( pSfxVwSh && pSfxVwSh->ISA( SwView ) ) 168 return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark ); 169 return sal_False; 170 } 171 172 void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt ) 173 { 174 Window::DataChanged( rDCEvt ); 175 176 SwWrtShell* pSh = GetView().GetWrtShellPtr(); 177 //#99906# DataChanged() is sometimes called prior to creating 178 // the SwWrtShell 179 if(!pSh) 180 return; 181 sal_Bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = sal_False; 182 pSh->LockView( sal_True ); 183 switch( rDCEvt.GetType() ) 184 { 185 case DATACHANGED_SETTINGS: 186 // ScrollBars neu anordnen bzw. Resize ausloesen, da sich 187 // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im 188 // Resize-Handler aber auch die Groesse der ScrollBars aus 189 // den Settings abgefragt werden. 190 if( rDCEvt.GetFlags() & SETTINGS_STYLE ) 191 { 192 pSh->LockPaint(); 193 bUnlockPaint = sal_True; 194 ViewShell::DeleteReplacementBitmaps(); 195 GetView().InvalidateBorder(); //Scrollbarbreiten 196 } 197 break; 198 199 case DATACHANGED_PRINTER: 200 case DATACHANGED_DISPLAY: 201 case DATACHANGED_FONTS: 202 case DATACHANGED_FONTSUBSTITUTION: 203 pSh->LockPaint(); 204 bUnlockPaint = sal_True; 205 GetView().GetDocShell()->UpdateFontList(); //z.B. Druckerwechsel 206 break; 207 } 208 pSh->LockView( bViewWasLocked ); 209 if( bUnlockPaint ) 210 pSh->UnlockPaint(); 211 } 212 213