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