summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx14
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsTheme.hxx1
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx87
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx82
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx9
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx1
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx206
-rw-r--r--sd/source/ui/slidesorter/view/makefile.mk1
8 files changed, 313 insertions, 88 deletions
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 427dcfa03a7c..449d76e7a9c2 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -68,6 +68,7 @@ class LayeredDevice;
class Layouter;
class PageObjectPainter;
class SelectionPainter;
+class ToolTip;
class SlideSorterView
@@ -240,14 +241,7 @@ public:
};
ButtonBar& GetButtonBar (void) const;
-
- /** Show a tool tip with either the given help text, or when that is
- empty, with the content of msHelpText.
- */
- void SetHelpText (
- const ::rtl::OUString& rsHelpText,
- const bool bIsDefaultHelpText);
- const ::rtl::OUString& GetDefaultHelpText (void) const;
+ ToolTip& GetToolTip (void) const;
protected:
virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
@@ -267,15 +261,13 @@ private:
Layouter::Orientation meOrientation;
::boost::shared_ptr<controller::Properties> mpProperties;
model::SharedPageDescriptor mpPageUnderMouse;
- ::rtl::OUString msDefaultHelpText;
- ::rtl::OUString msCurrentHelpText;
- ULONG mnHelpWindowHandle;
sal_Int32 mnButtonUnderMouse;
::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter;
::boost::shared_ptr<SelectionPainter> mpSelectionPainter;
Region maRedrawRegion;
SharedILayerPainter mpBackgroundPainter;
::boost::scoped_ptr<ButtonBar> mpButtonBar;
+ ::boost::scoped_ptr<ToolTip> mpToolTip;
bool mbIsRearrangePending;
/** Determine the visibility of all page objects.
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index fb2efd8fee97..8a428e374ae0 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -169,6 +169,7 @@ public:
Integer_ButtonFadeInDuration,
Integer_ButtonFadeOutDelay,
Integer_ButtonFadeOutDuration,
+ Integer_ToolTipDelay,
_IntegerValueType_Size_
};
sal_Int32 GetIntegerValue (const IntegerValueType eType) const;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
new file mode 100644
index 000000000000..258ef51b11f1
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
+#define SD_SLIDESORTER_VIEW_TOOL_TIP_HXX
+
+#include "SlideSorter.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+
+namespace sd { namespace slidesorter { namespace view {
+
+/** Manage the display of tool tips. The tool tip text changes when the
+ mouse is moved from slide to slide or from button to button.
+ After the mouse enters a slide the first display of the tool tip is
+ delayed for a short time in order to not draw attention from the slide
+ or its button bar.
+*/
+class ToolTip
+{
+public:
+ ToolTip (SlideSorter& rSlideSorter);
+ ~ToolTip (void);
+
+ /** Set a new page. This modifies the default help text. After a page
+ change a timer is started to delay the display of the tool tip for
+ the new page.
+ @param rpPage
+ When this is empty then the tool tip is hidden.
+ */
+ void SetPage (const model::SharedPageDescriptor& rpPage);
+
+ /** Set and show the default help text.
+ */
+ void ShowDefaultHelpText (const ::rtl::OUString& rsHelpText);
+
+ /** Show a previously set default help text.
+ */
+ void ShowDefaultHelpText (void);
+
+ /** Show a temporary help text.
+ */
+ void ShowHelpText (const ::rtl::OUString& rsHelpText);
+
+ /** Hide the tool tip.
+ */
+ void Hide (void);
+
+private:
+ SlideSorter& mrSlideSorter;
+ model::SharedPageDescriptor mpDescriptor;
+ ::rtl::OUString msDefaultHelpText;
+ ::rtl::OUString msCurrentHelpText;
+ ULONG mnHelpWindowHandle;
+ Timer maTimer;
+
+ void Show (void);
+ DECL_LINK(DelayTrigger, void*);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 81943f90e26b..cc1431421fc9 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -40,6 +40,7 @@
#include "view/SlsPageObjectPainter.hxx"
#include "view/SlsILayerPainter.hxx"
#include "view/SlsButtonBar.hxx"
+#include "view/SlsToolTip.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsProperties.hxx"
#include "model/SlideSorterModel.hxx"
@@ -66,7 +67,6 @@
#include <vcl/svapp.hxx>
#include <tools/poly.hxx>
#include <vcl/lineinfo.hxx>
-#include <vcl/help.hxx>
#include <algorithm>
#include <svx/sdrpagewindow.hxx>
#include <svl/itempool.hxx>
@@ -160,15 +160,13 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
meOrientation(Layouter::GRID),
mpProperties(rSlideSorter.GetProperties()),
mpPageUnderMouse(),
- msDefaultHelpText(),
- msCurrentHelpText(),
- mnHelpWindowHandle(0),
mnButtonUnderMouse(-1),
mpPageObjectPainter(),
mpSelectionPainter(),
mpBackgroundPainter(
new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Background))),
mpButtonBar(new ButtonBar(mrSlideSorter)),
+ mpToolTip(new ToolTip(mrSlideSorter)),
mbIsRearrangePending(true)
{
// Hide the page that contains the page objects.
@@ -840,53 +838,10 @@ ButtonBar& SlideSorterView::GetButtonBar (void) const
-void SlideSorterView::SetHelpText (
- const ::rtl::OUString& rsHelpText,
- const bool bIsDefaultHelpText)
+ToolTip& SlideSorterView::GetToolTip (void) const
{
- if (bIsDefaultHelpText)
- msDefaultHelpText = rsHelpText;
- if (msCurrentHelpText != rsHelpText)
- {
- if (mnHelpWindowHandle>0)
- {
- Help::HideTip(mnHelpWindowHandle);
- mnHelpWindowHandle = 0;
- }
-
- msCurrentHelpText = rsHelpText;
-
- if (msCurrentHelpText.getLength() > 0)
- {
- Rectangle aBox (
- mpLayouter->GetPageObjectLayouter()->GetBoundingBox(
- mpPageUnderMouse,
- PageObjectLayouter::Preview,
- PageObjectLayouter::WindowCoordinateSystem));
- ::Window* pParent (mrSlideSorter.GetContentWindow().get());
- while (pParent!=NULL && pParent->GetParent()!=NULL)
- pParent = pParent->GetParent();
- const Point aOffset (
- mrSlideSorter.GetContentWindow()->GetWindowExtentsRelative(pParent).TopLeft());
- aBox.Move(aOffset.X(), aOffset.Y());
- // We want the help text outside (below) the preview. Therefore
- // we have to make the box larger.
- aBox.Bottom()+=25;
- mnHelpWindowHandle = Help::ShowTip(
- mrSlideSorter.GetContentWindow().get(),
- aBox,
- msCurrentHelpText,
- QUICKHELP_CENTER | QUICKHELP_BOTTOM);
- }
- }
-}
-
-
-
-
-const ::rtl::OUString& SlideSorterView::GetDefaultHelpText (void) const
-{
- return msDefaultHelpText;
+ OSL_ASSERT(mpToolTip);
+ return *mpToolTip;
}
@@ -960,7 +915,7 @@ void SlideSorterView::UpdatePageUnderMouse (
&& GetButtonBar().IsMouseOverBar() != bIsMouseOverButtonBar
&& bIsMouseOverButtonBar)
{
- SetHelpText(msDefaultHelpText, true);
+ mpToolTip->ShowDefaultHelpText();
}
}
@@ -983,30 +938,7 @@ void SlideSorterView::SetPageUnderMouse (
// Change the quick help text to display the name of the page under
// the mouse.
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- ::rtl::OUString sHelpText;
- if (mpPageUnderMouse)
- {
- SdPage* pPage = mpPageUnderMouse->GetPage();
- if (pPage != NULL)
- sHelpText = pPage->GetName();
- else
- {
- OSL_ASSERT(mpPageUnderMouse->GetPage() != NULL);
- }
- if (sHelpText.getLength() == 0)
- {
- sHelpText = String(SdResId(STR_PAGE));
- sHelpText += String::CreateFromInt32(mpPageUnderMouse->GetPageIndex()+1);
- }
-
- SetHelpText(sHelpText, true);
- }
- else
- SetHelpText(::rtl::OUString(), false);
- }
+ mpToolTip->SetPage(rpDescriptor);
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 534900bf2440..0b01f41c81ad 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -33,6 +33,7 @@
#include "model/SlsPageDescriptor.hxx"
#include "view/SlsTheme.hxx"
#include "view/SlideSorterView.hxx"
+#include "view/SlsToolTip.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsSlotManager.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
@@ -296,9 +297,9 @@ void ButtonBar::ProcessMouseMotionEvent (
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
if (mpButtonUnderMouse)
- mrSlideSorter.GetView().SetHelpText(mpButtonUnderMouse->GetHelpText(), false);
+ mrSlideSorter.GetView().GetToolTip().ShowHelpText(mpButtonUnderMouse->GetHelpText());
else
- mrSlideSorter.GetView().SetHelpText(mrSlideSorter.GetView().GetDefaultHelpText(),true);
+ mrSlideSorter.GetView().GetToolTip().ShowDefaultHelpText();
}
if (bPageHasChanged || bButtonHasChanged || bButtonStateHasChanged)
@@ -1375,6 +1376,10 @@ void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescrip
if (mrSlideSorter.GetViewShell() != NULL
&& mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
{
+ // Hide the tool tip early, while the slide show still intializes.
+ mrSlideSorter.GetView().GetToolTip().SetPage(model::SharedPageDescriptor());
+
+ // Request the start of the slide show.
mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
SID_PRESENTATION,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index 5c692c606053..f0a79554193b 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -144,6 +144,7 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
maIntegerValues[Integer_ButtonFadeInDuration] = 400;
maIntegerValues[Integer_ButtonFadeOutDelay] = 0;
maIntegerValues[Integer_ButtonFadeOutDuration] = 250;
+ maIntegerValues[Integer_ToolTipDelay] = 1000;
}
Update(rpProperties);
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
new file mode 100644
index 000000000000..8f21acff3d3d
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "view/SlsToolTip.hxx"
+#include "view/SlideSorterView.hxx"
+#include "view/SlsLayouter.hxx"
+#include "view/SlsTheme.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "glob.hrc"
+#include <vcl/help.hxx>
+
+using ::rtl::OUString;
+
+namespace sd { namespace slidesorter { namespace view {
+
+ToolTip::ToolTip (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ msDefaultHelpText(),
+ msCurrentHelpText(),
+ mnHelpWindowHandle(0),
+ maTimer()
+{
+ maTimer.SetTimeout(rSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ToolTipDelay));
+ maTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
+}
+
+
+
+
+ToolTip::~ToolTip (void)
+{
+ maTimer.Stop();
+ Hide();
+}
+
+
+
+
+void ToolTip::SetPage (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if (mpDescriptor != rpDescriptor)
+ {
+ maTimer.Stop();
+ Hide();
+
+ mpDescriptor = rpDescriptor;
+
+ if (mpDescriptor)
+ {
+ SdPage* pPage = mpDescriptor->GetPage();
+ OUString sHelpText;
+ if (pPage != NULL)
+ sHelpText = pPage->GetName();
+ else
+ {
+ OSL_ASSERT(mpDescriptor->GetPage() != NULL);
+ }
+ if (sHelpText.getLength() == 0)
+ {
+ sHelpText = String(SdResId(STR_PAGE));
+ sHelpText += String::CreateFromInt32(mpDescriptor->GetPageIndex()+1);
+ }
+
+ msDefaultHelpText = sHelpText;
+ msCurrentHelpText = sHelpText;
+ maTimer.Start();
+ }
+ else
+ {
+ msDefaultHelpText = OUString();
+ msCurrentHelpText = OUString();
+ }
+ }
+}
+
+
+
+
+void ToolTip::ShowDefaultHelpText (const ::rtl::OUString& rsHelpText)
+{
+ if (msDefaultHelpText != rsHelpText)
+ {
+ Hide();
+
+ msDefaultHelpText = rsHelpText;
+ msCurrentHelpText = rsHelpText;
+
+ Show();
+ }
+}
+
+
+
+
+void ToolTip::ShowDefaultHelpText (void)
+{
+ if (msCurrentHelpText != msDefaultHelpText)
+ {
+ Hide();
+
+ msCurrentHelpText = msDefaultHelpText;
+
+ Show();
+ }
+}
+
+
+
+
+void ToolTip::ShowHelpText (const ::rtl::OUString& rsHelpText)
+{
+ if (msCurrentHelpText != rsHelpText)
+ {
+ Hide();
+
+ msCurrentHelpText = rsHelpText;
+
+ Show();
+ }
+}
+
+
+
+
+void ToolTip::Show (void)
+{
+ if (maTimer.IsActive())
+ {
+ // The delay timer is active. Wait for it to trigger the showing of
+ // the tool tip.
+ return;
+ }
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (msCurrentHelpText.getLength()>0 && pWindow)
+ {
+ Rectangle aBox (
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ mpDescriptor,
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::WindowCoordinateSystem));
+ ::Window* pParent (pWindow.get());
+ while (pParent!=NULL && pParent->GetParent()!=NULL)
+ pParent = pParent->GetParent();
+ const Point aOffset (
+ pWindow->GetWindowExtentsRelative(pParent).TopLeft());
+ aBox.Move(aOffset.X(), aOffset.Y());
+ // We want the help text outside (below) the preview. Therefore
+ // we have to make the box larger.
+ aBox.Bottom()+=25;
+ mnHelpWindowHandle = Help::ShowTip(
+ pWindow.get(),
+ aBox,
+ msCurrentHelpText,
+ QUICKHELP_CENTER | QUICKHELP_BOTTOM);
+ }
+}
+
+
+
+
+void ToolTip::Hide (void)
+{
+ if (mnHelpWindowHandle>0)
+ {
+ Help::HideTip(mnHelpWindowHandle);
+ mnHelpWindowHandle = 0;
+ }
+}
+
+
+
+
+IMPL_LINK(ToolTip, DelayTrigger, void*, EMPTYARG)
+{
+ Show();
+
+ return 0;
+}
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/makefile.mk b/sd/source/ui/slidesorter/view/makefile.mk
index 9a946670309b..3c5fc39c3ede 100644
--- a/sd/source/ui/slidesorter/view/makefile.mk
+++ b/sd/source/ui/slidesorter/view/makefile.mk
@@ -60,6 +60,7 @@ SLOFILES = \
$(SLO)$/SlsPageObjectLayouter.obj \
$(SLO)$/SlsPageObjectPainter.obj \
$(SLO)$/SlsTheme.obj \
+ $(SLO)$/SlsToolTip.obj \
$(SLO)$/SlsViewCacheContext.obj
# --- Tagets -------------------------------------------------------