1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #include <cppuhelper/supportsservice.hxx>
4 #include "vlcwindow.hxx"
5 #include "vlcplayer.hxx"
7 using namespace ::com::sun::star
;
14 const ::rtl::OUString AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME
= "com.sun.star.comp.avmedia.Window_VLC";
15 const ::rtl::OUString AVMEDIA_VLC_WINDOW_SERVICENAME
= "com.sun.star.media.Window_VLC";
18 VLCWindow::VLCWindow( VLCPlayer
& player
, const intptr_t prevWinID
)
20 , mPrevWinID( prevWinID
)
21 , meZoomLevel( media::ZoomLevel_ORIGINAL
)
25 VLCWindow::~VLCWindow()
27 if ( mPrevWinID
!= 0 )
28 mPlayer
.setWindowID( mPrevWinID
);
31 void SAL_CALL
VLCWindow::update() throw (css::uno::RuntimeException
, std::exception
)
35 sal_Bool SAL_CALL
VLCWindow::setZoomLevel( css::media::ZoomLevel eZoomLevel
) throw (css::uno::RuntimeException
, std::exception
)
39 if( media::ZoomLevel_NOT_AVAILABLE
!= meZoomLevel
&&
40 media::ZoomLevel_NOT_AVAILABLE
!= eZoomLevel
)
42 if( eZoomLevel
!= meZoomLevel
)
44 meZoomLevel
= eZoomLevel
;
47 switch ( static_cast<int>( eZoomLevel
) )
49 case media::ZoomLevel_ORIGINAL
:
50 case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT
:
51 mPlayer
.setVideoSize( mSize
.Width
, mSize
.Height
);
53 case media::ZoomLevel_ZOOM_1_TO_2
:
54 mPlayer
.setVideoSize( mSize
.Width
/ 2, mSize
.Height
/ 2 );
56 case media::ZoomLevel_ZOOM_2_TO_1
:
57 mPlayer
.setVideoSize( mSize
.Width
* 2, mSize
.Height
* 2 );
67 css::media::ZoomLevel SAL_CALL
VLCWindow::getZoomLevel() throw (css::uno::RuntimeException
, std::exception
)
72 void SAL_CALL
VLCWindow::setPointerType( ::sal_Int32
) throw (css::uno::RuntimeException
, std::exception
)
76 ::rtl::OUString SAL_CALL
VLCWindow::getImplementationName() throw (css::uno::RuntimeException
, std::exception
)
78 return AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME
;
81 sal_Bool SAL_CALL
VLCWindow::supportsService( const ::rtl::OUString
& serviceName
) throw (css::uno::RuntimeException
, std::exception
)
83 return cppu::supportsService(this, serviceName
);
86 uno::Sequence
< ::rtl::OUString
> SAL_CALL
VLCWindow::getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
)
88 uno::Sequence
< OUString
> aRet(1);
89 aRet
[0] = AVMEDIA_VLC_WINDOW_SERVICENAME
;
93 void SAL_CALL
VLCWindow::dispose() throw (uno::RuntimeException
, std::exception
)
97 void SAL_CALL
VLCWindow::addEventListener( const uno::Reference
< lang::XEventListener
>& )
98 throw (uno::RuntimeException
, std::exception
)
102 void SAL_CALL
VLCWindow::removeEventListener( const uno::Reference
< lang::XEventListener
>& )
103 throw (uno::RuntimeException
, std::exception
)
107 void SAL_CALL
VLCWindow::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, sal_Int16
/* Flags */ )
108 throw (uno::RuntimeException
, std::exception
)
113 mSize
.Height
= Height
;
116 awt::Rectangle SAL_CALL
VLCWindow::getPosSize()
117 throw (uno::RuntimeException
, std::exception
)
122 void SAL_CALL
VLCWindow::setVisible( sal_Bool
)
123 throw (uno::RuntimeException
, std::exception
)
127 void SAL_CALL
VLCWindow::setEnable( sal_Bool
)
128 throw (uno::RuntimeException
, std::exception
)
132 void SAL_CALL
VLCWindow::setFocus()
133 throw (uno::RuntimeException
, std::exception
)
137 void SAL_CALL
VLCWindow::addWindowListener( const uno::Reference
< awt::XWindowListener
>& )
138 throw (uno::RuntimeException
, std::exception
)
142 void SAL_CALL
VLCWindow::removeWindowListener( const uno::Reference
< awt::XWindowListener
>& )
143 throw (uno::RuntimeException
, std::exception
)
147 void SAL_CALL
VLCWindow::addFocusListener( const uno::Reference
< awt::XFocusListener
>& )
148 throw (uno::RuntimeException
, std::exception
)
152 void SAL_CALL
VLCWindow::removeFocusListener( const uno::Reference
< awt::XFocusListener
>& )
153 throw (uno::RuntimeException
, std::exception
)
157 void SAL_CALL
VLCWindow::addKeyListener( const uno::Reference
< awt::XKeyListener
>& )
158 throw (uno::RuntimeException
, std::exception
)
162 void SAL_CALL
VLCWindow::removeKeyListener( const uno::Reference
< awt::XKeyListener
>& )
163 throw (uno::RuntimeException
, std::exception
)
167 void SAL_CALL
VLCWindow::addMouseListener( const uno::Reference
< awt::XMouseListener
>& )
168 throw (uno::RuntimeException
, std::exception
)
172 void SAL_CALL
VLCWindow::removeMouseListener( const uno::Reference
< awt::XMouseListener
>& )
173 throw (uno::RuntimeException
, std::exception
)
177 void SAL_CALL
VLCWindow::addMouseMotionListener( const uno::Reference
< awt::XMouseMotionListener
>& )
178 throw (uno::RuntimeException
, std::exception
)
182 void SAL_CALL
VLCWindow::removeMouseMotionListener( const uno::Reference
< awt::XMouseMotionListener
>& )
183 throw (uno::RuntimeException
, std::exception
)
187 void SAL_CALL
VLCWindow::addPaintListener( const uno::Reference
< awt::XPaintListener
>& )
188 throw (uno::RuntimeException
, std::exception
)
192 void SAL_CALL
VLCWindow::removePaintListener( const uno::Reference
< awt::XPaintListener
>& )
193 throw (uno::RuntimeException
, std::exception
)
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */