xref: /AOO41X/main/sd/source/ui/func/futext.cxx (revision ee09355404ff3c4e10d1b74175c316c2345ff9cc)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "futext.hxx"
29cdf0e10cSrcweir #include <editeng/eeitem.hxx>
30cdf0e10cSrcweir #include <editeng/editerr.hxx>
31cdf0e10cSrcweir #include <svx/dlgutil.hxx>
32cdf0e10cSrcweir #include <svx/svxerr.hxx>
33cdf0e10cSrcweir #include <tools/urlobj.hxx>
34cdf0e10cSrcweir #include <vcl/help.hxx>
35cdf0e10cSrcweir #include <editeng/editstat.hxx>
36cdf0e10cSrcweir #include <svl/aeitem.hxx>
37cdf0e10cSrcweir #include <svl/intitem.hxx>
38cdf0e10cSrcweir #include <svx/svdotext.hxx>
39cdf0e10cSrcweir #include <svx/svdogrp.hxx>
40d975be8cSAndre Fischer #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
41cdf0e10cSrcweir #include <editeng/flditem.hxx>
42cdf0e10cSrcweir #include <svl/style.hxx>
43cdf0e10cSrcweir #include <svx/svdpagv.hxx>
44cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
45cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
46cdf0e10cSrcweir #include <sfx2/bindings.hxx>
47cdf0e10cSrcweir #include <sfx2/request.hxx>
48cdf0e10cSrcweir #include <editeng/editeng.hxx>
49cdf0e10cSrcweir #include <svx/svdoutl.hxx>
50cdf0e10cSrcweir #include <svx/svxids.hrc>
51cdf0e10cSrcweir #include <sfx2/docfile.hxx>
52b9e67834SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
53cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
54cdf0e10cSrcweir #include <editeng/outlobj.hxx>
55cdf0e10cSrcweir #include <svtools/langtab.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir // #104122#
58cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #include <svx/svdetc.hxx>
61cdf0e10cSrcweir #include <editeng/editview.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #include "sdresid.hxx"
64cdf0e10cSrcweir #include "app.hrc"
65cdf0e10cSrcweir #include "res_bmp.hrc"
66cdf0e10cSrcweir #include "ViewShell.hxx"
67cdf0e10cSrcweir #include "ViewShellBase.hxx"
68cdf0e10cSrcweir #include "View.hxx"
69cdf0e10cSrcweir #include "Outliner.hxx"
70cdf0e10cSrcweir #include "Window.hxx"
71cdf0e10cSrcweir #include "drawdoc.hxx"
72cdf0e10cSrcweir #include "sdpage.hxx"
73cdf0e10cSrcweir #include "sdmod.hxx"
74cdf0e10cSrcweir #include "FrameView.hxx"
75cdf0e10cSrcweir #include "ToolBarManager.hxx"
76cdf0e10cSrcweir #include "DrawDocShell.hxx"
77cdf0e10cSrcweir #include "glob.hrc"
78cdf0e10cSrcweir #include "pres.hxx"
79cdf0e10cSrcweir #include "optsitem.hxx"
80cdf0e10cSrcweir 
81cdf0e10cSrcweir using ::rtl::OUString;
82cdf0e10cSrcweir using namespace ::com::sun::star;
83cdf0e10cSrcweir using namespace ::com::sun::star::uno;
84cdf0e10cSrcweir using namespace ::com::sun::star::lang;
85cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir namespace sd {
88cdf0e10cSrcweir 
89cdf0e10cSrcweir static sal_uInt16 SidArray[] = {
90cdf0e10cSrcweir 	SID_STYLE_FAMILY2,                //    5542
91cdf0e10cSrcweir 	SID_STYLE_FAMILY5,                //    5545
92cdf0e10cSrcweir 	SID_CUT,                          //    5710
93cdf0e10cSrcweir 	SID_COPY,                         //    5711
94cdf0e10cSrcweir 	SID_ATTR_TABSTOP,                 //   10002
95cdf0e10cSrcweir 	SID_ATTR_CHAR_FONT,               //   10007
96cdf0e10cSrcweir 	SID_ATTR_CHAR_POSTURE,            //   10008
97cdf0e10cSrcweir 	SID_ATTR_CHAR_WEIGHT,             //   10009
98cdf0e10cSrcweir 	SID_ATTR_CHAR_UNDERLINE,          //   10014
99cdf0e10cSrcweir 	SID_ATTR_CHAR_FONTHEIGHT,         //   10015
100cdf0e10cSrcweir 	SID_ATTR_CHAR_COLOR,              //   10017
101cdf0e10cSrcweir 	SID_ATTR_PARA_ADJUST_LEFT,        //   10028
102cdf0e10cSrcweir 	SID_ATTR_PARA_ADJUST_RIGHT,       //   10029
103cdf0e10cSrcweir 	SID_ATTR_PARA_ADJUST_CENTER,      //   10030
104cdf0e10cSrcweir 	SID_ATTR_PARA_ADJUST_BLOCK,       //   10031
105cdf0e10cSrcweir 	SID_ATTR_PARA_LINESPACE_10,       //   10034
106cdf0e10cSrcweir 	SID_ATTR_PARA_LINESPACE_15,       //   10035
107cdf0e10cSrcweir 	SID_ATTR_PARA_LINESPACE_20,       //   10036
108cdf0e10cSrcweir 	SID_ATTR_PARA_LRSPACE,            //   10043
109*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_POS_X, //  10088
110*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_POS_Y, //  10089
111*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_WIDTH, //  10090
112*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_HEIGHT,//  10091
113*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_ROT_X, //  10093
114*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_ROT_Y, //  10094
115*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_ANGLE, //  10095 //Added
116cdf0e10cSrcweir 	SID_OUTLINE_UP,                   //   10150
117cdf0e10cSrcweir 	SID_OUTLINE_DOWN,                 //   10151
118cdf0e10cSrcweir 	SID_OUTLINE_LEFT,                 //   10152
119cdf0e10cSrcweir 	SID_OUTLINE_RIGHT,                //   10153
120*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_PROTECT_POS,//  10236
121*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_PROTECT_SIZE,// 10237 //Added
122cdf0e10cSrcweir 	SID_FORMTEXT_STYLE,               //   10257
123cdf0e10cSrcweir 	SID_SET_SUPER_SCRIPT,             //   10294
124cdf0e10cSrcweir 	SID_SET_SUB_SCRIPT,               //   10295
125*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_AUTOWIDTH,//    10310
126*ee093554SAndre Fischer     SID_ATTR_TRANSFORM_AUTOHEIGHT,//   10311 //Added
127cdf0e10cSrcweir 	SID_HYPERLINK_GETLINK,            //   10361
128cdf0e10cSrcweir 	SID_CHARMAP,					  //   10503
129cdf0e10cSrcweir 	SID_TEXTDIRECTION_LEFT_TO_RIGHT,  //   10907
130cdf0e10cSrcweir 	SID_TEXTDIRECTION_TOP_TO_BOTTOM,  //   10908
131cdf0e10cSrcweir     SID_ATTR_PARA_LEFT_TO_RIGHT,      //   10950
132cdf0e10cSrcweir     SID_ATTR_PARA_RIGHT_TO_LEFT,      //   10951
133cdf0e10cSrcweir 	FN_NUM_BULLET_ON,                 //   20138
134cdf0e10cSrcweir 	SID_PARASPACE_INCREASE,           //   27346
135cdf0e10cSrcweir 	SID_PARASPACE_DECREASE,           //   27347
136cdf0e10cSrcweir 							0 };
137cdf0e10cSrcweir 
138cdf0e10cSrcweir TYPEINIT1( FuText, FuConstruct );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
141cdf0e10cSrcweir static sal_Bool bTestText = 0;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir /*************************************************************************
144cdf0e10cSrcweir |*
145cdf0e10cSrcweir |* Basisklasse fuer Textfunktionen
146cdf0e10cSrcweir |*
147cdf0e10cSrcweir \************************************************************************/
148cdf0e10cSrcweir 
149cdf0e10cSrcweir FuText::FuText( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
150cdf0e10cSrcweir : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
151cdf0e10cSrcweir , bFirstObjCreated(sal_False)
152cdf0e10cSrcweir , rRequest (rReq)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir FunctionReference FuText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	FunctionReference xFunc( new FuText( pViewSh, pWin, pView, pDoc, rReq ) );
159cdf0e10cSrcweir 	return xFunc;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir /*************************************************************************
163cdf0e10cSrcweir |*
164cdf0e10cSrcweir |* Destruktor
165cdf0e10cSrcweir |*
166cdf0e10cSrcweir \************************************************************************/
167cdf0e10cSrcweir 
168cdf0e10cSrcweir void FuText::disposing()
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	if(mpView)
171cdf0e10cSrcweir 	{
172cdf0e10cSrcweir 		if(mpView->SdrEndTextEdit(sal_False) == SDRENDTEXTEDIT_DELETED)
173cdf0e10cSrcweir 			mxTextObj.reset( 0 );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 		// die RequestHandler der benutzten Outliner zuruecksetzen auf den
176cdf0e10cSrcweir 		// Handler am Dokument
177cdf0e10cSrcweir 		::Outliner* pOutliner = mpView->GetTextEditOutliner();
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 		if (pOutliner)
180cdf0e10cSrcweir 			pOutliner->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool()));
181cdf0e10cSrcweir 	}
182cdf0e10cSrcweir }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir /*************************************************************************
185cdf0e10cSrcweir |*
186cdf0e10cSrcweir |* Execute functionality of this class:
187cdf0e10cSrcweir |*
188cdf0e10cSrcweir |* #71422: Start the functionality of this class in this method
189cdf0e10cSrcweir |* and not in the ctor.
190cdf0e10cSrcweir |* If you construct an object of this class and you put the
191cdf0e10cSrcweir |* address of this object to pFuActual you've got a problem,
192cdf0e10cSrcweir |* because some methods inside DoExecute use the pFuActual-Pointer.
193cdf0e10cSrcweir |* If the code inside DoExecute is executed inside the ctor,
194cdf0e10cSrcweir |* the value of pFuActual is not right. And the value will not
195cdf0e10cSrcweir |* be right until the ctor finished !!!
196cdf0e10cSrcweir |*
197cdf0e10cSrcweir \************************************************************************/
198cdf0e10cSrcweir void FuText::DoExecute( SfxRequest& )
199cdf0e10cSrcweir {
200cdf0e10cSrcweir 	mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell(
201cdf0e10cSrcweir         ToolBarManager::TBG_FUNCTION,
202cdf0e10cSrcweir         RID_DRAW_TEXT_TOOLBOX);
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	mpView->SetCurrentObj(OBJ_TEXT);
205cdf0e10cSrcweir 	mpView->SetEditMode(SDREDITMODE_EDIT);
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	if (nSlotId == SID_TEXTEDIT)
210cdf0e10cSrcweir 	{
211cdf0e10cSrcweir 		// Try to select an object
212cdf0e10cSrcweir 		SdrPageView* pPV = mpView->GetSdrPageView();
213cdf0e10cSrcweir 		SdrViewEvent aVEvt;
214cdf0e10cSrcweir 		mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
215cdf0e10cSrcweir 		mpView->MarkObj(aVEvt.pRootObj, pPV);
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 		mxTextObj.reset( dynamic_cast< SdrTextObj* >( aVEvt.pObj ) );
218cdf0e10cSrcweir 	}
219cdf0e10cSrcweir 	else if (mpView->AreObjectsMarked())
220cdf0e10cSrcweir 	{
221cdf0e10cSrcweir 		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 		if (rMarkList.GetMarkCount() == 1)
224cdf0e10cSrcweir 		{
225cdf0e10cSrcweir 			SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
226cdf0e10cSrcweir 			mxTextObj.reset( dynamic_cast< SdrTextObj* >( pObj ) );
227cdf0e10cSrcweir 		}
228cdf0e10cSrcweir 	}
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	// check for table
231cdf0e10cSrcweir 	if (mpView->AreObjectsMarked())
232cdf0e10cSrcweir 	{
233cdf0e10cSrcweir 		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 		if (rMarkList.GetMarkCount() == 1)
236cdf0e10cSrcweir 		{
237cdf0e10cSrcweir 			SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
238cdf0e10cSrcweir 			if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
239cdf0e10cSrcweir 			{
240cdf0e10cSrcweir 				mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBarShell( ToolBarManager::TBG_FUNCTION, RID_DRAW_TABLE_TOOLBOX );
241cdf0e10cSrcweir 			}
242cdf0e10cSrcweir 		}
243cdf0e10cSrcweir 	}
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	sal_Bool bQuickDrag = sal_True;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	const SfxItemSet* pArgs = rRequest.GetArgs();
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	if (pArgs
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 		// #98198# test for type before using
252cdf0e10cSrcweir 		&& SID_TEXTEDIT == nSlotId
253cdf0e10cSrcweir 		&& SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 		&& (sal_uInt16)((SfxUInt16Item&)pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
256cdf0e10cSrcweir 	{
257cdf0e10cSrcweir 		// Selection by doubleclick -> don't allow QuickDrag
258cdf0e10cSrcweir 		bQuickDrag = sal_False;
259cdf0e10cSrcweir 	}
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 	SetInEditMode(aMEvt, bQuickDrag);
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir /*************************************************************************
265cdf0e10cSrcweir |*
266cdf0e10cSrcweir |* MouseButtonDown-event
267cdf0e10cSrcweir |*
268cdf0e10cSrcweir \************************************************************************/
269cdf0e10cSrcweir 
270cdf0e10cSrcweir sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	bMBDown = sal_True;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     /* af: (de)Select object before showing the context menu.
277cdf0e10cSrcweir 	// Fuer PopupMenu (vorher DrawViewShell)
278cdf0e10cSrcweir 	if ((rMEvt.GetButtons() == MOUSE_RIGHT) && rMEvt.GetClicks() == 1 &&
279cdf0e10cSrcweir 		mpView->IsTextEdit())
280cdf0e10cSrcweir 	{
281cdf0e10cSrcweir 		return (sal_True);
282cdf0e10cSrcweir 	}
283cdf0e10cSrcweir         */
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	mpView->SetMarkHdlWhenTextEdit(sal_True);
286cdf0e10cSrcweir 	SdrViewEvent aVEvt;
287cdf0e10cSrcweir 	SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	if (eHit == SDRHIT_TEXTEDIT)
290cdf0e10cSrcweir 	{
291cdf0e10cSrcweir 		// Text getroffen -> Event von SdrView auswerten lassen
292cdf0e10cSrcweir 		if (mpView->MouseButtonDown(rMEvt, mpWindow))
293cdf0e10cSrcweir 			return (sal_True);
294cdf0e10cSrcweir 	}
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	if (rMEvt.GetClicks() == 1)
297cdf0e10cSrcweir 	{
298cdf0e10cSrcweir 		if (mpView->IsTextEdit() && eHit != SDRHIT_MARKEDOBJECT && eHit != SDRHIT_HANDLE)
299cdf0e10cSrcweir 		{
300cdf0e10cSrcweir 			// Texteingabe beenden
301cdf0e10cSrcweir 			if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
302cdf0e10cSrcweir 			{
303cdf0e10cSrcweir 				// Bugfix von MBA: bei Doppelclick auf der Wiese im Modus Text wird
304cdf0e10cSrcweir 				// beim zweiten Click eHit = SDRHIT_TEXTEDITOBJ erhalten, weil ja der
305cdf0e10cSrcweir 				// zweite Click auf das im ersten Click angelegte TextObject geht.
306cdf0e10cSrcweir 				// Dieses wird aber in SdrEndTextEdit entfernt, weil es leer ist. Es
307cdf0e10cSrcweir 				// befindet sich aber noch in der Mark-Liste und der Aufruf MarkObj
308cdf0e10cSrcweir 				// weiter unten greift dann auf das tote Object zu.
309cdf0e10cSrcweir 				// Als einfacher Fix wird nach SdrEndTextEdit noch einmal eHit ermittelt,
310cdf0e10cSrcweir 				// was dann SDRHIT_NONE liefert.
311cdf0e10cSrcweir 				mxTextObj.reset( NULL );
312cdf0e10cSrcweir 				eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
313cdf0e10cSrcweir 			}
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 			mpView->SetCurrentObj(OBJ_TEXT);
316cdf0e10cSrcweir 			mpView->SetEditMode(SDREDITMODE_EDIT);
317cdf0e10cSrcweir 		}
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 		if (rMEvt.IsLeft() || rMEvt.IsRight())
320cdf0e10cSrcweir 		{
321cdf0e10cSrcweir 			mpWindow->CaptureMouse();
322cdf0e10cSrcweir 			SdrObject* pObj;
323cdf0e10cSrcweir 			SdrPageView* pPV = mpView->GetSdrPageView();
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 			if (eHit == SDRHIT_TEXTEDIT)
326cdf0e10cSrcweir 			{
327cdf0e10cSrcweir 				SetInEditMode(rMEvt, sal_False);
328cdf0e10cSrcweir 			}
329cdf0e10cSrcweir 			else
330cdf0e10cSrcweir 			{
331cdf0e10cSrcweir 				sal_Bool bMacro = sal_False;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 				if (bMacro && mpView->PickObj(aMDPos,mpView->getHitTolLog(),pObj,pPV,SDRSEARCH_PICKMACRO))
334cdf0e10cSrcweir 				{
335cdf0e10cSrcweir 					// Makro
336cdf0e10cSrcweir 					sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
337cdf0e10cSrcweir 					mpView->BegMacroObj(aMDPos,nHitLog,pObj,pPV,mpWindow);
338cdf0e10cSrcweir 				}
339cdf0e10cSrcweir 				else
340cdf0e10cSrcweir 				{
341cdf0e10cSrcweir 					if (eHit != SDRHIT_HANDLE)
342cdf0e10cSrcweir 					{
343cdf0e10cSrcweir 						// Selektion aufheben
344cdf0e10cSrcweir 						if (!rMEvt.IsShift() && eHit == SDRHIT_TEXTEDITOBJ)
345cdf0e10cSrcweir 						{
346cdf0e10cSrcweir 							mpView->UnmarkAll();
347cdf0e10cSrcweir 							mpView->SetDragMode(SDRDRAG_MOVE);
348cdf0e10cSrcweir 						}
349cdf0e10cSrcweir 					}
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 					if ( aVEvt.eEvent == SDREVENT_EXECUTEURL                   ||
352cdf0e10cSrcweir 						 eHit == SDRHIT_HANDLE                                 ||
353cdf0e10cSrcweir 						 eHit == SDRHIT_MARKEDOBJECT                           ||
354cdf0e10cSrcweir 						 eHit == SDRHIT_TEXTEDITOBJ                            ||
355cdf0e10cSrcweir 						 ( eHit == SDRHIT_UNMARKEDOBJECT && bFirstObjCreated &&
356cdf0e10cSrcweir 						   !bPermanent ) )
357cdf0e10cSrcweir 					{
358cdf0e10cSrcweir 						/**********************************************************
359cdf0e10cSrcweir 						* Handle, markiertes oder unmarkiertes Objekt getroffen
360cdf0e10cSrcweir 						**********************************************************/
361cdf0e10cSrcweir 						if (eHit == SDRHIT_TEXTEDITOBJ)
362cdf0e10cSrcweir 						{
363cdf0e10cSrcweir 							/******************************************************
364cdf0e10cSrcweir 							* Text eines unmarkierten Objekts getroffen:
365cdf0e10cSrcweir 							* Objekt wird selektiert und in EditMode versetzt
366cdf0e10cSrcweir 							******************************************************/
367cdf0e10cSrcweir 							mpView->MarkObj(aVEvt.pRootObj, pPV);
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 							if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
370cdf0e10cSrcweir 							{
371cdf0e10cSrcweir 								mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) );
372cdf0e10cSrcweir 							}
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 							SetInEditMode(rMEvt, sal_True);
375cdf0e10cSrcweir 						}
376cdf0e10cSrcweir 						else if (aVEvt.eEvent == SDREVENT_EXECUTEURL && !rMEvt.IsMod2())
377cdf0e10cSrcweir 						{
378cdf0e10cSrcweir 							/******************************************************
379cdf0e10cSrcweir 							* URL ausfuehren
380cdf0e10cSrcweir 							******************************************************/
381cdf0e10cSrcweir 							mpWindow->ReleaseMouse();
382cdf0e10cSrcweir 							SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
383cdf0e10cSrcweir 							SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
384cdf0e10cSrcweir 							SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
385cdf0e10cSrcweir 							SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
386cdf0e10cSrcweir 							mpWindow->ReleaseMouse();
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 							if (rMEvt.IsMod1())
389cdf0e10cSrcweir 							{
390cdf0e10cSrcweir 								// Im neuen Frame oeffnen
391cdf0e10cSrcweir 								pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
392cdf0e10cSrcweir 											&aStrItem, &aBrowseItem, &aReferer, 0L);
393cdf0e10cSrcweir 							}
394cdf0e10cSrcweir 							else
395cdf0e10cSrcweir 							{
396cdf0e10cSrcweir 								// Im aktuellen Frame oeffnen
397cdf0e10cSrcweir 								SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
398cdf0e10cSrcweir 								pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
399cdf0e10cSrcweir 											&aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
400cdf0e10cSrcweir 							}
401cdf0e10cSrcweir 						}
402cdf0e10cSrcweir 						else
403cdf0e10cSrcweir 						{
404cdf0e10cSrcweir 							/******************************************************
405cdf0e10cSrcweir 							* Objekt oder Handle draggen
406cdf0e10cSrcweir 							******************************************************/
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 							// #i78748#
409cdf0e10cSrcweir 							// do the EndTextEdit first, it will delete the handles and force a
410cdf0e10cSrcweir 							// recreation. This will make aVEvt.pHdl to point to a deleted handle,
411cdf0e10cSrcweir 							// thus it is necessary to reset it and to get it again.
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 							// #i112855#
414cdf0e10cSrcweir 							// cl: I'm not sure why we checked here also for mxTextObj->GetOutlinerParaObjet
415cdf0e10cSrcweir 							// this caused SdrEndTextEdit() to be called also when not in text editing and
416cdf0e10cSrcweir 							// this does not make sense and caused troubles. (see issue 112855)
417cdf0e10cSrcweir 
418cdf0e10cSrcweir //							::Outliner* pOutl = mpView->GetTextEditOutliner();
419cdf0e10cSrcweir //
420cdf0e10cSrcweir //							if (mxTextObj.is() && (mxTextObj->GetOutlinerParaObject() ||
421cdf0e10cSrcweir //								(pOutl && pOutl->GetText(pOutl->GetParagraph( 0 )).Len() != 0)))
422cdf0e10cSrcweir 							if( mpView->IsTextEdit() )
423cdf0e10cSrcweir 							{
424cdf0e10cSrcweir 								mpView->SdrEndTextEdit();
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 								if(aVEvt.pHdl)
427cdf0e10cSrcweir 								{
428cdf0e10cSrcweir 									// force new handle identification, the pointer will be dead here
429cdf0e10cSrcweir 									// since SdrEndTextEdit has resetted (deleted) the handles.
430cdf0e10cSrcweir 									aVEvt.pHdl = 0;
431cdf0e10cSrcweir 									mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
432cdf0e10cSrcweir 								}
433cdf0e10cSrcweir 							}
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 							if (!aVEvt.pHdl)
436cdf0e10cSrcweir 							{
437cdf0e10cSrcweir 								if( eHit == SDRHIT_UNMARKEDOBJECT )
438cdf0e10cSrcweir 								{
439cdf0e10cSrcweir 									if ( !rMEvt.IsShift() )
440cdf0e10cSrcweir 										mpView->UnmarkAll();
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 									mpView->MarkObj(aVEvt.pRootObj, pPV);
443cdf0e10cSrcweir 								}
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 								// Objekt draggen
446cdf0e10cSrcweir 								bFirstMouseMove = sal_True;
447cdf0e10cSrcweir 								aDragTimer.Start();
448cdf0e10cSrcweir 							}
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 
451cdf0e10cSrcweir                             if ( ! rMEvt.IsRight())
452cdf0e10cSrcweir                             {
453cdf0e10cSrcweir 							    // we need to pick again since SdrEndTextEdit can rebuild the handles list
454cdf0e10cSrcweir                                 eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
455cdf0e10cSrcweir 							    if( (eHit == SDRHIT_HANDLE) || (eHit == SDRHIT_MARKEDOBJECT) )
456cdf0e10cSrcweir 							    {
457cdf0e10cSrcweir 								    sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
458cdf0e10cSrcweir 								    mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
459cdf0e10cSrcweir 							    }
460cdf0e10cSrcweir                             }
461cdf0e10cSrcweir                             bReturn = true;
462cdf0e10cSrcweir 						}
463cdf0e10cSrcweir 					}
464cdf0e10cSrcweir 					else if ( nSlotId != SID_TEXTEDIT &&
465cdf0e10cSrcweir 							  (bPermanent || !bFirstObjCreated) )
466cdf0e10cSrcweir 					{
467cdf0e10cSrcweir 						/**********************************************************
468cdf0e10cSrcweir 						* Objekt erzeugen
469cdf0e10cSrcweir 						**********************************************************/
470cdf0e10cSrcweir 						mpView->SetCurrentObj(OBJ_TEXT);
471cdf0e10cSrcweir 						mpView->SetEditMode(SDREDITMODE_CREATE);
472cdf0e10cSrcweir 						sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
473cdf0e10cSrcweir 						mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
474cdf0e10cSrcweir 					}
475cdf0e10cSrcweir 					else
476cdf0e10cSrcweir 					{
477cdf0e10cSrcweir 						/**********************************************************
478cdf0e10cSrcweir 						* Selektieren
479cdf0e10cSrcweir 						**********************************************************/
480cdf0e10cSrcweir 						if( !rMEvt.IsShift() )
481cdf0e10cSrcweir 							mpView->UnmarkAll();
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 						mpView->BegMarkObj( aMDPos );
484cdf0e10cSrcweir 					}
485cdf0e10cSrcweir 				}
486cdf0e10cSrcweir 			}
487cdf0e10cSrcweir 		}
488cdf0e10cSrcweir 	}
489cdf0e10cSrcweir 	else if ( rMEvt.GetClicks() == 2 && !mpView->IsTextEdit() )
490cdf0e10cSrcweir 	{
491cdf0e10cSrcweir 		MouseEvent aMEvt( mpWindow->GetPointerPosPixel() );
492cdf0e10cSrcweir 		SetInEditMode( aMEvt, sal_False );
493cdf0e10cSrcweir 	}
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	if (!bIsInDragMode)
496cdf0e10cSrcweir 	{
497cdf0e10cSrcweir 		ForcePointer(&rMEvt);
498cdf0e10cSrcweir 		mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
499cdf0e10cSrcweir 	}
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 	return (bReturn);
502cdf0e10cSrcweir }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir /*************************************************************************
505cdf0e10cSrcweir |*
506cdf0e10cSrcweir |* MouseMove-event
507cdf0e10cSrcweir |*
508cdf0e10cSrcweir \************************************************************************/
509cdf0e10cSrcweir 
510cdf0e10cSrcweir sal_Bool FuText::MouseMove(const MouseEvent& rMEvt)
511cdf0e10cSrcweir {
512cdf0e10cSrcweir 	sal_Bool bReturn = FuDraw::MouseMove(rMEvt);
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 	if (aDragTimer.IsActive() )
515cdf0e10cSrcweir 	{
516cdf0e10cSrcweir 		if( bFirstMouseMove )
517cdf0e10cSrcweir 			bFirstMouseMove = sal_False;
518cdf0e10cSrcweir 		else
519cdf0e10cSrcweir 			aDragTimer.Stop();
520cdf0e10cSrcweir 	}
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	if (!bReturn && mpView->IsAction() && !mpDocSh->IsReadOnly())
523cdf0e10cSrcweir 	{
524cdf0e10cSrcweir 		Point aPix(rMEvt.GetPosPixel());
525cdf0e10cSrcweir 		Point aPnt(mpWindow->PixelToLogic(aPix));
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 		ForceScroll(aPix);
528cdf0e10cSrcweir 		mpView->MovAction(aPnt);
529cdf0e10cSrcweir 	}
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 	ForcePointer(&rMEvt);
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 	return (bReturn);
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir /*************************************************************************
537cdf0e10cSrcweir |*
538cdf0e10cSrcweir |* MouseButtonUp-event
539cdf0e10cSrcweir |*
540cdf0e10cSrcweir \************************************************************************/
541cdf0e10cSrcweir 
542cdf0e10cSrcweir // #97016#
543cdf0e10cSrcweir void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj)
544cdf0e10cSrcweir {
545cdf0e10cSrcweir 	if(mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
546cdf0e10cSrcweir 	{
547cdf0e10cSrcweir 		if( nSlotId == SID_ATTR_CHAR )
548cdf0e10cSrcweir 		{
549cdf0e10cSrcweir 			// Impress-Textobjekt wird erzeugt (faellt auf Zeilenhoehe zusammen)
550cdf0e10cSrcweir 			// Damit das Objekt beim anschliessenden Erzeugen gleich die richtige
551cdf0e10cSrcweir 			// Hoehe bekommt (sonst wird zuviel gepainted)
552cdf0e10cSrcweir 			SfxItemSet aSet(mpViewShell->GetPool());
553cdf0e10cSrcweir 			aSet.Put(SdrTextMinFrameHeightItem(0));
554cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
555cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
556cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
557cdf0e10cSrcweir 			pTxtObj->AdjustTextFrameWidthAndHeight();
558cdf0e10cSrcweir 			aSet.Put(SdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height()));
559cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
560cdf0e10cSrcweir 		}
561cdf0e10cSrcweir 		else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
562cdf0e10cSrcweir 		{
563cdf0e10cSrcweir 			SfxItemSet aSet(mpViewShell->GetPool());
564cdf0e10cSrcweir 			aSet.Put(SdrTextMinFrameWidthItem(0));
565cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
566cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 			// #91853# Needs to be set since default is SDRTEXTHORZADJUST_BLOCK
569cdf0e10cSrcweir 			aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
570cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
571cdf0e10cSrcweir 			pTxtObj->AdjustTextFrameWidthAndHeight();
572cdf0e10cSrcweir 			aSet.Put(SdrTextMaxFrameWidthItem(pTxtObj->GetLogicRect().GetSize().Width()));
573cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
574cdf0e10cSrcweir 		}
575cdf0e10cSrcweir 	}
576cdf0e10cSrcweir 	else
577cdf0e10cSrcweir 	{
578cdf0e10cSrcweir 		if( nSlotId == SID_ATTR_CHAR_VERTICAL )
579cdf0e10cSrcweir 		{
580cdf0e10cSrcweir 			// draw text object, needs to be initialized when vertical text is used
581cdf0e10cSrcweir 			SfxItemSet aSet(mpViewShell->GetPool());
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 			// #91510#
584cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
585cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 			// #91508#
588cdf0e10cSrcweir 			//aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
589cdf0e10cSrcweir 			//aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 			// #107235#
592cdf0e10cSrcweir 			// Set defaults for vertical klick-n'drag text object, pool defaults are:
593cdf0e10cSrcweir 			// SdrTextVertAdjustItem: SDRTEXTVERTADJUST_TOP
594cdf0e10cSrcweir 			// SdrTextHorzAdjustItem: SDRTEXTHORZADJUST_BLOCK
595cdf0e10cSrcweir 			// Analog to that (thus, #91508# was not completely correct):
596cdf0e10cSrcweir 			aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK));
597cdf0e10cSrcweir 			aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
600cdf0e10cSrcweir 		}
601cdf0e10cSrcweir 	}
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir // #97016#
605cdf0e10cSrcweir void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj)
606cdf0e10cSrcweir {
607cdf0e10cSrcweir 	// FitToSize (An Rahmen anpassen)
608cdf0e10cSrcweir 	SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
60926734c99SArmin Le Grand 	SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
61026734c99SArmin Le Grand 	aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
611cdf0e10cSrcweir 	aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
612cdf0e10cSrcweir 	aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
613cdf0e10cSrcweir 	pTxtObj->SetMergedItemSet(aSet);
614cdf0e10cSrcweir 	pTxtObj->AdjustTextFrameWidthAndHeight();
615cdf0e10cSrcweir }
616cdf0e10cSrcweir 
617cdf0e10cSrcweir // #97016#
618cdf0e10cSrcweir void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj)
619cdf0e10cSrcweir {
62026734c99SArmin Le Grand 	SfxItemSet aSet(mpViewShell->GetPool(),
62126734c99SArmin Le Grand 		SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
62226734c99SArmin Le Grand 	SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
62326734c99SArmin Le Grand 	aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
624cdf0e10cSrcweir 	aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
625cdf0e10cSrcweir 	aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
626cdf0e10cSrcweir 	pTxtObj->SetMergedItemSet(aSet);
627cdf0e10cSrcweir 	pTxtObj->AdjustTextFrameWidthAndHeight();
628cdf0e10cSrcweir }
629cdf0e10cSrcweir 
630cdf0e10cSrcweir // #97016#
631cdf0e10cSrcweir void FuText::ImpSetAttributesFitCommon(SdrTextObj* pTxtObj)
632cdf0e10cSrcweir {
633cdf0e10cSrcweir 	// Normales Textobjekt
634cdf0e10cSrcweir 	if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
635cdf0e10cSrcweir 	{
636cdf0e10cSrcweir 		if( nSlotId == SID_ATTR_CHAR )
637cdf0e10cSrcweir 		{
638cdf0e10cSrcweir 			// Impress-Textobjekt (faellt auf Zeilenhoehe zusammen)
639cdf0e10cSrcweir 			SfxItemSet aSet(mpViewShell->GetPool());
640cdf0e10cSrcweir 			aSet.Put(SdrTextMinFrameHeightItem(0));
641cdf0e10cSrcweir 			aSet.Put(SdrTextMaxFrameHeightItem(0));
642cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
643cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowWidthItem(sal_False));
644cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
645cdf0e10cSrcweir 		}
646cdf0e10cSrcweir 		else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
647cdf0e10cSrcweir 		{
648cdf0e10cSrcweir 			SfxItemSet aSet(mpViewShell->GetPool());
649cdf0e10cSrcweir 			aSet.Put(SdrTextMinFrameWidthItem(0));
650cdf0e10cSrcweir 			aSet.Put(SdrTextMaxFrameWidthItem(0));
651cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
652cdf0e10cSrcweir 			aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
653cdf0e10cSrcweir 			pTxtObj->SetMergedItemSet(aSet);
654cdf0e10cSrcweir 		}
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 		pTxtObj->AdjustTextFrameWidthAndHeight();
657cdf0e10cSrcweir 	}
658cdf0e10cSrcweir }
659cdf0e10cSrcweir 
660cdf0e10cSrcweir sal_Bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
661cdf0e10cSrcweir {
662cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 	if (aDragTimer.IsActive())
665cdf0e10cSrcweir 	{
666cdf0e10cSrcweir 		aDragTimer.Stop();
667cdf0e10cSrcweir 		bIsInDragMode = sal_False;
668cdf0e10cSrcweir 	}
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 	mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 	Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 	if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow)) || rMEvt.GetClicks() == 2 )
675cdf0e10cSrcweir 		return (sal_True); // Event von der SdrView ausgewertet
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 	sal_Bool bEmptyTextObj = sal_False;
678cdf0e10cSrcweir 
679cdf0e10cSrcweir 	if (mxTextObj.is())
680cdf0e10cSrcweir 	{
681cdf0e10cSrcweir 		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
682cdf0e10cSrcweir 
683cdf0e10cSrcweir 		if (rMarkList.GetMarkCount() == 1
684cdf0e10cSrcweir             && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) )
685cdf0e10cSrcweir 		{
686cdf0e10cSrcweir 			if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() )
687cdf0e10cSrcweir 				bEmptyTextObj = sal_True;
688cdf0e10cSrcweir 			else
689cdf0e10cSrcweir 				bFirstObjCreated = sal_True;
690cdf0e10cSrcweir 		}
691cdf0e10cSrcweir 		else
692cdf0e10cSrcweir 		{
693cdf0e10cSrcweir 			mxTextObj.reset( 0 );
694cdf0e10cSrcweir 		}
695cdf0e10cSrcweir 	}
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 	if( mpView && mpView->IsDragObj())
698cdf0e10cSrcweir 	{
699cdf0e10cSrcweir 		/**********************************************************************
700cdf0e10cSrcweir 		* Objekt wurde verschoben
701cdf0e10cSrcweir 		**********************************************************************/
702cdf0e10cSrcweir 		FrameView* pFrameView = mpViewShell->GetFrameView();
703cdf0e10cSrcweir 		sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
704cdf0e10cSrcweir 
705cdf0e10cSrcweir 		if (bDragWithCopy)
706cdf0e10cSrcweir 		{
707cdf0e10cSrcweir 			bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
708cdf0e10cSrcweir 		}
709cdf0e10cSrcweir 
710cdf0e10cSrcweir 		mpView->SetDragWithCopy(bDragWithCopy);
711cdf0e10cSrcweir 		mpView->EndDragObj( mpView->IsDragWithCopy() );
712cdf0e10cSrcweir 		mpView->ForceMarkedToAnotherPage();
713cdf0e10cSrcweir 		mpView->SetCurrentObj(OBJ_TEXT);
714cdf0e10cSrcweir 
715cdf0e10cSrcweir 	    sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
716cdf0e10cSrcweir 
717cdf0e10cSrcweir         if ( mpView->IsRotateAllowed() && mpViewShell->GetFrameView()->IsClickChangeRotation() && (rMEvt.GetClicks() != 2) &&
718cdf0e10cSrcweir 			!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsRight() &&
719cdf0e10cSrcweir             Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
720cdf0e10cSrcweir             Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
721cdf0e10cSrcweir         {
722cdf0e10cSrcweir 			// toggle to rotation mode
723cdf0e10cSrcweir 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_ROTATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
724cdf0e10cSrcweir 		}
725cdf0e10cSrcweir 	}
726cdf0e10cSrcweir 	else if( mpView && mpView->IsCreateObj() && rMEvt.IsLeft())
727cdf0e10cSrcweir 	{
728cdf0e10cSrcweir 		/**********************************************************************
729cdf0e10cSrcweir 		* Objekt wurde erzeugt
730cdf0e10cSrcweir 		**********************************************************************/
731cdf0e10cSrcweir 		mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 		if( mxTextObj.is() )
734cdf0e10cSrcweir 		{
735cdf0e10cSrcweir 			//AW outliner needs to be set to vertical when there is no
736cdf0e10cSrcweir 			// outliner object up to now; also it needs to be set back to not
737cdf0e10cSrcweir 			// vertical when there was a vertical one used last time.
738cdf0e10cSrcweir 			OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject();
739cdf0e10cSrcweir 			SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj());
740cdf0e10cSrcweir 			sal_Bool bVertical((pOPO && pOPO->IsVertical())
741cdf0e10cSrcweir 				|| nSlotId == SID_ATTR_CHAR_VERTICAL
742cdf0e10cSrcweir 				|| nSlotId == SID_TEXT_FITTOSIZE_VERTICAL);
743cdf0e10cSrcweir 			rOutl.SetVertical(bVertical);
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 			// #107235#
746cdf0e10cSrcweir 			// Before ImpSetAttributesForNewTextObject the vertical writing mode
747cdf0e10cSrcweir 			// needs to be set at the object. This is done here at the OutlinerParaObject
748cdf0e10cSrcweir 			// directly to not mirror the layout text items involved. These items will be set
749cdf0e10cSrcweir 			// from ImpSetAttributesForNewTextObject and below.
750cdf0e10cSrcweir 			OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 			if(!pPara)
753cdf0e10cSrcweir 			{
754cdf0e10cSrcweir 				GetTextObj()->ForceOutlinerParaObject();
755cdf0e10cSrcweir 				pPara = GetTextObj()->GetOutlinerParaObject();
756cdf0e10cSrcweir 			}
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 			if(pPara && (bool)bVertical != pPara->IsVertical())
759cdf0e10cSrcweir 			{
760cdf0e10cSrcweir 				// set ParaObject orientation accordingly
761cdf0e10cSrcweir 				pPara->SetVertical(bVertical);
762cdf0e10cSrcweir 			}
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 			// #97016#
765cdf0e10cSrcweir 			ImpSetAttributesForNewTextObject(GetTextObj());
766cdf0e10cSrcweir 		}
767cdf0e10cSrcweir 
768cdf0e10cSrcweir 		if (!mpView->EndCreateObj(SDRCREATE_FORCEEND))
769cdf0e10cSrcweir 		{
770cdf0e10cSrcweir 			// Textobjekt konnte nicht erzeugt werden
771cdf0e10cSrcweir 			mxTextObj.reset(0);
772cdf0e10cSrcweir 		}
773cdf0e10cSrcweir 		else if (nSlotId == SID_TEXT_FITTOSIZE)
774cdf0e10cSrcweir 		{
775cdf0e10cSrcweir 			// #97016#
776cdf0e10cSrcweir 			ImpSetAttributesFitToSize(GetTextObj());
777cdf0e10cSrcweir 
778cdf0e10cSrcweir 			SetInEditMode(rMEvt, sal_False);
779cdf0e10cSrcweir 		}
780cdf0e10cSrcweir 		else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
781cdf0e10cSrcweir 		{
782cdf0e10cSrcweir 			// #97016#
783cdf0e10cSrcweir 			ImpSetAttributesFitToSizeVertical(GetTextObj());
784cdf0e10cSrcweir 
785cdf0e10cSrcweir 			SetInEditMode(rMEvt, sal_False);
786cdf0e10cSrcweir 		}
787cdf0e10cSrcweir 		else
788cdf0e10cSrcweir 		{
789cdf0e10cSrcweir 			// #97016#
790cdf0e10cSrcweir 			ImpSetAttributesFitCommon(GetTextObj());
791cdf0e10cSrcweir 
792cdf0e10cSrcweir 			// Damit die Handles und der graue Rahmen stimmen
793cdf0e10cSrcweir 			mpView->AdjustMarkHdl();
794cdf0e10cSrcweir 			mpView->PickHandle(aPnt);
795cdf0e10cSrcweir 			SetInEditMode(rMEvt, sal_False);
796cdf0e10cSrcweir 		}
797cdf0e10cSrcweir 	}
798cdf0e10cSrcweir 	else if ( mpView && mpView->IsAction())
799cdf0e10cSrcweir 	{
800cdf0e10cSrcweir 		mpView->EndAction();
801cdf0e10cSrcweir 	}
802cdf0e10cSrcweir 
803cdf0e10cSrcweir 	ForcePointer(&rMEvt);
804cdf0e10cSrcweir 	mpWindow->ReleaseMouse();
805cdf0e10cSrcweir 	sal_uInt16 nDrgLog1 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 	if ( mpView && !mpView->AreObjectsMarked() &&
808cdf0e10cSrcweir 		 Abs(aMDPos.X() - aPnt.X()) < nDrgLog1 &&
809cdf0e10cSrcweir 		 Abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 &&
810cdf0e10cSrcweir 		 !rMEvt.IsShift() && !rMEvt.IsMod2() )
811cdf0e10cSrcweir 	{
812cdf0e10cSrcweir 		SdrPageView* pPV = mpView->GetSdrPageView();
813cdf0e10cSrcweir 		SdrViewEvent aVEvt;
814cdf0e10cSrcweir 		mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
815cdf0e10cSrcweir 		mpView->MarkObj(aVEvt.pRootObj, pPV);
816cdf0e10cSrcweir 	}
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 	if ( !mxTextObj.is() && mpView )
819cdf0e10cSrcweir 	{
820cdf0e10cSrcweir 		if ( ( (!bEmptyTextObj   &&  bPermanent) ||
821cdf0e10cSrcweir 			 (!bFirstObjCreated && !bPermanent) ) &&
822cdf0e10cSrcweir 			  !mpDocSh->IsReadOnly()               &&
823cdf0e10cSrcweir 			  nSlotId != SID_TEXTEDIT )
824cdf0e10cSrcweir 		{
825cdf0e10cSrcweir 			/**********************************************************************
826cdf0e10cSrcweir 			* Mengentext (linksbuendiges AutoGrow)
827cdf0e10cSrcweir 			**********************************************************************/
828cdf0e10cSrcweir 			mpView->SetCurrentObj(OBJ_TEXT);
829cdf0e10cSrcweir 			mpView->SetEditMode(SDREDITMODE_CREATE);
830cdf0e10cSrcweir 			sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
831cdf0e10cSrcweir 			mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 			sal_Bool bSnapEnabled = mpView->IsSnapEnabled();
834cdf0e10cSrcweir 
835cdf0e10cSrcweir 			if (bSnapEnabled)
836cdf0e10cSrcweir 				mpView->SetSnapEnabled(sal_False);
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 			aPnt.X() += nDrgLog + nDrgLog;
839cdf0e10cSrcweir 			aPnt.Y() += nDrgLog + nDrgLog;
840cdf0e10cSrcweir 			mpView->MovAction(aPnt);
841cdf0e10cSrcweir 
842cdf0e10cSrcweir 			mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
843cdf0e10cSrcweir 
844cdf0e10cSrcweir 			if(mxTextObj.is())
845cdf0e10cSrcweir 			{
846cdf0e10cSrcweir 				GetTextObj()->SetDisableAutoWidthOnDragging(sal_True);
847cdf0e10cSrcweir 			}
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 			if(!mpView->EndCreateObj(SDRCREATE_FORCEEND))
850cdf0e10cSrcweir 			{
851cdf0e10cSrcweir 				mxTextObj.reset(0);
852cdf0e10cSrcweir 			}
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 			if(bSnapEnabled)
855cdf0e10cSrcweir 				mpView->SetSnapEnabled(bSnapEnabled);
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 			if(mxTextObj.is())
858cdf0e10cSrcweir 			{
859cdf0e10cSrcweir 				SfxItemSet aSet(mpViewShell->GetPool());
860cdf0e10cSrcweir 				aSet.Put(SdrTextMinFrameHeightItem(0));
861cdf0e10cSrcweir 				aSet.Put(SdrTextMinFrameWidthItem(0));
862cdf0e10cSrcweir 				aSet.Put(SdrTextAutoGrowHeightItem(sal_True));
863cdf0e10cSrcweir 				aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
864cdf0e10cSrcweir 
865cdf0e10cSrcweir 				// #91508#
866cdf0e10cSrcweir 				if(nSlotId == SID_ATTR_CHAR_VERTICAL)
867cdf0e10cSrcweir 				{
868cdf0e10cSrcweir 					// #107235#
869cdf0e10cSrcweir 					//
870cdf0e10cSrcweir 					// Here, all items which need to be different from pool default need to be set
871cdf0e10cSrcweir 					// again on the newly created text object.
872cdf0e10cSrcweir 					// Since this is a simple klick text object, it is first created, then SetVertical()
873cdf0e10cSrcweir 					// is used, then ImpSetAttributesForNewTextObject is called and then the object is
874cdf0e10cSrcweir 					// deleted again since not the minimum drag distance was travelled. Then, a new
875cdf0e10cSrcweir 					// klick text object is created and thus all that stuff needs to be set again here.
876cdf0e10cSrcweir 					//
877cdf0e10cSrcweir 					// Before using the new object the vertical writing mode
878cdf0e10cSrcweir 					// needs to be set. This is done here at the OutlinerParaObject
879cdf0e10cSrcweir 					// directly to not mirror the layout text items involved. These items will be set
880cdf0e10cSrcweir 					// below.
881cdf0e10cSrcweir 					OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
882cdf0e10cSrcweir 
883cdf0e10cSrcweir 					if(!pPara)
884cdf0e10cSrcweir 					{
885cdf0e10cSrcweir 						GetTextObj()->ForceOutlinerParaObject();
886cdf0e10cSrcweir 						pPara = GetTextObj()->GetOutlinerParaObject();
887cdf0e10cSrcweir 					}
888cdf0e10cSrcweir 
889cdf0e10cSrcweir 					if(pPara && sal_True != pPara->IsVertical())
890cdf0e10cSrcweir 					{
891cdf0e10cSrcweir 						// set ParaObject orientation accordingly
892cdf0e10cSrcweir 						pPara->SetVertical(sal_True);
893cdf0e10cSrcweir 					}
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 					// #91508#
896cdf0e10cSrcweir 					// aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
897cdf0e10cSrcweir 					aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
898cdf0e10cSrcweir 
899cdf0e10cSrcweir 					// #107235#
900cdf0e10cSrcweir 					// Analog to the else case below, for vertical simple click texts
901cdf0e10cSrcweir 					// one of the defaulted setted items from ImpSetAttributesForNewTextObject
902cdf0e10cSrcweir 					// needs to be adapted to non-block mode. This could have been done with the
903cdf0e10cSrcweir 					// #104122#, but was obviously overseen.
904cdf0e10cSrcweir 					const SfxItemSet& rSet = mpView->GetDefaultAttr();
905cdf0e10cSrcweir 					SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 					if(FRMDIR_HORI_RIGHT_TOP == eDirection || FRMDIR_VERT_TOP_RIGHT == eDirection)
908cdf0e10cSrcweir 					{
909cdf0e10cSrcweir 	                    aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM));
910cdf0e10cSrcweir 					}
911cdf0e10cSrcweir 					else
912cdf0e10cSrcweir 					{
913cdf0e10cSrcweir 	                    aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
914cdf0e10cSrcweir 					}
915cdf0e10cSrcweir 				}
916cdf0e10cSrcweir 				else
917cdf0e10cSrcweir 				{
918cdf0e10cSrcweir 					// #104122# This is for Format/Page settings. Since this also leads
919cdf0e10cSrcweir 					// to the object defaults to be changed, i think this code can be
920cdf0e10cSrcweir 					// removed. CL. wanted to take a look before adding this.
921cdf0e10cSrcweir                     //const SdrTextHorzAdjust eHA = ( ( pDoc && pDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ) ?
922cdf0e10cSrcweir                     //                                SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_LEFT );
923cdf0e10cSrcweir                     //aSet.Put( SdrTextHorzAdjustItem( eHA ) );
924cdf0e10cSrcweir 
925cdf0e10cSrcweir 					// #104122# Look in the object defaults if left-to-right is wanted. If
926cdf0e10cSrcweir 					// yes, set text anchoring to right to let the box grow to left.
927cdf0e10cSrcweir 					const SfxItemSet& rSet = mpView->GetDefaultAttr();
928cdf0e10cSrcweir 					SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 					if(FRMDIR_HORI_RIGHT_TOP == eDirection)
931cdf0e10cSrcweir 					{
932cdf0e10cSrcweir 	                    aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
933cdf0e10cSrcweir 					}
934cdf0e10cSrcweir 					else
935cdf0e10cSrcweir 					{
936cdf0e10cSrcweir 	                    aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
937cdf0e10cSrcweir 					}
938cdf0e10cSrcweir 				}
939cdf0e10cSrcweir 
940cdf0e10cSrcweir 				GetTextObj()->SetMergedItemSet(aSet);
941cdf0e10cSrcweir 				GetTextObj()->SetDisableAutoWidthOnDragging(sal_True);
942cdf0e10cSrcweir 				SetInEditMode(rMEvt, sal_False);
943cdf0e10cSrcweir 			}
944cdf0e10cSrcweir 
945cdf0e10cSrcweir 			bFirstObjCreated = sal_True;
946cdf0e10cSrcweir 		}
947cdf0e10cSrcweir 		else
948cdf0e10cSrcweir 		{
949cdf0e10cSrcweir 			// In die Fkt. Selektion wechseln
950cdf0e10cSrcweir 			if (mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
951cdf0e10cSrcweir 			{
952cdf0e10cSrcweir 				mxTextObj.reset(0);
953cdf0e10cSrcweir 			}
954cdf0e10cSrcweir 
955cdf0e10cSrcweir 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
956cdf0e10cSrcweir 									  SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
957cdf0e10cSrcweir 		}
958cdf0e10cSrcweir 	}
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 	bMBDown = sal_False;
961cdf0e10cSrcweir 	FuConstruct::MouseButtonUp(rMEvt);
962cdf0e10cSrcweir 	return (bReturn);
963cdf0e10cSrcweir }
964cdf0e10cSrcweir 
965cdf0e10cSrcweir /*************************************************************************
966cdf0e10cSrcweir |*
967cdf0e10cSrcweir |* Tastaturereignisse bearbeiten
968cdf0e10cSrcweir |*
969cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
970cdf0e10cSrcweir |* sal_False.
971cdf0e10cSrcweir |*
972cdf0e10cSrcweir \************************************************************************/
973cdf0e10cSrcweir 
974cdf0e10cSrcweir sal_Bool FuText::KeyInput(const KeyEvent& rKEvt)
975cdf0e10cSrcweir {
976cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
977cdf0e10cSrcweir 	mpView->SetMarkHdlWhenTextEdit(sal_True);
978cdf0e10cSrcweir 
979cdf0e10cSrcweir 	KeyCode nCode = rKEvt.GetKeyCode();
980cdf0e10cSrcweir 	sal_Bool bShift = nCode.IsShift();
981cdf0e10cSrcweir 
982cdf0e10cSrcweir 	// #97016# IV
983cdf0e10cSrcweir 	if(mxTextObj.is())
984cdf0e10cSrcweir 	{
985cdf0e10cSrcweir 		// maybe object is deleted, test if it's equal to the selected object
986cdf0e10cSrcweir 		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
987cdf0e10cSrcweir 		SdrObject* pSelectedObj = 0L;
988cdf0e10cSrcweir 
989cdf0e10cSrcweir 		if(1 == rMarkList.GetMarkCount())
990cdf0e10cSrcweir 		{
991cdf0e10cSrcweir 			SdrMark* pMark = rMarkList.GetMark(0);
992cdf0e10cSrcweir 			pSelectedObj = pMark->GetMarkedSdrObj();
993cdf0e10cSrcweir 		}
994cdf0e10cSrcweir 
995cdf0e10cSrcweir 		if(mxTextObj.get() != pSelectedObj)
996cdf0e10cSrcweir 		{
997cdf0e10cSrcweir 			mxTextObj.reset(0);
998cdf0e10cSrcweir 		}
999cdf0e10cSrcweir 	}
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir 	if ( mxTextObj.is() && mxTextObj->GetObjInventor() == SdrInventor && mxTextObj->GetObjIdentifier() == OBJ_TITLETEXT && rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
1002cdf0e10cSrcweir 	{
1003cdf0e10cSrcweir 		// Titeltext-Objekt: immer "weiche" Umbrueche
1004cdf0e10cSrcweir 		bShift = sal_True;
1005cdf0e10cSrcweir 	}
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 	sal_uInt16 nKey = nCode.GetCode();
1008cdf0e10cSrcweir 	KeyCode aKeyCode (nKey, bShift, nCode.IsMod1(), nCode.IsMod2(), nCode.IsMod3() );
1009cdf0e10cSrcweir 	KeyEvent aKEvt(rKEvt.GetCharCode(), aKeyCode);
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir 	sal_Bool bOK = sal_True;
1012cdf0e10cSrcweir 
1013cdf0e10cSrcweir 	if (mpDocSh->IsReadOnly())
1014cdf0e10cSrcweir 	{
1015cdf0e10cSrcweir 		bOK = !EditEngine::DoesKeyChangeText(aKEvt);
1016cdf0e10cSrcweir 	}
1017cdf0e10cSrcweir 	if( aKeyCode.GetCode() == KEY_PAGEUP || aKeyCode.GetCode() == KEY_PAGEDOWN )
1018cdf0e10cSrcweir 	{
1019cdf0e10cSrcweir 		bOK = sal_False;   // default handling in base class
1020cdf0e10cSrcweir 	}
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir 	if (bOK && mpView->KeyInput(aKEvt, mpWindow) )
1023cdf0e10cSrcweir 	{
1024cdf0e10cSrcweir 		bReturn = sal_True;
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir //		if ( pTextObj )
1029cdf0e10cSrcweir //			pTextObj->SetEmptyPresObj(sal_False);
1030cdf0e10cSrcweir 	}
1031cdf0e10cSrcweir 	else if (aKeyCode == KEY_ESCAPE)
1032cdf0e10cSrcweir 	{
1033cdf0e10cSrcweir 		bReturn = cancel();
1034cdf0e10cSrcweir 	}
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	if( bPermanent )
1037cdf0e10cSrcweir 	{
1038cdf0e10cSrcweir 		mpView->SetCurrentObj(OBJ_TEXT);
1039cdf0e10cSrcweir 		mpView->SetEditMode(SDREDITMODE_CREATE);
1040cdf0e10cSrcweir 	}
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	if (!bReturn)
1043cdf0e10cSrcweir 	{
1044cdf0e10cSrcweir 		bReturn = FuDraw::KeyInput(aKEvt);
1045cdf0e10cSrcweir 	}
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir 	return (bReturn);
1048cdf0e10cSrcweir }
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir /*************************************************************************
1053cdf0e10cSrcweir |*
1054cdf0e10cSrcweir |* Function aktivieren
1055cdf0e10cSrcweir |*
1056cdf0e10cSrcweir \************************************************************************/
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir void FuText::Activate()
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir 	mpView->SetQuickTextEditMode(mpViewShell->GetFrameView()->IsQuickEdit());
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir     // #i89661# it's no longer necessary to make it so big here, it's fine tuned
1063cdf0e10cSrcweir     // for text objects in SdrMarkView::CheckSingleSdrObjectHit
1064cdf0e10cSrcweir 	mpView->SetHitTolerancePixel( 2 * HITPIX );
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir 	OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir 	if (pOLV)
1069cdf0e10cSrcweir 		pOLV->ShowCursor();
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir 	FuConstruct::Activate();
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir 	if( pOLV )
1074cdf0e10cSrcweir 		mpView->SetEditMode(SDREDITMODE_EDIT);
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir /*************************************************************************
1079cdf0e10cSrcweir |*
1080cdf0e10cSrcweir |* Function deaktivieren
1081cdf0e10cSrcweir |*
1082cdf0e10cSrcweir \************************************************************************/
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir void FuText::Deactivate()
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir 	OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir 	if (pOLV)
1089cdf0e10cSrcweir 		pOLV->HideCursor();
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 	mpView->SetHitTolerancePixel( HITPIX );
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir 	FuConstruct::Deactivate();
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir /*************************************************************************
1098cdf0e10cSrcweir |*
1099cdf0e10cSrcweir |* Objekt in Edit-Mode setzen
1100cdf0e10cSrcweir |*
1101cdf0e10cSrcweir \************************************************************************/
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir void FuText::SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag)
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir 	SdrPageView* pPV = mpView->GetSdrPageView();
1106cdf0e10cSrcweir 	if( mxTextObj.is() && (mxTextObj->GetPage() == pPV->GetPage()) )
1107cdf0e10cSrcweir 	{
1108cdf0e10cSrcweir 		mpView->SetCurrentObj(OBJ_TEXT);
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 		if( bPermanent )
1111cdf0e10cSrcweir 			mpView->SetEditMode(SDREDITMODE_CREATE);
1112cdf0e10cSrcweir 		else
1113cdf0e10cSrcweir 			mpView->SetEditMode(SDREDITMODE_EDIT);
1114cdf0e10cSrcweir 
1115cdf0e10cSrcweir 		sal_Bool bEmptyOutliner = sal_False;
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 		if (!GetTextObj()->GetOutlinerParaObject() && mpView->GetTextEditOutliner())
1118cdf0e10cSrcweir 		{
1119cdf0e10cSrcweir 			::Outliner* pOutl = mpView->GetTextEditOutliner();
1120cdf0e10cSrcweir 			sal_uLong nParaAnz = pOutl->GetParagraphCount();
1121cdf0e10cSrcweir 			Paragraph* p1stPara = pOutl->GetParagraph( 0 );
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir 			if (nParaAnz==1 && p1stPara)
1124cdf0e10cSrcweir 			{
1125cdf0e10cSrcweir 				// Bei nur einem Pararaph
1126cdf0e10cSrcweir 				if (pOutl->GetText(p1stPara).Len() == 0)
1127cdf0e10cSrcweir 				{
1128cdf0e10cSrcweir 					bEmptyOutliner = sal_True;
1129cdf0e10cSrcweir 				}
1130cdf0e10cSrcweir 			}
1131cdf0e10cSrcweir 		}
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir 		if (GetTextObj() != mpView->GetTextEditObject() || bEmptyOutliner)
1134cdf0e10cSrcweir 		{
1135cdf0e10cSrcweir 			sal_uInt32 nInv = mxTextObj->GetObjInventor();
1136cdf0e10cSrcweir 			sal_uInt16 nSdrObjKind = mxTextObj->GetObjIdentifier();
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir 			if (nInv == SdrInventor && GetTextObj()->HasTextEdit() &&
1139cdf0e10cSrcweir 				(nSdrObjKind == OBJ_TEXT ||
1140cdf0e10cSrcweir 			 	nSdrObjKind == OBJ_TITLETEXT ||
1141cdf0e10cSrcweir 			 	nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) )
1142cdf0e10cSrcweir 			{
1143cdf0e10cSrcweir 				// Neuen Outliner machen (gehoert der SdrObjEditView)
1144cdf0e10cSrcweir 				SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir 				if (bEmptyOutliner)
1147cdf0e10cSrcweir 					mpView->SdrEndTextEdit(sal_True);
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir 				SdrTextObj* pTextObj = GetTextObj();
1150cdf0e10cSrcweir 				if( pTextObj )
1151cdf0e10cSrcweir 				{
1152cdf0e10cSrcweir 					OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
1153cdf0e10cSrcweir 					if( ( pOPO && pOPO->IsVertical() ) || (nSlotId == SID_ATTR_CHAR_VERTICAL) || (nSlotId == SID_TEXT_FITTOSIZE_VERTICAL) )
1154cdf0e10cSrcweir 						pOutl->SetVertical( sal_True );
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir 					if( pTextObj->getTextCount() > 1 )
1157cdf0e10cSrcweir 					{
1158cdf0e10cSrcweir 						Point aPix(rMEvt.GetPosPixel());
1159cdf0e10cSrcweir 						Point aPnt(mpWindow->PixelToLogic(aPix));
1160cdf0e10cSrcweir 						pTextObj->setActiveText( pTextObj->CheckTextHit(aPnt ) );
1161cdf0e10cSrcweir 					}
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir 					if (mpView->SdrBeginTextEdit(pTextObj, pPV, mpWindow, sal_True, pOutl) && mxTextObj->GetObjInventor() == SdrInventor)
1164cdf0e10cSrcweir 					{
1165cdf0e10cSrcweir 						bFirstObjCreated = sal_True;
1166cdf0e10cSrcweir 						DeleteDefaultText();
1167cdf0e10cSrcweir 
1168cdf0e10cSrcweir 						OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
1169cdf0e10cSrcweir 
1170cdf0e10cSrcweir 						nSdrObjKind = mxTextObj->GetObjIdentifier();
1171cdf0e10cSrcweir 
1172cdf0e10cSrcweir 						SdrViewEvent aVEvt;
1173cdf0e10cSrcweir 						SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
1174cdf0e10cSrcweir 
1175cdf0e10cSrcweir 						if (eHit == SDRHIT_TEXTEDIT)
1176cdf0e10cSrcweir 						{
1177cdf0e10cSrcweir 							// Text getroffen
1178cdf0e10cSrcweir 							if (nSdrObjKind == OBJ_TEXT ||
1179cdf0e10cSrcweir 								nSdrObjKind == OBJ_TITLETEXT ||
1180cdf0e10cSrcweir 								nSdrObjKind == OBJ_OUTLINETEXT ||
1181cdf0e10cSrcweir 								nSdrObjKind == OBJ_TABLE ||
1182cdf0e10cSrcweir 								nSlotId == SID_TEXTEDIT ||
1183cdf0e10cSrcweir 								!bQuickDrag)
1184cdf0e10cSrcweir 							{
1185cdf0e10cSrcweir 								pOLV->MouseButtonDown(rMEvt);
1186cdf0e10cSrcweir 								pOLV->MouseMove(rMEvt);
1187cdf0e10cSrcweir 								pOLV->MouseButtonUp(rMEvt);
1188cdf0e10cSrcweir 							}
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir 							if (mpViewShell->GetFrameView()->IsQuickEdit() && bQuickDrag && GetTextObj()->GetOutlinerParaObject())
1191cdf0e10cSrcweir 							{
1192cdf0e10cSrcweir 								pOLV->MouseButtonDown(rMEvt);
1193cdf0e10cSrcweir 							}
1194cdf0e10cSrcweir 						}
1195cdf0e10cSrcweir 						else
1196cdf0e10cSrcweir 						{
1197cdf0e10cSrcweir 							// #98198# Move cursor to end of text
1198cdf0e10cSrcweir 							ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
119902c50d82SAndre Fischer 							if (pOLV != NULL)
1200cdf0e10cSrcweir 								pOLV->SetSelection(aNewSelection);
1201cdf0e10cSrcweir 						}
1202cdf0e10cSrcweir 					}
1203cdf0e10cSrcweir 					else
1204cdf0e10cSrcweir 					{
1205cdf0e10cSrcweir 						mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() ));
1206cdf0e10cSrcweir 					}
1207cdf0e10cSrcweir 				}
1208cdf0e10cSrcweir 			}
1209cdf0e10cSrcweir 		}
1210cdf0e10cSrcweir 	}
1211cdf0e10cSrcweir 	else
1212cdf0e10cSrcweir 	{
1213cdf0e10cSrcweir 		mxTextObj.reset(0);
1214cdf0e10cSrcweir 	}
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir /*************************************************************************
1218cdf0e10cSrcweir |*
1219cdf0e10cSrcweir |* Texteingabe wird gestartet, ggf. Default-Text loeschen
1220cdf0e10cSrcweir |*
1221cdf0e10cSrcweir \************************************************************************/
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir sal_Bool FuText::DeleteDefaultText()
1224cdf0e10cSrcweir {
1225cdf0e10cSrcweir 	sal_Bool bDeleted = sal_False;
1226cdf0e10cSrcweir 
1227cdf0e10cSrcweir 	if ( mxTextObj.is() && mxTextObj->IsEmptyPresObj() )
1228cdf0e10cSrcweir 	{
1229cdf0e10cSrcweir 		String aString;
1230cdf0e10cSrcweir 		SdPage* pPage = (SdPage*) mxTextObj->GetPage();
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir 		if (pPage)
1233cdf0e10cSrcweir 		{
1234cdf0e10cSrcweir 			PresObjKind ePresObjKind = pPage->GetPresObjKind(mxTextObj.get());
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir 			if ( (ePresObjKind == PRESOBJ_TITLE   ||
1237cdf0e10cSrcweir 				  ePresObjKind == PRESOBJ_OUTLINE ||
1238cdf0e10cSrcweir 				  ePresObjKind == PRESOBJ_NOTES   ||
1239cdf0e10cSrcweir 				  ePresObjKind == PRESOBJ_TEXT) &&
1240cdf0e10cSrcweir 				  !pPage->IsMasterPage() )
1241cdf0e10cSrcweir 			{
1242cdf0e10cSrcweir 				::Outliner* pOutliner = mpView->GetTextEditOutliner();
1243cdf0e10cSrcweir 				SfxStyleSheet* pSheet = pOutliner->GetStyleSheet( 0 );
1244cdf0e10cSrcweir 				sal_Bool bIsUndoEnabled = pOutliner->IsUndoEnabled();
1245cdf0e10cSrcweir 				if( bIsUndoEnabled )
1246cdf0e10cSrcweir 					pOutliner->EnableUndo(sal_False);
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir 				pOutliner->SetText( String(), pOutliner->GetParagraph( 0 ) );
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir 				if( bIsUndoEnabled )
1251cdf0e10cSrcweir 					pOutliner->EnableUndo(sal_True);
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir 				if (pSheet &&
1254cdf0e10cSrcweir 					(ePresObjKind == PRESOBJ_NOTES || ePresObjKind == PRESOBJ_TEXT))
1255cdf0e10cSrcweir 					pOutliner->SetStyleSheet(0, pSheet);
1256cdf0e10cSrcweir 
1257cdf0e10cSrcweir 				mxTextObj->SetEmptyPresObj(sal_True);
1258cdf0e10cSrcweir 				bDeleted = sal_True;
1259cdf0e10cSrcweir 			}
1260cdf0e10cSrcweir 		}
1261cdf0e10cSrcweir 	}
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir 	return(bDeleted);
1264cdf0e10cSrcweir }
1265cdf0e10cSrcweir 
1266cdf0e10cSrcweir /*************************************************************************
1267cdf0e10cSrcweir |*
1268cdf0e10cSrcweir |* Command-event
1269cdf0e10cSrcweir |*
1270cdf0e10cSrcweir \************************************************************************/
1271cdf0e10cSrcweir 
1272cdf0e10cSrcweir sal_Bool FuText::Command(const CommandEvent& rCEvt)
1273cdf0e10cSrcweir {
1274cdf0e10cSrcweir 	return( FuPoor::Command(rCEvt) );
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir 
1277cdf0e10cSrcweir /*************************************************************************
1278cdf0e10cSrcweir |*
1279cdf0e10cSrcweir |* Help-event
1280cdf0e10cSrcweir |*
1281cdf0e10cSrcweir \************************************************************************/
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir sal_Bool FuText::RequestHelp(const HelpEvent& rHEvt)
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir 	OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir 	if ((Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) &&
1290cdf0e10cSrcweir 		mxTextObj.is() && pOLV && pOLV->GetFieldUnderMousePointer())
1291cdf0e10cSrcweir 	{
1292cdf0e10cSrcweir 		String aHelpText;
1293cdf0e10cSrcweir 		const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer();
1294cdf0e10cSrcweir 		const SvxFieldData* pField = pFieldItem->GetField();
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir 		if (pField && pField->ISA(SvxURLField))
1297cdf0e10cSrcweir 		{
1298cdf0e10cSrcweir 			/******************************************************************
1299cdf0e10cSrcweir 			* URL-Field
1300cdf0e10cSrcweir 			******************************************************************/
1301cdf0e10cSrcweir 			aHelpText = INetURLObject::decode( ((const SvxURLField*)pField)->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
1302cdf0e10cSrcweir 		}
1303cdf0e10cSrcweir 		if (aHelpText.Len())
1304cdf0e10cSrcweir 		{
1305cdf0e10cSrcweir 			Rectangle aLogicPix = mpWindow->LogicToPixel(mxTextObj->GetLogicRect());
1306cdf0e10cSrcweir 			Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
1307cdf0e10cSrcweir 								  mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
1308cdf0e10cSrcweir 
1309cdf0e10cSrcweir 			if (Help::IsBalloonHelpEnabled())
1310cdf0e10cSrcweir 			{
1311cdf0e10cSrcweir 				bReturn = Help::ShowBalloon( (Window*)mpWindow, rHEvt.GetMousePosPixel(), aScreenRect, aHelpText);
1312cdf0e10cSrcweir 			}
1313cdf0e10cSrcweir 			else if (Help::IsQuickHelpEnabled())
1314cdf0e10cSrcweir 			{
1315cdf0e10cSrcweir 				bReturn = Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText);
1316cdf0e10cSrcweir 			}
1317cdf0e10cSrcweir 		}
1318cdf0e10cSrcweir 	}
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir 	if (!bReturn)
1321cdf0e10cSrcweir 	{
1322cdf0e10cSrcweir 		bReturn = FuConstruct::RequestHelp(rHEvt);
1323cdf0e10cSrcweir 	}
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir 	return(bReturn);
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir 
1328cdf0e10cSrcweir /*************************************************************************
1329cdf0e10cSrcweir |*
1330cdf0e10cSrcweir |* Request verarbeiten
1331cdf0e10cSrcweir |*
1332cdf0e10cSrcweir \************************************************************************/
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir void FuText::ReceiveRequest(SfxRequest& rReq)
1335cdf0e10cSrcweir {
1336cdf0e10cSrcweir 	nSlotId = rReq.GetSlot();
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir 	// Dann Basisklasse rufen (dort wird u.a. nSlotId NICHT gesetzt)
1339cdf0e10cSrcweir 	FuPoor::ReceiveRequest(rReq);
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir 	if (nSlotId == SID_TEXTEDIT || mpViewShell->GetFrameView()->IsQuickEdit() || /*#95971#*/ SID_ATTR_CHAR == nSlotId)
1342cdf0e10cSrcweir 	{
1343cdf0e10cSrcweir 		MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
1344cdf0e10cSrcweir 
1345cdf0e10cSrcweir 		mxTextObj.reset(0);
1346cdf0e10cSrcweir 
1347cdf0e10cSrcweir 		if (nSlotId == SID_TEXTEDIT)
1348cdf0e10cSrcweir 		{
1349cdf0e10cSrcweir 			// Wird gerade editiert?
1350cdf0e10cSrcweir 			if(!bTestText)
1351cdf0e10cSrcweir 				mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) );
1352cdf0e10cSrcweir 
1353cdf0e10cSrcweir 			if (!mxTextObj.is())
1354cdf0e10cSrcweir 			{
1355cdf0e10cSrcweir 				// Versuchen, ein Obj zu selektieren
1356cdf0e10cSrcweir 				SdrPageView* pPV = mpView->GetSdrPageView();
1357cdf0e10cSrcweir 				SdrViewEvent aVEvt;
1358cdf0e10cSrcweir 				mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
1359cdf0e10cSrcweir 				mpView->MarkObj(aVEvt.pRootObj, pPV);
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir 				if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
1362cdf0e10cSrcweir 				{
1363cdf0e10cSrcweir 					mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) );
1364cdf0e10cSrcweir 				}
1365cdf0e10cSrcweir 			}
1366cdf0e10cSrcweir 		}
1367cdf0e10cSrcweir 		else if (mpView->AreObjectsMarked())
1368cdf0e10cSrcweir 		{
1369cdf0e10cSrcweir 			const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
1370cdf0e10cSrcweir 
1371cdf0e10cSrcweir 			if (rMarkList.GetMarkCount() == 1)
1372cdf0e10cSrcweir 			{
1373cdf0e10cSrcweir 				SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1374cdf0e10cSrcweir 
1375cdf0e10cSrcweir 				if (pObj->ISA(SdrTextObj))
1376cdf0e10cSrcweir 				{
1377cdf0e10cSrcweir 					mxTextObj.reset( static_cast< SdrTextObj* >( pObj ) );
1378cdf0e10cSrcweir 				}
1379cdf0e10cSrcweir 			}
1380cdf0e10cSrcweir 		}
1381cdf0e10cSrcweir 
1382cdf0e10cSrcweir 		sal_Bool bQuickDrag = sal_True;
1383cdf0e10cSrcweir 
1384cdf0e10cSrcweir 		const SfxItemSet* pArgs = rReq.GetArgs();
1385cdf0e10cSrcweir 
1386cdf0e10cSrcweir 		if (pArgs
1387cdf0e10cSrcweir 
1388cdf0e10cSrcweir 			// #98198# test for type before using
1389cdf0e10cSrcweir 			&& SID_TEXTEDIT == nSlotId
1390cdf0e10cSrcweir 			&& SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
1391cdf0e10cSrcweir 
1392cdf0e10cSrcweir 			&& (sal_uInt16) ((SfxUInt16Item&) pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
1393cdf0e10cSrcweir 		{
1394cdf0e10cSrcweir 			// Anwahl per Doppelklick -> kein QuickDrag zulassen
1395cdf0e10cSrcweir 			bQuickDrag = sal_False;
1396cdf0e10cSrcweir 		}
1397cdf0e10cSrcweir 
1398cdf0e10cSrcweir 		SetInEditMode(aMEvt, bQuickDrag);
1399cdf0e10cSrcweir 	}
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir 
1402cdf0e10cSrcweir 
1403cdf0e10cSrcweir 
1404cdf0e10cSrcweir /*************************************************************************
1405cdf0e10cSrcweir |*
1406cdf0e10cSrcweir |* SpellChecker: Error-LinkHdl
1407cdf0e10cSrcweir |*
1408cdf0e10cSrcweir \************************************************************************/
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir IMPL_LINK( FuText, SpellError, void *, nLang )
1411cdf0e10cSrcweir {
1412cdf0e10cSrcweir 	String aError( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_uLong)nLang ) );
1413cdf0e10cSrcweir 	ErrorHandler::HandleError(* new StringErrorInfo(
1414cdf0e10cSrcweir 								ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aError) );
1415cdf0e10cSrcweir 	return 0;
1416cdf0e10cSrcweir }
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir /*************************************************************************
1420cdf0e10cSrcweir |*
1421cdf0e10cSrcweir |* Reaktion auf Doppelklick
1422cdf0e10cSrcweir |*
1423cdf0e10cSrcweir \************************************************************************/
1424cdf0e10cSrcweir void FuText::DoubleClick(const MouseEvent& )
1425cdf0e10cSrcweir {
1426cdf0e10cSrcweir 	// Nichts zu tun
1427cdf0e10cSrcweir }
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir /** #97016#
1430cdf0e10cSrcweir     #105815# Removed the insertion of default text and putting a new text
1431cdf0e10cSrcweir     object directly into edit mode.
1432cdf0e10cSrcweir */
1433cdf0e10cSrcweir SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
1434cdf0e10cSrcweir {
1435cdf0e10cSrcweir 	// case SID_TEXTEDIT:	// BASIC ???
1436cdf0e10cSrcweir 	// case SID_ATTR_CHAR:
1437cdf0e10cSrcweir 	// case SID_ATTR_CHAR_VERTICAL:
1438cdf0e10cSrcweir 	// case SID_TEXT_FITTOSIZE:
1439cdf0e10cSrcweir 	// case SID_TEXT_FITTOSIZE_VERTICAL:
1440cdf0e10cSrcweir 
1441cdf0e10cSrcweir 	SdrObject* pObj = SdrObjFactory::MakeNewObject(
1442cdf0e10cSrcweir 		mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
1443cdf0e10cSrcweir 		0L, mpDoc);
1444cdf0e10cSrcweir 
1445cdf0e10cSrcweir 	if(pObj)
1446cdf0e10cSrcweir 	{
1447cdf0e10cSrcweir 		if(pObj->ISA(SdrTextObj))
1448cdf0e10cSrcweir 		{
1449cdf0e10cSrcweir 			SdrTextObj* pText = (SdrTextObj*)pObj;
1450cdf0e10cSrcweir 			pText->SetLogicRect(rRectangle);
1451cdf0e10cSrcweir 
1452cdf0e10cSrcweir 			sal_Bool bVertical = (SID_ATTR_CHAR_VERTICAL == nID || SID_TEXT_FITTOSIZE_VERTICAL == nID);
1453cdf0e10cSrcweir 			pText->SetVerticalWriting(bVertical);
1454cdf0e10cSrcweir 
1455cdf0e10cSrcweir 			// #97016#
1456cdf0e10cSrcweir 			ImpSetAttributesForNewTextObject(pText);
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir 			if (nSlotId == SID_TEXT_FITTOSIZE)
1459cdf0e10cSrcweir 			{
1460cdf0e10cSrcweir 				// #97016#
1461cdf0e10cSrcweir 				ImpSetAttributesFitToSize(pText);
1462cdf0e10cSrcweir 			}
1463cdf0e10cSrcweir 			else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
1464cdf0e10cSrcweir 			{
1465cdf0e10cSrcweir 				// #97016#
1466cdf0e10cSrcweir 				ImpSetAttributesFitToSizeVertical(pText);
1467cdf0e10cSrcweir 			}
1468cdf0e10cSrcweir 			else
1469cdf0e10cSrcweir 			{
1470cdf0e10cSrcweir 				// #97016#
1471cdf0e10cSrcweir 				ImpSetAttributesFitCommon(pText);
1472cdf0e10cSrcweir 			}
1473cdf0e10cSrcweir 
1474cdf0e10cSrcweir             // Put text object into edit mode.
1475cdf0e10cSrcweir             SdrPageView* pPV = mpView->GetSdrPageView();
1476cdf0e10cSrcweir             mpView->SdrBeginTextEdit(pText, pPV);
1477cdf0e10cSrcweir 		}
1478cdf0e10cSrcweir 		else
1479cdf0e10cSrcweir 		{
1480cdf0e10cSrcweir 			DBG_ERROR("Object is NO text object");
1481cdf0e10cSrcweir 		}
1482cdf0e10cSrcweir 	}
1483cdf0e10cSrcweir 
1484cdf0e10cSrcweir 	return pObj;
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir 
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir 
1489cdf0e10cSrcweir 
1490cdf0e10cSrcweir /** is called when the currenct function should be aborted. <p>
1491cdf0e10cSrcweir 	This is used when a function gets a KEY_ESCAPE but can also
1492cdf0e10cSrcweir 	be called directly.
1493cdf0e10cSrcweir 
1494cdf0e10cSrcweir 	@returns true if a active function was aborted
1495cdf0e10cSrcweir */
1496cdf0e10cSrcweir bool FuText::cancel()
1497cdf0e10cSrcweir {
1498cdf0e10cSrcweir 	if ( mpView->IsTextEdit() )
1499cdf0e10cSrcweir 	{
1500cdf0e10cSrcweir 		if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
1501cdf0e10cSrcweir 			mxTextObj.reset(0);
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir 		mpView->SetCurrentObj(OBJ_TEXT);
1504cdf0e10cSrcweir 		mpView->SetEditMode(SDREDITMODE_EDIT);
1505cdf0e10cSrcweir 		return true;
1506cdf0e10cSrcweir 	}
1507cdf0e10cSrcweir 	else
1508cdf0e10cSrcweir 	{
1509cdf0e10cSrcweir 		return false;
1510cdf0e10cSrcweir 	}
1511cdf0e10cSrcweir }
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFontList, ::sd::View* pView )
1514cdf0e10cSrcweir {
1515cdf0e10cSrcweir     if( !pFontList || !pView )
1516cdf0e10cSrcweir         return;
1517cdf0e10cSrcweir 
1518cdf0e10cSrcweir     if( pOLV )
1519cdf0e10cSrcweir     {
1520cdf0e10cSrcweir         pOLV->GetEditView().ChangeFontSize( bGrow, pFontList );
1521cdf0e10cSrcweir     }
1522cdf0e10cSrcweir     else
1523cdf0e10cSrcweir     {
1524cdf0e10cSrcweir //		SdDrawDocument* pDoc = pView->GetDoc();
1525cdf0e10cSrcweir 
1526cdf0e10cSrcweir         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
1527cdf0e10cSrcweir         for( sal_uInt32 nMark = 0; nMark < rMarkList.GetMarkCount(); nMark++ )
1528cdf0e10cSrcweir         {
1529cdf0e10cSrcweir             SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() );
1530cdf0e10cSrcweir             if( pTextObj )
1531cdf0e10cSrcweir             {
1532cdf0e10cSrcweir                 for( sal_Int32 nText = 0; nText < pTextObj->getTextCount(); nText++ )
1533cdf0e10cSrcweir                 {
1534cdf0e10cSrcweir                     pTextObj->setActiveText( nText );
1535cdf0e10cSrcweir 
1536cdf0e10cSrcweir                     // Put text object into edit mode.
1537cdf0e10cSrcweir                     SdrPageView* pPV = pView->GetSdrPageView();
1538cdf0e10cSrcweir                     pView->SdrBeginTextEdit(pTextObj, pPV);
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir                     pOLV = pView->GetTextEditOutlinerView();
1541cdf0e10cSrcweir                     if( pOLV )
1542cdf0e10cSrcweir                     {
1543cdf0e10cSrcweir                         EditEngine* pEditEngine = pOLV->GetEditView().GetEditEngine();
1544cdf0e10cSrcweir                         if( pEditEngine )
1545cdf0e10cSrcweir                         {
1546cdf0e10cSrcweir                             ESelection aSel;
1547cdf0e10cSrcweir                             aSel.nEndPara = pEditEngine->GetParagraphCount()-1;
1548cdf0e10cSrcweir                             aSel.nEndPos = pEditEngine->GetTextLen(aSel.nEndPara);
1549cdf0e10cSrcweir                             pOLV->SetSelection(aSel);
1550cdf0e10cSrcweir                         }
1551cdf0e10cSrcweir 
1552cdf0e10cSrcweir                         ChangeFontSize( bGrow, pOLV, pFontList, pView );
1553cdf0e10cSrcweir                     }
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir                     pView->SdrEndTextEdit();
1556cdf0e10cSrcweir                 }
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir                 SfxItemSet aShapeSet( pTextObj->GetMergedItemSet() );
1559cdf0e10cSrcweir                 if( EditView::ChangeFontSize( bGrow, aShapeSet, pFontList ) )
1560cdf0e10cSrcweir                 {
1561cdf0e10cSrcweir                     pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT ) );
1562cdf0e10cSrcweir                     pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CJK ) );
1563cdf0e10cSrcweir                     pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CTL ) );
1564cdf0e10cSrcweir                 }
1565cdf0e10cSrcweir             }
1566cdf0e10cSrcweir         }
1567cdf0e10cSrcweir     }
1568cdf0e10cSrcweir }
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir } // end of namespace sd
1571cdf0e10cSrcweir 
1572