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