1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: edtwin3.cxx,v $
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>
46 #include "swmodule.hxx"
48 #include "swtable.hxx"
50 #include "pagedesc.hxx" // Aktuelles Seitenformat
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()));
83 /*--------------------------------------------------------------------
84 Beschreibung: Notify fuer Groessen-Aenderung
85 --------------------------------------------------------------------*/
89 void SizeNotify(ViewShell
* pVwSh
, const Size
&rSize
)
91 SfxViewShell
*pSfxVwSh
= pVwSh
->GetSfxViewShell();
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 )
119 * Erstellt : OK 08.02.94 13:49
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
));
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
);
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
);
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
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
)
201 ViewShell::DeleteReplacementBitmaps();
202 GetView().InvalidateBorder(); //Scrollbarbreiten
206 case DATACHANGED_PRINTER
:
207 case DATACHANGED_DISPLAY
:
208 case DATACHANGED_FONTS
:
209 case DATACHANGED_FONTSUBSTITUTION
:
212 GetView().GetDocShell()->UpdateFontList(); //z.B. Druckerwechsel
215 pSh
->LockView( bViewWasLocked
);