summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorAmin Irgaliev <irgaliev01@mail.ru>2023-05-03 19:54:17 +0400
committerMike Kaganski <mike.kaganski@collabora.com>2023-05-04 06:23:38 +0200
commit8d8779808063aeedcf0d2b7efba3d2f82e0d7bef (patch)
tree16e849b905c5f460a2262647f609e0c3deb07dab /sd/source
parent83b1f6b58a30bdb589e9ce73deef39f021aebde1 (diff)
tdf#154839 Add navigation buttons for slides
Change-Id: Ie9a533acf94f5760c6233aa70259bec620f420fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150448 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/core/drawdoc.cxx1
-rw-r--r--sd/source/ui/dlg/present.cxx3
-rw-r--r--sd/source/ui/func/fusldlg.cxx8
-rw-r--r--sd/source/ui/inc/present.hxx1
-rw-r--r--sd/source/ui/slideshow/slideshow.cxx49
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx46
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.hxx8
7 files changed, 99 insertions, 17 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 98ba2126b6ba..89d5bdefa714 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -105,6 +105,7 @@ PresentationSettings::PresentationSettings()
mbMouseAsPen( false ),
mbLockedPages( false ),
mbAlwaysOnTop( false ),
+ mbUseNavigation( false ),
mbFullScreen( true ),
mbAnimationAllowed( true ),
mnPauseTimeout( 0 ),
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 73932ba622bd..cb5c7d871b36 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -54,6 +54,7 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
, m_xCbxAnimationAllowed(m_xBuilder->weld_check_button("animationsallowed"))
, m_xCbxChangePage(m_xBuilder->weld_check_button("changeslidesbyclick"))
, m_xCbxAlwaysOnTop(m_xBuilder->weld_check_button("alwaysontop"))
+ , m_xCbxShowNavigationButton(m_xBuilder->weld_check_button("shownavigationbutton"))
, m_xFtMonitor(m_xBuilder->weld_label("presdisplay_label"))
, m_xLBMonitor(m_xBuilder->weld_combo_box("presdisplay_cb"))
, m_xMonitor(m_xBuilder->weld_label("monitor_str"))
@@ -112,6 +113,7 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
m_xCbxAnimationAllowed->set_active( static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_ANIMATION_ALLOWED ) ).GetValue() );
m_xCbxChangePage->set_active( static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_CHANGE_PAGE ) ).GetValue() );
m_xCbxAlwaysOnTop->set_active( static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_ALWAYS_ON_TOP ) ).GetValue() );
+ m_xCbxShowNavigationButton->set_active( static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS) ).GetValue() );
const bool bEndless = static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_ENDLESS ) ).GetValue();
const bool bWindow = !static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_FULLSCREEN ) ).GetValue();
@@ -260,6 +262,7 @@ void SdStartPresentationDlg::GetAttr( SfxItemSet& rAttr )
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ANIMATION_ALLOWED, m_xCbxAnimationAllowed->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_CHANGE_PAGE, m_xCbxChangePage->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALWAYS_ON_TOP, m_xCbxAlwaysOnTop->get_active() ) );
+ rAttr.Put( SfxBoolItem ( ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, m_xCbxShowNavigationButton->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_FULLSCREEN, !m_xRbtWindow->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ENDLESS, m_xRbtAuto->get_active() ) );
rAttr.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, m_xFormatter->GetTime().GetMSFromTime() / 1000 ) );
diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx
index c0269b08a362..f609da1a9631 100644
--- a/sd/source/ui/func/fusldlg.cxx
+++ b/sd/source/ui/func/fusldlg.cxx
@@ -99,6 +99,7 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, rPresentationSettings.mbUseNavigation ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
@@ -193,6 +194,13 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
rPresentationSettings.mbAlwaysOnTop = bValue;
}
+ bValue = ITEMVALUE(aDlgSet, ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, SfxBoolItem);
+ if (bValue != rPresentationSettings.mbUseNavigation)
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbUseNavigation = bValue;
+ }
+
bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
if ( bValue != rPresentationSettings.mbFullScreen )
{
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index 00c78ac79328..aba8839bdfd2 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -54,6 +54,7 @@ private:
std::unique_ptr<weld::CheckButton> m_xCbxAnimationAllowed;
std::unique_ptr<weld::CheckButton> m_xCbxChangePage;
std::unique_ptr<weld::CheckButton> m_xCbxAlwaysOnTop;
+ std::unique_ptr<weld::CheckButton> m_xCbxShowNavigationButton;
std::unique_ptr<weld::Label> m_xFtMonitor;
std::unique_ptr<weld::ComboBox> m_xLBMonitor;
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index ec070d0919c7..348bc606b800 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -109,21 +109,22 @@ static o3tl::span<const SfxItemPropertyMapEntry> ImplGetPresentationPropertyMap(
// NOTE: First member must be sorted
static const SfxItemPropertyMapEntry aPresentationPropertyMap_Impl[] =
{
- { u"AllowAnimations", ATTR_PRESENT_ANIMATION_ALLOWED, cppu::UnoType<bool>::get(), 0, 0 },
- { u"CustomShow", ATTR_PRESENT_CUSTOMSHOW, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"Display", ATTR_PRESENT_DISPLAY, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
- { u"FirstPage", ATTR_PRESENT_DIANAME, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"IsAlwaysOnTop", ATTR_PRESENT_ALWAYS_ON_TOP, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsAutomatic", ATTR_PRESENT_MANUEL, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsEndless", ATTR_PRESENT_ENDLESS, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsFullScreen", ATTR_PRESENT_FULLSCREEN, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsShowAll", ATTR_PRESENT_ALL, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsMouseVisible", ATTR_PRESENT_MOUSE, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsShowLogo", ATTR_PRESENT_SHOW_PAUSELOGO, cppu::UnoType<bool>::get(), 0, 0 },
- { u"IsTransitionOnClick", ATTR_PRESENT_CHANGE_PAGE, cppu::UnoType<bool>::get(), 0, 0 },
- { u"Pause", ATTR_PRESENT_PAUSE_TIMEOUT, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
- { u"StartWithNavigator", ATTR_PRESENT_NAVIGATOR, cppu::UnoType<bool>::get(), 0, 0 },
- { u"UsePen", ATTR_PRESENT_PEN, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"AllowAnimations", ATTR_PRESENT_ANIMATION_ALLOWED, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"CustomShow", ATTR_PRESENT_CUSTOMSHOW, ::cppu::UnoType<OUString>::get(), 0, 0 },
+ { u"Display", ATTR_PRESENT_DISPLAY, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
+ { u"FirstPage", ATTR_PRESENT_DIANAME, ::cppu::UnoType<OUString>::get(), 0, 0 },
+ { u"IsAlwaysOnTop", ATTR_PRESENT_ALWAYS_ON_TOP, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsShowNavigationButtons", ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsAutomatic", ATTR_PRESENT_MANUEL, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsEndless", ATTR_PRESENT_ENDLESS, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsFullScreen", ATTR_PRESENT_FULLSCREEN, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsShowAll", ATTR_PRESENT_ALL, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsMouseVisible", ATTR_PRESENT_MOUSE, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsShowLogo", ATTR_PRESENT_SHOW_PAUSELOGO, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"IsTransitionOnClick", ATTR_PRESENT_CHANGE_PAGE, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"Pause", ATTR_PRESENT_PAUSE_TIMEOUT, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
+ { u"StartWithNavigator", ATTR_PRESENT_NAVIGATOR, cppu::UnoType<bool>::get(), 0, 0 },
+ { u"UsePen", ATTR_PRESENT_PEN, cppu::UnoType<bool>::get(), 0, 0 },
};
return aPresentationPropertyMap_Impl;
@@ -439,6 +440,22 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const
}
break;
}
+ case ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS:
+ {
+ bool bVal = false;
+
+ if (aValue >>= bVal)
+ {
+ bIllegalArgument = false;
+
+ if (rPresSettings.mbUseNavigation != bVal)
+ {
+ bValuesChanged = true;
+ rPresSettings.mbUseNavigation = bVal;
+ }
+ }
+ break;
+ }
case ATTR_PRESENT_NAVIGATOR:
bIllegalArgument = false;
//ignored, but exists in some older documents
@@ -565,6 +582,8 @@ Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName )
return Any( rPresSettings.mbMouseVisible );
case ATTR_PRESENT_ALWAYS_ON_TOP:
return Any( rPresSettings.mbAlwaysOnTop );
+ case ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS:
+ return Any(rPresSettings.mbUseNavigation);
case ATTR_PRESENT_NAVIGATOR:
return Any( false );
case ATTR_PRESENT_PEN:
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 73517ff87c0e..a9f16b86b8d4 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -756,6 +756,7 @@ bool SlideshowImpl::startPreview(
maPresSettings.mbMouseAsPen = false;
maPresSettings.mbLockedPages = false;
maPresSettings.mbAlwaysOnTop = false;
+ maPresSettings.mbUseNavigation = false;
maPresSettings.mbFullScreen = false;
maPresSettings.mbAnimationAllowed = true;
maPresSettings.mnPauseTimeout = 0;
@@ -876,6 +877,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings )
maPresSettings.mbMouseAsPen = false;
maPresSettings.mnPauseTimeout = 0;
maPresSettings.mbShowPauseLogo = false;
+ maPresSettings.mbUseNavigation = false;
}
if( pStartPage )
@@ -1077,6 +1079,37 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp
Any( xPointerBitmap ),
beans::PropertyState_DIRECT_VALUE ) );
}
+
+ if (maPresSettings.mbUseNavigation)
+ {
+ BitmapEx prevSlideBm(BMP_PREV_SLIDE);
+ const Reference<rendering::XBitmap> xPrevSBitmap(
+ vcl::unotools::xBitmapFromBitmapEx(prevSlideBm));
+ if (xPrevSBitmap.is())
+ {
+ mxShow->setProperty(beans::PropertyValue("NavigationSlidePrev", -1,
+ Any(xPrevSBitmap),
+ beans::PropertyState_DIRECT_VALUE));
+ }
+ BitmapEx menuSlideBm(BMP_MENU_SLIDE);
+ const Reference<rendering::XBitmap> xMenuSBitmap(
+ vcl::unotools::xBitmapFromBitmapEx(menuSlideBm));
+ if (xMenuSBitmap.is())
+ {
+ mxShow->setProperty(beans::PropertyValue("NavigationSlideMenu", -1,
+ Any(xMenuSBitmap),
+ beans::PropertyState_DIRECT_VALUE));
+ }
+ BitmapEx nextSlideBm(BMP_NEXT_SLIDE);
+ const Reference<rendering::XBitmap> xNextSBitmap(
+ vcl::unotools::xBitmapFromBitmapEx(nextSlideBm));
+ if (xNextSBitmap.is())
+ {
+ mxShow->setProperty(beans::PropertyValue("NavigationSlideNext", -1,
+ Any(xNextSBitmap),
+ beans::PropertyState_DIRECT_VALUE));
+ }
+ }
}
for( const auto& rProp : aProperties )
@@ -1579,6 +1612,12 @@ sal_Int32 SlideshowImpl::getSlideNumberForBookmark( const OUString& rStrBookmark
return ( nPgNum - 1) >> 1;
}
+void SlideshowImpl::contextMenuShow(const css::awt::Point& point)
+{
+ maPopupMousePos = { point.X, point.Y };
+ mnContextMenuEvent = Application::PostUserEvent(LINK(this, SlideshowImpl, ContextMenuHdl));
+}
+
void SlideshowImpl::hyperLinkClicked( OUString const& aHyperLink )
{
OUString aBookmark( aHyperLink );
@@ -3346,6 +3385,13 @@ void SAL_CALL SlideShowListenerProxy::click( const Reference< XShape >& xShape,
mxController->click(xShape );
}
+void SAL_CALL SlideShowListenerProxy::contextMenuShow(const css::awt::Point& point)
+{
+ SolarMutexGuard aSolarGuard;
+ if (mxController.is())
+ mxController->contextMenuShow(point);
+}
+
} // namespace ::sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index 27c755318c8d..48802ba54499 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -25,7 +25,7 @@
#include <cppuhelper/implbase.hxx>
#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/presentation/ClickAction.hpp>
-#include <com/sun/star/presentation/XSlideShowListener.hpp>
+#include <com/sun/star/presentation/XSlideShowNavigationListener.hpp>
#include <com/sun/star/presentation/XSlideShowController.hpp>
#include <com/sun/star/presentation/XShapeEventListener.hpp>
@@ -80,7 +80,7 @@ struct WrappedShapeEventImpl
typedef std::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr;
class SlideShowListenerProxy :
- public ::cppu::WeakImplHelper< css::presentation::XSlideShowListener, css::presentation::XShapeEventListener >
+ public ::cppu::WeakImplHelper< css::presentation::XSlideShowNavigationListener, css::presentation::XShapeEventListener >
{
public:
SlideShowListenerProxy( rtl::Reference< SlideshowImpl > xController, css::uno::Reference< css::presentation::XSlideShow > xSlideShow );
@@ -109,6 +109,9 @@ public:
virtual void SAL_CALL slideEnded(sal_Bool bReverse) override;
virtual void SAL_CALL hyperLinkClicked(const OUString & hyperLink) override;
+ // css::presentation::XSlideShowNavigationListener:
+ virtual void SAL_CALL contextMenuShow(const css::awt::Point& point) override;
+
// css::lang::XEventListener:
virtual void SAL_CALL disposing(const css::lang::EventObject & Source) override;
@@ -182,6 +185,7 @@ public:
// will be called from the SlideShowListenerProxy when this event is fired from the XSlideShow
void slideEnded(const bool bReverse);
+ void contextMenuShow(const css::awt::Point& point);
/// @throws css::uno::RuntimeException
void hyperLinkClicked(const OUString & hyperLink);
void click(const css::uno::Reference< css::drawing::XShape > & xShape);