LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - futext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 326 0.0 %
Date: 2012-08-25 Functions: 0 15 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 542 0.0 %

           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 <svx/svddef.hxx>
      31                 :            : #include <svx/svdoutl.hxx>
      32                 :            : #include <editeng/outlobj.hxx>
      33                 :            : #include <svx/sdtaaitm.hxx>
      34                 :            : #include <svx/sdtacitm.hxx>
      35                 :            : #include <svx/svdotext.hxx>
      36                 :            : #include <editeng/unolingu.hxx>
      37                 :            : #include <svx/svdocapt.hxx>
      38                 :            : #include <sfx2/bindings.hxx>
      39                 :            : #include <sfx2/dispatch.hxx>
      40                 :            : #include <sfx2/viewfrm.hxx>
      41                 :            : #include <svx/svxids.hrc>
      42                 :            : #include <editeng/eeitem.hxx>
      43                 :            : #include <svl/itemset.hxx>
      44                 :            : 
      45                 :            : #include "futext.hxx"
      46                 :            : #include "drwlayer.hxx"
      47                 :            : #include "sc.hrc"
      48                 :            : #include "tabvwsh.hxx"
      49                 :            : #include "drawview.hxx"
      50                 :            : 
      51                 :            : // Create default drawing objects via keyboard
      52                 :            : #include "scresid.hxx"
      53                 :            : 
      54                 :            : //  Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten
      55                 :            : //! fusel,fuconstr,futext - zusammenfassen!
      56                 :            : #define SC_MAXDRAGMOVE  3
      57                 :            : 
      58                 :            : //------------------------------------------------------------------
      59                 :            : 
      60                 :          0 : void lcl_InvalidateAttribs( SfxBindings& rBindings )
      61                 :            : {
      62                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
      63                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
      64                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
      65                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_NONE );
      66                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
      67                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
      68                 :          0 :     rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
      69                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
      70                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
      71                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_FONT );
      72                 :          0 :     rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
      73                 :          0 :     rBindings.Invalidate( SID_ALIGNLEFT );
      74                 :          0 :     rBindings.Invalidate( SID_ALIGNCENTERHOR );
      75                 :          0 :     rBindings.Invalidate( SID_ALIGNRIGHT );
      76                 :          0 :     rBindings.Invalidate( SID_ALIGNBLOCK );
      77                 :          0 :     rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
      78                 :          0 :     rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
      79                 :          0 :     rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
      80                 :          0 :     rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
      81                 :          0 :     rBindings.Invalidate( SID_SET_SUB_SCRIPT );
      82                 :          0 :     rBindings.Invalidate( SID_HYPERLINK_GETLINK );
      83                 :          0 :     rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
      84                 :          0 :     rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
      85                 :          0 :     rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
      86                 :          0 :     rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
      87                 :            :     // pseudo slots for Format menu
      88                 :          0 :     rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
      89                 :          0 :     rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
      90                 :          0 :     rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
      91                 :          0 :     rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
      92                 :          0 : }
      93                 :            : 
      94                 :          0 : void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj )
      95                 :            : {
      96                 :            :     // use hyphenator only if hyphenation attribute is set
      97 [ #  # ][ #  # ]:          0 :     if ( pObj && ((const SfxBoolItem&)pObj->GetMergedItem(EE_PARA_HYPHENATE)).GetValue() ) {
                 [ #  # ]
      98         [ #  # ]:          0 :             com::sun::star::uno::Reference<com::sun::star::linguistic2::XHyphenator> xHyphenator( LinguMgr::GetHyphenator() );
      99         [ #  # ]:          0 :             rOutliner.SetHyphenator( xHyphenator );
     100                 :            :     }
     101                 :          0 : }
     102                 :            : 
     103                 :            : /*************************************************************************
     104                 :            : |*
     105                 :            : |* Basisklasse fuer Textfunktionen
     106                 :            : |*
     107                 :            : \************************************************************************/
     108                 :            : 
     109                 :          0 : FuText::FuText(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
     110                 :            :                    SdrModel* pDoc, SfxRequest& rReq) :
     111                 :            :     FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq),
     112                 :          0 :     pTextObj(NULL)
     113                 :            : {
     114                 :          0 : }
     115                 :            : 
     116                 :            : /*************************************************************************
     117                 :            : |*
     118                 :            : |* Destruktor
     119                 :            : |*
     120                 :            : \************************************************************************/
     121                 :            : 
     122                 :          0 : FuText::~FuText()
     123                 :            : {
     124                 :            : //  StopEditMode();                 // in Deactivate !
     125         [ #  # ]:          0 : }
     126                 :            : 
     127                 :            : /*************************************************************************
     128                 :            : |*
     129                 :            : |* MouseButtonDown-event
     130                 :            : |*
     131                 :            : \************************************************************************/
     132                 :            : 
     133                 :          0 : sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
     134                 :            : {
     135                 :            :     // remember button state for creation of own MouseEvents
     136                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     137                 :            : 
     138         [ #  # ]:          0 :     if ( pView->MouseButtonDown(rMEvt, pWindow) )
     139                 :          0 :         return (sal_True);                 // Event von der SdrView ausgewertet
     140                 :            : 
     141         [ #  # ]:          0 :     if ( pView->IsTextEdit() )
     142                 :            :     {
     143         [ #  # ]:          0 :         if( !IsSizingOrMovingNote(rMEvt) )
     144                 :          0 :             StopEditMode();            // Danebengeklickt, Ende mit Edit
     145                 :          0 :         pView->SetCreateMode();
     146                 :            :     }
     147                 :            : 
     148                 :          0 :     aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
     149                 :            : 
     150         [ #  # ]:          0 :     if ( rMEvt.IsLeft() )
     151                 :            :     {
     152         [ #  # ]:          0 :         SdrHdl* pHdl = pView->PickHandle(aMDPos);
     153                 :            : 
     154         [ #  # ]:          0 :         sal_uLong nHdlNum = pView->GetHdlNum(pHdl);
     155                 :            : 
     156         [ #  # ]:          0 :         if (pHdl != NULL)
     157                 :            :         {
     158 [ #  # ][ #  # ]:          0 :             if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl))
         [ #  # ][ #  # ]
                 [ #  # ]
     159                 :            :             {
     160         [ #  # ]:          0 :                 sal_Bool bPointMarked=pView->IsPointMarked(*pHdl);
     161                 :            : 
     162         [ #  # ]:          0 :                 if ( rMEvt.IsShift() )
     163                 :            :                 {
     164         [ #  # ]:          0 :                     if (!bPointMarked)
     165                 :            :                     {
     166         [ #  # ]:          0 :                         pView->MarkPoint(*pHdl);
     167                 :            :                     }
     168                 :            :                     else
     169                 :            :                     {
     170         [ #  # ]:          0 :                         pView->UnmarkPoint(*pHdl);
     171                 :            :                     }
     172                 :            :                 }
     173                 :            :                 else
     174                 :            :                 {
     175         [ #  # ]:          0 :                     if (!bPointMarked)
     176                 :            :                     {
     177         [ #  # ]:          0 :                         pView->UnmarkAllPoints();
     178         [ #  # ]:          0 :                         pView->MarkPoint(*pHdl);
     179                 :            :                     }
     180                 :            :                 }
     181         [ #  # ]:          0 :                 pHdl=pView->GetHdl(nHdlNum);
     182                 :            :             }
     183                 :            :         }
     184                 :            : 
     185                 :            :         SdrObject* pObj;
     186                 :            :         SdrPageView* pPV;
     187                 :            : 
     188 [ #  # ][ #  # ]:          0 :         if ( pHdl != NULL || pView->IsMarkedHit(aMDPos) )
         [ #  # ][ #  # ]
     189                 :            :         {
     190 [ #  # ][ #  # ]:          0 :             if (pHdl == NULL &&
                 [ #  # ]
     191                 :            : //              pView->TakeTextEditObject(aMDPos, pObj, pPV) )
     192         [ #  # ]:          0 :                 pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT) )
     193                 :            :             {
     194         [ #  # ]:          0 :                 SdrOutliner* pO = MakeOutliner();
     195         [ #  # ]:          0 :                 lcl_UpdateHyphenator( *pO, pObj );
     196                 :            : 
     197                 :            :                 //  vertical flag:
     198                 :            :                 //  deduced from slot ids only if text object has no content
     199                 :            : 
     200                 :          0 :                 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
     201                 :          0 :                 sal_Bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
     202         [ #  # ]:          0 :                 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     203         [ #  # ]:          0 :                 if ( pOPO )
     204         [ #  # ]:          0 :                     bVertical = pOPO->IsVertical();     // content wins
     205         [ #  # ]:          0 :                 pO->SetVertical( bVertical );
     206                 :            : 
     207                 :            :                 //!??   ohne uebergebenen Outliner stimmen die Defaults nicht ???!?
     208 [ #  # ][ #  # ]:          0 :                 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, sal_True, pO) )
     209                 :            :                 {
     210                 :            :                     //  EditEngine-UndoManager anmelden
     211 [ #  # ][ #  # ]:          0 :                     pViewShell->SetDrawTextUndo( &pO->GetUndoManager() );
     212                 :            : 
     213                 :          0 :                     OutlinerView* pOLV = pView->GetTextEditOutlinerView();
     214 [ #  # ][ #  # ]:          0 :                     if ( pOLV->MouseButtonDown(rMEvt) )
     215                 :          0 :                         return (sal_True); // Event an den Outliner
     216                 :            :                 }
     217                 :            :             }
     218                 :            :             else
     219                 :            :             {
     220                 :            :                 // disable tail & circular move for caption objects.
     221                 :          0 :                 bool bDrag = false;
     222                 :          0 :                 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     223         [ #  # ]:          0 :                 if( rMarkList.GetMarkCount() == 1 )
     224                 :            :                 {
     225 [ #  # ][ #  # ]:          0 :                     SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
     226 [ #  # ][ #  # ]:          0 :                     if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
     227                 :            :                     {
     228 [ #  # ][ #  # ]:          0 :                         if(pHdl->GetKind() != HDL_POLY && pHdl->GetKind() != HDL_CIRC)
                 [ #  # ]
     229                 :          0 :                             bDrag = true;
     230                 :            :                     }
     231                 :            :                     else
     232                 :          0 :                         bDrag = true;   // different object
     233                 :            :                 }
     234                 :            :                 else
     235                 :          0 :                     bDrag = true;       // several objects
     236                 :            : 
     237         [ #  # ]:          0 :                 if ( bDrag )
     238                 :            :                 {
     239         [ #  # ]:          0 :                     aDragTimer.Start();
     240         [ #  # ]:          0 :                     pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl);
     241                 :            :                 }
     242                 :            :             }
     243                 :            :         }
     244                 :            :         else
     245                 :            :         {
     246                 :          0 :             sal_Bool bMacro = false;
     247                 :            : 
     248                 :            : //          if (bMacro && pView->TakeMacroObject(aMDPos,pObj,pPV))
     249 [ #  # ][ #  # ]:          0 :             if (bMacro && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
         [ #  # ][ #  # ]
     250                 :            : 
     251                 :            :             {
     252         [ #  # ]:          0 :                 pView->BegMacroObj(aMDPos,pObj,pPV,pWindow);
     253                 :            :             }
     254                 :            :             else
     255                 :            :             {
     256         [ #  # ]:          0 :                 if (pView->IsEditMode())
     257                 :            :                 {
     258         [ #  # ]:          0 :                     sal_Bool bPointMode=pView->HasMarkablePoints();
     259                 :            : 
     260         [ #  # ]:          0 :                     if (!rMEvt.IsShift())
     261                 :            :                     {
     262         [ #  # ]:          0 :                         if (bPointMode)
     263                 :            :                         {
     264         [ #  # ]:          0 :                             pView->UnmarkAllPoints();
     265                 :            :                         }
     266                 :            :                         else
     267                 :            :                         {
     268         [ #  # ]:          0 :                             pView->UnmarkAll();
     269                 :            :                         }
     270                 :            : 
     271         [ #  # ]:          0 :                         pView->SetDragMode(SDRDRAG_MOVE);
     272                 :          0 :                         SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
     273         [ #  # ]:          0 :                         rBindings.Invalidate( SID_OBJECT_ROTATE );
     274         [ #  # ]:          0 :                         rBindings.Invalidate( SID_OBJECT_MIRROR );
     275         [ #  # ]:          0 :                         pHdl=pView->GetHdl(nHdlNum);
     276                 :            :                     }
     277                 :            : 
     278 [ #  # ][ #  # ]:          0 :                     if ( pView->MarkObj(aMDPos, -2, false, rMEvt.IsMod1()) )
     279                 :            :                     {
     280         [ #  # ]:          0 :                         aDragTimer.Start();
     281                 :            : 
     282         [ #  # ]:          0 :                         pHdl=pView->PickHandle(aMDPos);
     283                 :            : 
     284         [ #  # ]:          0 :                         if (pHdl!=NULL)
     285                 :            :                         {
     286         [ #  # ]:          0 :                             pView->MarkPoint(*pHdl);
     287         [ #  # ]:          0 :                             pHdl=pView->GetHdl(nHdlNum);
     288                 :            :                         }
     289                 :            : 
     290         [ #  # ]:          0 :                         pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl);
     291                 :            :                     }
     292                 :            :                     else
     293                 :            :                     {
     294         [ #  # ]:          0 :                         if (bPointMode)
     295                 :            :                         {
     296         [ #  # ]:          0 :                             pView->BegMarkPoints(aMDPos);
     297                 :            :                         }
     298                 :            :                         else
     299                 :            :                         {
     300         [ #  # ]:          0 :                             pView->BegMarkObj(aMDPos);
     301                 :            :                         }
     302                 :            :                     }
     303                 :            :                 }
     304         [ #  # ]:          0 :                 else if (aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
     305                 :            :                 {
     306                 :            :                     //  Notizen editieren -> keine neuen Textobjekte erzeugen,
     307                 :            :                     //  stattdessen Textmodus verlassen
     308                 :            : 
     309         [ #  # ]:          0 :                     pViewShell->GetViewData()->GetDispatcher().
     310         [ #  # ]:          0 :                         Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     311                 :            :                 }
     312                 :            :                 else
     313                 :            :                 {
     314                 :            :                     /**********************************************************
     315                 :            :                     * Objekt erzeugen
     316                 :            :                     **********************************************************/
     317         [ #  # ]:          0 :                     pView->BegCreateObj(aMDPos, (OutputDevice*) NULL);
     318                 :            :                 }
     319                 :            :             }
     320                 :            :         }
     321                 :            :     }
     322                 :            : 
     323                 :            : 
     324         [ #  # ]:          0 :     if (!bIsInDragMode)
     325                 :            :     {
     326                 :          0 :         pWindow->CaptureMouse();
     327                 :            : //      ForcePointer(&rMEvt);
     328                 :          0 :         lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() );
     329                 :            :     }
     330                 :            : 
     331                 :            :     pViewShell->SetActivePointer(pView->GetPreferedPointer(
     332 [ #  # ][ #  # ]:          0 :                     pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
     333                 :            : 
     334                 :            : //  return (bReturn);
     335                 :          0 :     return sal_True;
     336                 :            : }
     337                 :            : 
     338                 :            : /*************************************************************************
     339                 :            : |*
     340                 :            : |* MouseMove-event
     341                 :            : |*
     342                 :            : \************************************************************************/
     343                 :            : 
     344                 :          0 : sal_Bool FuText::MouseMove(const MouseEvent& rMEvt)
     345                 :            : {
     346                 :          0 :     sal_Bool bReturn = false;
     347                 :            : 
     348                 :            : //  pViewShell->SetActivePointer(aNewPointer);
     349                 :            : 
     350                 :            :     pViewShell->SetActivePointer(pView->GetPreferedPointer(
     351 [ #  # ][ #  # ]:          0 :                     pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
     352                 :            : 
     353         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     354                 :            :     {
     355         [ #  # ]:          0 :         Point aOldPixel = pWindow->LogicToPixel( aMDPos );
     356                 :          0 :         Point aNewPixel = rMEvt.GetPosPixel();
     357         [ #  # ]:          0 :         if ( Abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE ||
           [ #  #  #  # ]
     358                 :          0 :              Abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE )
     359         [ #  # ]:          0 :             aDragTimer.Stop();
     360                 :            :     }
     361                 :            : 
     362         [ #  # ]:          0 :     if ( pView->MouseMove(rMEvt, pWindow) )
     363                 :          0 :         return (sal_True); // Event von der SdrView ausgewertet
     364                 :            : 
     365         [ #  # ]:          0 :     if ( pView->IsAction() )
     366                 :            :     {
     367                 :          0 :         Point aPix(rMEvt.GetPosPixel());
     368         [ #  # ]:          0 :         Point aPnt(pWindow->PixelToLogic(aPix));
     369                 :            : 
     370         [ #  # ]:          0 :         ForceScroll(aPix);
     371         [ #  # ]:          0 :         pView->MovAction(aPnt);
     372                 :            :     }
     373                 :            : 
     374                 :          0 :     return (bReturn);
     375                 :            : }
     376                 :            : 
     377                 :            : /*************************************************************************
     378                 :            : |*
     379                 :            : |* MouseButtonUp-event
     380                 :            : |*
     381                 :            : \************************************************************************/
     382                 :            : 
     383                 :          0 : sal_Bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
     384                 :            : {
     385                 :            :     // remember button state for creation of own MouseEvents
     386                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     387                 :            : 
     388                 :          0 :     sal_Bool bReturn = false;
     389                 :            : 
     390         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     391                 :            :     {
     392         [ #  # ]:          0 :         aDragTimer.Stop();
     393                 :            :     }
     394                 :            : 
     395         [ #  # ]:          0 :     lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() );
     396                 :            : 
     397         [ #  # ]:          0 :     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     398                 :            : 
     399 [ #  # ][ #  # ]:          0 :     if ( pView->MouseButtonUp(rMEvt, pWindow) )
     400                 :          0 :         return (sal_True); // Event von der SdrView ausgewertet
     401                 :            : 
     402         [ #  # ]:          0 :     if ( pView->IsDragObj() )
     403                 :            :     {
     404         [ #  # ]:          0 :         pView->EndDragObj( rMEvt.IsShift() );
     405                 :          0 :         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     406         [ #  # ]:          0 :         if (rMarkList.GetMarkCount() == 1)
     407                 :            :         {
     408         [ #  # ]:          0 :               SdrMark* pMark = rMarkList.GetMark(0);
     409         [ #  # ]:          0 :               SdrObject* pObj = pMark->GetMarkedSdrObj();
     410                 :          0 :               FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
     411                 :          0 :               FuText* pText = static_cast<FuText*>(pPoor);
     412         [ #  # ]:          0 :             pText->StopDragMode(pObj );
     413                 :            :         }
     414         [ #  # ]:          0 :         pView->ForceMarkedToAnotherPage();
     415                 :            :     }
     416         [ #  # ]:          0 :     else if ( pView->IsCreateObj() )
     417                 :            :     {
     418         [ #  # ]:          0 :         if (rMEvt.IsLeft())
     419                 :            :         {
     420         [ #  # ]:          0 :             pView->EndCreateObj(SDRCREATE_FORCEEND);
     421         [ #  # ]:          0 :             if (aSfxRequest.GetSlot() == SID_DRAW_TEXT_MARQUEE)
     422                 :            :             {
     423                 :            :                 //  Lauftext-Objekt erzeugen?
     424                 :            : 
     425                 :          0 :                 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     426 [ #  # ][ #  # ]:          0 :                 if (rMarkList.GetMark(0))
     427                 :            :                 {
     428 [ #  # ][ #  # ]:          0 :                     SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     429                 :            : 
     430                 :            :                     // die fuer das Scrollen benoetigten Attribute setzen
     431                 :          0 :                     SfxItemSet aItemSet( pDrDoc->GetItemPool(),
     432         [ #  # ]:          0 :                                             SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
     433                 :            : 
     434 [ #  # ][ #  # ]:          0 :                     aItemSet.Put( SdrTextAutoGrowWidthItem( false ) );
                 [ #  # ]
     435 [ #  # ][ #  # ]:          0 :                     aItemSet.Put( SdrTextAutoGrowHeightItem( false ) );
                 [ #  # ]
     436 [ #  # ][ #  # ]:          0 :                     aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) );
                 [ #  # ]
     437 [ #  # ][ #  # ]:          0 :                     aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
                 [ #  # ]
     438 [ #  # ][ #  # ]:          0 :                     aItemSet.Put( SdrTextAniCountItem( 1 ) );
                 [ #  # ]
     439                 :            :                     aItemSet.Put( SdrTextAniAmountItem(
     440 [ #  # ][ #  # ]:          0 :                                     (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) );
         [ #  # ][ #  # ]
     441 [ #  # ][ #  # ]:          0 :                     pObj->SetMergedItemSetAndBroadcast(aItemSet);
     442                 :            :                 }
     443                 :            :             }
     444                 :            : 
     445                 :            :             // init object different when vertical writing
     446                 :          0 :             sal_uInt16 nSlotID(aSfxRequest.GetSlot());
     447                 :          0 :             sal_Bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotID);
     448         [ #  # ]:          0 :             if(bVertical)
     449                 :            :             {
     450                 :          0 :                 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     451 [ #  # ][ #  # ]:          0 :                 if(rMarkList.GetMark(0))
     452                 :            :                 {
     453 [ #  # ][ #  # ]:          0 :                     SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     454 [ #  # ][ #  # ]:          0 :                     if(pObj && pObj->ISA(SdrTextObj))
         [ #  # ][ #  # ]
                 [ #  # ]
     455                 :            :                     {
     456                 :          0 :                         SdrTextObj* pText = (SdrTextObj*)pObj;
     457         [ #  # ]:          0 :                         SfxItemSet aSet(pDrDoc->GetItemPool());
     458                 :            : 
     459         [ #  # ]:          0 :                         pText->SetVerticalWriting(sal_True);
     460                 :            : 
     461 [ #  # ][ #  # ]:          0 :                         aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
                 [ #  # ]
     462 [ #  # ][ #  # ]:          0 :                         aSet.Put(SdrTextAutoGrowHeightItem(false));
                 [ #  # ]
     463 [ #  # ][ #  # ]:          0 :                         aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
                 [ #  # ]
     464 [ #  # ][ #  # ]:          0 :                         aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
                 [ #  # ]
     465                 :            : 
     466 [ #  # ][ #  # ]:          0 :                         pText->SetMergedItemSet(aSet);
     467                 :            :                     }
     468                 :            :                 }
     469                 :            :             }
     470                 :            : 
     471         [ #  # ]:          0 :             SetInEditMode();
     472                 :            : 
     473                 :            :                 //  Modus verlassen bei einzelnem Klick
     474                 :            :                 //  (-> fuconstr)
     475                 :            : 
     476         [ #  # ]:          0 :             if ( !pView->AreObjectsMarked() )
     477                 :            :             {
     478         [ #  # ]:          0 :                 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
     479                 :            : 
     480         [ #  # ]:          0 :                 SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
     481         [ #  # ]:          0 :                 if ( pView->AreObjectsMarked() )
     482         [ #  # ]:          0 :                     rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     483                 :            :                 else
     484         [ #  # ]:          0 :                     rDisp.Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     485                 :            :             }
     486                 :            :         }
     487                 :            :     }
     488 [ #  # ][ #  # ]:          0 :     else if ( pView->IsAction() )
     489                 :            :     {
     490         [ #  # ]:          0 :         pView->EndAction();
     491                 :            :     }
     492 [ #  # ][ #  # ]:          0 :     else if( !pView->IsAction() )
     493                 :            :     {
     494         [ #  # ]:          0 :         pWindow->ReleaseMouse();
     495                 :            : 
     496 [ #  # ][ #  # ]:          0 :         if ( !pView->AreObjectsMarked() && rMEvt.GetClicks() < 2 )
                 [ #  # ]
     497                 :            :         {
     498         [ #  # ]:          0 :             pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
     499                 :            : 
     500         [ #  # ]:          0 :             SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
     501         [ #  # ]:          0 :             if ( pView->AreObjectsMarked() )
     502         [ #  # ]:          0 :                 rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     503                 :            :             else
     504         [ #  # ]:          0 :                 rDisp.Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     505                 :            :         }
     506                 :            :     }
     507                 :            : 
     508                 :          0 :     return (bReturn);
     509                 :            : }
     510                 :            : 
     511                 :            : /*************************************************************************
     512                 :            : |*
     513                 :            : |* Maus-Pointer umschalten
     514                 :            : |*
     515                 :            : \************************************************************************/
     516                 :            : 
     517                 :          0 : void FuText::ForcePointer(const MouseEvent* /* pMEvt */)
     518                 :            : {
     519                 :          0 :     pViewShell->SetActivePointer( aNewPointer );
     520                 :          0 : }
     521                 :            : 
     522                 :            : 
     523                 :            : 
     524                 :            : /*************************************************************************
     525                 :            : |*
     526                 :            : |* Tastaturereignisse bearbeiten
     527                 :            : |*
     528                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     529                 :            : |* FALSE.
     530                 :            : |*
     531                 :            : \************************************************************************/
     532                 :            : 
     533                 :          0 : sal_Bool FuText::KeyInput(const KeyEvent& rKEvt)
     534                 :            : {
     535                 :          0 :     sal_Bool bReturn = false;
     536                 :            : 
     537         [ #  # ]:          0 :     if ( pView->KeyInput(rKEvt, pWindow) )
     538                 :            :     {
     539                 :          0 :         bReturn = sal_True;
     540                 :          0 :         lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() );
     541                 :            :     }
     542                 :            :     else
     543                 :            :     {
     544                 :          0 :         bReturn = FuDraw::KeyInput(rKEvt);
     545                 :            :     }
     546                 :            : 
     547                 :          0 :     return (bReturn);
     548                 :            : }
     549                 :            : 
     550                 :            : 
     551                 :            : 
     552                 :            : /*************************************************************************
     553                 :            : |*
     554                 :            : |* Function aktivieren
     555                 :            : |*
     556                 :            : \************************************************************************/
     557                 :            : 
     558                 :          0 : void FuText::Activate()
     559                 :            : {
     560                 :          0 :     pView->SetDragMode(SDRDRAG_MOVE);
     561                 :          0 :     SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
     562                 :          0 :     rBindings.Invalidate( SID_OBJECT_ROTATE );
     563                 :          0 :     rBindings.Invalidate( SID_OBJECT_MIRROR );
     564                 :            : 
     565                 :            : //  Sofort in den Edit Mode setzen
     566                 :            : //  SetInEditMode();
     567                 :            : 
     568                 :            : //  if (!pTextObj)
     569                 :            :     {
     570                 :            :         /**********************************************************************
     571                 :            :         * Kein Textobjekt im EditMode, daher CreateMode setzen
     572                 :            :         **********************************************************************/
     573                 :          0 :         sal_uInt16 nObj = OBJ_TEXT;
     574                 :            : 
     575                 :          0 :         pView->SetCurrentObj(nObj);
     576                 :            : 
     577                 :          0 :         pView->SetCreateMode();
     578                 :            :     }
     579                 :            : 
     580                 :          0 :     aNewPointer = Pointer(POINTER_TEXT);
     581                 :            : 
     582                 :          0 :     aOldPointer = pWindow->GetPointer();
     583                 :          0 :     pViewShell->SetActivePointer( aNewPointer );
     584                 :            : 
     585                 :          0 :     FuConstruct::Activate();
     586                 :          0 : }
     587                 :            : 
     588                 :            : 
     589                 :            : /*************************************************************************
     590                 :            : |*
     591                 :            : |* Function deaktivieren
     592                 :            : |*
     593                 :            : \************************************************************************/
     594                 :            : 
     595                 :          0 : void FuText::Deactivate()
     596                 :            : {
     597                 :          0 :     FuConstruct::Deactivate();
     598                 :          0 :     pViewShell->SetActivePointer( aOldPointer );
     599                 :          0 :     StopEditMode();
     600                 :          0 : }
     601                 :            : 
     602                 :            : 
     603                 :            : /*************************************************************************
     604                 :            : |*
     605                 :            : |* Selektion hat sich geaendert
     606                 :            : |*
     607                 :            : \************************************************************************/
     608                 :            : 
     609                 :          0 : void FuText::SelectionHasChanged()
     610                 :            : {
     611                 :          0 :     pView->SetDragMode(SDRDRAG_MOVE);
     612                 :          0 :     SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
     613                 :          0 :     rBindings.Invalidate( SID_OBJECT_ROTATE );
     614                 :          0 :     rBindings.Invalidate( SID_OBJECT_MIRROR );
     615                 :            : 
     616                 :          0 :     pTextObj = NULL;
     617                 :            : 
     618         [ #  # ]:          0 :     if ( pView->AreObjectsMarked() )
     619                 :            :     {
     620                 :          0 :         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     621                 :            : 
     622         [ #  # ]:          0 :         if (rMarkList.GetMarkCount() == 1)
     623                 :            :         {
     624                 :          0 :             SdrMark* pMark = rMarkList.GetMark(0);
     625                 :          0 :             SdrObject* pObj = pMark->GetMarkedSdrObj();
     626                 :            : 
     627                 :          0 :             sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
     628                 :            : 
     629 [ #  # ][ #  # ]:          0 :             if (nSdrObjKind == OBJ_TEXT ||
                 [ #  # ]
     630                 :            :                 nSdrObjKind == OBJ_TITLETEXT ||
     631                 :            :                 nSdrObjKind == OBJ_OUTLINETEXT /* ||
     632                 :            :                 pObj->ISA(SdrTextObj) */ )
     633                 :            :             {
     634                 :          0 :                 pTextObj = (SdrTextObj*) pObj;
     635                 :            :             }
     636                 :            :         }
     637                 :            :     }
     638                 :            : 
     639         [ #  # ]:          0 :     if (!pTextObj)
     640                 :            :     {
     641                 :            :         /**********************************************************************
     642                 :            :         * Kein Textobjekt im EditMode, daher CreateMode setzen
     643                 :            :         **********************************************************************/
     644                 :          0 :         sal_uInt16 nObj = OBJ_TEXT;
     645                 :            :         sal_uInt16 nIdent;
     646                 :            :         sal_uInt32 nInvent;
     647                 :          0 :         pView->TakeCurrentObj(nIdent, nInvent);
     648                 :            : 
     649         [ #  # ]:          0 :         pView->SetCurrentObj(nObj);
     650                 :            : 
     651         [ #  # ]:          0 :         pView->SetCreateMode();
     652                 :            :     }
     653                 :          0 : }
     654                 :            : 
     655                 :            : /*************************************************************************
     656                 :            : |*
     657                 :            : |* Objekt in Edit-Mode setzen
     658                 :            : |*
     659                 :            : \************************************************************************/
     660                 :            : 
     661                 :          0 : void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
     662                 :            :                             sal_Bool bCursorToEnd, const KeyEvent* pInitialKey)
     663                 :            : {
     664                 :            :     /*  It is possible to pass a special (unselected) object in pObj, e.g. the
     665                 :            :         caption object of a cell note. If pObj is 0, then the selected object
     666                 :            :         is used. The layer will be relocked in FuText::StopEditMode(). */
     667 [ #  # ][ #  # ]:          0 :     if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) )
                 [ #  # ]
     668                 :          0 :         pView->UnlockInternalLayer();
     669                 :            : 
     670 [ #  # ][ #  # ]:          0 :     if ( !pObj && pView->AreObjectsMarked() )
                 [ #  # ]
     671                 :            :     {
     672                 :          0 :         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     673         [ #  # ]:          0 :         if (rMarkList.GetMarkCount() == 1)
     674                 :            :         {
     675                 :          0 :             SdrMark* pMark = rMarkList.GetMark(0);
     676                 :          0 :             pObj = pMark->GetMarkedSdrObj();
     677                 :            :         }
     678                 :            :     }
     679                 :            : 
     680                 :          0 :     pTextObj = NULL;
     681                 :            : 
     682         [ #  # ]:          0 :     if ( pObj )
     683                 :            :     {
     684                 :          0 :         sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
     685                 :            : 
     686         [ #  # ]:          0 :         if (nSdrObjKind == OBJ_TEXT ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     687                 :            :             nSdrObjKind == OBJ_TITLETEXT ||
     688                 :            :             nSdrObjKind == OBJ_OUTLINETEXT ||
     689                 :          0 :             pObj->ISA(SdrTextObj))
     690                 :            :         {
     691                 :          0 :             SdrPageView* pPV = pView->GetSdrPageView();
     692                 :            : 
     693         [ #  # ]:          0 :             if ( pObj->HasTextEdit() )
     694                 :            :             {
     695                 :          0 :                 SdrOutliner* pO = MakeOutliner();
     696                 :          0 :                 lcl_UpdateHyphenator( *pO, pObj );
     697                 :            : 
     698                 :            :                 //  vertical flag:
     699                 :            :                 //  deduced from slot ids only if text object has no content
     700                 :            : 
     701                 :          0 :                 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
     702                 :          0 :                 sal_Bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
     703                 :          0 :                 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     704         [ #  # ]:          0 :                 if ( pOPO )
     705                 :          0 :                     bVertical = pOPO->IsVertical();     // content wins
     706                 :          0 :                 pO->SetVertical( bVertical );
     707                 :            : 
     708                 :            :                 //!??   ohne uebergebenen Outliner stimmen die Defaults nicht ???!?
     709         [ #  # ]:          0 :                 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, sal_True, pO) )
     710                 :            :                 {
     711                 :            :                     //  EditEngine-UndoManager anmelden
     712                 :          0 :                     pViewShell->SetDrawTextUndo( &pO->GetUndoManager() );
     713                 :            : 
     714                 :          0 :                     pTextObj = (SdrTextObj*) pObj;
     715                 :          0 :                     pView->SetEditMode();
     716                 :            : 
     717                 :            :                     //  set text cursor to click position or to end,
     718                 :            :                     //  pass initial key event to outliner view
     719 [ #  # ][ #  # ]:          0 :                     if ( pMousePixel || bCursorToEnd || pInitialKey )
                 [ #  # ]
     720                 :            :                     {
     721                 :          0 :                         OutlinerView* pOLV = pView->GetTextEditOutlinerView();
     722         [ #  # ]:          0 :                         if (pOLV)
     723                 :            :                         {
     724         [ #  # ]:          0 :                             if ( pMousePixel )
     725                 :            :                             {
     726         [ #  # ]:          0 :                                 MouseEvent aEditEvt( *pMousePixel, 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
     727         [ #  # ]:          0 :                                 pOLV->MouseButtonDown(aEditEvt);
     728         [ #  # ]:          0 :                                 pOLV->MouseButtonUp(aEditEvt);
     729                 :            :                             }
     730         [ #  # ]:          0 :                             else if ( bCursorToEnd )
     731                 :            :                             {
     732                 :          0 :                                 ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
     733         [ #  # ]:          0 :                                 pOLV->SetSelection(aNewSelection);
     734                 :            :                             }
     735                 :            : 
     736         [ #  # ]:          0 :                             if ( pInitialKey )
     737                 :          0 :                                 pOLV->PostKeyEvent( *pInitialKey );
     738                 :            :                         }
     739                 :            :                     }
     740                 :            :                 }
     741                 :            :             }
     742                 :            :         }
     743                 :            :     }
     744                 :          0 : }
     745                 :            : 
     746                 :            : // Create default drawing objects via keyboard
     747                 :          0 : SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
     748                 :            : {
     749                 :            :     // case SID_DRAW_TEXT:
     750                 :            :     // case SID_DRAW_TEXT_VERTICAL:
     751                 :            :     // case SID_DRAW_TEXT_MARQUEE:
     752                 :            :     // case SID_DRAW_NOTEEDIT:
     753                 :            : 
     754                 :            :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     755                 :          0 :         pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
     756                 :          0 :         0L, pDrDoc);
     757                 :            : 
     758         [ #  # ]:          0 :     if(pObj)
     759                 :            :     {
     760         [ #  # ]:          0 :         if(pObj->ISA(SdrTextObj))
     761                 :            :         {
     762                 :          0 :             SdrTextObj* pText = (SdrTextObj*)pObj;
     763                 :          0 :             pText->SetLogicRect(rRectangle);
     764                 :            : 
     765                 :            :             //  don't set default text, start edit mode instead
     766                 :            :             // String aText(ScResId(STR_CAPTION_DEFAULT_TEXT));
     767                 :            :             // pText->SetText(aText);
     768                 :            : 
     769                 :          0 :             sal_Bool bVertical = (SID_DRAW_TEXT_VERTICAL == nID);
     770                 :          0 :             sal_Bool bMarquee = (SID_DRAW_TEXT_MARQUEE == nID);
     771                 :            : 
     772                 :          0 :             pText->SetVerticalWriting(bVertical);
     773                 :            : 
     774         [ #  # ]:          0 :             if(bVertical)
     775                 :            :             {
     776         [ #  # ]:          0 :                 SfxItemSet aSet(pDrDoc->GetItemPool());
     777                 :            : 
     778 [ #  # ][ #  # ]:          0 :                 aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
                 [ #  # ]
     779 [ #  # ][ #  # ]:          0 :                 aSet.Put(SdrTextAutoGrowHeightItem(false));
                 [ #  # ]
     780 [ #  # ][ #  # ]:          0 :                 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
                 [ #  # ]
     781 [ #  # ][ #  # ]:          0 :                 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
                 [ #  # ]
     782                 :            : 
     783 [ #  # ][ #  # ]:          0 :                 pText->SetMergedItemSet(aSet);
     784                 :            :             }
     785                 :            : 
     786         [ #  # ]:          0 :             if(bMarquee)
     787                 :            :             {
     788         [ #  # ]:          0 :                 SfxItemSet aSet(pDrDoc->GetItemPool(), SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
     789                 :            : 
     790 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAutoGrowWidthItem( false ) );
                 [ #  # ]
     791 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAutoGrowHeightItem( false ) );
                 [ #  # ]
     792 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) );
                 [ #  # ]
     793 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
                 [ #  # ]
     794 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAniCountItem( 1 ) );
                 [ #  # ]
     795 [ #  # ][ #  # ]:          0 :                 aSet.Put( SdrTextAniAmountItem( (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) );
         [ #  # ][ #  # ]
     796                 :            : 
     797 [ #  # ][ #  # ]:          0 :                 pObj->SetMergedItemSetAndBroadcast(aSet);
     798                 :            :             }
     799                 :            : 
     800                 :          0 :             SetInEditMode( pObj );      // start edit mode
     801                 :            :         }
     802                 :            :         else
     803                 :            :         {
     804                 :            :             OSL_FAIL("Object is NO text object");
     805                 :            :         }
     806                 :            :     }
     807                 :            : 
     808                 :          0 :     return pObj;
     809                 :            : }
     810                 :            : 
     811                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10