summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx16
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.hxx6
-rw-r--r--sd/source/ui/inc/SlideSorterViewShell.hxx3
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx50
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx147
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx11
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx2
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx10
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx8
9 files changed, 98 insertions, 155 deletions
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 1477cb2ec4b8..16f52686c008 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -230,7 +230,7 @@ Reference<XResource> SAL_CALL BasicViewFactory::createResource (
// When the requested view is not in the cache then create a new view.
if (pDescriptor.get() == NULL)
{
- pDescriptor = CreateView(rxViewId, *pFrame, *pWindow, xPane, pFrameView);
+ pDescriptor = CreateView(rxViewId, *pFrame, *pWindow, xPane, pFrameView, bIsCenterPane);
}
if (pDescriptor.get() != NULL)
@@ -354,7 +354,8 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
SfxViewFrame& rFrame,
::Window& rWindow,
const Reference<XPane>& rxPane,
- FrameView* pFrameView)
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
{
::boost::shared_ptr<ViewDescriptor> pDescriptor (new ViewDescriptor());
@@ -362,13 +363,12 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
rxViewId,
rFrame,
rWindow,
- pFrameView);
+ pFrameView,
+ bIsCenterPane);
pDescriptor->mxViewId = rxViewId;
if (pDescriptor->mpViewShell.get() != NULL)
{
- const bool bIsCenterPane (
- rxViewId->isBoundToURL(FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT));
pDescriptor->mpViewShell->Init(bIsCenterPane);
mpBase->GetViewShellManager()->ActivateViewShell(pDescriptor->mpViewShell.get());
@@ -389,7 +389,8 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
const Reference<XResourceId>& rxViewId,
SfxViewFrame& rFrame,
::Window& rWindow,
- FrameView* pFrameView)
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
{
::boost::shared_ptr<ViewShell> pViewShell;
const OUString& rsViewURL (rxViewId->getResourceURL());
@@ -465,7 +466,8 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
&rFrame,
*mpBase,
&rWindow,
- pFrameView);
+ pFrameView,
+ bIsCenterPane);
}
return pViewShell;
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx
index 59d2826ac106..0a839f47b7a9 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx
@@ -132,13 +132,15 @@ private:
SfxViewFrame& rFrame,
::Window& rWindow,
const css::uno::Reference<css::drawing::framework::XPane>& rxPane,
- FrameView* pFrameView);
+ FrameView* pFrameView,
+ const bool bIsCenterView);
::boost::shared_ptr<ViewShell> CreateViewShell (
const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
SfxViewFrame& rFrame,
::Window& rWindow,
- FrameView* pFrameView);
+ FrameView* pFrameView,
+ const bool bIsCenterView);
void ActivateCenterView (
const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor);
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index c861af9dfa21..70ab0b920673 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -66,7 +66,8 @@ public:
SfxViewFrame* pFrame,
ViewShellBase& rViewShellBase,
::Window* pParentWindow,
- FrameView* pFrameView);
+ FrameView* pFrameView,
+ const bool bIsCenterPane);
virtual ~SlideSorterViewShell (void);
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index d51693067f0e..63179c4dbcf9 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -485,20 +485,30 @@ bool ScrollBarManager::TestScrollBarVisibilities (
-void ScrollBarManager::SetTop (const sal_Int32 nNewTop)
+void ScrollBarManager::SetTopLeft (const Point aNewTopLeft)
{
- if (mpVerticalScrollBar != NULL
- && mpVerticalScrollBar->GetThumbPos() != nNewTop)
- {
- // Flush pending repaints before scrolling to avoid temporary artifacts.
- mrSlideSorter.GetContentWindow()->Update();
+ if ((mpVerticalScrollBar == NULL
+ || mpVerticalScrollBar->GetThumbPos() == aNewTopLeft.Y())
+ && (mpHorizontalScrollBar == NULL
+ || mpHorizontalScrollBar->GetThumbPos() == aNewTopLeft.X()))
+ return;
- OSL_TRACE("setting top of vertical scroll bar to %d", nNewTop);
- mpVerticalScrollBar->SetThumbPos(nNewTop);
- mnVerticalPosition = double(nNewTop) / double(mpVerticalScrollBar->GetRange().Len());
- mrSlideSorter.GetContentWindow()->SetVisibleXY (mnHorizontalPosition, mnVerticalPosition);
- mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+ // Flush pending repaints before scrolling to avoid temporary artifacts.
+ mrSlideSorter.GetContentWindow()->Update();
+
+ if (mpVerticalScrollBar != NULL)
+ {
+ mpVerticalScrollBar->SetThumbPos(aNewTopLeft.Y());
+ mnVerticalPosition = aNewTopLeft.Y() / double(mpVerticalScrollBar->GetRange().Len());
}
+ if (mpHorizontalScrollBar != NULL)
+ {
+ mpHorizontalScrollBar->SetThumbPos(aNewTopLeft.X());
+ mnHorizontalPosition = aNewTopLeft.X() / double(mpHorizontalScrollBar->GetRange().Len());
+ }
+
+ mrSlideSorter.GetContentWindow()->SetVisibleXY (mnHorizontalPosition, mnVerticalPosition);
+ mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
}
@@ -515,24 +525,6 @@ sal_Int32 ScrollBarManager::GetTop (void) const
-void ScrollBarManager::SetLeft (const sal_Int32 nNewLeft)
-{
- if (mpHorizontalScrollBar != NULL
- && mpHorizontalScrollBar->GetThumbPos() != nNewLeft)
- {
- // Flush pending repaints before scrolling to avoid temporary artifacts.
- mrSlideSorter.GetContentWindow()->Update();
-
- mpHorizontalScrollBar->SetThumbPos(nNewLeft);
- mnHorizontalPosition = double(nNewLeft) / double(mpHorizontalScrollBar->GetRange().Len());
- mrSlideSorter.GetContentWindow()->SetVisibleXY (
- mnHorizontalPosition, mnVerticalPosition);
- }
-}
-
-
-
-
sal_Int32 ScrollBarManager::GetLeft (void) const
{
if (mpHorizontalScrollBar != NULL)
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
index c7b8da6016a3..36262f22298a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
@@ -72,28 +72,18 @@ namespace sd { namespace slidesorter { namespace controller {
namespace {
- class VerticalVisibleAreaScroller
+ class VisibleAreaScroller
{
public:
- VerticalVisibleAreaScroller (SlideSorter& rSlideSorter,
- const double nStart, const double nEnd);
+ VisibleAreaScroller (
+ SlideSorter& rSlideSorter,
+ const Point aStart,
+ const Point aEnd);
void operator() (const double nValue);
private:
SlideSorter& mrSlideSorter;
- double mnStart;
- const double mnEnd;
- const ::boost::function<double(double)> maAccelerationFunction;
- };
- class HorizontalVisibleAreaScroller
- {
- public:
- HorizontalVisibleAreaScroller (SlideSorter& rSlideSorter,
- const double nStart, const double nEnd);
- void operator() (const double nValue);
- private:
- SlideSorter& mrSlideSorter;
- double mnStart;
- const double mnEnd;
+ Point maStart;
+ const Point maEnd;
const ::boost::function<double(double)> maAccelerationFunction;
};
}
@@ -436,10 +426,12 @@ Size SelectionManager::MakeRectangleVisible (const Rectangle& rBox)
Point(0,0),
pWindow->GetOutputSizePixel())));
- if (mrSlideSorter.GetView().GetOrientation() == SlideSorterView::VERTICAL)
+ sal_Int32 nNewTop (aVisibleArea.Top());
+ sal_Int32 nNewLeft (aVisibleArea.Left());
+
+ if (mrSlideSorter.GetView().GetOrientation() != SlideSorterView::HORIZONTAL)
{
// Scroll the visible area to make aSelectionBox visible.
- sal_Int32 nNewTop (aVisibleArea.Top());
if (mrSlideSorter.GetProperties()->IsCenterSelection())
{
nNewTop = rBox.Top() - (aVisibleArea.GetHeight() - rBox.GetHeight()) / 2;
@@ -460,28 +452,11 @@ Size SelectionManager::MakeRectangleVisible (const Rectangle& rBox)
if (nNewTop < aModelArea.Top())
nNewTop = aModelArea.Top();
- // Scroll.
- if (nNewTop != aVisibleArea.Top())
- {
- if (mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
- {
- if (mnAnimationId != Animator::NotAnAnimationId)
- mrController.GetAnimator()->RemoveAnimation(mnAnimationId);
- mnAnimationId = mrController.GetAnimator()->AddAnimation(
- VerticalVisibleAreaScroller(mrSlideSorter, aVisibleArea.Top(), nNewTop),
- 0,
- 300);
- }
- else
- VerticalVisibleAreaScroller(mrSlideSorter, aVisibleArea.Top(), nNewTop)(1.0);
- }
-
- return Size(0,aVisibleArea.Top() - nNewTop);
}
- else
+
+ if (mrSlideSorter.GetView().GetOrientation() != SlideSorterView::VERTICAL)
{
// Scroll the visible area to make aSelectionBox visible.
- sal_Int32 nNewLeft (aVisibleArea.Left());
if (mrSlideSorter.GetProperties()->IsCenterSelection())
{
nNewLeft = rBox.Left() - (aVisibleArea.GetWidth() - rBox.GetWidth()) / 2;
@@ -501,21 +476,26 @@ Size SelectionManager::MakeRectangleVisible (const Rectangle& rBox)
nNewLeft = aModelArea.GetWidth() - aVisibleArea.GetWidth();
if (nNewLeft < aModelArea.Left())
nNewLeft = aModelArea.Left();
+ }
- // Scroll.
- if (nNewLeft != aVisibleArea.Left())
+ // Scroll.
+ if (nNewTop != aVisibleArea.Top() || nNewLeft != aVisibleArea.Left())
+ {
+ VisibleAreaScroller aAnimation(
+ mrSlideSorter,
+ aVisibleArea.TopLeft(),
+ Point(nNewLeft, nNewTop));
+ if (mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
{
- if (mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
- mrController.GetAnimator()->AddAnimation(
- HorizontalVisibleAreaScroller(mrSlideSorter, aVisibleArea.Left(), nNewLeft),
- 0,
- 300);
- else
- HorizontalVisibleAreaScroller(mrSlideSorter, aVisibleArea.Left(), nNewLeft)(1.0);
+ if (mnAnimationId != Animator::NotAnAnimationId)
+ mrController.GetAnimator()->RemoveAnimation(mnAnimationId);
+ mnAnimationId = mrController.GetAnimator()->AddAnimation(aAnimation, 0, 300);
}
-
- return Size(aVisibleArea.Left() - nNewLeft, 0);
+ else
+ aAnimation(1.0);
}
+
+ return Size(aVisibleArea.Left() - nNewLeft, aVisibleArea.Top() - nNewTop);
}
@@ -659,13 +639,13 @@ namespace {
const static sal_Int32 gnMaxScrollDistance = 300;
-VerticalVisibleAreaScroller::VerticalVisibleAreaScroller (
+VisibleAreaScroller::VisibleAreaScroller (
SlideSorter& rSlideSorter,
- const double nStart,
- const double nEnd)
+ const Point aStart,
+ const Point aEnd)
: mrSlideSorter(rSlideSorter),
- mnStart(nStart),
- mnEnd(nEnd),
+ maStart(aStart),
+ maEnd(aEnd),
maAccelerationFunction(
controller::AnimationParametricFunction(
controller::AnimationBezierFunction (0.1,0.6)))
@@ -673,58 +653,27 @@ VerticalVisibleAreaScroller::VerticalVisibleAreaScroller (
// When the distance to scroll is larger than a threshold then first
// jump to within this distance of the final value and start the
// animation from there.
- if (abs(nStart-nEnd) > gnMaxScrollDistance)
- if (nStart < nEnd)
- mnStart = nEnd-gnMaxScrollDistance;
+ if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance)
+ if (aStart.X() < aEnd.X())
+ maStart.X() = aEnd.X()-gnMaxScrollDistance;
else
- mnStart = nEnd+gnMaxScrollDistance;
-}
-
-
-
-void VerticalVisibleAreaScroller::operator() (const double nTime)
-{
- const double nLocalTime (maAccelerationFunction(nTime));
- const sal_Int32 nNewTop (mnStart * (1.0 - nLocalTime) + mnEnd * nLocalTime);
- mrSlideSorter.GetController().GetScrollBarManager().SetTop(nNewTop);
- /*
- mrSlideSorter.GetViewShell()->Scroll(
- 0,
- nNewTop - mrSlideSorter.GetController().GetScrollBarManager().GetTop());
- mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
- */
-}
-
-
-
-
-//===== HorizontalVisibleAreaScroller =========================================
-
-HorizontalVisibleAreaScroller::HorizontalVisibleAreaScroller (
- SlideSorter& rSlideSorter,
- const double nStart,
- const double nEnd)
- : mrSlideSorter(rSlideSorter),
- mnStart(nStart),
- mnEnd(nEnd),
- maAccelerationFunction(
- controller::AnimationParametricFunction(
- controller::AnimationBezierFunction (0.1,0.6)))
-
-{
+ maStart.X() = aEnd.X()+gnMaxScrollDistance;
+ if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance)
+ if (aStart.Y() < aEnd.Y())
+ maStart.Y() = aEnd.Y()-gnMaxScrollDistance;
+ else
+ maStart.Y() = aEnd.Y()+gnMaxScrollDistance;
}
-
-void HorizontalVisibleAreaScroller::operator() (const double nTime)
+void VisibleAreaScroller::operator() (const double nTime)
{
const double nLocalTime (maAccelerationFunction(nTime));
- const sal_Int32 nNewLeft (mnStart * (1.0 - nLocalTime) + mnEnd * nLocalTime);
- mrSlideSorter.GetViewShell()->Scroll(
- nNewLeft - mrSlideSorter.GetController().GetScrollBarManager().GetLeft(),
- 0);
- mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
+ mrSlideSorter.GetController().GetScrollBarManager().SetTopLeft(
+ Point(
+ sal_Int32(0.5 + maStart.X() * (1.0 - nLocalTime) + maEnd.X() * nLocalTime),
+ sal_Int32 (0.5 + maStart.Y() * (1.0 - nLocalTime) + maEnd.Y() * nLocalTime)));
}
} // end of anonymous namespace
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
index 7c1f76bf1407..4c3a71e578d7 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -131,18 +131,13 @@ public:
*/
Rectangle PlaceScrollBars (const Rectangle& rAvailableArea);
- /** Update the vertical scroll bar so that the visible area has the
- given top value.
+ /** Update the vertical and horizontal scroll bars so that the visible
+ area has the given top and left values.
*/
- void SetTop (const sal_Int32 nTop);
+ void SetTopLeft (const Point aNewTopLeft);
sal_Int32 GetTop (void) const;
- /** Update the horizontal scroll bar so that the visible area has the
- given left value.
- */
- void SetLeft (const sal_Int32 nLeft);
-
sal_Int32 GetLeft (void) const;
/** Return the width of the vertical scroll bar, which--when
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 14ee98ffd693..3f327edc471d 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -88,7 +88,7 @@ public:
virtual ~SlideSorterView (void);
void Dispose (void);
- enum Orientation { HORIZONTAL, VERTICAL };
+ enum Orientation { HORIZONTAL, VERTICAL, GRID };
void SetOrientation (const Orientation eOrientation);
Orientation GetOrientation (void) const;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 4199afd7dc72..4ce1420157fd 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -101,7 +101,8 @@ TYPEINIT1(SlideSorterViewShell, ViewShell);
SfxViewFrame* pFrame,
ViewShellBase& rViewShellBase,
::Window* pParentWindow,
- FrameView* pFrameViewArgument)
+ FrameView* pFrameViewArgument,
+ const bool bIsCenterPane)
{
::boost::shared_ptr<SlideSorterViewShell> pViewShell;
try
@@ -111,6 +112,13 @@ TYPEINIT1(SlideSorterViewShell, ViewShell);
pViewShell->Initialize();
if (pViewShell->mpSlideSorter.get() == NULL)
pViewShell.reset();
+
+ // The layout of slides depends on whether the slide sorter is
+ // displayed in the center or the side pane.
+ if (bIsCenterPane)
+ pViewShell->mpSlideSorter->GetView().SetOrientation(view::SlideSorterView::GRID);
+ else
+ pViewShell->mpSlideSorter->GetView().SetOrientation(view::SlideSorterView::VERTICAL);
}
catch(Exception&)
{
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index c7b210f93056..eb4e36f803bc 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -76,7 +76,6 @@ public:
void UpdateOffsets(
const InsertPosition& rInsertPosition,
- const Size& rRequiredSpace,
const view::Layouter& GetLayouter);
void ResetOffsets (void);
@@ -241,11 +240,7 @@ void InsertAnimator::Implementation::SetInsertPosition (
if (pCurrentRun)
{
- const sal_Int32 nColumnCount (mrView.GetLayouter().GetColumnCount());
- pCurrentRun->UpdateOffsets(
- rInsertPosition,
- nColumnCount > 1 ? Size(rIconSize.Width(),0) : Size(0, rIconSize.Height()),
- mrView.GetLayouter());
+ pCurrentRun->UpdateOffsets(rInsertPosition, mrView.GetLayouter());
maRuns.insert(pCurrentRun);
}
}
@@ -404,7 +399,6 @@ Rectangle PageObjectRun::GetInnerBoundingBox (
void PageObjectRun::UpdateOffsets(
const InsertPosition& rInsertPosition,
- const Size& rRequiredSpace,
const view::Layouter& rLayouter)
{
const bool bIsVertical (rLayouter.GetColumnCount()==1);