xref: /AOO42X/main/sw/source/ui/docvw/edtwin3.cxx (revision e6c3383982593f62c175312992edcb7926eb63f7)
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 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <hintids.hxx>
26cdf0e10cSrcweir #include <vcl/settings.hxx>
27cdf0e10cSrcweir #include <svx/ruler.hxx>
28cdf0e10cSrcweir #include <viewopt.hxx>
29cdf0e10cSrcweir #include "view.hxx"
30cdf0e10cSrcweir #include "wrtsh.hxx"
31cdf0e10cSrcweir #include "basesh.hxx"
32cdf0e10cSrcweir #include "pview.hxx"
33cdf0e10cSrcweir #include "mdiexp.hxx"
34cdf0e10cSrcweir #include "edtwin.hxx"
35cdf0e10cSrcweir #include "swmodule.hxx"
36cdf0e10cSrcweir #include "modcfg.hxx"
37cdf0e10cSrcweir #include "swtable.hxx"
38cdf0e10cSrcweir #include "docsh.hxx"
39cdf0e10cSrcweir #include "pagedesc.hxx"     // Aktuelles Seitenformat
40cdf0e10cSrcweir #include <frmatr.hxx>
41cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /*--------------------------------------------------------------------
44cdf0e10cSrcweir     Beschreibung:   Core-Notify
45cdf0e10cSrcweir  --------------------------------------------------------------------*/
46cdf0e10cSrcweir 
ScrollMDI(ViewShell * pVwSh,const SwRect & rRect,sal_uInt16 nRangeX,sal_uInt16 nRangeY)47cdf0e10cSrcweir void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect,
48cdf0e10cSrcweir                 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
51cdf0e10cSrcweir     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
52cdf0e10cSrcweir         ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir /*--------------------------------------------------------------------
56cdf0e10cSrcweir     Beschreibung:   Docmdi - verschiebbar
57cdf0e10cSrcweir  --------------------------------------------------------------------*/
58cdf0e10cSrcweir 
IsScrollMDI(ViewShell * pVwSh,const SwRect & rRect)59cdf0e10cSrcweir sal_Bool IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
62cdf0e10cSrcweir     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
63cdf0e10cSrcweir         return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect()));
64cdf0e10cSrcweir     return sal_False;
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir /*--------------------------------------------------------------------
68cdf0e10cSrcweir     Beschreibung:   Notify fuer Groessen-Aenderung
69cdf0e10cSrcweir  --------------------------------------------------------------------*/
70cdf0e10cSrcweir 
SizeNotify(ViewShell * pVwSh,const Size & rSize)71cdf0e10cSrcweir void SizeNotify(ViewShell* pVwSh, const Size &rSize)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
74cdf0e10cSrcweir     if (pSfxVwSh)
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         if (pSfxVwSh->ISA(SwView))
77cdf0e10cSrcweir             ((SwView *)pSfxVwSh)->DocSzChgd(rSize);
78cdf0e10cSrcweir         else if (pSfxVwSh->ISA(SwPagePreView))
79cdf0e10cSrcweir             ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize );
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir /*--------------------------------------------------------------------
84cdf0e10cSrcweir     Beschreibung:   Notify fuer Seitenzahl-Update
85cdf0e10cSrcweir  --------------------------------------------------------------------*/
86cdf0e10cSrcweir 
PageNumNotify(ViewShell * pVwSh,sal_uInt16 nPhyNum,sal_uInt16 nVirtNum,const String & rPgStr)87cdf0e10cSrcweir void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
88cdf0e10cSrcweir                                                     const String& rPgStr)
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
91cdf0e10cSrcweir     if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
92cdf0e10cSrcweir          ((SwView*)pSfxVwSh)->GetCurShell() )
93cdf0e10cSrcweir             ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir /******************************************************************************
97cdf0e10cSrcweir  *  Methode     :   void FrameNotify( DocMDIBase *pWin, FlyMode eMode )
98cdf0e10cSrcweir  *  Beschreibung:
99cdf0e10cSrcweir  *  Erstellt    :   OK 08.02.94 13:49
100cdf0e10cSrcweir  *  Aenderung   :
101cdf0e10cSrcweir  ******************************************************************************/
102cdf0e10cSrcweir 
FrameNotify(ViewShell * pVwSh,FlyMode eMode)103cdf0e10cSrcweir void FrameNotify( ViewShell* pVwSh, FlyMode eMode )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     if ( pVwSh->ISA(SwCrsrShell) )
106cdf0e10cSrcweir         SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir /*--------------------------------------------------------------------
110cdf0e10cSrcweir     Beschreibung:   Notify fuer Seitenzahl-Update
111cdf0e10cSrcweir  --------------------------------------------------------------------*/
RulerColumnDrag(const MouseEvent & rMEvt,sal_Bool bVerticalMode)112cdf0e10cSrcweir sal_Bool SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode)
113cdf0e10cSrcweir {
114*e6c33839Smseidel     SvxRuler& rRuler = bVerticalMode ?  rView.GetVRuler() : rView.GetHRuler();
115cdf0e10cSrcweir     return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) &&
116cdf0e10cSrcweir             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) &&
117cdf0e10cSrcweir             !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2));
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir // #i23726#
121cdf0e10cSrcweir // --> OD 2005-02-18 #i42921# - add 3rd parameter <bVerticalMode> in order
122cdf0e10cSrcweir // to consider vertical layout
RulerMarginDrag(const MouseEvent & rMEvt,const bool bVerticalMode)123cdf0e10cSrcweir sal_Bool SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
124cdf0e10cSrcweir                                  const bool bVerticalMode )
125cdf0e10cSrcweir {
126*e6c33839Smseidel     SvxRuler& rRuler = bVerticalMode ?  rView.GetVRuler() : rView.GetHRuler();
127cdf0e10cSrcweir     return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
128cdf0e10cSrcweir }
129cdf0e10cSrcweir // <--
AccessibilityScrollMDI(ViewShell * pVwSh,const SwRect & rRect,sal_uInt16 nRangeX,sal_uInt16 nRangeY,sal_Bool isLeftTop)130ca62e2c2SSteve Yin void AccessibilityScrollMDI(ViewShell* pVwSh, const SwRect& rRect , sal_uInt16 nRangeX, sal_uInt16 nRangeY, sal_Bool isLeftTop)
131ca62e2c2SSteve Yin {
132ca62e2c2SSteve Yin     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
133ca62e2c2SSteve Yin     if (pSfxVwSh && pSfxVwSh->ISA(SwView))
134ca62e2c2SSteve Yin     {
135ca62e2c2SSteve Yin         SwView* pView = (SwView *)pSfxVwSh;
136ca62e2c2SSteve Yin 
137ca62e2c2SSteve Yin         Size aSz( rRect.Left(), rRect.Top());
138ca62e2c2SSteve Yin         aSz = pView->GetEditWin().PixelToLogic( aSz );
139ca62e2c2SSteve Yin 
140ca62e2c2SSteve Yin         Point aTopLeft( aSz.Width(), aSz.Height() );
141ca62e2c2SSteve Yin         Point aPoint;
142ca62e2c2SSteve Yin         Rectangle aRect(aTopLeft,aPoint);
143ca62e2c2SSteve Yin 
144ca62e2c2SSteve Yin         sal_Bool bIsCrsrAtTop = pView->IsCrsrAtTop();
145ca62e2c2SSteve Yin         sal_Bool bIsCrsrAtCenter = pView->IsCrsrAtCenter();
146ca62e2c2SSteve Yin         if(isLeftTop)
147ca62e2c2SSteve Yin             pView->SetCrsrAtTop(sal_True);
148ca62e2c2SSteve Yin 
149ca62e2c2SSteve Yin         pView->Scroll( aRect, nRangeX, nRangeY );
150ca62e2c2SSteve Yin 
151ca62e2c2SSteve Yin         if(isLeftTop)
152ca62e2c2SSteve Yin             pView->SetCrsrAtTop(bIsCrsrAtTop, bIsCrsrAtCenter);
153ca62e2c2SSteve Yin     }
154ca62e2c2SSteve Yin 
155ca62e2c2SSteve Yin }
156cdf0e10cSrcweir 
GetSearchDialog()157cdf0e10cSrcweir LAYOUT_NS Dialog* GetSearchDialog()
158cdf0e10cSrcweir {
159cdf0e10cSrcweir     return SwView::GetSearchDialog();
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
GetTblChgDefaultMode()162cdf0e10cSrcweir TblChgMode GetTblChgDefaultMode()
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
165cdf0e10cSrcweir     return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
RepaintPagePreview(ViewShell * pVwSh,const SwRect & rRect)168cdf0e10cSrcweir void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
171cdf0e10cSrcweir     if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView ))
172cdf0e10cSrcweir         ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect );
173cdf0e10cSrcweir }
174cdf0e10cSrcweir 
JumpToSwMark(ViewShell * pVwSh,const String & rMark)175cdf0e10cSrcweir sal_Bool JumpToSwMark( ViewShell* pVwSh, const String& rMark )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir     SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
178cdf0e10cSrcweir     if( pSfxVwSh && pSfxVwSh->ISA( SwView ) )
179cdf0e10cSrcweir         return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark );
180cdf0e10cSrcweir     return sal_False;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)183cdf0e10cSrcweir void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
184cdf0e10cSrcweir {
185cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     SwWrtShell* pSh = GetView().GetWrtShellPtr();
188cdf0e10cSrcweir     //#99906#   DataChanged() is sometimes called prior to creating
189cdf0e10cSrcweir     //          the SwWrtShell
190cdf0e10cSrcweir     if(!pSh)
191cdf0e10cSrcweir         return;
192cdf0e10cSrcweir     sal_Bool bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = sal_False;
193cdf0e10cSrcweir     pSh->LockView( sal_True );
194cdf0e10cSrcweir     switch( rDCEvt.GetType() )
195cdf0e10cSrcweir     {
196cdf0e10cSrcweir     case DATACHANGED_SETTINGS:
197*e6c33839Smseidel         // ScrollBars neu anordnen bzw. Resize auslösen, da sich
198cdf0e10cSrcweir         // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
199cdf0e10cSrcweir         // Resize-Handler aber auch die Groesse der ScrollBars aus
200cdf0e10cSrcweir         // den Settings abgefragt werden.
201cdf0e10cSrcweir         if( rDCEvt.GetFlags() & SETTINGS_STYLE )
202cdf0e10cSrcweir         {
203cdf0e10cSrcweir             pSh->LockPaint();
204cdf0e10cSrcweir             bUnlockPaint = sal_True;
205cdf0e10cSrcweir             ViewShell::DeleteReplacementBitmaps();
206cdf0e10cSrcweir             GetView().InvalidateBorder();               //Scrollbarbreiten
207cdf0e10cSrcweir         }
208cdf0e10cSrcweir         break;
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     case DATACHANGED_PRINTER:
211cdf0e10cSrcweir     case DATACHANGED_DISPLAY:
212cdf0e10cSrcweir     case DATACHANGED_FONTS:
213cdf0e10cSrcweir     case DATACHANGED_FONTSUBSTITUTION:
214cdf0e10cSrcweir         pSh->LockPaint();
215cdf0e10cSrcweir         bUnlockPaint = sal_True;
216cdf0e10cSrcweir         GetView().GetDocShell()->UpdateFontList(); // z.B. Druckerwechsel
217cdf0e10cSrcweir         break;
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir     pSh->LockView( bViewWasLocked );
220cdf0e10cSrcweir     if( bUnlockPaint )
221cdf0e10cSrcweir         pSh->UnlockPaint();
222cdf0e10cSrcweir }
223*e6c33839Smseidel 
224*e6c33839Smseidel /* vim: set noet sw=4 ts=4: */
225