LCOV - code coverage report
Current view: top level - include/svx - dlgctl3d.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 8 0.0 %
Date: 2014-04-14 Functions: 0 8 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_DLGCTL3D_HXX
      21             : #define INCLUDED_SVX_DLGCTL3D_HXX
      22             : 
      23             : #include <vcl/ctrl.hxx>
      24             : #include <vcl/scrbar.hxx>
      25             : #include <vcl/button.hxx>
      26             : #include <svl/itemset.hxx>
      27             : #include <svx/svxdllapi.h>
      28             : #include <basegfx/vector/b3dvector.hxx>
      29             : 
      30             : 
      31             : 
      32             : class FmFormModel;
      33             : class FmFormPage;
      34             : class E3dView;
      35             : class E3dPolyScene;
      36             : class E3dObject;
      37             : 
      38             : 
      39             : 
      40             : #define PREVIEW_OBJECTTYPE_SPHERE           0x0000
      41             : #define PREVIEW_OBJECTTYPE_CUBE             0x0001
      42             : 
      43             : 
      44             : 
      45             : class SVX_DLLPUBLIC Svx3DPreviewControl : public Control
      46             : {
      47             : protected:
      48             :     FmFormModel*            mpModel;
      49             :     FmFormPage*             mpFmPage;
      50             :     E3dView*                mp3DView;
      51             :     E3dPolyScene*           mpScene;
      52             :     E3dObject*              mp3DObj;
      53             :     sal_uInt16              mnObjectType;
      54             : 
      55             :     void Construct();
      56             : 
      57             : public:
      58             :     Svx3DPreviewControl(Window* pParent, const ResId& rResId);
      59             :     Svx3DPreviewControl(Window* pParent, WinBits nStyle = 0);
      60             :     virtual ~Svx3DPreviewControl();
      61             : 
      62             :     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
      63             :     virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      64             :     virtual void Resize() SAL_OVERRIDE;
      65             : 
      66             :     void Reset();
      67             :     virtual void SetObjectType(sal_uInt16 nType);
      68           0 :     sal_uInt16 GetObjectType() const { return( mnObjectType ); }
      69             :     SfxItemSet Get3DAttributes() const;
      70             :     virtual void Set3DAttributes(const SfxItemSet& rAttr);
      71             : };
      72             : 
      73             : 
      74             : 
      75             : class SVX_DLLPUBLIC Svx3DLightControl : public Svx3DPreviewControl
      76             : {
      77             :     // Callback for interactive changes
      78             :     Link                        maUserInteractiveChangeCallback;
      79             :     Link                        maUserSelectionChangeCallback;
      80             :     Link                        maChangeCallback;
      81             :     Link                        maSelectionChangeCallback;
      82             : 
      83             :     // lights
      84             :     sal_uInt32                  maSelectedLight;
      85             : 
      86             :     // extra objects for light control
      87             :     E3dObject*                  mpExpansionObject;
      88             :     E3dObject*                  mpLampBottomObject;
      89             :     E3dObject*                  mpLampShaftObject;
      90             :     std::vector< E3dObject* >   maLightObjects;
      91             : 
      92             :     // 3d rotations of object
      93             :     double                      mfRotateX;
      94             :     double                      mfRotateY;
      95             :     double                      mfRotateZ;
      96             : 
      97             :     // interaction parameters
      98             :     Point                       maActionStartPoint;
      99             :     sal_Int32                   mnInteractionStartDistance;
     100             :     double                      mfSaveActionStartHor;
     101             :     double                      mfSaveActionStartVer;
     102             :     double                      mfSaveActionStartRotZ;
     103             : 
     104             :     // bitfield
     105             :     bool                        mbMouseMoved : 1;
     106             :     bool                        mbGeometrySelected : 1;
     107             : 
     108             :     void Construct2();
     109             :     void ConstructLightObjects();
     110             :     void AdaptToSelectedLight();
     111             :     void TrySelection(Point aPosPixel);
     112             : 
     113             : public:
     114             :     Svx3DLightControl(Window* pParent, WinBits nStyle = 0);
     115             :     virtual ~Svx3DLightControl();
     116             : 
     117             :     virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE;
     118             :     virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
     119             :     virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     120             :     virtual void Resize() SAL_OVERRIDE;
     121             : 
     122             :     virtual void SetObjectType(sal_uInt16 nType) SAL_OVERRIDE;
     123             : 
     124             :     // register user callback
     125             :     void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
     126             :     void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
     127           0 :     void SetChangeCallback(Link aNew) { maChangeCallback = aNew; }
     128           0 :     void SetSelectionChangeCallback(Link aNew) { maSelectionChangeCallback = aNew; }
     129             : 
     130             :     // selection checks
     131             :     bool IsSelectionValid();
     132           0 :     bool IsGeometrySelected() { return mbGeometrySelected; }
     133             : 
     134             :     // get/set position of selected lamp in polar coordinates, Hor:[0..360.0[ and Ver:[-90..90] degrees
     135             :     void GetPosition(double& rHor, double& rVer);
     136             :     void SetPosition(double fHor, double fVer);
     137             : 
     138             :     // get/set rotation of 3D object
     139             :     void SetRotation(double fRotX, double fRotY, double fRotZ);
     140             :     void GetRotation(double& rRotX, double& rRotY, double& rRotZ);
     141             : 
     142             :     void SelectLight(sal_uInt32 nLightNumber);
     143             :     virtual void Set3DAttributes(const SfxItemSet& rAttr) SAL_OVERRIDE;
     144           0 :     sal_uInt32 GetSelectedLight() { return maSelectedLight; }
     145             : 
     146             :     // light data access
     147             :     bool GetLightOnOff(sal_uInt32 nNum) const;
     148             :     Color GetLightColor(sal_uInt32 nNum) const;
     149             :     basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const;
     150             : };
     151             : 
     152             : 
     153             : 
     154             : class SVX_DLLPUBLIC SvxLightCtl3D : public Control
     155             : {
     156             : private:
     157             :     // local controls
     158             :     Svx3DLightControl       maLightControl;
     159             :     ScrollBar               maHorScroller;
     160             :     ScrollBar               maVerScroller;
     161             :     PushButton              maSwitcher;
     162             : 
     163             :     // callback for interactive changes
     164             :     Link                    maUserInteractiveChangeCallback;
     165             :     Link                    maUserSelectionChangeCallback;
     166             : 
     167             : public:
     168             :     SvxLightCtl3D( Window* pParent, const ResId& rResId);
     169             :     SvxLightCtl3D( Window* pParent);
     170             :     virtual ~SvxLightCtl3D();
     171             : 
     172             :     // react to size changes
     173             :     virtual void Resize() SAL_OVERRIDE;
     174             :     void NewLayout();
     175             : 
     176             :     // check the selection for validity
     177             :     void CheckSelection();
     178             : 
     179             :     // bring further settings to the outside world
     180           0 :     Svx3DLightControl& GetSvx3DLightControl() { return maLightControl; }
     181             : 
     182             :     // register user callback
     183           0 :     void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
     184           0 :     void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
     185             : 
     186             :     virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     187             :     virtual void GetFocus() SAL_OVERRIDE;
     188             :     virtual void LoseFocus() SAL_OVERRIDE;
     189             : 
     190             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
     191             : 
     192             : protected:
     193             : 
     194             :     DECL_LINK( InternalInteractiveChange, void*);
     195             :     DECL_LINK( InternalSelectionChange, void*);
     196             :     DECL_LINK( ScrollBarMove, void*);
     197             :     DECL_LINK( ButtonPress, void*);
     198             : 
     199             :     // initialize local parameters
     200             :     void Init();
     201             : 
     202             :     void move( double fDeltaHor, double fDeltaVer );
     203             : };
     204             : 
     205             : #endif // _SCH_DLGCTL3D_HXX
     206             : 
     207             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10