xref: /AOO41X/main/sd/source/ui/view/sdview.cxx (revision 54628ca40d27d15cc98fe861da7fff7e60c2f7d6)
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 SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
1077 
1078         if(pObj)
1079         {
1080             if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
1081             {
1082                 bRet = sal_True;
1083             }
1084         }
1085     }
1086 
1087     return bRet;
1088 }
1089 
1090 void View::onAccessibilityOptionsChanged()
1091 {
1092     if( mpViewSh )
1093     {
1094         ::sd::Window* pWindow = mpViewSh->GetActiveWindow();
1095         if( pWindow )
1096         {
1097             const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
1098 
1099             sal_uInt16 nOutputSlot, nPreviewSlot;
1100 
1101             SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
1102 
1103             if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
1104             {
1105                 if( rStyleSettings.GetHighContrastMode() )
1106                 {
1107                     nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
1108                 }
1109                 else
1110                 {
1111                     nOutputSlot = SID_OUTPUT_QUALITY_COLOR;
1112                 }
1113 
1114                 if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() )
1115                 {
1116                     nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST;
1117                 }
1118                 else
1119                 {
1120                     nPreviewSlot = SID_PREVIEW_QUALITY_COLOR;
1121                 }
1122 
1123                 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON );
1124                 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON );
1125             }
1126 
1127             mpViewSh->Invalidate();
1128         }
1129     }
1130 }
1131 
1132 IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner )
1133 {
1134     Paragraph* pPara = pOutliner->GetHdlParagraph();
1135     SdrObject* pObj = GetTextEditObject();
1136 
1137     if( pPara && pObj )
1138     {
1139         SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1140         if( pPage )
1141             pPage->onParagraphInserted( pOutliner, pPara, pObj );
1142     }
1143     return 0;
1144 }
1145 
1146 /*************************************************************************
1147 |*
1148 |* Handler fuer das Loeschen von Seiten (Absaetzen)
1149 |*
1150 \************************************************************************/
1151 
1152 IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner )
1153 {
1154     Paragraph* pPara = pOutliner->GetHdlParagraph();
1155     SdrObject* pObj = GetTextEditObject();
1156 
1157     if( pPara && pObj )
1158     {
1159         SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
1160         if( pPage )
1161             pPage->onParagraphRemoving( pOutliner, pPara, pObj );
1162     }
1163     return 0;
1164 }
1165 
1166 bool View::isRecordingUndo() const
1167 {
1168     if( mpDoc && mpDoc->IsUndoEnabled() )
1169     {
1170         sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0;
1171         return pUndoManager && pUndoManager->IsInListAction();
1172     }
1173     else
1174     {
1175         return false;
1176     }
1177 }
1178 
1179 void View::AddCustomHdl()
1180 {
1181     maSmartTags.addCustomHandles( aHdl );
1182 }
1183 
1184 void View::updateHandles()
1185 {
1186     AdjustMarkHdl();
1187 }
1188 
1189 SdrViewContext View::GetContext() const
1190 {
1191     SdrViewContext eContext = SDRCONTEXT_STANDARD;
1192     if( maSmartTags.getContext( eContext ) )
1193         return eContext;
1194     else
1195         return FmFormView::GetContext();
1196 }
1197 
1198 sal_Bool View::HasMarkablePoints() const
1199 {
1200     if( maSmartTags.HasMarkablePoints() )
1201         return true;
1202     else
1203         return FmFormView::HasMarkablePoints();
1204 }
1205 
1206 sal_uLong View::GetMarkablePointCount() const
1207 {
1208     sal_uLong nCount = FmFormView::GetMarkablePointCount();
1209     nCount += maSmartTags.GetMarkablePointCount();
1210     return nCount;
1211 }
1212 
1213 sal_Bool View::HasMarkedPoints() const
1214 {
1215     if( maSmartTags.HasMarkedPoints() )
1216         return true;
1217     else
1218         return FmFormView::HasMarkedPoints();
1219 }
1220 
1221 sal_uLong View::GetMarkedPointCount() const
1222 {
1223     sal_uLong nCount = FmFormView::GetMarkedPointCount();
1224     nCount += maSmartTags.GetMarkedPointCount();
1225     return nCount;
1226 }
1227 
1228 sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const
1229 {
1230     if( maSmartTags.IsPointMarkable( rHdl ) )
1231         return true;
1232     else
1233         return FmFormView::IsPointMarkable( rHdl );
1234 }
1235 
1236 sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark )
1237 {
1238     if( maSmartTags.MarkPoint( rHdl, bUnmark ) )
1239         return true;
1240     else
1241         return FmFormView::MarkPoint( rHdl, bUnmark );
1242 }
1243 
1244 sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
1245 {
1246     if( maSmartTags.MarkPoints( pRect, bUnmark ) )
1247         return true;
1248     else
1249         return FmFormView::MarkPoints( pRect, bUnmark );
1250 }
1251 
1252 void View::CheckPossibilities()
1253 {
1254     FmFormView::CheckPossibilities();
1255     maSmartTags.CheckPossibilities();
1256 }
1257 
1258 void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
1259 {
1260 }
1261 
1262 /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1263     get the correct style sheet. */
1264 void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
1265 {
1266     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
1267     SdrOutliner* pOutliner = GetTextEditOutliner();
1268     if( pOutliner && pTextObj && pTextObj->GetPage() )
1269     {
1270         SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
1271 
1272         SfxStyleSheet* pStyleSheet = 0;
1273 
1274         const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);
1275         if( eKind != PRESOBJ_NONE )
1276             pStyleSheet = pPage->GetStyleSheetForPresObj(eKind);
1277         else
1278             pStyleSheet = pTextObj->GetStyleSheet();
1279 
1280         if( eKind == PRESOBJ_OUTLINE )
1281         {
1282             // for outline shapes, set the correct outline style sheet for each
1283             // new paragraph, depending on the paragraph depth
1284             SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
1285 
1286             for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1287             {
1288                 sal_Int16 nDepth = pOutliner->GetDepth( nPara );
1289 
1290                 SfxStyleSheet* pStyle = 0;
1291                 if( nDepth > 0 )
1292                 {
1293                     String aStyleSheetName( pStyleSheet->GetName() );
1294                     aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
1295                     aStyleSheetName += String::CreateFromInt32( nDepth );
1296                     pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
1297                     DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" );
1298                 }
1299 
1300                 if( !pStyle )
1301                     pStyle = pStyleSheet;
1302 
1303                 pOutliner->SetStyleSheet( nPara, pStyle );
1304             }
1305         }
1306         else
1307         {
1308             // just put the object style on each new paragraph
1309             for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1310             {
1311                 pOutliner->SetStyleSheet( nPara, pStyleSheet );
1312             }
1313         }
1314     }
1315 }
1316 
1317 } // end of namespace sd
1318