[Libreoffice-commits] core.git: include/svx svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 24 15:00:51 UTC 2020
include/svx/dlgctl3d.hxx | 48 ------
svx/source/dialog/dlgctl3d.cxx | 319 -----------------------------------------
2 files changed, 367 deletions(-)
New commits:
commit a0c9922cd8fd99c75ec9e48cb651e9671607ef1c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jan 23 20:48:09 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 24 16:00:18 2020 +0100
SvxLightCtl3D is now unused
Change-Id: I4aca00692184a91ce969feb909a75dff897fe5e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87298
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 73cb8680a53c..a7b2794a739f 100644
--- a/include/svx/dlgctl3d.hxx
+++ b/include/svx/dlgctl3d.hxx
@@ -238,54 +238,6 @@ public:
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const;
};
-class SAL_WARN_UNUSED SvxLightCtl3D final : public Control
-{
- // local controls
- VclPtr<Svx3DLightControl> maLightControl;
- VclPtr<ScrollBar> maHorScroller;
- VclPtr<ScrollBar> maVerScroller;
- VclPtr<PushButton> maSwitcher;
-
- // callback for interactive changes
- Link<SvxLightCtl3D*,void> maUserSelectionChangeCallback;
-
-public:
- SvxLightCtl3D(vcl::Window* pParent);
- virtual ~SvxLightCtl3D() override;
- virtual void dispose() override;
-
- // react to size changes
- virtual void Resize() override;
- void NewLayout();
-
- // check the selection for validity
- void CheckSelection();
-
- // bring further settings to the outside world
- Svx3DLightControl& GetSvx3DLightControl() { return *maLightControl; }
-
- // register user callback
- void SetUserSelectionChangeCallback(Link<SvxLightCtl3D*,void> aNew) { maUserSelectionChangeCallback = aNew; }
-
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
-
- virtual Size GetOptimalSize() const override;
-
-private:
-
- DECL_LINK( InternalInteractiveChange, Svx3DLightControl*, void);
- DECL_LINK( InternalSelectionChange, Svx3DLightControl*, void);
- DECL_LINK( ScrollBarMove, ScrollBar*, void);
- DECL_LINK( ButtonPress, Button*, void);
-
- // initialize local parameters
- void Init();
-
- void move( double fDeltaHor, double fDeltaVer );
-};
-
class SAL_WARN_UNUSED SVX_DLLPUBLIC LightCtl3D
{
// local controls
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index ce160c78e12d..51cc03e084b6 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -1795,325 +1795,6 @@ basegfx::B3DVector LightControl3D::GetLightDirection(sal_uInt32 nNum) const
return basegfx::B3DVector();
}
-SvxLightCtl3D::SvxLightCtl3D( vcl::Window* pParent)
-: Control(pParent, WB_BORDER | WB_TABSTOP),
- maLightControl(VclPtr<Svx3DLightControl>::Create(this, 0)),
- maHorScroller(VclPtr<ScrollBar>::Create(this, WB_HORZ | WB_DRAG)),
- maVerScroller(VclPtr<ScrollBar>::Create(this, WB_VERT | WB_DRAG)),
- maSwitcher(VclPtr<PushButton>::Create(this, 0))
-{
- // init members
- Init();
-}
-
-Size SvxLightCtl3D::GetOptimalSize() const
-{
- return LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont));
-}
-
-VCL_BUILDER_FACTORY(SvxLightCtl3D)
-
-void SvxLightCtl3D::Init()
-{
- // #i58240# set HelpIDs for scrollbars and switcher
- maHorScroller->SetHelpId(HID_CTRL3D_HSCROLL);
- maVerScroller->SetHelpId(HID_CTRL3D_VSCROLL);
- maSwitcher->SetHelpId(HID_CTRL3D_SWITCHER);
- maSwitcher->SetAccessibleName(SvxResId(STR_SWITCH));
-
- // Light preview
- maLightControl->Show();
- maLightControl->SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
- maLightControl->SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
-
- // Horiz Scrollbar
- maHorScroller->Show();
- maHorScroller->SetRange(Range(0, 36000));
- maHorScroller->SetLineSize(100);
- maHorScroller->SetPageSize(1000);
- maHorScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
-
- // Vert Scrollbar
- maVerScroller->Show();
- maVerScroller->SetRange(Range(0, 18000));
- maVerScroller->SetLineSize(100);
- maVerScroller->SetPageSize(1000);
- maVerScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
-
- // Switch Button
- maSwitcher->Show();
- maSwitcher->SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
-
- // check selection
- CheckSelection();
-
- // new layout
- NewLayout();
-}
-
-SvxLightCtl3D::~SvxLightCtl3D()
-{
- disposeOnce();
-}
-
-void SvxLightCtl3D::dispose()
-{
- maLightControl.disposeAndClear();
- maHorScroller.disposeAndClear();
- maVerScroller.disposeAndClear();
- maSwitcher.disposeAndClear();
- Control::dispose();
-}
-
-void SvxLightCtl3D::Resize()
-{
- // call parent
- Control::Resize();
-
- // new layout
- NewLayout();
-}
-
-void SvxLightCtl3D::NewLayout()
-{
- // Layout members
- const Size aSize(GetOutputSizePixel());
- const sal_Int32 nScrollSize(maHorScroller->GetSizePixel().Height());
-
- // Preview control
- Point aPoint(0, 0);
- Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
- maLightControl->SetPosSizePixel(aPoint, aDestSize);
-
- // hor scrollbar
- aPoint.setY( aSize.Height() - nScrollSize );
- aDestSize.setHeight( nScrollSize );
- maHorScroller->SetPosSizePixel(aPoint, aDestSize);
-
- // vert scrollbar
- aPoint.setX( aSize.Width() - nScrollSize );
- aPoint.setY( 0 );
- aDestSize.setWidth( nScrollSize );
- aDestSize.setHeight( aSize.Height() - nScrollSize );
- maVerScroller->SetPosSizePixel(aPoint, aDestSize);
-
- // button
- aPoint.setY( aSize.Height() - nScrollSize );
- aDestSize.setHeight( nScrollSize );
- maSwitcher->SetPosSizePixel(aPoint, aDestSize);
-}
-
-void SvxLightCtl3D::CheckSelection()
-{
- const bool bSelectionValid(maLightControl->IsSelectionValid() || maLightControl->IsGeometrySelected());
- maHorScroller->Enable(bSelectionValid);
- maVerScroller->Enable(bSelectionValid);
-
- if(bSelectionValid)
- {
- double fHor(0.0), fVer(0.0);
- maLightControl->GetPosition(fHor, fVer);
- maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
- }
-}
-
-void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
-{
- double fHor(0.0), fVer(0.0);
-
- maLightControl->GetPosition(fHor, fVer);
- fHor += fDeltaHor;
- fVer += fDeltaVer;
-
- if( fVer > 90.0 )
- return;
-
- if ( fVer < -90.0 )
- return;
-
- maLightControl->SetPosition(fHor, fVer);
- maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
-}
-
-void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
-{
- const vcl::KeyCode aCode(rKEvt.GetKeyCode());
-
- if( aCode.GetModifier() )
- {
- Control::KeyInput( rKEvt );
- return;
- }
-
- switch ( aCode.GetCode() )
- {
- case KEY_SPACE:
- {
- break;
- }
- case KEY_LEFT:
- {
- move( -4.0, 0.0 ); // #i58242# changed move direction in X
- break;
- }
- case KEY_RIGHT:
- {
- move( 4.0, 0.0 ); // #i58242# changed move direction in X
- break;
- }
- case KEY_UP:
- {
- move( 0.0, 4.0 );
- break;
- }
- case KEY_DOWN:
- {
- move( 0.0, -4.0 );
- break;
- }
- case KEY_PAGEUP:
- {
- sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
-
- while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
- {
- nLight--;
- }
-
- if(nLight < 0)
- {
- nLight = 7;
-
- while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
- {
- nLight--;
- }
- }
-
- if(nLight >= 0)
- {
- maLightControl->SelectLight(nLight);
- CheckSelection();
-
- if(maUserSelectionChangeCallback.IsSet())
- {
- maUserSelectionChangeCallback.Call(this);
- }
- }
-
- break;
- }
- case KEY_PAGEDOWN:
- {
- sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
-
- while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
- {
- nLight++;
- }
-
- if(nLight > 7)
- {
- nLight = 0;
-
- while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
- {
- nLight++;
- }
- }
-
- if(nLight <= 7)
- {
- maLightControl->SelectLight(nLight);
- CheckSelection();
-
- if(maUserSelectionChangeCallback.IsSet())
- {
- maUserSelectionChangeCallback.Call(this);
- }
- }
-
- break;
- }
- default:
- {
- Control::KeyInput( rKEvt );
- break;
- }
- }
-}
-
-void SvxLightCtl3D::GetFocus()
-{
- Control::GetFocus();
-
- if(HasFocus() && IsEnabled())
- {
- CheckSelection();
-
- Size aFocusSize = maLightControl->GetOutputSizePixel();
-
- aFocusSize.AdjustWidth( -4 );
- aFocusSize.AdjustHeight( -4 );
-
- tools::Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
-
- aFocusRect = maLightControl->PixelToLogic( aFocusRect );
-
- maLightControl->ShowFocus( aFocusRect );
- }
-}
-
-void SvxLightCtl3D::LoseFocus()
-{
- Control::LoseFocus();
-
- maLightControl->HideFocus();
-}
-
-IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove, ScrollBar*, void)
-{
- const sal_Int32 nHor(maHorScroller->GetThumbPos());
- const sal_Int32 nVer(maVerScroller->GetThumbPos());
-
- maLightControl->SetPosition(
- static_cast<double>(nHor) / 100.0,
- static_cast<double>((18000 - nVer) - 9000) / 100.0);
-}
-
-IMPL_LINK_NOARG(SvxLightCtl3D, ButtonPress, Button*, void)
-{
- if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
- {
- GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
- }
- else
- {
- GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
- }
-}
-
-IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange, Svx3DLightControl*, void)
-{
- double fHor(0.0), fVer(0.0);
-
- maLightControl->GetPosition(fHor, fVer);
- maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
- maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
-}
-
-IMPL_LINK_NOARG(SvxLightCtl3D, InternalSelectionChange, Svx3DLightControl*, void)
-{
- CheckSelection();
-
- if(maUserSelectionChangeCallback.IsSet())
- {
- maUserSelectionChangeCallback.Call(this);
- }
-}
-
LightCtl3D::LightCtl3D(LightControl3D& rLightControl, weld::Scale& rHori,
weld::Scale& rVert, weld::Button& rSwitcher)
: mrLightControl(rLightControl)
More information about the Libreoffice-commits
mailing list