LCOV - code coverage report
Current view: top level - libreoffice/svx/source/engine3d - view3d1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 68 0.0 %
Date: 2012-12-27 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10