xref: /aoo41x/main/svx/source/svdraw/svdedxv.cxx (revision c0739476)
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                 if(pTextObj->GetFitToSize())
676                 {
677         			aTextRect = aAnchorRect;
678                 }
679 			}
680 
681 			aTextEditArea = aTextRect;
682 
683 			// #108784#
684 			Point aPvOfs(pTextObj->GetTextEditOffset());
685 
686 			aTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
687             aMinTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
688             pTextEditCursorMerker=pWin->GetCursor();
689 
690 	        aHdl.SetMoveOutside(sal_True);
691 
692 			// #i72757#
693 			// Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
694 			// to call AdjustMarkHdl() always.
695 			AdjustMarkHdl();
696 
697             pTextEditOutlinerView=ImpMakeOutlinerView(pWin,!bEmpty,pGivenOutlinerView);
698 
699 			// check if this view is already inserted
700 			sal_uIntPtr i2,nCount = pTextEditOutliner->GetViewCount();
701 			for( i2 = 0; i2 < nCount; i2++ )
702 			{
703 				if( pTextEditOutliner->GetView(i2) == pTextEditOutlinerView )
704 					break;
705 			}
706 
707 			if( i2 == nCount )
708 				pTextEditOutliner->InsertView(pTextEditOutlinerView,0);
709 
710 	        aHdl.SetMoveOutside(sal_False);
711 	        aHdl.SetMoveOutside(sal_True);
712 			//OLMRefreshAllIAOManagers();
713 
714             // alle Wins als OutlinerView beim Outliner anmelden
715             if(!bOnlyOneView)
716 			{
717                 for(i = 0L; i < nWinAnz; i++)
718 				{
719 					SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
720 					OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
721 
722 					if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
723 					{
724                         OutlinerView* pOutlView = ImpMakeOutlinerView((Window*)(&rOutDev), !bEmpty, 0L);
725                         pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i);
726                     }
727                 }
728             }
729 
730 			pTextEditOutlinerView->ShowCursor();
731             pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
732 #ifdef DBG_UTIL
733             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
734 #endif
735             pTextEditOutliner->ClearModifyFlag();
736 
737 			// #71519#, #91453#
738 			if(pWin)
739 			{
740 				sal_Bool bExtraInvalidate(sal_False);
741 
742 				// #71519#
743 				if(!bExtraInvalidate)
744 				{
745                     if(pTextObj->GetFitToSize())
746                     {
747 						bExtraInvalidate = sal_True;
748                     }
749 				}
750 
751 				if(bExtraInvalidate)
752 				{
753 					pWin->Invalidate(aTextEditArea);
754 				}
755 			}
756 
757             // send HINT_BEGEDIT #99840#
758             if( GetModel() )
759             {
760                 SdrHint aHint(*pTextObj);
761                 aHint.SetKind(HINT_BEGEDIT);
762                 GetModel()->Broadcast(aHint);
763             }
764 
765 			pTextEditOutliner->setVisualizedPage(0);
766 
767 			if( mxSelectionController.is() )
768 				mxSelectionController->onSelectionHasChanged();
769 
770             return sal_True; // Gut gelaufen, TextEdit laeuft nun
771         }
772 		else
773 		{
774             bBrk = sal_True;
775             pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
776             pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
777             pTextEditOutliner->SetEndPasteOrDropHdl(Link());
778 
779         }
780     }
781     if (pTextEditOutliner != NULL)
782 	{
783 		pTextEditOutliner->setVisualizedPage(0);
784 	}
785 
786     // wenn hier angekommen, dann ist irgendwas schief gelaufen
787     if(!bDontDeleteOutliner)
788 	{
789         if(pGivenOutliner!=NULL)
790 		{
791 			delete pGivenOutliner;
792 			pTextEditOutliner = NULL;
793 		}
794 		if(pGivenOutlinerView!=NULL)
795 		{
796 			delete pGivenOutlinerView;
797 			pGivenOutlinerView = NULL;
798 		}
799     }
800     if( pTextEditOutliner!=NULL )
801 	{
802 		delete pTextEditOutliner;
803 	}
804 
805     pTextEditOutliner=NULL;
806     pTextEditOutlinerView=NULL;
807     mxTextEditObj.reset(0);
808     pTextEditPV=NULL;
809     pTextEditWin=NULL;
810     //HMHif (bMarkHdlWhenTextEdit) {
811     //HMH    HideMarkHdl();
812     //HMH}
813     aHdl.SetMoveOutside(sal_False);
814     //HMHShowMarkHdl();
815 
816 	return sal_False;
817 }
818 
819 SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
820 {
821     SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
822     SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
823     Window*       pTEWin         =pTextEditWin;
824     SdrOutliner*  pTEOutliner    =pTextEditOutliner;
825     OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
826     Cursor*       pTECursorMerker=pTextEditCursorMerker;
827 
828     // send HINT_ENDEDIT #99840#
829     if( GetModel() && mxTextEditObj.is() )
830     {
831         SdrHint aHint(*mxTextEditObj.get());
832         aHint.SetKind(HINT_ENDEDIT);
833         GetModel()->Broadcast(aHint);
834     }
835 
836     mxTextEditObj.reset(0);
837     pTextEditPV=NULL;
838     pTextEditWin=NULL;
839     pTextEditOutliner=NULL;
840     pTextEditOutlinerView=NULL;
841     pTextEditCursorMerker=NULL;
842     aTextEditArea=Rectangle();
843 
844     if (pTEOutliner!=NULL)
845 	{
846         sal_Bool bModified=pTEOutliner->IsModified();
847         if (pTEOutlinerView!=NULL)
848 		{
849             pTEOutlinerView->HideCursor();
850         }
851         if (pTEObj!=NULL)
852 		{
853             pTEOutliner->CompleteOnlineSpelling();
854 
855 			SdrUndoObjSetText* pTxtUndo = 0;
856 
857 			if( bModified )
858 			{
859 				sal_Int32 nText;
860 				for( nText = 0; nText < pTEObj->getTextCount(); ++nText )
861 					if( pTEObj->getText( nText ) == pTEObj->getActiveText() )
862 						break;
863 
864 				pTxtUndo = dynamic_cast< SdrUndoObjSetText* >( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTEObj, nText ) );
865 			}
866 			DBG_ASSERT( !bModified || pTxtUndo, "svx::SdrObjEditView::EndTextEdit(), could not create undo action!" );
867             // Den alten CalcFieldValue-Handler wieder setzen
868             // Muss vor Obj::EndTextEdit() geschehen, da dort ein UpdateFields() gemacht wird.
869             pTEOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
870             pTEOutliner->SetBeginPasteOrDropHdl(Link());
871             pTEOutliner->SetEndPasteOrDropHdl(Link());
872 
873 			const bool bUndo = IsUndoEnabled();
874 			if( bUndo )
875 			{
876 				XubString aObjName;
877 		        pTEObj->TakeObjNameSingul(aObjName);
878 			    BegUndo(ImpGetResStr(STR_UndoObjSetText),aObjName);
879 			}
880 
881             pTEObj->EndTextEdit(*pTEOutliner);
882 
883 			if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && pTEObj->ISA(SdrTextObj) && ((SdrTextObj*)pTEObj)->IsFontwork())  )
884 			{
885 				// obviously a repaint
886 				pTEObj->ActionChanged();
887 			}
888 
889             if (pTxtUndo!=NULL)
890 			{
891                 pTxtUndo->AfterSetText();
892                 if (!pTxtUndo->IsDifferent())
893 				{
894 					delete pTxtUndo;
895 					pTxtUndo=NULL;
896 				}
897             }
898             // Loeschung des gesamten TextObj checken
899             SdrUndoAction* pDelUndo=NULL;
900             sal_Bool bDelObj=sal_False;
901             SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pTEObj);
902             if (pTextObj!=NULL && bTextEditNewObj)
903 			{
904                 bDelObj=pTextObj->IsTextFrame() &&
905                         !pTextObj->HasText() &&
906                         !pTextObj->IsEmptyPresObj() &&
907                         !pTextObj->HasFill() &&
908                         !pTextObj->HasLine();
909 
910                 if(pTEObj->IsInserted() && bDelObj && pTextObj->GetObjInventor()==SdrInventor && !bDontDeleteReally)
911 				{
912                     SdrObjKind eIdent=(SdrObjKind)pTextObj->GetObjIdentifier();
913                     if(eIdent==OBJ_TEXT || eIdent==OBJ_TEXTEXT)
914 					{
915                         pDelUndo= GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
916                     }
917                 }
918             }
919             if (pTxtUndo!=NULL)
920 			{
921 				if( bUndo )
922 					AddUndo(pTxtUndo);
923 				eRet=SDRENDTEXTEDIT_CHANGED;
924 			}
925             if (pDelUndo!=NULL)
926 			{
927 				if( bUndo )
928 				{
929 					AddUndo(pDelUndo);
930 				}
931 				else
932 				{
933 					delete pDelUndo;
934 				}
935                 eRet=SDRENDTEXTEDIT_DELETED;
936                 DBG_ASSERT(pTEObj->GetObjList()!=NULL,"SdrObjEditView::SdrEndTextEdit(): Fatal: Editiertes Objekt hat keine ObjList!");
937                 if (pTEObj->GetObjList()!=NULL)
938 				{
939                     pTEObj->GetObjList()->RemoveObject(pTEObj->GetOrdNum());
940                     CheckMarked(); // und gleich die Maekierung entfernen...
941                 }
942             }
943 			else if (bDelObj)
944 			{ // Fuer den Writer: Loeschen muss die App nachholen.
945                 eRet=SDRENDTEXTEDIT_SHOULDBEDELETED;
946             }
947 
948 			if( bUndo )
949 				EndUndo(); // EndUndo hinter Remove, falls der UndoStack gleich weggehaun' wird
950 
951 			// #111096#
952 			// Switch on evtl. TextAnimation again after TextEdit
953 			if(pTEObj->ISA(SdrTextObj))
954 			{
955 				((SdrTextObj*)pTEObj)->SetTextAnimationAllowed(sal_True);
956 			}
957 
958 			// #i72757#
959 			// Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
960 			// to call AdjustMarkHdl() always.
961 			AdjustMarkHdl();
962         }
963         // alle OutlinerViews loeschen
964         for (sal_uIntPtr i=pTEOutliner->GetViewCount(); i>0;)
965 		{
966             i--;
967             OutlinerView* pOLV=pTEOutliner->GetView(i);
968             sal_uInt16 nMorePix=pOLV->GetInvalidateMore() + 10; // solaris aw033 test #i#
969             Window* pWin=pOLV->GetWindow();
970             Rectangle aRect(pOLV->GetOutputArea());
971             pTEOutliner->RemoveView(i);
972             if (!bTextEditDontDelete || i!=0)
973 			{
974                 // die nullte gehoert mir u.U. nicht.
975                 delete pOLV;
976             }
977             aRect.Union(aTextEditArea);
978             aRect.Union(aMinTextEditArea);
979             aRect=pWin->LogicToPixel(aRect);
980             aRect.Left()-=nMorePix;
981             aRect.Top()-=nMorePix;
982             aRect.Right()+=nMorePix;
983             aRect.Bottom()+=nMorePix;
984             aRect=pWin->PixelToLogic(aRect);
985             InvalidateOneWin(*pWin,aRect);
986 //			pWin->Invalidate(INVALIDATE_UPDATE);
987 
988 //			pWin->Update();
989 //			pWin->Flush();
990 			pWin->SetFillColor();
991 			pWin->SetLineColor(COL_BLACK);
992 			pWin->DrawPixel(aRect.TopLeft());
993 			pWin->DrawPixel(aRect.TopRight());
994 			pWin->DrawPixel(aRect.BottomLeft());
995 			pWin->DrawPixel(aRect.BottomRight());
996 			//pWin->DrawRect(aRect);
997         }
998         // und auch den Outliner selbst
999         if (!bTextEditDontDelete) delete pTEOutliner;
1000         else pTEOutliner->Clear();
1001         if (pTEWin!=NULL) {
1002             pTEWin->SetCursor(pTECursorMerker);
1003         }
1004 //HMH        if (bMarkHdlWhenTextEdit) {
1005 //HMH            HideMarkHdl();
1006 //HMH        }
1007         aHdl.SetMoveOutside(sal_False);
1008         if (eRet!=SDRENDTEXTEDIT_UNCHANGED)
1009 //HMH		{
1010 //HMH            ShowMarkHdl(); // Handles kommen ansonsten via Broadcast
1011 //HMH        }
1012 //HMH		else
1013 		{
1014 			GetMarkedObjectListWriteAccess().SetNameDirty();
1015 		}
1016 #ifdef DBG_UTIL
1017         if (pItemBrowser)
1018 		{
1019 			GetMarkedObjectListWriteAccess().SetNameDirty();
1020 			pItemBrowser->SetDirty();
1021 		}
1022 #endif
1023     }
1024 
1025 	// #108784#
1026 	if(	pTEObj &&
1027 		pTEObj->GetModel() &&
1028 		!pTEObj->GetModel()->isLocked() &&
1029 		pTEObj->GetBroadcaster())
1030 	{
1031 		SdrHint aHint(HINT_ENDEDIT);
1032 		aHint.SetObject(pTEObj);
1033 		((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
1034 	}
1035 
1036 	return eRet;
1037 }
1038 
1039 ////////////////////////////////////////////////////////////////////////////////////////////////////
1040 // info about TextEdit. Default is sal_False.
1041 bool SdrObjEditView::IsTextEdit() const
1042 {
1043 	return mxTextEditObj.is();
1044 }
1045 
1046 // info about TextEditPageView. Default is 0L.
1047 SdrPageView* SdrObjEditView::GetTextEditPageView() const
1048 {
1049 	return pTextEditPV;
1050 }
1051 
1052 ////////////////////////////////////////////////////////////////////////////////////////////////////
1053 
1054 OutlinerView* SdrObjEditView::ImpFindOutlinerView(Window* pWin) const
1055 {
1056     if (pWin==NULL) return NULL;
1057     if (pTextEditOutliner==NULL) return NULL;
1058     OutlinerView* pNewView=NULL;
1059     sal_uIntPtr nWinAnz=pTextEditOutliner->GetViewCount();
1060     for (sal_uIntPtr i=0; i<nWinAnz && pNewView==NULL; i++) {
1061         OutlinerView* pView=pTextEditOutliner->GetView(i);
1062         if (pView->GetWindow()==pWin) pNewView=pView;
1063     }
1064     return pNewView;
1065 }
1066 
1067 void SdrObjEditView::SetTextEditWin(Window* pWin)
1068 {
1069     if(mxTextEditObj.is() && pWin!=NULL && pWin!=pTextEditWin)
1070 	{
1071         OutlinerView* pNewView=ImpFindOutlinerView(pWin);
1072         if (pNewView!=NULL && pNewView!=pTextEditOutlinerView)
1073 		{
1074             if (pTextEditOutlinerView!=NULL)
1075 			{
1076                 pTextEditOutlinerView->HideCursor();
1077             }
1078             pTextEditOutlinerView=pNewView;
1079             pTextEditWin=pWin;
1080             pWin->GrabFocus(); // Damit der Cursor hier auch blinkt
1081             pNewView->ShowCursor();
1082             ImpMakeTextCursorAreaVisible();
1083         }
1084     }
1085 }
1086 
1087 sal_Bool SdrObjEditView::IsTextEditHit(const Point& rHit, short nTol) const
1088 {
1089     sal_Bool bOk=sal_False;
1090     if(mxTextEditObj.is())
1091 	{
1092         nTol=ImpGetHitTolLogic(nTol,NULL);
1093         // nur drittel Toleranz hier, damit die Handles
1094         // noch vernuenftig getroffen werden koennen
1095         nTol=nTol/3;
1096         nTol=0; // Joe am 6.3.1997: Keine Hittoleranz mehr hier
1097         if (!bOk)
1098 		{
1099             Rectangle aEditArea;
1100             OutlinerView* pOLV=pTextEditOutliner->GetView(0);
1101             if (pOLV!=NULL)
1102 			{
1103                 aEditArea.Union(pOLV->GetOutputArea());
1104             }
1105             aEditArea.Left()-=nTol;
1106             aEditArea.Top()-=nTol;
1107             aEditArea.Right()+=nTol;
1108             aEditArea.Bottom()+=nTol;
1109             bOk=aEditArea.IsInside(rHit);
1110             if (bOk)
1111 			{ // Nun noch checken, ob auch wirklich Buchstaben getroffen wurden
1112                 Point aPnt(rHit); aPnt-=aEditArea.TopLeft();
1113 				long nHitTol = 2000;
1114 				OutputDevice* pRef = pTextEditOutliner->GetRefDevice();
1115 				if( pRef )
1116 					nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() );
1117 
1118                 bOk = pTextEditOutliner->IsTextPos( aPnt, (sal_uInt16)nHitTol );
1119             }
1120         }
1121     }
1122     return bOk;
1123 }
1124 
1125 sal_Bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
1126 {
1127     sal_Bool bOk=sal_False;
1128     if(mxTextEditObj.is())
1129 	{
1130         SdrTextObj* pText= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
1131         OutlinerView* pOLV=pTextEditOutliner->GetView(0);
1132 		if( pOLV )
1133 		{
1134         	Window* pWin=pOLV->GetWindow();
1135         	if (pText!=NULL && pText->IsTextFrame() && pOLV!=NULL && pWin!=NULL) {
1136             	sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
1137             	Rectangle aEditArea(aMinTextEditArea);
1138             	aEditArea.Union(pOLV->GetOutputArea());
1139             	if (!aEditArea.IsInside(rHit)) {
1140                 	Size aSiz(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
1141                 	aEditArea.Left()-=aSiz.Width();
1142                 	aEditArea.Top()-=aSiz.Height();
1143                 	aEditArea.Right()+=aSiz.Width();
1144                 	aEditArea.Bottom()+=aSiz.Height();
1145                 	bOk=aEditArea.IsInside(rHit);
1146 				}
1147             }
1148         }
1149     }
1150     return bOk;
1151 }
1152 
1153 void SdrObjEditView::AddTextEditOfs(MouseEvent& rMEvt) const
1154 {
1155     if(mxTextEditObj.is())
1156 	{
1157         Point aPvOfs;
1158 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
1159 
1160 		if( pTextObj )
1161 		{
1162 			// #108784#
1163 			aPvOfs += pTextObj->GetTextEditOffset();
1164 		}
1165 
1166 		Point aObjOfs(mxTextEditObj->GetLogicRect().TopLeft());
1167         (Point&)(rMEvt.GetPosPixel())+=aPvOfs+aObjOfs;
1168     }
1169 }
1170 
1171 ////////////////////////////////////////////////////////////////////////////////////////////////////
1172 
1173 sal_Bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
1174 {
1175     if(pTextEditOutlinerView)
1176 	{
1177 #ifdef DBG_UTIL
1178         if(rKEvt.GetKeyCode().GetCode() == KEY_RETURN && pTextEditOutliner->GetParagraphCount() == 1)
1179 		{
1180             ByteString aLine(
1181 				pTextEditOutliner->GetText(pTextEditOutliner->GetParagraph( 0 ), 1),
1182 				gsl_getSystemTextEncoding());
1183             aLine = aLine.ToUpperAscii();
1184 
1185             if(aLine == "HELLO JOE, PLEASE SHOW THE ITEMBROWSER")
1186 				ShowItemBrowser();
1187         }
1188 #endif
1189 		if (pTextEditOutlinerView->PostKeyEvent(rKEvt))
1190 		{
1191 			if( pMod /* && !pMod->IsChanged() */ )
1192 			{
1193 				if( pTextEditOutliner && pTextEditOutliner->IsModified() )
1194 					pMod->SetChanged( sal_True );
1195 			}
1196 
1197             if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1198 #ifdef DBG_UTIL
1199             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1200 #endif
1201             ImpMakeTextCursorAreaVisible();
1202             return sal_True;
1203         }
1204     }
1205     return SdrGlueEditView::KeyInput(rKEvt,pWin);
1206 }
1207 
1208 sal_Bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
1209 {
1210     if (pTextEditOutlinerView!=NULL) {
1211         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
1212         if (!bPostIt) {
1213             Point aPt(rMEvt.GetPosPixel());
1214             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1215             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1216             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1217         }
1218         if (bPostIt) {
1219             Point aPixPos(rMEvt.GetPosPixel());
1220             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1221             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1222             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1223             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1224             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1225             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1226                              rMEvt.GetButtons(),rMEvt.GetModifier());
1227             if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
1228                 if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1229 #ifdef DBG_UTIL
1230                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1231 #endif
1232                 ImpMakeTextCursorAreaVisible();
1233                 return sal_True;
1234             }
1235         }
1236     }
1237     return SdrGlueEditView::MouseButtonDown(rMEvt,pWin);
1238 }
1239 
1240 sal_Bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
1241 {
1242     if (pTextEditOutlinerView!=NULL) {
1243         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
1244         if (!bPostIt) {
1245             Point aPt(rMEvt.GetPosPixel());
1246             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1247             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1248             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1249         }
1250         if (bPostIt) {
1251             Point aPixPos(rMEvt.GetPosPixel());
1252             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1253             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1254             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1255             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1256             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1257             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1258                              rMEvt.GetButtons(),rMEvt.GetModifier());
1259             if (pTextEditOutlinerView->MouseButtonUp(aMEvt)) {
1260 #ifdef DBG_UTIL
1261                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1262 #endif
1263                 ImpMakeTextCursorAreaVisible();
1264                 return sal_True;
1265             }
1266         }
1267     }
1268     return SdrGlueEditView::MouseButtonUp(rMEvt,pWin);
1269 }
1270 
1271 sal_Bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
1272 {
1273     if (pTextEditOutlinerView!=NULL) {
1274         sal_Bool bSelMode=pTextEditOutliner->IsInSelectionMode();
1275         sal_Bool bPostIt=bSelMode;
1276         if (!bPostIt) {
1277             Point aPt(rMEvt.GetPosPixel());
1278             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1279             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1280             bPostIt=IsTextEditHit(aPt,nHitTolLog);
1281         }
1282         if (bPostIt) {
1283             Point aPixPos(rMEvt.GetPosPixel());
1284             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1285             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1286             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1287             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1288             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1289             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
1290                              rMEvt.GetButtons(),rMEvt.GetModifier());
1291             if (pTextEditOutlinerView->MouseMove(aMEvt) && bSelMode) {
1292 #ifdef DBG_UTIL
1293                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1294 #endif
1295                 ImpMakeTextCursorAreaVisible();
1296                 return sal_True;
1297             }
1298         }
1299     }
1300     return SdrGlueEditView::MouseMove(rMEvt,pWin);
1301 }
1302 
1303 sal_Bool SdrObjEditView::Command(const CommandEvent& rCEvt, Window* pWin)
1304 {
1305     // solange bis die OutlinerView einen sal_Bool zurueckliefert
1306     // bekommt sie nur COMMAND_STARTDRAG
1307     if (pTextEditOutlinerView!=NULL)
1308 	{
1309 		if (rCEvt.GetCommand()==COMMAND_STARTDRAG) {
1310 	        sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode() || !rCEvt.IsMouseEvent();
1311     	    if (!bPostIt && rCEvt.IsMouseEvent()) {
1312         	    Point aPt(rCEvt.GetMousePosPixel());
1313             	if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
1314 	            else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
1315     	        bPostIt=IsTextEditHit(aPt,nHitTolLog);
1316         	}
1317 	        if (bPostIt) {
1318     	        Point aPixPos(rCEvt.GetMousePosPixel());
1319         	    if (rCEvt.IsMouseEvent()) {
1320             	    Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
1321 			        if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
1322             	    if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
1323 	                if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
1324     	            if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
1325         	    }
1326 	            CommandEvent aCEvt(aPixPos,rCEvt.GetCommand(),rCEvt.IsMouseEvent());
1327     	        // Command ist an der OutlinerView leider void
1328         	    pTextEditOutlinerView->Command(aCEvt);
1329             	if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
1330 #ifdef DBG_UTIL
1331 	            if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1332 #endif
1333     	        ImpMakeTextCursorAreaVisible();
1334         	    return sal_True;
1335         	}
1336 		}
1337 		else // if (rCEvt.GetCommand() == COMMAND_VOICE )
1338 		{
1339 			pTextEditOutlinerView->Command(rCEvt);
1340 			return sal_True;
1341 		}
1342 	}
1343 	return SdrGlueEditView::Command(rCEvt,pWin);
1344 }
1345 
1346 sal_Bool SdrObjEditView::Cut(sal_uIntPtr nFormat)
1347 {
1348     if (pTextEditOutliner!=NULL) {
1349         pTextEditOutlinerView->Cut();
1350 #ifdef DBG_UTIL
1351         if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1352 #endif
1353         ImpMakeTextCursorAreaVisible();
1354         return sal_True;
1355     } else {
1356         return SdrGlueEditView::Cut(nFormat);
1357     }
1358 }
1359 
1360 sal_Bool SdrObjEditView::Yank(sal_uIntPtr nFormat)
1361 {
1362     if (pTextEditOutliner!=NULL) {
1363         pTextEditOutlinerView->Copy();
1364         return sal_True;
1365     } else {
1366         return SdrGlueEditView::Yank(nFormat);
1367     }
1368 }
1369 
1370 sal_Bool SdrObjEditView::Paste(Window* pWin, sal_uIntPtr nFormat)
1371 {
1372     if (pTextEditOutliner!=NULL) {
1373         if (pWin!=NULL) {
1374             OutlinerView* pNewView=ImpFindOutlinerView(pWin);
1375             if (pNewView!=NULL) {
1376                 pNewView->Paste();
1377             }
1378         } else {
1379             pTextEditOutlinerView->Paste();
1380         }
1381 #ifdef DBG_UTIL
1382         if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1383 #endif
1384         ImpMakeTextCursorAreaVisible();
1385         return sal_True;
1386     } else {
1387         return SdrGlueEditView::Paste(pWin,nFormat);
1388     }
1389 }
1390 
1391 ////////////////////////////////////////////////////////////////////////////////////////////////////
1392 
1393 sal_Bool SdrObjEditView::ImpIsTextEditAllSelected() const
1394 {
1395     sal_Bool bRet=sal_False;
1396     if (pTextEditOutliner!=NULL && pTextEditOutlinerView!=NULL)
1397 	{
1398 		if(SdrTextObj::HasTextImpl( pTextEditOutliner ) )
1399 		{
1400 			const sal_uInt32 nParaAnz=pTextEditOutliner->GetParagraphCount();
1401 	        Paragraph* pLastPara=pTextEditOutliner->GetParagraph( nParaAnz > 1 ? nParaAnz - 1 : 0 );
1402 
1403 			ESelection aESel(pTextEditOutlinerView->GetSelection());
1404             if (aESel.nStartPara==0 && aESel.nStartPos==0 && aESel.nEndPara==sal_uInt16(nParaAnz-1))
1405 			{
1406                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
1407 
1408 				if(aStr.Len() == aESel.nEndPos)
1409 					bRet = sal_True;
1410             }
1411             // und nun auch noch fuer den Fall, das rueckwaerts selektiert wurde
1412             if (!bRet && aESel.nEndPara==0 && aESel.nEndPos==0 && aESel.nStartPara==sal_uInt16(nParaAnz-1))
1413 			{
1414                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
1415 
1416                 if(aStr.Len() == aESel.nStartPos)
1417 					bRet = sal_True;
1418             }
1419         }
1420 		else
1421 		{
1422             bRet=sal_True;
1423         }
1424     }
1425     return bRet;
1426 }
1427 
1428 void SdrObjEditView::ImpMakeTextCursorAreaVisible()
1429 {
1430     if (pTextEditOutlinerView!=NULL && pTextEditWin!=NULL) {
1431         Cursor* pCsr=pTextEditWin->GetCursor();
1432         if (pCsr!=NULL) {
1433             Size aSiz(pCsr->GetSize());
1434             if (aSiz.Width()!=0 && aSiz.Height()!=0) { // #38450#
1435                 MakeVisible(Rectangle(pCsr->GetPos(),aSiz),*pTextEditWin);
1436             }
1437         }
1438     }
1439 }
1440 
1441 sal_uInt16 SdrObjEditView::GetScriptType() const
1442 {
1443 	sal_uInt16 nScriptType = 0;
1444 
1445     if( IsTextEdit() )
1446 	{
1447 		if( mxTextEditObj->GetOutlinerParaObject() )
1448 			nScriptType = mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
1449 
1450 		if( pTextEditOutlinerView )
1451 			nScriptType = pTextEditOutlinerView->GetSelectedScriptType();
1452 	}
1453 	else
1454 	{
1455 		sal_uInt32 nMarkCount( GetMarkedObjectCount() );
1456 
1457 		for( sal_uInt32 i = 0; i < nMarkCount; i++ )
1458 		{
1459 			OutlinerParaObject* pParaObj = GetMarkedObjectByIndex( i )->GetOutlinerParaObject();
1460 
1461 			if( pParaObj )
1462 			{
1463 				nScriptType |= pParaObj->GetTextObject().GetScriptType();
1464 			}
1465 		}
1466 	}
1467 
1468 	if( nScriptType == 0 )
1469 		nScriptType = SCRIPTTYPE_LATIN;
1470 
1471 	return nScriptType;
1472 }
1473 
1474 /* new interface src537 */
1475 sal_Bool SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
1476 {
1477 	if( mxSelectionController.is() )
1478 		if( mxSelectionController->GetAttributes( rTargetSet, bOnlyHardAttr ) )
1479 			return sal_True;
1480 
1481     if(IsTextEdit())
1482 	{
1483         DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
1484         DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
1485 
1486 		// #92389# take care of bOnlyHardAttr(!)
1487 		if(!bOnlyHardAttr && mxTextEditObj->GetStyleSheet())
1488 			rTargetSet.Put(mxTextEditObj->GetStyleSheet()->GetItemSet());
1489 
1490 		// add object attributes
1491 		rTargetSet.Put( mxTextEditObj->GetMergedItemSet() );
1492 
1493 		if( mxTextEditObj->GetOutlinerParaObject() )
1494 			rTargetSet.Put( SvxScriptTypeItem( mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType() ) );
1495 
1496 		if(pTextEditOutlinerView)
1497 		{
1498 			// FALSE= InvalidItems nicht al Default, sondern als "Loecher" betrachten
1499             rTargetSet.Put(pTextEditOutlinerView->GetAttribs(), sal_False);
1500 			rTargetSet.Put( SvxScriptTypeItem( pTextEditOutlinerView->GetSelectedScriptType() ), sal_False );
1501         }
1502 
1503 		if(GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
1504 		{
1505 			MergeNotPersistAttrFromMarked(rTargetSet, bOnlyHardAttr);
1506 		}
1507 
1508 		return sal_True;
1509 	}
1510 	else
1511 	{
1512 		return SdrGlueEditView::GetAttributes(rTargetSet, bOnlyHardAttr);
1513 	}
1514 }
1515 
1516 sal_Bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
1517 {
1518     sal_Bool bRet=sal_False;
1519     sal_Bool bTextEdit=pTextEditOutlinerView!=NULL && mxTextEditObj.is();
1520     sal_Bool bAllTextSelected=ImpIsTextEditAllSelected();
1521     SfxItemSet* pModifiedSet=NULL;
1522     const SfxItemSet* pSet=&rSet;
1523     //const SvxAdjustItem* pParaJust=NULL;
1524 
1525     if (!bTextEdit)
1526 	{
1527         // Kein TextEdit aktiv -> alle Items ans Zeichenobjekt
1528 		if( mxSelectionController.is() )
1529 			bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
1530 
1531 		if( !bRet )
1532 		{
1533 		    bRet=SdrGlueEditView::SetAttributes(*pSet,bReplaceAll);
1534 		}
1535     }
1536 	else
1537 	{
1538 #ifdef DBG_UTIL
1539         {
1540             sal_Bool bHasEEFeatureItems=sal_False;
1541             SfxItemIter aIter(rSet);
1542             const SfxPoolItem* pItem=aIter.FirstItem();
1543             while (!bHasEEFeatureItems && pItem!=NULL)
1544 			{
1545                 if (!IsInvalidItem(pItem))
1546 				{
1547                     sal_uInt16 nW=pItem->Which();
1548                     if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END)
1549 						bHasEEFeatureItems=sal_True;
1550                 }
1551 
1552                 pItem=aIter.NextItem();
1553             }
1554 
1555             if(bHasEEFeatureItems)
1556 			{
1557 				String aMessage;
1558 				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.");
1559                 InfoBox(NULL, aMessage).Execute();
1560             }
1561         }
1562 #endif
1563 
1564         sal_Bool bOnlyEEItems;
1565         sal_Bool bNoEEItems=!SearchOutlinerItems(*pSet,bReplaceAll,&bOnlyEEItems);
1566         // alles selektiert? -> Attrs auch an den Rahmen
1567         // und falls keine EEItems, dann Attrs nur an den Rahmen
1568         if (bAllTextSelected || bNoEEItems)
1569 		{
1570 			if( mxSelectionController.is() )
1571 				bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
1572 
1573 			if( !bRet )
1574 			{
1575 				const bool bUndo = IsUndoEnabled();
1576 
1577 				if( bUndo )
1578 				{
1579 					String aStr;
1580 					ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
1581 					BegUndo(aStr);
1582 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
1583 
1584 					// #i43537#
1585 					// If this is a text object also rescue the OutlinerParaObject since
1586 					// applying attributes to the object may change text layout when
1587 					// multiple portions exist with multiple formats. If a OutlinerParaObject
1588 					// really exists and needs to be rescued is evaluated in the undo
1589 					// implementation itself.
1590 					bool bRescueText = dynamic_cast< SdrTextObj* >(mxTextEditObj.get());
1591 
1592 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,!bNoEEItems || bRescueText));
1593 					EndUndo();
1594 				}
1595 
1596 				mxTextEditObj->SetMergedItemSetAndBroadcast(*pSet, bReplaceAll);
1597 
1598 				FlushComeBackTimer(); // Damit ModeHasChanged sofort kommt
1599 				bRet=sal_True;
1600 			}
1601         }
1602 		else if (!bOnlyEEItems)
1603 		{
1604 			// sonst Set ggf. splitten
1605             // Es wird nun ein ItemSet aSet gemacht, in den die EE_Items von
1606             // *pSet nicht enhalten ist (ansonsten ist es eine Kopie).
1607             sal_uInt16* pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
1608             SfxItemSet aSet(pMod->GetItemPool(),pNewWhichTable);
1609             /*90353*/ delete[] pNewWhichTable;
1610             SfxWhichIter aIter(aSet);
1611             sal_uInt16 nWhich=aIter.FirstWhich();
1612             while (nWhich!=0)
1613 			{
1614                 const SfxPoolItem* pItem;
1615                 SfxItemState eState=pSet->GetItemState(nWhich,sal_False,&pItem);
1616                 if (eState==SFX_ITEM_SET) aSet.Put(*pItem);
1617                 nWhich=aIter.NextWhich();
1618             }
1619 
1620 
1621 			if( mxSelectionController.is() )
1622 				bRet=mxSelectionController->SetAttributes(aSet,bReplaceAll );
1623 
1624 			if( !bRet )
1625 			{
1626 				if( IsUndoEnabled() )
1627 				{
1628 					String aStr;
1629 					ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
1630 					BegUndo(aStr);
1631 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
1632 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,false));
1633 					EndUndo();
1634 				}
1635 
1636 				mxTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll);
1637 
1638 				if (GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
1639 				{
1640 					SetNotPersistAttrToMarked(aSet,bReplaceAll);
1641 				}
1642 			}
1643 			FlushComeBackTimer();
1644             bRet=sal_True;
1645         }
1646         if(!bNoEEItems)
1647 		{
1648             // und nun die Attribute auch noch an die EditEngine
1649             if (bReplaceAll) {
1650                 // Am Outliner kann man leider nur alle Attribute platthauen
1651                 pTextEditOutlinerView->RemoveAttribs( sal_True );
1652             }
1653             pTextEditOutlinerView->SetAttribs(rSet);
1654 
1655 #ifdef DBG_UTIL
1656             if (pItemBrowser!=NULL)
1657 				pItemBrowser->SetDirty();
1658 #endif
1659 
1660             ImpMakeTextCursorAreaVisible();
1661         }
1662         bRet=sal_True;
1663     }
1664     if (pModifiedSet!=NULL)
1665 		delete pModifiedSet;
1666     return bRet;
1667 }
1668 
1669 SfxStyleSheet* SdrObjEditView::GetStyleSheet() const
1670 {
1671 	SfxStyleSheet* pSheet = 0;
1672 
1673 	if( mxSelectionController.is() )
1674 	{
1675 		if( mxSelectionController->GetStyleSheet( pSheet ) )
1676 			return pSheet;
1677 	}
1678 
1679     if ( pTextEditOutlinerView )
1680 	{
1681 		pSheet = pTextEditOutlinerView->GetStyleSheet();
1682     }
1683 	else
1684 	{
1685 		pSheet = SdrGlueEditView::GetStyleSheet();
1686     }
1687 	return pSheet;
1688 }
1689 
1690 sal_Bool SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1691 {
1692 	if( mxSelectionController.is() )
1693 	{
1694 		if( mxSelectionController->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr ) )
1695 			return sal_True;
1696 	}
1697 
1698 	// if we are currently in edit mode we must also set the stylesheet
1699 	// on all paragraphs in the Outliner for the edit view
1700 	// #92191#
1701 	if( NULL != pTextEditOutlinerView )
1702 	{
1703 		Outliner* pOutliner = pTextEditOutlinerView->GetOutliner();
1704 
1705 		const sal_uIntPtr nParaCount = pOutliner->GetParagraphCount();
1706 		sal_uIntPtr nPara;
1707 		for( nPara = 0; nPara < nParaCount; nPara++ )
1708 		{
1709 			pOutliner->SetStyleSheet( nPara, pStyleSheet );
1710 		}
1711 	}
1712 
1713 	return SdrGlueEditView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1714 }
1715 
1716 ////////////////////////////////////////////////////////////////////////////////////////////////////
1717 
1718 void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin)
1719 {
1720     SdrGlueEditView::AddWindowToPaintView(pNewWin);
1721 
1722 	if(mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType()==OUTDEV_WINDOW)
1723 	{
1724         OutlinerView* pOutlView=ImpMakeOutlinerView((Window*)pNewWin,sal_False,NULL);
1725         pTextEditOutliner->InsertView(pOutlView);
1726     }
1727 }
1728 
1729 void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
1730 {
1731     SdrGlueEditView::DeleteWindowFromPaintView(pOldWin);
1732 
1733 	if(mxTextEditObj.is() && !bTextEditOnlyOneView && pOldWin->GetOutDevType()==OUTDEV_WINDOW)
1734 	{
1735         for (sal_uIntPtr i=pTextEditOutliner->GetViewCount(); i>0;) {
1736             i--;
1737             OutlinerView* pOLV=pTextEditOutliner->GetView(i);
1738             if (pOLV && pOLV->GetWindow()==(Window*)pOldWin) {
1739                 delete pTextEditOutliner->RemoveView(i);
1740             }
1741         }
1742     }
1743 }
1744 
1745 sal_Bool SdrObjEditView::IsTextEditInSelectionMode() const
1746 {
1747     return pTextEditOutliner!=NULL && pTextEditOutliner->IsInSelectionMode();
1748 }
1749 
1750 ////////////////////////////////////////////////////////////////////////////////////////////////////
1751 //
1752 //  @@   @@  @@@@   @@@@  @@@@@   @@@@   @@   @@  @@@@  @@@@@  @@@@@
1753 //  @@@ @@@ @@  @@ @@  @@ @@  @@ @@  @@  @@@ @@@ @@  @@ @@  @@ @@
1754 //  @@@@@@@ @@  @@ @@     @@  @@ @@  @@  @@@@@@@ @@  @@ @@  @@ @@
1755 //  @@@@@@@ @@@@@@ @@     @@@@@  @@  @@  @@@@@@@ @@  @@ @@  @@ @@@@
1756 //  @@ @ @@ @@  @@ @@     @@  @@ @@  @@  @@ @ @@ @@  @@ @@  @@ @@
1757 //  @@   @@ @@  @@ @@  @@ @@  @@ @@  @@  @@   @@ @@  @@ @@  @@ @@
1758 //  @@   @@ @@  @@  @@@@  @@  @@  @@@@   @@   @@  @@@@  @@@@@  @@@@@
1759 //
1760 ////////////////////////////////////////////////////////////////////////////////////////////////////
1761 
1762 sal_Bool SdrObjEditView::BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, Window* pWin)
1763 {
1764     sal_Bool bRet=sal_False;
1765     BrkMacroObj();
1766     if (pObj!=NULL && pPV!=NULL && pWin!=NULL && pObj->HasMacro()) {
1767         nTol=ImpGetHitTolLogic(nTol,NULL);
1768         pMacroObj=pObj;
1769         pMacroPV=pPV;
1770         pMacroWin=pWin;
1771         bMacroDown=sal_False;
1772         nMacroTol=sal_uInt16(nTol);
1773         aMacroDownPos=rPnt;
1774         MovMacroObj(rPnt);
1775     }
1776     return bRet;
1777 }
1778 
1779 void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
1780 {
1781     if (pMacroObj!=NULL && bMacroDown)
1782     {
1783         SdrObjMacroHitRec aHitRec;
1784         aHitRec.aPos=rUpPos;
1785         aHitRec.aDownPos=aMacroDownPos;
1786         aHitRec.nTol=nMacroTol;
1787         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1788         aHitRec.pPageView=pMacroPV;
1789         aHitRec.pOut=pMacroWin;
1790         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
1791         bMacroDown=sal_False;
1792     }
1793 }
1794 
1795 void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
1796 {
1797     if (pMacroObj!=NULL && !bMacroDown)
1798     {
1799         SdrObjMacroHitRec aHitRec;
1800         aHitRec.aPos=rDownPos;
1801         aHitRec.aDownPos=aMacroDownPos;
1802         aHitRec.nTol=nMacroTol;
1803         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1804         aHitRec.pPageView=pMacroPV;
1805         aHitRec.bDown=sal_True;
1806         aHitRec.pOut=pMacroWin;
1807         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
1808         bMacroDown=sal_True;
1809     }
1810 }
1811 
1812 void SdrObjEditView::MovMacroObj(const Point& rPnt)
1813 {
1814     if (pMacroObj!=NULL) {
1815         SdrObjMacroHitRec aHitRec;
1816         aHitRec.aPos=rPnt;
1817         aHitRec.aDownPos=aMacroDownPos;
1818         aHitRec.nTol=nMacroTol;
1819         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1820         aHitRec.pPageView=pMacroPV;
1821         aHitRec.bDown=bMacroDown;
1822         aHitRec.pOut=pMacroWin;
1823         sal_Bool bDown=pMacroObj->IsMacroHit(aHitRec);
1824         if (bDown) ImpMacroDown(rPnt);
1825         else ImpMacroUp(rPnt);
1826     }
1827 }
1828 
1829 void SdrObjEditView::BrkMacroObj()
1830 {
1831     if (pMacroObj!=NULL) {
1832         ImpMacroUp(aMacroDownPos);
1833         pMacroObj=NULL;
1834         pMacroPV=NULL;
1835         pMacroWin=NULL;
1836     }
1837 }
1838 
1839 sal_Bool SdrObjEditView::EndMacroObj()
1840 {
1841     if (pMacroObj!=NULL && bMacroDown) {
1842         ImpMacroUp(aMacroDownPos);
1843         SdrObjMacroHitRec aHitRec;
1844         aHitRec.aPos=aMacroDownPos;
1845         aHitRec.aDownPos=aMacroDownPos;
1846         aHitRec.nTol=nMacroTol;
1847         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1848         aHitRec.pPageView=pMacroPV;
1849         aHitRec.bDown=sal_True;
1850         aHitRec.pOut=pMacroWin;
1851         bool bRet=pMacroObj->DoMacro(aHitRec);
1852         pMacroObj=NULL;
1853         pMacroPV=NULL;
1854         pMacroWin=NULL;
1855         return bRet;
1856     } else {
1857         BrkMacroObj();
1858         return sal_False;
1859     }
1860 }
1861 
1862 /** fills the given any with a XTextCursor for the current text selection.
1863 	Leaves the any untouched if there currently is no text selected */
1864 void SdrObjEditView::getTextSelection( ::com::sun::star::uno::Any& rSelection )
1865 {
1866 	if( IsTextEdit() )
1867 	{
1868 		OutlinerView* pOutlinerView = GetTextEditOutlinerView();
1869 		if( pOutlinerView && pOutlinerView->HasSelection() )
1870 		{
1871 			SdrObject* pObj = GetTextEditObject();
1872 
1873 			if( pObj )
1874 			{
1875 				::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xText( pObj->getUnoShape(), ::com::sun::star::uno::UNO_QUERY );
1876 				if( xText.is() )
1877 				{
1878 					SvxUnoTextBase* pRange = SvxUnoTextBase::getImplementation( xText );
1879 					if( pRange )
1880 					{
1881 						rSelection <<= pRange->createTextCursorBySelection( pOutlinerView->GetSelection() );
1882 					}
1883 				}
1884 			}
1885 		}
1886 	}
1887 }
1888 
1889 namespace sdr { namespace table {
1890 extern rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
1891 } }
1892 
1893 /* check if we have a single selection and that single object likes
1894 	to handle the mouse and keyboard events itself
1895 
1896 	@todo: the selection controller should be queried from the
1897 	object specific view contact. Currently this method only
1898 	works for tables.
1899 */
1900 void SdrObjEditView::MarkListHasChanged()
1901 {
1902 	SdrGlueEditView::MarkListHasChanged();
1903 
1904 	if( mxSelectionController.is() )
1905 	{
1906 		mxLastSelectionController = mxSelectionController;
1907 		mxSelectionController->onSelectionHasChanged();
1908 	}
1909 
1910 	mxSelectionController.clear();
1911 
1912 	const SdrMarkList& rMarkList=GetMarkedObjectList();
1913 	if( rMarkList.GetMarkCount() == 1 )
1914 	{
1915 		const SdrObject* pObj= rMarkList.GetMark(0)->GetMarkedSdrObj();
1916 		// check for table
1917 		if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
1918 		{
1919 			mxSelectionController = sdr::table::CreateTableController( this, pObj, mxLastSelectionController );
1920 			if( mxSelectionController.is() )
1921 			{
1922 				mxLastSelectionController.clear();
1923 				mxSelectionController->onSelectionHasChanged();
1924 			}
1925 		}
1926 	}
1927 }
1928 
1929 IMPL_LINK( SdrObjEditView, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos )
1930 {
1931     OnEndPasteOrDrop( pInfos );
1932     return 0;
1933 }
1934 
1935 IMPL_LINK( SdrObjEditView, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos )
1936 {
1937     OnBeginPasteOrDrop( pInfos );
1938     return 0;
1939 }
1940 
1941 void SdrObjEditView::OnBeginPasteOrDrop( PasteOrDropInfos* )
1942 {
1943     // applications can derive from these virtual methods to do something before a drop or paste operation
1944 }
1945 
1946 void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* )
1947 {
1948     // applications can derive from these virtual methods to do something before a drop or paste operation
1949 }
1950 
1951 bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
1952 {
1953     if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor )
1954         return false;
1955     switch(nObjectIdentifier)
1956     {
1957         case OBJ_NONE:
1958         case OBJ_GRUP:
1959             return false;
1960         case OBJ_LINE:
1961         case OBJ_RECT:
1962         case OBJ_CIRC:
1963         case OBJ_SECT:
1964         case OBJ_CARC:
1965         case OBJ_CCUT:
1966         case OBJ_POLY:
1967         case OBJ_PLIN:
1968         case OBJ_PATHLINE:
1969         case OBJ_PATHFILL:
1970         case OBJ_FREELINE:
1971         case OBJ_FREEFILL:
1972         case OBJ_SPLNLINE:
1973         case OBJ_SPLNFILL:
1974         case OBJ_TEXT:
1975         case OBJ_TEXTEXT:
1976         case OBJ_TITLETEXT:
1977         case OBJ_OUTLINETEXT:
1978         case OBJ_GRAF:
1979         case OBJ_OLE2:
1980 		case OBJ_TABLE:
1981             return true;
1982         case OBJ_EDGE:
1983         case OBJ_CAPTION:
1984             return false;
1985         case OBJ_PATHPOLY:
1986         case OBJ_PATHPLIN:
1987             return true;
1988         case OBJ_PAGE:
1989         case OBJ_MEASURE:
1990         case OBJ_DUMMY:
1991         case OBJ_FRAME:
1992         case OBJ_UNO:
1993             return false;
1994         case OBJ_CUSTOMSHAPE:
1995             return true;
1996         default:
1997             return false;
1998     }
1999 }
2000 
2001 static const sal_uInt16* GetFormatRangeImpl( bool bTextOnly )
2002 {
2003     static const sal_uInt16 gRanges[] = {
2004         SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
2005         SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
2006         SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
2007         XATTR_LINE_FIRST, XATTR_LINE_LAST,
2008         XATTR_FILL_FIRST, XATTRSET_FILL,
2009         EE_PARA_START, EE_PARA_END,
2010         EE_CHAR_START, EE_CHAR_END,
2011         0,0
2012     };
2013     return &gRanges[ bTextOnly ? 10 : 0];
2014 }
2015 
2016 bool SdrObjEditView::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  )
2017 {
2018     if( mxSelectionController.is() && mxSelectionController->TakeFormatPaintBrush(rFormatSet) )
2019         return true;
2020 
2021 	const SdrMarkList& rMarkList = GetMarkedObjectList();
2022 	if( rMarkList.GetMarkCount() >= 1 )
2023 	{
2024 	    OutlinerView* pOLV = GetTextEditOutlinerView();
2025 
2026 	    rFormatSet.reset( new SfxItemSet( GetModel()->GetItemPool(), GetFormatRangeImpl( pOLV != NULL ) ) );
2027 	    if( pOLV )
2028 	    {
2029             rFormatSet->Put( pOLV->GetAttribs() );
2030 	    }
2031 	    else
2032 	    {
2033 		    const sal_Bool bOnlyHardAttr = sal_False;
2034 		    rFormatSet->Put( GetAttrFromMarked(bOnlyHardAttr) );
2035 		}
2036 		return true;
2037 	}
2038 
2039     return false;
2040 }
2041 
2042 static SfxItemSet CreatePaintSet( const sal_uInt16 *pRanges, SfxItemPool& rPool, const SfxItemSet& rSourceSet, const SfxItemSet& rTargetSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
2043 {
2044 	SfxItemSet aPaintSet( rPool, pRanges );
2045 
2046 	while( *pRanges )
2047 	{
2048 		sal_uInt16 nWhich = *pRanges++;
2049 		const sal_uInt16 nLastWhich = *pRanges++;
2050 
2051 		if( bNoCharacterFormats && (nWhich == EE_CHAR_START) )
2052 			continue;
2053 
2054 		if( bNoParagraphFormats && (nWhich == EE_PARA_START ) )
2055 			continue;
2056 
2057 		for( ; nWhich < nLastWhich; nWhich++ )
2058 		{
2059 			const SfxPoolItem* pSourceItem = rSourceSet.GetItem( nWhich );
2060 			const SfxPoolItem* pTargetItem = rTargetSet.GetItem( nWhich );
2061 
2062 			if( (pSourceItem && !pTargetItem) || (pSourceItem && pTargetItem && !((*pSourceItem) == (*pTargetItem)) ) )
2063 			{
2064 				aPaintSet.Put( *pSourceItem );
2065 			}
2066 		}
2067 	}
2068 	return aPaintSet;
2069 }
2070 
2071 void SdrObjEditView::ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats )
2072 {
2073     OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
2074     if(pParaObj)
2075     {
2076 	    SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
2077 	    rOutliner.SetText(*pParaObj);
2078 
2079 	    sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
2080 
2081 	    if(nParaCount)
2082 	    {
2083 		    for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
2084 		    {
2085 			    if( !bNoCharacterFormats )
2086 				    rOutliner.QuickRemoveCharAttribs( nPara, /* remove all */0 );
2087 
2088 			    SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
2089 			    aSet.Put(CreatePaintSet( GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
2090 			    rOutliner.SetParaAttribs(nPara, aSet);
2091 		    }
2092 
2093 		    OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
2094 		    rOutliner.Clear();
2095 
2096 		    rTextObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
2097 	    }
2098     }
2099 }
2100 
2101 void SdrObjEditView::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
2102 {
2103     if( !mxSelectionController.is() || !mxSelectionController->ApplyFormatPaintBrush( rFormatSet, bNoCharacterFormats, bNoParagraphFormats ) )
2104     {
2105         const SdrMarkList& rMarkList = GetMarkedObjectList();
2106         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
2107 	    OutlinerView* pOLV = GetTextEditOutlinerView();
2108 
2109         const SfxItemSet& rShapeSet = pObj->GetMergedItemSet();
2110 
2111 	    if( !pOLV )
2112 	    {
2113 		    // if not in text edit mode (aka the user selected text or clicked on a word)
2114 		    // apply formating attributes to selected shape
2115 		    // All formating items (see ranges above) that are unequal in selected shape and
2116 		    // the format paintbrush are hard set on the selected shape.
2117 
2118             const sal_uInt16* pRanges = rFormatSet.GetRanges();
2119             bool bTextOnly = true;
2120 
2121             while( *pRanges )
2122             {
2123                 if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) )
2124                 {
2125                     bTextOnly = false;
2126                     break;
2127                 }
2128                 pRanges += 2;
2129             }
2130 
2131 		    if( !bTextOnly )
2132 		    {
2133 			    SfxItemSet aPaintSet( CreatePaintSet( GetFormatRangeImpl(false), *rShapeSet.GetPool(), rFormatSet, rShapeSet, bNoCharacterFormats, bNoParagraphFormats ) );
2134 			    const sal_Bool bReplaceAll = sal_False;
2135 			    SetAttrToMarked(aPaintSet, bReplaceAll);
2136 		    }
2137 
2138 		    // now apply character and paragraph formating to text, if the shape has any
2139 		    SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
2140 		    if( pTextObj )
2141 		    {
2142 			    sal_Int32 nText = pTextObj->getTextCount();
2143 
2144 			    while( --nText >= 0 )
2145 			    {
2146                     SdrText* pText = pTextObj->getText( nText );
2147                     ApplyFormatPaintBrushToText( rFormatSet, *pTextObj, pText, bNoCharacterFormats, bNoParagraphFormats );
2148 			    }
2149 		    }
2150 	    }
2151 	    else
2152 	    {
2153 		    ::Outliner* pOutliner = pOLV->GetOutliner();
2154 		    if( pOutliner )
2155 		    {
2156 			    const EditEngine& rEditEngine = pOutliner->GetEditEngine();
2157 
2158 			    ESelection aSel( pOLV->GetSelection() );
2159 			    if( !aSel.HasRange() )
2160 				    pOLV->SetSelection( rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD ) );
2161 
2162 			    const sal_Bool bRemoveParaAttribs = !bNoParagraphFormats;
2163 			    pOLV->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
2164 			    SfxItemSet aSet( pOLV->GetAttribs() );
2165 			    SfxItemSet aPaintSet( CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
2166 			    pOLV->SetAttribs( aPaintSet );
2167 		    }
2168 	    }
2169     }
2170 }
2171