xref: /AOO41X/main/reportdesign/source/ui/report/dlgedfunc.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #include "precompiled_reportdesign.hxx"
28*cdf0e10cSrcweir #include <vcl/scrbar.hxx>
29*cdf0e10cSrcweir #include <vcl/svapp.hxx>
30*cdf0e10cSrcweir #include <vcl/seleng.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <svx/svdview.hxx>
36*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
37*cdf0e10cSrcweir #include <editeng/outlobj.hxx>
38*cdf0e10cSrcweir #include <editeng/unolingu.hxx>
39*cdf0e10cSrcweir #include <svx/svdetc.hxx>
40*cdf0e10cSrcweir #include <editeng/editstat.hxx>
41*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
42*cdf0e10cSrcweir #include <svx/svddrgmt.hxx>
43*cdf0e10cSrcweir #include <svx/svdoashp.hxx>
44*cdf0e10cSrcweir #include <svx/svxids.hrc>
45*cdf0e10cSrcweir #include <svx/svditer.hxx>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #include "dlgedfunc.hxx"
50*cdf0e10cSrcweir #include "ReportSection.hxx"
51*cdf0e10cSrcweir #include "DesignView.hxx"
52*cdf0e10cSrcweir #include "ReportController.hxx"
53*cdf0e10cSrcweir #include "SectionView.hxx"
54*cdf0e10cSrcweir #include "ViewsWindow.hxx"
55*cdf0e10cSrcweir #include "ReportWindow.hxx"
56*cdf0e10cSrcweir #include "RptObject.hxx"
57*cdf0e10cSrcweir #include "ScrollHelper.hxx"
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #include "ReportRuler.hxx"
60*cdf0e10cSrcweir #include "UITools.hxx"
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir #include <uistrings.hrc>
63*cdf0e10cSrcweir #include "UndoEnv.hxx"
64*cdf0e10cSrcweir #include <RptModel.hxx>
65*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir #define DEFAUL_MOVE_SIZE    100
68*cdf0e10cSrcweir namespace rptui
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir using namespace ::com::sun::star;
71*cdf0e10cSrcweir //----------------------------------------------------------------------------
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir //----------------------------------------------------------------------------
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir IMPL_LINK( DlgEdFunc, ScrollTimeout, Timer *,  )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 	ForceScroll( m_pParent->PixelToLogic( m_pParent->GetPointerPosPixel() ) );
78*cdf0e10cSrcweir 	return 0;
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir //----------------------------------------------------------------------------
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir void DlgEdFunc::ForceScroll( const Point& rPos )
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir 	aScrollTimer.Stop();
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	OReportWindow* pReportWindow = m_pParent->getSectionWindow()->getViewsWindow()->getView();
88*cdf0e10cSrcweir 	OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	Size aOut = pReportWindow->GetOutputSizePixel();
91*cdf0e10cSrcweir     Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
92*cdf0e10cSrcweir     aStartWidth *= m_pParent->GetMapMode().GetScaleX();
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	aOut.Width() -= (long)aStartWidth;
95*cdf0e10cSrcweir     aOut.Height() = m_pParent->GetOutputSizePixel().Height();
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     Point aPos = pScrollWindow->getThumbPos();
98*cdf0e10cSrcweir     aPos.X() *= 0.5;
99*cdf0e10cSrcweir     aPos.Y() *= 0.5;
100*cdf0e10cSrcweir 	Rectangle aOutRect( aPos, aOut );
101*cdf0e10cSrcweir 	aOutRect = m_pParent->PixelToLogic( aOutRect );
102*cdf0e10cSrcweir 	//Rectangle aWorkArea = m_pParent->getView()->GetWorkArea();
103*cdf0e10cSrcweir     Point aGcc3WorkaroundTemporary;
104*cdf0e10cSrcweir     Rectangle aWorkArea(aGcc3WorkaroundTemporary,pScrollWindow->getTotalSize());
105*cdf0e10cSrcweir     aWorkArea.Right() -= (long)aStartWidth;
106*cdf0e10cSrcweir 	aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
107*cdf0e10cSrcweir 	if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
108*cdf0e10cSrcweir 	{
109*cdf0e10cSrcweir 		ScrollBar* pHScroll = pScrollWindow->GetHScroll();
110*cdf0e10cSrcweir 		ScrollBar* pVScroll = pScrollWindow->GetVScroll();
111*cdf0e10cSrcweir 		ScrollType eH = SCROLL_LINEDOWN,eV = SCROLL_LINEDOWN;
112*cdf0e10cSrcweir 		if( rPos.X() < aOutRect.Left() )
113*cdf0e10cSrcweir             eH = SCROLL_LINEUP;
114*cdf0e10cSrcweir 		else if( rPos.X() <= aOutRect.Right() )
115*cdf0e10cSrcweir 			eH = SCROLL_DONTKNOW;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 		if( rPos.Y() < aOutRect.Top() )
118*cdf0e10cSrcweir 			eV = SCROLL_LINEUP;
119*cdf0e10cSrcweir 		else if( rPos.Y() <= aOutRect.Bottom() )
120*cdf0e10cSrcweir 			eV = SCROLL_DONTKNOW;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         pHScroll->DoScrollAction(eH);
123*cdf0e10cSrcweir         pVScroll->DoScrollAction(eV);
124*cdf0e10cSrcweir 	}
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	aScrollTimer.Start();
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir //----------------------------------------------------------------------------
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir DlgEdFunc::DlgEdFunc( OReportSection* _pParent )
132*cdf0e10cSrcweir :m_pParent(_pParent),
133*cdf0e10cSrcweir  m_rView(_pParent->getSectionView()),
134*cdf0e10cSrcweir  m_xOverlappingObj(NULL),
135*cdf0e10cSrcweir  m_pOverlappingObj(NULL),
136*cdf0e10cSrcweir  m_bSelectionMode(false),
137*cdf0e10cSrcweir  m_bUiActive(false),
138*cdf0e10cSrcweir  m_bShowPropertyBrowser(false)
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir 	// m_pParent = _pParent;
141*cdf0e10cSrcweir 	aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
142*cdf0e10cSrcweir     m_rView.SetActualWin( m_pParent);
143*cdf0e10cSrcweir 	aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
144*cdf0e10cSrcweir }
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir //----------------------------------------------------------------------------
147*cdf0e10cSrcweir void DlgEdFunc::setOverlappedControlColor(sal_Int32 _nColor)
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     m_nOverlappedControlColor = _nColor;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir // -----------------------------------------------------------------------------
152*cdf0e10cSrcweir sal_Int32 lcl_setColorOfObject(uno::Reference< uno::XInterface > _xObj, long _nColorTRGB)
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir     sal_Int32 nBackColor = 0;
155*cdf0e10cSrcweir     try
156*cdf0e10cSrcweir     {
157*cdf0e10cSrcweir         uno::Reference<report::XReportComponent> xComponent(_xObj, uno::UNO_QUERY_THROW);
158*cdf0e10cSrcweir         // NOT NEED if UNO_QUERY_THROW:
159*cdf0e10cSrcweir 		// if (xComponent.is())
160*cdf0e10cSrcweir         // {
161*cdf0e10cSrcweir         uno::Reference< beans::XPropertySet > xProp(xComponent, uno::UNO_QUERY_THROW);
162*cdf0e10cSrcweir         // if (xProp.is())
163*cdf0e10cSrcweir         // {
164*cdf0e10cSrcweir 		// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlBackground"))
165*cdf0e10cSrcweir 		// is PROPERTY_CONTROLBACKGROUND
166*cdf0e10cSrcweir 		uno::Any aAny = xProp->getPropertyValue(PROPERTY_CONTROLBACKGROUND);
167*cdf0e10cSrcweir         if (aAny.hasValue())
168*cdf0e10cSrcweir         {
169*cdf0e10cSrcweir             aAny >>= nBackColor;
170*cdf0e10cSrcweir             // try to set background color at the ReportComponent
171*cdf0e10cSrcweir             uno::Any aBlackColorAny = uno::makeAny(_nColorTRGB);
172*cdf0e10cSrcweir             xProp->setPropertyValue(PROPERTY_CONTROLBACKGROUND, aBlackColorAny);
173*cdf0e10cSrcweir         }
174*cdf0e10cSrcweir         // aCopies.push_back(xComponent->createClone());
175*cdf0e10cSrcweir     }
176*cdf0e10cSrcweir     catch(uno::Exception&)
177*cdf0e10cSrcweir     {
178*cdf0e10cSrcweir         // bit my shiny metal as!
179*cdf0e10cSrcweir         // OSL_ENSURE(0,"Can't copy report elements!");
180*cdf0e10cSrcweir     }
181*cdf0e10cSrcweir     return nBackColor;
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir // -----------------------------------------------------------------------------
184*cdf0e10cSrcweir DlgEdFunc::~DlgEdFunc()
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir 	unColorizeOverlappedObj();
187*cdf0e10cSrcweir 	aScrollTimer.Stop();
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir //----------------------------------------------------------------------------
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseButtonDown( const MouseEvent& rMEvt )
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir     m_aMDPos = m_pParent->PixelToLogic( rMEvt.GetPosPixel() );
195*cdf0e10cSrcweir 	m_pParent->GrabFocus();
196*cdf0e10cSrcweir     sal_Bool bHandled = sal_False;
197*cdf0e10cSrcweir     if ( rMEvt.IsLeft() )
198*cdf0e10cSrcweir     {
199*cdf0e10cSrcweir         if ( rMEvt.GetClicks() > 1 )
200*cdf0e10cSrcweir         {
201*cdf0e10cSrcweir             // show property browser
202*cdf0e10cSrcweir 		    if ( m_pParent->GetMode() != RPTUI_READONLY )
203*cdf0e10cSrcweir             {
204*cdf0e10cSrcweir                 uno::Sequence<beans::PropertyValue> aArgs(1);
205*cdf0e10cSrcweir                 aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowProperties"));
206*cdf0e10cSrcweir                 aArgs[0].Value <<= sal_True;
207*cdf0e10cSrcweir                 m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController().executeUnChecked(SID_SHOW_PROPERTYBROWSER,aArgs);
208*cdf0e10cSrcweir                 m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
209*cdf0e10cSrcweir                 // TODO character in shapes
210*cdf0e10cSrcweir                 //    SdrViewEvent aVEvt;
211*cdf0e10cSrcweir                 // m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
212*cdf0e10cSrcweir                 //    if ( aVEvt.pRootObj && aVEvt.pRootObj->ISA(SdrTextObj) )
213*cdf0e10cSrcweir                 //        SetInEditMode(static_cast<SdrTextObj *>(aVEvt.pRootObj),rMEvt, sal_False);
214*cdf0e10cSrcweir                 bHandled = sal_True;
215*cdf0e10cSrcweir             }
216*cdf0e10cSrcweir         }
217*cdf0e10cSrcweir         else
218*cdf0e10cSrcweir         {
219*cdf0e10cSrcweir             SdrHdl* pHdl = m_rView.PickHandle(m_aMDPos);
220*cdf0e10cSrcweir             //m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(m_pView);
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	        // if selected object was hit, drag object
223*cdf0e10cSrcweir 	        if ( pHdl!=NULL || m_rView.IsMarkedHit(m_aMDPos) )
224*cdf0e10cSrcweir             {
225*cdf0e10cSrcweir                 bHandled = sal_True;
226*cdf0e10cSrcweir                 m_pParent->CaptureMouse();
227*cdf0e10cSrcweir 		        m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, pHdl,&m_rView);
228*cdf0e10cSrcweir             }
229*cdf0e10cSrcweir         }
230*cdf0e10cSrcweir     }
231*cdf0e10cSrcweir     else if ( rMEvt.IsRight() && !rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) // mark object when context menu was selected
232*cdf0e10cSrcweir     {
233*cdf0e10cSrcweir         SdrPageView* pPV = m_rView.GetSdrPageView();
234*cdf0e10cSrcweir 		SdrViewEvent aVEvt;
235*cdf0e10cSrcweir 		if ( m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt) != SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() )
236*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
237*cdf0e10cSrcweir         if ( aVEvt.pRootObj )
238*cdf0e10cSrcweir 		    m_rView.MarkObj(aVEvt.pRootObj, pPV);
239*cdf0e10cSrcweir         else
240*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir         bHandled = sal_True;
243*cdf0e10cSrcweir     }
244*cdf0e10cSrcweir     else if( !rMEvt.IsLeft() )
245*cdf0e10cSrcweir 		bHandled = sal_True;
246*cdf0e10cSrcweir     if ( !bHandled )
247*cdf0e10cSrcweir         m_pParent->CaptureMouse();
248*cdf0e10cSrcweir     return bHandled;
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir //----------------------------------------------------------------------------
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseButtonUp( const MouseEvent& /*rMEvt*/ )
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir     sal_Bool bHandled = sal_False;
256*cdf0e10cSrcweir 	m_pParent->getSectionWindow()->getViewsWindow()->stopScrollTimer();
257*cdf0e10cSrcweir 	return bHandled;
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir // -----------------------------------------------------------------------------
260*cdf0e10cSrcweir void DlgEdFunc::checkTwoCklicks(const MouseEvent& rMEvt)
261*cdf0e10cSrcweir {
262*cdf0e10cSrcweir     deactivateOle();
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     const sal_uInt16 nClicks = rMEvt.GetClicks();
265*cdf0e10cSrcweir 	if ( nClicks == 2 && rMEvt.IsLeft() )
266*cdf0e10cSrcweir 	{
267*cdf0e10cSrcweir 		if ( m_rView.AreObjectsMarked() )
268*cdf0e10cSrcweir 		{
269*cdf0e10cSrcweir 			const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
270*cdf0e10cSrcweir 			if (rMarkList.GetMarkCount() == 1)
271*cdf0e10cSrcweir 			{
272*cdf0e10cSrcweir 				const SdrMark* pMark = rMarkList.GetMark(0);
273*cdf0e10cSrcweir 				SdrObject* pObj = pMark->GetMarkedSdrObj();
274*cdf0e10cSrcweir 				activateOle(pObj);
275*cdf0e10cSrcweir             } // if (rMarkList.GetMarkCount() == 1)
276*cdf0e10cSrcweir         } // if ( pView->AreObjectsMarked() )
277*cdf0e10cSrcweir     }
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir // -----------------------------------------------------------------------------
280*cdf0e10cSrcweir void DlgEdFunc::stopScrollTimer()
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir     unColorizeOverlappedObj();
283*cdf0e10cSrcweir     aScrollTimer.Stop();
284*cdf0e10cSrcweir     if ( m_pParent->IsMouseCaptured() )
285*cdf0e10cSrcweir         m_pParent->ReleaseMouse();
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir //----------------------------------------------------------------------------
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseMove( const MouseEvent& /*rMEvt*/ )
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir 	return sal_False;
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir //------------------------------------------------------------------------------
294*cdf0e10cSrcweir sal_Bool DlgEdFunc::handleKeyEvent(const KeyEvent& _rEvent)
295*cdf0e10cSrcweir {
296*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     if ( !m_bUiActive )
299*cdf0e10cSrcweir     {
300*cdf0e10cSrcweir         const KeyCode& rCode = _rEvent.GetKeyCode();
301*cdf0e10cSrcweir 	    sal_uInt16 nCode = rCode.GetCode();
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 		switch ( nCode )
304*cdf0e10cSrcweir 		{
305*cdf0e10cSrcweir 			case KEY_ESCAPE:
306*cdf0e10cSrcweir 			{
307*cdf0e10cSrcweir 				if ( m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
308*cdf0e10cSrcweir 				{
309*cdf0e10cSrcweir 					m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
310*cdf0e10cSrcweir 					bReturn = sal_True;
311*cdf0e10cSrcweir 				}
312*cdf0e10cSrcweir     	        else if ( m_rView.IsTextEdit() )
313*cdf0e10cSrcweir 	    	    {
314*cdf0e10cSrcweir 		    		m_rView.SdrEndTextEdit();
315*cdf0e10cSrcweir 		        	bReturn = sal_True;
316*cdf0e10cSrcweir 	            }
317*cdf0e10cSrcweir 				else if ( m_rView.AreObjectsMarked() )
318*cdf0e10cSrcweir 				{
319*cdf0e10cSrcweir 					const SdrHdlList& rHdlList = m_rView.GetHdlList();
320*cdf0e10cSrcweir 					SdrHdl* pHdl = rHdlList.GetFocusHdl();
321*cdf0e10cSrcweir 					if ( pHdl )
322*cdf0e10cSrcweir 						((SdrHdlList&)rHdlList).ResetFocusHdl();
323*cdf0e10cSrcweir 					else
324*cdf0e10cSrcweir             	        m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
325*cdf0e10cSrcweir 						//m_rView.UnmarkAll();
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 				    deactivateOle(true);
328*cdf0e10cSrcweir 					bReturn = sal_False;
329*cdf0e10cSrcweir 				}
330*cdf0e10cSrcweir                 else
331*cdf0e10cSrcweir                 {
332*cdf0e10cSrcweir                     deactivateOle(true);
333*cdf0e10cSrcweir                 }
334*cdf0e10cSrcweir 			}
335*cdf0e10cSrcweir 			break;
336*cdf0e10cSrcweir 			case KEY_TAB:
337*cdf0e10cSrcweir 			{
338*cdf0e10cSrcweir 				if ( !rCode.IsMod1() && !rCode.IsMod2() )
339*cdf0e10cSrcweir 				{
340*cdf0e10cSrcweir 					// mark next object
341*cdf0e10cSrcweir 					if ( !m_rView.MarkNextObj( !rCode.IsShift() ) )
342*cdf0e10cSrcweir 					{
343*cdf0e10cSrcweir 						// if no next object, mark first/last
344*cdf0e10cSrcweir 						m_rView.UnmarkAllObj();
345*cdf0e10cSrcweir 						m_rView.MarkNextObj( !rCode.IsShift() );
346*cdf0e10cSrcweir 					}
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 					if ( m_rView.AreObjectsMarked() )
349*cdf0e10cSrcweir 						m_rView.MakeVisible( m_rView.GetAllMarkedRect(), *m_pParent);
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 					bReturn = sal_True;
352*cdf0e10cSrcweir 				}
353*cdf0e10cSrcweir 				else if ( rCode.IsMod1() && rCode.IsMod2())
354*cdf0e10cSrcweir 				{
355*cdf0e10cSrcweir 					// selected handle
356*cdf0e10cSrcweir 					const SdrHdlList& rHdlList = m_rView.GetHdlList();
357*cdf0e10cSrcweir 					((SdrHdlList&)rHdlList).TravelFocusHdl( !rCode.IsShift() );
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 					// guarantee visibility of focused handle
360*cdf0e10cSrcweir 					SdrHdl* pHdl = rHdlList.GetFocusHdl();
361*cdf0e10cSrcweir 					if ( pHdl )
362*cdf0e10cSrcweir 					{
363*cdf0e10cSrcweir 						Point aHdlPosition( pHdl->GetPos() );
364*cdf0e10cSrcweir 						Rectangle aVisRect( aHdlPosition - Point( DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE ), Size( 200, 200 ) );
365*cdf0e10cSrcweir 						m_rView.MakeVisible( aVisRect, *m_pParent);
366*cdf0e10cSrcweir 					}
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 					bReturn = sal_True;
369*cdf0e10cSrcweir 				}
370*cdf0e10cSrcweir 			}
371*cdf0e10cSrcweir 			break;
372*cdf0e10cSrcweir 			case KEY_UP:
373*cdf0e10cSrcweir 			case KEY_DOWN:
374*cdf0e10cSrcweir 			case KEY_LEFT:
375*cdf0e10cSrcweir 			case KEY_RIGHT:
376*cdf0e10cSrcweir 			{
377*cdf0e10cSrcweir     	        m_pParent->getSectionWindow()->getViewsWindow()->handleKey(rCode);
378*cdf0e10cSrcweir 				bReturn = sal_True;
379*cdf0e10cSrcweir 			}
380*cdf0e10cSrcweir 			break;
381*cdf0e10cSrcweir         	case KEY_RETURN:
382*cdf0e10cSrcweir             	if ( !rCode.IsMod1() )
383*cdf0e10cSrcweir                 {
384*cdf0e10cSrcweir                     const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
385*cdf0e10cSrcweir                     if ( rMarkList.GetMarkCount() == 1 )
386*cdf0e10cSrcweir                     {
387*cdf0e10cSrcweir                         SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
388*cdf0e10cSrcweir                         activateOle(pObj);
389*cdf0e10cSrcweir                     }
390*cdf0e10cSrcweir                 }
391*cdf0e10cSrcweir                 break;
392*cdf0e10cSrcweir             case KEY_DELETE:
393*cdf0e10cSrcweir                 if ( !rCode.IsMod1() && !rCode.IsMod2() )
394*cdf0e10cSrcweir                 {
395*cdf0e10cSrcweir                     bReturn = sal_True;
396*cdf0e10cSrcweir                     break;
397*cdf0e10cSrcweir                 } // if ( !rCode.IsMod1() && !rCode.IsMod2() )
398*cdf0e10cSrcweir                 // run through
399*cdf0e10cSrcweir 			default:
400*cdf0e10cSrcweir 			{
401*cdf0e10cSrcweir         	    bReturn = m_rView.KeyInput(_rEvent, m_pParent);
402*cdf0e10cSrcweir 			}
403*cdf0e10cSrcweir 			break;
404*cdf0e10cSrcweir 		}
405*cdf0e10cSrcweir 	}
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 	if ( bReturn && m_pParent->IsMouseCaptured() )
408*cdf0e10cSrcweir 		m_pParent->ReleaseMouse();
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir 	return bReturn;
411*cdf0e10cSrcweir }
412*cdf0e10cSrcweir // -----------------------------------------------------------------------------
413*cdf0e10cSrcweir void DlgEdFunc::activateOle(SdrObject* _pObj)
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir     if ( _pObj )
416*cdf0e10cSrcweir     {
417*cdf0e10cSrcweir         const sal_uInt16 nSdrObjKind = _pObj->GetObjIdentifier();
418*cdf0e10cSrcweir         //
419*cdf0e10cSrcweir 	    //	OLE: activate
420*cdf0e10cSrcweir 	    //
421*cdf0e10cSrcweir 	    if (nSdrObjKind == OBJ_OLE2)
422*cdf0e10cSrcweir 	    {
423*cdf0e10cSrcweir             bool bIsInplaceOle = false;
424*cdf0e10cSrcweir 		    if (!bIsInplaceOle)
425*cdf0e10cSrcweir 		    {
426*cdf0e10cSrcweir                 SdrOle2Obj* pOleObj = dynamic_cast<SdrOle2Obj*>(_pObj);
427*cdf0e10cSrcweir                 if ( pOleObj->GetObjRef().is() )
428*cdf0e10cSrcweir 			    {
429*cdf0e10cSrcweir                     if (m_rView.IsTextEdit())
430*cdf0e10cSrcweir 		            {
431*cdf0e10cSrcweir 			            m_rView.SdrEndTextEdit();
432*cdf0e10cSrcweir 		            }
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir                     pOleObj->AddOwnLightClient();
435*cdf0e10cSrcweir                     pOleObj->SetWindow(VCLUnoHelper::GetInterface(m_pParent));
436*cdf0e10cSrcweir                     try
437*cdf0e10cSrcweir                     {
438*cdf0e10cSrcweir                         pOleObj->GetObjRef()->changeState( embed::EmbedStates::UI_ACTIVE );
439*cdf0e10cSrcweir                         m_bUiActive = true;
440*cdf0e10cSrcweir                         OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
441*cdf0e10cSrcweir                         m_bShowPropertyBrowser = rController.isCommandChecked(SID_SHOW_PROPERTYBROWSER);
442*cdf0e10cSrcweir                         if ( m_bShowPropertyBrowser )
443*cdf0e10cSrcweir                             rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
444*cdf0e10cSrcweir                     }
445*cdf0e10cSrcweir                     catch( uno::Exception& )
446*cdf0e10cSrcweir                     {
447*cdf0e10cSrcweir                         DBG_UNHANDLED_EXCEPTION();
448*cdf0e10cSrcweir                     }
449*cdf0e10cSrcweir 			    }
450*cdf0e10cSrcweir 		    }
451*cdf0e10cSrcweir 	    } // if (nSdrObjKind == OBJ_OLE2)
452*cdf0e10cSrcweir     } // if ( _pObj )
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir // -----------------------------------------------------------------------------
455*cdf0e10cSrcweir void DlgEdFunc::deactivateOle(bool _bSelect)
456*cdf0e10cSrcweir {
457*cdf0e10cSrcweir     OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache();
458*cdf0e10cSrcweir     OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
459*cdf0e10cSrcweir     const sal_uLong nCount = rObjCache.Count();
460*cdf0e10cSrcweir     for(sal_uLong i = 0 ; i< nCount;++i)
461*cdf0e10cSrcweir     {
462*cdf0e10cSrcweir         SdrOle2Obj* pObj = reinterpret_cast<SdrOle2Obj*>(rObjCache.GetObject(i));
463*cdf0e10cSrcweir         if ( m_pParent->getPage() == pObj->GetPage() )
464*cdf0e10cSrcweir         {
465*cdf0e10cSrcweir             uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
466*cdf0e10cSrcweir             if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
467*cdf0e10cSrcweir             {
468*cdf0e10cSrcweir                 xObj->changeState( embed::EmbedStates::RUNNING );
469*cdf0e10cSrcweir                 m_bUiActive = false;
470*cdf0e10cSrcweir                 if ( m_bShowPropertyBrowser )
471*cdf0e10cSrcweir                 {
472*cdf0e10cSrcweir                     rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
473*cdf0e10cSrcweir                 }
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir                 if ( _bSelect )
476*cdf0e10cSrcweir                 {
477*cdf0e10cSrcweir                     SdrPageView* pPV = m_rView.GetSdrPageView();
478*cdf0e10cSrcweir 		            m_rView.MarkObj(pObj, pPV);
479*cdf0e10cSrcweir                 }
480*cdf0e10cSrcweir             } // if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
481*cdf0e10cSrcweir         }
482*cdf0e10cSrcweir     } // for(sal_uLong i = 0 ; i< nCount;++i)
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir // -----------------------------------------------------------------------------
485*cdf0e10cSrcweir void DlgEdFunc::colorizeOverlappedObject(SdrObject* _pOverlappedObj)
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir 	OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
488*cdf0e10cSrcweir 	if ( pObj )
489*cdf0e10cSrcweir 	{
490*cdf0e10cSrcweir         uno::Reference<report::XReportComponent> xComponent = pObj->getReportComponent();
491*cdf0e10cSrcweir         if (xComponent.is() && xComponent != m_xOverlappingObj)
492*cdf0e10cSrcweir         {
493*cdf0e10cSrcweir 	        OReportModel* pRptModel = static_cast<OReportModel*>(_pOverlappedObj->GetModel());
494*cdf0e10cSrcweir 		    if ( pRptModel )
495*cdf0e10cSrcweir 			{
496*cdf0e10cSrcweir 				OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir 				// uncolorize an old object, if there is one
499*cdf0e10cSrcweir 				unColorizeOverlappedObj();
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 			    m_nOldColor = lcl_setColorOfObject(xComponent, m_nOverlappedControlColor);
502*cdf0e10cSrcweir 				m_xOverlappingObj = xComponent;
503*cdf0e10cSrcweir 				m_pOverlappingObj = _pOverlappedObj;
504*cdf0e10cSrcweir 			}
505*cdf0e10cSrcweir         }
506*cdf0e10cSrcweir     }
507*cdf0e10cSrcweir }
508*cdf0e10cSrcweir // -----------------------------------------------------------------------------
509*cdf0e10cSrcweir void DlgEdFunc::unColorizeOverlappedObj()
510*cdf0e10cSrcweir {
511*cdf0e10cSrcweir 	// uncolorize an old object, if there is one
512*cdf0e10cSrcweir     if (m_xOverlappingObj.is())
513*cdf0e10cSrcweir     {
514*cdf0e10cSrcweir 		OReportModel* pRptModel = static_cast<OReportModel*>(m_pOverlappingObj->GetModel());
515*cdf0e10cSrcweir 	    if ( pRptModel )
516*cdf0e10cSrcweir 		{
517*cdf0e10cSrcweir 			OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 			lcl_setColorOfObject(m_xOverlappingObj, m_nOldColor);
520*cdf0e10cSrcweir 		    m_xOverlappingObj = NULL;
521*cdf0e10cSrcweir 			m_pOverlappingObj = NULL;
522*cdf0e10cSrcweir 		}
523*cdf0e10cSrcweir     }
524*cdf0e10cSrcweir }
525*cdf0e10cSrcweir // -----------------------------------------------------------------------------
526*cdf0e10cSrcweir bool DlgEdFunc::isOverlapping(const MouseEvent& rMEvt)
527*cdf0e10cSrcweir {
528*cdf0e10cSrcweir     bool bOverlapping = false;
529*cdf0e10cSrcweir     SdrViewEvent aVEvt;
530*cdf0e10cSrcweir 	bOverlapping = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONUP, aVEvt) != SDRHIT_NONE;
531*cdf0e10cSrcweir 	if (bOverlapping && aVEvt.pObj)
532*cdf0e10cSrcweir 	{
533*cdf0e10cSrcweir 		colorizeOverlappedObject(aVEvt.pObj);
534*cdf0e10cSrcweir 	}
535*cdf0e10cSrcweir     else
536*cdf0e10cSrcweir     {
537*cdf0e10cSrcweir 		unColorizeOverlappedObj();
538*cdf0e10cSrcweir     }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir     return bOverlapping;
541*cdf0e10cSrcweir }
542*cdf0e10cSrcweir // -----------------------------------------------------------------------------
543*cdf0e10cSrcweir void DlgEdFunc::checkMovementAllowed(const MouseEvent& rMEvt)
544*cdf0e10cSrcweir {
545*cdf0e10cSrcweir     if ( m_pParent->getSectionWindow()->getViewsWindow()->IsDragObj() )
546*cdf0e10cSrcweir 	{
547*cdf0e10cSrcweir         if ( isRectangleHit(rMEvt) )
548*cdf0e10cSrcweir         {
549*cdf0e10cSrcweir             // there is an other component under use, break action
550*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
551*cdf0e10cSrcweir         }
552*cdf0e10cSrcweir 		// object was dragged
553*cdf0e10cSrcweir         Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
554*cdf0e10cSrcweir 		if (m_bSelectionMode)
555*cdf0e10cSrcweir 		{
556*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
557*cdf0e10cSrcweir 		}
558*cdf0e10cSrcweir 		else
559*cdf0e10cSrcweir 		{
560*cdf0e10cSrcweir 			bool bControlKeyPressed = rMEvt.IsMod1();
561*cdf0e10cSrcweir 			// Don't allow points smaller 0
562*cdf0e10cSrcweir 			if (bControlKeyPressed && (aPnt.Y() < 0))
563*cdf0e10cSrcweir 			{
564*cdf0e10cSrcweir 				aPnt.Y() = 0;
565*cdf0e10cSrcweir 			}
566*cdf0e10cSrcweir             if (m_rView.IsDragResize())
567*cdf0e10cSrcweir             {
568*cdf0e10cSrcweir                 // we resize the object don't resize to above sections
569*cdf0e10cSrcweir                 if ( aPnt.Y() < 0 )
570*cdf0e10cSrcweir                 {
571*cdf0e10cSrcweir                     aPnt.Y() = 0;
572*cdf0e10cSrcweir                 }
573*cdf0e10cSrcweir             }
574*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->EndDragObj( bControlKeyPressed, &m_rView, aPnt );
575*cdf0e10cSrcweir 		}
576*cdf0e10cSrcweir 		m_pParent->getSectionWindow()->getViewsWindow()->ForceMarkedToAnotherPage();
577*cdf0e10cSrcweir         m_pParent->Invalidate(INVALIDATE_CHILDREN);
578*cdf0e10cSrcweir 	}
579*cdf0e10cSrcweir     else
580*cdf0e10cSrcweir 		m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
581*cdf0e10cSrcweir }
582*cdf0e10cSrcweir // -----------------------------------------------------------------------------
583*cdf0e10cSrcweir bool DlgEdFunc::isOnlyCustomShapeMarked()
584*cdf0e10cSrcweir {
585*cdf0e10cSrcweir 	bool bReturn = true;
586*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
587*cdf0e10cSrcweir     for (sal_uInt32 i =  0; i < rMarkList.GetMarkCount();++i )
588*cdf0e10cSrcweir     {
589*cdf0e10cSrcweir         SdrMark* pMark = rMarkList.GetMark(i);
590*cdf0e10cSrcweir         // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
591*cdf0e10cSrcweir         SdrObject* pObj = pMark->GetMarkedSdrObj();
592*cdf0e10cSrcweir 		if (pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE)
593*cdf0e10cSrcweir 		{
594*cdf0e10cSrcweir 			// we found an object in the marked objects, which is not a custom shape.
595*cdf0e10cSrcweir 			bReturn = false;
596*cdf0e10cSrcweir 			break;
597*cdf0e10cSrcweir 		}
598*cdf0e10cSrcweir 	}
599*cdf0e10cSrcweir 	return bReturn;
600*cdf0e10cSrcweir }
601*cdf0e10cSrcweir // -----------------------------------------------------------------------------
602*cdf0e10cSrcweir bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
603*cdf0e10cSrcweir {
604*cdf0e10cSrcweir 	if (isOnlyCustomShapeMarked())
605*cdf0e10cSrcweir 	{
606*cdf0e10cSrcweir 		return false;
607*cdf0e10cSrcweir 	}
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir 	SdrViewEvent aVEvt;
610*cdf0e10cSrcweir 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEMOVE, aVEvt);
611*cdf0e10cSrcweir     bool bIsSetPoint = (eHit == SDRHIT_UNMARKEDOBJECT);
612*cdf0e10cSrcweir     if ( !bIsSetPoint )
613*cdf0e10cSrcweir     {
614*cdf0e10cSrcweir         // no drag rect, we have to check every single select rect
615*cdf0e10cSrcweir         //const Rectangle& rRect = m_rView.GetDragStat().GetActionRect();
616*cdf0e10cSrcweir         const SdrDragStat& rDragStat = m_rView.GetDragStat();
617*cdf0e10cSrcweir 		if (rDragStat.GetDragMethod() != NULL)
618*cdf0e10cSrcweir 		{
619*cdf0e10cSrcweir             SdrObjListIter aIter(*m_pParent->getPage(),IM_DEEPNOGROUPS);
620*cdf0e10cSrcweir             SdrObject* pObjIter = NULL;
621*cdf0e10cSrcweir             // loop through all marked objects and check if there new rect overlapps an old one.
622*cdf0e10cSrcweir             while( (pObjIter = aIter.Next()) != NULL && !bIsSetPoint)
623*cdf0e10cSrcweir             {
624*cdf0e10cSrcweir                 if ( m_rView.IsObjMarked(pObjIter)
625*cdf0e10cSrcweir                      && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
626*cdf0e10cSrcweir                 {
627*cdf0e10cSrcweir                     Rectangle aNewRect = pObjIter->GetLastBoundRect();
628*cdf0e10cSrcweir                     long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();
629*cdf0e10cSrcweir                     long nDy = rDragStat.IsVerFixed() ? 0 : rDragStat.GetDY();
630*cdf0e10cSrcweir                     if ( (nDx + aNewRect.Left()) < 0 )
631*cdf0e10cSrcweir                         nDx = -aNewRect.Left();
632*cdf0e10cSrcweir                     if ( (nDy + aNewRect.Top()) < 0 )
633*cdf0e10cSrcweir                         nDy = -aNewRect.Top();
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir 					if ( rDragStat.GetDragMethod()->getMoveOnly() )
636*cdf0e10cSrcweir                         aNewRect.Move(nDx,nDy);
637*cdf0e10cSrcweir                     else
638*cdf0e10cSrcweir                         ::ResizeRect(aNewRect,rDragStat.GetRef1(),rDragStat.GetXFact(),rDragStat.GetYFact());
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir 					SdrObject* pObjOverlapped = isOver(aNewRect,*m_pParent->getPage(),m_rView,false,pObjIter, ISOVER_IGNORE_CUSTOMSHAPES);
642*cdf0e10cSrcweir 					bIsSetPoint = pObjOverlapped ? true : false;
643*cdf0e10cSrcweir 					if (pObjOverlapped && !m_bSelectionMode)
644*cdf0e10cSrcweir 					{
645*cdf0e10cSrcweir 						colorizeOverlappedObject(pObjOverlapped);
646*cdf0e10cSrcweir                     }
647*cdf0e10cSrcweir                 }
648*cdf0e10cSrcweir             }
649*cdf0e10cSrcweir         }
650*cdf0e10cSrcweir     }
651*cdf0e10cSrcweir 	else if ( aVEvt.pObj && (aVEvt.pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode)
652*cdf0e10cSrcweir 	{
653*cdf0e10cSrcweir 		colorizeOverlappedObject(aVEvt.pObj);
654*cdf0e10cSrcweir 	}
655*cdf0e10cSrcweir     else
656*cdf0e10cSrcweir         bIsSetPoint = false;
657*cdf0e10cSrcweir     return bIsSetPoint;
658*cdf0e10cSrcweir }
659*cdf0e10cSrcweir // -----------------------------------------------------------------------------
660*cdf0e10cSrcweir bool DlgEdFunc::setMovementPointer(const MouseEvent& rMEvt)
661*cdf0e10cSrcweir {
662*cdf0e10cSrcweir     bool bIsSetPoint = isRectangleHit(rMEvt);
663*cdf0e10cSrcweir     if ( bIsSetPoint )
664*cdf0e10cSrcweir         m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
665*cdf0e10cSrcweir 	else
666*cdf0e10cSrcweir 	{
667*cdf0e10cSrcweir 		bool bCtrlKey = rMEvt.IsMod1();
668*cdf0e10cSrcweir 		(void)bCtrlKey;
669*cdf0e10cSrcweir 		if (bCtrlKey)
670*cdf0e10cSrcweir 		{
671*cdf0e10cSrcweir 	        m_pParent->SetPointer( Pointer(POINTER_MOVEDATALINK ));
672*cdf0e10cSrcweir 			bIsSetPoint = true;
673*cdf0e10cSrcweir 		}
674*cdf0e10cSrcweir 	}
675*cdf0e10cSrcweir     return bIsSetPoint;
676*cdf0e10cSrcweir }
677*cdf0e10cSrcweir //----------------------------------------------------------------------------
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir DlgEdFuncInsert::DlgEdFuncInsert( OReportSection* _pParent ) :
680*cdf0e10cSrcweir 	DlgEdFunc( _pParent )
681*cdf0e10cSrcweir {
682*cdf0e10cSrcweir 	m_rView.SetCreateMode( sal_True );
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir //----------------------------------------------------------------------------
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir DlgEdFuncInsert::~DlgEdFuncInsert()
688*cdf0e10cSrcweir {
689*cdf0e10cSrcweir 	m_rView.SetEditMode( sal_True );
690*cdf0e10cSrcweir }
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir //----------------------------------------------------------------------------
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
695*cdf0e10cSrcweir {
696*cdf0e10cSrcweir     if ( DlgEdFunc::MouseButtonDown(rMEvt) )
697*cdf0e10cSrcweir         return sal_True;
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir     SdrViewEvent aVEvt;
700*cdf0e10cSrcweir     sal_Int16 nId = m_rView.GetCurrentObjIdentifier();
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir // eHit == SDRHIT_UNMARKEDOBJECT under the mouse cursor is a unmarked object
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir     if (eHit == SDRHIT_UNMARKEDOBJECT &&
707*cdf0e10cSrcweir         nId != OBJ_CUSTOMSHAPE)
708*cdf0e10cSrcweir     {
709*cdf0e10cSrcweir         // there is an object under the mouse cursor, but not a customshape
710*cdf0e10cSrcweir         // rtl::OUString suWasN = m_rView.getInsertObjString();
711*cdf0e10cSrcweir         // rtl::OUString suWasN2 = m_pParent->getSectionWindow()->getViewsWindow()->GetInsertObjString();
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir         m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
714*cdf0e10cSrcweir         return sal_False;
715*cdf0e10cSrcweir     }
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir     if( eHit != SDRHIT_UNMARKEDOBJECT || nId == OBJ_CUSTOMSHAPE)
718*cdf0e10cSrcweir     {
719*cdf0e10cSrcweir 	    // if no action, create object
720*cdf0e10cSrcweir 	    if ( !m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
721*cdf0e10cSrcweir         {
722*cdf0e10cSrcweir             deactivateOle(true);
723*cdf0e10cSrcweir             if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
724*cdf0e10cSrcweir                 m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
725*cdf0e10cSrcweir 		    m_rView.BegCreateObj(m_aMDPos);
726*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
727*cdf0e10cSrcweir         }
728*cdf0e10cSrcweir     }
729*cdf0e10cSrcweir     else
730*cdf0e10cSrcweir     {
731*cdf0e10cSrcweir         if( !rMEvt.IsShift() )
732*cdf0e10cSrcweir         {
733*cdf0e10cSrcweir             // shift key pressed?
734*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
735*cdf0e10cSrcweir         }
736*cdf0e10cSrcweir 		m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos,&m_rView );
737*cdf0e10cSrcweir     }
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 	return sal_True;
740*cdf0e10cSrcweir }
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir //----------------------------------------------------------------------------
743*cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
744*cdf0e10cSrcweir {
745*cdf0e10cSrcweir 	if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
746*cdf0e10cSrcweir         return sal_True;
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 	const Point	aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
749*cdf0e10cSrcweir 	const sal_uInt16 nHitLog = sal_uInt16 ( m_pParent->PixelToLogic(Size(3,0)).Width() );
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir     sal_Bool bReturn = sal_True;
752*cdf0e10cSrcweir 	// object creation active?
753*cdf0e10cSrcweir 	if ( m_rView.IsCreateObj() )
754*cdf0e10cSrcweir 	{
755*cdf0e10cSrcweir         if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),m_rView) )
756*cdf0e10cSrcweir         {
757*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
758*cdf0e10cSrcweir             // BrkAction disables the create mode
759*cdf0e10cSrcweir             m_rView.SetCreateMode( sal_True );
760*cdf0e10cSrcweir             return sal_True;
761*cdf0e10cSrcweir         }
762*cdf0e10cSrcweir 
763*cdf0e10cSrcweir 		m_rView.EndCreateObj(SDRCREATE_FORCEEND);
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir 		if ( !m_rView.AreObjectsMarked() )
766*cdf0e10cSrcweir 		{
767*cdf0e10cSrcweir 			m_rView.MarkObj(aPos, nHitLog);
768*cdf0e10cSrcweir 		}
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir 		bReturn = m_rView.AreObjectsMarked();
771*cdf0e10cSrcweir         if ( bReturn )
772*cdf0e10cSrcweir         {
773*cdf0e10cSrcweir             OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
774*cdf0e10cSrcweir             const SdrMarkList& rMarkList = m_rView.GetMarkedObjectList();
775*cdf0e10cSrcweir             for (sal_uInt32 i =  0; i < rMarkList.GetMarkCount();++i )
776*cdf0e10cSrcweir             {
777*cdf0e10cSrcweir                 SdrMark* pMark = rMarkList.GetMark(i);
778*cdf0e10cSrcweir                 // bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
779*cdf0e10cSrcweir                 OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
780*cdf0e10cSrcweir 		        if ( pObj && !pObj->IsEmpty() )
781*cdf0e10cSrcweir                 {
782*cdf0e10cSrcweir                     pObj->initializeChart(rController.getModel());
783*cdf0e10cSrcweir                 }
784*cdf0e10cSrcweir             }
785*cdf0e10cSrcweir         }
786*cdf0e10cSrcweir 	}
787*cdf0e10cSrcweir 	else
788*cdf0e10cSrcweir         checkMovementAllowed(rMEvt);
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir 	if ( !m_rView.AreObjectsMarked() &&
791*cdf0e10cSrcweir 		 Abs(m_aMDPos.X() - aPos.X()) < nHitLog &&
792*cdf0e10cSrcweir 		 Abs(m_aMDPos.Y() - aPos.Y()) < nHitLog &&
793*cdf0e10cSrcweir 		 !rMEvt.IsShift() && !rMEvt.IsMod2() )
794*cdf0e10cSrcweir 	{
795*cdf0e10cSrcweir 		SdrPageView* pPV = m_rView.GetSdrPageView();
796*cdf0e10cSrcweir 		SdrViewEvent aVEvt;
797*cdf0e10cSrcweir 		m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
798*cdf0e10cSrcweir 		m_rView.MarkObj(aVEvt.pRootObj, pPV);
799*cdf0e10cSrcweir 	} // ift() && !rMEvt.IsMod2() )
800*cdf0e10cSrcweir     checkTwoCklicks(rMEvt);
801*cdf0e10cSrcweir     m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
802*cdf0e10cSrcweir     return bReturn;
803*cdf0e10cSrcweir }
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir //----------------------------------------------------------------------------
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
808*cdf0e10cSrcweir {
809*cdf0e10cSrcweir     if ( DlgEdFunc::MouseMove(rMEvt ) )
810*cdf0e10cSrcweir         return sal_True;
811*cdf0e10cSrcweir 	Point	aPos( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir     if ( m_rView.IsCreateObj() )
814*cdf0e10cSrcweir 	{
815*cdf0e10cSrcweir         m_rView.SetOrtho(SdrObjCustomShape::doConstructOrthogonal(m_rView.getReportSection()->getSectionWindow()->getViewsWindow()->getShapeType()) ? !rMEvt.IsShift() : rMEvt.IsShift());
816*cdf0e10cSrcweir 		m_rView.SetAngleSnapEnabled(rMEvt.IsShift());
817*cdf0e10cSrcweir     }
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir     bool bIsSetPoint = false;
820*cdf0e10cSrcweir 	if ( m_rView.IsAction() )
821*cdf0e10cSrcweir 	{
822*cdf0e10cSrcweir 		if ( m_rView.IsDragResize() )
823*cdf0e10cSrcweir 		{
824*cdf0e10cSrcweir 		    // we resize the object don't resize to above sections
825*cdf0e10cSrcweir 		    if ( aPos.Y() < 0 )
826*cdf0e10cSrcweir 		    {
827*cdf0e10cSrcweir         		aPos.Y() = 0;
828*cdf0e10cSrcweir 		    }
829*cdf0e10cSrcweir 		}
830*cdf0e10cSrcweir         bIsSetPoint = setMovementPointer(rMEvt);
831*cdf0e10cSrcweir 		ForceScroll(aPos);
832*cdf0e10cSrcweir         m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPos,&m_rView, m_rView.GetDragMethod() == NULL, false);
833*cdf0e10cSrcweir 	}
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir     //if ( isOver(m_rView.GetCreateObj(),*m_pParent->getPage(),*m_pView) )
836*cdf0e10cSrcweir     //    m_pParent->SetPointer( Pointer(POINTER_NOTALLOWED));
837*cdf0e10cSrcweir     //else
838*cdf0e10cSrcweir     if ( !bIsSetPoint )
839*cdf0e10cSrcweir 	    m_pParent->SetPointer( m_rView.GetPreferedPointer( aPos, m_pParent) );
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir 	return sal_True;
842*cdf0e10cSrcweir }
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir //----------------------------------------------------------------------------
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir DlgEdFuncSelect::DlgEdFuncSelect( OReportSection* _pParent ) :
847*cdf0e10cSrcweir 	DlgEdFunc( _pParent )
848*cdf0e10cSrcweir {
849*cdf0e10cSrcweir }
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir //----------------------------------------------------------------------------
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir DlgEdFuncSelect::~DlgEdFuncSelect()
854*cdf0e10cSrcweir {
855*cdf0e10cSrcweir }
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir //----------------------------------------------------------------------------
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
860*cdf0e10cSrcweir {
861*cdf0e10cSrcweir 	m_bSelectionMode = false;
862*cdf0e10cSrcweir     if ( DlgEdFunc::MouseButtonDown(rMEvt) )
863*cdf0e10cSrcweir         return sal_True;
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir     SdrViewEvent aVEvt;
866*cdf0e10cSrcweir 	const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
867*cdf0e10cSrcweir     if( eHit == SDRHIT_UNMARKEDOBJECT )
868*cdf0e10cSrcweir 	{
869*cdf0e10cSrcweir 		// if not multi selection, unmark all
870*cdf0e10cSrcweir 		if ( !rMEvt.IsShift() )
871*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir 		if ( m_rView.MarkObj(m_aMDPos) && rMEvt.IsLeft() )
874*cdf0e10cSrcweir 		{
875*cdf0e10cSrcweir 			// drag object
876*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->BegDragObj(m_aMDPos, m_rView.PickHandle(m_aMDPos), &m_rView);
877*cdf0e10cSrcweir 		}
878*cdf0e10cSrcweir 		else
879*cdf0e10cSrcweir 		{
880*cdf0e10cSrcweir 			// select object
881*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj(m_aMDPos,&m_rView);
882*cdf0e10cSrcweir 		}
883*cdf0e10cSrcweir 	}
884*cdf0e10cSrcweir     else
885*cdf0e10cSrcweir     {
886*cdf0e10cSrcweir         if( !rMEvt.IsShift() )
887*cdf0e10cSrcweir             m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
888*cdf0e10cSrcweir 			//m_rView.UnmarkAll();
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir         if ( rMEvt.GetClicks() == 1 )
891*cdf0e10cSrcweir 		{
892*cdf0e10cSrcweir 			m_bSelectionMode = true;
893*cdf0e10cSrcweir 		    m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos ,&m_rView);
894*cdf0e10cSrcweir 		}
895*cdf0e10cSrcweir         else
896*cdf0e10cSrcweir         {
897*cdf0e10cSrcweir             m_rView.SdrBeginTextEdit( aVEvt.pRootObj,m_rView.GetSdrPageView(),m_pParent,sal_False );
898*cdf0e10cSrcweir         }
899*cdf0e10cSrcweir     }
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir 	return sal_True;
902*cdf0e10cSrcweir }
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir //----------------------------------------------------------------------------
905*cdf0e10cSrcweir 
906*cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
907*cdf0e10cSrcweir {
908*cdf0e10cSrcweir 	if ( DlgEdFunc::MouseButtonUp( rMEvt ) )
909*cdf0e10cSrcweir         return sal_True;
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 	// get view from parent
912*cdf0e10cSrcweir 	const Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 	if ( rMEvt.IsLeft() )                     // left mousebutton pressed
915*cdf0e10cSrcweir         checkMovementAllowed(rMEvt);
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir     m_pParent->getSectionWindow()->getViewsWindow()->EndAction();
918*cdf0e10cSrcweir     checkTwoCklicks(rMEvt);
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir 	m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
921*cdf0e10cSrcweir 
922*cdf0e10cSrcweir     if ( !m_bUiActive )
923*cdf0e10cSrcweir     	m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->UpdatePropertyBrowserDelayed(m_rView);
924*cdf0e10cSrcweir 	m_bSelectionMode = false;
925*cdf0e10cSrcweir 	return sal_True;
926*cdf0e10cSrcweir }
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir //----------------------------------------------------------------------------
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
931*cdf0e10cSrcweir {
932*cdf0e10cSrcweir     if ( DlgEdFunc::MouseMove(rMEvt ) )
933*cdf0e10cSrcweir         return sal_True;
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir 	Point aPnt( m_pParent->PixelToLogic( rMEvt.GetPosPixel() ) );
936*cdf0e10cSrcweir     bool bIsSetPoint = false;
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir 	if ( m_rView.IsAction() ) // Drag Mode
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir         bIsSetPoint = setMovementPointer(rMEvt);
941*cdf0e10cSrcweir 		ForceScroll(aPnt);
942*cdf0e10cSrcweir 		if (m_rView.GetDragMethod()==NULL)
943*cdf0e10cSrcweir 		{
944*cdf0e10cSrcweir             // create a selection
945*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, true, false);
946*cdf0e10cSrcweir 		}
947*cdf0e10cSrcweir 		else
948*cdf0e10cSrcweir 		{
949*cdf0e10cSrcweir             if ( m_rView.IsDragResize() )
950*cdf0e10cSrcweir             {
951*cdf0e10cSrcweir                 // we resize the object don't resize to above sections
952*cdf0e10cSrcweir                 if ( aPnt.Y() < 0 )
953*cdf0e10cSrcweir                 {
954*cdf0e10cSrcweir                     aPnt.Y() = 0;
955*cdf0e10cSrcweir                 }
956*cdf0e10cSrcweir                 // grow section if it is under the current section
957*cdf0e10cSrcweir //                else
958*cdf0e10cSrcweir //                {
959*cdf0e10cSrcweir //                    const Size& aSectionSize = m_rView->GetSizePixel();
960*cdf0e10cSrcweir //                    if ( aPnt.Y() > aSectionSize.Height() )
961*cdf0e10cSrcweir //                    {
962*cdf0e10cSrcweir //                        aPnt.Y() = aSectionSize.Height();
963*cdf0e10cSrcweir //                    }
964*cdf0e10cSrcweir //                }
965*cdf0e10cSrcweir             }
966*cdf0e10cSrcweir             // drag or resize an object
967*cdf0e10cSrcweir             bool bControlKey = rMEvt.IsMod1();
968*cdf0e10cSrcweir 			m_pParent->getSectionWindow()->getViewsWindow()->MovAction(aPnt, &m_rView, false, bControlKey);
969*cdf0e10cSrcweir 		}
970*cdf0e10cSrcweir 	}
971*cdf0e10cSrcweir 
972*cdf0e10cSrcweir     if ( !bIsSetPoint )
973*cdf0e10cSrcweir     {
974*cdf0e10cSrcweir         m_pParent->SetPointer( m_rView.GetPreferedPointer( aPnt, m_pParent) );
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir 		// restore color
977*cdf0e10cSrcweir 		unColorizeOverlappedObj();
978*cdf0e10cSrcweir     }
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir 	return sal_True;
981*cdf0e10cSrcweir }
982*cdf0e10cSrcweir // -----------------------------------------------------------------------------
983*cdf0e10cSrcweir //void DlgEdFuncSelect::SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag)
984*cdf0e10cSrcweir //{
985*cdf0e10cSrcweir //
986*cdf0e10cSrcweir //	SdrPageView* pPV = m_rView.GetSdrPageView();
987*cdf0e10cSrcweir //	if( _pTextObj && _pTextObj->GetPage() == pPV->GetPage() )
988*cdf0e10cSrcweir //	{
989*cdf0e10cSrcweir //		m_rView.SetCurrentObj(OBJ_TEXT);
990*cdf0e10cSrcweir //    	m_rView.SetEditMode(SDREDITMODE_EDIT);
991*cdf0e10cSrcweir //
992*cdf0e10cSrcweir //		sal_Bool bEmptyOutliner = sal_False;
993*cdf0e10cSrcweir //
994*cdf0e10cSrcweir //		if (!_pTextObj->GetOutlinerParaObject() && m_rView.GetTextEditOutliner())
995*cdf0e10cSrcweir //		{
996*cdf0e10cSrcweir //			::SdrOutliner* pOutl = m_rView.GetTextEditOutliner();
997*cdf0e10cSrcweir //			sal_uLong nParaAnz = pOutl->GetParagraphCount();
998*cdf0e10cSrcweir //			Paragraph* p1stPara = pOutl->GetParagraph( 0 );
999*cdf0e10cSrcweir //
1000*cdf0e10cSrcweir //			if (nParaAnz==1 && p1stPara)
1001*cdf0e10cSrcweir //			{
1002*cdf0e10cSrcweir //				// Bei nur einem Pararaph
1003*cdf0e10cSrcweir //				if (pOutl->GetText(p1stPara).Len() == 0)
1004*cdf0e10cSrcweir //				{
1005*cdf0e10cSrcweir //					bEmptyOutliner = sal_True;
1006*cdf0e10cSrcweir //				}
1007*cdf0e10cSrcweir //			}
1008*cdf0e10cSrcweir //		}
1009*cdf0e10cSrcweir //
1010*cdf0e10cSrcweir //		if (_pTextObj != m_rView.GetTextEditObject() || bEmptyOutliner)
1011*cdf0e10cSrcweir //		{
1012*cdf0e10cSrcweir //			sal_uInt32 nInv = _pTextObj->GetObjInventor();
1013*cdf0e10cSrcweir //			sal_uInt16 nSdrObjKind = _pTextObj->GetObjIdentifier();
1014*cdf0e10cSrcweir //
1015*cdf0e10cSrcweir //			if (nInv == SdrInventor && _pTextObj->HasTextEdit() &&
1016*cdf0e10cSrcweir //				(nSdrObjKind == OBJ_TEXT ||
1017*cdf0e10cSrcweir //			 	nSdrObjKind == OBJ_TITLETEXT ||
1018*cdf0e10cSrcweir //			 	nSdrObjKind == OBJ_OUTLINETEXT ||
1019*cdf0e10cSrcweir //			 	(_pTextObj->ISA(SdrTextObj) && !_pTextObj->IsEmptyPresObj())))
1020*cdf0e10cSrcweir //			{
1021*cdf0e10cSrcweir //				// Neuen Outliner machen (gehoert der SdrObjEditView)
1022*cdf0e10cSrcweir //                SdrModel* pModel = _pTextObj->GetModel();
1023*cdf0e10cSrcweir //                SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, pModel );
1024*cdf0e10cSrcweir //				pOutl->SetMinDepth(0);
1025*cdf0e10cSrcweir //				pOutl->SetStyleSheetPool((SfxStyleSheetPool*) pModel->GetStyleSheetPool());
1026*cdf0e10cSrcweir //				//pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
1027*cdf0e10cSrcweir //				sal_uLong nCntrl = pOutl->GetControlWord();
1028*cdf0e10cSrcweir //				nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
1029*cdf0e10cSrcweir //				nCntrl |= EE_CNTRL_URLSFXEXECUTE;
1030*cdf0e10cSrcweir //				nCntrl |= EE_CNTRL_MARKFIELDS;
1031*cdf0e10cSrcweir //				nCntrl |= EE_CNTRL_AUTOCORRECT;
1032*cdf0e10cSrcweir //
1033*cdf0e10cSrcweir //				nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
1034*cdf0e10cSrcweir //				//if ( pModel->IsSummationOfParagraphs() )
1035*cdf0e10cSrcweir //				//    nCntrl |= EE_CNTRL_ULSPACESUMMATION;
1036*cdf0e10cSrcweir //
1037*cdf0e10cSrcweir //				//SetSpellOptions( nCntrl );
1038*cdf0e10cSrcweir //
1039*cdf0e10cSrcweir //				pOutl->SetControlWord(nCntrl);
1040*cdf0e10cSrcweir //
1041*cdf0e10cSrcweir //                uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
1042*cdf0e10cSrcweir //	            if ( xSpellChecker.is() )
1043*cdf0e10cSrcweir //		            pOutl->SetSpeller( xSpellChecker );
1044*cdf0e10cSrcweir //
1045*cdf0e10cSrcweir //                uno::Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
1046*cdf0e10cSrcweir //	            if( xHyphenator.is() )
1047*cdf0e10cSrcweir //		            pOutl->SetHyphenator( xHyphenator );
1048*cdf0e10cSrcweir //
1049*cdf0e10cSrcweir //				pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
1050*cdf0e10cSrcweir //
1051*cdf0e10cSrcweir //				// in einem Gliederungstext darf nicht auf die 0-te
1052*cdf0e10cSrcweir //				// Ebene ausgerueckt werden
1053*cdf0e10cSrcweir //				if (_pTextObj->GetObjInventor() == SdrInventor &&
1054*cdf0e10cSrcweir //					_pTextObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
1055*cdf0e10cSrcweir //				{
1056*cdf0e10cSrcweir //					pOutl->SetMinDepth(1);
1057*cdf0e10cSrcweir //				}
1058*cdf0e10cSrcweir //
1059*cdf0e10cSrcweir //				if (bEmptyOutliner)
1060*cdf0e10cSrcweir //				{
1061*cdf0e10cSrcweir //					m_rView.SdrEndTextEdit(sal_True);
1062*cdf0e10cSrcweir //				}
1063*cdf0e10cSrcweir //
1064*cdf0e10cSrcweir //				if( _pTextObj )
1065*cdf0e10cSrcweir //				{
1066*cdf0e10cSrcweir //					OutlinerParaObject* pOPO = _pTextObj->GetOutlinerParaObject();
1067*cdf0e10cSrcweir //					if( ( pOPO && pOPO->IsVertical() ) /*||
1068*cdf0e10cSrcweir //						nSlotId == SID_ATTR_CHAR_VERTICAL ||
1069*cdf0e10cSrcweir //						nSlotId == SID_TEXT_FITTOSIZE_VERTICAL */)
1070*cdf0e10cSrcweir //						pOutl->SetVertical( sal_True );
1071*cdf0e10cSrcweir //
1072*cdf0e10cSrcweir //
1073*cdf0e10cSrcweir //					if (m_rView.SdrBeginTextEdit(_pTextObj, pPV, pParent, sal_True, pOutl) && _pTextObj->GetObjInventor() == SdrInventor)
1074*cdf0e10cSrcweir //					{
1075*cdf0e10cSrcweir //						//bFirstObjCreated = sal_True;
1076*cdf0e10cSrcweir //						//DeleteDefaultText();
1077*cdf0e10cSrcweir //
1078*cdf0e10cSrcweir //						OutlinerView* pOLV = m_rView.GetTextEditOutlinerView();
1079*cdf0e10cSrcweir //
1080*cdf0e10cSrcweir //						nSdrObjKind = _pTextObj->GetObjIdentifier();
1081*cdf0e10cSrcweir //
1082*cdf0e10cSrcweir //						SdrViewEvent aVEvt;
1083*cdf0e10cSrcweir //						SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
1084*cdf0e10cSrcweir //
1085*cdf0e10cSrcweir //						if (eHit == SDRHIT_TEXTEDIT)
1086*cdf0e10cSrcweir //						{
1087*cdf0e10cSrcweir //							// Text getroffen
1088*cdf0e10cSrcweir //							if (nSdrObjKind == OBJ_TEXT ||
1089*cdf0e10cSrcweir //								nSdrObjKind == OBJ_TITLETEXT ||
1090*cdf0e10cSrcweir //								nSdrObjKind == OBJ_OUTLINETEXT ||
1091*cdf0e10cSrcweir //								//nSlotId == SID_TEXTEDIT ||
1092*cdf0e10cSrcweir //								!bQuickDrag)
1093*cdf0e10cSrcweir //							{
1094*cdf0e10cSrcweir //								pOLV->MouseButtonDown(rMEvt);
1095*cdf0e10cSrcweir //								pOLV->MouseMove(rMEvt);
1096*cdf0e10cSrcweir //								pOLV->MouseButtonUp(rMEvt);
1097*cdf0e10cSrcweir //							}
1098*cdf0e10cSrcweir //
1099*cdf0e10cSrcweir //							if ( bQuickDrag && _pTextObj->GetOutlinerParaObject())
1100*cdf0e10cSrcweir //							{
1101*cdf0e10cSrcweir //								pOLV->MouseButtonDown(rMEvt);
1102*cdf0e10cSrcweir //							}
1103*cdf0e10cSrcweir //						}
1104*cdf0e10cSrcweir //						else
1105*cdf0e10cSrcweir //						{
1106*cdf0e10cSrcweir //							// #98198# Move cursor to end of text
1107*cdf0e10cSrcweir //							ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
1108*cdf0e10cSrcweir //							pOLV->SetSelection(aNewSelection);
1109*cdf0e10cSrcweir //						}
1110*cdf0e10cSrcweir //					}
1111*cdf0e10cSrcweir //					else
1112*cdf0e10cSrcweir //					{
1113*cdf0e10cSrcweir //						//RestoreDefaultText();
1114*cdf0e10cSrcweir //					}
1115*cdf0e10cSrcweir //				}
1116*cdf0e10cSrcweir //			}
1117*cdf0e10cSrcweir //		}
1118*cdf0e10cSrcweir //	}
1119*cdf0e10cSrcweir //	else
1120*cdf0e10cSrcweir //		_pTextObj = NULL;
1121*cdf0e10cSrcweir //}
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir //----------------------------------------------------------------------------
1125*cdf0e10cSrcweir }
1126