LCOV - code coverage report
Current view: top level - svx/source/engine3d - view3d1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 68 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 108 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 <tools/shl.hxx>
      31                 :            : #include "svx/svditer.hxx"
      32                 :            : #include <svx/svdpool.hxx>
      33                 :            : #include <svx/svdmodel.hxx>
      34                 :            : #include <svx/svxids.hrc>
      35                 :            : #include <svx/xtable.hxx>
      36                 :            : #include <svx/fmview.hxx>
      37                 :            : #include <svx/dialogs.hrc>
      38                 :            : #include <svx/dialmgr.hxx>
      39                 :            : #include "svx/globl3d.hxx"
      40                 :            : #include <svx/obj3d.hxx>
      41                 :            : #include <svx/polysc3d.hxx>
      42                 :            : #include <svx/e3ditem.hxx>
      43                 :            : #include <editeng/colritem.hxx>
      44                 :            : #include <svx/lathe3d.hxx>
      45                 :            : #include <svx/sphere3d.hxx>
      46                 :            : #include <svx/extrud3d.hxx>
      47                 :            : #include <svx/e3dundo.hxx>
      48                 :            : #include <svx/view3d.hxx>
      49                 :            : #include <svx/cube3d.hxx>
      50                 :            : #include <svx/xflclit.hxx>
      51                 :            : #include <svx/svdogrp.hxx>
      52                 :            : #include <svx/e3dsceneupdater.hxx>
      53                 :            : 
      54                 :          0 : void E3dView::ConvertMarkedToPolyObj(sal_Bool bLineToArea)
      55                 :            : {
      56                 :          0 :     SdrObject* pNewObj = NULL;
      57                 :            : 
      58         [ #  # ]:          0 :     if (GetMarkedObjectCount() == 1)
      59                 :            :     {
      60                 :          0 :         SdrObject* pObj = GetMarkedObjectByIndex(0);
      61                 :            : 
      62 [ #  # ][ #  # ]:          0 :         if (pObj && pObj->ISA(E3dPolyScene))
                 [ #  # ]
      63                 :            :         {
      64                 :          0 :             sal_Bool bBezier = sal_False;
      65                 :          0 :             pNewObj = ((E3dPolyScene*) pObj)->ConvertToPolyObj(bBezier, bLineToArea);
      66                 :            : 
      67         [ #  # ]:          0 :             if (pNewObj)
      68                 :            :             {
      69 [ #  # ][ #  # ]:          0 :                 BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXTRUDE));
         [ #  # ][ #  # ]
      70                 :          0 :                 ReplaceObjectAtView(pObj, *GetSdrPageView(), pNewObj);
      71                 :          0 :                 EndUndo();
      72                 :            :             }
      73                 :            :         }
      74                 :            :     }
      75                 :            : 
      76         [ #  # ]:          0 :     if (!pNewObj)
      77                 :            :     {
      78                 :          0 :         SdrView::ConvertMarkedToPolyObj(bLineToArea);
      79                 :            :     }
      80                 :          0 : }
      81                 :            : 
      82                 :          0 : void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& rMask)
      83                 :            : {
      84         [ #  # ]:          0 :     if(pObj->ISA(E3dLatheObj))
      85                 :            :     {
      86                 :          0 :         rMask |= 0x0001;
      87                 :            :     }
      88         [ #  # ]:          0 :     else if(pObj->ISA(E3dExtrudeObj))
      89                 :            :     {
      90                 :          0 :         rMask |= 0x0002;
      91                 :            :     }
      92         [ #  # ]:          0 :     else if(pObj->ISA(E3dSphereObj))
      93                 :            :     {
      94                 :          0 :         rMask |= 0x0004;
      95                 :            :     }
      96         [ #  # ]:          0 :     else if(pObj->ISA(E3dCubeObj))
      97                 :            :     {
      98                 :          0 :         rMask |= 0x0008;
      99                 :            :     }
     100         [ #  # ]:          0 :     else if(pObj->IsGroupObject())
     101                 :            :     {
     102                 :          0 :         SdrObjList* pList = pObj->GetSubList();
     103         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < pList->GetObjCount(); a++)
     104                 :          0 :             Imp_E3dView_InorderRun3DObjects(pList->GetObj(a), rMask);
     105                 :            :     }
     106                 :          0 : }
     107                 :            : 
     108                 :          0 : SfxItemSet E3dView::Get3DAttributes(E3dScene* pInScene, sal_Bool /*bOnly3DAttr*/) const
     109                 :            : {
     110                 :            :     // Creating itemset with corresponding field
     111                 :            :     SfxItemSet aSet(
     112                 :          0 :         pMod->GetItemPool(),
     113                 :            :         SDRATTR_START,      SDRATTR_END,
     114                 :            :         SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN,
     115         [ #  # ]:          0 :         0, 0);
     116                 :            : 
     117                 :          0 :     sal_uInt32 nSelectedItems(0L);
     118                 :            : 
     119         [ #  # ]:          0 :     if(pInScene)
     120                 :            :     {
     121                 :            :         // special scene
     122 [ #  # ][ #  # ]:          0 :         aSet.Put(pInScene->GetMergedItemSet());
     123                 :            :     }
     124                 :            :     else
     125                 :            :     {
     126                 :            :         // get attributes from all selected objects
     127         [ #  # ]:          0 :         MergeAttrFromMarked(aSet, sal_False);
     128                 :            : 
     129                 :            :         // calc flags for SID_ATTR_3D_INTERN
     130                 :          0 :         const SdrMarkList& rMarkList = GetMarkedObjectList();
     131                 :          0 :         sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
     132                 :            : 
     133         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < nMarkCnt; a++)
     134                 :            :         {
     135         [ #  # ]:          0 :             SdrObject* pObj = GetMarkedObjectByIndex(a);
     136         [ #  # ]:          0 :             Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
     137                 :            :         }
     138                 :            :     }
     139                 :            : 
     140                 :            :     // Set SID_ATTR_3D_INTERN on the status of the selected objects
     141 [ #  # ][ #  # ]:          0 :     aSet.Put(SfxUInt32Item(SID_ATTR_3D_INTERN, nSelectedItems));
                 [ #  # ]
     142                 :            : 
     143                 :            :     // maintain default values
     144 [ #  # ][ #  # ]:          0 :     if(!nSelectedItems  && !pInScene)
     145                 :            :     {
     146                 :            :         // Get defaults and apply
     147         [ #  # ]:          0 :         SfxItemSet aDefaultSet(pMod->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST);
     148         [ #  # ]:          0 :         GetAttributes(aDefaultSet);
     149         [ #  # ]:          0 :         aSet.Put(aDefaultSet);
     150                 :            : 
     151                 :            :         // ... but no lines for 3D
     152 [ #  # ][ #  # ]:          0 :         aSet.Put(XLineStyleItem (XLINE_NONE));
                 [ #  # ]
     153                 :            : 
     154                 :            :         // new defaults for distance and focal length
     155 [ #  # ][ #  # ]:          0 :         aSet.Put(Svx3DDistanceItem(100));
                 [ #  # ]
     156 [ #  # ][ #  # ]:          0 :         aSet.Put(Svx3DFocalLengthItem(10000));
         [ #  # ][ #  # ]
     157                 :            :     }
     158                 :            : 
     159                 :            :     // return ItemSet
     160                 :          0 :     return(aSet);
     161                 :            : }
     162                 :            : 
     163                 :          0 : void E3dView::Set3DAttributes( const SfxItemSet& rAttr, E3dScene* pInScene, sal_Bool bReplaceAll)
     164                 :            : {
     165                 :          0 :     sal_uInt32 nSelectedItems(0L);
     166                 :            : 
     167         [ #  # ]:          0 :     if(pInScene)
     168                 :            :     {
     169         [ #  # ]:          0 :         pInScene->SetMergedItemSetAndBroadcast(rAttr, bReplaceAll);
     170                 :            :     }
     171                 :            :     else
     172                 :            :     {
     173                 :            :         // #i94832# removed usage of E3DModifySceneSnapRectUpdater here.
     174                 :            :         // They are not needed here, they are already handled in SetAttrToMarked
     175                 :            : 
     176                 :            :         // set at selected objects
     177         [ #  # ]:          0 :         SetAttrToMarked(rAttr, bReplaceAll);
     178                 :            : 
     179                 :            :         // old run
     180                 :          0 :         const SdrMarkList& rMarkList = GetMarkedObjectList();
     181                 :          0 :         const sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
     182                 :            : 
     183         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < nMarkCnt; a++)
     184                 :            :         {
     185         [ #  # ]:          0 :             SdrObject* pObj = GetMarkedObjectByIndex(a);
     186         [ #  # ]:          0 :             Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
     187                 :            :         }
     188                 :            :     }
     189                 :            : 
     190                 :            :     // Maintain default values
     191 [ #  # ][ #  # ]:          0 :     if(!nSelectedItems && !pInScene)
     192                 :            :     {
     193                 :            :         // Set defaults
     194         [ #  # ]:          0 :         SfxItemSet aDefaultSet(pMod->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST);
     195         [ #  # ]:          0 :         aDefaultSet.Put(rAttr);
     196 [ #  # ][ #  # ]:          0 :         SetAttributes(aDefaultSet);
     197                 :            : 
     198                 :            :     }
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : double E3dView::GetDefaultCamPosZ()
     202                 :            : {
     203                 :          0 :     return (double)((const SfxUInt32Item&)pMod->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE)).GetValue();
     204                 :            : }
     205                 :            : 
     206                 :          0 : double E3dView::GetDefaultCamFocal()
     207                 :            : {
     208                 :          0 :     return (double)((const SfxUInt32Item&)pMod->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
     209                 :            : }
     210                 :            : 
     211                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10