LCOV - code coverage report
Current view: top level - sd/source/ui/view - sdview.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 181 642 28.2 %
Date: 2014-11-03 Functions: 27 54 50.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10