Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <hintids.hxx>
21 : #include <vcl/settings.hxx>
22 : #include <svx/ruler.hxx>
23 : #include <viewopt.hxx>
24 : #include "view.hxx"
25 : #include "wrtsh.hxx"
26 : #include "basesh.hxx"
27 : #include "pview.hxx"
28 : #include "mdiexp.hxx"
29 : #include "edtwin.hxx"
30 : #include "swmodule.hxx"
31 : #include "modcfg.hxx"
32 : #include "swtable.hxx"
33 : #include "docsh.hxx"
34 : #include "pagedesc.hxx" // Aktuelles Seitenformat
35 : #include <frmatr.hxx>
36 : #include <editeng/frmdiritem.hxx>
37 :
38 :
39 :
40 : // Core-Notify
41 410 : void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect,
42 : sal_uInt16 nRangeX, sal_uInt16 nRangeY)
43 : {
44 410 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
45 410 : if (pSfxVwSh && pSfxVwSh->ISA(SwView))
46 410 : ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
47 410 : }
48 :
49 : // Docmdi - movable
50 14446 : sal_Bool IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect )
51 : {
52 14446 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
53 14446 : if (pSfxVwSh && pSfxVwSh->ISA(SwView))
54 14446 : return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect()));
55 0 : return sal_False;
56 : }
57 :
58 : // Notify for size change
59 1773 : void SizeNotify(ViewShell* pVwSh, const Size &rSize)
60 : {
61 1773 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
62 1773 : if (pSfxVwSh)
63 : {
64 94 : if (pSfxVwSh->ISA(SwView))
65 94 : ((SwView *)pSfxVwSh)->DocSzChgd(rSize);
66 0 : else if (pSfxVwSh->ISA(SwPagePreView))
67 0 : ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize );
68 : }
69 1773 : }
70 :
71 : // Notify for page number update
72 96 : void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
73 : const OUString& rPgStr)
74 : {
75 96 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
76 192 : if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
77 96 : ((SwView*)pSfxVwSh)->GetCurShell() )
78 79 : ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
79 96 : }
80 :
81 0 : void FrameNotify( ViewShell* pVwSh, FlyMode eMode )
82 : {
83 0 : if ( pVwSh->ISA(SwCrsrShell) )
84 0 : SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh );
85 0 : }
86 :
87 : // Notify for page number update
88 0 : sal_Bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode)
89 : {
90 0 : SvxRuler& rRuler = bVerticalMode ? m_rView.GetVRuler() : m_rView.GetHRuler();
91 0 : return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) &&
92 0 : !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) &&
93 0 : !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2));
94 : }
95 :
96 : // #i23726#
97 : // #i42921# - add 3rd parameter <bVerticalMode> in order
98 : // to consider vertical layout
99 0 : sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
100 : const bool bVerticalMode )
101 : {
102 0 : SvxRuler& rRuler = bVerticalMode ? m_rView.GetVRuler() : m_rView.GetHRuler();
103 0 : return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
104 : }
105 :
106 0 : Dialog* GetSearchDialog()
107 : {
108 0 : return SwView::GetSearchDialog();
109 : }
110 :
111 189 : TblChgMode GetTblChgDefaultMode()
112 : {
113 189 : SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
114 189 : return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS;
115 : }
116 :
117 0 : void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect )
118 : {
119 0 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
120 0 : if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView ))
121 0 : ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect );
122 0 : }
123 :
124 0 : bool JumpToSwMark( ViewShell* pVwSh, const OUString& rMark )
125 : {
126 0 : SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
127 0 : if( pSfxVwSh && pSfxVwSh->ISA( SwView ) )
128 0 : return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark );
129 0 : return false;
130 : }
131 :
132 4 : void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
133 : {
134 4 : Window::DataChanged( rDCEvt );
135 :
136 4 : SwWrtShell* pSh = GetView().GetWrtShellPtr();
137 : // DataChanged() is sometimes called prior to creating
138 : // the SwWrtShell
139 4 : if(!pSh)
140 4 : return;
141 4 : sal_Bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = sal_False;
142 4 : pSh->LockView( sal_True );
143 4 : switch( rDCEvt.GetType() )
144 : {
145 : case DATACHANGED_SETTINGS:
146 : // rearrange ScrollBars, respectively trigger resize, because
147 : // the ScrollBar size can have change. For that, in the reset
148 : // handler, the size of the ScrollBars also has to be queried
149 : // from the settings.
150 4 : if( rDCEvt.GetFlags() & SETTINGS_STYLE )
151 : {
152 0 : pSh->LockPaint();
153 0 : bUnlockPaint = sal_True;
154 0 : ViewShell::DeleteReplacementBitmaps();
155 0 : GetView().InvalidateBorder(); //Scrollbar work
156 : }
157 4 : break;
158 :
159 : case DATACHANGED_PRINTER:
160 : case DATACHANGED_DISPLAY:
161 : case DATACHANGED_FONTS:
162 : case DATACHANGED_FONTSUBSTITUTION:
163 0 : pSh->LockPaint();
164 0 : bUnlockPaint = sal_True;
165 0 : GetView().GetDocShell()->UpdateFontList(); //e.g. printer change
166 0 : break;
167 : }
168 4 : pSh->LockView( bViewWasLocked );
169 4 : if( bUnlockPaint )
170 0 : pSh->UnlockPaint();
171 99 : }
172 :
173 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|