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

Generated by: LCOV version 1.10