LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsi.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 57 21.1 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 104 1.9 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include "DrawViewShell.hxx"
      22                 :            : #include <svx/xtable.hxx>
      23                 :            : #include "sdattr.hxx"
      24                 :            : #include <svl/aeitem.hxx>
      25                 :            : #include <editeng/eeitem.hxx>
      26                 :            : #include <sfx2/request.hxx>
      27                 :            : #include <svx/svditer.hxx>
      28                 :            : #include <editeng/colritem.hxx>
      29                 :            : #include <sfx2/viewfrm.hxx>
      30                 :            : #include <svx/svxids.hrc>
      31                 :            : #include <svx/svdundo.hxx>
      32                 :            : #include <svx/view3d.hxx>
      33                 :            : #include <sfx2/dispatch.hxx>
      34                 :            : #include <svx/float3d.hxx>
      35                 :            : #include <svx/f3dchild.hxx>
      36                 :            : #include <svx/dialogs.hrc>
      37                 :            : #include <vcl/msgbox.hxx>
      38                 :            : 
      39                 :            : 
      40                 :            : #include "app.hrc"
      41                 :            : #include "strings.hrc"
      42                 :            : 
      43                 :            : #include "drawdoc.hxx"
      44                 :            : #include "DrawDocShell.hxx"
      45                 :            : #include "anminfo.hxx"
      46                 :            : #include "unoaprms.hxx"                 // Undo-Action
      47                 :            : #include "sdundogr.hxx"                 // Undo Gruppe
      48                 :            : #include "drawview.hxx"
      49                 :            : #include "Window.hxx"
      50                 :            : #include "sdresid.hxx"
      51                 :            : 
      52                 :            : using namespace ::com::sun::star;
      53                 :            : 
      54                 :            : namespace sd {
      55                 :            : 
      56                 :            : #define ATTR_MISSING    0       // Attribut nicht verfuegbar
      57                 :            : #define ATTR_MIXED      1       // Attribut uneindeutig (bei Mehrfachselektion)
      58                 :            : #define ATTR_SET        2       // Attribut eindeutig
      59                 :            : 
      60                 :            : #define ITEMVALUE(ItemSet,Id,Cast)  ((const Cast&)(ItemSet).Get(Id)).GetValue()
      61                 :            : 
      62                 :            : /*************************************************************************
      63                 :            : |*
      64                 :            : |* SfxRequests fuer EffekteWindow bearbeiten
      65                 :            : |*
      66                 :            : \************************************************************************/
      67                 :            : 
      68                 :        313 : void DrawViewShell::ExecEffectWin( SfxRequest& rReq )
      69                 :            : {
      70                 :        313 :     CheckLineTo (rReq);
      71                 :            : 
      72                 :        313 :     sal_uInt16 nSId = rReq.GetSlot();
      73                 :            : 
      74   [ -  +  -  - ]:        313 :     switch( nSId )
      75                 :            :     {
      76                 :            :         case SID_3D_INIT:
      77                 :            :         {
      78                 :          0 :             sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
      79                 :          0 :             SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
      80         [ #  # ]:          0 :             if( pWindow )
      81                 :            :             {
      82                 :          0 :                 Svx3DWin* p3DWin = (Svx3DWin*)( pWindow->GetWindow() );
      83         [ #  # ]:          0 :                 if( p3DWin )
      84                 :          0 :                     p3DWin->InitColorLB( GetDoc() );
      85                 :            :             }
      86                 :            :         }
      87                 :          0 :         break;
      88                 :            : 
      89                 :            :         case SID_3D_STATE:
      90                 :            :         {
      91                 :        313 :             Update3DWindow();
      92                 :            :         }
      93                 :        313 :         break;
      94                 :            : 
      95                 :            :         case SID_3D_ASSIGN:
      96                 :            :         {
      97                 :          0 :             AssignFrom3DWindow();
      98                 :            :         }
      99                 :          0 :         break;
     100                 :            : 
     101                 :            :     }
     102                 :        313 : }
     103                 :            : 
     104                 :            : /*************************************************************************
     105                 :            : |*
     106                 :            : |* 3D - Assign / Update
     107                 :            : |*
     108                 :            : \************************************************************************/
     109                 :        313 : void DrawViewShell::Update3DWindow()
     110                 :            : {
     111                 :        313 :     sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
     112                 :        313 :     SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
     113         [ -  + ]:        313 :     if( pWindow )
     114                 :            :     {
     115                 :          0 :         Svx3DWin* p3DWin = (Svx3DWin*) pWindow->GetWindow();
     116 [ #  # ][ #  # ]:          0 :         if( p3DWin && p3DWin->IsUpdateMode() )
                 [ #  # ]
     117                 :            :         {
     118         [ #  # ]:          0 :             SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
     119 [ #  # ][ #  # ]:          0 :             p3DWin->Update( aTmpItemSet );
     120                 :            :         }
     121                 :            :     }
     122                 :        313 : }
     123                 :            : 
     124                 :            : /*----------------------------------------------------------------------------*/
     125                 :            : 
     126                 :          0 : void DrawViewShell::AssignFrom3DWindow()
     127                 :            : {
     128                 :          0 :     sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
     129                 :          0 :     SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId );
     130         [ #  # ]:          0 :     if( pWin )
     131                 :            :     {
     132                 :          0 :         Svx3DWin* p3DWin = (Svx3DWin*) pWin->GetWindow();
     133 [ #  # ][ #  # ]:          0 :         if( p3DWin && GetView() )
                 [ #  # ]
     134                 :            :         {
     135         [ #  # ]:          0 :             if(!GetView()->IsPresObjSelected())
     136                 :            :             {
     137         [ #  # ]:          0 :                 SfxItemSet aSet( GetDoc()->GetPool(),
     138                 :            :                     SDRATTR_START,  SDRATTR_END,
     139         [ #  # ]:          0 :                     0, 0);
     140         [ #  # ]:          0 :                 p3DWin->GetAttr( aSet );
     141                 :            : 
     142                 :            :                 // Eigene UNDO-Klammerung auch um die Wandlung in 3D
     143 [ #  # ][ #  # ]:          0 :                 GetView()->BegUndo(String(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)));
         [ #  # ][ #  # ]
     144                 :            : 
     145 [ #  # ][ #  # ]:          0 :                 if(GetView()->IsConvertTo3DObjPossible())
     146                 :            :                 {
     147                 :            :                     // Nur TextAttribute zuweisen
     148         [ #  # ]:          0 :                     SfxItemSet aTextSet( GetDoc()->GetPool(),
     149         [ #  # ]:          0 :                         EE_ITEMS_START, EE_ITEMS_END, 0 );
     150         [ #  # ]:          0 :                     aTextSet.Put( aSet, sal_False );
     151         [ #  # ]:          0 :                     GetView()->SetAttributes( aTextSet );
     152                 :            : 
     153                 :            :                     // Text in 3D umwandeln
     154                 :          0 :                     sal_uInt16 nSId = SID_CONVERT_TO_3D;
     155         [ #  # ]:          0 :                     SfxBoolItem aItem( nSId, sal_True );
     156                 :            :                     GetViewFrame()->GetDispatcher()->Execute(
     157 [ #  # ][ #  # ]:          0 :                         nSId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
     158                 :            : 
     159                 :            :                     // Feststellen, ob ein FILL_Attribut gesetzt ist.
     160                 :            :                     // Falls nicht, Fuellattribut hart setzen
     161         [ #  # ]:          0 :                     XFillStyle eFillStyle = ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem );
     162         [ #  # ]:          0 :                     if(eFillStyle == XFILL_NONE)
     163 [ #  # ][ #  # ]:          0 :                         aSet.Put(XFillStyleItem (XFILL_SOLID));
                 [ #  # ]
     164                 :            : 
     165                 :            :                     // remove some 3DSCENE attributes since these were
     166                 :            :                     // created by convert to 3D and may not be changed
     167                 :            :                     // to the defaults again.
     168         [ #  # ]:          0 :                     aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE);
     169         [ #  # ]:          0 :                     aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
     170 [ #  # ][ #  # ]:          0 :                     aSet.ClearItem(SDRATTR_3DOBJ_DEPTH);
                 [ #  # ]
     171                 :            :                 }
     172                 :            : 
     173                 :            :                 // Attribute zuweisen
     174         [ #  # ]:          0 :                 GetView()->Set3DAttributes( aSet );
     175                 :            : 
     176                 :            :                 // Ende UNDO
     177 [ #  # ][ #  # ]:          0 :                 GetView()->EndUndo();
     178                 :            :             }
     179                 :            :             else
     180                 :            :             {
     181                 :            :                 InfoBox aInfoBox (
     182         [ #  # ]:          0 :                     GetActiveWindow(),
     183 [ #  # ][ #  # ]:          0 :                     String(SdResId(STR_ACTION_NOTPOSSIBLE)));
         [ #  # ][ #  # ]
     184 [ #  # ][ #  # ]:          0 :                 aInfoBox.Execute();
     185                 :            :             }
     186                 :            : 
     187                 :            :             // Focus zurueckholen
     188                 :          0 :             GetActiveWindow()->GrabFocus();
     189                 :            :         }
     190                 :            :     }
     191                 :          0 : }
     192                 :            : 
     193                 :            : }
     194                 :            : 
     195                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10