LCOV - code coverage report
Current view: top level - include/svx - scene3d.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 13 0.0 %
Date: 2014-04-14 Functions: 0 11 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             : #ifndef INCLUDED_SVX_SCENE3D_HXX
      21             : #define INCLUDED_SVX_SCENE3D_HXX
      22             : 
      23             : #include <svx/camera3d.hxx>
      24             : #include <tools/b3dtrans.hxx>
      25             : #include <svx/svxdllapi.h>
      26             : #include <svx/obj3d.hxx>
      27             : 
      28             : namespace sdr { namespace properties {
      29             :     class BaseProperties;
      30             :     class E3dSceneProperties;
      31             : }}
      32             : 
      33             : namespace drawinglayer { namespace geometry {
      34             :     class ViewInformation3D;
      35             : }}
      36             : 
      37             : /*************************************************************************
      38             : |*
      39             : |* GeoData relevant for undo actions
      40             : |*
      41             : \************************************************************************/
      42             : 
      43           0 : class E3DSceneGeoData : public E3DObjGeoData
      44             : {
      45             : public:
      46             :     Camera3D                    aCamera;
      47             : 
      48           0 :     E3DSceneGeoData() {}
      49             : };
      50             : 
      51             : class Imp3DDepthRemapper;
      52             : 
      53             : /*************************************************************************
      54             : |*
      55             : |* base class for 3D scenes
      56             : |*
      57             : \************************************************************************/
      58             : 
      59             : class SVX_DLLPUBLIC E3dScene : public E3dObject
      60             : {
      61             : private:
      62             :     // to allow sdr::properties::E3dSceneProperties access to StructureChanged()
      63             :     friend class sdr::properties::E3dSceneProperties;
      64             : 
      65             : protected:
      66             :     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
      67             :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
      68             : 
      69             :     // transformations
      70             :     B3dCamera                   aCameraSet;
      71             :     Camera3D                    aCamera;
      72             : 
      73             :     Imp3DDepthRemapper*         mp3DDepthRemapper;
      74             : 
      75             :     // Flag to determine if only selected objects should be drawn
      76             :     bool                        bDrawOnlySelected       : 1;
      77             : 
      78             :     virtual void NewObjectInserted(const E3dObject* p3DObj) SAL_OVERRIDE;
      79             :     virtual void StructureChanged() SAL_OVERRIDE;
      80             : 
      81             :     void RebuildLists();
      82             : 
      83             :     virtual void Notify(SfxBroadcaster &rBC, const SfxHint  &rHint) SAL_OVERRIDE;
      84             : 
      85             : protected:
      86             :     void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
      87             : 
      88             :     void ImpCleanup3DDepthMapper();
      89             : 
      90             : public:
      91             :     TYPEINFO_OVERRIDE();
      92             :     E3dScene();
      93             :     E3dScene(E3dDefaultAttributes& rDefault);
      94             :     virtual ~E3dScene();
      95             : 
      96             :     virtual void SetBoundRectDirty() SAL_OVERRIDE;
      97             : 
      98             :     // access to cleanup of depth mapper
      99           0 :     void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); }
     100             : 
     101             :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
     102             : 
     103             :     sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
     104             : 
     105             :     // Perspective: enum ProjectionType { PR_PARALLEL, PR_PERSPECTIVE }
     106           0 :     ProjectionType GetPerspective() const
     107           0 :         { return (ProjectionType)((const Svx3DPerspectiveItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue(); }
     108             : 
     109             :     // Distance:
     110           0 :     double GetDistance() const
     111           0 :         { return (double)((const Svx3DDistanceItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_DISTANCE)).GetValue(); }
     112             : 
     113             :     // Focal length: before cm, now 1/10th mm (*100)
     114           0 :     double GetFocalLength() const
     115           0 :         { return ((const Svx3DFocalLengthItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue(); }
     116             : 
     117             :     // Two sided lighting:
     118             :     bool GetTwoSidedLighting() const
     119             :         { return ((const Svx3DTwoSidedLightingItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue(); }
     120             : 
     121             :     // Lightcolor:
     122             :     Color GetLightColor1() const
     123             :         { return ((const Svx3DLightcolor1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue(); }
     124             :     Color GetLightColor2() const
     125             :         { return ((const Svx3DLightcolor2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue(); }
     126             :     Color GetLightColor3() const
     127             :         { return ((const Svx3DLightcolor3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue(); }
     128             :     Color GetLightColor4() const
     129             :         { return ((const Svx3DLightcolor4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue(); }
     130             :     Color GetLightColor5() const
     131             :         { return ((const Svx3DLightcolor5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue(); }
     132             :     Color GetLightColor6() const
     133             :         { return ((const Svx3DLightcolor6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue(); }
     134             :     Color GetLightColor7() const
     135             :         { return ((const Svx3DLightcolor7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue(); }
     136             :     Color GetLightColor8() const
     137             :         { return ((const Svx3DLightcolor8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue(); }
     138             : 
     139             :     // Ambient color:
     140             :     Color GetGlobalAmbientColor() const
     141             :         { return ((const Svx3DAmbientcolorItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue(); }
     142             : 
     143             :     // Light on/off:
     144             :     bool GetLightOnOff1() const
     145             :         { return ((const Svx3DLightOnOff1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue(); }
     146             :     bool GetLightOnOff2() const
     147             :         { return ((const Svx3DLightOnOff2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue(); }
     148             :     bool GetLightOnOff3() const
     149             :         { return ((const Svx3DLightOnOff3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue(); }
     150             :     bool GetLightOnOff4() const
     151             :         { return ((const Svx3DLightOnOff4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue(); }
     152             :     bool GetLightOnOff5() const
     153             :         { return ((const Svx3DLightOnOff5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue(); }
     154             :     bool GetLightOnOff6() const
     155             :         { return ((const Svx3DLightOnOff6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue(); }
     156             :     bool GetLightOnOff7() const
     157             :         { return ((const Svx3DLightOnOff7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue(); }
     158             :     bool GetLightOnOff8() const
     159             :         { return ((const Svx3DLightOnOff8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue(); }
     160             : 
     161             :     // Light direction:
     162             :     basegfx::B3DVector GetLightDirection1() const
     163             :         { return ((const Svx3DLightDirection1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue(); }
     164             :     basegfx::B3DVector GetLightDirection2() const
     165             :         { return ((const Svx3DLightDirection2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue(); }
     166             :     basegfx::B3DVector GetLightDirection3() const
     167             :         { return ((const Svx3DLightDirection3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue(); }
     168             :     basegfx::B3DVector GetLightDirection4() const
     169             :         { return ((const Svx3DLightDirection4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue(); }
     170             :     basegfx::B3DVector GetLightDirection5() const
     171             :         { return ((const Svx3DLightDirection5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue(); }
     172             :     basegfx::B3DVector GetLightDirection6() const
     173             :         { return ((const Svx3DLightDirection6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue(); }
     174             :     basegfx::B3DVector GetLightDirection7() const
     175             :         { return ((const Svx3DLightDirection7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue(); }
     176             :     basegfx::B3DVector GetLightDirection8() const
     177             :         { return ((const Svx3DLightDirection8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue(); }
     178             : 
     179             :     // ShadowSlant:
     180             :     sal_uInt16 GetShadowSlant() const
     181             :         { return ((const Svx3DShadowSlantItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue(); }
     182             : 
     183             :     // ShadeMode: 0 == FLAT, 1 == PHONG, 2 == SMOOTH, 3 == ForceDraft
     184             :     sal_uInt16 GetShadeMode() const
     185             :         { return ((const Svx3DShadeModeItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue(); }
     186             : 
     187             :     // set flag to draw only selected
     188           0 :     void SetDrawOnlySelected(bool bNew) { bDrawOnlySelected = bNew; }
     189           0 :     bool GetDrawOnlySelected() const { return bDrawOnlySelected; }
     190             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
     191             : 
     192             :     virtual void    NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
     193             :     virtual void    NbcMove(const Size& rSize) SAL_OVERRIDE;
     194             :     virtual void    NbcResize(const Point& rRef, const Fraction& rXFact,
     195             :                                                  const Fraction& rYFact) SAL_OVERRIDE;
     196             :     virtual void    RecalcSnapRect() SAL_OVERRIDE;
     197             : 
     198             :     virtual E3dScene* GetScene() const SAL_OVERRIDE;
     199             :     void SetCamera(const Camera3D& rNewCamera);
     200           0 :     const Camera3D& GetCamera() const { return aCamera; }
     201             :     void removeAllNonSelectedObjects();
     202             : 
     203             :     virtual E3dScene* Clone() const SAL_OVERRIDE;
     204             :     E3dScene& operator=(const E3dScene&);
     205             : 
     206             :     virtual SdrObjGeoData *NewGeoData() const SAL_OVERRIDE;
     207             :     virtual void          SaveGeoData(SdrObjGeoData& rGeo) const SAL_OVERRIDE;
     208             :     virtual void          RestGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
     209             : 
     210             :     virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) SAL_OVERRIDE;
     211             :     virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix) SAL_OVERRIDE;
     212             : 
     213             :     virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
     214             :     void RotateScene(const Point& rRef, long nWink, double sn, double cs);
     215             : 
     216             :     // TakeObjName...() is for the display in the UI, for example "3 frames selected".
     217             :     virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
     218             :     virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
     219             : 
     220             :     // get transformations
     221           0 :     B3dCamera& GetCameraSet() { return aCameraSet; }
     222             : 
     223             :     // break up
     224             :     virtual bool IsBreakObjPossible() SAL_OVERRIDE;
     225             : 
     226             :     // polygon which is built during creation
     227             :     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
     228             : 
     229             :     // create moves
     230             :     virtual bool BegCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     231             :     virtual bool MovCreate(SdrDragStat& rStat) SAL_OVERRIDE; // true=Xor muss repainted werden
     232             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     233             :     virtual bool BckCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     234             :     virtual void BrkCreate(SdrDragStat& rStat) SAL_OVERRIDE;
     235             : };
     236             : 
     237             : #endif // INCLUDED_SVX_SCENE3D_HXX
     238             : 
     239             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10