summaryrefslogtreecommitdiff
path: root/svx/source/dialog
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-23 20:51:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-24 16:01:02 +0100
commitb431d38974d3802f33ef91eb6ee2e3366687bf4d (patch)
tree36a5f953c9430b5e3c5a7149ad9dcd7b80ce1a9c /svx/source/dialog
parenta0c9922cd8fd99c75ec9e48cb651e9671607ef1c (diff)
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@redhat.com>
Diffstat (limited to 'svx/source/dialog')
-rw-r--r--svx/source/dialog/dlgctl3d.cxx200
1 files changed, 0 insertions, 200 deletions
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)