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: fupoor.cxx,v $
10 * $Revision: 1.50.74.1 $
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_sd.hxx"
37 #include <svx/svxids.hrc>
38 #include <svtools/aeitem.hxx>
39 #include <svx/svdpagv.hxx>
40 #include <svx/svdoole2.hxx>
41 #include <svx/svdograf.hxx>
42 #include <vcl/seleng.hxx>
43 #include <sfx2/app.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <sfx2/bindings.hxx>
46 #include <sfx2/request.hxx>
47 #include <vcl/dialog.hxx>
48 #include <com/sun/star/beans/XPropertySet.hpp>
49 #include <com/sun/star/drawing/XLayer.hpp>
50 #include <com/sun/star/drawing/XLayerManager.hpp>
51 #include <com/sun/star/container/XChild.hpp>
52 #include <com/sun/star/embed/EmbedVerbs.hpp>
54 #ifndef SD_FRAMW_VIEW_HXX
55 #include "FrameView.hxx"
60 #include "drawview.hxx"
61 #include "DrawViewShell.hxx"
62 #ifndef SD_WINDOW_SHELL_HXX
65 #include "drawdoc.hxx"
66 #include "DrawDocShell.hxx"
67 #include "zoomlist.hxx"
69 #include "slideshow.hxx"
70 #include "LayerTabBar.hxx"
72 #include <sfx2/viewfrm.hxx>
75 #include <svx/svditer.hxx>
78 #include <svx/editeng.hxx>
80 using namespace ::com::sun::star
;
81 using ::com::sun::star::uno::Reference
;
87 /*************************************************************************
91 \************************************************************************/
97 SdDrawDocument
* pDrDoc
,
100 mpViewShell(pViewSh
),
102 mpDocSh( pDrDoc
->GetDocSh() ),
104 nSlotId( rReq
.GetSlot() ),
107 bIsInDragMode(FALSE
),
108 bNoScrollUntilInside (TRUE
),
110 bDelayActive (FALSE
),
111 // #95491# remember MouseButton state
114 ReceiveRequest(rReq
);
116 aScrollTimer
.SetTimeoutHdl( LINK(this, FuPoor
, ScrollHdl
) );
117 aScrollTimer
.SetTimeout(SELENG_AUTOREPEAT_INTERVAL
);
119 aDragTimer
.SetTimeoutHdl( LINK(this, FuPoor
, DragHdl
) );
120 aDragTimer
.SetTimeout(SELENG_DRAGDROP_TIMEOUT
);
122 aDelayToScrollTimer
.SetTimeoutHdl( LINK(this, FuPoor
, DelayHdl
) );
123 aDelayToScrollTimer
.SetTimeout(2000);
126 /*************************************************************************
130 \************************************************************************/
136 aDelayToScrollTimer
.Stop ();
142 /*************************************************************************
144 |* Function aktivieren
146 \************************************************************************/
148 void FuPoor::Activate()
156 /*************************************************************************
158 |* Function deaktivieren
160 \************************************************************************/
162 void FuPoor::Deactivate()
166 aDelayToScrollTimer
.Stop ();
168 bDelayActive
= FALSE
;
175 if (mpWindow
) mpWindow
->ReleaseMouse ();
178 /*************************************************************************
180 |* Scrollen bei Erreichen des Fensterrandes; wird von
181 |* MouseMove aufgerufen
183 \************************************************************************/
185 void FuPoor::ForceScroll(const Point
& aPixPos
)
189 if ( !mpView
->IsDragHelpLine() && !mpView
->IsSetPageOrg() &&
190 !SlideShow::IsRunning( mpViewShell
->GetViewShellBase() ) )
192 /* Size aSize = mpWindow->GetSizePixel();
193 short dx = 0, dy = 0;
195 if ( aPixPos.X() <= 0 ) dx = -1;
196 if ( aPixPos.X() >= aSize.Width() ) dx = 1;
197 if ( aPixPos.Y() <= 0 ) dy = -1;
198 if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
200 Point aPos
= mpWindow
->OutputToScreenPixel(aPixPos
);
201 const Rectangle
& rRect
= mpViewShell
->GetAllWindowRect();
203 if ( bNoScrollUntilInside
)
205 if ( rRect
.IsInside(aPos
) )
206 bNoScrollUntilInside
= FALSE
;
210 short dx
= 0, dy
= 0;
212 if ( aPos
.X() <= rRect
.Left() ) dx
= -1;
213 if ( aPos
.X() >= rRect
.Right() ) dx
= 1;
214 if ( aPos
.Y() <= rRect
.Top() ) dy
= -1;
215 if ( aPos
.Y() >= rRect
.Bottom() ) dy
= 1;
217 if ( dx
!= 0 || dy
!= 0 )
221 // Scrollaktion in abgeleiteter Klasse
223 mpViewShell
->ScrollLines(dx
, dy
);
225 aScrollTimer
.Start();
227 else if (! bDelayActive
) StartDelayToScrollTimer ();
233 /*************************************************************************
235 |* Timer-Handler fuer Fensterscrolling
237 \************************************************************************/
239 IMPL_LINK_INLINE_START( FuPoor
, ScrollHdl
, Timer
*, EMPTYARG
)
241 Point
aPnt(mpWindow
->GetPointerPosPixel());
243 // #95491# use remembered MouseButton state to create correct
244 // MouseEvents for this artifical MouseMove.
245 MouseMove(MouseEvent(aPnt
, 1, 0, GetMouseButtonCode()));
249 IMPL_LINK_INLINE_END( FuPoor
, ScrollHdl
, Timer
*, pTimer
)
251 /*************************************************************************
253 |* String in Applikations-Statuszeile ausgeben
255 \************************************************************************/
257 void FuPoor::WriteStatus(const String
& )
261 /*************************************************************************
263 |* Tastaturereignisse bearbeiten
265 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
268 \************************************************************************/
270 BOOL
FuPoor::KeyInput(const KeyEvent
& rKEvt
)
272 USHORT nCode
= rKEvt
.GetKeyCode().GetCode();
273 BOOL bReturn
= FALSE
;
274 BOOL bSlideShow
= SlideShow::IsRunning( mpViewShell
->GetViewShellBase() );
281 if(rKEvt
.GetKeyCode().IsMod1())
283 if(mpViewShell
&& mpViewShell
->ISA(DrawViewShell
))
285 DrawViewShell
* pDrawViewShell
=
286 static_cast<DrawViewShell
*>(mpViewShell
);
287 SdPage
* pActualPage
= pDrawViewShell
->GetActualPage();
288 SdrTextObj
* pCandidate
= 0L;
292 SdrObjListIter
aIter(*pActualPage
, IM_DEEPNOGROUPS
);
294 while(aIter
.IsMore() && !pCandidate
)
296 SdrObject
* pObj
= aIter
.Next();
298 if(pObj
&& pObj
->ISA(SdrTextObj
))
300 sal_uInt32
nInv(pObj
->GetObjInventor());
301 sal_uInt16
nKnd(pObj
->GetObjIdentifier());
303 if(SdrInventor
== nInv
&&
304 (OBJ_TITLETEXT
== nKnd
|| OBJ_OUTLINETEXT
== nKnd
|| OBJ_TEXT
== nKnd
))
306 pCandidate
= (SdrTextObj
*)pObj
;
315 mpView
->MarkObj(pCandidate
, mpView
->GetSdrPageView());
317 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute(
318 SID_ATTR_CHAR
, SFX_CALLMODE_ASYNCHRON
);
322 // insert a new page with the same page layout
323 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute(
324 SID_INSERTPAGE_QUICK
, SFX_CALLMODE_ASYNCHRON
);
333 // #98255# activate OLE object on RETURN for selected object
334 // #98198# activate text edit on RETURN for selected object
335 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
337 if( !mpView
->IsTextEdit() && 1 == rMarkList
.GetMarkCount() )
339 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
341 if( pObj
&& pObj
->ISA( SdrOle2Obj
) && !mpDocSh
->IsUIActive() )
343 if(rKEvt
.GetKeyCode().IsShift())
344 mpViewShell
->ActivateObject( static_cast< SdrOle2Obj
* >( pObj
),
345 embed::EmbedVerbs::MS_OLEVERB_OPEN
);
347 mpViewShell
->ActivateObject( static_cast< SdrOle2Obj
* >( pObj
),
348 embed::EmbedVerbs::MS_OLEVERB_PRIMARY
);
350 else if( pObj
&& pObj
->IsEmptyPresObj() && pObj
->ISA( SdrGrafObj
) )
352 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_GRAPHIC
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
356 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_CHAR
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
369 // #98994# handle Mod1 and Mod2 to get travelling running on different systems
370 if(rKEvt
.GetKeyCode().IsMod1() || rKEvt
.GetKeyCode().IsMod2())
372 // #97016# II do something with a selected handle?
373 const SdrHdlList
& rHdlList
= mpView
->GetHdlList();
374 sal_Bool
bForward(!rKEvt
.GetKeyCode().IsShift());
376 ((SdrHdlList
&)rHdlList
).TravelFocusHdl(bForward
);
378 // guarantee visibility of focused handle
379 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
383 Point
aHdlPosition(pHdl
->GetPos());
384 Rectangle
aVisRect(aHdlPosition
- Point(100, 100), Size(200, 200));
385 mpView
->MakeVisible(aVisRect
, *mpWindow
);
396 bReturn
= FuPoor::cancel();
402 if (!mpView
->IsTextEdit() && !bSlideShow
&& !mpDocSh
->IsUIActive())
405 mpViewShell
->SetZoom(mpWindow
->GetZoom() * 3 / 2);
407 if (mpViewShell
->ISA(DrawViewShell
))
408 static_cast<DrawViewShell
*>(mpViewShell
)
409 ->SetZoomOnPage(FALSE
);
418 if (!mpView
->IsTextEdit() && !bSlideShow
&& !mpDocSh
->IsUIActive())
421 mpViewShell
->SetZoom(mpWindow
->GetZoom() * 2 / 3);
423 if (mpViewShell
->ISA(DrawViewShell
))
424 static_cast<DrawViewShell
*>(mpViewShell
)
425 ->SetZoomOnPage(FALSE
);
434 if (!mpView
->IsTextEdit() && !bSlideShow
)
437 mpViewShell
->GetViewFrame()->GetDispatcher()->
438 Execute(SID_SIZE_PAGE
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
446 if (!mpView
->IsTextEdit() && !bSlideShow
)
448 // Zoom auf selektierte Objekte
449 mpViewShell
->GetViewFrame()->GetDispatcher()->
450 Execute(SID_SIZE_OPTIMAL
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
458 ZoomList
* pZoomList
= mpViewShell
->GetZoomList();
460 if (!mpView
->IsTextEdit() && pZoomList
->IsNextPossible() && !bSlideShow
&& !mpDocSh
->IsUIActive())
462 // Naechstes ZoomRect einstellen
463 mpViewShell
->SetZoomRect(pZoomList
->GetNextZoomRect());
471 ZoomList
* pZoomList
= mpViewShell
->GetZoomList();
473 if (!mpView
->IsTextEdit() && pZoomList
->IsPreviousPossible() && !bSlideShow
&& !mpDocSh
->IsUIActive())
475 // Vorheriges ZoomRect einstellen
476 mpViewShell
->SetZoomRect(pZoomList
->GetPreviousZoomRect());
484 if (!mpView
->IsTextEdit()
485 && mpViewShell
->ISA(DrawViewShell
)
488 // Sprung zu erster Seite
489 static_cast<DrawViewShell
*>(mpViewShell
)->SwitchPage(0);
497 if (!mpView
->IsTextEdit()
498 && mpViewShell
->ISA(DrawViewShell
)
501 // Sprung zu letzter Seite
503 static_cast<DrawViewShell
*>(mpViewShell
)->GetActualPage();
504 static_cast<DrawViewShell
*>(mpViewShell
)
505 ->SwitchPage(mpDoc
->GetSdPageCount(
506 pPage
->GetPageKind()) - 1);
514 if(mpViewShell
->ISA(DrawViewShell
) && !bSlideShow
)
516 // The page-up key switches layers or pages depending on the
518 if ( ! rKEvt
.GetKeyCode().GetAllModifier())
520 // With no modifier pressed we move to the previous
522 mpView
->SdrEndTextEdit();
526 SdPage
* pPage
= static_cast<DrawViewShell
*>(mpViewShell
)->GetActualPage();
527 USHORT nSdPage
= (pPage
->GetPageNum() - 1) / 2;
531 // Switch the page and send events regarding
532 // deactivation the old page and activating the new
534 TabControl
* pPageTabControl
=
535 static_cast<DrawViewShell
*>(mpViewShell
)
536 ->GetPageTabControl();
537 if (pPageTabControl
->IsReallyShown())
538 pPageTabControl
->SendDeactivatePageEvent ();
539 static_cast<DrawViewShell
*>(mpViewShell
)->SwitchPage(nSdPage
- 1);
540 if (pPageTabControl
->IsReallyShown())
541 pPageTabControl
->SendActivatePageEvent ();
544 else if (rKEvt
.GetKeyCode().IsMod1())
546 // With the CONTROL modifier we switch layers.
547 if (static_cast<DrawViewShell
*>(mpViewShell
)->IsLayerModeActive())
549 // Moves to the previous layer.
559 if(mpViewShell
->ISA(DrawViewShell
) && !bSlideShow
)
561 // The page-down key switches layers or pages depending on the
563 if ( ! rKEvt
.GetKeyCode().GetAllModifier())
565 // With no modifier pressed we move to the next slide.
566 mpView
->SdrEndTextEdit();
570 SdPage
* pPage
= static_cast<DrawViewShell
*>(mpViewShell
)->GetActualPage();
571 USHORT nSdPage
= (pPage
->GetPageNum() - 1) / 2;
573 if (nSdPage
< mpDoc
->GetSdPageCount(pPage
->GetPageKind()) - 1)
575 // Switch the page and send events regarding
576 // deactivation the old page and activating the new
578 TabControl
* pPageTabControl
=
579 static_cast<DrawViewShell
*>(mpViewShell
)->GetPageTabControl();
580 if (pPageTabControl
->IsReallyShown())
581 pPageTabControl
->SendDeactivatePageEvent ();
582 static_cast<DrawViewShell
*>(mpViewShell
)->SwitchPage(nSdPage
+ 1);
583 if (pPageTabControl
->IsReallyShown())
584 pPageTabControl
->SendActivatePageEvent ();
587 else if (rKEvt
.GetKeyCode().IsMod1())
589 // With the CONTROL modifier we switch layers.
590 if (static_cast<DrawViewShell
*>(mpViewShell
)->IsLayerModeActive())
592 // With the layer mode active pressing page-down
593 // moves to the next layer.
601 // #97016# II change select state when focus is on poly point
604 const SdrHdlList
& rHdlList
= mpView
->GetHdlList();
605 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
609 if(pHdl
->GetKind() == HDL_POLY
)
611 // rescue ID of point with focus
612 sal_uInt32
nPol(pHdl
->GetPolyNum());
613 sal_uInt32
nPnt(pHdl
->GetPointNum());
615 if(mpView
->IsPointMarked(*pHdl
))
617 if(rKEvt
.GetKeyCode().IsShift())
619 mpView
->UnmarkPoint(*pHdl
);
624 if(!rKEvt
.GetKeyCode().IsShift())
626 mpView
->UnmarkAllPoints();
629 mpView
->MarkPoint(*pHdl
);
632 if(0L == rHdlList
.GetFocusHdl())
634 // restore point with focus
635 SdrHdl
* pNewOne
= 0L;
637 for(sal_uInt32
a(0); !pNewOne
&& a
< rHdlList
.GetHdlCount(); a
++)
639 SdrHdl
* pAct
= rHdlList
.GetHdl(a
);
642 && pAct
->GetKind() == HDL_POLY
643 && pAct
->GetPolyNum() == nPol
644 && pAct
->GetPointNum() == nPnt
)
652 ((SdrHdlList
&)rHdlList
).SetFocusHdl(pNewOne
);
667 if (!mpView
->IsTextEdit() && !bSlideShow
)
678 else if (nCode
== KEY_DOWN
)
684 else if (nCode
== KEY_LEFT
)
690 else if (nCode
== KEY_RIGHT
)
692 // Scroll nach rechts
697 if (mpView
->AreObjectsMarked() && !rKEvt
.GetKeyCode().IsMod1() &&
698 !mpDocSh
->IsReadOnly())
701 const SdrHdlList
& rHdlList
= mpView
->GetHdlList();
702 SdrHdl
* pHdl
= rHdlList
.GetFocusHdl();
705 sal_Bool
bIsMoveOfConnectedHandle(sal_False
);
706 sal_Bool bOldSuppress
= false;
707 SdrEdgeObj
* pEdgeObj
= 0L;
709 if(pHdl
&& pHdl
->GetObj() && pHdl
->GetObj()->ISA(SdrEdgeObj
) && 0 == pHdl
->GetPolyNum())
711 pEdgeObj
= (SdrEdgeObj
*)pHdl
->GetObj();
713 if(0L == pHdl
->GetPointNum())
715 if(pEdgeObj
->GetConnection(sal_True
).GetObject())
717 bIsMoveOfConnectedHandle
= sal_True
;
720 if(1L == pHdl
->GetPointNum())
722 if(pEdgeObj
->GetConnection(sal_False
).GetObject())
724 bIsMoveOfConnectedHandle
= sal_True
;
732 // Suppress default connects to inside object and object center
733 bOldSuppress
= pEdgeObj
->GetSuppressDefaultConnect();
734 pEdgeObj
->SetSuppressDefaultConnect(sal_True
);
738 if(bIsMoveOfConnectedHandle
)
740 sal_uInt16
nMarkHdSiz(mpView
->GetMarkHdlSizePixel());
741 Size
aHalfConSiz(nMarkHdSiz
+ 1, nMarkHdSiz
+ 1);
742 aHalfConSiz
= mpWindow
->PixelToLogic(aHalfConSiz
);
744 if(100 < aHalfConSiz
.Width())
745 nX
*= aHalfConSiz
.Width();
749 if(100 < aHalfConSiz
.Height())
750 nY
*= aHalfConSiz
.Height();
754 else if(rKEvt
.GetKeyCode().IsMod2())
756 // #97016# move in 1 pixel distance
757 Size aLogicSizeOnePixel
= (mpWindow
) ? mpWindow
->PixelToLogic(Size(1,1)) : Size(100, 100);
758 nX
*= aLogicSizeOnePixel
.Width();
759 nY
*= aLogicSizeOnePixel
.Height();
761 else if(rKEvt
.GetKeyCode().IsShift())
768 // old, fixed move distance
775 // #67368# only take action when move is allowed
776 if(mpView
->IsMoveAllowed())
778 // #90129# restrict movement to WorkArea
779 const Rectangle
& rWorkArea
= mpView
->GetWorkArea();
781 if(!rWorkArea
.IsEmpty())
783 Rectangle
aMarkRect(mpView
->GetMarkedObjRect());
784 aMarkRect
.Move(nX
, nY
);
786 if(!aMarkRect
.IsInside(rWorkArea
))
788 if(aMarkRect
.Left() < rWorkArea
.Left())
790 nX
+= rWorkArea
.Left() - aMarkRect
.Left();
793 if(aMarkRect
.Right() > rWorkArea
.Right())
795 nX
-= aMarkRect
.Right() - rWorkArea
.Right();
798 if(aMarkRect
.Top() < rWorkArea
.Top())
800 nY
+= rWorkArea
.Top() - aMarkRect
.Top();
803 if(aMarkRect
.Bottom() > rWorkArea
.Bottom())
805 nY
-= aMarkRect
.Bottom() - rWorkArea
.Bottom();
810 // no handle selected
811 if(0 != nX
|| 0 != nY
)
813 mpView
->MoveAllMarked(Size(nX
, nY
));
816 mpView
->MakeVisible(mpView
->GetAllMarkedRect(), *mpWindow
);
822 // move handle with index nHandleIndex
823 if(pHdl
&& (nX
|| nY
))
825 // now move the Handle (nX, nY)
826 Point
aStartPoint(pHdl
->GetPos());
827 Point
aEndPoint(pHdl
->GetPos() + Point(nX
, nY
));
828 const SdrDragStat
& rDragStat
= mpView
->GetDragStat();
831 mpView
->BegDragObj(aStartPoint
, 0, pHdl
, 0);
833 if(mpView
->IsDragObj())
835 FASTBOOL bWasNoSnap
= rDragStat
.IsNoSnap();
836 BOOL bWasSnapEnabled
= mpView
->IsSnapEnabled();
838 // switch snapping off
840 ((SdrDragStat
&)rDragStat
).SetNoSnap(TRUE
);
842 mpView
->SetSnapEnabled(FALSE
);
844 mpView
->MovAction(aEndPoint
);
845 mpView
->EndDragObj();
849 ((SdrDragStat
&)rDragStat
).SetNoSnap(bWasNoSnap
);
851 mpView
->SetSnapEnabled(bWasSnapEnabled
);
854 // make moved handle visible
855 Rectangle
aVisRect(aEndPoint
- Point(100, 100), Size(200, 200));
856 mpView
->MakeVisible(aVisRect
, *mpWindow
);
863 // Restore original suppress value
864 pEdgeObj
->SetSuppressDefaultConnect(bOldSuppress
);
871 mpViewShell
->ScrollLines(nX
, nY
);
883 mpWindow
->ReleaseMouse();
886 // #98198# when a text-editable object is selected and the
887 // input character is printable, activate text edit on that object
888 // and feed character to object
889 if(!bReturn
&& !mpDocSh
->IsReadOnly())
891 if(!mpView
->IsTextEdit() && mpViewShell
)
893 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
895 if(1 == rMarkList
.GetMarkCount())
897 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
899 if(pObj
->ISA(SdrTextObj
) && pObj
->HasTextEdit() && !pObj
->ISA(SdrOle2Obj
))
901 // #98533# use common IsSimpleCharInput from
903 sal_Bool
bPrintable(EditEngine::IsSimpleCharInput(rKEvt
));
907 // try to activate textedit mode for the selected object
908 SfxStringItem
aInputString(SID_ATTR_CHAR
, String(rKEvt
.GetCharCode()));
910 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute(
912 SFX_CALLMODE_ASYNCHRON
,
923 // #99039# test if there is a title object there. If yes, try to
924 // set it to edit mode and start typing...
925 if(mpViewShell
->ISA(DrawViewShell
)
926 && EditEngine::IsSimpleCharInput(rKEvt
))
928 DrawViewShell
* pDrawViewShell
=
929 static_cast<DrawViewShell
*>(mpViewShell
);
930 SdPage
* pActualPage
= pDrawViewShell
->GetActualPage();
931 SdrTextObj
* pCandidate
= 0L;
935 SdrObjListIter
aIter(*pActualPage
, IM_DEEPNOGROUPS
);
937 while(aIter
.IsMore() && !pCandidate
)
939 SdrObject
* pObj
= aIter
.Next();
941 if(pObj
&& pObj
->ISA(SdrTextObj
))
943 sal_uInt32
nInv(pObj
->GetObjInventor());
944 sal_uInt16
nKnd(pObj
->GetObjIdentifier());
946 if(SdrInventor
== nInv
&& OBJ_TITLETEXT
== nKnd
)
948 pCandidate
= (SdrTextObj
*)pObj
;
954 // when candidate found and candidate is untouched, start editing text...
955 if(pCandidate
&& pCandidate
->IsEmptyPresObj())
958 mpView
->MarkObj(pCandidate
, mpView
->GetSdrPageView());
959 SfxStringItem
aInputString(SID_ATTR_CHAR
, String(rKEvt
.GetCharCode()));
961 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute(
963 SFX_CALLMODE_ASYNCHRON
,
978 BOOL
FuPoor::MouseMove(const MouseEvent
& )
984 void FuPoor::SelectionHasChanged()
986 const SdrHdlList
& rHdlList
= mpView
->GetHdlList();
987 ((SdrHdlList
&)rHdlList
).ResetFocusHdl();
990 /*************************************************************************
992 |* Cut object to clipboard
994 \************************************************************************/
1000 mpView
->DoCut(mpWindow
);
1004 /*************************************************************************
1006 |* Copy object to clipboard
1008 \************************************************************************/
1010 void FuPoor::DoCopy()
1014 mpView
->DoCopy(mpWindow
);
1018 /*************************************************************************
1020 |* Paste object from clipboard
1022 \************************************************************************/
1024 void FuPoor::DoPaste()
1028 mpView
->DoPaste(mpWindow
);
1032 /*************************************************************************
1034 |* Timer-Handler fuer Drag&Drop
1036 \************************************************************************/
1038 IMPL_LINK( FuPoor
, DragHdl
, Timer
*, EMPTYARG
)
1042 USHORT nHitLog
= USHORT ( mpWindow
->PixelToLogic(Size(HITPIX
,0)).Width() );
1043 SdrHdl
* pHdl
= mpView
->PickHandle(aMDPos
);
1045 if ( pHdl
==NULL
&& mpView
->IsMarkedHit(aMDPos
, nHitLog
)
1046 && !mpView
->IsPresObjSelected(FALSE
, TRUE
) )
1048 mpWindow
->ReleaseMouse();
1049 bIsInDragMode
= TRUE
;
1050 mpView
->StartDrag( aMDPos
, mpWindow
);
1056 /*************************************************************************
1060 \************************************************************************/
1062 BOOL
FuPoor::Command(const CommandEvent
& rCEvt
)
1064 return( mpView
->Command(rCEvt
,mpWindow
) );
1067 /*************************************************************************
1069 |* Timer-Handler fuer Fensterscrolling
1071 \************************************************************************/
1073 IMPL_LINK_INLINE_START( FuPoor
, DelayHdl
, Timer
*, EMPTYARG
)
1075 aDelayToScrollTimer
.Stop ();
1078 Point
aPnt(mpWindow
->GetPointerPosPixel());
1080 // #95491# use remembered MouseButton state to create correct
1081 // MouseEvents for this artifical MouseMove.
1082 MouseMove(MouseEvent(aPnt
, 1, 0, GetMouseButtonCode()));
1086 IMPL_LINK_INLINE_END( FuPoor
, DelayHdl
, Timer
*, pTimer
)
1088 /*************************************************************************
1090 |* Handler fuer Maustaste
1092 \************************************************************************/
1094 BOOL
FuPoor::MouseButtonUp (const MouseEvent
& rMEvt
)
1096 // #95491# remember button state for creation of own MouseEvents
1097 SetMouseButtonCode(rMEvt
.GetButtons());
1099 aDelayToScrollTimer
.Stop ();
1100 return bScrollable
=
1101 bDelayActive
= FALSE
;
1104 BOOL
FuPoor::MouseButtonDown(const MouseEvent
& rMEvt
)
1106 // #95491# remember button state for creation of own MouseEvents
1107 SetMouseButtonCode(rMEvt
.GetButtons());
1112 /*************************************************************************
1114 |* Handler fuer Maustaste
1116 \************************************************************************/
1118 void FuPoor::StartDelayToScrollTimer ()
1120 bDelayActive
= TRUE
;
1121 aDelayToScrollTimer
.Start ();
1124 /*************************************************************************
1126 |* Handler fuer Maustaste
1128 \************************************************************************/
1130 long FuPoor::diffPoint (long pos1
, long pos2
)
1132 return (pos1
> pos2
) ? pos1
- pos2
1136 /*************************************************************************
1140 \************************************************************************/
1142 BOOL
FuPoor::RequestHelp(const HelpEvent
& rHEvt
)
1144 BOOL bReturn
= FALSE
;
1146 SdrPageView
* pPV
= mpView
->GetSdrPageView();
1150 SdPage
* pPage
= (SdPage
*) pPV
->GetPage();
1154 bReturn
= pPage
->RequestHelp(mpWindow
, mpView
, rHEvt
);
1161 void FuPoor::Paint(const Rectangle
&, ::sd::Window
* )
1165 /*************************************************************************
1167 |* Request verarbeiten
1169 \************************************************************************/
1171 void FuPoor::ReceiveRequest(SfxRequest
& rReq
)
1173 const SfxItemSet
* pSet
= rReq
.GetArgs();
1177 if( pSet
->GetItemState( nSlotId
) == SFX_ITEM_SET
)
1179 const SfxPoolItem
& rItem
= pSet
->Get( nSlotId
);
1181 if( rItem
.ISA( SfxAllEnumItem
) )
1183 nSlotValue
= ( ( const SfxAllEnumItem
& ) rItem
).GetValue();
1189 /*************************************************************************
1193 \************************************************************************/
1195 SdrObject
* FuPoor::CreateDefaultObject(const sal_uInt16
, const Rectangle
& )
1197 // empty base implementation
1201 void FuPoor::ImpForceQuadratic(Rectangle
& rRect
)
1203 if(rRect
.GetWidth() > rRect
.GetHeight())
1206 Point(rRect
.Left() + ((rRect
.GetWidth() - rRect
.GetHeight()) / 2), rRect
.Top()),
1207 Size(rRect
.GetHeight(), rRect
.GetHeight()));
1212 Point(rRect
.Left(), rRect
.Top() + ((rRect
.GetHeight() - rRect
.GetWidth()) / 2)),
1213 Size(rRect
.GetWidth(), rRect
.GetWidth()));
1220 void FuPoor::SwitchLayer (sal_Int32 nOffset
)
1222 if(mpViewShell
&& mpViewShell
->ISA(DrawViewShell
))
1224 DrawViewShell
* pDrawViewShell
=
1225 static_cast<DrawViewShell
*>(mpViewShell
);
1227 // Calculate the new index.
1228 sal_Int32 nIndex
= pDrawViewShell
->GetActiveTabLayerIndex() + nOffset
;
1230 // Make sure the new index lies inside the range of valid indices.
1233 else if (nIndex
>= pDrawViewShell
->GetTabLayerCount ())
1234 nIndex
= pDrawViewShell
->GetTabLayerCount() - 1;
1236 // Set the new active layer.
1237 if (nIndex
!= pDrawViewShell
->GetActiveTabLayerIndex ())
1239 LayerTabBar
* pLayerTabControl
=
1240 static_cast<DrawViewShell
*>(mpViewShell
)->GetLayerTabControl();
1241 if (pLayerTabControl
!= NULL
)
1242 pLayerTabControl
->SendDeactivatePageEvent ();
1244 pDrawViewShell
->SetActiveTabLayerIndex (nIndex
);
1246 if (pLayerTabControl
!= NULL
)
1247 pLayerTabControl
->SendActivatePageEvent ();
1252 /** is called when the currenct function should be aborted. <p>
1253 This is used when a function gets a KEY_ESCAPE but can also
1256 @returns true if a active function was aborted
1258 bool FuPoor::cancel()
1260 if ( !this->ISA(FuSelection
) )
1262 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
1270 bool FuPoor::doConstructOrthogonal() const
1273 SID_DRAW_XLINE
== nSlotId
||
1274 SID_DRAW_CIRCLEARC
== nSlotId
||
1275 SID_DRAW_SQUARE
== nSlotId
||
1276 SID_DRAW_SQUARE_NOFILL
== nSlotId
||
1277 SID_DRAW_SQUARE_ROUND
== nSlotId
||
1278 SID_DRAW_SQUARE_ROUND_NOFILL
== nSlotId
||
1279 SID_DRAW_CIRCLE
== nSlotId
||
1280 SID_DRAW_CIRCLE_NOFILL
== nSlotId
||
1281 SID_DRAW_CIRCLEPIE
== nSlotId
||
1282 SID_DRAW_CIRCLEPIE_NOFILL
== nSlotId
||
1283 SID_DRAW_CIRCLECUT
== nSlotId
||
1284 SID_DRAW_CIRCLECUT_NOFILL
== nSlotId
||
1285 SID_DRAW_XPOLYGON
== nSlotId
||
1286 SID_DRAW_XPOLYGON_NOFILL
== nSlotId
||
1287 SID_3D_CUBE
== nSlotId
||
1288 SID_3D_SPHERE
== nSlotId
||
1289 SID_3D_SHELL
== nSlotId
||
1290 SID_3D_HALF_SPHERE
== nSlotId
||
1291 SID_3D_TORUS
== nSlotId
||
1292 SID_3D_CYLINDER
== nSlotId
||
1293 SID_3D_CONE
== nSlotId
||
1294 SID_3D_PYRAMID
== nSlotId
);
1297 void FuPoor::DoExecute( SfxRequest
& )
1301 } // end of namespace sd