[Libreoffice-commits] .: 3 commits - svl/source vcl/inc vcl/source
Ivan Timofeev
ivantimofeev at kemper.freedesktop.org
Thu Jun 28 03:00:32 PDT 2012
svl/source/undo/undo.cxx | 10 +-
vcl/inc/vcl/toolbox.hxx | 7 -
vcl/source/window/toolbox.cxx | 184 +++++++++++-------------------------------
3 files changed, 59 insertions(+), 142 deletions(-)
New commits:
commit 1eed4c837828c00dff4ef0b2cf29b1e2962e912d
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Thu Jun 28 13:12:56 2012 +0400
i#119400 repair broken undo
Change-Id: I36d74fe1555bd436f93a5fa595e7da05bbd37493
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index e27bf00..e916675 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -635,10 +635,14 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT
// merge, if required
SfxUndoAction* pMergeWithAction = m_pData->pActUndoArray->nCurUndoAction ?
m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1].pAction : NULL;
- if ( bTryMerge && ( !pMergeWithAction || !pMergeWithAction->Merge( pAction ) ) )
+ if ( bTryMerge && pMergeWithAction )
{
- i_guard.markForDeletion( pAction );
- return false;
+ bool bMerged = pMergeWithAction->Merge( pAction );
+ if ( bMerged )
+ {
+ i_guard.markForDeletion( pAction );
+ return false;
+ }
}
// clear redo stack, if requested
commit b4fae0294601ac8e72f350ab9f7061532acd4210
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Wed Jun 27 22:06:01 2012 +0400
FloatingSizeMode is always FSMODE_AUTO, remove it
Change-Id: I0468ff6deaf701ed3d155db1ff3f0f0c204e1199
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 22901be..fd410d9 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -155,9 +155,6 @@ enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON,
// dontcare will let the toolbox decide about its size
enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE };
-// used for internal sizing calculations
-enum FloatingSizeMode { FSMODE_AUTO, FSMODE_FAVOURWIDTH, FSMODE_FAVOURHEIGHT };
-
// TBX_LAYOUT_NORMAL - traditional layout, items are centered in the toolbar
// TBX_LAYOUT_LOCKVERT - special mode (currently used for calc input/formula
// bar) where item's vertical position is locked, e.g.
@@ -287,7 +284,7 @@ private:
SAL_DLLPRIVATE sal_Bool ImplIsFloatingMode() const;
SAL_DLLPRIVATE sal_Bool ImplIsInPopupMode() const;
SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const;
- SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize( FloatingSizeMode eMode );
+ SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize();
SAL_DLLPRIVATE sal_Bool ImplHasExternalMenubutton();
SAL_DLLPRIVATE void ImplDrawFloatwinBorder( ImplToolItem* pItem );
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 8470d25..eaf0be7 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2156,7 +2156,7 @@ sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool b
// -----------------------------------------------------------------------
-Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode )
+Size ToolBox::ImplGetOptimalFloatingSize()
{
if( !ImplIsFloatingMode() )
return Size();
@@ -2166,60 +2166,55 @@ Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode )
Size aSize2( aCurrentSize );
// try to preserve current height
- if( eMode == FSMODE_AUTO || eMode == FSMODE_FAVOURHEIGHT )
- {
- // calc number of floating lines for current window height
- sal_uInt16 nFloatLinesHeight = ImplCalcLines( this, mnDY );
- // calc window size according to this number
- aSize1 = ImplCalcFloatSize( this, nFloatLinesHeight );
- if( eMode == FSMODE_FAVOURHEIGHT || aCurrentSize == aSize1 )
- return aSize1;
- }
+ // calc number of floating lines for current window height
+ sal_uInt16 nFloatLinesHeight = ImplCalcLines( this, mnDY );
+ // calc window size according to this number
+ aSize1 = ImplCalcFloatSize( this, nFloatLinesHeight );
- if( eMode == FSMODE_AUTO || eMode == FSMODE_FAVOURWIDTH )
- {
- // try to preserve current width
- long nLineHeight = ( mnWinHeight > mnMaxItemHeight ) ? mnWinHeight : mnMaxItemHeight;
- int nBorderX = 2*TB_BORDER_OFFSET1 + mnLeftBorder + mnRightBorder;
- int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder;
- Size aSz( aCurrentSize );
- long maxX;
- sal_uInt16 nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz );
+ if( aCurrentSize == aSize1 )
+ return aSize1;
- sal_uInt16 manyLines = 1000;
- Size aMinimalFloatSize = ImplCalcFloatSize( this, manyLines );
+ // try to preserve current width
- aSz.Height() = nBorderY + nLineHeight * nLines;
- // line space when more than one line
- if ( mnWinStyle & WB_LINESPACING )
- aSz.Height() += (nLines-1)*TB_LINESPACING;
+ long nLineHeight = ( mnWinHeight > mnMaxItemHeight ) ? mnWinHeight : mnMaxItemHeight;
+ int nBorderX = 2*TB_BORDER_OFFSET1 + mnLeftBorder + mnRightBorder;
+ int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder;
+ Size aSz( aCurrentSize );
+ long maxX;
+ sal_uInt16 nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz );
- aSz.Width() = nBorderX + maxX;
+ sal_uInt16 manyLines = 1000;
+ Size aMinimalFloatSize = ImplCalcFloatSize( this, manyLines );
- // avoid clipping of any items
- if( aSz.Width() < aMinimalFloatSize.Width() )
- aSize2 = ImplCalcFloatSize( this, nLines );
- else
- aSize2 = aSz;
+ aSz.Height() = nBorderY + nLineHeight * nLines;
+ // line space when more than one line
+ if ( mnWinStyle & WB_LINESPACING )
+ aSz.Height() += (nLines-1)*TB_LINESPACING;
- if( eMode == FSMODE_FAVOURWIDTH || aCurrentSize == aSize2 )
- return aSize2;
- else
- {
- // set the size with the smallest delta as the current size
- long dx1 = abs( mnDX - aSize1.Width() );
- long dy1 = abs( mnDY - aSize1.Height() );
+ aSz.Width() = nBorderX + maxX;
- long dx2 = abs( mnDX - aSize2.Width() );
- long dy2 = abs( mnDY - aSize2.Height() );
+ // avoid clipping of any items
+ if( aSz.Width() < aMinimalFloatSize.Width() )
+ aSize2 = ImplCalcFloatSize( this, nLines );
+ else
+ aSize2 = aSz;
+
+ if( aCurrentSize == aSize2 )
+ return aSize2;
+
+ // set the size with the smallest delta as the current size
+ long dx1 = abs( mnDX - aSize1.Width() );
+ long dy1 = abs( mnDY - aSize1.Height() );
+
+ long dx2 = abs( mnDX - aSize2.Width() );
+ long dy2 = abs( mnDY - aSize2.Height() );
+
+ if( dx1*dy1 < dx2*dy2 )
+ aCurrentSize = aSize1;
+ else
+ aCurrentSize = aSize2;
- if( dx1*dy1 < dx2*dy2 )
- aCurrentSize = aSize1;
- else
- aCurrentSize = aSize2;
- }
- }
return aCurrentSize;
}
@@ -2304,7 +2299,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
if ( bResize )
mnFloatLines = ImplCalcLines( this, mnDY );
else
- SetOutputSizePixel( ImplGetOptimalFloatingSize( FSMODE_AUTO ) );
+ SetOutputSizePixel( ImplGetOptimalFloatingSize() );
}
// Horizontal
commit 044eae119281b9521e70e64aabd42f5142cb54d0
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Tue Jun 26 23:12:17 2012 +0400
remove unused toolbox styles
Change-Id: If19d8a79e34dfa20c41084c91992d860aad6c968
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index c35c6a9..22901be 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -130,8 +130,6 @@ typedef sal_uInt16 ToolBoxItemBits;
// - ToolBox-Types -
// -----------------
-#define TOOLBOX_STYLE_OUTBUTTON ((sal_uInt16)0x0001)
-#define TOOLBOX_STYLE_HANDPOINTER ((sal_uInt16)0x0002)
#define TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004)
#define TOOLBOX_APPEND ((sal_uInt16)0xFFFF)
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index be3ddb2..8470d25 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -72,11 +72,6 @@ DBG_NAMEEX( Window )
#define SMALLBUTTON_OFF_PRESSED_X 5
#define SMALLBUTTON_OFF_PRESSED_Y 5
-#define OUTBUTTON_SIZE 6
-#define OUTBUTTON_BORDER 4
-#define OUTBUTTON_OFF_NORMAL_X 1
-#define OUTBUTTON_OFF_NORMAL_Y 1
-
// -----------------------------------------------------------------------
#define TB_TEXTOFFSET 2
@@ -1444,51 +1439,6 @@ IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel )
// -----------------------------------------------------------------------
-static void ImplDrawOutButton( OutputDevice* pOutDev, const Rectangle& rRect,
- sal_uInt16 nStyle )
-{
- const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings();
- Color aShadowColor = rStyleSettings.GetShadowColor();
- Point aPos( rRect.TopLeft() );
- Size aSize( rRect.GetSize() );
- long nOffset = 0;
-
- if ( pOutDev->GetBackground().GetColor() == aShadowColor )
- aShadowColor = rStyleSettings.GetDarkShadowColor();
-
- if ( nStyle & BUTTON_DRAW_PRESSED )
- {
- aPos.X()++;
- aPos.Y()++;
- nOffset++;
- }
-
- // delete background
- pOutDev->Erase( rRect );
-
- // draw button
- pOutDev->SetLineColor( rStyleSettings.GetLightColor() );
- pOutDev->DrawLine( aPos,
- Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y() ) );
- pOutDev->DrawLine( aPos,
- Point( aPos.X(), aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
- pOutDev->SetLineColor( aShadowColor );
- pOutDev->DrawLine( Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y() ),
- Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
- pOutDev->DrawLine( Point( aPos.X(), aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ),
- Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
- for ( long i = 0; i < OUTBUTTON_BORDER-1-nOffset; i++ )
- {
- pOutDev->DrawLine( Point( aPos.X()+aSize.Width()-(OUTBUTTON_BORDER-i-1), aPos.Y()+OUTBUTTON_BORDER ),
- Point( aPos.X()+aSize.Width()-(OUTBUTTON_BORDER-i-1), aPos.Y()+aSize.Height()-1 ) );
- pOutDev->DrawLine( Point( aPos.X()+OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-(OUTBUTTON_BORDER-i-1) ),
- Point( aPos.X()+aSize.Width()-1, aPos.Y()+aSize.Height()-(OUTBUTTON_BORDER-i-1) ) );
- }
-}
-
-
-// -----------------------------------------------------------------------
-
void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
{
@@ -1775,18 +1725,10 @@ ImplToolItem* ToolBox::ImplGetItem( sal_uInt16 nItemId ) const
}
// -----------------------------------------------------------------------
-static void ImplAddButtonBorder( long &rWidth, long& rHeight, sal_uInt16 aOutStyle, sal_Bool bNativeButtons )
+static void ImplAddButtonBorder( long &rWidth, long& rHeight, sal_Bool bNativeButtons )
{
- if ( aOutStyle & TOOLBOX_STYLE_OUTBUTTON )
- {
- rWidth += OUTBUTTON_SIZE;
- rHeight += OUTBUTTON_SIZE;
- }
- else
- {
- rWidth += SMALLBUTTON_HSIZE;
- rHeight += SMALLBUTTON_VSIZE;
- }
+ rWidth += SMALLBUTTON_HSIZE;
+ rHeight += SMALLBUTTON_VSIZE;
if( bNativeButtons )
{
@@ -2001,7 +1943,7 @@ sal_Bool ToolBox::ImplCalcItem()
if ( it->meType == TOOLBOXITEM_BUTTON || it->meType == TOOLBOXITEM_SPACE )
{
// add borders
- ImplAddButtonBorder( it->maItemSize.Width(), it->maItemSize.Height(), mnOutStyle, mpData->mbNativeButtons );
+ ImplAddButtonBorder( it->maItemSize.Width(), it->maItemSize.Height(), mpData->mbNativeButtons );
if( it->meType == TOOLBOXITEM_BUTTON )
{
@@ -2026,7 +1968,7 @@ sal_Bool ToolBox::ImplCalcItem()
nMaxWidth = nDefWidth;
nMaxHeight = nDefHeight;
- ImplAddButtonBorder( nMaxWidth, nMaxHeight, mnOutStyle, mpData->mbNativeButtons );
+ ImplAddButtonBorder( nMaxWidth, nMaxHeight, mpData->mbNativeButtons );
}
if( !ImplIsFloatingMode() && GetToolboxButtonSize() != TOOLBOX_BUTTONSIZE_DONTCARE )
@@ -2038,7 +1980,7 @@ sal_Bool ToolBox::ImplCalcItem()
long nFixedWidth = nDefWidth+nDropDownArrowWidth;
long nFixedHeight = nDefHeight;
- ImplAddButtonBorder( nFixedWidth, nFixedHeight, mnOutStyle, mpData->mbNativeButtons );
+ ImplAddButtonBorder( nFixedWidth, nFixedHeight, mpData->mbNativeButtons );
if( mbHorz )
nMaxHeight = nFixedHeight;
@@ -3220,17 +3162,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
nStyle |= BUTTON_DRAW_PRESSED;
}
- if ( mnOutStyle & TOOLBOX_STYLE_OUTBUTTON )
- {
- nOffX = OUTBUTTON_OFF_NORMAL_X;
- nOffY = OUTBUTTON_OFF_NORMAL_Y;
- if ( nHighlight != 0 )
- {
- nOffX++;
- nOffY++;
- }
- }
-
if( ! bLayout )
{
if ( mnOutStyle & TOOLBOX_STYLE_FLAT )
@@ -3242,13 +3173,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
}
else
{
- if ( mnOutStyle & TOOLBOX_STYLE_OUTBUTTON )
- ImplDrawOutButton( this, aButtonRect, nStyle );
- else
- {
- DecorationView aDecoView( this );
- aDecoView.DrawButton( aButtonRect, nStyle );
- }
+ DecorationView aDecoView( this );
+ aDecoView.DrawButton( aButtonRect, nStyle );
}
}
@@ -3850,8 +3776,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
}
}
- if ( bDrawHotSpot && ( ((eStyle == POINTER_ARROW) && (mnOutStyle & TOOLBOX_STYLE_HANDPOINTER)) ||
- (mnOutStyle & TOOLBOX_STYLE_FLAT) || !mnOutStyle ) )
+ if ( bDrawHotSpot && ( (mnOutStyle & TOOLBOX_STYLE_FLAT) || !mnOutStyle ) )
{
sal_Bool bClearHigh = sal_True;
if ( !rMEvt.IsLeaveWindow() && (mnCurPos == TOOLBOX_ITEM_NOTFOUND) )
@@ -3887,8 +3812,6 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHT );
}
}
- if ( mnOutStyle & TOOLBOX_STYLE_HANDPOINTER )
- eStyle = POINTER_REFHAND;
}
break;
}
More information about the Libreoffice-commits
mailing list