xref: /aoo42x/main/svx/source/svdraw/svdedxv.cxx (revision a56bd57b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include <com/sun/star/i18n/WordType.hpp>
28 
29 #include <svtools/accessibilityoptions.hxx>
30 
31 #include <svx/svdedxv.hxx>
32 #include <svl/solar.hrc>
33 
34 //#include <tools/string.h>
35 #include <svl/itemiter.hxx>
36 #include <vcl/msgbox.hxx>
37 #include <vcl/hatch.hxx>
38 #include <svl/whiter.hxx>
39 #include <svl/style.hxx>
40 #include <editeng/editstat.hxx>
41 #include <tools/config.hxx>
42 #include <vcl/cursor.hxx>
43 #include <editeng/unotext.hxx>
44 
45 #include <editeng/editeng.hxx>
46 #include <editeng/editobj.hxx>
47 #include <editeng/outlobj.hxx>
48 #include <editeng/scripttypeitem.hxx>
49 #include "svx/svditext.hxx"
50 #include <svx/svdoutl.hxx>
51 #include <svx/sdtfchim.hxx>
52 #include <svx/svdotext.hxx>
53 #include <svx/svdundo.hxx>
54 #include "svx/svditer.hxx"
55 #include "svx/svdpagv.hxx"
56 #include "svx/svdpage.hxx"
57 #include "svx/svdetc.hxx"   // fuer GetDraftFillColor
58 #include "svx/svdotable.hxx"
59 #include <svx/selectioncontroller.hxx>
60 #ifdef DBG_UTIL
61 #include <svdibrow.hxx>
62 #endif
63 
64 #include <svx/svdoutl.hxx>
65 #include <svx/svddrgv.hxx>  // fuer SetSolidDragging()
66 #include "svx/svdstr.hrc"   // Namen aus der Resource
67 #include "svx/svdglob.hxx"  // StringCache
68 #include "svx/globl3d.hxx"
69 #include <editeng/outliner.hxx>
70 #include <editeng/adjitem.hxx>
71 
72 // #98988#
73 #include <svtools/colorcfg.hxx>
74 #include <vcl/svapp.hxx> //add CHINA001
75 #include <svx/sdrpaintwindow.hxx>
76 
77 ////////////////////////////////////////////////////////////////////////////////////////////////////
78 
79 void SdrObjEditView::ImpClearVars()
80 {
81     bQuickTextEditMode=sal_True;
82     bMacroMode=sal_True;
83     pTextEditOutliner=NULL;
84     pTextEditOutlinerView=NULL;
85     pTextEditPV=NULL;
86     pTextEditWin=NULL;
87     pTextEditCursorMerker=NULL;
88     pEditPara=NULL;
89     bTextEditNewObj=sal_False;
90     bMacroDown=sal_False;
91     pMacroObj=NULL;
92     pMacroPV=NULL;
93     pMacroWin=NULL;
94     nMacroTol=0;
95     bTextEditDontDelete=sal_False;
96     bTextEditOnlyOneView=sal_False;
97 }
98 
99 SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
100     SdrGlueEditView(pModel1,pOut)
101 {
102     ImpClearVars();
103 }
104 
105 SdrObjEditView::~SdrObjEditView()
106 {
107 	pTextEditWin = NULL;            // Damit es in SdrEndTextEdit kein ShowCursor gibt
108 	if (IsTextEdit()) SdrEndTextEdit();
109     if (pTextEditOutliner!=NULL) {
110         delete pTextEditOutliner;
111     }
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////////////////////////
115 
116 sal_Bool SdrObjEditView::IsAction() const
117 {
118     return IsMacroObj() || SdrGlueEditView::IsAction();
119 }
120 
121 void SdrObjEditView::MovAction(const Point& rPnt)
122 {
123     if (IsMacroObj()) MovMacroObj(rPnt);
124     SdrGlueEditView::MovAction(rPnt);
125 }
126 
127 void SdrObjEditView::EndAction()
128 {
129     if (IsMacroObj()) EndMacroObj();
130     SdrGlueEditView::EndAction();
131 }
132 
133 void SdrObjEditView::BckAction()
134 {
135     BrkMacroObj();
136     SdrGlueEditView::BckAction();
137 }
138 
139 void SdrObjEditView::BrkAction()
140 {
141     BrkMacroObj();
142     SdrGlueEditView::BrkAction();
143 }
144 
145 void SdrObjEditView::TakeActionRect(Rectangle& rRect) const
146 {
147     if (IsMacroObj()) {
148         rRect=pMacroObj->GetCurrentBoundRect();
149     } else {
150         SdrGlueEditView::TakeActionRect(rRect);
151     }
152 }
153 
154 void __EXPORT SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
155 {
156     SdrGlueEditView::Notify(rBC,rHint);
157     // Printerwechsel waerend des Editierens
158     SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
159     if (pSdrHint!=NULL && pTextEditOutliner!=NULL) {
160         SdrHintKind eKind=pSdrHint->GetKind();
161         if (eKind==HINT_REFDEVICECHG) {
162             pTextEditOutliner->SetRefDevice(pMod->GetRefDevice());
163         }
164         if (eKind==HINT_DEFAULTTABCHG) {
165             pTextEditOutliner->SetDefTab(pMod->GetDefaultTabulator());
166         }
167         if (eKind==HINT_DEFFONTHGTCHG) {
168             // ...
169         }
170         if (eKind==HINT_MODELSAVED) { // #43095#
171             pTextEditOutliner->ClearModifyFlag();
172         }
173     }
174 }
175 
176 void SdrObjEditView::ModelHasChanged()
177 {
178     SdrGlueEditView::ModelHasChanged();
179     if (mxTextEditObj.is() && !mxTextEditObj->IsInserted()) SdrEndTextEdit(); // Objekt geloescht
180     // TextEditObj geaendert?
181     if (IsTextEdit()) {
182         SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( mxTextEditObj.get() );
183         if (pTextObj!=NULL) {
184             sal_uIntPtr nOutlViewAnz=pTextEditOutliner->GetViewCount();
185             sal_Bool bAreaChg=sal_False;
186             sal_Bool bAnchorChg=sal_False;
187             sal_Bool bColorChg=sal_False;
188             bool bContourFrame=pTextObj->IsContourTextFrame();
189             EVAnchorMode eNewAnchor(ANCHOR_VCENTER_HCENTER);
190             Rectangle aOldArea(aMinTextEditArea);
191             aOldArea.Union(aTextEditArea);
192             Color aNewColor;
193             { // Area Checken
194                 Size aPaperMin1;
195                 Size aPaperMax1;
196                 Rectangle aEditArea1;
197                 Rectangle aMinArea1;
198                 pTextObj->TakeTextEditArea(&aPaperMin1,&aPaperMax1,&aEditArea1,&aMinArea1);
199 
200 				// #108784#
201 				Point aPvOfs(pTextObj->GetTextEditOffset());
202 
203                 aEditArea1.Move(aPvOfs.X(),aPvOfs.Y());
204                 aMinArea1.Move(aPvOfs.X(),aPvOfs.Y());
205                 Rectangle aNewArea(aMinArea1);
206                 aNewArea.Union(aEditArea1);
207                 if (aNewArea!=aOldArea || aEditArea1!=aTextEditArea || aMinArea1!=aMinTextEditArea ||
208                     pTextEditOutliner->GetMinAutoPaperSize()!=aPaperMin1 || pTextEditOutliner->GetMaxAutoPaperSize()!=aPaperMax1) {
209                     aTextEditArea=aEditArea1;
210                     aMinTextEditArea=aMinArea1;
211                     pTextEditOutliner->SetUpdateMode(sal_False);
212                     pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
213                     pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
214                     pTextEditOutliner->SetPaperSize(Size(0,0)); // Damit der Outliner neu formatiert
215                     if (!bContourFrame) {
216                         pTextEditOutliner->ClearPolygon();
217                         sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
218                         nStat|=EE_CNTRL_AUTOPAGESIZE;
219                         pTextEditOutliner->SetControlWord(nStat);
220                     } else {
221                         sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
222                         nStat&=~EE_CNTRL_AUTOPAGESIZE;
223                         pTextEditOutliner->SetControlWord(nStat);
224                         Rectangle aAnchorRect;
225                         pTextObj->TakeTextAnchorRect(aAnchorRect);
226                         pTextObj->ImpSetContourPolygon(*pTextEditOutliner,aAnchorRect, sal_True);
227                     }
228                     for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++) {
229                         OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
230                         sal_uIntPtr nStat0=pOLV->GetControlWord();
231                         sal_uIntPtr nStat=nStat0;
232                         // AutoViewSize nur wenn nicht KontourFrame.
233                         if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
234                         else nStat&=~EV_CNTRL_AUTOSIZE;
235                         if (nStat!=nStat0) pOLV->SetControlWord(nStat);
236                     }
237                     pTextEditOutliner->SetUpdateMode(sal_True);
238                     bAreaChg=sal_True;
239                 }
240             }
241             if (pTextEditOutlinerView!=NULL) { // Fuellfarbe und Anker checken
242                 EVAnchorMode eOldAnchor=pTextEditOutlinerView->GetAnchorMode();
243                 eNewAnchor=(EVAnchorMode)pTextObj->GetOutlinerViewAnchorMode();
244                 bAnchorChg=eOldAnchor!=eNewAnchor;
245                 Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
246                 aNewColor = GetTextEditBackgroundColor(*this);
247                 bColorChg=aOldColor!=aNewColor;
248             }
249 			// #104082# refresh always when it's a contour frame. That
250 			// refresh is necessary since it triggers the repaint
251 			// which makes the Handles visible. Changes at TakeTextRect()
252 			// seem to have resulted in a case where no refresh is executed.
253 			// Before that, a refresh must have been always executed
254 			// (else this error would have happend earlier), thus i
255 			// even think here a refresh should be done always.
256 			// Since follow-up problems cannot even be guessed I only
257 			// add this one more case to the if below.
258 			// BTW: It's VERY bad style that here, inside ModelHasChanged()
259 			// the outliner is again massively changed for the text object
260 			// in text edit mode. Normally, all necessary data should be
261 			// set at SdrBeginTextEdit(). Some changes and value assigns in
262 			// SdrBeginTextEdit() are completely useless since they are set here
263 			// again on ModelHasChanged().
264             if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
265 			{
266                 for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++)
267 				{
268                     OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
269                     { // Alten OutlinerView-Bereich invalidieren
270                         Window* pWin=pOLV->GetWindow();
271                         Rectangle aTmpRect(aOldArea);
272                         sal_uInt16 nPixSiz=pOLV->GetInvalidateMore()+1;
273                         Size aMore(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
274                         aTmpRect.Left()-=aMore.Width();
275                         aTmpRect.Right()+=aMore.Width();
276                         aTmpRect.Top()-=aMore.Height();
277                         aTmpRect.Bottom()+=aMore.Height();
278                         InvalidateOneWin(*pWin,aTmpRect);
279                     }
280                     if (bAnchorChg)
281 						pOLV->SetAnchorMode(eNewAnchor);
282                     if (bColorChg)
283 						pOLV->SetBackgroundColor( aNewColor );
284 
285 					pOLV->SetOutputArea(aTextEditArea); // weil sonst scheinbar nicht richtig umgeankert wird
286                     ImpInvalidateOutlinerView(*pOLV);
287                 }
288                 pTextEditOutlinerView->ShowCursor();
289             }
290         }
291         ImpMakeTextCursorAreaVisible();
292     }
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////////////////////////
296 //
297 //  @@@@@@ @@@@@ @@   @@ @@@@@@  @@@@@ @@@@@  @@ @@@@@@
298 //    @@   @@    @@@ @@@   @@    @@    @@  @@ @@   @@
299 //    @@   @@     @@@@@    @@    @@    @@  @@ @@   @@
300 //    @@   @@@@    @@@     @@    @@@@  @@  @@ @@   @@
301 //    @@   @@     @@@@@    @@    @@    @@  @@ @@   @@
302 //    @@   @@    @@@ @@@   @@    @@    @@  @@ @@   @@
303 //    @@   @@@@@ @@   @@   @@    @@@@@ @@@@@  @@   @@
304 //
305 ////////////////////////////////////////////////////////////////////////////////////////////////////
306 
307 void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
308 {
309 	// draw old text edit stuff
310 	if(IsTextEdit())
311 	{
312 		const SdrOutliner* pActiveOutliner = GetTextEditOutliner();
313 
314 		if(pActiveOutliner)
315 		{
316 			const sal_uInt32 nViewAnz(pActiveOutliner->GetViewCount());
317 
318 			if(nViewAnz)
319 			{
320 				const Region& rRedrawRegion = rPaintWindow.GetRedrawRegion();
321 				const Rectangle aCheckRect(rRedrawRegion.GetBoundRect());
322 
323 				for(sal_uInt32 i(0); i < nViewAnz; i++)
324 				{
325 					OutlinerView* pOLV = pActiveOutliner->GetView(i);
326 
327 					if(pOLV->GetWindow() == &rPaintWindow.GetOutputDevice())
328 					{
329 						ImpPaintOutlinerView(*pOLV, aCheckRect, rPaintWindow.GetTargetOutputDevice());
330 						return;
331 					}
332 				}
333 			}
334 		}
335 	}
336 }
337 
338 void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect, OutputDevice& rTargetDevice) const
339 {
340 	const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
341 	bool bTextFrame(pText && pText->IsTextFrame());
342 	bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
343 	bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
344 	Rectangle aBlankRect(rOutlView.GetOutputArea());
345 	aBlankRect.Union(aMinTextEditArea);
346 	Rectangle aPixRect(rTargetDevice.LogicToPixel(aBlankRect));
347 	aBlankRect.Intersection(rRect);
348 	rOutlView.GetOutliner()->SetUpdateMode(sal_True); // Bugfix #22596#
349 	rOutlView.Paint(aBlankRect, &rTargetDevice);
350 
351 	if(!bModifyMerk)
352 	{
353 		// #43095#
354 		pTextEditOutliner->ClearModifyFlag();
355 	}
356 
357 	if(bTextFrame && !bFitToSize)
358 	{
359 		aPixRect.Left()--;
360 		aPixRect.Top()--;
361 		aPixRect.Right()++;
362 		aPixRect.Bottom()++;
363 		sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
364 
365 		{
366 			// xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten
367 			Size aMaxXY(rTargetDevice.GetOutputSizePixel());
368 			long a(2 * nPixSiz);
369 			long nMaxX(aMaxXY.Width() + a);
370 			long nMaxY(aMaxXY.Height() + a);
371 
372 			if (aPixRect.Left  ()<-a) aPixRect.Left()=-a;
373 			if (aPixRect.Top   ()<-a) aPixRect.Top ()=-a;
374 			if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
375 			if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
376 		}
377 
378 		Rectangle aOuterPix(aPixRect);
379 		aOuterPix.Left()-=nPixSiz;
380 		aOuterPix.Top()-=nPixSiz;
381 		aOuterPix.Right()+=nPixSiz;
382 		aOuterPix.Bottom()+=nPixSiz;
383 
384 		bool bMerk(rTargetDevice.IsMapModeEnabled());
385 		rTargetDevice.EnableMapMode(sal_False);
386 		PolyPolygon aPolyPoly( 2 );
387 
388 		svtools::ColorConfig aColorConfig;
389 		Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
390 		const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 );
391 
392 		aPolyPoly.Insert( aOuterPix );
393 		aPolyPoly.Insert( aPixRect );
394 		rTargetDevice.DrawHatch( aPolyPoly, aHatch );
395 
396 		rTargetDevice.EnableMapMode(bMerk);
397 	}
398 
399 	rOutlView.ShowCursor();
400 }
401 
402 void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
403 {
404     Window* pWin = rOutlView.GetWindow();
405 
406 	if(pWin)
407 	{
408 		const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
409 		bool bTextFrame(pText && pText->IsTextFrame());
410 		bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
411 
412 		if(bTextFrame && !bFitToSize)
413 		{
414 			Rectangle aBlankRect(rOutlView.GetOutputArea());
415 			aBlankRect.Union(aMinTextEditArea);
416 			Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
417 			sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
418 
419 			aPixRect.Left()--;
420 			aPixRect.Top()--;
421 			aPixRect.Right()++;
422 			aPixRect.Bottom()++;
423 
424 			{
425 				// xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten
426 				Size aMaxXY(pWin->GetOutputSizePixel());
427 				long a(2 * nPixSiz);
428 				long nMaxX(aMaxXY.Width() + a);
429 				long nMaxY(aMaxXY.Height() + a);
430 
431 				if (aPixRect.Left  ()<-a) aPixRect.Left()=-a;
432 				if (aPixRect.Top   ()<-a) aPixRect.Top ()=-a;
433 				if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
434 				if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
435 			}
436 
437 			Rectangle aOuterPix(aPixRect);
438 			aOuterPix.Left()-=nPixSiz;
439 			aOuterPix.Top()-=nPixSiz;
440 			aOuterPix.Right()+=nPixSiz;
441 			aOuterPix.Bottom()+=nPixSiz;
442 
443 			bool bMerk(pWin->IsMapModeEnabled());
444 			pWin->EnableMapMode(sal_False);
445 			pWin->Invalidate(aOuterPix);
446 			pWin->EnableMapMode(bMerk);
447 		}
448 	}
449 }
450 
451 OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, sal_Bool /*bNoPaint*/, OutlinerView* pGivenView) const
452 {
453     // Hintergrund
454     Color aBackground(GetTextEditBackgroundColor(*this));
455     SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
456     sal_Bool bTextFrame=pText!=NULL && pText->IsTextFrame();
457     sal_Bool bContourFrame=pText!=NULL && pText->IsContourTextFrame();
458     // OutlinerView erzeugen
459     OutlinerView* pOutlView=pGivenView;
460     pTextEditOutliner->SetUpdateMode(sal_False);
461     if (pOutlView==NULL) pOutlView=new OutlinerView(pTextEditOutliner,pWin);
462     else pOutlView->SetWindow(pWin);
463     // Scrollen verbieten
464     sal_uIntPtr nStat=pOutlView->GetControlWord();
465     nStat&=~EV_CNTRL_AUTOSCROLL;
466     // AutoViewSize nur wenn nicht KontourFrame.
467     if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
468     if (bTextFrame) {
469         sal_uInt16 nPixSiz=aHdl.GetHdlSize()*2+1;
470         nStat|=EV_CNTRL_INVONEMORE;
471         pOutlView->SetInvalidateMore(nPixSiz);
472     }
473     pOutlView->SetControlWord(nStat);
474     pOutlView->SetBackgroundColor( aBackground );
475     if (pText!=NULL)
476 	{
477         pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));
478 		pTextEditOutliner->SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)pText->GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
479     }
480     pOutlView->SetOutputArea(aTextEditArea);
481     pTextEditOutliner->SetUpdateMode(sal_True);
482     ImpInvalidateOutlinerView(*pOutlView);
483     return pOutlView;
484 }
485 
486 sal_Bool SdrObjEditView::IsTextEditFrame() const
487 {
488     SdrTextObj* pText = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
489     return pText!=NULL && pText->IsTextFrame();
490 }
491 
492 IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl,EditStatus*,pEditStat)
493 {
494     if(pTextEditOutliner )
495 	{
496 	    SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
497 		if( pTextObj )
498 		{
499 			pTextObj->onEditOutlinerStatusEvent( pEditStat );
500 		}
501 	}
502 	return 0;
503 }
504 
505 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
506 {
507     bool bOk=false;
508     String& rStr=pFI->GetRepresentation();
509     rStr.Erase();
510     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
511     if (pTextObj!=NULL) {
512         Color* pTxtCol=NULL;
513         Color* pFldCol=NULL;
514         bOk=pTextObj->CalcFieldValue(pFI->GetField(),pFI->GetPara(),pFI->GetPos(),sal_True,pTxtCol,pFldCol,rStr);
515         if (bOk) {
516             if (pTxtCol!=NULL) {
517                 pFI->SetTxtColor(*pTxtCol);
518                 delete pTxtCol;
519             }
520             if (pFldCol!=NULL) {
521                 pFI->SetFldColor(*pFldCol);
522                 delete pFldCol;
523             } else {
524                 pFI->SetFldColor(Color(COL_LIGHTGRAY)); // kann spaeter (357) raus
525             }
526         }
527     }
528     Outliner& rDrawOutl=pMod->GetDrawOutliner(pTextObj);
529     Link aDrawOutlLink=rDrawOutl.GetCalcFieldValueHdl();
530     if (!bOk && aDrawOutlLink.IsSet()) {
531         aDrawOutlLink.Call(pFI);
532         bOk = (sal_Bool)rStr.Len();
533     }
534     if (!bOk && aOldCalcFieldValueLink.IsSet()) {
535         return aOldCalcFieldValueLink.Call(pFI);
536     }
537     return 0;
538 }
539 
540 sal_Bool SdrObjEditView::SdrBeginTextEdit(
541 	SdrObject* pObj, SdrPageView* pPV, Window* pWin,
542 	sal_Bool bIsNewObj,	SdrOutliner* pGivenOutliner,
543 	OutlinerView* pGivenOutlinerView,
544 	sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView,
545 	sal_Bool bGrabFocus)
546 {
547     SdrEndTextEdit();
548 
549 	if( dynamic_cast< SdrTextObj* >( pObj ) == 0 )
550 		return sal_False; // currently only possible with text objects
551 
552     if(bGrabFocus && pWin)
553 	{
554 		// attetion, this call may cause an EndTextEdit() call to this view
555 		pWin->GrabFocus(); // to force the cursor into the edit view
556 	}
557 
558     bTextEditDontDelete=bDontDeleteOutliner && pGivenOutliner!=NULL;
559     bTextEditOnlyOneView=bOnlyOneView;
560     bTextEditNewObj=bIsNewObj;
561     const sal_uInt32 nWinAnz(PaintWindowCount());
562     sal_uInt32 i;
563     sal_Bool bBrk(sal_False);
564     // Abbruch, wenn kein Objekt angegeben.
565 
566 	if(!pObj)
567 	{
568 		bBrk = sal_True;
569 	}
570 
571     if(!bBrk && !pWin)
572 	{
573         for(i = 0L; i < nWinAnz && !pWin; i++)
574 		{
575 			SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
576 
577 			if(OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType())
578 			{
579 				pWin = (Window*)(&pPaintWindow->GetOutputDevice());
580 			}
581         }
582 
583 		// Abbruch, wenn kein Window da.
584         if(!pWin)
585 		{
586 			bBrk = sal_True;
587 		}
588     }
589 
590 	if(!bBrk && !pPV)
591 	{
592         pPV = GetSdrPageView();
593 
594 		// Abbruch, wenn keine PageView zu dem Objekt vorhanden.
595         if(!pPV)
596 		{
597 			bBrk = sal_True;
598 		}
599     }
600 
601 	if(pObj && pPV)
602 	{
603         // Kein TextEdit an Objekten im gesperrten Layer
604         if(pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
605 		{
606             bBrk = sal_True;
607         }
608     }
609 
610     if(pTextEditOutliner)
611 	{
612         DBG_ERROR("SdrObjEditView::SdrBeginTextEdit() da stand noch ein alter Outliner rum");
613         delete pTextEditOutliner;
614         pTextEditOutliner = 0L;
615     }
616 
617     if(!bBrk)
618 	{
619         pTextEditWin=pWin;
620         pTextEditPV=pPV;
621         mxTextEditObj.reset( pObj );
622         pTextEditOutliner=pGivenOutliner;
623         if (pTextEditOutliner==NULL)
624 			pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, mxTextEditObj->GetModel() );
625 
626 		{
627 			SvtAccessibilityOptions aOptions;
628 			pTextEditOutliner->ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
629 		}
630 
631         sal_Bool bEmpty = mxTextEditObj->GetOutlinerParaObject()==NULL;
632 
633         aOldCalcFieldValueLink=pTextEditOutliner->GetCalcFieldValueHdl();
634         // Der FieldHdl muss von SdrBeginTextEdit gesetzt sein, da dor ein UpdateFields gerufen wird.
635         pTextEditOutliner->SetCalcFieldValueHdl(LINK(this,SdrObjEditView,ImpOutlinerCalcFieldValueHdl));
636         pTextEditOutliner->SetBeginPasteOrDropHdl(LINK(this,SdrObjEditView,BeginPasteOrDropHdl));
637         pTextEditOutliner->SetEndPasteOrDropHdl(LINK(this,SdrObjEditView, EndPasteOrDropHdl));
638 
639 		// It is just necessary to make the visualized page known. Set it.
640 		pTextEditOutliner->setVisualizedPage(pPV ? pPV->GetPage() : 0);
641 
642 		pTextEditOutliner->SetTextObjNoInit( dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ) );
643 
644         if(mxTextEditObj->BegTextEdit(*pTextEditOutliner))
645 		{
646 			SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
647 			DBG_ASSERT( pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?" );
648 			if( !pTextObj )
649 				return sal_False;
650 
651 			// #111096# Switch off evtl. running TextAnimation
652 			pTextObj->SetTextAnimationAllowed(sal_False);
653 
654             // alten Cursor merken
655             if (pTextEditOutliner->GetViewCount()!=0)
656 			{
657                 OutlinerView* pTmpOLV=pTextEditOutliner->RemoveView(sal_uIntPtr(0));
658                 if(pTmpOLV!=NULL && pTmpOLV!=pGivenOutlinerView)
659 					delete pTmpOLV;
660             }
661 
662             // EditArea ueberTakeTextEditArea bestimmen
663 			// Das koennte eigentlich entfallen, da TakeTextRect() die Berechnung der aTextEditArea vornimmt
664 			// Die aMinTextEditArea muss jedoch wohl auch erfolgen (darum bleibt es voerst drinnen)
665             pTextObj->TakeTextEditArea(NULL,NULL,&aTextEditArea,&aMinTextEditArea);
666 
667 			Rectangle aTextRect;
668     		Rectangle aAnchorRect;
669     		pTextObj->TakeTextRect(*pTextEditOutliner, aTextRect, sal_True,
670 				&aAnchorRect /* #97097# Give sal_True here, not sal_False */);
671 
672     		if ( !pTextObj->IsContourTextFrame() )
673 			{
674 				// FitToSize erstmal nicht mit ContourFrame
675         		SdrFitToSizeType eFit = pTextObj->GetFitToSize();
676         		if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
677         			aTextRect = aAnchorRect;
678 			}
679 
680 			aTextEditArea = aTextRect;
681 
682 			// #108784#
683 			Point aPvOfs(pTextObj->GetTextEditOffset());
684 
685 			aTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
686             aMinTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
687             pTextEditCursorMerker=pWin->GetCursor();
688 
689 	        aHdl.SetMoveOutside(sal_True);
690 
691 			// #i72757#
692 			// Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
693 			// to call AdjustMarkHdl() always.
694 			AdjustMarkHdl();
695 
696             pTextEditOutlinerView=ImpMakeOutlinerView(pWin,!bEmpty,pGivenOutlinerView);
697 
698 			// check if this view is already inserted
699 			sal_uIntPtr i2,nCount = pTextEditOutliner->GetViewCount();
700 			for( i2 = 0; i2 < nCount; i2++ )
701 			{
702 				if( pTextEditOutliner->GetView(i2) == pTextEditOutlinerView )
703 					break;
704 			}
705 
706 			if( i2 == nCount )
707 				pTextEditOutliner->InsertView(pTextEditOutlinerView,0);
708 
709 	        aHdl.SetMoveOutside(sal_False);
710 	        aHdl.SetMoveOutside(sal_True);
711 			//OLMRefreshAllIAOManagers();
712 
713             // alle Wins als OutlinerView beim Outliner anmelden
714             if(!bOnlyOneView)
715 			{
716                 for(i = 0L; i < nWinAnz; i++)
717 				{
718 					SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
719 					OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
720 
721 					if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
722 					{
723                         OutlinerView* pOutlView = ImpMakeOutlinerView((Window*)(&rOutDev), !bEmpty, 0L);
724                         pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i);
725                     }
726                 }
727             }
728 
729 			pTextEditOutlinerView->ShowCursor();
730             pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
731 #ifdef DBG_UTIL
732             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
733 #endif
734             pTextEditOutliner->ClearModifyFlag();
735 
736 			// #71519#, #91453#
737 			if(pWin)
738 			{
739 				sal_Bool bExtraInvalidate(sal_False);
740 
741 				// #71519#
742 				if(!bExtraInvalidate)
743 				{
744         			SdrFitToSizeType eFit = pTextObj->GetFitToSize();
745 					if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES)
746 						bExtraInvalidate = sal_True;
747 				}
748 
749 				if(bExtraInvalidate)
750 				{
751 					pWin->Invalidate(aTextEditArea);
752 				}
753 			}
754 
755             // send HINT_BEGEDIT #99840#
756             if( GetModel() )
757             {
758                 SdrHint aHint(*pTextObj);
759                 aHint.SetKind(HINT_BEGEDIT);
760                 GetModel()->Broadcast(aHint);
761             }
762 
763 			pTextEditOutliner->setVisualizedPage(0);
764 
765 			if( mxSelectionController.is() )
766 				mxSelectionController->onSelectionHasChanged();
767 
768             return sal_True; // Gut gelaufen, TextEdit laeuft nun
769         }
770 		else
771 		{
772             bBrk = sal_True;
773             pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
774             pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
775             pTextEditOutliner->SetEndPasteOrDropHdl(Link());
776 
777         }
778     }
779     if (pTextEditOutliner != NULL)
780 	{
781 		pTextEditOutliner->setVisualizedPage(0);
782 	}
783 
784     // wenn hier angekommen, dann ist irgendwas schief gelaufen
785     if(!bDontDeleteOutliner)
786 	{
787         if(pGivenOutliner!=NULL)
788 		{
789 			delete pGivenOutliner;
790 			pTextEditOutliner = NULL;
791 		}
792 		if(pGivenOutlinerView!=NULL)
793 		{
794 			delete pGivenOutlinerView;
795 			pGivenOutlinerView = NULL;
796 		}
797     }
798     if( pTextEditOutliner!=NULL )
799 	{
800 		delete pTextEditOutliner;
801 	}
802 
803     pTextEditOutliner=NULL;
804     pTextEditOutlinerView=NULL;
805     mxTextEditObj.reset(0);
806     pTextEditPV=NULL;
807     pTextEditWin=NULL;
808     //HMHif (bMarkHdlWhenTextEdit) {
809     //HMH    HideMarkHdl();
810     //HMH}
811     aHdl.SetMoveOutside(sal_False);
812     //HMHShowMarkHdl();
813 
814 	return sal_False;
815 }
816 
817 SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
818 {
819     SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
820     SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
821     Window*       pTEWin         =pTextEditWin;
822     SdrOutliner*  pTEOutliner    =pTextEditOutliner;
823     OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
824     Cursor*       pTECursorMerker=pTextEditCursorMerker;
825 
826     // send HINT_ENDEDIT #99840#
827     if( GetModel() && mxTextEditObj.is() )
828     {
829         SdrHint aHint(*mxTextEditObj.get());
830         aHint.SetKind(HINT_ENDEDIT);
831         GetModel()->Broadcast(aHint);
832     }
833 
834     mxTextEditObj.reset(0);
835     pTextEditPV=NULL;
836     pTextEditWin=NULL;
837     pTextEditOutliner=NULL;
838     pTextEditOutlinerView=NULL;
839     pTextEditCursorMerker=NULL;
840     aTextEditArea=Rectangle();
841 
842     if (pTEOutliner!=NULL)
843 	{
844         sal_Bool bModified=pTEOutliner->IsModified();
845         if (pTEOutlinerView!=NULL)
846 		{
847             pTEOutlinerView->HideCursor();
848         }
849         if (pTEObj!=NULL)
850 		{
851             pTEOutliner->CompleteOnlineSpelling();
852 
853 			SdrUndoObjSetText* pTxtUndo = 0;
854 
855 			if( bModified )
856 			{
857 				sal_Int32 nText;
858 				for( nText = 0; nText < pTEObj->getTextCount(); ++nText )
859 					if( pTEObj->getText( nText ) == pTEObj->getActiveText() )
860 						break;
861 
862 				pTxtUndo = dynamic_cast< SdrUndoObjSetText* >( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTEObj, nText ) );
863 			}
864 			DBG_ASSERT( !bModified || pTxtUndo, "svx::SdrObjEditView::EndTextEdit(), could not create undo action!" );
865             // Den alten CalcFieldValue-Handler wieder setzen
866             // Muss vor Obj::EndTextEdit() geschehen, da dort ein UpdateFields() gemacht wird.
867             pTEOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
868             pTEOutliner->SetBeginPasteOrDropHdl(Link());
869             pTEOutliner->SetEndPasteOrDropHdl(Link());
870 
871 			const bool bUndo = IsUndoEnabled();
872 			if( bUndo )
873 			{
874 				XubString aObjName;
875 		        pTEObj->TakeObjNameSingul(aObjName);
876 			    BegUndo(ImpGetResStr(STR_UndoObjSetText),aObjName);
877 			}
878 
879             pTEObj->EndTextEdit(*pTEOutliner);
880 
881 			if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && pTEObj->ISA(SdrTextObj) && ((SdrTextObj*)pTEObj)->IsFontwork())  )
882 			{
883 				// obviously a repaint
884 				pTEObj->ActionChanged();
885 			}
886 
887             if (pTxtUndo!=NULL)
888 			{
889                 pTxtUndo->AfterSetText();
890                 if (!pTxtUndo->IsDifferent())
891 				{
892 					delete pTxtUndo;
893 					pTxtUndo=NULL;
894 				}
895             }
896             // Loeschung des gesamten TextObj checken
897             SdrUndoAction* pDelUndo=NULL;
898             sal_Bool bDelObj=sal_False;
899             SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pTEObj);
900             if (pTextObj!=NULL && bTextEditNewObj)
901 			{
902                 bDelObj=pTextObj->IsTextFrame() &&
903                         !pTextObj->HasText() &&
904                         !pTextObj->IsEmptyPresObj() &&
905                         !pTextObj->HasFill() &&
906                         !pTextObj->HasLine();
907 
908                 if(pTEObj->IsInserted() && bDelObj && pTextObj->GetObjInventor()==SdrInventor && !bDontDeleteReally)
909 				{
910                     SdrObjKind eIdent=(SdrObjKind)pTextObj->GetObjIdentifier();
911                     if(eIdent==OBJ_TEXT || eIdent==OBJ_TEXTEXT)
912 					{
913                         pDelUndo= GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
914                     }
915                 }
916             }
917             if (pTxtUndo!=NULL)
918 			{
919 				if( bUndo )
920 					AddUndo(pTxtUndo);
921 				eRet=SDRENDTEXTEDIT_CHANGED;
922 			}
923             if (pDelUndo!=NULL)
924 			{
925 				if( bUndo )
926 				{
927 					AddUndo(pDelUndo);
928 				}
929 				else
930 				{
931 					delete pDelUndo;
932 				}
933                 eRet=SDRENDTEXTEDIT_DELETED;
934                 DBG_ASSERT(pTEObj->GetObjList()!=NULL,"SdrObjEditView::SdrEndTextEdit(): Fatal: Editiertes Objekt hat keine ObjList!");
935                 if (pTEObj->GetObjList()!=NULL)
936 				{
937                     pTEObj->GetObjList()->RemoveObject(pTEObj->GetOrdNum());
938                     CheckMarked(); // und gleich die Maekierung entfernen...
939                 }
940             }
941 			else if (bDelObj)
942 			{ // Fuer den Writer: Loeschen muss die App nachholen.
943                 eRet=SDRENDTEXTEDIT_SHOULDBEDELETED;
944             }
945 
946 			if( bUndo )
947 				EndUndo(); // EndUndo hinter Remove, falls der UndoStack gleich weggehaun' wird
948 
949 			// #111096#
950 			// Switch on evtl. TextAnimation again after TextEdit
951 			if(pTEObj->ISA(SdrTextObj))
952 			{
953 				((SdrTextObj*)pTEObj)->SetTextAnimationAllowed(sal_True);
954 			}
955 
956 			// #i72757#
957 			// Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
958 			// to call AdjustMarkHdl() always.
959 			AdjustMarkHdl();
960         }
961         // alle OutlinerViews loeschen
962         for (sal_uIntPtr i=pTEOutliner->GetViewCount(); i>0;)
963 		{
964             i--;
965             OutlinerView* pOLV=pTEOutliner->GetView(i);
966             sal_uInt16 nMorePix=pOLV->GetInvalidateMore() + 10; // solaris aw033 test #i#
967             Window* pWin=pOLV->GetWindow();
968             Rectangle aRect(pOLV->GetOutputArea());
969             pTEOutliner->RemoveView(i);
970             if (!bTextEditDontDelete || i!=0)
971 			{
972                 // die nullte gehoert mir u.U. nicht.
973                 delete pOLV;
974             }
975             aRect.Union(aTextEditArea);
976             aRect.Union(aMinTextEditArea);
977             aRect=pWin->LogicToPixel(aRect);
978             aRect.Left()-=nMorePix;
979             aRect.Top()-=nMorePix;
980             aRect.Right()+=nMorePix;
981             aRect.Bottom()+=nMorePix;
982             aRect=pWin->PixelToLogic(aRect);
983             InvalidateOneWin(*pWin,aRect);
984 //			pWin->Invalidate(INVALIDATE_UPDATE);
985 
986 //			pWin->Update();
987 //			pWin->Flush();
988 			pWin->SetFillColor();
989 			pWin->SetLineColor(COL_BLACK);
990 			pWin->DrawPixel(aRect.TopLeft());
991 			pWin->DrawPixel(aRect.TopRight());
992 			pWin->DrawPixel(aRect.BottomLeft());
993 			pWin->DrawPixel(aRect.BottomRight());
994 			//pWin->DrawRect(aRect);
995         }
996         // und auch den Outliner selbst
997         if (!bTextEditDontDelete) delete pTEOutliner;
998         else pTEOutliner->Clear();
999         if (pTEWin!=NULL) {
1000             pTEWin->SetCursor(pTECursorMerker);
1001         }
1002 //HMH        if (bMarkHdlWhenTextEdit) {
1003 //HMH            HideMarkHdl();
1004 //HMH        }
1005         aHdl.SetMoveOutside(sal_False);
1006         if (eRet!=SDRENDTEXTEDIT_UNCHANGED)
1007 //HMH		{
1008 //HMH            ShowMarkHdl(); // Handles kommen ansonsten via Broadcast
1009 //HMH        }
1010 //HMH		else
1011 		{
1012 			GetMarkedObjectListWriteAccess().SetNameDirty();
1013 		}
1014 #ifdef DBG_UTIL
1015         if (pItemBrowser)
1016 		{
1017 			GetMarkedObjectListWriteAccess().SetNameDirty();
1018 			pItemBrowser->SetDirty();
1019 		}
1020 #endif
1021     }
1022 
1023 	// #108784#
1024 	if(	pTEObj &&
1025 		pTEObj->GetModel() &&
1026 		!pTEObj->GetModel()->isLocked() &&
1027 		pTEObj->GetBroadcaster())
1028 	{
1029 		SdrHint aHint(HINT_ENDEDIT);
1030 		aHint.SetObject(pTEObj);
1031 		((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
1032 	}
1033 
1034 	return eRet;
1035 }
1036 
1037 ////////////////////////////////////////////////////////////////////////////////////////////////////
1038 // info about TextEdit. Default is sal_False.
1039 bool SdrObjEditView::IsTextEdit() const
1040 {
1041 	return mxTextEditObj.is();
1042 }
1043 
1044 // info about TextEditPageView. Default is 0L.
1045 SdrPageView* SdrObjEditView::GetTextEditPageView() const
1046 {
1047 	return pTextEditPV;
1048 }
1049 
1050 ////////////////////////////////////////////////////////////////////////////////////////////////////
1051 
1052 OutlinerView* SdrObjEditView::ImpFindOutlinerView(Window* pWin) const
1053 {
1054     if (pWin==NULL) return NULL;
1055     if (pTextEditOutliner==NULL) return NULL;
1056     OutlinerView* pNewView=NULL;
1057     sal_uIntPtr nWinAnz=pTextEditOutliner->GetViewCount();
1058     for (sal_uIntPtr i=0; i<nWinAnz && pNewView==NULL; i++) {
1059         OutlinerView* pView=pTextEditOutliner->GetView(i);
1060         if (pView->GetWindow()==pWin) pNewView=pView;
1061     }
1062     return pNewView;
1063 }
1064 
1065 void SdrObjEditView::SetTextEditWin(Window* pWin)
1066 {
1067     if(mxTextEditObj.is() && pWin!=NULL && pWin!=pTextEditWin)
1068 	{
1069         OutlinerView* pNewView=ImpFindOutlinerView(pWin);
1070         if (pNewView!=NULL && pNewView!=pTextEditOutlinerView)
1071 		{
1072             if (pTextEditOutlinerView!=NULL)
1073 			{
1074                 pTextEditOutlinerView->HideCursor();
1075             }
1076             pTextEditOutlinerView=pNewView;
1077             pTextEditWin=pWin;
1078             pWin->GrabFocus(); // Damit der Cursor hier auch blinkt
1079             pNewView->ShowCursor();
1080             ImpMakeTextCursorAreaVisible();
1081         }
1082     }
1083 }
1084 
1085 sal_Bool SdrObjEditView::IsTextEditHit(const Point& rHit, short nTol) const
1086 {
1087     sal_Bool bOk=sal_False;
1088     if(mxTextEditObj.is())
1089 	{
1090         nTol=ImpGetHitTolLogic(nTol,NULL);
1091         // nur drittel Toleranz hier, damit die Handles
1092         // noch vernuenftig getroffen werden koennen
1093         nTol=nTol/3;
1094         nTol=0; // Joe am 6.3.1997: Keine Hittoleranz mehr hier
1095         if (!bOk)
1096 		{
1097             Rectangle aEditArea;
1098             OutlinerView* pOLV=pTextEditOutliner->GetView(0);
1099             if (pOLV!=NULL)
1100 			{
1101                 aEditArea.Union(pOLV->GetOutputArea());
1102             }
1103             aEditArea.Left()-=nTol;
1104             aEditArea.Top()-=nTol;
1105             aEditArea.Right()+=nTol;
1106             aEditArea.Bottom()+=nTol;
1107             bOk=aEditArea.IsInside(rHit);
1108             if (bOk)
1109 			{ // Nun noch checken, ob auch wirklich Buchstaben getroffen wurden
1110                 Point aPnt(rHit); aPnt-=aEditArea.TopLeft();
1111 				long nHitTol = 2000;
1112 				OutputDevice* pRef = pTextEditOutliner->GetRefDevice();
1113 				if( pRef )
1114 					nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() );
1115 
1116                 bOk = pTextEditOutliner->IsTextPos( aPnt, (sal_uInt16)nHitTol );
1117             }
1118         }
1119     }
1120     return bOk;
1121 }
1122 
1123 sal_Bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
1124 {
1125     sal_Bool bOk=sal_False;
1126     if(mxTextEditObj.is())
1127 	{
1128         SdrTextObj* pText= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
1129         OutlinerView* pOLV=pTextEditOutliner->GetView(0);
1130 		if( pOLV )
1131 		{
1132         	Window* pWin=pOLV->GetWindow();
1133         	if (pText!=NULL && pText->IsTextFrame() && pOLV!=NULL && pWin!=NULL) {
1134             	sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
1135             	Rectangle aEditArea(aMinTextEditArea);
1136             	aEditArea.Union(pOLV->GetOutputArea());
1137             	if (!aEditArea.IsInside(rHit)) {
1138                 	Size aSiz(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
1139                 	aEditArea.Left()-=aSiz.Width();
1140                 	aEditArea.Top()-=aSiz.Height();
1141                 	aEditArea.Right()+=aSiz.Width();
1142                 	aEditArea.Bottom()+=aSiz.Height();
1143                 	bOk=aEditArea.IsInside(rHit);
1144 				}
1145             }
1146         }
1147     }
1148     return bOk;
1149 }
1150 
1151 void SdrObjEditView::AddTextEditOfs(MouseEvent& rMEvt) const
1152 {
1153     if(mxTextEditObj.is())
1154 	{
1155         Point aPvOfs;
1156 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
1157 
1158 		if( pTextObj )
1159 		{
1160 			// #108784#
1161 			aPvOfs += pTextObj->GetTextEditOffset();
1162 		}
1163 
1164 		Point aObjOfs(mxTextEditObj->GetLogicRect().TopLeft());
1165         (Point&)(rMEvt.GetPosPixel())+=aPvOfs+aObjOfs;
1166     }
1167 }
1168 
1169 ////////////////////////////////////////////////////////////////////////////////////////////////////
1170 
1171 sal_Bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
1172 {
1173     if(pTextEditOutlinerView)
1174 	{
1175 #ifdef DBG_UTIL
1176         if(rKEvt.GetKeyCode().GetCode() == KEY_RETURN && pTextEditOutliner->GetParagraphCount() == 1)
1177 		{
1178             ByteString aLine(
1179 				pTextEditOutliner->GetText(pTextEditOutliner->GetParagraph( 0 ), 1),
1180 				gsl_getSystemTextEncoding());
1181             aLine = aLine.ToUpperAscii();
1182 
1183             if(aLine == "HELLO JOE, PLEASE SHOW THE ITEMBROWSER")
1184 				ShowItemBrowser();
1185         }
1186 #endif
1187 		if (pTextEditOutlinerView->PostKeyEvent(rKEvt))
1188 		{
1189 			if( pMod /* && !pMod->IsChanged() */ )
1190 			{
1191 				if( pTextEditOutliner && pTextEditOutliner->IsModified() )
1192 					pMod->SetChanged( sal_True );
1193 			}
1194 
1195             if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1196 #ifdef DBG_UTIL
1197             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1198 #endif
1199             ImpMakeTextCursorAreaVisible();
1200             return sal_True;
1201         }
1202     }
1203     return SdrGlueEditView::KeyInput(rKEvt,pWin);
1204 }
1205 
1206 sal_Bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
1207 {
1208     if (pTextEditOutlinerView!=NULL) {
1209         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
1210         if (!bPostIt) {
1211             Point aPt(rMEvt.GetPosPixel());
1212             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1213             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1214             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1215         }
1216         if (bPostIt) {
1217             Point aPixPos(rMEvt.GetPosPixel());
1218             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1219             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1220             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1221             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1222             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1223             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1224                              rMEvt.GetButtons(),rMEvt.GetModifier());
1225             if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
1226                 if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1227 #ifdef DBG_UTIL
1228                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1229 #endif
1230                 ImpMakeTextCursorAreaVisible();
1231                 return sal_True;
1232             }
1233         }
1234     }
1235     return SdrGlueEditView::MouseButtonDown(rMEvt,pWin);
1236 }
1237 
1238 sal_Bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
1239 {
1240     if (pTextEditOutlinerView!=NULL) {
1241         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
1242         if (!bPostIt) {
1243             Point aPt(rMEvt.GetPosPixel());
1244             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1245             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1246             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1247         }
1248         if (bPostIt) {
1249             Point aPixPos(rMEvt.GetPosPixel());
1250             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1251             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1252             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1253             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1254             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1255             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1256                              rMEvt.GetButtons(),rMEvt.GetModifier());
1257             if (pTextEditOutlinerView->MouseButtonUp(aMEvt)) {
1258 #ifdef DBG_UTIL
1259                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1260 #endif
1261                 ImpMakeTextCursorAreaVisible();
1262                 return sal_True;
1263             }
1264         }
1265     }
1266     return SdrGlueEditView::MouseButtonUp(rMEvt,pWin);
1267 }
1268 
1269 sal_Bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
1270 {
1271     if (pTextEditOutlinerView!=NULL) {
1272         sal_Bool bSelMode=pTextEditOutliner->IsInSelectionMode();
1273         sal_Bool bPostIt=bSelMode;
1274         if (!bPostIt) {
1275             Point aPt(rMEvt.GetPosPixel());
1276             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1277             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1278             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1279         }
1280         if (bPostIt) {
1281             Point aPixPos(rMEvt.GetPosPixel());
1282             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1283             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1284             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1285             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1286             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1287             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1288                              rMEvt.GetButtons(),rMEvt.GetModifier());
1289             if (pTextEditOutlinerView->MouseMove(aMEvt) && bSelMode) {
1290 #ifdef DBG_UTIL
1291                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1292 #endif
1293                 ImpMakeTextCursorAreaVisible();
1294                 return sal_True;
1295             }
1296         }
1297     }
1298     return SdrGlueEditView::MouseMove(rMEvt,pWin);
1299 }
1300 
1301 sal_Bool SdrObjEditView::Command(const CommandEvent& rCEvt, Window* pWin)
1302 {
1303     // solange bis die OutlinerView einen sal_Bool zurueckliefert
1304     // bekommt sie nur COMMAND_STARTDRAG
1305     if (pTextEditOutlinerView!=NULL)
1306 	{
1307 		if (rCEvt.GetCommand()==COMMAND_STARTDRAG) {
1308 	        sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode() || !rCEvt.IsMouseEvent();
1309     	    if (!bPostIt && rCEvt.IsMouseEvent()) {
1310         	    Point aPt(rCEvt.GetMousePosPixel());
1311             	if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1312 	            else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1313     	        bPostIt=IsTextEditHit(aPt,nHitTolLog);
1314         	}
1315 	        if (bPostIt) {
1316     	        Point aPixPos(rCEvt.GetMousePosPixel());
1317         	    if (rCEvt.IsMouseEvent()) {
1318             	    Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1319 			        if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1320             	    if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1321 	                if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1322     	            if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1323         	    }
1324 	            CommandEvent aCEvt(aPixPos,rCEvt.GetCommand(),rCEvt.IsMouseEvent());
1325     	        // Command ist an der OutlinerView leider void
1326         	    pTextEditOutlinerView->Command(aCEvt);
1327             	if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1328 #ifdef DBG_UTIL
1329 	            if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1330 #endif
1331     	        ImpMakeTextCursorAreaVisible();
1332         	    return sal_True;
1333         	}
1334 		}
1335 		else // if (rCEvt.GetCommand() == COMMAND_VOICE )
1336 		{
1337 			pTextEditOutlinerView->Command(rCEvt);
1338 			return sal_True;
1339 		}
1340 	}
1341 	return SdrGlueEditView::Command(rCEvt,pWin);
1342 }
1343 
1344 sal_Bool SdrObjEditView::Cut(sal_uIntPtr nFormat)
1345 {
1346     if (pTextEditOutliner!=NULL) {
1347         pTextEditOutlinerView->Cut();
1348 #ifdef DBG_UTIL
1349         if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1350 #endif
1351         ImpMakeTextCursorAreaVisible();
1352         return sal_True;
1353     } else {
1354         return SdrGlueEditView::Cut(nFormat);
1355     }
1356 }
1357 
1358 sal_Bool SdrObjEditView::Yank(sal_uIntPtr nFormat)
1359 {
1360     if (pTextEditOutliner!=NULL) {
1361         pTextEditOutlinerView->Copy();
1362         return sal_True;
1363     } else {
1364         return SdrGlueEditView::Yank(nFormat);
1365     }
1366 }
1367 
1368 sal_Bool SdrObjEditView::Paste(Window* pWin, sal_uIntPtr nFormat)
1369 {
1370     if (pTextEditOutliner!=NULL) {
1371         if (pWin!=NULL) {
1372             OutlinerView* pNewView=ImpFindOutlinerView(pWin);
1373             if (pNewView!=NULL) {
1374                 pNewView->Paste();
1375             }
1376         } else {
1377             pTextEditOutlinerView->Paste();
1378         }
1379 #ifdef DBG_UTIL
1380         if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1381 #endif
1382         ImpMakeTextCursorAreaVisible();
1383         return sal_True;
1384     } else {
1385         return SdrGlueEditView::Paste(pWin,nFormat);
1386     }
1387 }
1388 
1389 ////////////////////////////////////////////////////////////////////////////////////////////////////
1390 
1391 sal_Bool SdrObjEditView::ImpIsTextEditAllSelected() const
1392 {
1393     sal_Bool bRet=sal_False;
1394     if (pTextEditOutliner!=NULL && pTextEditOutlinerView!=NULL)
1395 	{
1396 		if(SdrTextObj::HasTextImpl( pTextEditOutliner ) )
1397 		{
1398 			const sal_uInt32 nParaAnz=pTextEditOutliner->GetParagraphCount();
1399 	        Paragraph* pLastPara=pTextEditOutliner->GetParagraph( nParaAnz > 1 ? nParaAnz - 1 : 0 );
1400 
1401 			ESelection aESel(pTextEditOutlinerView->GetSelection());
1402             if (aESel.nStartPara==0 && aESel.nStartPos==0 && aESel.nEndPara==sal_uInt16(nParaAnz-1))
1403 			{
1404                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
1405 
1406 				if(aStr.Len() == aESel.nEndPos)
1407 					bRet = sal_True;
1408             }
1409             // und nun auch noch fuer den Fall, das rueckwaerts selektiert wurde
1410             if (!bRet && aESel.nEndPara==0 && aESel.nEndPos==0 && aESel.nStartPara==sal_uInt16(nParaAnz-1))
1411 			{
1412                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
1413 
1414                 if(aStr.Len() == aESel.nStartPos)
1415 					bRet = sal_True;
1416             }
1417         }
1418 		else
1419 		{
1420             bRet=sal_True;
1421         }
1422     }
1423     return bRet;
1424 }
1425 
1426 void SdrObjEditView::ImpMakeTextCursorAreaVisible()
1427 {
1428     if (pTextEditOutlinerView!=NULL && pTextEditWin!=NULL) {
1429         Cursor* pCsr=pTextEditWin->GetCursor();
1430         if (pCsr!=NULL) {
1431             Size aSiz(pCsr->GetSize());
1432             if (aSiz.Width()!=0 && aSiz.Height()!=0) { // #38450#
1433                 MakeVisible(Rectangle(pCsr->GetPos(),aSiz),*pTextEditWin);
1434             }
1435         }
1436     }
1437 }
1438 
1439 sal_uInt16 SdrObjEditView::GetScriptType() const
1440 {
1441 	sal_uInt16 nScriptType = 0;
1442 
1443     if( IsTextEdit() )
1444 	{
1445 		if( mxTextEditObj->GetOutlinerParaObject() )
1446 			nScriptType = mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
1447 
1448 		if( pTextEditOutlinerView )
1449 			nScriptType = pTextEditOutlinerView->GetSelectedScriptType();
1450 	}
1451 	else
1452 	{
1453 		sal_uInt32 nMarkCount( GetMarkedObjectCount() );
1454 
1455 		for( sal_uInt32 i = 0; i < nMarkCount; i++ )
1456 		{
1457 			OutlinerParaObject* pParaObj = GetMarkedObjectByIndex( i )->GetOutlinerParaObject();
1458 
1459 			if( pParaObj )
1460 			{
1461 				nScriptType |= pParaObj->GetTextObject().GetScriptType();
1462 			}
1463 		}
1464 	}
1465 
1466 	if( nScriptType == 0 )
1467 		nScriptType = SCRIPTTYPE_LATIN;
1468 
1469 	return nScriptType;
1470 }
1471 
1472 /* new interface src537 */
1473 sal_Bool SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
1474 {
1475 	if( mxSelectionController.is() )
1476 		if( mxSelectionController->GetAttributes( rTargetSet, bOnlyHardAttr ) )
1477 			return sal_True;
1478 
1479     if(IsTextEdit())
1480 	{
1481         DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
1482         DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
1483 
1484 		// #92389# take care of bOnlyHardAttr(!)
1485 		if(!bOnlyHardAttr && mxTextEditObj->GetStyleSheet())
1486 			rTargetSet.Put(mxTextEditObj->GetStyleSheet()->GetItemSet());
1487 
1488 		// add object attributes
1489 		rTargetSet.Put( mxTextEditObj->GetMergedItemSet() );
1490 
1491 		if( mxTextEditObj->GetOutlinerParaObject() )
1492 			rTargetSet.Put( SvxScriptTypeItem( mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType() ) );
1493 
1494 		if(pTextEditOutlinerView)
1495 		{
1496 			// FALSE= InvalidItems nicht al Default, sondern als "Loecher" betrachten
1497             rTargetSet.Put(pTextEditOutlinerView->GetAttribs(), sal_False);
1498 			rTargetSet.Put( SvxScriptTypeItem( pTextEditOutlinerView->GetSelectedScriptType() ), sal_False );
1499         }
1500 
1501 		if(GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
1502 		{
1503 			MergeNotPersistAttrFromMarked(rTargetSet, bOnlyHardAttr);
1504 		}
1505 
1506 		return sal_True;
1507 	}
1508 	else
1509 	{
1510 		return SdrGlueEditView::GetAttributes(rTargetSet, bOnlyHardAttr);
1511 	}
1512 }
1513 
1514 sal_Bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
1515 {
1516     sal_Bool bRet=sal_False;
1517     sal_Bool bTextEdit=pTextEditOutlinerView!=NULL && mxTextEditObj.is();
1518     sal_Bool bAllTextSelected=ImpIsTextEditAllSelected();
1519     SfxItemSet* pModifiedSet=NULL;
1520     const SfxItemSet* pSet=&rSet;
1521     //const SvxAdjustItem* pParaJust=NULL;
1522 
1523     if (!bTextEdit)
1524 	{
1525         // Kein TextEdit aktiv -> alle Items ans Zeichenobjekt
1526 		if( mxSelectionController.is() )
1527 			bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
1528 
1529 		if( !bRet )
1530 		{
1531 		    bRet=SdrGlueEditView::SetAttributes(*pSet,bReplaceAll);
1532 		}
1533     }
1534 	else
1535 	{
1536 #ifdef DBG_UTIL
1537         {
1538             sal_Bool bHasEEFeatureItems=sal_False;
1539             SfxItemIter aIter(rSet);
1540             const SfxPoolItem* pItem=aIter.FirstItem();
1541             while (!bHasEEFeatureItems && pItem!=NULL)
1542 			{
1543                 if (!IsInvalidItem(pItem))
1544 				{
1545                     sal_uInt16 nW=pItem->Which();
1546                     if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END)
1547 						bHasEEFeatureItems=sal_True;
1548                 }
1549 
1550                 pItem=aIter.NextItem();
1551             }
1552 
1553             if(bHasEEFeatureItems)
1554 			{
1555 				String aMessage;
1556 				aMessage.AppendAscii("SdrObjEditView::SetAttributes(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
1557                 InfoBox(NULL, aMessage).Execute();
1558             }
1559         }
1560 #endif
1561 
1562         sal_Bool bOnlyEEItems;
1563         sal_Bool bNoEEItems=!SearchOutlinerItems(*pSet,bReplaceAll,&bOnlyEEItems);
1564         // alles selektiert? -> Attrs auch an den Rahmen
1565         // und falls keine EEItems, dann Attrs nur an den Rahmen
1566         if (bAllTextSelected || bNoEEItems)
1567 		{
1568 			if( mxSelectionController.is() )
1569 				bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
1570 
1571 			if( !bRet )
1572 			{
1573 				const bool bUndo = IsUndoEnabled();
1574 
1575 				if( bUndo )
1576 				{
1577 					String aStr;
1578 					ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
1579 					BegUndo(aStr);
1580 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
1581 
1582 					// #i43537#
1583 					// If this is a text object also rescue the OutlinerParaObject since
1584 					// applying attributes to the object may change text layout when
1585 					// multiple portions exist with multiple formats. If a OutlinerParaObject
1586 					// really exists and needs to be rescued is evaluated in the undo
1587 					// implementation itself.
1588 					bool bRescueText = dynamic_cast< SdrTextObj* >(mxTextEditObj.get());
1589 
1590 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,!bNoEEItems || bRescueText));
1591 					EndUndo();
1592 				}
1593 
1594 				mxTextEditObj->SetMergedItemSetAndBroadcast(*pSet, bReplaceAll);
1595 
1596 				FlushComeBackTimer(); // Damit ModeHasChanged sofort kommt
1597 				bRet=sal_True;
1598 			}
1599         }
1600 		else if (!bOnlyEEItems)
1601 		{
1602 			// sonst Set ggf. splitten
1603             // Es wird nun ein ItemSet aSet gemacht, in den die EE_Items von
1604             // *pSet nicht enhalten ist (ansonsten ist es eine Kopie).
1605             sal_uInt16* pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
1606             SfxItemSet aSet(pMod->GetItemPool(),pNewWhichTable);
1607             /*90353*/ delete[] pNewWhichTable;
1608             SfxWhichIter aIter(aSet);
1609             sal_uInt16 nWhich=aIter.FirstWhich();
1610             while (nWhich!=0)
1611 			{
1612                 const SfxPoolItem* pItem;
1613                 SfxItemState eState=pSet->GetItemState(nWhich,sal_False,&pItem);
1614                 if (eState==SFX_ITEM_SET) aSet.Put(*pItem);
1615                 nWhich=aIter.NextWhich();
1616             }
1617 
1618 
1619 			if( mxSelectionController.is() )
1620 				bRet=mxSelectionController->SetAttributes(aSet,bReplaceAll );
1621 
1622 			if( !bRet )
1623 			{
1624 				if( IsUndoEnabled() )
1625 				{
1626 					String aStr;
1627 					ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
1628 					BegUndo(aStr);
1629 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
1630 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,false));
1631 					EndUndo();
1632 				}
1633 
1634 				mxTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll);
1635 
1636 				if (GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
1637 				{
1638 					SetNotPersistAttrToMarked(aSet,bReplaceAll);
1639 				}
1640 			}
1641 			FlushComeBackTimer();
1642             bRet=sal_True;
1643         }
1644         if(!bNoEEItems)
1645 		{
1646             // und nun die Attribute auch noch an die EditEngine
1647             if (bReplaceAll) {
1648                 // Am Outliner kann man leider nur alle Attribute platthauen
1649                 pTextEditOutlinerView->RemoveAttribs( sal_True );
1650             }
1651             pTextEditOutlinerView->SetAttribs(rSet);
1652 
1653 #ifdef DBG_UTIL
1654             if (pItemBrowser!=NULL)
1655 				pItemBrowser->SetDirty();
1656 #endif
1657 
1658             ImpMakeTextCursorAreaVisible();
1659         }
1660         bRet=sal_True;
1661     }
1662     if (pModifiedSet!=NULL)
1663 		delete pModifiedSet;
1664     return bRet;
1665 }
1666 
1667 SfxStyleSheet* SdrObjEditView::GetStyleSheet() const
1668 {
1669 	SfxStyleSheet* pSheet = 0;
1670 
1671 	if( mxSelectionController.is() )
1672 	{
1673 		if( mxSelectionController->GetStyleSheet( pSheet ) )
1674 			return pSheet;
1675 	}
1676 
1677     if ( pTextEditOutlinerView )
1678 	{
1679 		pSheet = pTextEditOutlinerView->GetStyleSheet();
1680     }
1681 	else
1682 	{
1683 		pSheet = SdrGlueEditView::GetStyleSheet();
1684     }
1685 	return pSheet;
1686 }
1687 
1688 sal_Bool SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1689 {
1690 	if( mxSelectionController.is() )
1691 	{
1692 		if( mxSelectionController->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr ) )
1693 			return sal_True;
1694 	}
1695 
1696 	// if we are currently in edit mode we must also set the stylesheet
1697 	// on all paragraphs in the Outliner for the edit view
1698 	// #92191#
1699 	if( NULL != pTextEditOutlinerView )
1700 	{
1701 		Outliner* pOutliner = pTextEditOutlinerView->GetOutliner();
1702 
1703 		const sal_uIntPtr nParaCount = pOutliner->GetParagraphCount();
1704 		sal_uIntPtr nPara;
1705 		for( nPara = 0; nPara < nParaCount; nPara++ )
1706 		{
1707 			pOutliner->SetStyleSheet( nPara, pStyleSheet );
1708 		}
1709 	}
1710 
1711 	return SdrGlueEditView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1712 }
1713 
1714 ////////////////////////////////////////////////////////////////////////////////////////////////////
1715 
1716 void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin)
1717 {
1718     SdrGlueEditView::AddWindowToPaintView(pNewWin);
1719 
1720 	if(mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType()==OUTDEV_WINDOW)
1721 	{
1722         OutlinerView* pOutlView=ImpMakeOutlinerView((Window*)pNewWin,sal_False,NULL);
1723         pTextEditOutliner->InsertView(pOutlView);
1724     }
1725 }
1726 
1727 void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
1728 {
1729     SdrGlueEditView::DeleteWindowFromPaintView(pOldWin);
1730 
1731 	if(mxTextEditObj.is() && !bTextEditOnlyOneView && pOldWin->GetOutDevType()==OUTDEV_WINDOW)
1732 	{
1733         for (sal_uIntPtr i=pTextEditOutliner->GetViewCount(); i>0;) {
1734             i--;
1735             OutlinerView* pOLV=pTextEditOutliner->GetView(i);
1736             if (pOLV && pOLV->GetWindow()==(Window*)pOldWin) {
1737                 delete pTextEditOutliner->RemoveView(i);
1738             }
1739         }
1740     }
1741 }
1742 
1743 sal_Bool SdrObjEditView::IsTextEditInSelectionMode() const
1744 {
1745     return pTextEditOutliner!=NULL && pTextEditOutliner->IsInSelectionMode();
1746 }
1747 
1748 ////////////////////////////////////////////////////////////////////////////////////////////////////
1749 //
1750 //  @@   @@  @@@@   @@@@  @@@@@   @@@@   @@   @@  @@@@  @@@@@  @@@@@
1751 //  @@@ @@@ @@  @@ @@  @@ @@  @@ @@  @@  @@@ @@@ @@  @@ @@  @@ @@
1752 //  @@@@@@@ @@  @@ @@     @@  @@ @@  @@  @@@@@@@ @@  @@ @@  @@ @@
1753 //  @@@@@@@ @@@@@@ @@     @@@@@  @@  @@  @@@@@@@ @@  @@ @@  @@ @@@@
1754 //  @@ @ @@ @@  @@ @@     @@  @@ @@  @@  @@ @ @@ @@  @@ @@  @@ @@
1755 //  @@   @@ @@  @@ @@  @@ @@  @@ @@  @@  @@   @@ @@  @@ @@  @@ @@
1756 //  @@   @@ @@  @@  @@@@  @@  @@  @@@@   @@   @@  @@@@  @@@@@  @@@@@
1757 //
1758 ////////////////////////////////////////////////////////////////////////////////////////////////////
1759 
1760 sal_Bool SdrObjEditView::BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, Window* pWin)
1761 {
1762     sal_Bool bRet=sal_False;
1763     BrkMacroObj();
1764     if (pObj!=NULL && pPV!=NULL && pWin!=NULL && pObj->HasMacro()) {
1765         nTol=ImpGetHitTolLogic(nTol,NULL);
1766         pMacroObj=pObj;
1767         pMacroPV=pPV;
1768         pMacroWin=pWin;
1769         bMacroDown=sal_False;
1770         nMacroTol=sal_uInt16(nTol);
1771         aMacroDownPos=rPnt;
1772         MovMacroObj(rPnt);
1773     }
1774     return bRet;
1775 }
1776 
1777 void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
1778 {
1779     if (pMacroObj!=NULL && bMacroDown)
1780     {
1781         SdrObjMacroHitRec aHitRec;
1782         aHitRec.aPos=rUpPos;
1783         aHitRec.aDownPos=aMacroDownPos;
1784         aHitRec.nTol=nMacroTol;
1785         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1786         aHitRec.pPageView=pMacroPV;
1787         aHitRec.pOut=pMacroWin;
1788         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
1789         bMacroDown=sal_False;
1790     }
1791 }
1792 
1793 void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
1794 {
1795     if (pMacroObj!=NULL && !bMacroDown)
1796     {
1797         SdrObjMacroHitRec aHitRec;
1798         aHitRec.aPos=rDownPos;
1799         aHitRec.aDownPos=aMacroDownPos;
1800         aHitRec.nTol=nMacroTol;
1801         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1802         aHitRec.pPageView=pMacroPV;
1803         aHitRec.bDown=sal_True;
1804         aHitRec.pOut=pMacroWin;
1805         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
1806         bMacroDown=sal_True;
1807     }
1808 }
1809 
1810 void SdrObjEditView::MovMacroObj(const Point& rPnt)
1811 {
1812     if (pMacroObj!=NULL) {
1813         SdrObjMacroHitRec aHitRec;
1814         aHitRec.aPos=rPnt;
1815         aHitRec.aDownPos=aMacroDownPos;
1816         aHitRec.nTol=nMacroTol;
1817         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1818         aHitRec.pPageView=pMacroPV;
1819         aHitRec.bDown=bMacroDown;
1820         aHitRec.pOut=pMacroWin;
1821         sal_Bool bDown=pMacroObj->IsMacroHit(aHitRec);
1822         if (bDown) ImpMacroDown(rPnt);
1823         else ImpMacroUp(rPnt);
1824     }
1825 }
1826 
1827 void SdrObjEditView::BrkMacroObj()
1828 {
1829     if (pMacroObj!=NULL) {
1830         ImpMacroUp(aMacroDownPos);
1831         pMacroObj=NULL;
1832         pMacroPV=NULL;
1833         pMacroWin=NULL;
1834     }
1835 }
1836 
1837 sal_Bool SdrObjEditView::EndMacroObj()
1838 {
1839     if (pMacroObj!=NULL && bMacroDown) {
1840         ImpMacroUp(aMacroDownPos);
1841         SdrObjMacroHitRec aHitRec;
1842         aHitRec.aPos=aMacroDownPos;
1843         aHitRec.aDownPos=aMacroDownPos;
1844         aHitRec.nTol=nMacroTol;
1845         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1846         aHitRec.pPageView=pMacroPV;
1847         aHitRec.bDown=sal_True;
1848         aHitRec.pOut=pMacroWin;
1849         bool bRet=pMacroObj->DoMacro(aHitRec);
1850         pMacroObj=NULL;
1851         pMacroPV=NULL;
1852         pMacroWin=NULL;
1853         return bRet;
1854     } else {
1855         BrkMacroObj();
1856         return sal_False;
1857     }
1858 }
1859 
1860 /** fills the given any with a XTextCursor for the current text selection.
1861 	Leaves the any untouched if there currently is no text selected */
1862 void SdrObjEditView::getTextSelection( ::com::sun::star::uno::Any& rSelection )
1863 {
1864 	if( IsTextEdit() )
1865 	{
1866 		OutlinerView* pOutlinerView = GetTextEditOutlinerView();
1867 		if( pOutlinerView && pOutlinerView->HasSelection() )
1868 		{
1869 			SdrObject* pObj = GetTextEditObject();
1870 
1871 			if( pObj )
1872 			{
1873 				::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xText( pObj->getUnoShape(), ::com::sun::star::uno::UNO_QUERY );
1874 				if( xText.is() )
1875 				{
1876 					SvxUnoTextBase* pRange = SvxUnoTextBase::getImplementation( xText );
1877 					if( pRange )
1878 					{
1879 						rSelection <<= pRange->createTextCursorBySelection( pOutlinerView->GetSelection() );
1880 					}
1881 				}
1882 			}
1883 		}
1884 	}
1885 }
1886 
1887 namespace sdr { namespace table {
1888 extern rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
1889 } }
1890 
1891 /* check if we have a single selection and that single object likes
1892 	to handle the mouse and keyboard events itself
1893 
1894 	@todo: the selection controller should be queried from the
1895 	object specific view contact. Currently this method only
1896 	works for tables.
1897 */
1898 void SdrObjEditView::MarkListHasChanged()
1899 {
1900 	SdrGlueEditView::MarkListHasChanged();
1901 
1902 	if( mxSelectionController.is() )
1903 	{
1904 		mxLastSelectionController = mxSelectionController;
1905 		mxSelectionController->onSelectionHasChanged();
1906 	}
1907 
1908 	mxSelectionController.clear();
1909 
1910 	const SdrMarkList& rMarkList=GetMarkedObjectList();
1911 	if( rMarkList.GetMarkCount() == 1 )
1912 	{
1913 		const SdrObject* pObj= rMarkList.GetMark(0)->GetMarkedSdrObj();
1914 		// check for table
1915 		if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
1916 		{
1917 			mxSelectionController = sdr::table::CreateTableController( this, pObj, mxLastSelectionController );
1918 			if( mxSelectionController.is() )
1919 			{
1920 				mxLastSelectionController.clear();
1921 				mxSelectionController->onSelectionHasChanged();
1922 			}
1923 		}
1924 	}
1925 }
1926 
1927 IMPL_LINK( SdrObjEditView, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos )
1928 {
1929     OnEndPasteOrDrop( pInfos );
1930     return 0;
1931 }
1932 
1933 IMPL_LINK( SdrObjEditView, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos )
1934 {
1935     OnBeginPasteOrDrop( pInfos );
1936     return 0;
1937 }
1938 
1939 void SdrObjEditView::OnBeginPasteOrDrop( PasteOrDropInfos* )
1940 {
1941     // applications can derive from these virtual methods to do something before a drop or paste operation
1942 }
1943 
1944 void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* )
1945 {
1946     // applications can derive from these virtual methods to do something before a drop or paste operation
1947 }
1948 
1949 bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
1950 {
1951     if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor )
1952         return false;
1953     switch(nObjectIdentifier)
1954     {
1955         case OBJ_NONE:
1956         case OBJ_GRUP:
1957             return false;
1958         case OBJ_LINE:
1959         case OBJ_RECT:
1960         case OBJ_CIRC:
1961         case OBJ_SECT:
1962         case OBJ_CARC:
1963         case OBJ_CCUT:
1964         case OBJ_POLY:
1965         case OBJ_PLIN:
1966         case OBJ_PATHLINE:
1967         case OBJ_PATHFILL:
1968         case OBJ_FREELINE:
1969         case OBJ_FREEFILL:
1970         case OBJ_SPLNLINE:
1971         case OBJ_SPLNFILL:
1972         case OBJ_TEXT:
1973         case OBJ_TEXTEXT:
1974         case OBJ_TITLETEXT:
1975         case OBJ_OUTLINETEXT:
1976         case OBJ_GRAF:
1977         case OBJ_OLE2:
1978 		case OBJ_TABLE:
1979             return true;
1980         case OBJ_EDGE:
1981         case OBJ_CAPTION:
1982             return false;
1983         case OBJ_PATHPOLY:
1984         case OBJ_PATHPLIN:
1985             return true;
1986         case OBJ_PAGE:
1987         case OBJ_MEASURE:
1988         case OBJ_DUMMY:
1989         case OBJ_FRAME:
1990         case OBJ_UNO:
1991             return false;
1992         case OBJ_CUSTOMSHAPE:
1993             return true;
1994         default:
1995             return false;
1996     }
1997 }
1998 
1999 static const sal_uInt16* GetFormatRangeImpl( bool bTextOnly )
2000 {
2001     static const sal_uInt16 gRanges[] = {
2002         SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
2003         SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
2004         SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
2005         XATTR_LINE_FIRST, XATTR_LINE_LAST,
2006         XATTR_FILL_FIRST, XATTRSET_FILL,
2007         EE_PARA_START, EE_PARA_END,
2008         EE_CHAR_START, EE_CHAR_END,
2009         0,0
2010     };
2011     return &gRanges[ bTextOnly ? 10 : 0];
2012 }
2013 
2014 bool SdrObjEditView::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  )
2015 {
2016     if( mxSelectionController.is() && mxSelectionController->TakeFormatPaintBrush(rFormatSet) )
2017         return true;
2018 
2019 	const SdrMarkList& rMarkList = GetMarkedObjectList();
2020 	if( rMarkList.GetMarkCount() >= 1 )
2021 	{
2022 	    OutlinerView* pOLV = GetTextEditOutlinerView();
2023 
2024 	    rFormatSet.reset( new SfxItemSet( GetModel()->GetItemPool(), GetFormatRangeImpl( pOLV != NULL ) ) );
2025 	    if( pOLV )
2026 	    {
2027             rFormatSet->Put( pOLV->GetAttribs() );
2028 	    }
2029 	    else
2030 	    {
2031 		    const sal_Bool bOnlyHardAttr = sal_False;
2032 		    rFormatSet->Put( GetAttrFromMarked(bOnlyHardAttr) );
2033 		}
2034 		return true;
2035 	}
2036 
2037     return false;
2038 }
2039 
2040 static SfxItemSet CreatePaintSet( const sal_uInt16 *pRanges, SfxItemPool& rPool, const SfxItemSet& rSourceSet, const SfxItemSet& rTargetSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
2041 {
2042 	SfxItemSet aPaintSet( rPool, pRanges );
2043 
2044 	while( *pRanges )
2045 	{
2046 		sal_uInt16 nWhich = *pRanges++;
2047 		const sal_uInt16 nLastWhich = *pRanges++;
2048 
2049 		if( bNoCharacterFormats && (nWhich == EE_CHAR_START) )
2050 			continue;
2051 
2052 		if( bNoParagraphFormats && (nWhich == EE_PARA_START ) )
2053 			continue;
2054 
2055 		for( ; nWhich < nLastWhich; nWhich++ )
2056 		{
2057 			const SfxPoolItem* pSourceItem = rSourceSet.GetItem( nWhich );
2058 			const SfxPoolItem* pTargetItem = rTargetSet.GetItem( nWhich );
2059 
2060 			if( (pSourceItem && !pTargetItem) || (pSourceItem && pTargetItem && !((*pSourceItem) == (*pTargetItem)) ) )
2061 			{
2062 				aPaintSet.Put( *pSourceItem );
2063 			}
2064 		}
2065 	}
2066 	return aPaintSet;
2067 }
2068 
2069 void SdrObjEditView::ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats )
2070 {
2071     OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
2072     if(pParaObj)
2073     {
2074 	    SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
2075 	    rOutliner.SetText(*pParaObj);
2076 
2077 	    sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
2078 
2079 	    if(nParaCount)
2080 	    {
2081 		    for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
2082 		    {
2083 			    if( !bNoCharacterFormats )
2084 				    rOutliner.QuickRemoveCharAttribs( nPara, /* remove all */0 );
2085 
2086 			    SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
2087 			    aSet.Put(CreatePaintSet( GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
2088 			    rOutliner.SetParaAttribs(nPara, aSet);
2089 		    }
2090 
2091 		    OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
2092 		    rOutliner.Clear();
2093 
2094 		    rTextObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
2095 	    }
2096     }
2097 }
2098 
2099 void SdrObjEditView::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
2100 {
2101     if( !mxSelectionController.is() || !mxSelectionController->ApplyFormatPaintBrush( rFormatSet, bNoCharacterFormats, bNoParagraphFormats ) )
2102     {
2103         const SdrMarkList& rMarkList = GetMarkedObjectList();
2104         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
2105 	    OutlinerView* pOLV = GetTextEditOutlinerView();
2106 
2107         const SfxItemSet& rShapeSet = pObj->GetMergedItemSet();
2108 
2109 	    if( !pOLV )
2110 	    {
2111 		    // if not in text edit mode (aka the user selected text or clicked on a word)
2112 		    // apply formating attributes to selected shape
2113 		    // All formating items (see ranges above) that are unequal in selected shape and
2114 		    // the format paintbrush are hard set on the selected shape.
2115 
2116             const sal_uInt16* pRanges = rFormatSet.GetRanges();
2117             bool bTextOnly = true;
2118 
2119             while( *pRanges )
2120             {
2121                 if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) )
2122                 {
2123                     bTextOnly = false;
2124                     break;
2125                 }
2126                 pRanges += 2;
2127             }
2128 
2129 		    if( !bTextOnly )
2130 		    {
2131 			    SfxItemSet aPaintSet( CreatePaintSet( GetFormatRangeImpl(false), *rShapeSet.GetPool(), rFormatSet, rShapeSet, bNoCharacterFormats, bNoParagraphFormats ) );
2132 			    const sal_Bool bReplaceAll = sal_False;
2133 			    SetAttrToMarked(aPaintSet, bReplaceAll);
2134 		    }
2135 
2136 		    // now apply character and paragraph formating to text, if the shape has any
2137 		    SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
2138 		    if( pTextObj )
2139 		    {
2140 			    sal_Int32 nText = pTextObj->getTextCount();
2141 
2142 			    while( --nText >= 0 )
2143 			    {
2144                     SdrText* pText = pTextObj->getText( nText );
2145                     ApplyFormatPaintBrushToText( rFormatSet, *pTextObj, pText, bNoCharacterFormats, bNoParagraphFormats );
2146 			    }
2147 		    }
2148 	    }
2149 	    else
2150 	    {
2151 		    ::Outliner* pOutliner = pOLV->GetOutliner();
2152 		    if( pOutliner )
2153 		    {
2154 			    const EditEngine& rEditEngine = pOutliner->GetEditEngine();
2155 
2156 			    ESelection aSel( pOLV->GetSelection() );
2157 			    if( !aSel.HasRange() )
2158 				    pOLV->SetSelection( rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD ) );
2159 
2160 			    const sal_Bool bRemoveParaAttribs = !bNoParagraphFormats;
2161 			    pOLV->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
2162 			    SfxItemSet aSet( pOLV->GetAttribs() );
2163 			    SfxItemSet aPaintSet( CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
2164 			    pOLV->SetAttribs( aPaintSet );
2165 		    }
2166 	    }
2167     }
2168 }
2169