renaissance1: #i107215# Mouse wheel scrolls whole slides.
This commit is contained in:
@@ -127,8 +127,6 @@ public:
|
||||
*/
|
||||
virtual void ArrangeGUIElements (void);
|
||||
|
||||
virtual bool HandleScrollCommand (const CommandEvent& rEvent, ::sd::Window* pWindow);
|
||||
|
||||
virtual void Activate (BOOL IsMDIActivate);
|
||||
|
||||
//===== Drag and Drop =====================================================
|
||||
|
@@ -502,10 +502,35 @@ bool SlideSorterController::Command (
|
||||
|
||||
case COMMAND_WHEEL:
|
||||
{
|
||||
// We ignore zooming with control+mouse wheel.
|
||||
const CommandWheelData* pData = rEvent.GetWheelData();
|
||||
if (pData!=NULL && pData->IsMod1())
|
||||
bEventHasBeenHandled = true;
|
||||
if (pData == NULL)
|
||||
return false;
|
||||
if (pData->IsMod1())
|
||||
{
|
||||
// We do not support zooming with control+mouse wheel.
|
||||
return false;
|
||||
}
|
||||
// Determine whether to scroll horizontally or vertically. This
|
||||
// depends on the orientation of the scroll bar and the
|
||||
// IsHoriz() flag of the event.
|
||||
if ((mrSlideSorter.GetView().GetOrientation()==view::Layouter::HORIZONTAL)
|
||||
== pData->IsHorz())
|
||||
{
|
||||
GetScrollBarManager().Scroll(
|
||||
ScrollBarManager::Orientation_Vertical,
|
||||
ScrollBarManager::Unit_Slide,
|
||||
-pData->GetNotchDelta());
|
||||
}
|
||||
else
|
||||
{
|
||||
GetScrollBarManager().Scroll(
|
||||
ScrollBarManager::Orientation_Horizontal,
|
||||
ScrollBarManager::Unit_Slide,
|
||||
-pData->GetNotchDelta());
|
||||
}
|
||||
mrSlideSorter.GetView().UpdatePageUnderMouse(rEvent.GetMousePosPixel(), false);
|
||||
|
||||
bEventHasBeenHandled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -487,21 +487,21 @@ bool ScrollBarManager::TestScrollBarVisibilities (
|
||||
|
||||
void ScrollBarManager::SetTopLeft (const Point aNewTopLeft)
|
||||
{
|
||||
if ((mpVerticalScrollBar == NULL
|
||||
if (( ! mpVerticalScrollBar
|
||||
|| mpVerticalScrollBar->GetThumbPos() == aNewTopLeft.Y())
|
||||
&& (mpHorizontalScrollBar == NULL
|
||||
&& ( ! mpHorizontalScrollBar
|
||||
|| mpHorizontalScrollBar->GetThumbPos() == aNewTopLeft.X()))
|
||||
return;
|
||||
|
||||
// Flush pending repaints before scrolling to avoid temporary artifacts.
|
||||
mrSlideSorter.GetContentWindow()->Update();
|
||||
|
||||
if (mpVerticalScrollBar != NULL)
|
||||
if (mpVerticalScrollBar)
|
||||
{
|
||||
mpVerticalScrollBar->SetThumbPos(aNewTopLeft.Y());
|
||||
mnVerticalPosition = aNewTopLeft.Y() / double(mpVerticalScrollBar->GetRange().Len());
|
||||
}
|
||||
if (mpHorizontalScrollBar != NULL)
|
||||
if (mpHorizontalScrollBar)
|
||||
{
|
||||
mpHorizontalScrollBar->SetThumbPos(aNewTopLeft.X());
|
||||
mnHorizontalPosition = aNewTopLeft.X() / double(mpHorizontalScrollBar->GetRange().Len());
|
||||
@@ -677,4 +677,82 @@ IMPL_LINK(ScrollBarManager, AutoScrollTimeoutHandler, Timer *, EMPTYARG)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ScrollBarManager::Scroll(
|
||||
const Orientation eOrientation,
|
||||
const Unit eUnit,
|
||||
const sal_Int32 nDistance)
|
||||
{
|
||||
bool bIsVertical (false);
|
||||
switch (eOrientation)
|
||||
{
|
||||
case Orientation_Horizontal: bIsVertical = false; break;
|
||||
case Orientation_Vertical: bIsVertical = true; break;
|
||||
default:
|
||||
OSL_ASSERT(eOrientation==Orientation_Horizontal || eOrientation==Orientation_Vertical);
|
||||
return;
|
||||
}
|
||||
|
||||
Point aNewTopLeft (
|
||||
mpHorizontalScrollBar ? mpHorizontalScrollBar->GetThumbPos() : 0,
|
||||
mpVerticalScrollBar ? mpVerticalScrollBar->GetThumbPos() : 0);
|
||||
switch (eUnit)
|
||||
{
|
||||
case Unit_Pixel:
|
||||
if (bIsVertical)
|
||||
aNewTopLeft.Y() += nDistance;
|
||||
else
|
||||
aNewTopLeft.X() += nDistance;
|
||||
break;
|
||||
|
||||
case Unit_Slide:
|
||||
{
|
||||
view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
|
||||
|
||||
// Calculate estimate of new location.
|
||||
if (bIsVertical)
|
||||
aNewTopLeft.Y() += nDistance * rLayouter.GetPageObjectSize().Height();
|
||||
else
|
||||
aNewTopLeft.X() += nDistance * rLayouter.GetPageObjectSize().Width();
|
||||
|
||||
// Adapt location to show whole slides.
|
||||
if (bIsVertical)
|
||||
if (nDistance > 0)
|
||||
{
|
||||
const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
|
||||
Point(aNewTopLeft.X(), aNewTopLeft.Y()+mpVerticalScrollBar->GetVisibleSize()),
|
||||
true));
|
||||
aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Bottom()
|
||||
- mpVerticalScrollBar->GetVisibleSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
|
||||
Point(aNewTopLeft.X(), aNewTopLeft.Y()),
|
||||
true));
|
||||
aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Top();
|
||||
}
|
||||
else
|
||||
if (nDistance > 0)
|
||||
{
|
||||
const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
|
||||
Point(aNewTopLeft.X()+mpVerticalScrollBar->GetVisibleSize(), aNewTopLeft.Y()),
|
||||
true));
|
||||
aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Right()
|
||||
- mpVerticalScrollBar->GetVisibleSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
const sal_Int32 nIndex (rLayouter.GetIndexAtPoint(
|
||||
Point(aNewTopLeft.X(), aNewTopLeft.Y()),
|
||||
true));
|
||||
aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Left();
|
||||
}
|
||||
}
|
||||
}
|
||||
SetTopLeft(aNewTopLeft);
|
||||
}
|
||||
|
||||
|
||||
} } } // end of namespace ::sd::slidesorter::controller
|
||||
|
@@ -175,6 +175,21 @@ public:
|
||||
|
||||
void StopAutoScroll (void);
|
||||
|
||||
enum Orientation { Orientation_Horizontal, Orientation_Vertical };
|
||||
enum Unit { Unit_Pixel, Unit_Slide };
|
||||
/** Scroll the slide sorter by setting the thumbs of the scroll bars and
|
||||
by moving the content of the content window.
|
||||
@param eOrientation
|
||||
Defines whether to scroll horizontally or vertically.
|
||||
@param eUnit
|
||||
Defines whether the distance is a pixel value or the number of
|
||||
slides to scroll.
|
||||
*/
|
||||
void Scroll(
|
||||
const Orientation eOrientation,
|
||||
const Unit eUnit,
|
||||
const sal_Int32 nDistance);
|
||||
|
||||
private:
|
||||
SlideSorter& mrSlideSorter;
|
||||
|
||||
|
@@ -88,12 +88,13 @@
|
||||
#define IMAGE_INSERT_SHADOW 71
|
||||
#define IMAGE_HIDE_SLIDE_OVERLAY 72
|
||||
|
||||
#define STRING_UNHIDE 73
|
||||
#define STRING_DRAG_AND_DROP_PAGES 74
|
||||
#define STRING_DRAG_AND_DROP_SLIDES 75
|
||||
#define STRING_DRAG_AND_DROP_PAGES 73
|
||||
#define STRING_DRAG_AND_DROP_SLIDES 74
|
||||
|
||||
#define STRING_COMMAND1 76
|
||||
#define STRING_COMMAND2 77
|
||||
#define STRING_COMMAND3 78
|
||||
#define STRING_COMMAND1 75
|
||||
#define STRING_COMMAND2_A 76
|
||||
#define STRING_COMMAND2_B 77
|
||||
#define STRING_COMMAND2_HELP 78
|
||||
#define STRING_COMMAND3 79
|
||||
|
||||
#endif
|
||||
|
@@ -180,7 +180,9 @@ public:
|
||||
String_DragAndDropPages,
|
||||
String_DragAndDropSlides,
|
||||
String_Command1,
|
||||
String_Command2,
|
||||
String_Command2_A,
|
||||
String_Command2_B,
|
||||
String_Command2_Help,
|
||||
String_Command3,
|
||||
_StringType_Size_
|
||||
};
|
||||
|
@@ -570,47 +570,6 @@ void SlideSorterViewShell::ArrangeGUIElements (void)
|
||||
|
||||
|
||||
|
||||
bool SlideSorterViewShell::HandleScrollCommand (const CommandEvent& rEvent, ::sd::Window* pWindow)
|
||||
{
|
||||
bool bDone (false);
|
||||
|
||||
if (rEvent.GetCommand() == COMMAND_WHEEL
|
||||
&& mpSlideSorter->GetView().GetOrientation() == view::Layouter::HORIZONTAL)
|
||||
{
|
||||
// Make the wheel scroll the horizontal scroll bar. For this we
|
||||
// change the IsHoriz() flag of the CommandWheelData structure.
|
||||
CommandWheelData* pData = (CommandWheelData*)rEvent.GetData();
|
||||
CommandEvent aEvent (
|
||||
rEvent.GetMousePosPixel(),
|
||||
COMMAND_WHEEL,
|
||||
FALSE,
|
||||
new CommandWheelData(
|
||||
pData->GetDelta(),
|
||||
pData->GetNotchDelta(),
|
||||
pData->GetScrollLines(),
|
||||
pData->GetMode(),
|
||||
pData->GetModifier(),
|
||||
TRUE));
|
||||
bDone = ViewShell::HandleScrollCommand(aEvent, pWindow);
|
||||
}
|
||||
else
|
||||
bDone = ViewShell::HandleScrollCommand(rEvent, pWindow);
|
||||
|
||||
if (bDone)
|
||||
{
|
||||
OSL_ASSERT(mpSlideSorter.get()!=NULL);
|
||||
if (rEvent.GetCommand() == COMMAND_WHEEL)
|
||||
{
|
||||
mpSlideSorter->GetView().UpdatePageUnderMouse(rEvent.GetMousePosPixel(), false);
|
||||
}
|
||||
}
|
||||
|
||||
return bDone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SlideSorterViewShell::Activate (BOOL bIsMDIActivate)
|
||||
{
|
||||
ViewShell::Activate(bIsMDIActivate);
|
||||
|
@@ -1306,8 +1306,8 @@ Size ImageButton::GetSize (const Button::IconSize eIconSize) const
|
||||
UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
|
||||
: TextButton(
|
||||
rSlideSorter,
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Unhide),
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Command2_B),
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Command2_Help))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,7 @@ HideButton::HideButton (SlideSorter& rSlideSorter)
|
||||
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2MediumHover),
|
||||
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Small),
|
||||
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2SmallHover),
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
|
||||
rSlideSorter.GetTheme()->GetString(Theme::String_Command2_A))
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -161,11 +161,11 @@ Resource RID_SLIDESORTER_ICONS
|
||||
|
||||
Image IMAGE_COMMAND3_LARGE_HC
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "slide_sorter_command3_hc.png" ; };
|
||||
ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hc.png" ; };
|
||||
};
|
||||
Image IMAGE_COMMAND3_LARGE_HOVER_HC
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "slide_sorter_command3_hover_hc.png" ; };
|
||||
ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hover_hc.png" ; };
|
||||
};
|
||||
Image IMAGE_COMMAND3_MEDIUM_HC
|
||||
{
|
||||
@@ -229,11 +229,6 @@ Resource RID_SLIDESORTER_ICONS
|
||||
};
|
||||
|
||||
|
||||
String STRING_UNHIDE
|
||||
{
|
||||
Text [ en-US ] = "Show" ;
|
||||
};
|
||||
|
||||
String STRING_DRAG_AND_DROP_PAGES
|
||||
{
|
||||
Text [ en-US ] = "Drag and Drop Pages" ;
|
||||
@@ -249,11 +244,21 @@ Resource RID_SLIDESORTER_ICONS
|
||||
Text [ en-US ] = "Start Slide Show" ;
|
||||
};
|
||||
|
||||
String STRING_COMMAND2
|
||||
String STRING_COMMAND2_A
|
||||
{
|
||||
Text [ en-US ] = "Hide Slide" ;
|
||||
};
|
||||
|
||||
String STRING_COMMAND2_B
|
||||
{
|
||||
Text [ en-US ] = "Show" ;
|
||||
};
|
||||
|
||||
String STRING_COMMAND2_HELP
|
||||
{
|
||||
Text [ en-US ] = "Show Slide" ;
|
||||
};
|
||||
|
||||
String STRING_COMMAND3
|
||||
{
|
||||
Text [ en-US ] = "Duplicate Slide" ;
|
||||
|
@@ -114,11 +114,12 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
|
||||
LocalResource aResource (RID_SLIDESORTER_ICONS);
|
||||
|
||||
maStrings.resize(_StringType_Size_);
|
||||
maStrings[String_Unhide] = String(SdResId(STRING_UNHIDE));
|
||||
maStrings[String_DragAndDropPages] = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
|
||||
maStrings[String_DragAndDropSlides] = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
|
||||
maStrings[String_Command1] = String(SdResId(STRING_COMMAND1));
|
||||
maStrings[String_Command2] = String(SdResId(STRING_COMMAND2));
|
||||
maStrings[String_Command2_A] = String(SdResId(STRING_COMMAND2_A));
|
||||
maStrings[String_Command2_B] = String(SdResId(STRING_COMMAND2_B));
|
||||
maStrings[String_Command2_Help] = String(SdResId(STRING_COMMAND2_HELP));
|
||||
maStrings[String_Command3] = String(SdResId(STRING_COMMAND3));
|
||||
|
||||
maColor.resize(_ColorType_Size_);
|
||||
@@ -530,7 +531,12 @@ Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
|
||||
void Theme::InitializeIcon (const IconType eType, USHORT nResourceId)
|
||||
{
|
||||
if (eType>=0 && size_t(eType)<maIcons.size())
|
||||
maIcons[eType] = Image(SdResId(nResourceId)).GetBitmapEx();
|
||||
{
|
||||
const BitmapEx aIcon (Image(SdResId(nResourceId)).GetBitmapEx());
|
||||
OSL_TRACE("loaded icon %d in size %dx%d", nResourceId, aIcon.GetSizePixel().Width(),
|
||||
aIcon.GetSizePixel().Height());
|
||||
maIcons[eType] = aIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ASSERT(eType>=0 && size_t(eType)<maIcons.size());
|
||||
|
Reference in New Issue
Block a user