xref: /aoo41x/main/sd/source/ui/view/sdview.cxx (revision 5b190011)
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_sd.hxx"
26 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
27 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
28 
29 #include "View.hxx"
30 #include <editeng/unolingu.hxx>
31 #include <sfx2/request.hxx>
32 #include <svx/obj3d.hxx>
33 #include <svx/fmview.hxx>
34 #include <editeng/outliner.hxx>
35 #ifndef _SVX_SVXIDS_HRC
36 #include <svx/svxids.hrc>
37 #endif
38 #include <svx/svdograf.hxx>
39 #include <svx/svdoole2.hxx>
40 #include <svx/svdundo.hxx>
41 #include <vcl/msgbox.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <sfx2/app.hxx>
44 #include <svx/svdpagv.hxx>
45 #include <sfx2/docfile.hxx>
46 #include <svx/svdoutl.hxx>
47 #include <svx/sdr/contact/displayinfo.hxx>
48 
49 #include <svx/svdetc.hxx>
50 #include <editeng/editstat.hxx>
51 
52 #include <svx/dialogs.hrc>
53 #include <sfx2/viewfrm.hxx>
54 #include <svx/svdopage.hxx>
55 #include <toolkit/helper/vclunohelper.hxx>
56 #include <svx/xlndsit.hxx>
57 #include <svx/xlineit0.hxx>
58 #include <svx/xlnclit.hxx>
59 #include <vcl/virdev.hxx>
60 
61 #include "app.hrc"
62 #include "strings.hrc"
63 #include "Window.hxx"
64 #include "Client.hxx"
65 #include "drawdoc.hxx"
66 #include "DrawDocShell.hxx"
67 #include "app.hxx"
68 #include "sdpage.hxx"
69 #include "glob.hrc"
70 #include "sdresid.hxx"
71 #include "DrawViewShell.hxx"
72 #include "futext.hxx"
73 #include "fuinsfil.hxx"
74 #include "slideshow.hxx"
75 #include "stlpool.hxx"
76 #include "FrameView.hxx"
77 #include "ViewClipboard.hxx"
78 #include "undo/undomanager.hxx"
79 #include <svx/sdr/contact/viewobjectcontact.hxx>
80 #include <svx/sdr/contact/viewcontact.hxx>
81 #include <svx/sdr/contact/displayinfo.hxx>
82 #include "EventMultiplexer.hxx"
83 #include "ViewShellBase.hxx"
84 #include "ViewShellManager.hxx"
85 
86 #include <basegfx/polygon/b2dpolygontools.hxx>
87 #include <basegfx/color/bcolor.hxx>
88 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
89 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
90 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
91 #include <svx/sdr/contact/objectcontact.hxx>
92 #include <basegfx/matrix/b2dhommatrix.hxx>
93 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
94 #include <svx/unoapi.hxx>
95 #include <basegfx/matrix/b2dhommatrixtools.hxx>
96 
97 #include <numeric>
98 
99 using namespace com::sun::star;
100 using namespace com::sun::star::uno;
101 namespace sd {
102 
103 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
104 #define SO2_DECL_SVINPLACEOBJECT_DEFINED
105 SO2_DECL_REF(SvInPlaceObject)
106 #endif
107 
108 TYPEINIT1(View, FmFormView);
109 
110 /*************************************************************************
111 |*
112 |* Ctor
113 |*
114 \************************************************************************/
115 
116 View::View(SdDrawDocument* pDrawDoc, OutputDevice* pOutDev,
117 			   ViewShell* pViewShell)
118   : FmFormView(pDrawDoc, pOutDev),
119 	mpDoc(pDrawDoc),
120 	mpDocSh( pDrawDoc->GetDocSh() ),
121 	mpViewSh(pViewShell),
122 	mpDragSrcMarkList(NULL),
123 	mpDropMarkerObj(NULL),
124 	mpDropMarker(NULL),
125 	mnDragSrcPgNum(SDRPAGE_NOTFOUND),
126 	mnAction(DND_ACTION_NONE),
127 	mnLockRedrawSmph(0),
128 	mpLockedRedraws(NULL),
129 	mbIsDropAllowed(sal_True),
130 	maSmartTags(*this),
131     mpClipboard (new ViewClipboard (*this))
132 {
133 	// #i73602# Use default from the configuration
134 	SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress());
135 
136 	// #i74769#, #i75172# Use default from the configuration
137 	SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress());
138 
139 	EnableExtendedKeyInputDispatcher(sal_False);
140 	EnableExtendedMouseEventDispatcher(sal_False);
141 	EnableExtendedCommandEventDispatcher(sal_False);
142 
143 	SetUseIncompatiblePathCreateInterface(sal_False);
144 	SetMarkHdlWhenTextEdit(sal_True);
145 	EnableTextEditOnObjectsWithoutTextIfTextTool(sal_True);
146 
147 	SetMinMoveDistancePixel(2);
148 	SetHitTolerancePixel(2);
149 	SetMeasureLayer(String(SdResId(STR_LAYER_MEASURELINES)));
150 
151 	// Timer fuer verzoegertes Drop (muss fuer MAC sein)
152 	maDropErrorTimer.SetTimeoutHdl( LINK(this, View, DropErrorHdl) );
153 	maDropErrorTimer.SetTimeout(50);
154 	maDropInsertFileTimer.SetTimeoutHdl( LINK(this, View, DropInsertFileHdl) );
155 	maDropInsertFileTimer.SetTimeout(50);
156 }
157 
158 void View::ImplClearDrawDropMarker()
159 {
160 	if(mpDropMarker)
161 	{
162 		delete mpDropMarker;
163 		mpDropMarker = 0L;
164 	}
165 }
166 
167 /*************************************************************************
168 |*
169 |* Dtor
170 |*
171 \************************************************************************/
172 
173 View::~View()
174 {
175 	maSmartTags.Dispose();
176 
177 	// release content of selection clipboard, if we own the content
178     UpdateSelectionClipboard( sal_True );
179 
180 	maDropErrorTimer.Stop();
181 	maDropInsertFileTimer.Stop();
182 
183 	ImplClearDrawDropMarker();
184 
185 	while(PaintWindowCount())
186 	{
187 		// Alle angemeldeten OutDevs entfernen
188 		DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/);
189 	}
190 
191 	// gespeicherte Redraws loeschen
192 	if (mpLockedRedraws)
193 	{
194 		SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
195 		while (pRec)
196 		{
197 			delete pRec;
198 			pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
199 		}
200 		delete mpLockedRedraws;
201 	}
202 }
203 
204 
205 class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
206 {
207 public:
208 	ViewRedirector();
209 	virtual ~ViewRedirector();
210 
211 	// all default implementations just call the same methods at the original. To do something
212 	// different, overload the method and at least do what the method does.
213 	virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
214 		const sdr::contact::ViewObjectContact& rOriginal,
215 		const sdr::contact::DisplayInfo& rDisplayInfo);
216 };
217 
218 ViewRedirector::ViewRedirector()
219 {
220 }
221 
222 ViewRedirector::~ViewRedirector()
223 {
224 }
225 
226 drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
227 	const sdr::contact::ViewObjectContact& rOriginal,
228 	const sdr::contact::DisplayInfo& rDisplayInfo)
229 {
230 	SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
231 	drawinglayer::primitive2d::Primitive2DSequence xRetval;
232 
233 	if(pObject && pObject->GetPage())
234 	{
235 		const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true ));
236 
237 		if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) )
238 			return xRetval;
239 
240 		PresObjKind eKind(PRESOBJ_NONE);
241 		const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
242 		const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage());
243 		const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter());
244 		const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
245         const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
246 		const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage());
247 		const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);
248 
249 		// check if we need to draw a placeholder border. Never do it for
250 		// objects inside a SdrPageObj and never when printing
251 		if(!bIsInsidePageObj && !bIsPrinting)
252 		{
253 			bool bCreateOutline(false);
254 
255 			if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) )
256 			{
257 				if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() )
258 				{
259 					eKind = pObjectsSdPage ? pObjectsSdPage->GetPresObjKind(pObject) : PRESOBJ_NONE;
260 					bCreateOutline = true;
261 				}
262 			}
263 			else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_TEXT ) )
264 			{
265 				if( pObjectsSdPage )
266 				{
267 					eKind = pObjectsSdPage->GetPresObjKind(pObject);
268 
269 					if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) )
270 					{
271 						if( !bSubContentProcessing )
272 						{
273 							// only draw a boundary for header&footer objects on the masterpage itself
274 							bCreateOutline = true;
275 						}
276 					}
277 				}
278 			}
279 			else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE ) )
280 			{
281 				// only for handout page, else this frame will be created for each
282 				// page preview object in SlideSorter and PagePane
283 				if(pObjectsSdPage && PK_HANDOUT == pObjectsSdPage->GetPageKind())
284 				{
285 					bCreateOutline = true;
286 				}
287 			}
288 
289 			if(bCreateOutline)
290 			{
291 				// empty presentation objects get a gray frame
292 				const svtools::ColorConfig aColorConfig;
293 				const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) );
294 
295 				if( aColor.bIsVisible )
296 				{
297 					// get basic object transformation
298 					const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor());
299 					basegfx::B2DHomMatrix aObjectMatrix;
300 					basegfx::B2DPolyPolygon aObjectPolyPolygon;
301 					pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
302 
303 					// create dashed border
304 					{
305 						// create object polygon
306 						basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
307 						aPolygon.transform(aObjectMatrix);
308 
309 						// create line and stroke attribute
310 						::std::vector< double > aDotDashArray;
311 
312 						aDotDashArray.push_back(160.0);
313 						aDotDashArray.push_back(80.0);
314 
315 						const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0));
316 						const drawinglayer::attribute::LineAttribute aLine(aRGBColor);
317 						const drawinglayer::attribute::StrokeAttribute aStroke(aDotDashArray, fFullDotDashLen);
318 
319 						// create primitive and add
320 						const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
321 							aPolygon,
322 							aLine,
323 							aStroke));
324 						drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
325 					}
326 
327 					// now paint the placeholder description, but only when masterpage
328 					// is displayed as page directly (MasterPage view)
329 					if(!bSubContentProcessing && bIsMasterPageObject)
330 					{
331 						String aObjectString;
332 
333 						switch( eKind )
334 						{
335 							case PRESOBJ_TITLE:
336 							{
337 								if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
338 								{
339 									static String aTitleAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_TITLE ) );
340 									aObjectString = aTitleAreaStr;
341 								}
342 
343 								break;
344 							}
345 							case PRESOBJ_OUTLINE:
346 							{
347 								static String aOutlineAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_OUTLINE ) );
348 								aObjectString = aOutlineAreaStr;
349 								break;
350 							}
351 							case PRESOBJ_FOOTER:
352 							{
353 								static String aFooterAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_FOOTER ) );
354 								aObjectString = aFooterAreaStr;
355 								break;
356 							}
357 							case PRESOBJ_HEADER:
358 							{
359 								static String aHeaderAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_HEADER ) );
360 								aObjectString = aHeaderAreaStr;
361 								break;
362 							}
363 							case PRESOBJ_DATETIME:
364 							{
365 								static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_DATETIME ) );
366 								aObjectString = aDateTimeStr;
367 								break;
368 							}
369 							case PRESOBJ_NOTES:
370 							{
371 								static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NOTES ) );
372 								aObjectString = aDateTimeStr;
373 								break;
374 							}
375 							case PRESOBJ_SLIDENUMBER:
376 							{
377 								if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD)
378 								{
379 									static String aSlideAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_SLIDE ) );
380 									aObjectString = aSlideAreaStr;
381 								}
382 								else
383 								{
384 									static String aNumberAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NUMBER ) );
385 									aObjectString = aNumberAreaStr;
386 								}
387 								break;
388 							}
389 							default:
390 							{
391 								break;
392 							}
393 						}
394 
395 						if( aObjectString.Len() )
396 						{
397 							// decompose object matrix to be able to place text correctly
398 							basegfx::B2DTuple aScale;
399 							basegfx::B2DTuple aTranslate;
400 							double fRotate, fShearX;
401 							aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
402 
403 							// create font
404 							SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject );
405 							const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER);
406 							Font aScaledVclFont;
407 
408 							// use a text size factor to get more reliable text sizes from the text layouter
409 							// (and from vcl), tipp from HDU
410 							static sal_uInt32 nTextSizeFactor(100);
411 
412 							// use a factor to get more linear text size calculations
413 							aScaledVclFont.SetHeight( 500 * nTextSizeFactor );
414 
415 							// get basic geometry and get text size
416 							drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
417 							aTextLayouter.setFont(aScaledVclFont);
418 							const xub_StrLen nTextLength(aObjectString.Len());
419 
420 							// do not forget to use the factor again to get the width for the 500
421 							const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor));
422 							const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor));
423 
424 							// calculate text primitive position. If text is at bottom, use top for
425 							// the extra text and vice versa
426 							const double fHorDist(125);
427 							const double fVerDist(125);
428 							const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist);
429 							const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA)
430 								? aTranslate.getY() - fVerDist + fTextHeight
431 								: (aTranslate.getY() + aScale.getY()) - fVerDist);
432 
433 							// get font attributes; use normally scaled font
434 							const basegfx::BColor aFontColor(aRGBColor);
435 							Font aVclFont;
436 							basegfx::B2DVector aTextSizeAttribute;
437 
438 							aVclFont.SetHeight( 500 );
439 
440 							const drawinglayer::attribute::FontAttribute aFontAttribute(
441                                 drawinglayer::primitive2d::getFontAttributeFromVclFont(
442 								    aTextSizeAttribute,
443 								    aVclFont,
444 								    false,
445 								    false));
446 
447 							// fill text matrix
448 							const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
449 								aTextSizeAttribute.getX(), aTextSizeAttribute.getY(),
450 								fShearX,
451                                 fRotate,
452                                 fPosX, fPosY));
453 
454 							// create DXTextArray (can be empty one)
455 							const ::std::vector< double > aDXArray;
456 
457 							// create locale; this may need some more information in the future
458 							const ::com::sun::star::lang::Locale aLocale;
459 
460 							// create primitive and add
461 							const drawinglayer::primitive2d::Primitive2DReference xRef(
462                                 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
463 								    aTextMatrix,
464 								    aObjectString,
465 								    0,
466 								    nTextLength,
467 								    aDXArray,
468 								    aFontAttribute,
469 								    aLocale,
470 								    aFontColor));
471 							drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef);
472 						}
473 					}
474 				}
475 			}
476 		}
477 
478 		if(bDoCreateGeometry)
479 		{
480 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
481 				xRetval,
482 				sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
483 					rOriginal,
484 					rDisplayInfo));
485 		}
486 	}
487 	else
488 	{
489 		// not a SdrObject visualisation (maybe e.g. page) or no page
490 		xRetval = sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
491 	}
492 
493 	return xRetval;
494 }
495 
496 /*************************************************************************
497 |*
498 |* Paint-Methode: das Ereignis wird an die View weitergeleitet
499 |*
500 \************************************************************************/
501 
502 void View::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
503 {
504 	// ausfuehren ??
505 	if (mnLockRedrawSmph == 0)
506 	{
507 		SdrPageView* pPgView = GetSdrPageView();
508 
509 		if (pPgView)
510 		{
511 			SdPage* pPage = (SdPage*) pPgView->GetPage();
512 			if( pPage )
513 			{
514 				SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
515                 bool bScreenDisplay(true);
516 
517                 if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType())
518                 {
519                     // #i75566# printing; suppress AutoColor BackgroundColor generation
520                     // for visibility reasons by giving GetPageBackgroundColor()
521                     // the needed hint
522                     bScreenDisplay = false;
523                 }
524 
525                 if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter())
526                 {
527                     // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
528                     bScreenDisplay = false;
529                 }
530 
531                 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
532                 // hint value if screen display. Only then the AutoColor mechanisms shall be applied
533 				rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) );
534 			}
535 		}
536 
537 		ViewRedirector aViewRedirector;
538 		FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector);
539 	}
540 	// oder speichern?
541 	else
542 	{
543 		if (!mpLockedRedraws)
544 			mpLockedRedraws = new List;
545 
546 		SdViewRedrawRec* pRec = new SdViewRedrawRec;
547 		pRec->mpOut	= pOutDev;
548 		pRec->aRect = rReg.GetBoundRect();
549 		mpLockedRedraws->Insert(pRec, LIST_APPEND);
550 	}
551 }
552 
553 
554 /*************************************************************************
555 |*
556 |* Selektion hat sich geaendert
557 |*
558 \************************************************************************/
559 
560 void View::MarkListHasChanged()
561 {
562 	FmFormView::MarkListHasChanged();
563 
564 	if( GetMarkedObjectCount() > 0 )
565 		maSmartTags.deselect();
566 }
567 
568 
569 /*************************************************************************
570 |*
571 |* Attribute setzen
572 |*
573 \************************************************************************/
574 
575 sal_Bool View::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
576 {
577 	sal_Bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll);
578 	return (bOk);
579 }
580 
581 
582 /*************************************************************************
583 |*
584 |* Attribute holen
585 |*
586 \************************************************************************/
587 
588 sal_Bool View::GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr ) const
589 {
590 	return( FmFormView::GetAttributes( rTargetSet, bOnlyHardAttr ) );
591 }
592 
593 
594 /*************************************************************************
595 |*
596 |* Ist ein Praesentationsobjekt selektiert?
597 |*
598 \************************************************************************/
599 
600 sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool bOnMasterPage, sal_Bool bCheckPresObjListOnly, sal_Bool bCheckLayoutOnly) const
601 {
602 	/**************************************************************************
603 	* Ist ein Presentationsobjekt selektiert?
604 	**************************************************************************/
605 	SdrMarkList* pMarkList;
606 
607 	if (mnDragSrcPgNum != SDRPAGE_NOTFOUND &&
608 		mnDragSrcPgNum != GetSdrPageView()->GetPage()->GetPageNum())
609 	{
610 		// Es laeuft gerade Drag&Drop
611 		// Source- und Destination-Page unterschiedlich:
612 		// es wird die gemerkte MarkList verwendet
613 		pMarkList = mpDragSrcMarkList;
614 	}
615 	else
616 	{
617 		// Es wird die aktuelle MarkList verwendet
618 		pMarkList = new SdrMarkList(GetMarkedObjectList());
619 	}
620 
621 	SdrMark* pMark;
622 	SdPage* pPage;
623 	SdrObject* pObj;
624 
625 	sal_Bool bSelected = sal_False;
626 	sal_Bool bMasterPage = sal_False;
627 	long nMark;
628 	long nMarkMax = long(pMarkList->GetMarkCount()) - 1;
629 
630 	for (nMark = nMarkMax; (nMark >= 0) && !bSelected; nMark--)
631 	{
632 		// Rueckwaerts durch die Marklist
633 		pMark = pMarkList->GetMark(nMark);
634 		pObj = pMark->GetMarkedSdrObj();
635 
636 		if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) )
637 		{
638 			pPage = (SdPage*) pObj->GetPage();
639 			bMasterPage = pPage->IsMasterPage();
640 
641 			if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
642 			{
643 				if ( pPage && pPage->IsPresObj(pObj) )
644 				{
645 					if( bCheckLayoutOnly )
646 					{
647 						PresObjKind eKind = pPage->GetPresObjKind(pObj);
648 
649 						if((eKind != PRESOBJ_FOOTER) && (eKind != PRESOBJ_HEADER) && (eKind != PRESOBJ_DATETIME) && (eKind != PRESOBJ_SLIDENUMBER) )
650 							bSelected = sal_True;
651 					}
652 					else
653 					{
654 						bSelected = sal_True;
655 					}
656 				}
657 			}
658 		}
659 	}
660 
661 	if (pMarkList != mpDragSrcMarkList)
662 	{
663 	   delete pMarkList;
664 	}
665 
666 	return (bSelected);
667 }
668 
669 /*************************************************************************
670 |*
671 |* Alles selektieren
672 |*
673 \************************************************************************/
674 
675 void View::SelectAll()
676 {
677 	if ( IsTextEdit() )
678 	{
679 		OutlinerView* pOLV = GetTextEditOutlinerView();
680 		const ::Outliner* pOutliner = GetTextEditOutliner();
681 		pOLV->SelectRange( 0, (sal_uInt16) pOutliner->GetParagraphCount() );
682 	}
683 	else
684 	{
685 		MarkAll();
686 	}
687 }
688 
689 
690 /*************************************************************************
691 |*
692 |* Dokument hat sich geaendert
693 |*
694 \************************************************************************/
695 
696 void View::ModelHasChanged()
697 {
698 	// Erst SdrView benachrichtigen
699 	FmFormView::ModelHasChanged();
700 }
701 
702 /*************************************************************************
703 |*
704 |* StyleSheet setzen
705 |*
706 \************************************************************************/
707 
708 sal_Bool View::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
709 {
710 	// weiter an SdrView
711 	return FmFormView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
712 }
713 
714 
715 /*************************************************************************
716 |*
717 |* Texteingabe beginnen
718 |*
719 \************************************************************************/
720 
721 static void SetSpellOptions( SdDrawDocument* pDoc, sal_uLong& rCntrl )
722 {
723 	sal_Bool bOnlineSpell = pDoc->GetOnlineSpell();
724 
725 	if( bOnlineSpell )
726 		rCntrl |= EE_CNTRL_ONLINESPELLING;
727 	else
728 		rCntrl &= ~EE_CNTRL_ONLINESPELLING;
729 }
730 
731 sal_Bool View::SdrBeginTextEdit(
732 	SdrObject* pObj, SdrPageView* pPV, ::Window* pWin,
733 	sal_Bool bIsNewObj,
734 	SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
735     sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, sal_Bool bGrabFocus )
736 {
737 	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
738         sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
739 
740 	if( pOutl==NULL && pObj )
741 		pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
742 
743 	// make draw&impress specific initialisations
744 	if( pOutl )
745 	{
746 		pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
747 		pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
748 		sal_uLong nCntrl = pOutl->GetControlWord();
749 		nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
750 		nCntrl |= EE_CNTRL_URLSFXEXECUTE;
751 		nCntrl |= EE_CNTRL_MARKFIELDS;
752 		nCntrl |= EE_CNTRL_AUTOCORRECT;
753 
754 		nCntrl &= ~EE_CNTRL_ULSPACESUMMATION;
755 		if ( mpDoc->IsSummationOfParagraphs() )
756 		    nCntrl |= EE_CNTRL_ULSPACESUMMATION;
757 
758 		SetSpellOptions( mpDoc, nCntrl );
759 
760 		pOutl->SetControlWord(nCntrl);
761 
762 		Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
763         if ( xSpellChecker.is() )
764             pOutl->SetSpeller( xSpellChecker );
765 
766 		Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
767         if( xHyphenator.is() )
768             pOutl->SetHyphenator( xHyphenator );
769 
770 		pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
771 	}
772 
773 	sal_Bool bReturn = FmFormView::SdrBeginTextEdit(
774 		pObj, pPV, pWin, bIsNewObj, pOutl,
775 		pGivenOutlinerView, bDontDeleteOutliner,
776 		bOnlyOneView, bGrabFocus);
777 
778 	if (bReturn)
779 	{
780 		::Outliner* pOL = GetTextEditOutliner();
781 
782 		if( pObj && pObj->GetPage() )
783 		{
784 			Color aBackground;
785 			if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE )
786 			{
787 				aBackground = GetTextEditBackgroundColor(*this);
788 			}
789 			else
790 			{
791 				aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
792 			}
793 			pOL->SetBackgroundColor( aBackground  );
794 		}
795 
796 		pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
797 		pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
798 	}
799 
800 	return(bReturn);
801 }
802 
803 /** ends current text editing */
804 SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally )
805 {
806 	SdrObjectWeakRef xObj( GetTextEditObject() );
807 
808 	sal_Bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
809 
810 	SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
811 
812 	if( bDefaultTextRestored )
813 	{
814 		if( xObj.is() && !xObj->IsEmptyPresObj() )
815 		{
816 			xObj->SetEmptyPresObj( sal_True );
817 		}
818 		else
819 		{
820 			eKind = SDRENDTEXTEDIT_UNCHANGED;
821 		}
822 	}
823 	else if( xObj.is() && xObj->IsEmptyPresObj() )
824 	{
825 		SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
826 		if( pObj && pObj->HasText() )
827 		{
828 			SdrPage* pPage = pObj->GetPage();
829 			if( !pPage || !pPage->IsMasterPage() )
830 				pObj->SetEmptyPresObj( sal_False );
831 		}
832 	}
833 
834 	GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() );
835 
836 	if( xObj.is() )
837 	{
838 		SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
839 		if( pPage )
840 			pPage->onEndTextEdit( xObj.get() );
841 	}
842 
843 	return(eKind);
844 }
845 
846 // --------------------------------------------------------------------
847 
848 /** restores the default text if the given text object is currently in edit mode and
849 	no text has been entered already. Is only usefull just before text edit ends. */
850 bool View::RestoreDefaultText( SdrTextObj* pTextObj )
851 {
852 	bool bRestored = false;
853 
854 	if( pTextObj && (pTextObj == GetTextEditObject()) )
855 	{
856 		if( !pTextObj->HasText() )
857 		{
858 			SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
859 
860 			if(pPage)
861 			{
862 				bRestored = pPage->RestoreDefaultText( pTextObj );
863 				if( bRestored )
864 				{
865 					SdrOutliner* pOutliner = GetTextEditOutliner();
866 					pTextObj->SetTextEditOutliner( pOutliner );
867 					OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
868 					if (pOutliner)
869 						pOutliner->SetText(*pParaObj);
870 				}
871 			}
872 		}
873 	}
874 
875 	return bRestored;
876 }
877 
878 /*************************************************************************
879 |*
880 |* Originalgroesse der markierten Objekte setzen
881 |*
882 \************************************************************************/
883 
884 void View::SetMarkedOriginalSize()
885 {
886 	SdrUndoGroup*   pUndoGroup = new SdrUndoGroup(*mpDoc);
887 	sal_uLong           nCount = GetMarkedObjectCount();
888 	sal_Bool            bOK = sal_False;
889 
890 	for( sal_uInt32 i = 0; i < nCount; i++ )
891 	{
892 		SdrObject* pObj = GetMarkedObjectByIndex(i);
893 
894 		if( pObj->GetObjInventor() == SdrInventor )
895 		{
896 			if( pObj->GetObjIdentifier() == OBJ_OLE2 )
897 			{
898                 uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObj)->GetObjRef();
899                 if( xObj.is() )
900 				{
901                     // TODO/LEAN: working with VisualArea can switch object to running state
902 
903                    	sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect();
904 					Size aOleSize;
905 
906 					if ( nAspect == embed::Aspects::MSOLE_ICON )
907 					{
908 						MapMode aMap100( MAP_100TH_MM );
909                     	aOleSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMap100 );
910                     	bOK = sal_True;
911 					}
912 					else
913 					{
914                     	MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
915 						try
916 						{
917                     		awt::Size aSz = xObj->getVisualAreaSize( nAspect );
918                     		aOleSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM );
919                     		bOK = sal_True;
920 						}
921 						catch( embed::NoVisualAreaSizeException& )
922 						{}
923 					}
924 
925 					if ( bOK )
926 					{
927 						Rectangle   aDrawRect( pObj->GetLogicRect() );
928 
929 						pUndoGroup->AddAction( mpDoc->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
930 						pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ),
931 													   	Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) );
932 					}
933                 }
934 			}
935 			else if( pObj->GetObjIdentifier() == OBJ_GRAF )
936 			{
937 				const MapMode   aMap100( MAP_100TH_MM );
938 				Size            aSize;
939 
940 			    if ( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
941 				    aSize = Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), aMap100 );
942 			    else
943 			    {
944 				    aSize = OutputDevice::LogicToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(),
945 														static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode(),
946 														aMap100 );
947 				}
948 
949 				pUndoGroup->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj ) );
950 				Rectangle aRect( pObj->GetLogicRect() );
951 				aRect.SetSize( aSize );
952 				pObj->SetLogicRect( aRect );
953 
954 				bOK = sal_True;
955 			}
956 		}
957 	}
958 
959 	if( bOK )
960 	{
961 		pUndoGroup->SetComment( String(SdResId(STR_UNDO_ORIGINALSIZE)) );
962 		mpDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
963 	}
964 	else
965 		delete pUndoGroup;
966 }
967 
968 /*************************************************************************
969 |*
970 |* OLE-Obj am Client connecten
971 |*
972 \************************************************************************/
973 
974 void View::DoConnect(SdrOle2Obj* pObj)
975 {
976 	if (mpViewSh)
977 	{
978         uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
979         if( xObj.is() )
980 		{
981             ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
982             SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow );
983             if ( !pSdClient )
984 			{
985                 pSdClient = new Client(pObj, mpViewSh, pWindow);
986 				Rectangle aRect = pObj->GetLogicRect();
987 				{
988                     // TODO/LEAN: working with visual area can switch object to running state
989 					Size aDrawSize = aRect.GetSize();
990                     awt::Size aSz;
991 
992 					MapMode aMapMode( mpDoc->GetScaleUnit() );
993                     Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
994 
995 					Fraction aScaleWidth (aDrawSize.Width(),  aObjAreaSize.Width() );
996 					Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
997 					aScaleWidth.ReduceInaccurate(10);		// kompatibel zum SdrOle2Obj
998 					aScaleHeight.ReduceInaccurate(10);
999                     pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
1000 
1001 					// sichtbarer Ausschnitt wird nur inplace veraendert!
1002 					// the object area must be set after the scaling, since it triggers resize
1003 					aRect.SetSize(aObjAreaSize);
1004                     pSdClient->SetObjArea(aRect);
1005 				}
1006 			}
1007         }
1008 	}
1009 }
1010 
1011 /*************************************************************************
1012 |*
1013 |*
1014 |*
1015 \************************************************************************/
1016 
1017 sal_Bool View::IsMorphingAllowed() const
1018 {
1019 	const SdrMarkList&	rMarkList = GetMarkedObjectList();
1020 	sal_Bool				bRet = sal_False;
1021 
1022 	if ( rMarkList.GetMarkCount() == 2 )
1023 	{
1024 		const SdrObject*	pObj1 = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
1025 		const SdrObject*	pObj2 = rMarkList.GetMark( 1 )->GetMarkedSdrObj();
1026 		const sal_uInt16		nKind1 = pObj1->GetObjIdentifier();
1027 		const sal_uInt16		nKind2 = pObj2->GetObjIdentifier();
1028 
1029 		if ( ( nKind1 != OBJ_TEXT && nKind2 != OBJ_TEXT ) &&
1030 			 ( nKind1 != OBJ_TITLETEXT && nKind2 != OBJ_TITLETEXT ) &&
1031 			 ( nKind1 != OBJ_OUTLINETEXT && nKind2 != OBJ_OUTLINETEXT ) &&
1032 			 ( nKind1 != OBJ_GRUP && nKind2 != OBJ_GRUP ) &&
1033 			 ( nKind1 != OBJ_LINE && nKind2 != OBJ_LINE ) &&
1034 			 ( nKind1 != OBJ_PLIN && nKind2 != OBJ_PLIN ) &&
1035 			 ( nKind1 != OBJ_PATHLINE && nKind2 != OBJ_PATHLINE ) &&
1036 			 ( nKind1 != OBJ_FREELINE && nKind2 != OBJ_FREELINE ) &&
1037 			 ( nKind1 != OBJ_PATHPLIN && nKind2 != OBJ_PATHPLIN ) &&
1038 			 ( nKind1 != OBJ_MEASURE && nKind2 != OBJ_MEASURE ) &&
1039 			 ( nKind1 != OBJ_EDGE && nKind2 != OBJ_EDGE ) &&
1040 			 ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) &&
1041 			 ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) &&
1042 			 ( nKind1 != OBJ_CAPTION && nKind2 !=  OBJ_CAPTION ) &&
1043 			 !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) )
1044 		{
1045 			SfxItemSet		aSet1( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1046 			SfxItemSet		aSet2( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE );
1047 
1048 			aSet1.Put(pObj1->GetMergedItemSet());
1049 			aSet2.Put(pObj2->GetMergedItemSet());
1050 
1051 			const XFillStyle	eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
1052 			const XFillStyle	eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
1053 
1054 			if( ( eFillStyle1 == XFILL_NONE || eFillStyle1 == XFILL_SOLID ) &&
1055 				( eFillStyle2 == XFILL_NONE || eFillStyle2 == XFILL_SOLID ) )
1056 				bRet = sal_True;
1057 		}
1058 	}
1059 
1060 	return bRet;
1061 }
1062 
1063 /*************************************************************************
1064 |*
1065 |*
1066 |*
1067 \************************************************************************/
1068 
1069 sal_Bool View::IsVectorizeAllowed() const
1070 {
1071 	const SdrMarkList&	rMarkList = GetMarkedObjectList();
1072 	sal_Bool				bRet = sal_False;
1073 
1074 	if( rMarkList.GetMarkCount() == 1 )
1075 	{
1076 		const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
1077 
1078 		if( pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
1079 			bRet = sal_True;
1080 	}
1081 
1082 	return bRet;
1083 }
1084 
1085 void View::onAccessibilityOptionsChanged()
1086 {
1087 	if( mpViewSh )
1088 	{
1089 		::sd::Window* pWindow = mpViewSh->GetActiveWindow();
1090 		if( pWindow )
1091 		{
1092 			const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
1093 
1094 			sal_uInt16 nOutputSlot, nPreviewSlot;
1095 
1096 			SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
1097 
1098 			if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
1099 			{
1100 				if( rStyleSettings.GetHighContrastMode() )
1101 				{
1102 					nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
1103 				}
1104 				else
1105 				{
1106 					nOutputSlot = SID_OUTPUT_QUALITY_COLOR;
1107 				}
1108 
1109 				if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
1110 				{
1111 					nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
1112 				}
1113 				else
1114 				{
1115 					nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
1116 				}
1117 
1118 				mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON );
1119 				mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON );
1120 			}
1121 
1122 			mpViewSh->Invalidate();
1123 		}
1124 	}
1125 }
1126 
1127 IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner )
1128 {
1129 	Paragraph* pPara = pOutliner->GetHdlParagraph();
1130 	SdrObject* pObj = GetTextEditObject();
1131 
1132 	if( pPara && pObj )
1133 	{
1134 		SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1135 		if( pPage )
1136 			pPage->onParagraphInserted( pOutliner, pPara, pObj );
1137 	}
1138 	return 0;
1139 }
1140 
1141 /*************************************************************************
1142 |*
1143 |* Handler fuer das Loeschen von Seiten (Absaetzen)
1144 |*
1145 \************************************************************************/
1146 
1147 IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner )
1148 {
1149 	Paragraph* pPara = pOutliner->GetHdlParagraph();
1150 	SdrObject* pObj = GetTextEditObject();
1151 
1152 	if( pPara && pObj )
1153 	{
1154 		SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1155 		if( pPage )
1156 			pPage->onParagraphRemoving( pOutliner, pPara, pObj );
1157 	}
1158 	return 0;
1159 }
1160 
1161 bool View::isRecordingUndo() const
1162 {
1163 	if( mpDoc && mpDoc->IsUndoEnabled() )
1164 	{
1165 		sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0;
1166 		return pUndoManager && pUndoManager->IsInListAction();
1167 	}
1168 	else
1169 	{
1170 		return false;
1171 	}
1172 }
1173 
1174 void View::AddCustomHdl()
1175 {
1176 	maSmartTags.addCustomHandles( aHdl );
1177 }
1178 
1179 void View::updateHandles()
1180 {
1181 	AdjustMarkHdl();
1182 }
1183 
1184 SdrViewContext View::GetContext() const
1185 {
1186 	SdrViewContext eContext = SDRCONTEXT_STANDARD;
1187 	if( maSmartTags.getContext( eContext ) )
1188 		return eContext;
1189 	else
1190 		return FmFormView::GetContext();
1191 }
1192 
1193 sal_Bool View::HasMarkablePoints() const
1194 {
1195 	if( maSmartTags.HasMarkablePoints() )
1196 		return true;
1197 	else
1198 		return FmFormView::HasMarkablePoints();
1199 }
1200 
1201 sal_uLong View::GetMarkablePointCount() const
1202 {
1203 	sal_uLong nCount = FmFormView::GetMarkablePointCount();
1204 	nCount += maSmartTags.GetMarkablePointCount();
1205 	return nCount;
1206 }
1207 
1208 sal_Bool View::HasMarkedPoints() const
1209 {
1210 	if( maSmartTags.HasMarkedPoints() )
1211 		return true;
1212 	else
1213 		return FmFormView::HasMarkedPoints();
1214 }
1215 
1216 sal_uLong View::GetMarkedPointCount() const
1217 {
1218 	sal_uLong nCount = FmFormView::GetMarkedPointCount();
1219 	nCount += maSmartTags.GetMarkedPointCount();
1220 	return nCount;
1221 }
1222 
1223 sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const
1224 {
1225 	if( maSmartTags.IsPointMarkable( rHdl ) )
1226 		return true;
1227 	else
1228 		return FmFormView::IsPointMarkable( rHdl );
1229 }
1230 
1231 sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
1232 {
1233 	if( maSmartTags.MarkPoint( rHdl, bUnmark ) )
1234 		return true;
1235 	else
1236 		return FmFormView::MarkPoint( rHdl, bUnmark );
1237 }
1238 
1239 sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
1240 {
1241 	if( maSmartTags.MarkPoints( pRect, bUnmark ) )
1242 		return true;
1243 	else
1244 		return FmFormView::MarkPoints( pRect, bUnmark );
1245 }
1246 
1247 void View::CheckPossibilities()
1248 {
1249 	FmFormView::CheckPossibilities();
1250 	maSmartTags.CheckPossibilities();
1251 }
1252 
1253 void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
1254 {
1255 }
1256 
1257 /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1258 	get the correct style sheet. */
1259 void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
1260 {
1261 	SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
1262 	SdrOutliner* pOutliner = GetTextEditOutliner();
1263 	if( pOutliner && pTextObj && pTextObj->GetPage() )
1264 	{
1265 		SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
1266 
1267 		SfxStyleSheet* pStyleSheet = 0;
1268 
1269 		const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);
1270 		if( eKind != PRESOBJ_NONE )
1271 			pStyleSheet = pPage->GetStyleSheetForPresObj(eKind);
1272 		else
1273 			pStyleSheet = pTextObj->GetStyleSheet();
1274 
1275 		if( eKind == PRESOBJ_OUTLINE )
1276 		{
1277 			// for outline shapes, set the correct outline style sheet for each
1278 			// new paragraph, depending on the paragraph depth
1279 			SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
1280 
1281 			for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1282 			{
1283 				sal_Int16 nDepth = pOutliner->GetDepth( nPara );
1284 
1285 				SfxStyleSheet* pStyle = 0;
1286 				if( nDepth > 0 )
1287 				{
1288 					String aStyleSheetName( pStyleSheet->GetName() );
1289 					aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
1290 					aStyleSheetName += String::CreateFromInt32( nDepth );
1291 					pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
1292 					DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" );
1293 				}
1294 
1295 				if( !pStyle )
1296 					pStyle = pStyleSheet;
1297 
1298 				pOutliner->SetStyleSheet( nPara, pStyle );
1299 			}
1300 		}
1301 		else
1302 		{
1303 			// just put the object style on each new paragraph
1304 			for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1305 			{
1306 				pOutliner->SetStyleSheet( nPara, pStyleSheet );
1307 			}
1308 		}
1309 	}
1310 }
1311 
1312 } // end of namespace sd
1313