LCOV - code coverage report
Current view: top level - sc/source/ui/view - tabvwsh2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 28 188 14.9 %
Date: 2012-08-25 Functions: 2 5 40.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 35 418 8.4 %

           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                 :            : #ifdef _MSC_VER
      30                 :            : #pragma optimize ("", off)
      31                 :            : #endif
      32                 :            : 
      33                 :            : #include <sfx2/bindings.hxx>
      34                 :            : #include <sfx2/viewfrm.hxx>
      35                 :            : #include <svl/aeitem.hxx>
      36                 :            : #include <svl/whiter.hxx>
      37                 :            : #include <unotools/moduleoptions.hxx>
      38                 :            : #include <svl/languageoptions.hxx>
      39                 :            : #include <sfx2/dispatch.hxx>
      40                 :            : 
      41                 :            : #include "tabvwsh.hxx"
      42                 :            : #include "drawattr.hxx"
      43                 :            : #include "drawsh.hxx"
      44                 :            : #include "drawview.hxx"
      45                 :            : #include "fupoor.hxx"
      46                 :            : #include "fuconrec.hxx"
      47                 :            : #include "fuconpol.hxx"
      48                 :            : #include "fuconarc.hxx"
      49                 :            : #include "fuconuno.hxx"
      50                 :            : #include "fusel.hxx"
      51                 :            : #include "futext.hxx"
      52                 :            : #include "fumark.hxx"
      53                 :            : #include "fuinsert.hxx"
      54                 :            : #include "global.hxx"
      55                 :            : #include "sc.hrc"
      56                 :            : #include "scmod.hxx"
      57                 :            : #include "appoptio.hxx"
      58                 :            : 
      59                 :            : // Create default drawing objects via keyboard
      60                 :            : #include <svx/svdpagv.hxx>
      61                 :            : #include <svl/stritem.hxx>
      62                 :            : #include <svx/svdpage.hxx>
      63                 :            : #include <fuconcustomshape.hxx>
      64                 :            : 
      65                 :            : // -----------------------------------------------------------------------
      66                 :            : 
      67                 :          0 : SdrView* ScTabViewShell::GetDrawView() const
      68                 :            : {
      69                 :          0 :     return ((ScTabViewShell*)this)->GetScDrawView();    // GetScDrawView ist nicht-const
      70                 :            : }
      71                 :            : 
      72                 :        303 : void ScTabViewShell::WindowChanged()
      73                 :            : {
      74                 :        303 :     Window* pWin = GetActiveWin();
      75                 :            : 
      76                 :        303 :     ScDrawView* pDrView = GetScDrawView();
      77         [ +  - ]:        303 :     if (pDrView)
      78                 :        303 :         pDrView->SetActualWin(pWin);
      79                 :            : 
      80                 :        303 :     FuPoor* pFunc = GetDrawFuncPtr();
      81         [ +  - ]:        303 :     if (pFunc)
      82                 :        303 :         pFunc->SetWindow(pWin);
      83                 :            : 
      84                 :            :     //  when font from InputContext is used,
      85                 :            :     //  this must be moved to change of cursor position:
      86                 :        303 :     UpdateInputContext();
      87                 :        303 : }
      88                 :            : 
      89                 :          0 : void ScTabViewShell::ExecDraw(SfxRequest& rReq)
      90                 :            : {
      91 [ #  # ][ #  # ]:          0 :     SC_MOD()->InputEnterHandler();
      92         [ #  # ]:          0 :     UpdateInputHandler();
      93                 :            : 
      94         [ #  # ]:          0 :     MakeDrawLayer();
      95                 :            : 
      96         [ #  # ]:          0 :     ScTabView* pTabView = GetViewData()->GetView();
      97                 :          0 :     SfxBindings& rBindings = GetViewFrame()->GetBindings();
      98                 :            : 
      99         [ #  # ]:          0 :     Window*     pWin    = pTabView->GetActiveWin();
     100                 :          0 :     ScDrawView* pView   = pTabView->GetScDrawView();
     101                 :          0 :     SdrModel*   pDoc    = pView->GetModel();
     102                 :            : 
     103                 :          0 :     const SfxItemSet *pArgs = rReq.GetArgs();
     104                 :          0 :     sal_uInt16 nNewId = rReq.GetSlot();
     105                 :            : 
     106         [ #  # ]:          0 :     if ( nNewId == SID_DRAW_CHART )
     107                 :            :     {
     108                 :            :         // #i71254# directly insert a chart instead of drawing its output rectangle
     109 [ #  # ][ #  # ]:          0 :         FuInsertChart(this, pWin, pView, pDoc, rReq);
     110                 :            :         return;
     111                 :            :     }
     112                 :            : 
     113                 :            :     //
     114                 :            :     //  Pseudo-Slots von Draw-Toolbox auswerten
     115                 :            :     //! wird das ueberhaupt noch gebraucht ?????
     116                 :            :     //
     117                 :            : 
     118 [ #  # ][ #  # ]:          0 :     if (nNewId == SID_INSERT_DRAW && pArgs)
     119                 :            :     {
     120                 :            :         const SfxPoolItem* pItem;
     121 [ #  # ][ #  # ]:          0 :         if ( pArgs->GetItemState( SID_INSERT_DRAW, sal_True, &pItem ) == SFX_ITEM_SET &&
         [ #  # ][ #  # ]
     122 [ #  # ][ #  # ]:          0 :              pItem->ISA( SvxDrawToolItem ) )
     123                 :            :         {
     124                 :          0 :             SvxDrawToolEnum eSel = (SvxDrawToolEnum)((const SvxDrawToolItem*)pItem)->GetValue();
     125   [ #  #  #  #  :          0 :             switch (eSel)
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     126                 :            :             {
     127                 :          0 :                 case SVX_SNAP_DRAW_SELECT:          nNewId = SID_OBJECT_SELECT;         break;
     128                 :          0 :                 case SVX_SNAP_DRAW_LINE:            nNewId = SID_DRAW_LINE;             break;
     129                 :          0 :                 case SVX_SNAP_DRAW_RECT:            nNewId = SID_DRAW_RECT;             break;
     130                 :          0 :                 case SVX_SNAP_DRAW_ELLIPSE:         nNewId = SID_DRAW_ELLIPSE;          break;
     131                 :          0 :                 case SVX_SNAP_DRAW_POLYGON_NOFILL:  nNewId = SID_DRAW_POLYGON_NOFILL;   break;
     132                 :          0 :                 case SVX_SNAP_DRAW_BEZIER_NOFILL:   nNewId = SID_DRAW_BEZIER_NOFILL;    break;
     133                 :          0 :                 case SVX_SNAP_DRAW_FREELINE_NOFILL: nNewId = SID_DRAW_FREELINE_NOFILL;  break;
     134                 :          0 :                 case SVX_SNAP_DRAW_ARC:             nNewId = SID_DRAW_ARC;              break;
     135                 :          0 :                 case SVX_SNAP_DRAW_PIE:             nNewId = SID_DRAW_PIE;              break;
     136                 :          0 :                 case SVX_SNAP_DRAW_CIRCLECUT:       nNewId = SID_DRAW_CIRCLECUT;        break;
     137                 :          0 :                 case SVX_SNAP_DRAW_TEXT:            nNewId = SID_DRAW_TEXT;             break;
     138                 :          0 :                 case SVX_SNAP_DRAW_TEXT_VERTICAL:   nNewId = SID_DRAW_TEXT_VERTICAL;    break;
     139                 :          0 :                 case SVX_SNAP_DRAW_TEXT_MARQUEE:    nNewId = SID_DRAW_TEXT_MARQUEE;     break;
     140                 :          0 :                 case SVX_SNAP_DRAW_CAPTION:         nNewId = SID_DRAW_CAPTION;          break;
     141                 :          0 :                 case SVX_SNAP_DRAW_CAPTION_VERTICAL: nNewId = SID_DRAW_CAPTION_VERTICAL; break;
     142                 :            :             }
     143                 :            :         }
     144                 :            :         else                    // sal_uInt16-Item vom Controller
     145                 :            :         {
     146         [ #  # ]:          0 :             rReq.Done();
     147                 :            :             return;
     148                 :            :         }
     149                 :            :     }
     150                 :            : 
     151         [ #  # ]:          0 :     if ( nNewId == SID_DRAW_SELECT )
     152                 :          0 :         nNewId = SID_OBJECT_SELECT;
     153                 :            : 
     154                 :          0 :     sal_uInt16 nNewFormId = 0;
     155 [ #  # ][ #  # ]:          0 :     if ( nNewId == SID_FM_CREATE_CONTROL && pArgs )
     156                 :            :     {
     157                 :            :         const SfxPoolItem* pItem;
     158 [ #  # ][ #  # ]:          0 :         if ( pArgs->GetItemState( SID_FM_CONTROL_IDENTIFIER, sal_True, &pItem ) == SFX_ITEM_SET &&
         [ #  # ][ #  # ]
     159 [ #  # ][ #  # ]:          0 :              pItem->ISA( SfxUInt16Item ) )
     160                 :          0 :             nNewFormId = ((const SfxUInt16Item*)pItem)->GetValue();
     161                 :            :     }
     162                 :            : 
     163         [ #  # ]:          0 :     String sStringItemValue;
     164         [ #  # ]:          0 :     if ( pArgs )
     165                 :            :     {
     166                 :            :         const SfxPoolItem* pItem;
     167 [ #  # ][ #  # ]:          0 :         if ( pArgs->GetItemState( nNewId, sal_True, &pItem ) == SFX_ITEM_SET && pItem->ISA( SfxStringItem ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     168         [ #  # ]:          0 :             sStringItemValue = static_cast<const SfxStringItem*>(pItem)->GetValue();
     169                 :            :     }
     170 [ #  # ][ #  # ]:          0 :     bool bSwitchCustom = ( sStringItemValue.Len() && sDrawCustom.Len() && sStringItemValue != sDrawCustom );
         [ #  # ][ #  # ]
     171                 :            : 
     172         [ #  # ]:          0 :     if (nNewId == SID_INSERT_FRAME)                     // vom Tbx-Button
     173                 :          0 :         nNewId = SID_DRAW_TEXT;
     174                 :            : 
     175                 :            :     //  CTRL-SID_OBJECT_SELECT is used to select the first object,
     176                 :            :     //  but not if SID_OBJECT_SELECT is the result of clicking a create function again,
     177                 :            :     //  so this must be tested before changing nNewId below.
     178 [ #  # ][ #  # ]:          0 :     sal_Bool bSelectFirst = ( nNewId == SID_OBJECT_SELECT && (rReq.GetModifier() & KEY_MOD1) );
                 [ #  # ]
     179                 :            : 
     180                 :          0 :     sal_Bool bEx = IsDrawSelMode();
     181 [ #  # ][ #  # ]:          0 :     if ( rReq.GetModifier() & KEY_MOD1 )
     182                 :            :     {
     183                 :            :         //  always allow keyboard selection also on background layer
     184                 :            :         //  also allow creation of default objects if the same object type
     185                 :            :         //  was already active
     186                 :          0 :         bEx = sal_True;
     187                 :            :     }
     188 [ #  # ][ #  # ]:          0 :     else if ( nNewId == nDrawSfxId && ( nNewId != SID_FM_CREATE_CONTROL ||
         [ #  # ][ #  # ]
                 [ #  # ]
     189                 :          0 :                                     nNewFormId == nFormSfxId || nNewFormId == 0 ) && !bSwitchCustom )
     190                 :            :     {
     191                 :            :         //  #i52871# if a different custom shape is selected, the slot id can be the same,
     192                 :            :         //  so the custom shape type string has to be compared, too.
     193                 :            : 
     194                 :            :         //  SID_FM_CREATE_CONTROL mit nNewFormId==0 (ohne Parameter) kommt beim Deaktivieren
     195                 :            :         //  aus FuConstruct::SimpleMouseButtonUp
     196                 :            :         //  Execute fuer die Form-Shell, um im Controller zu deselektieren
     197         [ #  # ]:          0 :         if ( nNewId == SID_FM_CREATE_CONTROL )
     198                 :            :         {
     199 [ #  # ][ #  # ]:          0 :             GetViewData()->GetDispatcher().Execute(SID_FM_LEAVE_CREATE);
     200         [ #  # ]:          0 :             GetViewFrame()->GetBindings().InvalidateAll(false);
     201                 :            :             //! was fuer einen Slot braucht der komische Controller wirklich, um das anzuzeigen????
     202                 :            :         }
     203                 :            : 
     204                 :          0 :         bEx = !bEx;
     205                 :          0 :         nNewId = SID_OBJECT_SELECT;
     206                 :            :     }
     207                 :            :     else
     208                 :          0 :         bEx = sal_True;
     209                 :            : 
     210 [ #  # ][ #  # ]:          0 :     if ( nDrawSfxId == SID_FM_CREATE_CONTROL && nNewId != nDrawSfxId )
     211                 :            :     {
     212                 :            :         //  Wechsel von Control- zu Zeichenfunktion -> im Control-Controller deselektieren
     213 [ #  # ][ #  # ]:          0 :         GetViewData()->GetDispatcher().Execute(SID_FM_LEAVE_CREATE);
     214         [ #  # ]:          0 :         GetViewFrame()->GetBindings().InvalidateAll(false);
     215                 :            :         //! was fuer einen Slot braucht der komische Controller wirklich, um das anzuzeigen????
     216                 :            :     }
     217                 :            : 
     218                 :          0 :     SetDrawSelMode(bEx);
     219                 :            : 
     220         [ #  # ]:          0 :     pView->LockBackgroundLayer( !bEx );
     221                 :            : 
     222         [ #  # ]:          0 :     if ( bSelectFirst )
     223                 :            :     {
     224                 :            :         //  select first draw object if none is selected yet
     225         [ #  # ]:          0 :         if(!pView->AreObjectsMarked())
     226                 :            :         {
     227                 :            :             // select first object
     228         [ #  # ]:          0 :             pView->UnmarkAllObj();
     229         [ #  # ]:          0 :             pView->MarkNextObj(sal_True);
     230                 :            : 
     231                 :            :             // ...and make it visible
     232         [ #  # ]:          0 :             if(pView->AreObjectsMarked())
     233 [ #  # ][ #  # ]:          0 :                 pView->MakeVisible(pView->GetAllMarkedRect(), *pWin);
     234                 :            :         }
     235                 :            :     }
     236                 :            : 
     237                 :          0 :     nDrawSfxId = nNewId;
     238         [ #  # ]:          0 :     sDrawCustom.Erase();    // value is set below for custom shapes
     239                 :            : 
     240         [ #  # ]:          0 :     if ( nNewId != SID_DRAW_CHART )             // Chart nicht mit DrawShell
     241                 :            :     {
     242 [ #  # ][ #  # ]:          0 :         if ( nNewId == SID_DRAW_TEXT || nNewId == SID_DRAW_TEXT_VERTICAL ||
         [ #  # ][ #  # ]
     243                 :            :                 nNewId == SID_DRAW_TEXT_MARQUEE || nNewId == SID_DRAW_NOTEEDIT )
     244         [ #  # ]:          0 :             SetDrawTextShell( sal_True );
     245                 :            :         else
     246                 :            :         {
     247 [ #  # ][ #  # ]:          0 :             if ( bEx || pView->GetMarkedObjectList().GetMarkCount() != 0 )
                 [ #  # ]
     248         [ #  # ]:          0 :                 SetDrawShellOrSub();
     249                 :            :             else
     250         [ #  # ]:          0 :                 SetDrawShell( false );
     251                 :            :         }
     252                 :            :     }
     253                 :            : 
     254         [ #  # ]:          0 :     if (pTabView->GetDrawFuncPtr())
     255                 :            :     {
     256         [ #  # ]:          0 :         if (pTabView->GetDrawFuncOldPtr() != pTabView->GetDrawFuncPtr())
     257 [ #  # ][ #  # ]:          0 :             delete pTabView->GetDrawFuncOldPtr();
     258                 :            : 
     259         [ #  # ]:          0 :         pTabView->GetDrawFuncPtr()->Deactivate();
     260                 :          0 :         pTabView->SetDrawFuncOldPtr(pTabView->GetDrawFuncPtr());
     261                 :          0 :         pTabView->SetDrawFuncPtr(NULL);
     262                 :            :     }
     263                 :            : 
     264         [ #  # ]:          0 :     SfxRequest aNewReq(rReq);
     265                 :          0 :     aNewReq.SetSlot(nDrawSfxId);
     266                 :            : 
     267   [ #  #  #  #  :          0 :     switch (nNewId)
          #  #  #  #  #  
                      # ]
     268                 :            :     {
     269                 :            :         case SID_OBJECT_SELECT:
     270                 :            :             // Nicht immer zurueckschalten
     271 [ #  # ][ #  # ]:          0 :             if(pView->GetMarkedObjectList().GetMarkCount() == 0) SetDrawShell(bEx);
     272 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuSelection(this, pWin, pView, pDoc, aNewReq));
     273                 :          0 :             break;
     274                 :            : 
     275                 :            :         case SID_DRAW_LINE:
     276                 :            :         case SID_DRAW_RECT:
     277                 :            :         case SID_DRAW_ELLIPSE:
     278 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuConstRectangle(this, pWin, pView, pDoc, aNewReq));
     279                 :          0 :             break;
     280                 :            : 
     281                 :            :         case SID_DRAW_CAPTION:
     282                 :            :         case SID_DRAW_CAPTION_VERTICAL:
     283 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuConstRectangle(this, pWin, pView, pDoc, aNewReq));
     284         [ #  # ]:          0 :             pView->SetFrameDragSingles( false );
     285         [ #  # ]:          0 :             rBindings.Invalidate( SID_BEZIER_EDIT );
     286                 :          0 :             break;
     287                 :            : 
     288                 :            :         case SID_DRAW_POLYGON:
     289                 :            :         case SID_DRAW_POLYGON_NOFILL:
     290                 :            :         case SID_DRAW_BEZIER_NOFILL:
     291                 :            :         case SID_DRAW_FREELINE_NOFILL:
     292 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuConstPolygon(this, pWin, pView, pDoc, aNewReq));
     293                 :          0 :             break;
     294                 :            : 
     295                 :            :         case SID_DRAW_ARC:
     296                 :            :         case SID_DRAW_PIE:
     297                 :            :         case SID_DRAW_CIRCLECUT:
     298 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuConstArc(this, pWin, pView, pDoc, aNewReq));
     299                 :          0 :             break;
     300                 :            : 
     301                 :            :         case SID_DRAW_TEXT:
     302                 :            :         case SID_DRAW_TEXT_VERTICAL:
     303                 :            :         case SID_DRAW_TEXT_MARQUEE:
     304                 :            :         case SID_DRAW_NOTEEDIT:
     305 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuText(this, pWin, pView, pDoc, aNewReq));
     306                 :          0 :             break;
     307                 :            : 
     308                 :            :         case SID_FM_CREATE_CONTROL:
     309         [ #  # ]:          0 :             SetDrawFormShell(sal_True);
     310 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuConstUnoControl(this, pWin, pView, pDoc, aNewReq));
     311                 :          0 :             nFormSfxId = nNewFormId;
     312                 :          0 :             break;
     313                 :            : 
     314                 :            :         case SID_DRAW_CHART:
     315 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr(new FuMarkRect(this, pWin, pView, pDoc, aNewReq));
     316                 :          0 :             break;
     317                 :            : 
     318                 :            :         case SID_DRAWTBX_CS_BASIC :
     319                 :            :         case SID_DRAWTBX_CS_SYMBOL :
     320                 :            :         case SID_DRAWTBX_CS_ARROW :
     321                 :            :         case SID_DRAWTBX_CS_FLOWCHART :
     322                 :            :         case SID_DRAWTBX_CS_CALLOUT :
     323                 :            :         case SID_DRAWTBX_CS_STAR :
     324                 :            :         case SID_DRAW_CS_ID :
     325                 :            :         {
     326 [ #  # ][ #  # ]:          0 :             pTabView->SetDrawFuncPtr( new FuConstCustomShape( this, pWin, pView, pDoc, aNewReq ));
     327         [ #  # ]:          0 :             if ( nNewId != SID_DRAW_CS_ID )
     328                 :            :             {
     329 [ #  # ][ #  # ]:          0 :                 SFX_REQUEST_ARG( rReq, pEnumCommand, SfxStringItem, nNewId, false );
     330         [ #  # ]:          0 :                 if ( pEnumCommand )
     331                 :            :                 {
     332         [ #  # ]:          0 :                     aCurrShapeEnumCommand[ nNewId - SID_DRAWTBX_CS_BASIC ] = pEnumCommand->GetValue();
     333                 :          0 :                     SfxBindings& rBind = GetViewFrame()->GetBindings();
     334         [ #  # ]:          0 :                     rBind.Invalidate( nNewId );
     335         [ #  # ]:          0 :                     rBind.Update( nNewId );
     336                 :            : 
     337         [ #  # ]:          0 :                     sDrawCustom = pEnumCommand->GetValue();  // to detect when a different shape type is selected
     338                 :            :                 }
     339                 :            :             }
     340                 :            :         }
     341                 :          0 :         break;
     342                 :            : 
     343                 :            :         default:
     344                 :          0 :             break;
     345                 :            :     }
     346                 :            : 
     347         [ #  # ]:          0 :     if (pTabView->GetDrawFuncPtr())
     348         [ #  # ]:          0 :         pTabView->GetDrawFuncPtr()->Activate();
     349                 :            : 
     350         [ #  # ]:          0 :     rReq.Done();
     351                 :            : 
     352         [ #  # ]:          0 :     rBindings.Invalidate( SID_INSERT_DRAW );
     353         [ #  # ]:          0 :     rBindings.Update( SID_INSERT_DRAW );
     354                 :            : 
     355                 :            :     // Create default drawing objects via keyboard
     356                 :            :     // with qualifier construct directly
     357                 :          0 :     FuPoor* pFuActual = GetDrawFuncPtr();
     358                 :            : 
     359 [ #  # ][ #  # ]:          0 :     if(pFuActual && (rReq.GetModifier() & KEY_MOD1))
         [ #  # ][ #  # ]
     360                 :            :     {
     361                 :            :         // Create default drawing objects via keyboard
     362 [ #  # ][ #  # ]:          0 :         const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
     363                 :          0 :         sal_uInt32 nDefaultObjectSizeWidth = rAppOpt.GetDefaultObjectSizeWidth();
     364                 :          0 :         sal_uInt32 nDefaultObjectSizeHeight = rAppOpt.GetDefaultObjectSizeHeight();
     365                 :            : 
     366                 :            :         // calc position and size
     367 [ #  # ][ #  # ]:          0 :         Rectangle aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
     368         [ #  # ]:          0 :         Point aPagePos = aVisArea.Center();
     369                 :          0 :         aPagePos.X() -= nDefaultObjectSizeWidth / 2;
     370                 :          0 :         aPagePos.Y() -= nDefaultObjectSizeHeight / 2;
     371         [ #  # ]:          0 :         Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
     372                 :            : 
     373                 :          0 :         ScDrawView* pDrView = GetScDrawView();
     374                 :            : 
     375         [ #  # ]:          0 :         if(pDrView)
     376                 :            :         {
     377                 :          0 :             SdrPageView* pPageView = pDrView->GetSdrPageView();
     378                 :            : 
     379         [ #  # ]:          0 :             if(pPageView)
     380                 :            :             {
     381                 :            :                 // create the default object
     382         [ #  # ]:          0 :                 SdrObject* pObj = pFuActual->CreateDefaultObject(nNewId, aNewObjectRectangle);
     383                 :            : 
     384         [ #  # ]:          0 :                 if(pObj)
     385                 :            :                 {
     386                 :            :                     // insert into page
     387         [ #  # ]:          0 :                     pView->InsertObjectAtView(pObj, *pPageView);
     388                 :            : 
     389 [ #  # ][ #  # ]:          0 :                     if ( nNewId == SID_DRAW_CAPTION || nNewId == SID_DRAW_CAPTION_VERTICAL )
     390                 :            :                     {
     391                 :            :                         //  use KeyInput to start edit mode (FuText is created).
     392                 :            :                         //  For FuText objects, edit mode is handled within CreateDefaultObject.
     393                 :            :                         //  KEY_F2 is handled in FuDraw::KeyInput.
     394                 :            : 
     395 [ #  # ][ #  # ]:          0 :                         pFuActual->KeyInput( KeyEvent( 0, KeyCode( KEY_F2 ) ) );
     396                 :            :                     }
     397                 :            :                 }
     398                 :            :             }
     399                 :            :         }
     400 [ #  # ][ #  # ]:          0 :     }
     401                 :            : }
     402                 :            : 
     403                 :        241 : void ScTabViewShell::GetDrawState(SfxItemSet &rSet)
     404                 :            : {
     405         [ +  - ]:        241 :     SfxWhichIter    aIter(rSet);
     406         [ +  - ]:        241 :     sal_uInt16          nWhich = aIter.FirstWhich();
     407                 :            : 
     408         [ +  + ]:        482 :     while ( nWhich )
     409                 :            :     {
     410   [ +  -  -  - ]:        241 :         switch ( nWhich )
     411                 :            :         {
     412                 :            :             case SID_INSERT_DRAW:
     413                 :            :                 {
     414                 :            :                     //  SID_OBJECT_SELECT nur, wenn "harter" Selektionsmodus
     415                 :        241 :                     sal_uInt16 nPutId = nDrawSfxId;
     416 [ -  + ][ #  # ]:        241 :                     if ( nPutId == SID_OBJECT_SELECT && !IsDrawSelMode() )
                 [ -  + ]
     417                 :          0 :                         nPutId = USHRT_MAX;
     418                 :            :                     // nur die Images, die auch auf dem Controller liegen
     419 [ +  - ][ +  - ]:        241 :                     if ( nPutId != SID_OBJECT_SELECT &&
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     420                 :            :                          nPutId != SID_DRAW_LINE &&
     421                 :            :                          nPutId != SID_DRAW_RECT &&
     422                 :            :                          nPutId != SID_DRAW_ELLIPSE &&
     423                 :            :                          nPutId != SID_DRAW_POLYGON_NOFILL &&
     424                 :            :                          nPutId != SID_DRAW_BEZIER_NOFILL &&
     425                 :            :                          nPutId != SID_DRAW_FREELINE_NOFILL &&
     426                 :            :                          nPutId != SID_DRAW_ARC &&
     427                 :            :                          nPutId != SID_DRAW_PIE &&
     428                 :            :                          nPutId != SID_DRAW_CIRCLECUT &&
     429                 :            :                          nPutId != SID_DRAW_TEXT &&
     430                 :            :                          nPutId != SID_DRAW_TEXT_VERTICAL &&
     431                 :            :                          nPutId != SID_DRAW_TEXT_MARQUEE &&
     432                 :            :                          nPutId != SID_DRAW_CAPTION &&
     433                 :            :                          nPutId != SID_DRAW_CAPTION_VERTICAL )
     434                 :        241 :                         nPutId = USHRT_MAX;
     435         [ +  - ]:        241 :                     SfxAllEnumItem aItem( nWhich, nPutId );
     436 [ +  - ][ +  - ]:        241 :                     if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
         [ +  - ][ +  - ]
     437                 :            :                     {
     438         [ +  - ]:        241 :                         aItem.DisableValue( SID_DRAW_TEXT_VERTICAL );
     439         [ +  - ]:        241 :                         aItem.DisableValue( SID_DRAW_CAPTION_VERTICAL );
     440                 :            :                     }
     441 [ +  - ][ +  - ]:        241 :                     rSet.Put( aItem );
     442                 :            :                 }
     443                 :        241 :                 break;
     444                 :            : 
     445                 :            :             case SID_DRAW_CHART:
     446                 :            :                 {
     447 [ #  # ][ #  # ]:          0 :                     sal_Bool bOle = GetViewFrame()->GetFrame().IsInPlace();
     448 [ #  # ][ #  # ]:          0 :                     if ( bOle || !SvtModuleOptions().IsChart() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     449         [ #  # ]:          0 :                         rSet.DisableItem( nWhich );
     450                 :            :                 }
     451                 :          0 :                 break;
     452                 :            : 
     453                 :            :             case SID_OBJECT_SELECT:     // wichtig fuer den ollen Control-Controller
     454 [ #  # ][ #  # ]:          0 :                 rSet.Put( SfxBoolItem( nWhich, nDrawSfxId == SID_OBJECT_SELECT && IsDrawSelMode() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     455                 :          0 :                 break;
     456                 :            :         }
     457         [ +  - ]:        241 :         nWhich = aIter.NextWhich();
     458         [ +  - ]:        241 :     }
     459                 :        241 : }
     460                 :            : 
     461                 :          0 : sal_Bool ScTabViewShell::SelectObject( const String& rName )
     462                 :            : {
     463                 :          0 :     ScDrawView* pView = GetViewData()->GetScDrawView();
     464         [ #  # ]:          0 :     if (!pView)
     465                 :          0 :         return false;
     466                 :            : 
     467                 :          0 :     sal_Bool bFound = pView->SelectObject( rName );
     468                 :            :     // DrawShell etc. is handled in MarkListHasChanged
     469                 :            : 
     470                 :          0 :     return bFound;
     471                 :            : }
     472                 :            : 
     473                 :            : 
     474                 :            : 
     475                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10