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