Resolve several thousand lines of conflicts. Conflicts: accessibility/source/extended/accessiblelistbox.cxx accessibility/source/standard/vclxaccessiblecombobox.cxx accessibility/source/standard/vclxaccessibledropdowncombobox.cxx accessibility/source/standard/vclxaccessibledropdownlistbox.cxx accessibility/source/standard/vclxaccessiblelistbox.cxx accessibility/source/standard/vclxaccessibletextfield.cxx basctl/source/basicide/basidesh.cxx cui/source/inc/chardlg.hxx cui/source/tabpages/tpbitmap.cxx dbaccess/source/ui/dlg/UserAdmin.cxx dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx extensions/source/propctrlr/propertyeditor.hxx extensions/source/scanner/sanedlg.cxx filter/source/pdf/impdialog.cxx include/sfx2/mgetempl.hxx include/sfx2/sidebar/SidebarToolBox.hxx include/sfx2/viewsh.hxx include/svtools/brwbox.hxx include/svtools/filectrl.hxx include/svtools/scrwin.hxx include/svx/dlgctrl.hxx include/svx/sidebar/Popup.hxx include/svx/sidebar/PopupContainer.hxx include/svx/sidebar/PopupControl.hxx include/svx/sidebar/SidebarDialControl.hxx include/svx/sidebar/ValueSetWithTextControl.hxx sc/source/ui/condformat/condformatdlgentry.cxx sc/source/ui/navipi/navipi.cxx sc/source/ui/sidebar/CellBorderStyleControl.hxx sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/inc/DrawViewShell.hxx sd/source/ui/inc/Ruler.hxx sd/source/ui/inc/SlideSorter.hxx sd/source/ui/inc/ViewTabBar.hxx sd/source/ui/inc/Window.hxx sd/source/ui/inc/morphdlg.hxx sd/source/ui/inc/sdpreslt.hxx sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx sd/source/ui/sidebar/LayoutMenu.hxx sd/source/ui/sidebar/MasterPagesSelector.hxx sd/source/ui/sidebar/NavigatorWrapper.hxx sd/source/ui/sidebar/PanelBase.hxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentMasterPagesSelector.hxx sd/source/ui/slideshow/showwindow.hxx sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drviewsa.cxx sfx2/source/appl/fileobj.hxx sfx2/source/appl/opengrf.cxx sfx2/source/control/thumbnailviewacc.hxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/doc/docinsert.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/inc/alienwarn.hxx sfx2/source/sidebar/Deck.cxx sfx2/source/sidebar/Deck.hxx sfx2/source/sidebar/DeckTitleBar.cxx sfx2/source/sidebar/DeckTitleBar.hxx sfx2/source/sidebar/MenuButton.cxx sfx2/source/sidebar/MenuButton.hxx sfx2/source/sidebar/Panel.cxx sfx2/source/sidebar/Panel.hxx sfx2/source/sidebar/PanelTitleBar.hxx sfx2/source/sidebar/SidebarDockingWindow.hxx sfx2/source/sidebar/SidebarToolBox.cxx sfx2/source/sidebar/TabBar.hxx sfx2/source/sidebar/TabItem.cxx sfx2/source/sidebar/TabItem.hxx sfx2/source/sidebar/TitleBar.hxx sfx2/source/toolbox/imgmgr.cxx starmath/inc/edit.hxx starmath/inc/smmod.hxx starmath/qa/cppunit/test_starmath.cxx starmath/source/edit.cxx starmath/source/smmod.cxx svtools/source/brwbox/brwbox1.cxx svtools/source/brwbox/datwin.hxx svtools/source/contnr/fileview.cxx svtools/source/contnr/simptabl.cxx svtools/source/control/filectrl.cxx svtools/source/control/valueimp.hxx svx/inc/GalleryControl.hxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/swframeexample.cxx svx/source/fmcomp/fmgridif.cxx svx/source/gallery2/GalleryControl.cxx svx/source/sidebar/EmptyPanel.hxx svx/source/sidebar/area/AreaPropertyPanel.hxx svx/source/sidebar/area/AreaTransparencyGradientControl.hxx svx/source/sidebar/graphic/GraphicPropertyPanel.hxx svx/source/sidebar/insert/InsertPropertyPanel.cxx svx/source/sidebar/insert/InsertPropertyPanel.hxx svx/source/sidebar/line/LinePropertyPanel.hxx svx/source/sidebar/line/LineWidthControl.cxx svx/source/sidebar/line/LineWidthControl.hxx svx/source/sidebar/line/LineWidthValueSet.hxx svx/source/sidebar/paragraph/ParaPropertyPanel.hxx svx/source/sidebar/possize/SidebarDialControl.cxx svx/source/sidebar/text/TextCharacterSpacingPopup.hxx svx/source/sidebar/text/TextPropertyPanel.hxx svx/source/sidebar/tools/PopupContainer.cxx svx/source/sidebar/tools/PopupControl.cxx svx/source/sidebar/tools/ValueSetWithTextControl.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdibrow.cxx svx/source/tbxctrls/colrctrl.cxx svx/source/tbxctrls/tbcontrl.cxx sw/source/ui/dbui/mmaddressblockpage.cxx sw/source/ui/dialog/uiregionsw.cxx sw/source/ui/index/cnttab.cxx sw/source/uibase/inc/drpcps.hxx sw/source/uibase/sidebar/PageColumnControl.hxx sw/source/uibase/sidebar/PageMarginControl.hxx sw/source/uibase/sidebar/PageOrientationControl.hxx sw/source/uibase/sidebar/PagePropertyPanel.hxx sw/source/uibase/sidebar/PageSizeControl.hxx sw/source/uibase/uiview/view2.cxx sw/source/uibase/utlui/navipi.cxx vcl/inc/svdata.hxx vcl/source/control/combobox.cxx vcl/source/control/lstbox.cxx vcl/source/window/dockwin.cxx vcl/source/window/winproc.cxx Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
266 lines
8.6 KiB
C++
266 lines
8.6 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#include <sal/config.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include "controller/SlsVisibleAreaManager.hxx"
|
|
#include "controller/SlideSorterController.hxx"
|
|
#include "controller/SlsProperties.hxx"
|
|
#include "controller/SlsAnimationFunction.hxx"
|
|
#include "controller/SlsScrollBarManager.hxx"
|
|
#include "controller/SlsCurrentSlideManager.hxx"
|
|
|
|
namespace sd { namespace slidesorter { namespace controller {
|
|
|
|
namespace {
|
|
class VisibleAreaScroller
|
|
{
|
|
public:
|
|
VisibleAreaScroller (
|
|
SlideSorter& rSlideSorter,
|
|
const Point& rStart,
|
|
const Point& rEnd);
|
|
void operator() (const double nValue);
|
|
private:
|
|
SlideSorter& mrSlideSorter;
|
|
Point maStart;
|
|
const Point maEnd;
|
|
const ::boost::function<double(double)> maAccelerationFunction;
|
|
};
|
|
|
|
} // end of anonymous namespace
|
|
|
|
VisibleAreaManager::VisibleAreaManager (SlideSorter& rSlideSorter)
|
|
: mrSlideSorter(rSlideSorter),
|
|
maVisibleRequests(),
|
|
mnScrollAnimationId(Animator::NotAnAnimationId),
|
|
maRequestedVisibleTopLeft(),
|
|
meRequestedAnimationMode(Animator::AM_Immediate),
|
|
mbIsCurrentSlideTrackingActive(true),
|
|
mnDisableCount(0)
|
|
{
|
|
}
|
|
|
|
VisibleAreaManager::~VisibleAreaManager()
|
|
{
|
|
}
|
|
|
|
void VisibleAreaManager::ActivateCurrentSlideTracking()
|
|
{
|
|
mbIsCurrentSlideTrackingActive = true;
|
|
}
|
|
|
|
void VisibleAreaManager::DeactivateCurrentSlideTracking()
|
|
{
|
|
mbIsCurrentSlideTrackingActive = false;
|
|
}
|
|
|
|
void VisibleAreaManager::RequestVisible (
|
|
const model::SharedPageDescriptor& rpDescriptor,
|
|
const bool bForce)
|
|
{
|
|
if (rpDescriptor)
|
|
{
|
|
if (mnDisableCount == 0)
|
|
{
|
|
maVisibleRequests.push_back(
|
|
mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
|
|
rpDescriptor->GetPageIndex(),
|
|
true));
|
|
}
|
|
if (bForce && ! mbIsCurrentSlideTrackingActive)
|
|
ActivateCurrentSlideTracking();
|
|
MakeVisible();
|
|
}
|
|
}
|
|
|
|
void VisibleAreaManager::RequestCurrentSlideVisible()
|
|
{
|
|
if (mbIsCurrentSlideTrackingActive && mnDisableCount==0)
|
|
RequestVisible(
|
|
mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
|
|
}
|
|
|
|
void VisibleAreaManager::MakeVisible()
|
|
{
|
|
if (maVisibleRequests.empty())
|
|
return;
|
|
|
|
sd::Window *pWindow (mrSlideSorter.GetContentWindow());
|
|
if ( ! pWindow)
|
|
return;
|
|
const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
|
|
|
|
const ::boost::optional<Point> aNewVisibleTopLeft (GetRequestedTopLeft());
|
|
maVisibleRequests.clear();
|
|
if ( ! aNewVisibleTopLeft)
|
|
return;
|
|
|
|
// We now know what the visible area shall be. Scroll accordingly
|
|
// unless that is not already the visible area or a running scroll
|
|
// animation has it as its target area.
|
|
if (mnScrollAnimationId!=Animator::NotAnAnimationId
|
|
&& maRequestedVisibleTopLeft==aNewVisibleTopLeft)
|
|
return;
|
|
|
|
// Stop a running animation.
|
|
if (mnScrollAnimationId != Animator::NotAnAnimationId)
|
|
mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(mnScrollAnimationId);
|
|
|
|
maRequestedVisibleTopLeft = aNewVisibleTopLeft.get();
|
|
VisibleAreaScroller aAnimation(
|
|
mrSlideSorter,
|
|
aCurrentTopLeft,
|
|
maRequestedVisibleTopLeft);
|
|
if (meRequestedAnimationMode==Animator::AM_Animated
|
|
&& mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
|
|
{
|
|
mnScrollAnimationId = mrSlideSorter.GetController().GetAnimator()->AddAnimation(
|
|
aAnimation,
|
|
0,
|
|
300);
|
|
}
|
|
else
|
|
{
|
|
// Execute the animation at its final value.
|
|
aAnimation(1.0);
|
|
}
|
|
meRequestedAnimationMode = Animator::AM_Immediate;
|
|
}
|
|
|
|
::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft() const
|
|
{
|
|
sd::Window *pWindow (mrSlideSorter.GetContentWindow());
|
|
if ( ! pWindow)
|
|
return ::boost::optional<Point>();
|
|
|
|
// Get the currently visible area and the model area.
|
|
const Rectangle aVisibleArea (pWindow->PixelToLogic(
|
|
Rectangle(
|
|
Point(0,0),
|
|
pWindow->GetOutputSizePixel())));
|
|
const Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
|
|
|
|
sal_Int32 nVisibleTop (aVisibleArea.Top());
|
|
const sal_Int32 nVisibleWidth (aVisibleArea.GetWidth());
|
|
sal_Int32 nVisibleLeft (aVisibleArea.Left());
|
|
const sal_Int32 nVisibleHeight (aVisibleArea.GetHeight());
|
|
|
|
// Find the longest run of boxes whose union fits into the visible area.
|
|
for (::std::vector<Rectangle>::const_iterator
|
|
iBox(maVisibleRequests.begin()),
|
|
iEnd(maVisibleRequests.end());
|
|
iBox!=iEnd;
|
|
++iBox)
|
|
{
|
|
if (nVisibleTop+nVisibleHeight <= iBox->Bottom())
|
|
nVisibleTop = iBox->Bottom()-nVisibleHeight;
|
|
if (nVisibleTop > iBox->Top())
|
|
nVisibleTop = iBox->Top();
|
|
|
|
if (nVisibleLeft+nVisibleWidth <= iBox->Right())
|
|
nVisibleLeft = iBox->Right()-nVisibleWidth;
|
|
if (nVisibleLeft > iBox->Left())
|
|
nVisibleLeft = iBox->Left();
|
|
|
|
// Make sure the visible area does not move outside the model area.
|
|
if (nVisibleTop + nVisibleHeight > aModelArea.Bottom())
|
|
nVisibleTop = aModelArea.Bottom() - nVisibleHeight;
|
|
if (nVisibleTop < aModelArea.Top())
|
|
nVisibleTop = aModelArea.Top();
|
|
|
|
if (nVisibleLeft + nVisibleWidth > aModelArea.Right())
|
|
nVisibleLeft = aModelArea.Right() - nVisibleWidth;
|
|
if (nVisibleLeft < aModelArea.Left())
|
|
nVisibleLeft = aModelArea.Left();
|
|
}
|
|
|
|
const Point aRequestedTopLeft (nVisibleLeft, nVisibleTop);
|
|
if (aRequestedTopLeft == aVisibleArea.TopLeft())
|
|
return ::boost::optional<Point>();
|
|
else
|
|
return ::boost::optional<Point>(aRequestedTopLeft);
|
|
}
|
|
|
|
//===== VisibleAreaManager::TemporaryDisabler =================================
|
|
|
|
VisibleAreaManager::TemporaryDisabler::TemporaryDisabler (SlideSorter& rSlideSorter)
|
|
: mrVisibleAreaManager(rSlideSorter.GetController().GetVisibleAreaManager())
|
|
{
|
|
++mrVisibleAreaManager.mnDisableCount;
|
|
}
|
|
|
|
VisibleAreaManager::TemporaryDisabler::~TemporaryDisabler()
|
|
{
|
|
--mrVisibleAreaManager.mnDisableCount;
|
|
}
|
|
|
|
//===== VerticalVisibleAreaScroller ===========================================
|
|
|
|
namespace {
|
|
|
|
const static sal_Int32 gnMaxScrollDistance = 300;
|
|
|
|
VisibleAreaScroller::VisibleAreaScroller (
|
|
SlideSorter& rSlideSorter,
|
|
const Point& rStart,
|
|
const Point& rEnd)
|
|
: mrSlideSorter(rSlideSorter),
|
|
maStart(rStart),
|
|
maEnd(rEnd),
|
|
maAccelerationFunction(
|
|
controller::AnimationParametricFunction(
|
|
controller::AnimationBezierFunction (0.1,0.6)))
|
|
{
|
|
// 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 (std::abs(rStart.X()-rEnd.X()) > gnMaxScrollDistance)
|
|
{
|
|
if (rStart.X() < rEnd.X())
|
|
maStart.X() = rEnd.X()-gnMaxScrollDistance;
|
|
else
|
|
maStart.X() = rEnd.X()+gnMaxScrollDistance;
|
|
}
|
|
if (std::abs(rStart.Y()-rEnd.Y()) > gnMaxScrollDistance)
|
|
{
|
|
if (rStart.Y() < rEnd.Y())
|
|
maStart.Y() = rEnd.Y()-gnMaxScrollDistance;
|
|
else
|
|
maStart.Y() = rEnd.Y()+gnMaxScrollDistance;
|
|
}
|
|
}
|
|
|
|
void VisibleAreaScroller::operator() (const double nTime)
|
|
{
|
|
const double nLocalTime (maAccelerationFunction(nTime));
|
|
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
|
|
|
|
} } } // end of namespace ::sd::slidesorter::controller
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|