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

Generated by: LCOV version 1.10