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