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