[Libreoffice-commits] .: 5 commits - svx/source sw/inc sw/source vcl/inc vcl/source
Ivan Timofeev
ivantimofeev at kemper.freedesktop.org
Thu Jun 21 01:16:53 PDT 2012
svx/source/gallery2/galbrws2.cxx | 1
sw/inc/EnhancedPDFExportHelper.hxx | 9
sw/source/core/text/EnhancedPDFExportHelper.cxx | 57 ++---
vcl/inc/vcl/toolbox.hxx | 30 --
vcl/source/window/toolbox.cxx | 273 +++---------------------
vcl/source/window/toolbox2.cxx | 27 --
6 files changed, 93 insertions(+), 304 deletions(-)
New commits:
commit db053e48d2ca17e1256eb12500f075488483603b
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Wed Jun 20 22:15:46 2012 +0400
fdo#34093: fix error in calculation of page number of SwRect
StringRangeEnumerator (i.e. user's input) contains page numbers in a different
page range (it excludes empty pages). So:
- first map page numbers to a common range, then compare
- user's input can't contain empty pages, remove this check
Change-Id: I4fce5215272fc90f39c9e05d3f3604734a8aebe3
diff --git a/sw/inc/EnhancedPDFExportHelper.hxx b/sw/inc/EnhancedPDFExportHelper.hxx
index 2020d13..a5a5210 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -216,7 +216,14 @@ class SwEnhancedPDFExportHelper
OutputDevice& mrOut;
StringRangeEnumerator* mpRangeEnum;
- std::vector<bool> maIsPageEmpty;
+ /** The problem is that numbers in StringRangeEnumerator aren't accordant
+ * to real page numbers if mbSkipEmptyPages is true, because in this case
+ * empty pages are excluded from a page range and numbers in
+ * StringRangeEnumerator are shifted.
+ *
+ * maPageNumberMap[real_page_number] is either a corresponding page number
+ * in a page range without empty pages, or -1 if this page is empty. */
+ std::vector< sal_Int32 > maPageNumberMap;
bool mbSkipEmptyPages;
bool mbEditEngineOnly;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 5cbc431..6a4210d 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1523,12 +1523,17 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( SwEditShell& rSh,
if ( mbSkipEmptyPages )
{
- maIsPageEmpty.resize( mrSh.GetPageCount() );
+ maPageNumberMap.resize( mrSh.GetPageCount() );
const SwPageFrm* pCurrPage =
static_cast<const SwPageFrm*>( mrSh.GetLayout()->Lower() );
- for ( size_t i = 0, n = maIsPageEmpty.size(); i < n && pCurrPage; ++i )
+ sal_Int32 nPageNumber = 0;
+ for ( size_t i = 0, n = maPageNumberMap.size(); i < n && pCurrPage; ++i )
{
- maIsPageEmpty[i] = pCurrPage->IsEmptyPage();
+ if ( pCurrPage->IsEmptyPage() )
+ maPageNumberMap[i] = -1;
+ else
+ maPageNumberMap[i] = nPageNumber++;
+
pCurrPage = static_cast<const SwPageFrm*>( pCurrPage->GetNext() );
}
}
@@ -2150,7 +2155,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) const
{
// Document page number.
- const sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect );
+ sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect );
if ( nPageNumOfRect < 0 )
return -1;
@@ -2158,6 +2163,10 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) co
sal_Int32 nRet = -1;
if ( mpRangeEnum )
{
+ if ( mbSkipEmptyPages )
+ // Map the page number to the range without empty pages.
+ nPageNumOfRect = maPageNumberMap[ nPageNumOfRect ];
+
if ( mpRangeEnum->hasValue( nPageNumOfRect ) )
{
sal_Int32 nOutputPageNum = 0;
@@ -2165,18 +2174,12 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) co
StringRangeEnumerator::Iterator aEnd = mpRangeEnum->end();
for ( ; aIter != aEnd; ++aIter )
{
- bool bSkipThisPage = mbSkipEmptyPages &&
- static_cast<size_t>( *aIter ) < maIsPageEmpty.size() &&
- maIsPageEmpty[*aIter];
- if ( !bSkipThisPage )
+ if ( *aIter == nPageNumOfRect )
{
- if ( *aIter == nPageNumOfRect )
- {
- nRet = nOutputPageNum;
- break;
- }
- ++nOutputPageNum;
+ nRet = nOutputPageNum;
+ break;
}
+ ++nOutputPageNum;
}
}
}
@@ -2185,9 +2188,9 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) co
if ( mbSkipEmptyPages )
{
sal_Int32 nOutputPageNum = 0;
- for ( size_t i = 0; i < maIsPageEmpty.size(); ++i )
+ for ( size_t i = 0; i < maPageNumberMap.size(); ++i )
{
- if ( !maIsPageEmpty[i] )
+ if ( maPageNumberMap[i] >= 0 ) // is not empty?
{
if ( i == static_cast<size_t>( nPageNumOfRect ) )
{
@@ -2218,13 +2221,17 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
rPageNums.clear();
// Document page number.
- const sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect );
+ sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect );
if ( nPageNumOfRect < 0 )
return;
// What will be the page numbers of page nPageNumOfRect in the output pdf?
if ( mpRangeEnum )
{
+ if ( mbSkipEmptyPages )
+ // Map the page number to the range without empty pages.
+ nPageNumOfRect = maPageNumberMap[ nPageNumOfRect ];
+
if ( mpRangeEnum->hasValue( nPageNumOfRect ) )
{
sal_Int32 nOutputPageNum = 0;
@@ -2232,15 +2239,9 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
StringRangeEnumerator::Iterator aEnd = mpRangeEnum->end();
for ( ; aIter != aEnd; ++aIter )
{
- bool bSkipThisPage = mbSkipEmptyPages &&
- static_cast<size_t>( *aIter ) < maIsPageEmpty.size() &&
- maIsPageEmpty[*aIter];
- if ( !bSkipThisPage )
- {
- if ( *aIter == nPageNumOfRect )
- rPageNums.push_back( nOutputPageNum );
- ++nOutputPageNum;
- }
+ if ( *aIter == nPageNumOfRect )
+ rPageNums.push_back( nOutputPageNum );
+ ++nOutputPageNum;
}
}
}
@@ -2249,9 +2250,9 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
if ( mbSkipEmptyPages )
{
sal_Int32 nOutputPageNum = 0;
- for ( size_t i = 0; i < maIsPageEmpty.size(); ++i )
+ for ( size_t i = 0; i < maPageNumberMap.size(); ++i )
{
- if ( !maIsPageEmpty[i] )
+ if ( maPageNumberMap[i] >= 0 ) // is not empty?
{
if ( i == static_cast<size_t>( nPageNumOfRect ) )
{
commit 5f690158d1468d9eaec8cdc648b795487b0dcd89
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Thu Jun 14 18:12:13 2012 +0400
convert array to std::vector
Change-Id: I5e5bcebeb804256d0ad8cf6afafc392b2853b88f
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 13f4c1f..d812dfc 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -34,6 +34,7 @@
#include <vcl/dockwin.hxx>
#include <vcl/image.hxx>
#include <vcl/timer.hxx>
+#include <vector>
class UserDrawEvent;
@@ -164,6 +165,14 @@ enum FloatingSizeMode { FSMODE_AUTO, FSMODE_FAVOURWIDTH, FSMODE_FAVOURHEIGHT };
// bar) where item's vertical position is locked, e.g.
// toolbox is prevented from centering the items
enum ToolBoxLayoutMode { TBX_LAYOUT_NORMAL, TBX_LAYOUT_LOCKVERT };
+
+struct ImplToolSize
+{
+ long mnWidth;
+ long mnHeight;
+ sal_uInt16 mnLines;
+};
+
// -----------
// - ToolBox -
// -----------
@@ -175,7 +184,7 @@ class VCL_DLLPUBLIC ToolBox : public DockingWindow
private:
ImplToolBoxPrivateData* mpData;
- ImplToolSizeArray* mpFloatSizeAry;
+ std::vector<ImplToolSize> maFloatSizes;
ImageList maImageList;
Timer maTimer;
Rectangle maUpperRect;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index b3434b5..5ddafaf 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -114,25 +114,6 @@ DBG_NAMEEX( Window )
static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bEnabled, sal_Bool bIsWindow );
// -----------------------------------------------------------------------
-struct ImplToolSize
-{
- long mnWidth;
- long mnHeight;
- sal_uInt16 mnLines;
-};
-
-struct ImplToolSizeArray
-{
- long mnLength;
- long mnLastEntry;
- ImplToolSize* mpSize;
-
- ImplToolSizeArray() { mpSize = NULL; mnLength = 0; mnLastEntry = 0; }
- ~ImplToolSizeArray() { if( mpSize ) delete [] mpSize; mnLength = 0; }
-};
-
-// -----------------------------------------------------------------------
-
typedef ::std::vector< ToolBox* > ImplTBList;
class ImplTBDragMgr
@@ -856,7 +837,7 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
void ToolBox::ImplCalcFloatSizes( ToolBox* pThis )
{
- if ( pThis->mpFloatSizeAry )
+ if ( !pThis->maFloatSizes.empty() )
return;
// calculate the minimal size, i.e. where the biggest item just fits
@@ -886,28 +867,24 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis )
// calc an upper bound for ImplCalcBreaks below
long upperBoundWidth = nCalcSize * pThis->mpData->m_aItems.size();
- sal_uInt16 i;
sal_uInt16 nLines;
sal_uInt16 nCalcLines;
sal_uInt16 nTempLines;
- long nHeight;
long nMaxLineWidth;
nCalcLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, sal_True );
- pThis->mpFloatSizeAry = new ImplToolSizeArray;
- pThis->mpFloatSizeAry->mpSize = new ImplToolSize[nCalcLines];
- pThis->mpFloatSizeAry->mnLength = nCalcLines;
+ pThis->maFloatSizes.reserve( nCalcLines );
- memset( pThis->mpFloatSizeAry->mpSize, 0, sizeof( ImplToolSize )*nCalcLines );
- i = 0;
nTempLines = nLines = nCalcLines;
while ( nLines )
{
- nHeight = ImplCalcSize( pThis, nTempLines, TB_CALCMODE_FLOAT ).Height();
- pThis->mpFloatSizeAry->mnLastEntry = i;
- pThis->mpFloatSizeAry->mpSize[i].mnHeight = nHeight;
- pThis->mpFloatSizeAry->mpSize[i].mnLines = nTempLines;
- pThis->mpFloatSizeAry->mpSize[i].mnWidth = nMaxLineWidth+(TB_BORDER_OFFSET1*2);
+ long nHeight = ImplCalcSize( pThis, nTempLines, TB_CALCMODE_FLOAT ).Height();
+
+ ImplToolSize aSize;
+ aSize.mnWidth = nMaxLineWidth+(TB_BORDER_OFFSET1*2);
+ aSize.mnHeight = nHeight;
+ aSize.mnLines = nTempLines;
+ pThis->maFloatSizes.push_back( aSize );
nLines--;
if ( nLines )
{
@@ -920,7 +897,6 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis )
if ( nTempLines < nLines )
nLines = nTempLines;
}
- i++;
}
}
@@ -938,13 +914,15 @@ Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines )
}
sal_uInt16 i = 0;
- while ( i < pThis->mpFloatSizeAry->mnLastEntry &&
- rLines < pThis->mpFloatSizeAry->mpSize[i].mnLines )
+ while ( i + 1u < pThis->maFloatSizes.size() &&
+ rLines < pThis->maFloatSizes[i].mnLines )
+ {
i++;
+ }
- Size aSize( pThis->mpFloatSizeAry->mpSize[i].mnWidth,
- pThis->mpFloatSizeAry->mpSize[i].mnHeight );
- rLines = pThis->mpFloatSizeAry->mpSize[i].mnLines;
+ Size aSize( pThis->maFloatSizes[i].mnWidth,
+ pThis->maFloatSizes[i].mnHeight );
+ rLines = pThis->maFloatSizes[i].mnLines;
return aSize;
}
@@ -956,19 +934,19 @@ void ToolBox::ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMa
ImplCalcFloatSizes( pThis );
sal_uInt16 i = 0;
- rMinSize = Size( pThis->mpFloatSizeAry->mpSize[i].mnWidth, pThis->mpFloatSizeAry->mpSize[i].mnHeight );
- rMaxSize = Size( pThis->mpFloatSizeAry->mpSize[i].mnWidth, pThis->mpFloatSizeAry->mpSize[i].mnHeight );
- while ( ++i <= pThis->mpFloatSizeAry->mnLastEntry )
+ rMinSize = Size( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight );
+ rMaxSize = Size( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight );
+ while ( ++i < pThis->maFloatSizes.size() )
{
- if( pThis->mpFloatSizeAry->mpSize[i].mnWidth < rMinSize.Width() )
- rMinSize.Width() = pThis->mpFloatSizeAry->mpSize[i].mnWidth;
- if( pThis->mpFloatSizeAry->mpSize[i].mnHeight < rMinSize.Height() )
- rMinSize.Height() = pThis->mpFloatSizeAry->mpSize[i].mnHeight;
+ if( pThis->maFloatSizes[i].mnWidth < rMinSize.Width() )
+ rMinSize.Width() = pThis->maFloatSizes[i].mnWidth;
+ if( pThis->maFloatSizes[i].mnHeight < rMinSize.Height() )
+ rMinSize.Height() = pThis->maFloatSizes[i].mnHeight;
- if( pThis->mpFloatSizeAry->mpSize[i].mnWidth > rMaxSize.Width() )
- rMaxSize.Width() = pThis->mpFloatSizeAry->mpSize[i].mnWidth;
- if( pThis->mpFloatSizeAry->mpSize[i].mnHeight > rMaxSize.Height() )
- rMaxSize.Height() = pThis->mpFloatSizeAry->mpSize[i].mnHeight;
+ if( pThis->maFloatSizes[i].mnWidth > rMaxSize.Width() )
+ rMaxSize.Width() = pThis->maFloatSizes[i].mnWidth;
+ if( pThis->maFloatSizes[i].mnHeight > rMaxSize.Height() )
+ rMaxSize.Height() = pThis->maFloatSizes[i].mnHeight;
}
}
@@ -1516,7 +1494,6 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
// initialize variables
ImplGetWindowImpl()->mbToolBox = sal_True;
- mpFloatSizeAry = NULL;
mpData = new ImplToolBoxPrivateData;
mpFloatWin = NULL;
mnDX = 0;
@@ -1765,9 +1742,6 @@ ToolBox::~ToolBox()
// delete private data
delete mpData;
- // delete FloatSizeAry if required
- delete mpFloatSizeAry;
-
// remove the lists when there are no more toolbox references to
// the lists
ImplSVData* pSVData = ImplGetSVData();
@@ -2364,12 +2338,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
sal_Bool bIsInPopupMode = ImplIsInPopupMode();
- // delete FloatSizeAry if required
- if ( mpFloatSizeAry )
- {
- delete mpFloatSizeAry;
- mpFloatSizeAry = NULL;
- }
+ maFloatSizes.clear();
// compute border sizes
ImplCalcBorder( meAlign, mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder, this );
@@ -4976,7 +4945,7 @@ void ToolBox::Resizing( Size& rSize )
nTemp = nCalcLines;
Size aTempSize = ImplCalcFloatSize( this, nTemp );
while ( (aTempSize.Width() > rSize.Width()) &&
- (nCalcLines <= mpFloatSizeAry->mpSize[0].mnLines) )
+ (nCalcLines <= maFloatSizes[0].mnLines) )
{
nCalcLines++;
nTemp = nCalcLines;
commit df59e1d5bd56904caf4feae14e679255ed024128
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Thu Jun 14 00:14:34 2012 +0400
no need to be a class member
Change-Id: I230e8972340b409c6da70a4c988ac1d531a9f3b5
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 0c4e585..13f4c1f 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -176,7 +176,6 @@ class VCL_DLLPUBLIC ToolBox : public DockingWindow
private:
ImplToolBoxPrivateData* mpData;
ImplToolSizeArray* mpFloatSizeAry;
- XubString maCvtStr;
ImageList maImageList;
Timer maTimer;
Rectangle maUpperRect;
@@ -262,7 +261,7 @@ private:
using Window::ImplInvalidate;
SAL_DLLPRIVATE void ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False );
SAL_DLLPRIVATE void ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
- SAL_DLLPRIVATE const XubString& ImplConvertMenuString( const XubString& rStr );
+ SAL_DLLPRIVATE const rtl::OUString ImplConvertMenuString( const XubString& rStr );
SAL_DLLPRIVATE sal_Bool ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False );
SAL_DLLPRIVATE sal_Bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False );
SAL_DLLPRIVATE void ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus = sal_False );
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 3c924cf..ff2c3bb 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -400,13 +400,13 @@ sal_Bool ImplToolItem::IsClipped() const
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-const XubString& ToolBox::ImplConvertMenuString( const XubString& rStr )
+const rtl::OUString ToolBox::ImplConvertMenuString( const XubString& rStr )
{
- maCvtStr = rStr;
+ rtl::OUString aCvtStr( rStr );
if ( mbMenuStrings )
- maCvtStr = comphelper::string::stripEnd(maCvtStr, '.');
- maCvtStr = MnemonicGenerator::EraseAllMnemonicChars( maCvtStr );
- return maCvtStr;
+ aCvtStr = comphelper::string::stripEnd(aCvtStr, '.');
+ aCvtStr = MnemonicGenerator::EraseAllMnemonicChars( aCvtStr );
+ return aCvtStr;
}
// -----------------------------------------------------------------------
commit 1b7e9855d9e90bbd33b78b7da0b65dc915800cc6
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Thu Jun 14 00:01:32 2012 +0400
remove misterious NextToolbox functionality
Change-Id: Ic64d2cae56787884ff107b78c3b6567ab5d38785
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 705abb6..0c4e585 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -177,12 +177,10 @@ private:
ImplToolBoxPrivateData* mpData;
ImplToolSizeArray* mpFloatSizeAry;
XubString maCvtStr;
- XubString maNextToolBoxStr;
ImageList maImageList;
Timer maTimer;
Rectangle maUpperRect;
Rectangle maLowerRect;
- Rectangle maNextToolRect;
Rectangle maOutDockRect;
Rectangle maInDockRect;
Rectangle maPaintRect;
@@ -220,7 +218,6 @@ private:
mbCommandDrag:1,
mbUpper:1,
mbLower:1,
- mbNextTool:1,
mbIn:1,
mbCalc:1,
mbFormat:1,
@@ -247,7 +244,6 @@ private:
Link maDeactivateHdl;
Link maHighlightHdl;
Link maSelectHdl;
- Link maNextToolBoxHdl;
public:
using Window::ImplInit;
@@ -261,7 +257,6 @@ private:
SAL_DLLPRIVATE sal_uInt16 ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool bCalcHorz );
SAL_DLLPRIVATE void ImplFormat( sal_Bool bResize = sal_False );
SAL_DLLPRIVATE void ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn );
- SAL_DLLPRIVATE void ImplDrawNext( sal_Bool bIn );
SAL_DLLPRIVATE void ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect );
SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight = 0, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
using Window::ImplInvalidate;
@@ -349,7 +344,6 @@ public:
virtual void Deactivate();
virtual void Highlight();
virtual void Select();
- virtual void NextToolBox();
virtual void Customize( const ToolBoxCustomizeEvent& rCEvt );
virtual void UserDraw( const UserDrawEvent& rUDEvt );
@@ -423,8 +417,6 @@ public:
// Used to enable/disable scrolling one page at a time for toolbar
void SetPageScroll( sal_Bool b );
- const XubString& GetNextToolBox() const { return maNextToolBoxStr; }
-
sal_uInt16 GetItemCount() const;
ToolBoxItemType GetItemType( sal_uInt16 nPos ) const;
sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
@@ -557,8 +549,6 @@ public:
const Link& GetHighlightHdl() const { return maHighlightHdl; }
void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
const Link& GetSelectHdl() const { return maSelectHdl; }
- void SetNextToolBoxHdl( const Link& rLink ) { maNextToolBoxHdl = rLink; }
- const Link& GetNextToolBoxHdl() const { return maNextToolBoxHdl; }
// support for custom menu (eg for configuration)
// note: this menu will also be used to display currently
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4ed2388..b3434b5 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -945,8 +945,7 @@ Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines )
Size aSize( pThis->mpFloatSizeAry->mpSize[i].mnWidth,
pThis->mpFloatSizeAry->mpSize[i].mnHeight );
rLines = pThis->mpFloatSizeAry->mpSize[i].mnLines;
- if ( pThis->maNextToolBoxStr.Len() && pThis->mbScroll )
- aSize.Width() += TB_NEXT_SIZE-TB_NEXT_OFFSET;
+
return aSize;
}
@@ -1549,7 +1548,6 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
mbCommandDrag = sal_False;
mbUpper = sal_False;
mbLower = sal_False;
- mbNextTool = sal_False;
mbIn = sal_False;
mbCalc = sal_True;
mbFormat = sal_False;
@@ -2501,7 +2499,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
maLowerRect = aEmptyRect;
maUpperRect = aEmptyRect;
- maNextToolRect = aEmptyRect;
}
else
{
@@ -2513,33 +2510,11 @@ void ToolBox::ImplFormat( sal_Bool bResize )
// save old scroll rectangles and reset them
Rectangle aOldLowerRect = maLowerRect;
Rectangle aOldUpperRect = maUpperRect;
- Rectangle aOldNextToolRect = maNextToolRect;
Rectangle aOldMenubuttonRect = mpData->maMenubuttonItem.maRect;
maUpperRect = aEmptyRect;
maLowerRect = aEmptyRect;
- maNextToolRect = aEmptyRect;
mpData->maMenubuttonItem.maRect = aEmptyRect;
- // additional toolboxes require a toggle button (maNextToolRect)
- if ( maNextToolBoxStr.Len() && mbScroll )
- {
- nMax -= TB_NEXT_SIZE-TB_NEXT_OFFSET;
- if ( mbHorz )
- {
- maNextToolRect.Left() = nLeft+nMax;
- maNextToolRect.Right() = maNextToolRect.Left()+TB_NEXT_SIZE-1;
- maNextToolRect.Top() = nTop;
- maNextToolRect.Bottom() = mnDY-mnBottomBorder-TB_BORDER_OFFSET2-1;
- }
- else
- {
- maNextToolRect.Top() = nTop+nMax;
- maNextToolRect.Bottom() = maNextToolRect.Top()+TB_NEXT_SIZE-1;
- maNextToolRect.Left() = nLeft;
- maNextToolRect.Right() = mnDX-mnRightBorder-TB_BORDER_OFFSET2-1;
- }
- }
-
// do we have any toolbox items at all ?
if ( !mpData->m_aItems.empty() || IsMenuEnabled() )
{
@@ -2785,11 +2760,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
maPaintRect.Union( maUpperRect );
maPaintRect.Union( aOldUpperRect );
}
- if ( aOldNextToolRect != maNextToolRect )
- {
- maPaintRect.Union( maNextToolRect );
- maPaintRect.Union( aOldNextToolRect );
- }
if ( aOldMenubuttonRect != mpData->maMenubuttonItem.maRect )
{
maPaintRect.Union( mpData->maMenubuttonItem.maRect );
@@ -3156,52 +3126,6 @@ void ToolBox::ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn )
// -----------------------------------------------------------------------
-void ToolBox::ImplDrawNext( sal_Bool bIn )
-{
- DBG_CHKTHIS( Window, ImplDbgCheckWindow );
-
- if ( maNextToolRect.IsEmpty() )
- return;
-
- DecorationView aDecoView( this );
-
- // Button malen
- long nX = SMALLBUTTON_OFF_NORMAL_X;
- long nY = SMALLBUTTON_OFF_NORMAL_Y;
- sal_uInt16 nStyle = 0;
- if ( bIn == 1 )
- {
- nStyle |= BUTTON_DRAW_PRESSED;
- nX = SMALLBUTTON_OFF_PRESSED_X;
- nY = SMALLBUTTON_OFF_PRESSED_Y;
- }
- aDecoView.DrawButton( maNextToolRect, nStyle );
-
- // Inhalt ausgeben
- sal_Bool bLeft = sal_False;
- sal_Bool bTop = sal_False;
- if ( mbHorz )
- {
- bLeft = sal_True;
- nX += (maNextToolRect.GetWidth()-6)/2-4;
- nY += (maNextToolRect.GetHeight()-6)/2-6;
- }
- else
- {
- bTop = sal_True;
- nY += (maNextToolRect.GetHeight()-6)/2-4;
- nX += (maNextToolRect.GetWidth()-6)/2-6;
- }
-
- nX += maNextToolRect.Left();
- nY += maNextToolRect.Top();
- SetLineColor();
- SetFillColor( COL_LIGHTBLUE );
- ImplDrawToolArrow( this, nX, nY, sal_True, sal_False, bLeft, bTop, 10 );
-}
-
-// -----------------------------------------------------------------------
-
void ToolBox::ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect )
{
bool bNativeOk = false;
@@ -3793,17 +3717,6 @@ sal_Bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat
return sal_True;
}
- if ( mbNextTool )
- {
- sal_Bool bNewIn = maNextToolRect.IsInside( aMousePos );
- if ( bNewIn != mbIn )
- {
- mbIn = bNewIn;
- ImplDrawNext( mbIn );
- }
- return sal_True;
- }
-
return sal_False;
}
@@ -3922,14 +3835,6 @@ sal_Bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCa
ImplDrawSpin( sal_False, sal_False );
return sal_True;
}
- else if ( mbNextTool )
- {
- mbNextTool = sal_False;
- mbIn = sal_False;
- ImplDrawNext( sal_False );
- NextToolBox();
- return sal_True;
- }
return sal_False;
}
@@ -4349,14 +4254,6 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
}
return;
}
- if ( maNextToolRect.IsInside( aMousePos ) )
- {
- StartTracking();
- mbNextTool = sal_True;
- mbIn = sal_True;
- ImplDrawNext( sal_True );
- return;
- }
// Linesizing testen
if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING )
@@ -4458,9 +4355,6 @@ void ToolBox::Paint( const Rectangle& rPaintRect )
ImplDrawSpin( sal_False, sal_False );
}
- // draw NextButton
- ImplDrawNext( sal_False );
-
// draw buttons
sal_uInt16 nHighPos;
if ( mnHighItemId )
@@ -4650,26 +4544,6 @@ void ToolBox::RequestHelp( const HelpEvent& rHEvt )
}
}
}
- else if ( maNextToolRect.IsInside( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ) )
- {
- if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
- {
- // get rectangle
- Rectangle aTempRect = maNextToolRect;
- Point aPt = OutputToScreenPixel( aTempRect.TopLeft() );
- aTempRect.Left() = aPt.X();
- aTempRect.Top() = aPt.Y();
- aPt = OutputToScreenPixel( aTempRect.BottomRight() );
- aTempRect.Right() = aPt.X();
- aTempRect.Bottom() = aPt.Y();
-
- if ( rHEvt.GetMode() & HELPMODE_BALLOON )
- Help::ShowBalloon( this, aTempRect.Center(), aTempRect, maNextToolBoxStr );
- else
- Help::ShowQuickHelp( this, aTempRect, maNextToolBoxStr );
- return;
- }
- }
DockingWindow::RequestHelp( rHEvt );
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index cb699c9..3c924cf 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -536,13 +536,6 @@ void ToolBox::Select()
// -----------------------------------------------------------------------
-void ToolBox::NextToolBox()
-{
- maNextToolBoxHdl.Call( this );
-}
-
-// -----------------------------------------------------------------------
-
void ToolBox::Customize( const ToolBoxCustomizeEvent& )
{
}
commit 5e0acb90224f4aa7a06db03fac56267de6b05bc6
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Wed Jun 13 23:40:05 2012 +0400
so many code to just add a minimal border in the gallery
Change-Id: Id7349d1ff6547afe0f46404340b20132b97ce854
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 70cd657..6a673f5 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -331,7 +331,6 @@ GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId,
maViewBox.SetHelpId( TBX_ID_LIST, HID_GALLERY_LISTVIEW );
maViewBox.SetQuickHelpText( TBX_ID_LIST, GAL_RESSTR(RID_SVXSTR_GALLERY_LISTVIEW) );
- maViewBox.SetBorder( 0, 1 );
MiscHdl( NULL );
maViewBox.SetSelectHdl( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
maViewBox.Show();
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 5d6eae3..705abb6 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -193,8 +193,6 @@ private:
long mnMaxItemWidth; // max item width
long mnMaxItemHeight; // max item height (for standard items)
long mnWinHeight; // max window height (for window items)
- long mnBorderX; // custom border
- long mnBorderY;
long mnLeftBorder; // inner border
long mnTopBorder;
long mnRightBorder;
@@ -516,10 +514,6 @@ public:
void SetFloatingLines( sal_uInt16 nFloatLines );
sal_uInt16 GetFloatingLines() const;
- void SetBorder( long nX, long nY );
- long GetBorderX() const { return mnBorderX; }
- long GetBorderY() const { return mnBorderY; }
-
void SetStyle( WinBits nNewStyle ) { mnWinStyle = nNewStyle; }
WinBits GetStyle() const { return mnWinStyle; }
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 993c107..4ed2388 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -466,24 +466,6 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp
}
}
- if( pThis->mbHorz )
- {
- aTopLineSz.Height() += pThis->mnBorderY;
- if( pThis->mnCurLines == 1 )
- aTopLineSz.Height() += pThis->mnBorderY;
-
- aBottomLineSz.Height() += pThis->mnBorderY;
- }
- else
- {
- aTopLineSz.Width() += pThis->mnBorderX;
- if( pThis->mnCurLines == 1 )
- aTopLineSz.Width() += pThis->mnBorderX;
-
- aBottomLineSz.Width() += pThis->mnBorderX;
- }
-
-
if ( pThis->mnWinStyle & WB_LINESPACING )
{
if( pThis->mbHorz )
@@ -867,11 +849,6 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
}
}
- if ( aSize.Width() )
- aSize.Width() += pThis->mnBorderX*2;
- if ( aSize.Height() )
- aSize.Height() += pThis->mnBorderY*2;
-
return aSize;
}
@@ -1548,8 +1525,6 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
mnMaxItemWidth = 0;
mnMaxItemHeight = 0;
mnWinHeight = 0;
- mnBorderX = 0;
- mnBorderY = 0;
mnLeftBorder = 0;
mnTopBorder = 0;
mnRightBorder = 0;
@@ -2292,8 +2267,8 @@ Size ToolBox::ImplGetOptimalFloatingSize( FloatingSizeMode eMode )
{
// try to preserve current width
long nLineHeight = ( mnWinHeight > mnMaxItemHeight ) ? mnWinHeight : mnMaxItemHeight;
- int nBorderX = 2*TB_BORDER_OFFSET1 + mnLeftBorder + mnRightBorder + 2*mnBorderX;
- int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder + 2*mnBorderY;
+ 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 );
@@ -2446,7 +2421,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
}
// add in all border offsets
- // inner border as well as custom border (mnBorderX, mnBorderY)
if ( mnWinStyle & WB_BORDER )
{
nLeft = TB_BORDER_OFFSET1 + mnLeftBorder;
@@ -2461,11 +2435,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
nBottom = 0;
}
- nLeft += mnBorderX;
- nTop += mnBorderY;
- nBottom += mnBorderY;
- nMax -= mnBorderX*2;
-
// adjust linesize if docked in single-line mode (i.e. when using a clipped item menu)
// we have to center all items in the window height
if( IsMenuEnabled() && !ImplIsFloatingMode() )
@@ -2505,11 +2474,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
nRight = 0;
}
- nLeft += mnBorderX;
- nRight+= mnBorderX;
- nTop += mnBorderY;
- nMax -= mnBorderY*2;
-
// adjust linesize if docked in single-line mode (i.e. when using a clipped item menu)
// we have to center all items in the window height
if( !ImplIsFloatingMode() && IsMenuEnabled() )
@@ -2565,14 +2529,14 @@ void ToolBox::ImplFormat( sal_Bool bResize )
maNextToolRect.Left() = nLeft+nMax;
maNextToolRect.Right() = maNextToolRect.Left()+TB_NEXT_SIZE-1;
maNextToolRect.Top() = nTop;
- maNextToolRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ maNextToolRect.Bottom() = mnDY-mnBottomBorder-TB_BORDER_OFFSET2-1;
}
else
{
maNextToolRect.Top() = nTop+nMax;
maNextToolRect.Bottom() = maNextToolRect.Top()+TB_NEXT_SIZE-1;
maNextToolRect.Left() = nLeft;
- maNextToolRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ maNextToolRect.Right() = mnDX-mnRightBorder-TB_BORDER_OFFSET2-1;
}
}
@@ -2607,13 +2571,13 @@ void ToolBox::ImplFormat( sal_Bool bResize )
{
mpData->maMenubuttonItem.maRect.Right() = mnDX - 2;
mpData->maMenubuttonItem.maRect.Top() = nTop;
- mpData->maMenubuttonItem.maRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ mpData->maMenubuttonItem.maRect.Bottom() = mnDY-mnBottomBorder-TB_BORDER_OFFSET2-1;
}
else
{
- mpData->maMenubuttonItem.maRect.Right() = mnDX - mnRightBorder-mnBorderX-TB_BORDER_OFFSET1-1;
+ mpData->maMenubuttonItem.maRect.Right() = mnDX - mnRightBorder-TB_BORDER_OFFSET1-1;
mpData->maMenubuttonItem.maRect.Top() = nTop;
- mpData->maMenubuttonItem.maRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ mpData->maMenubuttonItem.maRect.Bottom() = mnDY-mnBottomBorder-TB_BORDER_OFFSET2-1;
}
mpData->maMenubuttonItem.maRect.Left() = mpData->maMenubuttonItem.maRect.Right() - mpData->mnMenuButtonWidth;
}
@@ -2622,7 +2586,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
maUpperRect.Left() = nLeft+nMax+TB_SPIN_OFFSET;
maUpperRect.Right() = maUpperRect.Left()+TB_SPIN_SIZE-1;
maUpperRect.Top() = nTop;
- maLowerRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ maLowerRect.Bottom() = mnDY-mnBottomBorder-TB_BORDER_OFFSET2-1;
maLowerRect.Left() = maUpperRect.Left();
maLowerRect.Right() = maUpperRect.Right();
maUpperRect.Bottom() = maUpperRect.Top() +
@@ -2638,13 +2602,13 @@ void ToolBox::ImplFormat( sal_Bool bResize )
{
mpData->maMenubuttonItem.maRect.Bottom() = mnDY - 2;
mpData->maMenubuttonItem.maRect.Left() = nLeft;
- mpData->maMenubuttonItem.maRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ mpData->maMenubuttonItem.maRect.Right() = mnDX-mnRightBorder-TB_BORDER_OFFSET2-1;
}
else
{
- mpData->maMenubuttonItem.maRect.Bottom() = mnDY - mnBottomBorder-mnBorderY-TB_BORDER_OFFSET1-1;
+ mpData->maMenubuttonItem.maRect.Bottom() = mnDY - mnBottomBorder-TB_BORDER_OFFSET1-1;
mpData->maMenubuttonItem.maRect.Left() = nLeft;
- mpData->maMenubuttonItem.maRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ mpData->maMenubuttonItem.maRect.Right() = mnDX-mnRightBorder-TB_BORDER_OFFSET2-1;
}
mpData->maMenubuttonItem.maRect.Top() = mpData->maMenubuttonItem.maRect.Bottom() - mpData->mnMenuButtonWidth;
}
@@ -2653,7 +2617,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
maUpperRect.Top() = nTop+nMax+TB_SPIN_OFFSET;
maUpperRect.Bottom() = maUpperRect.Top()+TB_SPIN_SIZE-1;
maUpperRect.Left() = nLeft;
- maLowerRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ maLowerRect.Right() = mnDX-mnRightBorder-TB_BORDER_OFFSET2-1;
maLowerRect.Top() = maUpperRect.Top();
maLowerRect.Bottom() = maUpperRect.Bottom();
maUpperRect.Right() = maUpperRect.Left() +
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 1e04215..cb699c9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1773,16 +1773,6 @@ rtl::OString ToolBox::GetHelpId( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-void ToolBox::SetBorder( long nX, long nY )
-{
- mnBorderX = nX;
- mnBorderY = nY;
-
- ImplInvalidate( sal_True, sal_True );
-}
-
-// -----------------------------------------------------------------------
-
void ToolBox::SetOutStyle( sal_uInt16 nNewStyle )
{
// always force flat looking toolbars since NWF
More information about the Libreoffice-commits
mailing list