[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 4 commits - sd/source sfx2/source svx/source vcl/source
Michael Meeks
michael.meeks at collabora.com
Fri May 22 07:29:09 PDT 2015
sd/source/ui/animations/CustomAnimationPane.cxx | 102 +++++++++++-------------
sfx2/source/dialog/dockwin.cxx | 3
svx/source/dialog/charmap.cxx | 3
vcl/source/window/menufloatingwindow.cxx | 61 +++++++++++---
vcl/source/window/menufloatingwindow.hxx | 4
vcl/source/window/printdlg.cxx | 1
6 files changed, 110 insertions(+), 64 deletions(-)
New commits:
commit 55d052d2ae94522237206bc5ff260ea4ae037f96
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri May 22 15:13:48 2015 +0100
tdf#91366 - invalidate only individual menu items to render highlight.
Change-Id: I0dd741829dd315ed86e3fcf79b7fb4da349d0ac8
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 46a997a..0093ba1 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -80,7 +80,7 @@ void MenuFloatingWindow::doShutdown()
{
MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
if (pPWin)
- pPWin->Invalidate(); //pPWin->HighlightItem( i, false );
+ pPWin->InvalidateItem(i);
}
}
@@ -136,6 +136,7 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext)
rRenderContext.SetLineColor();
}
+/// Get a negative pixel offset for an offset menu
long MenuFloatingWindow::ImplGetStartY() const
{
long nY = 0;
@@ -183,14 +184,13 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, bool bMBDow
if( ! pMenu )
return;
- long nY = nScrollerHeight + ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
+ long nY = GetInitialItemY();
long nMouseY = rMEvt.GetPosPixel().Y();
Size aOutSz = GetOutputSizePixel();
if ( ( nMouseY >= nY ) && ( nMouseY < ( aOutSz.Height() - nY ) ) )
{
bool bHighlighted = false;
size_t nCount = pMenu->pItemList->size();
- nY += ImplGetStartY(); // ggf. gescrollt.
for ( size_t n = 0; !bHighlighted && ( n < nCount ); n++ )
{
if ( pMenu->ImplIsVisible( n ) )
@@ -681,7 +681,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
if ( nHighlightedItem != ITEMPOS_INVALID )
{
- Invalidate(); //HighlightItem( nHighlightedItem, false );
+ InvalidateItem(nHighlightedItem);
pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
}
@@ -704,12 +704,12 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
if( pPWin && pPWin->nHighlightedItem != i )
{
- pPWin->Invalidate(); //HighlightItem( i, true );
+ pPWin->InvalidateItem(i);
pPWin->nHighlightedItem = i;
}
}
}
- Invalidate(); //HighlightItem( nHighlightedItem, true );
+ InvalidateItem(nHighlightedItem);
pMenu->ImplCallHighlight( nHighlightedItem );
}
else
@@ -728,15 +728,49 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
}
}
-void MenuFloatingWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight)
+/// Calculate the initial vertical pixel offset of the first item.
+/// May be negative for scrolled windows.
+long MenuFloatingWindow::GetInitialItemY(long *pStartY) const
+{
+ long nStartY = ImplGetStartY();
+ if (pStartY)
+ *pStartY = nStartY;
+ return nScrollerHeight + nStartY +
+ ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
+}
+
+/// Emit an Invalidate just for this item's area
+void MenuFloatingWindow::InvalidateItem(sal_uInt16 nPos)
+{
+ if (!pMenu)
+ return;
+
+ long nY = GetInitialItemY();
+ size_t nCount = pMenu->pItemList->size();
+ for (size_t n = 0; n < nCount; n++)
+ {
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
+ long nHeight = pData->aSz.Height();
+ if (n == nPos)
+ {
+ Size aWidth( GetSizePixel() );
+ Rectangle aRect(Point(0, nY), Size(aWidth.Width(), nHeight));
+ Invalidate( aRect );
+ }
+ nY += nHeight;
+ }
+}
+
+void MenuFloatingWindow::RenderHighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight)
{
if (!pMenu)
return;
Size aSz = rRenderContext.GetOutputSizePixel();
- long nStartY = ImplGetStartY();
- long nY = nScrollerHeight + nStartY + ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
+
long nX = 0;
+ long nStartY;
+ long nY = GetInitialItemY(&nStartY);
if (pMenu->pLogo)
nX = pMenu->pLogo->aBitmap.GetSizePixel().Width();
@@ -1097,11 +1131,14 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
}
}
-void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
+void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rPaintRect)
{
if (!pMenu)
return;
+ rRenderContext.Push( PushFlags::CLIPREGION );
+ rRenderContext.SetClipRegion(vcl::Region(rPaintRect));
+
if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
rRenderContext.SetClipRegion();
@@ -1122,7 +1159,9 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang
rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuColor());
pMenu->ImplPaint(rRenderContext, nScrollerHeight, ImplGetStartY());
if (nHighlightedItem != ITEMPOS_INVALID)
- HighlightItem(rRenderContext, nHighlightedItem, true);
+ RenderHighlightItem(rRenderContext, nHighlightedItem, true);
+
+ rRenderContext.Pop();
}
void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp)
diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx
index 9336664..00c797d 100644
--- a/vcl/source/window/menufloatingwindow.hxx
+++ b/vcl/source/window/menufloatingwindow.hxx
@@ -78,6 +78,9 @@ protected:
void ImplHighlightItem( const MouseEvent& rMEvt, bool bMBDown );
long ImplGetStartY() const;
Rectangle ImplGetItemRect( sal_uInt16 nPos );
+ void RenderHighlightItem( vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight );
+ long GetInitialItemY( long *pOptStartY = NULL ) const;
+ void InvalidateItem( sal_uInt16 nPos );
public:
MenuFloatingWindow(Menu* pMenu, vcl::Window* pParent, WinBits nStyle);
@@ -112,7 +115,6 @@ public:
PopupMenu* GetActivePopup() const { return pActivePopup; }
void KillActivePopup( PopupMenu* pThisOnly = NULL );
- void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight);
void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer);
sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
commit 15b6db458f5516377703bab8a2860d43753441ed
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri May 22 13:35:39 2015 +0100
tdf#91395 - avoid post-dispose charmap crasher.
Change-Id: Ia3536e0297ecd24f6368b9563002a9888904007a
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index c57a4e3..104161d 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -569,6 +569,9 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
{
+ if( !aVscrollSB )
+ return;
+
if( nNewIndex < 0 )
{
// need to scroll see closest unicode
commit 0d682a9d5a9c68b0ba949725bdab3042f2e8aaa1
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri May 22 11:26:42 2015 +0100
tdf#91283 - reset the PrinterController during dispose.
Change-Id: I22c6c534cfefdbb68e965cbd6baab3da3146d9d0
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 66ada2d..2d06c3b 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -736,6 +736,7 @@ void PrintDialog::dispose()
mpOKButton.clear();
mpCancelButton.clear();
mpHelpButton.clear();
+ maPController.reset();
ModalDialog::dispose();
}
commit 94f8754f8e69bc0e5f06dc271fc286eaa0e0c339
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu May 21 16:26:37 2015 +0100
tdf#91381 - fix a couple of animation related lifecycle issues.
Change-Id: I4aada7f27e3a88124ad670e62ddb6c92ecf431a8
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index d7a97cb..ca19853 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -1752,76 +1752,74 @@ void CustomAnimationPane::onChange( bool bCreate )
}
}
- VclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration );
- if( pDlg->Execute() )
{
- addUndo();
- fDuration = pDlg->getSelectedDuration();
- CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
- if( pDescriptor.get() )
+ ScopedVclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration );
+ if( pDlg->Execute() )
{
- if( bCreate )
+ addUndo();
+ fDuration = pDlg->getSelectedDuration();
+ CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
+ if( pDescriptor.get() )
{
- mpCustomAnimationList->SelectAll( false );
-
- // gather shapes from the selection
- std::vector< Any >::iterator aIter( aTargets.begin() );
- const std::vector< Any >::iterator aEnd( aTargets.end() );
- bool bFirst = true;
- for( ; aIter != aEnd; ++aIter )
+ if( bCreate )
{
- CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration );
+ mpCustomAnimationList->SelectAll( false );
- // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs
- if( bHasText && (aTargets.size() == 1) )
+ // gather shapes from the selection
+ std::vector< Any >::iterator aIter( aTargets.begin() );
+ const std::vector< Any >::iterator aEnd( aTargets.end() );
+ bool bFirst = true;
+ for( ; aIter != aEnd; ++aIter )
{
- Reference< XShape > xShape( (*aIter), UNO_QUERY );
- if( xShape.is() && !hasVisibleShape( xShape ) )
+ CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration );
+
+ // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs
+ if( bHasText && (aTargets.size() == 1) )
{
- mpMainSequence->createTextGroup( pCreated, 1, -1.0, false, false );
+ Reference< XShape > xShape( (*aIter), UNO_QUERY );
+ if( xShape.is() && !hasVisibleShape( xShape ) )
+ {
+ mpMainSequence->createTextGroup( pCreated, 1, -1.0, false, false );
+ }
}
- }
- if( bFirst )
- bFirst = false;
- else
- pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
+ if( bFirst )
+ bFirst = false;
+ else
+ pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
- if( pCreated.get() )
- {
- mpCustomAnimationList->select( pCreated );
+ if( pCreated.get() )
+ mpCustomAnimationList->select( pCreated );
}
}
- }
- else
- {
- MainSequenceRebuildGuard aGuard( mpMainSequence );
-
- // get selected effect
- EffectSequence::iterator aIter( maListSelection.begin() );
- const EffectSequence::iterator aEnd( maListSelection.end() );
- while( aIter != aEnd )
+ else
{
- CustomAnimationEffectPtr pEffect = (*aIter++);
+ MainSequenceRebuildGuard aGuard( mpMainSequence );
- EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
- if( !pEffectSequence )
- pEffectSequence = mpMainSequence.get();
+ // get selected effect
+ EffectSequence::iterator aIter( maListSelection.begin() );
+ const EffectSequence::iterator aEnd( maListSelection.end() );
+ while( aIter != aEnd )
+ {
+ CustomAnimationEffectPtr pEffect = (*aIter++);
+
+ EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+ if( !pEffectSequence )
+ pEffectSequence = mpMainSequence.get();
- pEffectSequence->replace( pEffect, pDescriptor, fDuration );
+ pEffectSequence->replace( pEffect, pDescriptor, fDuration );
+ }
}
}
+ else
+ {
+ PathKind eKind = pDlg->getCreatePathKind();
+ if( eKind != PathKind::NONE )
+ createPath( eKind, aTargets, fDuration );
+ }
+ mrBase.GetDocShell()->SetModified();
}
- else
- {
- PathKind eKind = pDlg->getCreatePathKind();
- if( eKind != PathKind::NONE )
- createPath( eKind, aTargets, fDuration );
- }
- mrBase.GetDocShell()->SetModified();
- }
-
- pDlg.reset();
+ } // dispose pDlg
updateControls();
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 80613ce..6f30d50 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -1729,6 +1729,9 @@ Size SfxDockingWindow::GetMinOutputSizePixel() const
bool SfxDockingWindow::Notify( NotifyEvent& rEvt )
{
+ if ( !pImp )
+ return DockingWindow::Notify( rEvt );
+
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{
if (pMgr != NULL)
More information about the Libreoffice-commits
mailing list