renaissance1: #i107215# Some minor fixes and improvements.

This commit is contained in:
Andre Fischer
2010-05-28 13:26:19 +02:00
parent 125c18fc86
commit 506928805f
15 changed files with 175 additions and 176 deletions

View File

@@ -393,6 +393,12 @@ void PaneDockingWindow::MouseButtonDown (const MouseEvent& rEvent)
{
if (rEvent.GetButtons() == MOUSE_LEFT && mpContentWindow)
{
// For some strange reason we have to set the WB_DIALOGCONTROL at
// the content window in order to have it pass focus to its content
// window. Without setting this flag here that works only on views
// that have not been taken from the cash and relocated to this pane
// docking window.
mpContentWindow->SetStyle(mpContentWindow->GetStyle() | WB_DIALOGCONTROL);
mpContentWindow->GrabFocus();
}
SfxDockingWindow::MouseButtonDown(rEvent);

View File

@@ -113,9 +113,6 @@ public:
virtual void SetZoom (long int nZoom);
virtual void SetZoomRect (const Rectangle& rZoomRect);
/// forward VCLs PrePaint window event to DrawingLayer
virtual void PrePaint();
/** This is a callback method used by the active window to delegate its
Paint() call to. This view shell itself delegates it to the view.
*/

View File

@@ -54,6 +54,7 @@
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsPageObjectPainter.hxx"
#include "view/SlsTheme.hxx"
#include "view/SlsToolTip.hxx"
#include "cache/SlsPageCache.hxx"
#include "cache/SlsPageCacheManager.hxx"
@@ -143,8 +144,6 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
// Connect the view with the window that has been created by our base
// class.
// mrView.AddWindowToPaintView(pWindow.get());
// mrView.SetActualWin(pWindow.get());
pWindow->SetBackground(Wallpaper());
pWindow->SetCenterAllowed(false);
pWindow->SetMapMode(MapMode(MAP_PIXEL));
@@ -328,15 +327,6 @@ ScrollBarManager& SlideSorterController::GetScrollBarManager (void)
void SlideSorterController::PrePaint()
{
// forward VCLs PrePaint window event to DrawingLayer
//AF mrView.PrePaint();
}
void SlideSorterController::Paint (
const Rectangle& rBBox,
::Window* pWindow)
@@ -451,41 +441,43 @@ bool SlideSorterController::Command (
}
pWindow->ReleaseMouse();
Point aMenuLocation (0,0);
if (rEvent.IsMouseEvent())
{
mbIsContextMenuOpen = true;
if (pViewShell != NULL)
{
SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
if (pDispatcher != NULL)
pDispatcher->ExecutePopup(SdResId(nPopupId));
}
// We have to explicitly specify the location of the menu
// when the slide sorter is placed in an undocked child
// menu. But when it is docked it does not hurt, so we
// specify the location always.
aMenuLocation = rEvent.GetMousePosPixel();
}
else
{
// The event is not a mouse event. Use the center of the
// focused page as top left position of the context menu.
if (pPage != NULL)
model::SharedPageDescriptor pDescriptor (
GetFocusManager().GetFocusedPageDescriptor());
if (pDescriptor.get() != NULL)
{
model::SharedPageDescriptor pDescriptor (
GetFocusManager().GetFocusedPageDescriptor());
if (pDescriptor.get() != NULL)
{
Rectangle aBBox (
mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox (
pDescriptor,
PageObjectLayouter::PageObject,
PageObjectLayouter::ModelCoordinateSystem));
Point aCenter (aBBox.Center());
mbIsContextMenuOpen = true;
if (pViewShell != NULL)
pViewShell->GetViewFrame()->GetDispatcher()->ExecutePopup(
SdResId(nPopupId),
pWindow,
&aCenter);
}
Rectangle aBBox (
mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox (
pDescriptor,
PageObjectLayouter::PageObject,
PageObjectLayouter::ModelCoordinateSystem));
aMenuLocation = aBBox.Center();
}
}
mbIsContextMenuOpen = true;
if (pViewShell != NULL)
{
SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
if (pDispatcher != NULL)
pDispatcher->ExecutePopup(
SdResId(nPopupId),
pWindow,
&aMenuLocation);
}
mbIsContextMenuOpen = false;
if (pPage == NULL)
{
@@ -643,13 +635,21 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent)
break;
case VCLEVENT_WINDOW_GETFOCUS:
if (pActiveWindow && pWindow == pActiveWindow.get())
GetFocusManager().ShowFocus(false);
if (pActiveWindow)
if (pWindow == pActiveWindow.get())
GetFocusManager().ShowFocus(false);
break;
case VCLEVENT_WINDOW_LOSEFOCUS:
if (pActiveWindow && pWindow == pActiveWindow.get())
{
GetFocusManager().HideFocus();
mrView.GetToolTip().Hide();
// Select the current slide so that it is properly
// visualized when the focus is moved to the edit view.
GetPageSelector().SelectPage(GetCurrentSlideManager()->GetCurrentSlide());
}
break;
case VCLEVENT_APPLICATION_DATACHANGED:

View File

@@ -201,28 +201,34 @@ void PageSelector::SelectPage (const SharedPageDescriptor& rpDescriptor)
void PageSelector::DeselectPage (int nPageIndex)
void PageSelector::DeselectPage (
int nPageIndex,
const bool bUpdateCurrentPage)
{
model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
if (pDescriptor.get() != NULL)
DeselectPage(pDescriptor);
DeselectPage(pDescriptor, bUpdateCurrentPage);
}
void PageSelector::DeselectPage (const SdPage* pPage)
void PageSelector::DeselectPage (
const SdPage* pPage,
const bool bUpdateCurrentPage)
{
const sal_Int32 nPageIndex (mrModel.GetIndex(pPage));
SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
if (pDescriptor.get()!=NULL && pDescriptor->GetPage()==pPage)
DeselectPage(pDescriptor);
DeselectPage(pDescriptor, bUpdateCurrentPage);
}
void PageSelector::DeselectPage (const SharedPageDescriptor& rpDescriptor)
void PageSelector::DeselectPage (
const SharedPageDescriptor& rpDescriptor,
const bool bUpdateCurrentPage)
{
if (rpDescriptor.get()!=NULL
&& mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, false))
@@ -236,7 +242,8 @@ void PageSelector::DeselectPage (const SharedPageDescriptor& rpDescriptor)
mbSelectionChangeBroadcastPending = true;
else
mrController.GetSelectionManager()->SelectionHasChanged();
UpdateCurrentPage();
if (bUpdateCurrentPage)
UpdateCurrentPage();
}
}

View File

@@ -491,10 +491,8 @@ BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
model::SharedPageDescriptor pDescriptor (rFocusManager.GetFocusedPageDescriptor());
if (pDescriptor && rCode.IsMod1())
{
// Doing a multi selection by default. Can we ask the event
// for the state of the shift key?
if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
mrController.GetPageSelector().DeselectPage(pDescriptor);
mrController.GetPageSelector().DeselectPage(pDescriptor, false);
else
mrController.GetPageSelector().SelectPage(pDescriptor);
}
@@ -1341,8 +1339,13 @@ bool NormalModeHandler::ProcessButtonDownEvent (
case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
if (mrSlideSorter.GetView().GetButtonBar().IsMouseOverButton())
{
mrSelectionFunction.SwitchToButtonMode();
ReprocessEvent(rDescriptor);
// Switch to button mode only when the buttons are visible
// (or being faded in.)
if (mrSlideSorter.GetView().GetButtonBar().IsVisible(rDescriptor.mpHitDescriptor))
{
mrSelectionFunction.SwitchToButtonMode();
ReprocessEvent(rDescriptor);
}
}
break;

View File

@@ -304,69 +304,6 @@ void SelectionManager::RemoveSelectionChangeListener(const Link&rListener)
}
/*
bool SelectionManager::DoesSelectionExceedVisibleArea (const Rectangle& rSelectionBox) const
{
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow == NULL)
return true;
Rectangle aVisibleArea (pWindow->PixelToLogic(
Rectangle(
Point(0,0),
pWindow->GetOutputSizePixel())));
if (mrSlideSorter.GetView().GetOrientation() != Layouter::HORIZONTAL)
return rSelectionBox.GetHeight() > aVisibleArea.GetHeight();
else
return rSelectionBox.GetWidth() > aVisibleArea.GetWidth();
}
Rectangle SelectionManager::ResolveLargeSelection (
const SharedPageDescriptor& rpFirst,
const SharedPageDescriptor& rpLast,
const SelectionHint eSelectionHint)
{
OSL_ASSERT(rpFirst.get()!=NULL);
OSL_ASSERT(rpLast.get()!=NULL);
// The mose recently selected page is assumed to lie in the range
// between first and last selected page. Therefore the bounding box is
// not modified.
model::SharedPageDescriptor pRecent (
mrController.GetPageSelector().GetMostRecentlySelectedPage());
// Get the bounding box of the page object on which to concentrate.
model::SharedPageDescriptor pRepresentative;
switch (eSelectionHint)
{
case SH_FIRST:
pRepresentative = rpFirst;
break;
case SH_LAST:
pRepresentative = rpLast;
break;
case SH_RECENT:
default:
if (pRecent.get() == NULL)
pRepresentative = rpFirst;
else
pRepresentative = pRecent;
break;
}
OSL_ASSERT(pRepresentative.get() != NULL);
return mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
pRepresentative->GetPageIndex(),
true);
}
*/
sal_Int32 SelectionManager::GetInsertionPosition (void) const

View File

@@ -134,9 +134,6 @@ public:
::boost::shared_ptr<SelectionManager> GetSelectionManager (void) const;
::boost::shared_ptr<InsertionIndicatorHandler> GetInsertionIndicatorHandler (void) const;
// forward VCLs PrePaint window event to DrawingLayer
void PrePaint();
/** This method forwards the call to the SlideSorterView and executes
pending operations like moving selected pages into the visible area.
*/

View File

@@ -102,10 +102,19 @@ public:
bool IsPageSelected (int nPageIndex);
/** Deselect the descriptor that is associated with the given page.
@param bUpdateCurrentPage
When <TRUE/> then the current page is updated to the first slide
of the remaining selection.
*/
void DeselectPage (int nPageIndex);
void DeselectPage (const SdPage* pPage);
void DeselectPage (const model::SharedPageDescriptor& rpDescriptor);
void DeselectPage (
int nPageIndex,
const bool bUpdateCurrentPage = true);
void DeselectPage (
const SdPage* pPage,
const bool bUpdateCurrentPage = true);
void DeselectPage (
const model::SharedPageDescriptor& rpDescriptor,
const bool bUpdateCurrentPage = true);
/** This convenience method returns the same number of pages that
SlideSorterModel.GetPageCount() returns. It is included here so

View File

@@ -132,6 +132,11 @@ public:
const model::SharedPageDescriptor& rpDescriptor,
const bool bAnimate);
/** Return whether the button bar is visible for the givn descriptor (or
being faded in.)
*/
bool IsVisible (const model::SharedPageDescriptor& rpDescriptor);
class BackgroundTheme;
/** While at least one Lock object exists the button bar will not be

View File

@@ -119,17 +119,20 @@ private:
void PaintBorder (
OutputDevice& rDevice,
const Theme::GradientColorType eColorType,
const Rectangle& rBox) const;
const Rectangle& rBox,
const int nBorderWidth) const;
Bitmap& GetBackgroundForState (
const model::SharedPageDescriptor& rpDescriptor,
const OutputDevice& rTemplateDevice);
Bitmap& GetBackground(
Bitmap& rBackground,
Theme::GradientColorType eType,
const OutputDevice& rTemplateDevice);
const OutputDevice& rTemplateDevice,
const int nBorderWidth);
Bitmap CreateBackgroundBitmap(
const OutputDevice& rReferenceDevice,
const Theme::GradientColorType eType) const;
const Theme::GradientColorType eType,
const int nBorderWidth) const;
Bitmap CreateMarkedPreview(
const Size& rSize,
const Bitmap& rPreview,

View File

@@ -412,7 +412,6 @@ void SlideSorter::ReleaseListeners (void)
SharedSdWindow pWindow (GetContentWindow());
if (pWindow)
{
pWindow->RemoveEventListener(
LINK(mpSlideSorterController.get(),
controller::SlideSorterController,

View File

@@ -532,16 +532,6 @@ void SlideSorterViewShell::ExecStatusBar (SfxRequest& rRequest)
void SlideSorterViewShell::PrePaint()
{
OSL_ASSERT(mpSlideSorter.get()!=NULL);
if (mpSlideSorter.get() != NULL)
mpSlideSorter->GetController().PrePaint();
}
void SlideSorterViewShell::Paint (
const Rectangle& rBBox,
::sd::Window* pWindow)

View File

@@ -668,6 +668,15 @@ void ButtonBar::RequestFadeOut (
bool ButtonBar::IsVisible (const model::SharedPageDescriptor& rpDescriptor)
{
const double nMaxAlpha (1);
return rpDescriptor && rpDescriptor->GetVisualState().GetButtonBarAlpha() < nMaxAlpha;
}
void ButtonBar::StartFadeAnimation (
const model::SharedPageDescriptor& rpDescriptor,
const double nTargetAlpha,
@@ -1466,6 +1475,4 @@ void DuplicateButton::ProcessClick (const model::SharedPageDescriptor& rpDescrip
} } } // end of namespace ::sd::slidesorter::view

View File

@@ -356,46 +356,62 @@ Bitmap& PageObjectPainter::GetBackgroundForState (
const model::SharedPageDescriptor& rpDescriptor,
const OutputDevice& rReferenceDevice)
{
const bool bIsSelected (rpDescriptor->HasState(model::PageDescriptor::ST_Selected));
const bool bIsMouseOver (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver));
const bool bIsFocused (rpDescriptor->HasState(model::PageDescriptor::ST_Focused));
enum State { None = 0x00, Selected = 0x01, MouseOver = 0x02, Focused = 0x04 };
const int nFocusedBorderWidth (2);
const int nNormalBorderWidth (1);
if (bIsMouseOver)
const State eState (State(
(rpDescriptor->HasState(model::PageDescriptor::ST_Selected) ? Selected : None)
| (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ? MouseOver : None)
| (rpDescriptor->HasState(model::PageDescriptor::ST_Focused) ? Focused : None)));
switch (eState)
{
if (bIsSelected && bIsFocused)
case MouseOver | Selected | Focused:
return GetBackground(
maMouseOverSelectedAndFocusedBackground,
Theme::Gradient_MouseOverSelectedAndFocusedPage,
rReferenceDevice);
else
rReferenceDevice,
nFocusedBorderWidth);
case MouseOver | Selected:
case MouseOver | Focused:
case MouseOver:
return GetBackground(
maMouseOverBackground,
Theme::Gradient_MouseOverPage,
rReferenceDevice);
}
else if (bIsSelected)
{
if (bIsFocused)
rReferenceDevice,
(eState & Focused) ? nFocusedBorderWidth : nNormalBorderWidth);
case Selected | Focused:
return GetBackground(
maFocusedSelectionBackground,
Theme::Gradient_SelectedAndFocusedPage,
rReferenceDevice);
else
rReferenceDevice,
nFocusedBorderWidth);
case Selected:
return GetBackground(
maSelectionBackground,
Theme::Gradient_SelectedPage,
rReferenceDevice);
rReferenceDevice,
nNormalBorderWidth);
case Focused:
return GetBackground(
maFocusedBackground,
Theme::Gradient_FocusedPage,
rReferenceDevice,
nFocusedBorderWidth);
case None:
default:
return GetBackground(
maNormalBackground,
Theme::Gradient_NormalPage,
rReferenceDevice,
nNormalBorderWidth);
}
else if (bIsFocused)
return GetBackground(
maFocusedBackground,
Theme::Gradient_FocusedPage,
rReferenceDevice);
else
return GetBackground(
maNormalBackground,
Theme::Gradient_NormalPage,
rReferenceDevice);
}
@@ -404,10 +420,11 @@ Bitmap& PageObjectPainter::GetBackgroundForState (
Bitmap& PageObjectPainter::GetBackground(
Bitmap& rBackground,
Theme::GradientColorType eType,
const OutputDevice& rReferenceDevice)
const OutputDevice& rReferenceDevice,
const int nBorderWidth)
{
if (rBackground.IsEmpty())
rBackground = CreateBackgroundBitmap(rReferenceDevice, eType);
rBackground = CreateBackgroundBitmap(rReferenceDevice, eType, nBorderWidth);
return rBackground;
}
@@ -416,7 +433,8 @@ Bitmap& PageObjectPainter::GetBackground(
Bitmap PageObjectPainter::CreateBackgroundBitmap(
const OutputDevice& rReferenceDevice,
const Theme::GradientColorType eColorType) const
const Theme::GradientColorType eColorType,
const int nBorderWidth) const
{
const Size aSize (mpPageObjectLayouter->GetPageObjectSize());
VirtualDevice aBitmapDevice (rReferenceDevice);
@@ -451,7 +469,7 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
aBitmapDevice.DrawLine(Point(0,nY), Point(aSize.Width(),nY));
}
PaintBorder(aBitmapDevice, eColorType, Rectangle(Point(0,0), aSize));
PaintBorder(aBitmapDevice, eColorType, Rectangle(Point(0,0), aSize), nBorderWidth);
// Get bounding box of the preview around which a shadow is painted.
// Compensate for the border around the preview.
@@ -471,14 +489,29 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
void PageObjectPainter::PaintBorder (
OutputDevice& rDevice,
const Theme::GradientColorType eColorType,
const Rectangle& rBox) const
const Rectangle& rBox,
const int nBorderWidth) const
{
const Size aSize (mpPageObjectLayouter->GetPageObjectSize());
rDevice.SetFillColor();
rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border2));
rDevice.DrawRect(rBox);
rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border1));
rDevice.DrawLine(rBox.TopLeft(), rBox.TopRight());
for (int nIndex=0; nIndex<nBorderWidth; ++nIndex)
{
const int nDelta (-nIndex);
rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border2));
rDevice.DrawLine(
Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta));
rDevice.DrawLine(
Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta),
Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta));
rDevice.DrawLine(
Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta),
Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border1));
rDevice.DrawLine(
Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
}
}

View File

@@ -169,8 +169,8 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert
SetGradient(Gradient_SelectedPage, aSelectionColor, 50, 50, +100,+100, +50,+25);
SetGradient(Gradient_MouseOverPage, aSelectionColor, 75, 75, +100,+100, +50,+25);
SetGradient(Gradient_SelectedAndFocusedPage, aSelectionColor, 50, 50, +100,0, -50,-75);
SetGradient(Gradient_MouseOverSelectedAndFocusedPage, aSelectionColor, 75, 75, +100,0, -50,-75);
SetGradient(Gradient_SelectedAndFocusedPage, aSelectionColor, 50, 50, +100,+100, -50,-75);
SetGradient(Gradient_MouseOverSelectedAndFocusedPage, aSelectionColor, 75, 75, +100,+100, -50,-75);
SetGradient(Gradient_FocusedPage, aSelectionColor, -1,-1, 0,0, -50,-75);
#else
@@ -417,6 +417,8 @@ void Theme::SetGradient (
}
sal_Int32 Theme::GetGradientSaturationOverride (const GradientColorType eType)
{
GradientDescriptor& rGradient (GetGradient(eType));
@@ -424,6 +426,8 @@ sal_Int32 Theme::GetGradientSaturationOverride (const GradientColorType eType)
}
sal_Int32 Theme::GetGradientBrightnessOverride (const GradientColorType eType)
{
GradientDescriptor& rGradient (GetGradient(eType));
@@ -431,6 +435,8 @@ sal_Int32 Theme::GetGradientBrightnessOverride (const GradientColorType eType)
}
void Theme::SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue)
{
GradientDescriptor& rGradient (GetGradient(eType));
@@ -446,6 +452,8 @@ void Theme::SetGradientSaturationOverride (const GradientColorType eType, const
}
void Theme::SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue)
{
GradientDescriptor& rGradient (GetGradient(eType));
@@ -536,8 +544,6 @@ void Theme::InitializeIcon (const IconType eType, USHORT nResourceId)
if (eType>=0 && size_t(eType)<maIcons.size())
{
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