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