LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdedxv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 104 1055 9.9 %
Date: 2012-08-25 Functions: 18 62 29.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 47 1599 2.9 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/i18n/WordType.hpp>
      31                 :            : 
      32                 :            : #include <svtools/accessibilityoptions.hxx>
      33                 :            : 
      34                 :            : #include <svx/svdedxv.hxx>
      35                 :            : #include <svl/solar.hrc>
      36                 :            : 
      37                 :            : #include <svl/itemiter.hxx>
      38                 :            : #include <vcl/msgbox.hxx>
      39                 :            : #include <vcl/hatch.hxx>
      40                 :            : #include <svl/whiter.hxx>
      41                 :            : #include <svl/style.hxx>
      42                 :            : #include <editeng/editstat.hxx>
      43                 :            : #include <vcl/cursor.hxx>
      44                 :            : #include <editeng/unotext.hxx>
      45                 :            : 
      46                 :            : #include <editeng/editeng.hxx>
      47                 :            : #include <editeng/editobj.hxx>
      48                 :            : #include <editeng/outlobj.hxx>
      49                 :            : #include <editeng/scripttypeitem.hxx>
      50                 :            : #include "svx/svditext.hxx"
      51                 :            : #include <svx/svdoutl.hxx>
      52                 :            : #include <svx/sdtfchim.hxx>
      53                 :            : #include <svx/svdotext.hxx>
      54                 :            : #include <svx/svdundo.hxx>
      55                 :            : #include "svx/svditer.hxx"
      56                 :            : #include "svx/svdpagv.hxx"
      57                 :            : #include "svx/svdpage.hxx"
      58                 :            : #include "svx/svdetc.hxx"   // for GetDraftFillColor
      59                 :            : #include "svx/svdotable.hxx"
      60                 :            : #include <svx/selectioncontroller.hxx>
      61                 :            : #ifdef DBG_UTIL
      62                 :            : #include <svdibrow.hxx>
      63                 :            : #endif
      64                 :            : 
      65                 :            : #include <svx/svddrgv.hxx>  // for SetSolidDragging()
      66                 :            : #include "svx/svdstr.hrc"   // names taken from the resource
      67                 :            : #include "svx/svdglob.hxx"  // StringCache
      68                 :            : #include "svx/globl3d.hxx"
      69                 :            : #include <editeng/outliner.hxx>
      70                 :            : #include <editeng/adjitem.hxx>
      71                 :            : 
      72                 :            : #include <svtools/colorcfg.hxx>
      73                 :            : #include <vcl/svapp.hxx>
      74                 :            : #include <svx/sdrpaintwindow.hxx>
      75                 :            : 
      76                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      77                 :            : 
      78                 :       4699 : void SdrObjEditView::ImpClearVars()
      79                 :            : {
      80                 :       4699 :     bQuickTextEditMode=sal_True;
      81                 :       4699 :     bMacroMode=sal_True;
      82                 :       4699 :     pTextEditOutliner=NULL;
      83                 :       4699 :     pTextEditOutlinerView=NULL;
      84                 :       4699 :     pTextEditPV=NULL;
      85                 :       4699 :     pTextEditWin=NULL;
      86                 :       4699 :     pTextEditCursorMerker=NULL;
      87                 :       4699 :     pEditPara=NULL;
      88                 :       4699 :     bTextEditNewObj=sal_False;
      89                 :       4699 :     bMacroDown=sal_False;
      90                 :       4699 :     pMacroObj=NULL;
      91                 :       4699 :     pMacroPV=NULL;
      92                 :       4699 :     pMacroWin=NULL;
      93                 :       4699 :     nMacroTol=0;
      94                 :       4699 :     bTextEditDontDelete=sal_False;
      95                 :       4699 :     bTextEditOnlyOneView=sal_False;
      96                 :       4699 : }
      97                 :            : 
      98                 :       4699 : SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
      99 [ +  - ][ +  - ]:       4699 :     SdrGlueEditView(pModel1,pOut)
         [ +  - ][ +  - ]
     100                 :            : {
     101                 :       4699 :     ImpClearVars();
     102                 :       4699 : }
     103                 :            : 
     104         [ +  - ]:       4508 : SdrObjEditView::~SdrObjEditView()
     105                 :            : {
     106                 :       4508 :     pTextEditWin = NULL;            // so there's no ShowCursor in SdrEndTextEdit
     107 [ +  - ][ -  + ]:       4508 :     if (IsTextEdit()) SdrEndTextEdit();
                 [ #  # ]
     108         [ -  + ]:       4508 :     if (pTextEditOutliner!=NULL) {
     109 [ #  # ][ #  # ]:          0 :         delete pTextEditOutliner;
     110                 :            :     }
     111         [ -  + ]:       4508 : }
     112                 :            : 
     113                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     114                 :            : 
     115                 :       2168 : sal_Bool SdrObjEditView::IsAction() const
     116                 :            : {
     117 [ +  - ][ -  + ]:       2168 :     return IsMacroObj() || SdrGlueEditView::IsAction();
     118                 :            : }
     119                 :            : 
     120                 :          0 : void SdrObjEditView::MovAction(const Point& rPnt)
     121                 :            : {
     122         [ #  # ]:          0 :     if (IsMacroObj()) MovMacroObj(rPnt);
     123                 :          0 :     SdrGlueEditView::MovAction(rPnt);
     124                 :          0 : }
     125                 :            : 
     126                 :          0 : void SdrObjEditView::EndAction()
     127                 :            : {
     128         [ #  # ]:          0 :     if (IsMacroObj()) EndMacroObj();
     129                 :          0 :     SdrGlueEditView::EndAction();
     130                 :          0 : }
     131                 :            : 
     132                 :          0 : void SdrObjEditView::BckAction()
     133                 :            : {
     134                 :          0 :     BrkMacroObj();
     135                 :          0 :     SdrGlueEditView::BckAction();
     136                 :          0 : }
     137                 :            : 
     138                 :       4877 : void SdrObjEditView::BrkAction()
     139                 :            : {
     140                 :       4877 :     BrkMacroObj();
     141                 :       4877 :     SdrGlueEditView::BrkAction();
     142                 :       4877 : }
     143                 :            : 
     144                 :          0 : void SdrObjEditView::TakeActionRect(Rectangle& rRect) const
     145                 :            : {
     146         [ #  # ]:          0 :     if (IsMacroObj()) {
     147                 :          0 :         rRect=pMacroObj->GetCurrentBoundRect();
     148                 :            :     } else {
     149                 :          0 :         SdrGlueEditView::TakeActionRect(rRect);
     150                 :            :     }
     151                 :          0 : }
     152                 :            : 
     153                 :     304910 : void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     154                 :            : {
     155                 :     304910 :     SdrGlueEditView::Notify(rBC,rHint);
     156                 :            :     // change of printer while editing
     157 [ +  + ][ +  - ]:     304910 :     SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
     158 [ +  + ][ -  + ]:     304910 :     if (pSdrHint!=NULL && pTextEditOutliner!=NULL) {
     159                 :          0 :         SdrHintKind eKind=pSdrHint->GetKind();
     160         [ #  # ]:          0 :         if (eKind==HINT_REFDEVICECHG) {
     161                 :          0 :             pTextEditOutliner->SetRefDevice(pMod->GetRefDevice());
     162                 :            :         }
     163         [ #  # ]:          0 :         if (eKind==HINT_DEFAULTTABCHG) {
     164                 :          0 :             pTextEditOutliner->SetDefTab(pMod->GetDefaultTabulator());
     165                 :            :         }
     166                 :            :         if (eKind==HINT_DEFFONTHGTCHG) {
     167                 :            :             // ...
     168                 :            :         }
     169         [ #  # ]:          0 :         if (eKind==HINT_MODELSAVED) {
     170                 :          0 :             pTextEditOutliner->ClearModifyFlag();
     171                 :            :         }
     172                 :            :     }
     173                 :     304910 : }
     174                 :            : 
     175                 :       4384 : void SdrObjEditView::ModelHasChanged()
     176                 :            : {
     177                 :       4384 :     SdrGlueEditView::ModelHasChanged();
     178 [ #  # ][ -  + ]:       4384 :     if (mxTextEditObj.is() && !mxTextEditObj->IsInserted()) SdrEndTextEdit(); // object deleted
                 [ -  + ]
     179                 :            :     // TextEditObj changed?
     180         [ -  + ]:       4384 :     if (IsTextEdit()) {
     181         [ #  # ]:          0 :         SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( mxTextEditObj.get() );
     182         [ #  # ]:          0 :         if (pTextObj!=NULL) {
     183         [ #  # ]:          0 :             sal_uIntPtr nOutlViewAnz=pTextEditOutliner->GetViewCount();
     184                 :          0 :             sal_Bool bAreaChg=sal_False;
     185                 :          0 :             sal_Bool bAnchorChg=sal_False;
     186                 :          0 :             sal_Bool bColorChg=sal_False;
     187         [ #  # ]:          0 :             bool bContourFrame=pTextObj->IsContourTextFrame();
     188                 :          0 :             EVAnchorMode eNewAnchor(ANCHOR_VCENTER_HCENTER);
     189                 :          0 :             Rectangle aOldArea(aMinTextEditArea);
     190         [ #  # ]:          0 :             aOldArea.Union(aTextEditArea);
     191                 :          0 :             Color aNewColor;
     192                 :            :             { // check area
     193                 :          0 :                 Size aPaperMin1;
     194                 :          0 :                 Size aPaperMax1;
     195         [ #  # ]:          0 :                 Rectangle aEditArea1;
     196         [ #  # ]:          0 :                 Rectangle aMinArea1;
     197         [ #  # ]:          0 :                 pTextObj->TakeTextEditArea(&aPaperMin1,&aPaperMax1,&aEditArea1,&aMinArea1);
     198                 :            : 
     199                 :          0 :                 Point aPvOfs(pTextObj->GetTextEditOffset());
     200                 :            : 
     201         [ #  # ]:          0 :                 aEditArea1.Move(aPvOfs.X(),aPvOfs.Y());
     202         [ #  # ]:          0 :                 aMinArea1.Move(aPvOfs.X(),aPvOfs.Y());
     203                 :          0 :                 Rectangle aNewArea(aMinArea1);
     204         [ #  # ]:          0 :                 aNewArea.Union(aEditArea1);
     205 [ #  # ][ #  # ]:          0 :                 if (aNewArea!=aOldArea || aEditArea1!=aTextEditArea || aMinArea1!=aMinTextEditArea ||
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
     206 [ #  # ][ #  # ]:          0 :                     pTextEditOutliner->GetMinAutoPaperSize()!=aPaperMin1 || pTextEditOutliner->GetMaxAutoPaperSize()!=aPaperMax1) {
     207                 :          0 :                     aTextEditArea=aEditArea1;
     208                 :          0 :                     aMinTextEditArea=aMinArea1;
     209         [ #  # ]:          0 :                     pTextEditOutliner->SetUpdateMode(sal_False);
     210         [ #  # ]:          0 :                     pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
     211         [ #  # ]:          0 :                     pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
     212         [ #  # ]:          0 :                     pTextEditOutliner->SetPaperSize(Size(0,0)); // re-format Outliner
     213         [ #  # ]:          0 :                     if (!bContourFrame) {
     214         [ #  # ]:          0 :                         pTextEditOutliner->ClearPolygon();
     215         [ #  # ]:          0 :                         sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
     216                 :          0 :                         nStat|=EE_CNTRL_AUTOPAGESIZE;
     217         [ #  # ]:          0 :                         pTextEditOutliner->SetControlWord(nStat);
     218                 :            :                     } else {
     219         [ #  # ]:          0 :                         sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
     220                 :          0 :                         nStat&=~EE_CNTRL_AUTOPAGESIZE;
     221         [ #  # ]:          0 :                         pTextEditOutliner->SetControlWord(nStat);
     222         [ #  # ]:          0 :                         Rectangle aAnchorRect;
     223         [ #  # ]:          0 :                         pTextObj->TakeTextAnchorRect(aAnchorRect);
     224         [ #  # ]:          0 :                         pTextObj->ImpSetContourPolygon(*pTextEditOutliner,aAnchorRect, sal_True);
     225                 :            :                     }
     226         [ #  # ]:          0 :                     for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++) {
     227         [ #  # ]:          0 :                         OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
     228         [ #  # ]:          0 :                         sal_uIntPtr nStat0=pOLV->GetControlWord();
     229                 :          0 :                         sal_uIntPtr nStat=nStat0;
     230                 :            :                         // AutoViewSize only if not ContourFrame.
     231         [ #  # ]:          0 :                         if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
     232                 :          0 :                         else nStat&=~EV_CNTRL_AUTOSIZE;
     233 [ #  # ][ #  # ]:          0 :                         if (nStat!=nStat0) pOLV->SetControlWord(nStat);
     234                 :            :                     }
     235         [ #  # ]:          0 :                     pTextEditOutliner->SetUpdateMode(sal_True);
     236                 :          0 :                     bAreaChg=sal_True;
     237                 :            :                 }
     238                 :            :             }
     239         [ #  # ]:          0 :             if (pTextEditOutlinerView!=NULL) { // check fill and anchor
     240         [ #  # ]:          0 :                 EVAnchorMode eOldAnchor=pTextEditOutlinerView->GetAnchorMode();
     241         [ #  # ]:          0 :                 eNewAnchor=(EVAnchorMode)pTextObj->GetOutlinerViewAnchorMode();
     242                 :          0 :                 bAnchorChg=eOldAnchor!=eNewAnchor;
     243         [ #  # ]:          0 :                 Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
     244         [ #  # ]:          0 :                 aNewColor = GetTextEditBackgroundColor(*this);
     245                 :          0 :                 bColorChg=aOldColor!=aNewColor;
     246                 :            :             }
     247                 :            :             // refresh always when it's a contour frame. That
     248                 :            :             // refresh is necessary since it triggers the repaint
     249                 :            :             // which makes the Handles visible. Changes at TakeTextRect()
     250                 :            :             // seem to have resulted in a case where no refresh is executed.
     251                 :            :             // Before that, a refresh must have been always executed
     252                 :            :             // (else this error would have happened earlier), thus I
     253                 :            :             // even think here a refresh should be done always.
     254                 :            :             // Since follow-up problems cannot even be guessed I only
     255                 :            :             // add this one more case to the if below.
     256                 :            :             // BTW: It's VERY bad style that here, inside ModelHasChanged()
     257                 :            :             // the outliner is again massively changed for the text object
     258                 :            :             // in text edit mode. Normally, all necessary data should be
     259                 :            :             // set at SdrBeginTextEdit(). Some changes and value assigns in
     260                 :            :             // SdrBeginTextEdit() are completely useless since they are set here
     261                 :            :             // again on ModelHasChanged().
     262 [ #  # ][ #  # ]:          0 :             if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
         [ #  # ][ #  # ]
     263                 :            :             {
     264         [ #  # ]:          0 :                 for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++)
     265                 :            :                 {
     266         [ #  # ]:          0 :                     OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
     267                 :            :                     { // invalidate old OutlinerView area
     268         [ #  # ]:          0 :                         Window* pWin=pOLV->GetWindow();
     269                 :          0 :                         Rectangle aTmpRect(aOldArea);
     270         [ #  # ]:          0 :                         sal_uInt16 nPixSiz=pOLV->GetInvalidateMore()+1;
     271         [ #  # ]:          0 :                         Size aMore(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
     272                 :          0 :                         aTmpRect.Left()-=aMore.Width();
     273                 :          0 :                         aTmpRect.Right()+=aMore.Width();
     274                 :          0 :                         aTmpRect.Top()-=aMore.Height();
     275                 :          0 :                         aTmpRect.Bottom()+=aMore.Height();
     276         [ #  # ]:          0 :                         InvalidateOneWin(*pWin,aTmpRect);
     277                 :            :                     }
     278         [ #  # ]:          0 :                     if (bAnchorChg)
     279         [ #  # ]:          0 :                         pOLV->SetAnchorMode(eNewAnchor);
     280         [ #  # ]:          0 :                     if (bColorChg)
     281         [ #  # ]:          0 :                         pOLV->SetBackgroundColor( aNewColor );
     282                 :            : 
     283         [ #  # ]:          0 :                     pOLV->SetOutputArea(aTextEditArea); // because otherwise, we're not re-anchoring correctly
     284         [ #  # ]:          0 :                     ImpInvalidateOutlinerView(*pOLV);
     285                 :            :                 }
     286         [ #  # ]:          0 :                 pTextEditOutlinerView->ShowCursor();
     287                 :            :             }
     288                 :            :         }
     289                 :          0 :         ImpMakeTextCursorAreaVisible();
     290                 :            :     }
     291                 :       4384 : }
     292                 :            : 
     293                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     294                 :            : // TextEdit
     295                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     296                 :            : 
     297                 :          0 : void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect) const
     298                 :            : {
     299                 :          0 :     Window* pWin = rOutlView.GetWindow();
     300                 :            : 
     301         [ #  # ]:          0 :     if(pWin)
     302                 :            :     {
     303 [ #  # ][ #  # ]:          0 :         const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     304 [ #  # ][ #  # ]:          0 :         bool bTextFrame(pText && pText->IsTextFrame());
     305 [ #  # ][ #  # ]:          0 :         bool bFitToSize(pText && pText->IsFitToSize());
                 [ #  # ]
     306         [ #  # ]:          0 :         bool bModifyMerk(pTextEditOutliner->IsModified());
     307         [ #  # ]:          0 :         Rectangle aBlankRect(rOutlView.GetOutputArea());
     308         [ #  # ]:          0 :         aBlankRect.Union(aMinTextEditArea);
     309         [ #  # ]:          0 :         Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
     310         [ #  # ]:          0 :         aBlankRect.Intersection(rRect);
     311         [ #  # ]:          0 :         rOutlView.GetOutliner()->SetUpdateMode(sal_True);
     312         [ #  # ]:          0 :         rOutlView.Paint(aBlankRect);
     313                 :            : 
     314         [ #  # ]:          0 :         if(!bModifyMerk)
     315                 :            :         {
     316         [ #  # ]:          0 :             pTextEditOutliner->ClearModifyFlag();
     317                 :            :         }
     318                 :            : 
     319 [ #  # ][ #  # ]:          0 :         if(bTextFrame && !bFitToSize)
     320                 :            :         {
     321                 :          0 :             aPixRect.Left()--;
     322                 :          0 :             aPixRect.Top()--;
     323                 :          0 :             aPixRect.Right()++;
     324                 :          0 :             aPixRect.Bottom()++;
     325         [ #  # ]:          0 :             sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
     326                 :            : 
     327                 :            :             {
     328                 :            :                 // limit xPixRect because of driver problems when pixel coordinates are too far out
     329                 :          0 :                 Size aMaxXY(pWin->GetOutputSizePixel());
     330                 :          0 :                 long a(2 * nPixSiz);
     331                 :          0 :                 long nMaxX(aMaxXY.Width() + a);
     332                 :          0 :                 long nMaxY(aMaxXY.Height() + a);
     333                 :            : 
     334         [ #  # ]:          0 :                 if (aPixRect.Left  ()<-a) aPixRect.Left()=-a;
     335         [ #  # ]:          0 :                 if (aPixRect.Top   ()<-a) aPixRect.Top ()=-a;
     336         [ #  # ]:          0 :                 if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
     337         [ #  # ]:          0 :                 if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
     338                 :            :             }
     339                 :            : 
     340                 :          0 :             Rectangle aOuterPix(aPixRect);
     341                 :          0 :             aOuterPix.Left()-=nPixSiz;
     342                 :          0 :             aOuterPix.Top()-=nPixSiz;
     343                 :          0 :             aOuterPix.Right()+=nPixSiz;
     344                 :          0 :             aOuterPix.Bottom()+=nPixSiz;
     345                 :            : 
     346                 :          0 :             bool bMerk(pWin->IsMapModeEnabled());
     347         [ #  # ]:          0 :             pWin->EnableMapMode(sal_False);
     348         [ #  # ]:          0 :             PolyPolygon aPolyPoly( 2 );
     349                 :            : 
     350         [ #  # ]:          0 :             svtools::ColorConfig aColorConfig;
     351         [ #  # ]:          0 :             Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
     352         [ #  # ]:          0 :             const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 );
     353                 :            : 
     354 [ #  # ][ #  # ]:          0 :             aPolyPoly.Insert( aOuterPix );
                 [ #  # ]
     355 [ #  # ][ #  # ]:          0 :             aPolyPoly.Insert( aPixRect );
                 [ #  # ]
     356         [ #  # ]:          0 :             pWin->DrawHatch( aPolyPoly, aHatch );
     357                 :            : 
     358 [ #  # ][ #  # ]:          0 :             pWin->EnableMapMode(bMerk);
         [ #  # ][ #  # ]
     359                 :            :         }
     360                 :            : 
     361         [ #  # ]:          0 :         rOutlView.ShowCursor();
     362                 :            :     }
     363                 :          0 : }
     364                 :            : 
     365                 :          0 : void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
     366                 :            : {
     367                 :          0 :     Window* pWin = rOutlView.GetWindow();
     368                 :            : 
     369         [ #  # ]:          0 :     if(pWin)
     370                 :            :     {
     371 [ #  # ][ #  # ]:          0 :         const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
     372 [ #  # ][ #  # ]:          0 :         bool bTextFrame(pText && pText->IsTextFrame());
     373 [ #  # ][ #  # ]:          0 :         bool bFitToSize(pText && pText->IsFitToSize());
     374                 :            : 
     375 [ #  # ][ #  # ]:          0 :         if(bTextFrame && !bFitToSize)
     376                 :            :         {
     377         [ #  # ]:          0 :             Rectangle aBlankRect(rOutlView.GetOutputArea());
     378         [ #  # ]:          0 :             aBlankRect.Union(aMinTextEditArea);
     379         [ #  # ]:          0 :             Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
     380         [ #  # ]:          0 :             sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
     381                 :            : 
     382                 :          0 :             aPixRect.Left()--;
     383                 :          0 :             aPixRect.Top()--;
     384                 :          0 :             aPixRect.Right()++;
     385                 :          0 :             aPixRect.Bottom()++;
     386                 :            : 
     387                 :            :             {
     388                 :            :                 // limit xPixRect because of driver problems when pixel coordinates are too far out
     389                 :          0 :                 Size aMaxXY(pWin->GetOutputSizePixel());
     390                 :          0 :                 long a(2 * nPixSiz);
     391                 :          0 :                 long nMaxX(aMaxXY.Width() + a);
     392                 :          0 :                 long nMaxY(aMaxXY.Height() + a);
     393                 :            : 
     394         [ #  # ]:          0 :                 if (aPixRect.Left  ()<-a) aPixRect.Left()=-a;
     395         [ #  # ]:          0 :                 if (aPixRect.Top   ()<-a) aPixRect.Top ()=-a;
     396         [ #  # ]:          0 :                 if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
     397         [ #  # ]:          0 :                 if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
     398                 :            :             }
     399                 :            : 
     400                 :          0 :             Rectangle aOuterPix(aPixRect);
     401                 :          0 :             aOuterPix.Left()-=nPixSiz;
     402                 :          0 :             aOuterPix.Top()-=nPixSiz;
     403                 :          0 :             aOuterPix.Right()+=nPixSiz;
     404                 :          0 :             aOuterPix.Bottom()+=nPixSiz;
     405                 :            : 
     406                 :          0 :             bool bMerk(pWin->IsMapModeEnabled());
     407         [ #  # ]:          0 :             pWin->EnableMapMode(sal_False);
     408         [ #  # ]:          0 :             pWin->Invalidate(aOuterPix);
     409         [ #  # ]:          0 :             pWin->EnableMapMode(bMerk);
     410                 :            :         }
     411                 :            :     }
     412                 :          0 : }
     413                 :            : 
     414                 :          0 : OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, sal_Bool /*bNoPaint*/, OutlinerView* pGivenView) const
     415                 :            : {
     416                 :            :     // background
     417         [ #  # ]:          0 :     Color aBackground(GetTextEditBackgroundColor(*this));
     418         [ #  # ]:          0 :     SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
     419 [ #  # ][ #  # ]:          0 :     sal_Bool bTextFrame=pText!=NULL && pText->IsTextFrame();
     420 [ #  # ][ #  # ]:          0 :     sal_Bool bContourFrame=pText!=NULL && pText->IsContourTextFrame();
                 [ #  # ]
     421                 :            :     // create OutlinerView
     422                 :          0 :     OutlinerView* pOutlView=pGivenView;
     423         [ #  # ]:          0 :     pTextEditOutliner->SetUpdateMode(sal_False);
     424 [ #  # ][ #  # ]:          0 :     if (pOutlView==NULL) pOutlView=new OutlinerView(pTextEditOutliner,pWin);
                 [ #  # ]
     425         [ #  # ]:          0 :     else pOutlView->SetWindow(pWin);
     426                 :            :     // disallow scrolling
     427         [ #  # ]:          0 :     sal_uIntPtr nStat=pOutlView->GetControlWord();
     428                 :          0 :     nStat&=~EV_CNTRL_AUTOSCROLL;
     429                 :            :     // AutoViewSize only if not ContourFrame.
     430         [ #  # ]:          0 :     if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
     431         [ #  # ]:          0 :     if (bTextFrame) {
     432                 :          0 :         sal_uInt16 nPixSiz=aHdl.GetHdlSize()*2+1;
     433                 :          0 :         nStat|=EV_CNTRL_INVONEMORE;
     434         [ #  # ]:          0 :         pOutlView->SetInvalidateMore(nPixSiz);
     435                 :            :     }
     436         [ #  # ]:          0 :     pOutlView->SetControlWord(nStat);
     437         [ #  # ]:          0 :     pOutlView->SetBackgroundColor( aBackground );
     438         [ #  # ]:          0 :     if (pText!=NULL)
     439                 :            :     {
     440 [ #  # ][ #  # ]:          0 :         pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));
     441 [ #  # ][ #  # ]:          0 :         pTextEditOutliner->SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)pText->GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
     442                 :            :     }
     443                 :            :     // do update before setting output area so that aTextEditArea can be recalculated
     444         [ #  # ]:          0 :     pTextEditOutliner->SetUpdateMode(sal_True);
     445         [ #  # ]:          0 :     pOutlView->SetOutputArea(aTextEditArea);
     446         [ #  # ]:          0 :     ImpInvalidateOutlinerView(*pOutlView);
     447                 :          0 :     return pOutlView;
     448                 :            : }
     449                 :            : 
     450                 :          0 : IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl,EditStatus*,pEditStat)
     451                 :            : {
     452         [ #  # ]:          0 :     if(pTextEditOutliner )
     453                 :            :     {
     454         [ #  # ]:          0 :         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
     455         [ #  # ]:          0 :         if( pTextObj )
     456                 :            :         {
     457                 :          0 :             pTextObj->onEditOutlinerStatusEvent( pEditStat );
     458                 :            :         }
     459                 :            :     }
     460                 :          0 :     return 0;
     461                 :            : }
     462                 :            : 
     463                 :          0 : IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
     464                 :            : {
     465                 :          0 :     bool bOk=false;
     466                 :          0 :     String& rStr=pFI->GetRepresentation();
     467         [ #  # ]:          0 :     rStr.Erase();
     468         [ #  # ]:          0 :     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
     469         [ #  # ]:          0 :     if (pTextObj!=NULL) {
     470                 :          0 :         Color* pTxtCol=NULL;
     471                 :          0 :         Color* pFldCol=NULL;
     472         [ #  # ]:          0 :         bOk=pTextObj->CalcFieldValue(pFI->GetField(),pFI->GetPara(),pFI->GetPos(),sal_True,pTxtCol,pFldCol,rStr);
     473         [ #  # ]:          0 :         if (bOk) {
     474         [ #  # ]:          0 :             if (pTxtCol!=NULL) {
     475         [ #  # ]:          0 :                 pFI->SetTxtColor(*pTxtCol);
     476                 :          0 :                 delete pTxtCol;
     477                 :            :             }
     478         [ #  # ]:          0 :             if (pFldCol!=NULL) {
     479         [ #  # ]:          0 :                 pFI->SetFldColor(*pFldCol);
     480                 :          0 :                 delete pFldCol;
     481                 :            :             } else {
     482         [ #  # ]:          0 :                 pFI->SetFldColor(Color(COL_LIGHTGRAY)); // TODO: remove this later on (357)
     483                 :            :             }
     484                 :            :         }
     485                 :            :     }
     486         [ #  # ]:          0 :     Outliner& rDrawOutl=pMod->GetDrawOutliner(pTextObj);
     487                 :          0 :     Link aDrawOutlLink=rDrawOutl.GetCalcFieldValueHdl();
     488 [ #  # ][ #  # ]:          0 :     if (!bOk && aDrawOutlLink.IsSet()) {
         [ #  # ][ #  # ]
     489         [ #  # ]:          0 :         aDrawOutlLink.Call(pFI);
     490                 :          0 :         bOk = (sal_Bool)rStr.Len();
     491                 :            :     }
     492 [ #  # ][ #  # ]:          0 :     if (!bOk && aOldCalcFieldValueLink.IsSet()) {
         [ #  # ][ #  # ]
     493         [ #  # ]:          0 :         return aOldCalcFieldValueLink.Call(pFI);
     494                 :            :     }
     495                 :          0 :     return 0;
     496                 :            : }
     497                 :            : 
     498                 :          0 : sal_Bool SdrObjEditView::SdrBeginTextEdit(
     499                 :            :     SdrObject* pObj, SdrPageView* pPV, Window* pWin,
     500                 :            :     sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner,
     501                 :            :     OutlinerView* pGivenOutlinerView,
     502                 :            :     sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView,
     503                 :            :     sal_Bool bGrabFocus)
     504                 :            : {
     505                 :          0 :     SdrEndTextEdit();
     506                 :            : 
     507 [ #  # ][ #  # ]:          0 :     if( dynamic_cast< SdrTextObj* >( pObj ) == 0 )
                 [ #  # ]
     508                 :          0 :         return sal_False; // currently only possible with text objects
     509                 :            : 
     510 [ #  # ][ #  # ]:          0 :     if(bGrabFocus && pWin)
     511                 :            :     {
     512                 :            :         // attention, this call may cause an EndTextEdit() call to this view
     513                 :          0 :         pWin->GrabFocus(); // to force the cursor into the edit view
     514                 :            :     }
     515                 :            : 
     516 [ #  # ][ #  # ]:          0 :     bTextEditDontDelete=bDontDeleteOutliner && pGivenOutliner!=NULL;
     517                 :          0 :     bTextEditOnlyOneView=bOnlyOneView;
     518                 :          0 :     bTextEditNewObj=bIsNewObj;
     519                 :          0 :     const sal_uInt32 nWinAnz(PaintWindowCount());
     520                 :            :     sal_uInt32 i;
     521                 :          0 :     sal_Bool bBrk(sal_False);
     522                 :            :     // break, when no object given
     523                 :            : 
     524         [ #  # ]:          0 :     if(!pObj)
     525                 :            :     {
     526                 :          0 :         bBrk = sal_True;
     527                 :            :     }
     528                 :            : 
     529 [ #  # ][ #  # ]:          0 :     if(!bBrk && !pWin)
     530                 :            :     {
     531 [ #  # ][ #  # ]:          0 :         for(i = 0L; i < nWinAnz && !pWin; i++)
                 [ #  # ]
     532                 :            :         {
     533                 :          0 :             SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
     534                 :            : 
     535         [ #  # ]:          0 :             if(OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType())
     536                 :            :             {
     537                 :          0 :                 pWin = (Window*)(&pPaintWindow->GetOutputDevice());
     538                 :            :             }
     539                 :            :         }
     540                 :            : 
     541                 :            :         // break, when no window exists
     542         [ #  # ]:          0 :         if(!pWin)
     543                 :            :         {
     544                 :          0 :             bBrk = sal_True;
     545                 :            :         }
     546                 :            :     }
     547                 :            : 
     548 [ #  # ][ #  # ]:          0 :     if(!bBrk && !pPV)
     549                 :            :     {
     550                 :          0 :         pPV = GetSdrPageView();
     551                 :            : 
     552                 :            :         // break, when no PageView for the object exists
     553         [ #  # ]:          0 :         if(!pPV)
     554                 :            :         {
     555                 :          0 :             bBrk = sal_True;
     556                 :            :         }
     557                 :            :     }
     558                 :            : 
     559 [ #  # ][ #  # ]:          0 :     if(pObj && pPV)
     560                 :            :     {
     561                 :            :         // no TextEdit on objects in locked Layer
     562         [ #  # ]:          0 :         if(pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
     563                 :            :         {
     564                 :          0 :             bBrk = sal_True;
     565                 :            :         }
     566                 :            :     }
     567                 :            : 
     568         [ #  # ]:          0 :     if(pTextEditOutliner)
     569                 :            :     {
     570                 :            :         OSL_FAIL("SdrObjEditView::SdrBeginTextEdit(): Old Outliner still exists.");
     571         [ #  # ]:          0 :         delete pTextEditOutliner;
     572                 :          0 :         pTextEditOutliner = 0L;
     573                 :            :     }
     574                 :            : 
     575         [ #  # ]:          0 :     if(!bBrk)
     576                 :            :     {
     577                 :          0 :         pTextEditWin=pWin;
     578                 :          0 :         pTextEditPV=pPV;
     579                 :          0 :         mxTextEditObj.reset( pObj );
     580                 :          0 :         pTextEditOutliner=pGivenOutliner;
     581         [ #  # ]:          0 :         if (pTextEditOutliner==NULL)
     582                 :          0 :             pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, mxTextEditObj->GetModel() );
     583                 :            : 
     584                 :            :         {
     585         [ #  # ]:          0 :             SvtAccessibilityOptions aOptions;
     586 [ #  # ][ #  # ]:          0 :             pTextEditOutliner->ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
                 [ #  # ]
     587                 :            :         }
     588                 :            : 
     589                 :          0 :         sal_Bool bEmpty = mxTextEditObj->GetOutlinerParaObject()==NULL;
     590                 :            : 
     591                 :          0 :         aOldCalcFieldValueLink=pTextEditOutliner->GetCalcFieldValueHdl();
     592                 :            :         // FieldHdl has to be set by SdrBeginTextEdit, because this call an UpdateFields
     593                 :          0 :         pTextEditOutliner->SetCalcFieldValueHdl(LINK(this,SdrObjEditView,ImpOutlinerCalcFieldValueHdl));
     594         [ #  # ]:          0 :         pTextEditOutliner->SetBeginPasteOrDropHdl(LINK(this,SdrObjEditView,BeginPasteOrDropHdl));
     595         [ #  # ]:          0 :         pTextEditOutliner->SetEndPasteOrDropHdl(LINK(this,SdrObjEditView, EndPasteOrDropHdl));
     596                 :            : 
     597                 :            :         // It is just necessary to make the visualized page known. Set it.
     598         [ #  # ]:          0 :         pTextEditOutliner->setVisualizedPage(pPV ? pPV->GetPage() : 0);
     599                 :            : 
     600         [ #  # ]:          0 :         pTextEditOutliner->SetTextObjNoInit( dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ) );
     601                 :            : 
     602         [ #  # ]:          0 :         if(mxTextEditObj->BegTextEdit(*pTextEditOutliner))
     603                 :            :         {
     604         [ #  # ]:          0 :             SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
     605                 :            :             DBG_ASSERT( pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?" );
     606         [ #  # ]:          0 :             if( !pTextObj )
     607                 :          0 :                 return sal_False;
     608                 :            : 
     609                 :            :             // switch off any running TextAnimations
     610         [ #  # ]:          0 :             pTextObj->SetTextAnimationAllowed(sal_False);
     611                 :            : 
     612                 :            :             // remember old cursor
     613 [ #  # ][ #  # ]:          0 :             if (pTextEditOutliner->GetViewCount()!=0)
     614                 :            :             {
     615         [ #  # ]:          0 :                 OutlinerView* pTmpOLV=pTextEditOutliner->RemoveView(static_cast<size_t>(0));
     616 [ #  # ][ #  # ]:          0 :                 if(pTmpOLV!=NULL && pTmpOLV!=pGivenOutlinerView)
     617 [ #  # ][ #  # ]:          0 :                     delete pTmpOLV;
     618                 :            :             }
     619                 :            : 
     620                 :            :             // Determine EditArea via TakeTextEditArea.
     621                 :            :             // TODO: This could theoretically be left out, because TakeTextRect() calculates the aTextEditArea,
     622                 :            :             // but aMinTextEditArea has to happen, too (therefore leaving this in right now)
     623         [ #  # ]:          0 :             pTextObj->TakeTextEditArea(NULL,NULL,&aTextEditArea,&aMinTextEditArea);
     624                 :            : 
     625         [ #  # ]:          0 :             Rectangle aTextRect;
     626         [ #  # ]:          0 :             Rectangle aAnchorRect;
     627                 :            :             pTextObj->TakeTextRect(*pTextEditOutliner, aTextRect, sal_True,
     628         [ #  # ]:          0 :                 &aAnchorRect /* Give sal_True here, not sal_False */);
     629                 :            : 
     630 [ #  # ][ #  # ]:          0 :             if ( !pTextObj->IsContourTextFrame() )
     631                 :            :             {
     632                 :            :                 // FitToSize not together with ContourFrame, for now
     633 [ #  # ][ #  # ]:          0 :                 if (pTextObj->IsFitToSize())
     634                 :          0 :                     aTextRect = aAnchorRect;
     635                 :            :             }
     636                 :            : 
     637                 :          0 :             aTextEditArea = aTextRect;
     638                 :            : 
     639                 :          0 :             Point aPvOfs(pTextObj->GetTextEditOffset());
     640                 :            : 
     641         [ #  # ]:          0 :             aTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
     642         [ #  # ]:          0 :             aMinTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
     643         [ #  # ]:          0 :             pTextEditCursorMerker=pWin->GetCursor();
     644                 :            : 
     645         [ #  # ]:          0 :             aHdl.SetMoveOutside(sal_True);
     646                 :            : 
     647                 :            :             // #i72757#
     648                 :            :             // Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
     649                 :            :             // to call AdjustMarkHdl() always.
     650         [ #  # ]:          0 :             AdjustMarkHdl();
     651                 :            : 
     652         [ #  # ]:          0 :             pTextEditOutlinerView=ImpMakeOutlinerView(pWin,!bEmpty,pGivenOutlinerView);
     653                 :            : 
     654                 :            :             // check if this view is already inserted
     655         [ #  # ]:          0 :             sal_uIntPtr i2,nCount = pTextEditOutliner->GetViewCount();
     656         [ #  # ]:          0 :             for( i2 = 0; i2 < nCount; i2++ )
     657                 :            :             {
     658 [ #  # ][ #  # ]:          0 :                 if( pTextEditOutliner->GetView(i2) == pTextEditOutlinerView )
     659                 :          0 :                     break;
     660                 :            :             }
     661                 :            : 
     662         [ #  # ]:          0 :             if( i2 == nCount )
     663         [ #  # ]:          0 :                 pTextEditOutliner->InsertView(pTextEditOutlinerView,0);
     664                 :            : 
     665         [ #  # ]:          0 :             aHdl.SetMoveOutside(sal_False);
     666         [ #  # ]:          0 :             aHdl.SetMoveOutside(sal_True);
     667                 :            : 
     668                 :            :             // register all windows as OutlinerViews with the Outliner
     669         [ #  # ]:          0 :             if(!bOnlyOneView)
     670                 :            :             {
     671         [ #  # ]:          0 :                 for(i = 0L; i < nWinAnz; i++)
     672                 :            :                 {
     673         [ #  # ]:          0 :                     SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
     674                 :          0 :                     OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
     675                 :            : 
     676 [ #  # ][ #  # ]:          0 :                     if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
                 [ #  # ]
     677                 :            :                     {
     678         [ #  # ]:          0 :                         OutlinerView* pOutlView = ImpMakeOutlinerView((Window*)(&rOutDev), !bEmpty, 0L);
     679         [ #  # ]:          0 :                         pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i);
     680                 :            :                     }
     681                 :            :                 }
     682                 :            :             }
     683                 :            : 
     684         [ #  # ]:          0 :             pTextEditOutlinerView->ShowCursor();
     685 [ #  # ][ #  # ]:          0 :             pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
     686                 :            : #ifdef DBG_UTIL
     687                 :            :             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
     688                 :            : #endif
     689         [ #  # ]:          0 :             pTextEditOutliner->ClearModifyFlag();
     690                 :            : 
     691         [ #  # ]:          0 :             if(pWin)
     692                 :            :             {
     693                 :          0 :                 sal_Bool bExtraInvalidate(sal_False);
     694                 :            : 
     695         [ #  # ]:          0 :                 if(!bExtraInvalidate)
     696                 :            :                 {
     697 [ #  # ][ #  # ]:          0 :                     if(pTextObj->IsFitToSize())
     698                 :          0 :                         bExtraInvalidate = sal_True;
     699                 :            :                 }
     700                 :            : 
     701         [ #  # ]:          0 :                 if(bExtraInvalidate)
     702                 :            :                 {
     703         [ #  # ]:          0 :                     pWin->Invalidate(aTextEditArea);
     704                 :            :                 }
     705                 :            :             }
     706                 :            : 
     707         [ #  # ]:          0 :             if( GetModel() )
     708                 :            :             {
     709         [ #  # ]:          0 :                 SdrHint aHint(*pTextObj);
     710         [ #  # ]:          0 :                 aHint.SetKind(HINT_BEGEDIT);
     711 [ #  # ][ #  # ]:          0 :                 GetModel()->Broadcast(aHint);
     712                 :            :             }
     713                 :            : 
     714                 :          0 :             pTextEditOutliner->setVisualizedPage(0);
     715                 :            : 
     716         [ #  # ]:          0 :             if( mxSelectionController.is() )
     717         [ #  # ]:          0 :                 mxSelectionController->onSelectionHasChanged();
     718                 :            : 
     719                 :          0 :             return sal_True; // ran fine, let TextEdit run now
     720                 :            :         }
     721                 :            :         else
     722                 :            :         {
     723                 :          0 :             bBrk = sal_True;
     724                 :          0 :             pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
     725         [ #  # ]:          0 :             pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
     726         [ #  # ]:          0 :             pTextEditOutliner->SetEndPasteOrDropHdl(Link());
     727                 :            : 
     728                 :            :         }
     729                 :            :     }
     730         [ #  # ]:          0 :     if (pTextEditOutliner != NULL)
     731                 :            :     {
     732                 :          0 :         pTextEditOutliner->setVisualizedPage(0);
     733                 :            :     }
     734                 :            : 
     735                 :            :     // something went wrong...
     736         [ #  # ]:          0 :     if(!bDontDeleteOutliner)
     737                 :            :     {
     738         [ #  # ]:          0 :         if(pGivenOutliner!=NULL)
     739                 :            :         {
     740         [ #  # ]:          0 :             delete pGivenOutliner;
     741                 :          0 :             pTextEditOutliner = NULL;
     742                 :            :         }
     743         [ #  # ]:          0 :         if(pGivenOutlinerView!=NULL)
     744                 :            :         {
     745         [ #  # ]:          0 :             delete pGivenOutlinerView;
     746                 :          0 :             pGivenOutlinerView = NULL;
     747                 :            :         }
     748                 :            :     }
     749         [ #  # ]:          0 :     if( pTextEditOutliner!=NULL )
     750                 :            :     {
     751         [ #  # ]:          0 :         delete pTextEditOutliner;
     752                 :            :     }
     753                 :            : 
     754                 :          0 :     pTextEditOutliner=NULL;
     755                 :          0 :     pTextEditOutlinerView=NULL;
     756                 :          0 :     mxTextEditObj.reset(0);
     757                 :          0 :     pTextEditPV=NULL;
     758                 :          0 :     pTextEditWin=NULL;
     759                 :          0 :     aHdl.SetMoveOutside(sal_False);
     760                 :            : 
     761                 :          0 :     return sal_False;
     762                 :            : }
     763                 :            : 
     764                 :       1192 : SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
     765                 :            : {
     766                 :       1192 :     SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
     767         [ +  - ]:       1192 :     SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
     768                 :       1192 :     Window*       pTEWin         =pTextEditWin;
     769                 :       1192 :     SdrOutliner*  pTEOutliner    =pTextEditOutliner;
     770                 :       1192 :     OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
     771                 :       1192 :     Cursor*       pTECursorMerker=pTextEditCursorMerker;
     772                 :            : 
     773 [ +  - ][ -  + ]:       1192 :     if( GetModel() && mxTextEditObj.is() )
                 [ -  + ]
     774                 :            :     {
     775         [ #  # ]:          0 :         SdrHint aHint(*mxTextEditObj.get());
     776         [ #  # ]:          0 :         aHint.SetKind(HINT_ENDEDIT);
     777 [ #  # ][ #  # ]:          0 :         GetModel()->Broadcast(aHint);
     778                 :            :     }
     779                 :            : 
     780                 :       1192 :     mxTextEditObj.reset(0);
     781                 :       1192 :     pTextEditPV=NULL;
     782                 :       1192 :     pTextEditWin=NULL;
     783                 :       1192 :     pTextEditOutliner=NULL;
     784                 :       1192 :     pTextEditOutlinerView=NULL;
     785                 :       1192 :     pTextEditCursorMerker=NULL;
     786                 :       1192 :     aTextEditArea=Rectangle();
     787                 :            : 
     788         [ -  + ]:       1192 :     if (pTEOutliner!=NULL)
     789                 :            :     {
     790                 :          0 :         sal_Bool bModified=pTEOutliner->IsModified();
     791         [ #  # ]:          0 :         if (pTEOutlinerView!=NULL)
     792                 :            :         {
     793                 :          0 :             pTEOutlinerView->HideCursor();
     794                 :            :         }
     795         [ #  # ]:          0 :         if (pTEObj!=NULL)
     796                 :            :         {
     797                 :          0 :             pTEOutliner->CompleteOnlineSpelling();
     798                 :            : 
     799                 :          0 :             SdrUndoObjSetText* pTxtUndo = 0;
     800                 :            : 
     801         [ #  # ]:          0 :             if( bModified )
     802                 :            :             {
     803                 :            :                 sal_Int32 nText;
     804         [ #  # ]:          0 :                 for( nText = 0; nText < pTEObj->getTextCount(); ++nText )
     805         [ #  # ]:          0 :                     if( pTEObj->getText( nText ) == pTEObj->getActiveText() )
     806                 :          0 :                         break;
     807                 :            : 
     808         [ #  # ]:          0 :                 pTxtUndo = dynamic_cast< SdrUndoObjSetText* >( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTEObj, nText ) );
     809                 :            :             }
     810                 :            :             DBG_ASSERT( !bModified || pTxtUndo, "svx::SdrObjEditView::EndTextEdit(), could not create undo action!" );
     811                 :            :             // Set old CalcFieldValue-Handler again, this
     812                 :            :             // has to happen before Obj::EndTextEdit(), as this does UpdateFields().
     813                 :          0 :             pTEOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
     814         [ #  # ]:          0 :             pTEOutliner->SetBeginPasteOrDropHdl(Link());
     815         [ #  # ]:          0 :             pTEOutliner->SetEndPasteOrDropHdl(Link());
     816                 :            : 
     817                 :          0 :             const bool bUndo = IsUndoEnabled();
     818         [ #  # ]:          0 :             if( bUndo )
     819                 :            :             {
     820         [ #  # ]:          0 :                 XubString aObjName;
     821         [ #  # ]:          0 :                 pTEObj->TakeObjNameSingul(aObjName);
     822 [ #  # ][ #  # ]:          0 :                 BegUndo(ImpGetResStr(STR_UndoObjSetText),aObjName);
         [ #  # ][ #  # ]
     823                 :            :             }
     824                 :            : 
     825                 :          0 :             pTEObj->EndTextEdit(*pTEOutliner);
     826                 :            : 
     827 [ #  # ][ #  # ]:          0 :             if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && pTEObj->ISA(SdrTextObj) && ((SdrTextObj*)pTEObj)->IsFontwork())  )
         [ #  # ][ #  # ]
                 [ #  # ]
     828                 :            :             {
     829                 :          0 :                 pTEObj->ActionChanged();
     830                 :            :             }
     831                 :            : 
     832         [ #  # ]:          0 :             if (pTxtUndo!=NULL)
     833                 :            :             {
     834                 :          0 :                 pTxtUndo->AfterSetText();
     835         [ #  # ]:          0 :                 if (!pTxtUndo->IsDifferent())
     836                 :            :                 {
     837         [ #  # ]:          0 :                     delete pTxtUndo;
     838                 :          0 :                     pTxtUndo=NULL;
     839                 :            :                 }
     840                 :            :             }
     841                 :            :             // check deletion of entire TextObj
     842                 :          0 :             SdrUndoAction* pDelUndo=NULL;
     843                 :          0 :             sal_Bool bDelObj=sal_False;
     844 [ #  # ][ #  # ]:          0 :             SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pTEObj);
     845 [ #  # ][ #  # ]:          0 :             if (pTextObj!=NULL && bTextEditNewObj)
     846                 :            :             {
     847                 :          0 :                 bDelObj=pTextObj->IsTextFrame() &&
     848                 :          0 :                         !pTextObj->HasText() &&
     849                 :          0 :                         !pTextObj->IsEmptyPresObj() &&
     850                 :          0 :                         !pTextObj->HasFill() &&
     851 [ #  # ][ #  #  :          0 :                         !pTextObj->HasLine();
          #  #  #  #  #  
                      # ]
     852                 :            : 
     853 [ #  # ][ #  # ]:          0 :                 if(pTEObj->IsInserted() && bDelObj && pTextObj->GetObjInventor()==SdrInventor && !bDontDeleteReally)
         [ #  # ][ #  # ]
                 [ #  # ]
     854                 :            :                 {
     855                 :          0 :                     SdrObjKind eIdent=(SdrObjKind)pTextObj->GetObjIdentifier();
     856 [ #  # ][ #  # ]:          0 :                     if(eIdent==OBJ_TEXT || eIdent==OBJ_TEXTEXT)
     857                 :            :                     {
     858                 :          0 :                         pDelUndo= GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
     859                 :            :                     }
     860                 :            :                 }
     861                 :            :             }
     862         [ #  # ]:          0 :             if (pTxtUndo!=NULL)
     863                 :            :             {
     864         [ #  # ]:          0 :                 if( bUndo )
     865                 :          0 :                     AddUndo(pTxtUndo);
     866                 :          0 :                 eRet=SDRENDTEXTEDIT_CHANGED;
     867                 :            :             }
     868         [ #  # ]:          0 :             if (pDelUndo!=NULL)
     869                 :            :             {
     870         [ #  # ]:          0 :                 if( bUndo )
     871                 :            :                 {
     872                 :          0 :                     AddUndo(pDelUndo);
     873                 :            :                 }
     874                 :            :                 else
     875                 :            :                 {
     876         [ #  # ]:          0 :                     delete pDelUndo;
     877                 :            :                 }
     878                 :          0 :                 eRet=SDRENDTEXTEDIT_DELETED;
     879                 :            :                 DBG_ASSERT(pTEObj->GetObjList()!=NULL,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!");
     880         [ #  # ]:          0 :                 if (pTEObj->GetObjList()!=NULL)
     881                 :            :                 {
     882                 :          0 :                     pTEObj->GetObjList()->RemoveObject(pTEObj->GetOrdNum());
     883                 :          0 :                     CheckMarked(); // remove selection immediately...
     884                 :            :                 }
     885                 :            :             }
     886         [ #  # ]:          0 :             else if (bDelObj)
     887                 :            :             { // for Writer: the app has to do the deletion itself.
     888                 :          0 :                 eRet=SDRENDTEXTEDIT_SHOULDBEDELETED;
     889                 :            :             }
     890                 :            : 
     891         [ #  # ]:          0 :             if( bUndo )
     892                 :          0 :                 EndUndo(); // EndUndo after Remove, in case UndoStack is deleted immediately
     893                 :            : 
     894                 :            :             // Switch on any TextAnimation again after TextEdit
     895         [ #  # ]:          0 :             if(pTEObj->ISA(SdrTextObj))
     896                 :            :             {
     897                 :          0 :                 ((SdrTextObj*)pTEObj)->SetTextAnimationAllowed(sal_True);
     898                 :            :             }
     899                 :            : 
     900                 :            :             // #i72757#
     901                 :            :             // Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
     902                 :            :             // to call AdjustMarkHdl() always.
     903                 :          0 :             AdjustMarkHdl();
     904                 :            :         }
     905                 :            :         // delete all OutlinerViews
     906         [ #  # ]:          0 :         for (sal_uIntPtr i=pTEOutliner->GetViewCount(); i>0;)
     907                 :            :         {
     908                 :          0 :             i--;
     909         [ #  # ]:          0 :             OutlinerView* pOLV=pTEOutliner->GetView(i);
     910         [ #  # ]:          0 :             sal_uInt16 nMorePix=pOLV->GetInvalidateMore() + 10;
     911         [ #  # ]:          0 :             Window* pWin=pOLV->GetWindow();
     912         [ #  # ]:          0 :             Rectangle aRect(pOLV->GetOutputArea());
     913         [ #  # ]:          0 :             pTEOutliner->RemoveView(i);
     914 [ #  # ][ #  # ]:          0 :             if (!bTextEditDontDelete || i!=0)
     915                 :            :             {
     916                 :            :                 // may not own the zeroth one
     917 [ #  # ][ #  # ]:          0 :                 delete pOLV;
     918                 :            :             }
     919         [ #  # ]:          0 :             aRect.Union(aTextEditArea);
     920         [ #  # ]:          0 :             aRect.Union(aMinTextEditArea);
     921         [ #  # ]:          0 :             aRect=pWin->LogicToPixel(aRect);
     922                 :          0 :             aRect.Left()-=nMorePix;
     923                 :          0 :             aRect.Top()-=nMorePix;
     924                 :          0 :             aRect.Right()+=nMorePix;
     925                 :          0 :             aRect.Bottom()+=nMorePix;
     926         [ #  # ]:          0 :             aRect=pWin->PixelToLogic(aRect);
     927         [ #  # ]:          0 :             InvalidateOneWin(*pWin,aRect);
     928         [ #  # ]:          0 :             pWin->SetFillColor();
     929         [ #  # ]:          0 :             pWin->SetLineColor(COL_BLACK);
     930         [ #  # ]:          0 :             pWin->DrawPixel(aRect.TopLeft());
     931 [ #  # ][ #  # ]:          0 :             pWin->DrawPixel(aRect.TopRight());
     932 [ #  # ][ #  # ]:          0 :             pWin->DrawPixel(aRect.BottomLeft());
     933 [ #  # ][ #  # ]:          0 :             pWin->DrawPixel(aRect.BottomRight());
     934                 :            :         }
     935                 :            :         // and now the Outliner itself
     936 [ #  # ][ #  # ]:          0 :         if (!bTextEditDontDelete) delete pTEOutliner;
     937                 :          0 :         else pTEOutliner->Clear();
     938         [ #  # ]:          0 :         if (pTEWin!=NULL) {
     939                 :          0 :             pTEWin->SetCursor(pTECursorMerker);
     940                 :            :         }
     941                 :          0 :         aHdl.SetMoveOutside(sal_False);
     942         [ #  # ]:          0 :         if (eRet!=SDRENDTEXTEDIT_UNCHANGED)
     943                 :            :         {
     944                 :          0 :             GetMarkedObjectListWriteAccess().SetNameDirty();
     945                 :            :         }
     946                 :            : #ifdef DBG_UTIL
     947                 :            :         if (pItemBrowser)
     948                 :            :         {
     949                 :            :             GetMarkedObjectListWriteAccess().SetNameDirty();
     950                 :            :             pItemBrowser->SetDirty();
     951                 :            :         }
     952                 :            : #endif
     953                 :            :     }
     954                 :            : 
     955   [ -  +  #  #  :       1192 :     if( pTEObj &&
             #  #  #  # ]
                 [ -  + ]
     956                 :          0 :         pTEObj->GetModel() &&
     957                 :          0 :         !pTEObj->GetModel()->isLocked() &&
     958                 :          0 :         pTEObj->GetBroadcaster())
     959                 :            :     {
     960         [ #  # ]:          0 :         SdrHint aHint(HINT_ENDEDIT);
     961         [ #  # ]:          0 :         aHint.SetObject(pTEObj);
     962 [ #  # ][ #  # ]:          0 :         ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
                 [ #  # ]
     963                 :            :     }
     964                 :            : 
     965                 :       1192 :     return eRet;
     966                 :            : }
     967                 :            : 
     968                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     969                 :            : // info about TextEdit. Default is sal_False.
     970                 :      54721 : bool SdrObjEditView::IsTextEdit() const
     971                 :            : {
     972                 :      54721 :     return mxTextEditObj.is();
     973                 :            : }
     974                 :            : 
     975                 :            : // info about TextEditPageView. Default is 0L.
     976                 :          0 : SdrPageView* SdrObjEditView::GetTextEditPageView() const
     977                 :            : {
     978                 :          0 :     return pTextEditPV;
     979                 :            : }
     980                 :            : 
     981                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     982                 :            : 
     983                 :          0 : OutlinerView* SdrObjEditView::ImpFindOutlinerView(Window* pWin) const
     984                 :            : {
     985         [ #  # ]:          0 :     if (pWin==NULL) return NULL;
     986         [ #  # ]:          0 :     if (pTextEditOutliner==NULL) return NULL;
     987                 :          0 :     OutlinerView* pNewView=NULL;
     988                 :          0 :     sal_uIntPtr nWinAnz=pTextEditOutliner->GetViewCount();
     989 [ #  # ][ #  # ]:          0 :     for (sal_uIntPtr i=0; i<nWinAnz && pNewView==NULL; i++) {
                 [ #  # ]
     990                 :          0 :         OutlinerView* pView=pTextEditOutliner->GetView(i);
     991         [ #  # ]:          0 :         if (pView->GetWindow()==pWin) pNewView=pView;
     992                 :            :     }
     993                 :          0 :     return pNewView;
     994                 :            : }
     995                 :            : 
     996                 :          0 : void SdrObjEditView::SetTextEditWin(Window* pWin)
     997                 :            : {
     998 [ #  # ][ #  # ]:          0 :     if(mxTextEditObj.is() && pWin!=NULL && pWin!=pTextEditWin)
         [ #  # ][ #  # ]
     999                 :            :     {
    1000                 :          0 :         OutlinerView* pNewView=ImpFindOutlinerView(pWin);
    1001 [ #  # ][ #  # ]:          0 :         if (pNewView!=NULL && pNewView!=pTextEditOutlinerView)
    1002                 :            :         {
    1003         [ #  # ]:          0 :             if (pTextEditOutlinerView!=NULL)
    1004                 :            :             {
    1005                 :          0 :                 pTextEditOutlinerView->HideCursor();
    1006                 :            :             }
    1007                 :          0 :             pTextEditOutlinerView=pNewView;
    1008                 :          0 :             pTextEditWin=pWin;
    1009                 :          0 :             pWin->GrabFocus(); // Make the cursor blink here as well
    1010                 :          0 :             pNewView->ShowCursor();
    1011                 :          0 :             ImpMakeTextCursorAreaVisible();
    1012                 :            :         }
    1013                 :            :     }
    1014                 :          0 : }
    1015                 :            : 
    1016                 :        405 : sal_Bool SdrObjEditView::IsTextEditHit(const Point& rHit, short nTol) const
    1017                 :            : {
    1018                 :        405 :     sal_Bool bOk=sal_False;
    1019         [ -  + ]:        405 :     if(mxTextEditObj.is())
    1020                 :            :     {
    1021                 :          0 :         nTol=ImpGetHitTolLogic(nTol,NULL);
    1022                 :            :         // only a third of the tolerance here, so handles can be hit well
    1023                 :          0 :         nTol=nTol/3;
    1024                 :          0 :         nTol=0; // no hit tolerance here any more
    1025         [ #  # ]:          0 :         if (!bOk)
    1026                 :            :         {
    1027         [ #  # ]:          0 :             Rectangle aEditArea;
    1028         [ #  # ]:          0 :             OutlinerView* pOLV=pTextEditOutliner->GetView(0);
    1029         [ #  # ]:          0 :             if (pOLV!=NULL)
    1030                 :            :             {
    1031 [ #  # ][ #  # ]:          0 :                 aEditArea.Union(pOLV->GetOutputArea());
    1032                 :            :             }
    1033                 :          0 :             aEditArea.Left()-=nTol;
    1034                 :          0 :             aEditArea.Top()-=nTol;
    1035                 :          0 :             aEditArea.Right()+=nTol;
    1036                 :          0 :             aEditArea.Bottom()+=nTol;
    1037         [ #  # ]:          0 :             bOk=aEditArea.IsInside(rHit);
    1038         [ #  # ]:          0 :             if (bOk)
    1039                 :            :             { // check if any characters were actually hit
    1040                 :          0 :                 Point aPnt(rHit); aPnt-=aEditArea.TopLeft();
    1041                 :          0 :                 long nHitTol = 2000;
    1042         [ #  # ]:          0 :                 OutputDevice* pRef = pTextEditOutliner->GetRefDevice();
    1043         [ #  # ]:          0 :                 if( pRef )
    1044         [ #  # ]:          0 :                     nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() );
    1045                 :            : 
    1046         [ #  # ]:          0 :                 bOk = pTextEditOutliner->IsTextPos( aPnt, (sal_uInt16)nHitTol );
    1047                 :            :             }
    1048                 :            :         }
    1049                 :            :     }
    1050                 :        405 :     return bOk;
    1051                 :            : }
    1052                 :            : 
    1053                 :       1588 : sal_Bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
    1054                 :            : {
    1055                 :       1588 :     sal_Bool bOk=sal_False;
    1056         [ -  + ]:       1588 :     if(mxTextEditObj.is())
    1057                 :            :     {
    1058         [ #  # ]:          0 :         SdrTextObj* pText= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
    1059                 :          0 :         OutlinerView* pOLV=pTextEditOutliner->GetView(0);
    1060         [ #  # ]:          0 :         if( pOLV )
    1061                 :            :         {
    1062                 :          0 :             Window* pWin=pOLV->GetWindow();
    1063 [ #  # ][ #  # ]:          0 :             if (pText!=NULL && pText->IsTextFrame() && pOLV!=NULL && pWin!=NULL) {
         [ #  # ][ #  # ]
                 [ #  # ]
    1064         [ #  # ]:          0 :                 sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
    1065                 :          0 :                 Rectangle aEditArea(aMinTextEditArea);
    1066 [ #  # ][ #  # ]:          0 :                 aEditArea.Union(pOLV->GetOutputArea());
    1067 [ #  # ][ #  # ]:          0 :                 if (!aEditArea.IsInside(rHit)) {
    1068         [ #  # ]:          0 :                     Size aSiz(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
    1069                 :          0 :                     aEditArea.Left()-=aSiz.Width();
    1070                 :          0 :                     aEditArea.Top()-=aSiz.Height();
    1071                 :          0 :                     aEditArea.Right()+=aSiz.Width();
    1072                 :          0 :                     aEditArea.Bottom()+=aSiz.Height();
    1073         [ #  # ]:          0 :                     bOk=aEditArea.IsInside(rHit);
    1074                 :            :                 }
    1075                 :            :             }
    1076                 :            :         }
    1077                 :            :     }
    1078                 :       1588 :     return bOk;
    1079                 :            : }
    1080                 :            : 
    1081                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1082                 :            : 
    1083                 :          0 : sal_Bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
    1084                 :            : {
    1085         [ #  # ]:          0 :     if(pTextEditOutlinerView)
    1086                 :            :     {
    1087         [ #  # ]:          0 :         if (pTextEditOutlinerView->PostKeyEvent(rKEvt, pWin))
    1088                 :            :         {
    1089         [ #  # ]:          0 :             if( pMod )
    1090                 :            :             {
    1091 [ #  # ][ #  # ]:          0 :                 if( pTextEditOutliner && pTextEditOutliner->IsModified() )
                 [ #  # ]
    1092                 :          0 :                     pMod->SetChanged( sal_True );
    1093                 :            :             }
    1094                 :            : 
    1095 [ #  # ][ #  # ]:          0 :             if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
    1096                 :            : #ifdef DBG_UTIL
    1097                 :            :             if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1098                 :            : #endif
    1099                 :          0 :             ImpMakeTextCursorAreaVisible();
    1100                 :          0 :             return sal_True;
    1101                 :            :         }
    1102                 :            :     }
    1103                 :          0 :     return SdrGlueEditView::KeyInput(rKEvt,pWin);
    1104                 :            : }
    1105                 :            : 
    1106                 :          0 : sal_Bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
    1107                 :            : {
    1108         [ #  # ]:          0 :     if (pTextEditOutlinerView!=NULL) {
    1109                 :          0 :         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
    1110         [ #  # ]:          0 :         if (!bPostIt) {
    1111                 :          0 :             Point aPt(rMEvt.GetPosPixel());
    1112 [ #  # ][ #  # ]:          0 :             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
    1113 [ #  # ][ #  # ]:          0 :             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
    1114         [ #  # ]:          0 :             bPostIt=IsTextEditHit(aPt,nHitTolLog);
    1115                 :            :         }
    1116         [ #  # ]:          0 :         if (bPostIt) {
    1117                 :          0 :             Point aPixPos(rMEvt.GetPosPixel());
    1118 [ #  # ][ #  # ]:          0 :             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
    1119         [ #  # ]:          0 :             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
    1120         [ #  # ]:          0 :             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
    1121         [ #  # ]:          0 :             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
    1122         [ #  # ]:          0 :             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
    1123                 :          0 :             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
    1124         [ #  # ]:          0 :                              rMEvt.GetButtons(),rMEvt.GetModifier());
    1125 [ #  # ][ #  # ]:          0 :             if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
    1126 [ #  # ][ #  # ]:          0 :                 if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
                 [ #  # ]
    1127                 :            : #ifdef DBG_UTIL
    1128                 :            :                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1129                 :            : #endif
    1130         [ #  # ]:          0 :                 ImpMakeTextCursorAreaVisible();
    1131                 :          0 :                 return sal_True;
    1132                 :            :             }
    1133                 :            :         }
    1134                 :            :     }
    1135                 :          0 :     return SdrGlueEditView::MouseButtonDown(rMEvt,pWin);
    1136                 :            : }
    1137                 :            : 
    1138                 :          0 : sal_Bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
    1139                 :            : {
    1140         [ #  # ]:          0 :     if (pTextEditOutlinerView!=NULL) {
    1141                 :          0 :         sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
    1142         [ #  # ]:          0 :         if (!bPostIt) {
    1143                 :          0 :             Point aPt(rMEvt.GetPosPixel());
    1144 [ #  # ][ #  # ]:          0 :             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
    1145 [ #  # ][ #  # ]:          0 :             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
    1146         [ #  # ]:          0 :             bPostIt=IsTextEditHit(aPt,nHitTolLog);
    1147                 :            :         }
    1148         [ #  # ]:          0 :         if (bPostIt) {
    1149                 :          0 :             Point aPixPos(rMEvt.GetPosPixel());
    1150 [ #  # ][ #  # ]:          0 :             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
    1151         [ #  # ]:          0 :             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
    1152         [ #  # ]:          0 :             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
    1153         [ #  # ]:          0 :             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
    1154         [ #  # ]:          0 :             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
    1155                 :          0 :             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
    1156         [ #  # ]:          0 :                              rMEvt.GetButtons(),rMEvt.GetModifier());
    1157 [ #  # ][ #  # ]:          0 :             if (pTextEditOutlinerView->MouseButtonUp(aMEvt)) {
    1158                 :            : #ifdef DBG_UTIL
    1159                 :            :                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1160                 :            : #endif
    1161         [ #  # ]:          0 :                 ImpMakeTextCursorAreaVisible();
    1162                 :          0 :                 return sal_True;
    1163                 :            :             }
    1164                 :            :         }
    1165                 :            :     }
    1166                 :          0 :     return SdrGlueEditView::MouseButtonUp(rMEvt,pWin);
    1167                 :            : }
    1168                 :            : 
    1169                 :          0 : sal_Bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
    1170                 :            : {
    1171         [ #  # ]:          0 :     if (pTextEditOutlinerView!=NULL) {
    1172                 :          0 :         sal_Bool bSelMode=pTextEditOutliner->IsInSelectionMode();
    1173                 :          0 :         sal_Bool bPostIt=bSelMode;
    1174         [ #  # ]:          0 :         if (!bPostIt) {
    1175                 :          0 :             Point aPt(rMEvt.GetPosPixel());
    1176 [ #  # ][ #  # ]:          0 :             if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
    1177 [ #  # ][ #  # ]:          0 :             else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
    1178         [ #  # ]:          0 :             bPostIt=IsTextEditHit(aPt,nHitTolLog);
    1179                 :            :         }
    1180         [ #  # ]:          0 :         if (bPostIt) {
    1181                 :          0 :             Point aPixPos(rMEvt.GetPosPixel());
    1182 [ #  # ][ #  # ]:          0 :             Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
    1183         [ #  # ]:          0 :             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
    1184         [ #  # ]:          0 :             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
    1185         [ #  # ]:          0 :             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
    1186         [ #  # ]:          0 :             if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
    1187                 :          0 :             MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
    1188         [ #  # ]:          0 :                              rMEvt.GetButtons(),rMEvt.GetModifier());
    1189 [ #  # ][ #  # ]:          0 :             if (pTextEditOutlinerView->MouseMove(aMEvt) && bSelMode) {
         [ #  # ][ #  # ]
    1190                 :            : #ifdef DBG_UTIL
    1191                 :            :                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1192                 :            : #endif
    1193         [ #  # ]:          0 :                 ImpMakeTextCursorAreaVisible();
    1194                 :          0 :                 return sal_True;
    1195                 :            :             }
    1196                 :            :         }
    1197                 :            :     }
    1198                 :          0 :     return SdrGlueEditView::MouseMove(rMEvt,pWin);
    1199                 :            : }
    1200                 :            : 
    1201                 :          0 : sal_Bool SdrObjEditView::Command(const CommandEvent& rCEvt, Window* pWin)
    1202                 :            : {
    1203                 :            :     // as long as OutlinerView returns a sal_Bool, it only gets COMMAND_STARTDRAG
    1204         [ #  # ]:          0 :     if (pTextEditOutlinerView!=NULL)
    1205                 :            :     {
    1206         [ #  # ]:          0 :         if (rCEvt.GetCommand()==COMMAND_STARTDRAG) {
    1207 [ #  # ][ #  # ]:          0 :             sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode() || !rCEvt.IsMouseEvent();
    1208 [ #  # ][ #  # ]:          0 :             if (!bPostIt && rCEvt.IsMouseEvent()) {
                 [ #  # ]
    1209                 :          0 :                 Point aPt(rCEvt.GetMousePosPixel());
    1210 [ #  # ][ #  # ]:          0 :                 if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
    1211 [ #  # ][ #  # ]:          0 :                 else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
    1212         [ #  # ]:          0 :                 bPostIt=IsTextEditHit(aPt,nHitTolLog);
    1213                 :            :             }
    1214         [ #  # ]:          0 :             if (bPostIt) {
    1215                 :          0 :                 Point aPixPos(rCEvt.GetMousePosPixel());
    1216         [ #  # ]:          0 :                 if (rCEvt.IsMouseEvent()) {
    1217 [ #  # ][ #  # ]:          0 :                     Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
    1218         [ #  # ]:          0 :                     if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
    1219         [ #  # ]:          0 :                     if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
    1220         [ #  # ]:          0 :                     if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
    1221         [ #  # ]:          0 :                     if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
    1222                 :            :                 }
    1223         [ #  # ]:          0 :                 CommandEvent aCEvt(aPixPos,rCEvt.GetCommand(),rCEvt.IsMouseEvent());
    1224                 :            :                 // Command is void at the OutlinerView, sadly
    1225         [ #  # ]:          0 :                 pTextEditOutlinerView->Command(aCEvt);
    1226 [ #  # ][ #  # ]:          0 :                 if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
                 [ #  # ]
    1227                 :            : #ifdef DBG_UTIL
    1228                 :            :                 if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1229                 :            : #endif
    1230         [ #  # ]:          0 :                 ImpMakeTextCursorAreaVisible();
    1231                 :          0 :                 return sal_True;
    1232                 :            :             }
    1233                 :            :         }
    1234                 :            :         else
    1235                 :            :         {
    1236                 :          0 :             pTextEditOutlinerView->Command(rCEvt);
    1237                 :          0 :             return sal_True;
    1238                 :            :         }
    1239                 :            :     }
    1240                 :          0 :     return SdrGlueEditView::Command(rCEvt,pWin);
    1241                 :            : }
    1242                 :            : 
    1243                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1244                 :            : 
    1245                 :          0 : sal_Bool SdrObjEditView::ImpIsTextEditAllSelected() const
    1246                 :            : {
    1247                 :          0 :     sal_Bool bRet=sal_False;
    1248 [ #  # ][ #  # ]:          0 :     if (pTextEditOutliner!=NULL && pTextEditOutlinerView!=NULL)
    1249                 :            :     {
    1250         [ #  # ]:          0 :         if(SdrTextObj::HasTextImpl( pTextEditOutliner ) )
    1251                 :            :         {
    1252         [ #  # ]:          0 :             const sal_uInt32 nParaAnz=pTextEditOutliner->GetParagraphCount();
    1253 [ #  # ][ #  # ]:          0 :             Paragraph* pLastPara=pTextEditOutliner->GetParagraph( nParaAnz > 1 ? nParaAnz - 1 : 0 );
    1254                 :            : 
    1255         [ #  # ]:          0 :             ESelection aESel(pTextEditOutlinerView->GetSelection());
    1256 [ #  # ][ #  # ]:          0 :             if (aESel.nStartPara==0 && aESel.nStartPos==0 && aESel.nEndPara==sal_uInt16(nParaAnz-1))
                 [ #  # ]
    1257                 :            :             {
    1258         [ #  # ]:          0 :                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
    1259                 :            : 
    1260         [ #  # ]:          0 :                 if(aStr.Len() == aESel.nEndPos)
    1261         [ #  # ]:          0 :                     bRet = sal_True;
    1262                 :            :             }
    1263                 :            :             // in case the selection was done backwards
    1264 [ #  # ][ #  # ]:          0 :             if (!bRet && aESel.nEndPara==0 && aESel.nEndPos==0 && aESel.nStartPara==sal_uInt16(nParaAnz-1))
         [ #  # ][ #  # ]
    1265                 :            :             {
    1266         [ #  # ]:          0 :                 XubString aStr(pTextEditOutliner->GetText(pLastPara));
    1267                 :            : 
    1268         [ #  # ]:          0 :                 if(aStr.Len() == aESel.nStartPos)
    1269         [ #  # ]:          0 :                     bRet = sal_True;
    1270                 :            :             }
    1271                 :            :         }
    1272                 :            :         else
    1273                 :            :         {
    1274                 :          0 :             bRet=sal_True;
    1275                 :            :         }
    1276                 :            :     }
    1277                 :          0 :     return bRet;
    1278                 :            : }
    1279                 :            : 
    1280                 :          0 : void SdrObjEditView::ImpMakeTextCursorAreaVisible()
    1281                 :            : {
    1282 [ #  # ][ #  # ]:          0 :     if (pTextEditOutlinerView!=NULL && pTextEditWin!=NULL) {
    1283                 :          0 :         Cursor* pCsr=pTextEditWin->GetCursor();
    1284         [ #  # ]:          0 :         if (pCsr!=NULL) {
    1285                 :          0 :             Size aSiz(pCsr->GetSize());
    1286 [ #  # ][ #  # ]:          0 :             if (aSiz.Width()!=0 && aSiz.Height()!=0) {
                 [ #  # ]
    1287 [ #  # ][ #  # ]:          0 :                 MakeVisible(Rectangle(pCsr->GetPos(),aSiz),*pTextEditWin);
    1288                 :            :             }
    1289                 :            :         }
    1290                 :            :     }
    1291                 :          0 : }
    1292                 :            : 
    1293                 :          0 : sal_uInt16 SdrObjEditView::GetScriptType() const
    1294                 :            : {
    1295                 :          0 :     sal_uInt16 nScriptType = 0;
    1296                 :            : 
    1297         [ #  # ]:          0 :     if( IsTextEdit() )
    1298                 :            :     {
    1299         [ #  # ]:          0 :         if( mxTextEditObj->GetOutlinerParaObject() )
    1300                 :          0 :             nScriptType = mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
    1301                 :            : 
    1302         [ #  # ]:          0 :         if( pTextEditOutlinerView )
    1303                 :          0 :             nScriptType = pTextEditOutlinerView->GetSelectedScriptType();
    1304                 :            :     }
    1305                 :            :     else
    1306                 :            :     {
    1307                 :          0 :         sal_uInt32 nMarkCount( GetMarkedObjectCount() );
    1308                 :            : 
    1309         [ #  # ]:          0 :         for( sal_uInt32 i = 0; i < nMarkCount; i++ )
    1310                 :            :         {
    1311                 :          0 :             OutlinerParaObject* pParaObj = GetMarkedObjectByIndex( i )->GetOutlinerParaObject();
    1312                 :            : 
    1313         [ #  # ]:          0 :             if( pParaObj )
    1314                 :            :             {
    1315                 :          0 :                 nScriptType |= pParaObj->GetTextObject().GetScriptType();
    1316                 :            :             }
    1317                 :            :         }
    1318                 :            :     }
    1319                 :            : 
    1320         [ #  # ]:          0 :     if( nScriptType == 0 )
    1321                 :          0 :         nScriptType = SCRIPTTYPE_LATIN;
    1322                 :            : 
    1323                 :          0 :     return nScriptType;
    1324                 :            : }
    1325                 :            : 
    1326                 :       1216 : sal_Bool SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
    1327                 :            : {
    1328         [ -  + ]:       1216 :     if( mxSelectionController.is() )
    1329         [ #  # ]:          0 :         if( mxSelectionController->GetAttributes( rTargetSet, bOnlyHardAttr ) )
    1330                 :          0 :             return sal_True;
    1331                 :            : 
    1332         [ -  + ]:       1216 :     if(IsTextEdit())
    1333                 :            :     {
    1334                 :            :         DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
    1335                 :            :         DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
    1336                 :            : 
    1337                 :            :         // take care of bOnlyHardAttr(!)
    1338 [ #  # ][ #  # ]:          0 :         if(!bOnlyHardAttr && mxTextEditObj->GetStyleSheet())
                 [ #  # ]
    1339                 :          0 :             rTargetSet.Put(mxTextEditObj->GetStyleSheet()->GetItemSet());
    1340                 :            : 
    1341                 :            :         // add object attributes
    1342                 :          0 :         rTargetSet.Put( mxTextEditObj->GetMergedItemSet() );
    1343                 :            : 
    1344         [ #  # ]:          0 :         if( mxTextEditObj->GetOutlinerParaObject() )
    1345         [ #  # ]:          0 :             rTargetSet.Put( SvxScriptTypeItem( mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType() ) );
    1346                 :            : 
    1347         [ #  # ]:          0 :         if(pTextEditOutlinerView)
    1348                 :            :         {
    1349                 :            :             // FALSE= regard InvalidItems as "holes," not as Default
    1350         [ #  # ]:          0 :             rTargetSet.Put(pTextEditOutlinerView->GetAttribs(), sal_False);
    1351         [ #  # ]:          0 :             rTargetSet.Put( SvxScriptTypeItem( pTextEditOutlinerView->GetSelectedScriptType() ), sal_False );
    1352                 :            :         }
    1353                 :            : 
    1354 [ #  # ][ #  # ]:          0 :         if(GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
                 [ #  # ]
    1355                 :            :         {
    1356                 :          0 :             MergeNotPersistAttrFromMarked(rTargetSet, bOnlyHardAttr);
    1357                 :            :         }
    1358                 :            : 
    1359                 :          0 :         return sal_True;
    1360                 :            :     }
    1361                 :            :     else
    1362                 :            :     {
    1363                 :       1216 :         return SdrGlueEditView::GetAttributes(rTargetSet, bOnlyHardAttr);
    1364                 :            :     }
    1365                 :            : }
    1366                 :            : 
    1367                 :          0 : sal_Bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
    1368                 :            : {
    1369                 :          0 :     sal_Bool bRet=sal_False;
    1370 [ #  # ][ #  # ]:          0 :     sal_Bool bTextEdit=pTextEditOutlinerView!=NULL && mxTextEditObj.is();
    1371                 :          0 :     sal_Bool bAllTextSelected=ImpIsTextEditAllSelected();
    1372                 :          0 :     SfxItemSet* pModifiedSet=NULL;
    1373                 :          0 :     const SfxItemSet* pSet=&rSet;
    1374                 :            : 
    1375         [ #  # ]:          0 :     if (!bTextEdit)
    1376                 :            :     {
    1377                 :            :         // no TextEdit activw -> all Items to drawing object
    1378         [ #  # ]:          0 :         if( mxSelectionController.is() )
    1379                 :          0 :             bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
    1380                 :            : 
    1381         [ #  # ]:          0 :         if( !bRet )
    1382                 :            :         {
    1383                 :          0 :             bRet=SdrGlueEditView::SetAttributes(*pSet,bReplaceAll);
    1384                 :            :         }
    1385                 :            :     }
    1386                 :            :     else
    1387                 :            :     {
    1388                 :            : #ifdef DBG_UTIL
    1389                 :            :         {
    1390                 :            :             sal_Bool bHasEEFeatureItems=sal_False;
    1391                 :            :             SfxItemIter aIter(rSet);
    1392                 :            :             const SfxPoolItem* pItem=aIter.FirstItem();
    1393                 :            :             while (!bHasEEFeatureItems && pItem!=NULL)
    1394                 :            :             {
    1395                 :            :                 if (!IsInvalidItem(pItem))
    1396                 :            :                 {
    1397                 :            :                     sal_uInt16 nW=pItem->Which();
    1398                 :            :                     if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END)
    1399                 :            :                         bHasEEFeatureItems=sal_True;
    1400                 :            :                 }
    1401                 :            : 
    1402                 :            :                 pItem=aIter.NextItem();
    1403                 :            :             }
    1404                 :            : 
    1405                 :            :             if(bHasEEFeatureItems)
    1406                 :            :             {
    1407                 :            :                 String aMessage;
    1408                 :            :                 aMessage.AppendAscii("SdrObjEditView::SetAttributes(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents.");
    1409                 :            :                 InfoBox(NULL, aMessage).Execute();
    1410                 :            :             }
    1411                 :            :         }
    1412                 :            : #endif
    1413                 :            : 
    1414                 :            :         sal_Bool bOnlyEEItems;
    1415         [ #  # ]:          0 :         sal_Bool bNoEEItems=!SearchOutlinerItems(*pSet,bReplaceAll,&bOnlyEEItems);
    1416                 :            :         // everything selected? -> attributes to the border, too
    1417                 :            :         // if no EEItems, attributes to the border only
    1418 [ #  # ][ #  # ]:          0 :         if (bAllTextSelected || bNoEEItems)
    1419                 :            :         {
    1420         [ #  # ]:          0 :             if( mxSelectionController.is() )
    1421         [ #  # ]:          0 :                 bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
    1422                 :            : 
    1423         [ #  # ]:          0 :             if( !bRet )
    1424                 :            :             {
    1425         [ #  # ]:          0 :                 const bool bUndo = IsUndoEnabled();
    1426                 :            : 
    1427         [ #  # ]:          0 :                 if( bUndo )
    1428                 :            :                 {
    1429         [ #  # ]:          0 :                     String aStr;
    1430         [ #  # ]:          0 :                     ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
    1431         [ #  # ]:          0 :                     BegUndo(aStr);
    1432 [ #  # ][ #  # ]:          0 :                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
                 [ #  # ]
    1433                 :            : 
    1434                 :            :                     // #i43537#
    1435                 :            :                     // If this is a text object also rescue the OutlinerParaObject since
    1436                 :            :                     // applying attributes to the object may change text layout when
    1437                 :            :                     // multiple portions exist with multiple formats. If a OutlinerParaObject
    1438                 :            :                     // really exists and needs to be rescued is evaluated in the undo
    1439                 :            :                     // implementation itself.
    1440 [ #  # ][ #  # ]:          0 :                     bool bRescueText = dynamic_cast< SdrTextObj* >(mxTextEditObj.get());
    1441                 :            : 
    1442 [ #  # ][ #  # ]:          0 :                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,!bNoEEItems || bRescueText));
         [ #  # ][ #  # ]
                 [ #  # ]
    1443 [ #  # ][ #  # ]:          0 :                     EndUndo();
    1444                 :            :                 }
    1445                 :            : 
    1446         [ #  # ]:          0 :                 mxTextEditObj->SetMergedItemSetAndBroadcast(*pSet, bReplaceAll);
    1447                 :            : 
    1448         [ #  # ]:          0 :                 FlushComeBackTimer(); // to set ModeHasChanged immediately
    1449                 :          0 :                 bRet=sal_True;
    1450                 :          0 :             }
    1451                 :            :         }
    1452         [ #  # ]:          0 :         else if (!bOnlyEEItems)
    1453                 :            :         {
    1454                 :            :             // Otherwise split Set, if necessary.
    1455                 :            :             // Now we build an ItemSet aSet that doesn't contain EE_Items from
    1456                 :            :             // *pSet (otherwise it would be a copy).
    1457         [ #  # ]:          0 :             sal_uInt16* pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
    1458         [ #  # ]:          0 :             SfxItemSet aSet(pMod->GetItemPool(),pNewWhichTable);
    1459         [ #  # ]:          0 :             delete[] pNewWhichTable;
    1460         [ #  # ]:          0 :             SfxWhichIter aIter(aSet);
    1461         [ #  # ]:          0 :             sal_uInt16 nWhich=aIter.FirstWhich();
    1462         [ #  # ]:          0 :             while (nWhich!=0)
    1463                 :            :             {
    1464                 :            :                 const SfxPoolItem* pItem;
    1465         [ #  # ]:          0 :                 SfxItemState eState=pSet->GetItemState(nWhich,sal_False,&pItem);
    1466 [ #  # ][ #  # ]:          0 :                 if (eState==SFX_ITEM_SET) aSet.Put(*pItem);
    1467         [ #  # ]:          0 :                 nWhich=aIter.NextWhich();
    1468                 :            :             }
    1469                 :            : 
    1470                 :            : 
    1471         [ #  # ]:          0 :             if( mxSelectionController.is() )
    1472         [ #  # ]:          0 :                 bRet=mxSelectionController->SetAttributes(aSet,bReplaceAll );
    1473                 :            : 
    1474         [ #  # ]:          0 :             if( !bRet )
    1475                 :            :             {
    1476 [ #  # ][ #  # ]:          0 :                 if( IsUndoEnabled() )
    1477                 :            :                 {
    1478         [ #  # ]:          0 :                     String aStr;
    1479         [ #  # ]:          0 :                     ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
    1480         [ #  # ]:          0 :                     BegUndo(aStr);
    1481 [ #  # ][ #  # ]:          0 :                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
                 [ #  # ]
    1482 [ #  # ][ #  # ]:          0 :                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,false));
                 [ #  # ]
    1483 [ #  # ][ #  # ]:          0 :                     EndUndo();
    1484                 :            :                 }
    1485                 :            : 
    1486         [ #  # ]:          0 :                 mxTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll);
    1487                 :            : 
    1488 [ #  # ][ #  # ]:          0 :                 if (GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
         [ #  # ][ #  # ]
    1489                 :            :                 {
    1490         [ #  # ]:          0 :                     SetNotPersistAttrToMarked(aSet,bReplaceAll);
    1491                 :            :                 }
    1492                 :            :             }
    1493         [ #  # ]:          0 :             FlushComeBackTimer();
    1494 [ #  # ][ #  # ]:          0 :             bRet=sal_True;
    1495                 :            :         }
    1496         [ #  # ]:          0 :         if(!bNoEEItems)
    1497                 :            :         {
    1498                 :            :             // and now the attributes to the EditEngine
    1499         [ #  # ]:          0 :             if (bReplaceAll) {
    1500         [ #  # ]:          0 :                 pTextEditOutlinerView->RemoveAttribs( sal_True );
    1501                 :            :             }
    1502         [ #  # ]:          0 :             pTextEditOutlinerView->SetAttribs(rSet);
    1503                 :            : 
    1504                 :            : #ifdef DBG_UTIL
    1505                 :            :             if (pItemBrowser!=NULL)
    1506                 :            :                 pItemBrowser->SetDirty();
    1507                 :            : #endif
    1508                 :            : 
    1509         [ #  # ]:          0 :             ImpMakeTextCursorAreaVisible();
    1510                 :            :         }
    1511                 :          0 :         bRet=sal_True;
    1512                 :            :     }
    1513         [ #  # ]:          0 :     if (pModifiedSet!=NULL)
    1514         [ #  # ]:          0 :         delete pModifiedSet;
    1515                 :          0 :     return bRet;
    1516                 :            : }
    1517                 :            : 
    1518                 :          4 : SfxStyleSheet* SdrObjEditView::GetStyleSheet() const
    1519                 :            : {
    1520                 :          4 :     SfxStyleSheet* pSheet = 0;
    1521                 :            : 
    1522         [ -  + ]:          4 :     if( mxSelectionController.is() )
    1523                 :            :     {
    1524 [ #  # ][ #  # ]:          0 :         if( mxSelectionController->GetStyleSheet( pSheet ) )
    1525                 :          0 :             return pSheet;
    1526                 :            :     }
    1527                 :            : 
    1528         [ -  + ]:          4 :     if ( pTextEditOutlinerView )
    1529                 :            :     {
    1530         [ #  # ]:          0 :         pSheet = pTextEditOutlinerView->GetStyleSheet();
    1531                 :            :     }
    1532                 :            :     else
    1533                 :            :     {
    1534         [ +  - ]:          4 :         pSheet = SdrGlueEditView::GetStyleSheet();
    1535                 :            :     }
    1536                 :          4 :     return pSheet;
    1537                 :            : }
    1538                 :            : 
    1539                 :          0 : sal_Bool SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
    1540                 :            : {
    1541         [ #  # ]:          0 :     if( mxSelectionController.is() )
    1542                 :            :     {
    1543         [ #  # ]:          0 :         if( mxSelectionController->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr ) )
    1544                 :          0 :             return sal_True;
    1545                 :            :     }
    1546                 :            : 
    1547                 :            :     // if we are currently in edit mode we must also set the stylesheet
    1548                 :            :     // on all paragraphs in the Outliner for the edit view
    1549         [ #  # ]:          0 :     if( NULL != pTextEditOutlinerView )
    1550                 :            :     {
    1551                 :          0 :         Outliner* pOutliner = pTextEditOutlinerView->GetOutliner();
    1552                 :            : 
    1553                 :          0 :         const sal_uIntPtr nParaCount = pOutliner->GetParagraphCount();
    1554                 :            :         sal_uIntPtr nPara;
    1555         [ #  # ]:          0 :         for( nPara = 0; nPara < nParaCount; nPara++ )
    1556                 :            :         {
    1557                 :          0 :             pOutliner->SetStyleSheet( nPara, pStyleSheet );
    1558                 :            :         }
    1559                 :            :     }
    1560                 :            : 
    1561                 :          0 :     return SdrGlueEditView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
    1562                 :            : }
    1563                 :            : 
    1564                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1565                 :            : 
    1566                 :          0 : void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin)
    1567                 :            : {
    1568                 :          0 :     SdrGlueEditView::AddWindowToPaintView(pNewWin);
    1569                 :            : 
    1570 [ #  # ][ #  # ]:          0 :     if(mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType()==OUTDEV_WINDOW)
         [ #  # ][ #  # ]
    1571                 :            :     {
    1572                 :          0 :         OutlinerView* pOutlView=ImpMakeOutlinerView((Window*)pNewWin,sal_False,NULL);
    1573                 :          0 :         pTextEditOutliner->InsertView(pOutlView);
    1574                 :            :     }
    1575                 :          0 : }
    1576                 :            : 
    1577                 :        615 : void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
    1578                 :            : {
    1579                 :        615 :     SdrGlueEditView::DeleteWindowFromPaintView(pOldWin);
    1580                 :            : 
    1581 [ #  # ][ #  # ]:        615 :     if(mxTextEditObj.is() && !bTextEditOnlyOneView && pOldWin->GetOutDevType()==OUTDEV_WINDOW)
         [ -  + ][ -  + ]
    1582                 :            :     {
    1583         [ #  # ]:          0 :         for (sal_uIntPtr i=pTextEditOutliner->GetViewCount(); i>0;) {
    1584                 :          0 :             i--;
    1585                 :          0 :             OutlinerView* pOLV=pTextEditOutliner->GetView(i);
    1586 [ #  # ][ #  # ]:          0 :             if (pOLV && pOLV->GetWindow()==(Window*)pOldWin) {
                 [ #  # ]
    1587         [ #  # ]:          0 :                 delete pTextEditOutliner->RemoveView(i);
    1588                 :            :             }
    1589                 :            :         }
    1590                 :            :     }
    1591                 :        615 : }
    1592                 :            : 
    1593                 :        405 : sal_Bool SdrObjEditView::IsTextEditInSelectionMode() const
    1594                 :            : {
    1595 [ -  + ][ #  # ]:        405 :     return pTextEditOutliner!=NULL && pTextEditOutliner->IsInSelectionMode();
    1596                 :            : }
    1597                 :            : 
    1598                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1599                 :            : // MacroMode
    1600                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1601                 :            : 
    1602                 :          0 : sal_Bool SdrObjEditView::BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, Window* pWin)
    1603                 :            : {
    1604                 :          0 :     sal_Bool bRet=sal_False;
    1605                 :          0 :     BrkMacroObj();
    1606 [ #  # ][ #  # ]:          0 :     if (pObj!=NULL && pPV!=NULL && pWin!=NULL && pObj->HasMacro()) {
         [ #  # ][ #  # ]
                 [ #  # ]
    1607                 :          0 :         nTol=ImpGetHitTolLogic(nTol,NULL);
    1608                 :          0 :         pMacroObj=pObj;
    1609                 :          0 :         pMacroPV=pPV;
    1610                 :          0 :         pMacroWin=pWin;
    1611                 :          0 :         bMacroDown=sal_False;
    1612                 :          0 :         nMacroTol=sal_uInt16(nTol);
    1613                 :          0 :         aMacroDownPos=rPnt;
    1614                 :          0 :         MovMacroObj(rPnt);
    1615                 :            :     }
    1616                 :          0 :     return bRet;
    1617                 :            : }
    1618                 :            : 
    1619                 :          0 : void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
    1620                 :            : {
    1621 [ #  # ][ #  # ]:          0 :     if (pMacroObj!=NULL && bMacroDown)
    1622                 :            :     {
    1623         [ #  # ]:          0 :         SdrObjMacroHitRec aHitRec;
    1624                 :          0 :         aHitRec.aPos=rUpPos;
    1625                 :          0 :         aHitRec.aDownPos=aMacroDownPos;
    1626                 :          0 :         aHitRec.nTol=nMacroTol;
    1627                 :          0 :         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
    1628                 :          0 :         aHitRec.pPageView=pMacroPV;
    1629                 :          0 :         aHitRec.pOut=pMacroWin;
    1630 [ #  # ][ #  # ]:          0 :         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
    1631                 :          0 :         bMacroDown=sal_False;
    1632                 :            :     }
    1633                 :          0 : }
    1634                 :            : 
    1635                 :          0 : void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
    1636                 :            : {
    1637 [ #  # ][ #  # ]:          0 :     if (pMacroObj!=NULL && !bMacroDown)
    1638                 :            :     {
    1639         [ #  # ]:          0 :         SdrObjMacroHitRec aHitRec;
    1640                 :          0 :         aHitRec.aPos=rDownPos;
    1641                 :          0 :         aHitRec.aDownPos=aMacroDownPos;
    1642                 :          0 :         aHitRec.nTol=nMacroTol;
    1643                 :          0 :         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
    1644                 :          0 :         aHitRec.pPageView=pMacroPV;
    1645                 :          0 :         aHitRec.bDown=sal_True;
    1646                 :          0 :         aHitRec.pOut=pMacroWin;
    1647 [ #  # ][ #  # ]:          0 :         pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
    1648                 :          0 :         bMacroDown=sal_True;
    1649                 :            :     }
    1650                 :          0 : }
    1651                 :            : 
    1652                 :          0 : void SdrObjEditView::MovMacroObj(const Point& rPnt)
    1653                 :            : {
    1654         [ #  # ]:          0 :     if (pMacroObj!=NULL) {
    1655         [ #  # ]:          0 :         SdrObjMacroHitRec aHitRec;
    1656                 :          0 :         aHitRec.aPos=rPnt;
    1657                 :          0 :         aHitRec.aDownPos=aMacroDownPos;
    1658                 :          0 :         aHitRec.nTol=nMacroTol;
    1659                 :          0 :         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
    1660                 :          0 :         aHitRec.pPageView=pMacroPV;
    1661                 :          0 :         aHitRec.bDown=bMacroDown;
    1662                 :          0 :         aHitRec.pOut=pMacroWin;
    1663         [ #  # ]:          0 :         sal_Bool bDown=pMacroObj->IsMacroHit(aHitRec);
    1664 [ #  # ][ #  # ]:          0 :         if (bDown) ImpMacroDown(rPnt);
    1665         [ #  # ]:          0 :         else ImpMacroUp(rPnt);
    1666                 :            :     }
    1667                 :          0 : }
    1668                 :            : 
    1669                 :       4877 : void SdrObjEditView::BrkMacroObj()
    1670                 :            : {
    1671         [ -  + ]:       4877 :     if (pMacroObj!=NULL) {
    1672                 :          0 :         ImpMacroUp(aMacroDownPos);
    1673                 :          0 :         pMacroObj=NULL;
    1674                 :          0 :         pMacroPV=NULL;
    1675                 :          0 :         pMacroWin=NULL;
    1676                 :            :     }
    1677                 :       4877 : }
    1678                 :            : 
    1679                 :          0 : sal_Bool SdrObjEditView::EndMacroObj()
    1680                 :            : {
    1681 [ #  # ][ #  # ]:          0 :     if (pMacroObj!=NULL && bMacroDown) {
    1682         [ #  # ]:          0 :         ImpMacroUp(aMacroDownPos);
    1683         [ #  # ]:          0 :         SdrObjMacroHitRec aHitRec;
    1684                 :          0 :         aHitRec.aPos=aMacroDownPos;
    1685                 :          0 :         aHitRec.aDownPos=aMacroDownPos;
    1686                 :          0 :         aHitRec.nTol=nMacroTol;
    1687                 :          0 :         aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
    1688                 :          0 :         aHitRec.pPageView=pMacroPV;
    1689                 :          0 :         aHitRec.bDown=sal_True;
    1690                 :          0 :         aHitRec.pOut=pMacroWin;
    1691         [ #  # ]:          0 :         bool bRet=pMacroObj->DoMacro(aHitRec);
    1692                 :          0 :         pMacroObj=NULL;
    1693                 :          0 :         pMacroPV=NULL;
    1694                 :          0 :         pMacroWin=NULL;
    1695                 :          0 :         return bRet;
    1696                 :            :     } else {
    1697                 :          0 :         BrkMacroObj();
    1698                 :          0 :         return sal_False;
    1699                 :            :     }
    1700                 :            : }
    1701                 :            : 
    1702                 :            : /** fills the given any with a XTextCursor for the current text selection.
    1703                 :            :     Leaves the any untouched if there currently is no text selected */
    1704                 :          0 : void SdrObjEditView::getTextSelection( ::com::sun::star::uno::Any& rSelection )
    1705                 :            : {
    1706         [ #  # ]:          0 :     if( IsTextEdit() )
    1707                 :            :     {
    1708                 :          0 :         OutlinerView* pOutlinerView = GetTextEditOutlinerView();
    1709 [ #  # ][ #  # ]:          0 :         if( pOutlinerView && pOutlinerView->HasSelection() )
                 [ #  # ]
    1710                 :            :         {
    1711                 :          0 :             SdrObject* pObj = GetTextEditObject();
    1712                 :            : 
    1713         [ #  # ]:          0 :             if( pObj )
    1714                 :            :             {
    1715 [ #  # ][ #  # ]:          0 :                 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xText( pObj->getUnoShape(), ::com::sun::star::uno::UNO_QUERY );
    1716         [ #  # ]:          0 :                 if( xText.is() )
    1717                 :            :                 {
    1718         [ #  # ]:          0 :                     SvxUnoTextBase* pRange = SvxUnoTextBase::getImplementation( xText );
    1719         [ #  # ]:          0 :                     if( pRange )
    1720                 :            :                     {
    1721 [ #  # ][ #  # ]:          0 :                         rSelection <<= pRange->createTextCursorBySelection( pOutlinerView->GetSelection() );
                 [ #  # ]
    1722                 :            :                     }
    1723                 :          0 :                 }
    1724                 :            :             }
    1725                 :            :         }
    1726                 :            :     }
    1727                 :          0 : }
    1728                 :            : 
    1729                 :            : namespace sdr { namespace table {
    1730                 :            : extern rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
    1731                 :            : } }
    1732                 :            : 
    1733                 :            : /* check if we have a single selection and that single object likes
    1734                 :            :     to handle the mouse and keyboard events itself
    1735                 :            : 
    1736                 :            :     TODO: the selection controller should be queried from the
    1737                 :            :     object specific view contact. Currently this method only
    1738                 :            :     works for tables.
    1739                 :            : */
    1740                 :       3748 : void SdrObjEditView::MarkListHasChanged()
    1741                 :            : {
    1742                 :       3748 :     SdrGlueEditView::MarkListHasChanged();
    1743                 :            : 
    1744         [ -  + ]:       3748 :     if( mxSelectionController.is() )
    1745                 :            :     {
    1746                 :          0 :         mxLastSelectionController = mxSelectionController;
    1747                 :          0 :         mxSelectionController->onSelectionHasChanged();
    1748                 :            :     }
    1749                 :            : 
    1750                 :       3748 :     mxSelectionController.clear();
    1751                 :            : 
    1752                 :       3748 :     const SdrMarkList& rMarkList=GetMarkedObjectList();
    1753         [ +  + ]:       3748 :     if( rMarkList.GetMarkCount() == 1 )
    1754                 :            :     {
    1755                 :        823 :         const SdrObject* pObj= rMarkList.GetMark(0)->GetMarkedSdrObj();
    1756                 :            :         // check for table
    1757 [ +  - ][ -  + ]:        823 :         if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
         [ -  + ][ +  - ]
    1758                 :            :         {
    1759         [ #  # ]:          0 :             mxSelectionController = sdr::table::CreateTableController( this, pObj, mxLastSelectionController );
    1760         [ #  # ]:          0 :             if( mxSelectionController.is() )
    1761                 :            :             {
    1762                 :          0 :                 mxLastSelectionController.clear();
    1763                 :          0 :                 mxSelectionController->onSelectionHasChanged();
    1764                 :            :             }
    1765                 :            :         }
    1766                 :            :     }
    1767                 :       3748 : }
    1768                 :            : 
    1769                 :          0 : IMPL_LINK( SdrObjEditView, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos )
    1770                 :            : {
    1771                 :          0 :     OnEndPasteOrDrop( pInfos );
    1772                 :          0 :     return 0;
    1773                 :            : }
    1774                 :            : 
    1775                 :          0 : IMPL_LINK( SdrObjEditView, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos )
    1776                 :            : {
    1777                 :          0 :     OnBeginPasteOrDrop( pInfos );
    1778                 :          0 :     return 0;
    1779                 :            : }
    1780                 :            : 
    1781                 :          0 : void SdrObjEditView::OnBeginPasteOrDrop( PasteOrDropInfos* )
    1782                 :            : {
    1783                 :            :     // applications can derive from these virtual methods to do something before a drop or paste operation
    1784                 :          0 : }
    1785                 :            : 
    1786                 :          0 : void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* )
    1787                 :            : {
    1788                 :            :     // applications can derive from these virtual methods to do something before a drop or paste operation
    1789                 :          0 : }
    1790                 :            : 
    1791                 :          3 : bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
    1792                 :            : {
    1793 [ -  + ][ #  # ]:          3 :     if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor )
    1794                 :          0 :         return false;
    1795   [ -  +  -  -  :          3 :     switch(nObjectIdentifier)
                -  -  - ]
    1796                 :            :     {
    1797                 :            :         case OBJ_NONE:
    1798                 :            :         case OBJ_GRUP:
    1799                 :          0 :             return false;
    1800                 :            :         case OBJ_LINE:
    1801                 :            :         case OBJ_RECT:
    1802                 :            :         case OBJ_CIRC:
    1803                 :            :         case OBJ_SECT:
    1804                 :            :         case OBJ_CARC:
    1805                 :            :         case OBJ_CCUT:
    1806                 :            :         case OBJ_POLY:
    1807                 :            :         case OBJ_PLIN:
    1808                 :            :         case OBJ_PATHLINE:
    1809                 :            :         case OBJ_PATHFILL:
    1810                 :            :         case OBJ_FREELINE:
    1811                 :            :         case OBJ_FREEFILL:
    1812                 :            :         case OBJ_SPLNLINE:
    1813                 :            :         case OBJ_SPLNFILL:
    1814                 :            :         case OBJ_TEXT:
    1815                 :            :         case OBJ_TEXTEXT:
    1816                 :            :         case OBJ_TITLETEXT:
    1817                 :            :         case OBJ_OUTLINETEXT:
    1818                 :            :         case OBJ_GRAF:
    1819                 :            :         case OBJ_OLE2:
    1820                 :            :         case OBJ_TABLE:
    1821                 :          3 :             return true;
    1822                 :            :         case OBJ_EDGE:
    1823                 :            :         case OBJ_CAPTION:
    1824                 :          0 :             return false;
    1825                 :            :         case OBJ_PATHPOLY:
    1826                 :            :         case OBJ_PATHPLIN:
    1827                 :          0 :             return true;
    1828                 :            :         case OBJ_PAGE:
    1829                 :            :         case OBJ_MEASURE:
    1830                 :            :         case OBJ_DUMMY:
    1831                 :            :         case OBJ_FRAME:
    1832                 :            :         case OBJ_UNO:
    1833                 :          0 :             return false;
    1834                 :            :         case OBJ_CUSTOMSHAPE:
    1835                 :          0 :             return true;
    1836                 :            :         default:
    1837                 :          3 :             return false;
    1838                 :            :     }
    1839                 :            : }
    1840                 :            : 
    1841                 :          0 : static const sal_uInt16* GetFormatRangeImpl( bool bTextOnly )
    1842                 :            : {
    1843                 :            :     static const sal_uInt16 gRanges[] = {
    1844                 :            :         SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
    1845                 :            :         SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
    1846                 :            :         SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
    1847                 :            :         XATTR_LINE_FIRST, XATTR_LINE_LAST,
    1848                 :            :         XATTR_FILL_FIRST, XATTRSET_FILL,
    1849                 :            :         EE_PARA_START, EE_PARA_END,
    1850                 :            :         EE_CHAR_START, EE_CHAR_END,
    1851                 :            :         0,0
    1852                 :            :     };
    1853         [ #  # ]:          0 :     return &gRanges[ bTextOnly ? 10 : 0];
    1854                 :            : }
    1855                 :            : 
    1856                 :          0 : bool SdrObjEditView::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  )
    1857                 :            : {
    1858 [ #  # ][ #  # ]:          0 :     if( mxSelectionController.is() && mxSelectionController->TakeFormatPaintBrush(rFormatSet) )
                 [ #  # ]
    1859                 :          0 :         return true;
    1860                 :            : 
    1861                 :          0 :     const SdrMarkList& rMarkList = GetMarkedObjectList();
    1862         [ #  # ]:          0 :     if( rMarkList.GetMarkCount() >= 1 )
    1863                 :            :     {
    1864                 :          0 :         OutlinerView* pOLV = GetTextEditOutlinerView();
    1865                 :            : 
    1866         [ #  # ]:          0 :         rFormatSet.reset( new SfxItemSet( GetModel()->GetItemPool(), GetFormatRangeImpl( pOLV != NULL ) ) );
    1867         [ #  # ]:          0 :         if( pOLV )
    1868                 :            :         {
    1869         [ #  # ]:          0 :             rFormatSet->Put( pOLV->GetAttribs() );
    1870                 :            :         }
    1871                 :            :         else
    1872                 :            :         {
    1873                 :          0 :             const sal_Bool bOnlyHardAttr = sal_False;
    1874         [ #  # ]:          0 :             rFormatSet->Put( GetAttrFromMarked(bOnlyHardAttr) );
    1875                 :            :         }
    1876                 :          0 :         return true;
    1877                 :            :     }
    1878                 :            : 
    1879                 :          0 :     return false;
    1880                 :            : }
    1881                 :            : 
    1882                 :          0 : static SfxItemSet CreatePaintSet( const sal_uInt16 *pRanges, SfxItemPool& rPool, const SfxItemSet& rSourceSet, const SfxItemSet& rTargetSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
    1883                 :            : {
    1884                 :          0 :     SfxItemSet aPaintSet( rPool, pRanges );
    1885                 :            : 
    1886         [ #  # ]:          0 :     while( *pRanges )
    1887                 :            :     {
    1888                 :          0 :         sal_uInt16 nWhich = *pRanges++;
    1889                 :          0 :         const sal_uInt16 nLastWhich = *pRanges++;
    1890                 :            : 
    1891 [ #  # ][ #  # ]:          0 :         if( bNoCharacterFormats && (nWhich == EE_CHAR_START) )
    1892                 :          0 :             continue;
    1893                 :            : 
    1894 [ #  # ][ #  # ]:          0 :         if( bNoParagraphFormats && (nWhich == EE_PARA_START ) )
    1895                 :          0 :             continue;
    1896                 :            : 
    1897         [ #  # ]:          0 :         for( ; nWhich < nLastWhich; nWhich++ )
    1898                 :            :         {
    1899         [ #  # ]:          0 :             const SfxPoolItem* pSourceItem = rSourceSet.GetItem( nWhich );
    1900         [ #  # ]:          0 :             const SfxPoolItem* pTargetItem = rTargetSet.GetItem( nWhich );
    1901                 :            : 
    1902 [ #  # ][ #  # ]:          0 :             if( (pSourceItem && !pTargetItem) || (pSourceItem && pTargetItem && !((*pSourceItem) == (*pTargetItem)) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1903                 :            :             {
    1904         [ #  # ]:          0 :                 aPaintSet.Put( *pSourceItem );
    1905                 :            :             }
    1906                 :            :         }
    1907                 :            :     }
    1908                 :          0 :     return aPaintSet;
    1909                 :            : }
    1910                 :            : 
    1911                 :          0 : void SdrObjEditView::ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats )
    1912                 :            : {
    1913         [ #  # ]:          0 :     OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
    1914         [ #  # ]:          0 :     if(pParaObj)
    1915                 :            :     {
    1916                 :          0 :         SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
    1917                 :          0 :         rOutliner.SetText(*pParaObj);
    1918                 :            : 
    1919                 :          0 :         sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
    1920                 :            : 
    1921         [ #  # ]:          0 :         if(nParaCount)
    1922                 :            :         {
    1923         [ #  # ]:          0 :             for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
    1924                 :            :             {
    1925         [ #  # ]:          0 :                 if( !bNoCharacterFormats )
    1926         [ #  # ]:          0 :                     rOutliner.QuickRemoveCharAttribs( nPara, /* remove all */0 );
    1927                 :            : 
    1928         [ #  # ]:          0 :                 SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
    1929 [ #  # ][ #  # ]:          0 :                 aSet.Put(CreatePaintSet( GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
                 [ #  # ]
    1930         [ #  # ]:          0 :                 rOutliner.SetParaAttribs(nPara, aSet);
    1931         [ #  # ]:          0 :             }
    1932                 :            : 
    1933                 :          0 :             OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
    1934                 :          0 :             rOutliner.Clear();
    1935                 :            : 
    1936                 :          0 :             rTextObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
    1937                 :            :         }
    1938                 :            :     }
    1939                 :          0 : }
    1940                 :            : 
    1941                 :          0 : void SdrObjEditView::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
    1942                 :            : {
    1943 [ #  # ][ #  # ]:          0 :     if( !mxSelectionController.is() || !mxSelectionController->ApplyFormatPaintBrush( rFormatSet, bNoCharacterFormats, bNoParagraphFormats ) )
                 [ #  # ]
    1944                 :            :     {
    1945                 :          0 :         const SdrMarkList& rMarkList = GetMarkedObjectList();
    1946                 :          0 :         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
    1947                 :          0 :         OutlinerView* pOLV = GetTextEditOutlinerView();
    1948                 :            : 
    1949                 :          0 :         const SfxItemSet& rShapeSet = pObj->GetMergedItemSet();
    1950                 :            : 
    1951         [ #  # ]:          0 :         if( !pOLV )
    1952                 :            :         {
    1953                 :            :             // if not in text edit mode (aka the user selected text or clicked on a word)
    1954                 :            :             // apply formatting attributes to selected shape
    1955                 :            :             // All formatting items (see ranges above) that are unequal in selected shape and
    1956                 :            :             // the format paintbrush are hard set on the selected shape.
    1957                 :            : 
    1958                 :          0 :             const sal_uInt16* pRanges = rFormatSet.GetRanges();
    1959                 :          0 :             bool bTextOnly = true;
    1960                 :            : 
    1961         [ #  # ]:          0 :             while( *pRanges )
    1962                 :            :             {
    1963 [ #  # ][ #  # ]:          0 :                 if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) )
    1964                 :            :                 {
    1965                 :          0 :                     bTextOnly = false;
    1966                 :          0 :                     break;
    1967                 :            :                 }
    1968                 :          0 :                 pRanges += 2;
    1969                 :            :             }
    1970                 :            : 
    1971         [ #  # ]:          0 :             if( !bTextOnly )
    1972                 :            :             {
    1973         [ #  # ]:          0 :                 SfxItemSet aPaintSet( CreatePaintSet( GetFormatRangeImpl(false), *rShapeSet.GetPool(), rFormatSet, rShapeSet, bNoCharacterFormats, bNoParagraphFormats ) );
    1974                 :          0 :                 const sal_Bool bReplaceAll = sal_False;
    1975 [ #  # ][ #  # ]:          0 :                 SetAttrToMarked(aPaintSet, bReplaceAll);
    1976                 :            :             }
    1977                 :            : 
    1978                 :            :             // now apply character and paragraph formatting to text, if the shape has any
    1979         [ #  # ]:          0 :             SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
    1980         [ #  # ]:          0 :             if( pTextObj )
    1981                 :            :             {
    1982                 :          0 :                 sal_Int32 nText = pTextObj->getTextCount();
    1983                 :            : 
    1984         [ #  # ]:          0 :                 while( --nText >= 0 )
    1985                 :            :                 {
    1986                 :          0 :                     SdrText* pText = pTextObj->getText( nText );
    1987                 :          0 :                     ApplyFormatPaintBrushToText( rFormatSet, *pTextObj, pText, bNoCharacterFormats, bNoParagraphFormats );
    1988                 :            :                 }
    1989                 :            :             }
    1990                 :            :         }
    1991                 :            :         else
    1992                 :            :         {
    1993                 :          0 :             ::Outliner* pOutliner = pOLV->GetOutliner();
    1994         [ #  # ]:          0 :             if( pOutliner )
    1995                 :            :             {
    1996                 :          0 :                 const EditEngine& rEditEngine = pOutliner->GetEditEngine();
    1997                 :            : 
    1998         [ #  # ]:          0 :                 ESelection aSel( pOLV->GetSelection() );
    1999         [ #  # ]:          0 :                 if( !aSel.HasRange() )
    2000 [ #  # ][ #  # ]:          0 :                     pOLV->SetSelection( rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD ) );
    2001                 :            : 
    2002                 :          0 :                 const sal_Bool bRemoveParaAttribs = !bNoParagraphFormats;
    2003         [ #  # ]:          0 :                 pOLV->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
    2004         [ #  # ]:          0 :                 SfxItemSet aSet( pOLV->GetAttribs() );
    2005         [ #  # ]:          0 :                 SfxItemSet aPaintSet( CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
    2006 [ #  # ][ #  # ]:          0 :                 pOLV->SetAttribs( aPaintSet );
                 [ #  # ]
    2007                 :            :             }
    2008                 :            :         }
    2009                 :            :     }
    2010                 :          0 : }
    2011                 :            : 
    2012                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10