[Libreoffice-commits] core.git: include/svx svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 24 15:01:39 UTC 2020
include/svx/dlgctl3d.hxx | 28 -----
svx/source/dialog/dlgctl3d.cxx | 200 -----------------------------------------
2 files changed, 228 deletions(-)
New commits:
commit b431d38974d3802f33ef91eb6ee2e3366687bf4d
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jan 23 20:51:27 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 24 16:01:02 2020 +0100
Svx3DPreviewControl is now unused
Change-Id: I5ab6783cd0e36718798b0e7075f46a4e28e11761
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87300
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx
index a7b2794a739f..7d37654297b4 100644
--- a/include/svx/dlgctl3d.hxx
+++ b/include/svx/dlgctl3d.hxx
@@ -38,34 +38,6 @@ class E3dScene;
enum class SvxPreviewObjectType { SPHERE, CUBE };
-class SAL_WARN_UNUSED Svx3DPreviewControl : public Control
-{
-protected:
- std::unique_ptr<FmFormModel> mpModel;
- FmFormPage* mpFmPage;
- std::unique_ptr<E3dView> mp3DView;
- E3dScene* mpScene;
- E3dObject* mp3DObj;
- SvxPreviewObjectType mnObjectType;
-
- void Construct();
-
-public:
- Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle = 0);
- virtual ~Svx3DPreviewControl() override;
- virtual void dispose() override;
-
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
- virtual void Resize() override;
- virtual Size GetOptimalSize() const override;
-
- virtual void SetObjectType(SvxPreviewObjectType nType);
- SvxPreviewObjectType GetObjectType() const { return mnObjectType; }
- SfxItemSet const & Get3DAttributes() const;
- virtual void Set3DAttributes(const SfxItemSet& rAttr);
-};
-
class SAL_WARN_UNUSED SVX_DLLPUBLIC PreviewControl3D : public weld::CustomWidgetController
{
protected:
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 51cc03e084b6..bc0545b6ee7c 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -45,206 +45,6 @@
using namespace com::sun::star;
-Svx3DPreviewControl::Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle)
-: Control(pParent, nStyle),
- mpFmPage(nullptr),
- mpScene(nullptr),
- mp3DObj(nullptr),
- mnObjectType(SvxPreviewObjectType::SPHERE)
-{
- Construct();
-
- // do not paint background self, DrawingLayer paints this buffered and as page
- SetControlBackground();
- SetBackground();
-}
-
-Size Svx3DPreviewControl::GetOptimalSize() const
-{
- return LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont));
-}
-
-VCL_BUILDER_FACTORY(Svx3DPreviewControl)
-
-Svx3DPreviewControl::~Svx3DPreviewControl()
-{
- disposeOnce();
-}
-
-void Svx3DPreviewControl::dispose()
-{
- mp3DView.reset();
- mpModel.reset();
- Control::dispose();
-}
-
-void Svx3DPreviewControl::Construct()
-{
- // Do never mirror the preview window. This explicitly includes right
- // to left writing environments.
- EnableRTL (false);
- SetMapMode(MapMode(MapUnit::Map100thMM));
-
- // Model
- mpModel.reset(new FmFormModel());
- mpModel->GetItemPool().FreezeIdRanges();
-
- // Page
- mpFmPage = new FmFormPage( *mpModel );
- mpModel->InsertPage( mpFmPage, 0 );
-
- // 3D View
- mp3DView.reset(new E3dView(*mpModel, this ));
- mp3DView->SetBufferedOutputAllowed(true);
- mp3DView->SetBufferedOverlayAllowed(true);
-
- // 3D Scene
- mpScene = new E3dScene(*mpModel);
-
- // initially create object
- SetObjectType(SvxPreviewObjectType::SPHERE);
-
- // camera and perspective
- Camera3D rCamera = mpScene->GetCamera();
- const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
- double fW = rVolume.getWidth();
- double fH = rVolume.getHeight();
- double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
-
- rCamera.SetAutoAdjustProjection(false);
- rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
- basegfx::B3DPoint aLookAt;
- double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
- basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
- rCamera.SetPosAndLookAt(aCamPos, aLookAt);
- double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
- rCamera.SetFocalLength(fDefaultCamFocal);
-
- mpScene->SetCamera( rCamera );
- mpFmPage->InsertObject( mpScene );
-
- basegfx::B3DHomMatrix aRotation;
- aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
- aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
- mpScene->SetTransform(aRotation * mpScene->GetTransform());
-
- // invalidate SnapRects of objects
- mpScene->SetRectsDirty();
-
- SfxItemSet aSet( mpModel->GetItemPool(),
- svl::Items<XATTR_LINESTYLE, XATTR_LINESTYLE,
- XATTR_FILL_FIRST, XATTR_FILLBITMAP>{} );
- aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
- aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
- aSet.Put( XFillColorItem( "", COL_WHITE ) );
-
- mpScene->SetMergedItemSet(aSet);
-
- // PageView
- SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
- mp3DView->hideMarkHandles();
-
- // mark scene
- mp3DView->MarkObj( mpScene, pPageView );
-}
-
-void Svx3DPreviewControl::Resize()
-{
- // size of page
- Size aSize( GetSizePixel() );
- aSize = PixelToLogic( aSize );
- mpFmPage->SetSize( aSize );
-
- // set size
- Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
- Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
- (aSize.Height() - aObjSize.Height()) / 2);
- tools::Rectangle aRect( aObjPoint, aObjSize);
- mpScene->SetSnapRect( aRect );
-}
-
-void Svx3DPreviewControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
-{
- mp3DView->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
-}
-
-void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
-{
- Control::MouseButtonDown(rMEvt);
-
- if( rMEvt.IsShift() && rMEvt.IsMod1() )
- {
- if(SvxPreviewObjectType::SPHERE == GetObjectType())
- {
- SetObjectType(SvxPreviewObjectType::CUBE);
- }
- else
- {
- SetObjectType(SvxPreviewObjectType::SPHERE);
- }
- }
-}
-
-void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
-{
- if( mnObjectType != nType || !mp3DObj)
- {
- SfxItemSet aSet(mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{});
- mnObjectType = nType;
-
- if( mp3DObj )
- {
- aSet.Put(mp3DObj->GetMergedItemSet());
- mpScene->RemoveObject( mp3DObj->GetOrdNum() );
- // always use SdrObject::Free(...) for SdrObjects (!)
- SdrObject* pTemp(mp3DObj);
- SdrObject::Free(pTemp);
- }
-
- switch( nType )
- {
- case SvxPreviewObjectType::SPHERE:
- {
- mp3DObj = new E3dSphereObj(
- *mpModel,
- mp3DView->Get3DDefaultAttributes(),
- basegfx::B3DPoint( 0, 0, 0 ),
- basegfx::B3DVector( 5000, 5000, 5000 ));
- }
- break;
-
- case SvxPreviewObjectType::CUBE:
- {
- mp3DObj = new E3dCubeObj(
- *mpModel,
- mp3DView->Get3DDefaultAttributes(),
- basegfx::B3DPoint( -2500, -2500, -2500 ),
- basegfx::B3DVector( 5000, 5000, 5000 ));
- }
- break;
- }
-
- if (mp3DObj)
- {
- mpScene->InsertObject( mp3DObj );
- mp3DObj->SetMergedItemSet(aSet);
- }
-
- Resize();
- }
-}
-
-SfxItemSet const & Svx3DPreviewControl::Get3DAttributes() const
-{
- return mp3DObj->GetMergedItemSet();
-}
-
-void Svx3DPreviewControl::Set3DAttributes( const SfxItemSet& rAttr )
-{
- mp3DObj->SetMergedItemSet(rAttr, true);
- Resize();
-}
-
PreviewControl3D::PreviewControl3D()
: mpFmPage(nullptr)
, mpScene(nullptr)
More information about the Libreoffice-commits
mailing list