Kaydet (Commit) 60fb87cf authored tarafından Michael Meeks's avatar Michael Meeks

Revert "tdf#91259 Crash when closing Help"

This reverts commit 91b18146.
üst f4578ce1
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <vcl/dockwin.hxx> #include <vcl/dockwin.hxx>
class Wallpaper; class Wallpaper;
class ImplSplitSet; struct ImplSplitSet;
typedef sal_uInt16 SplitWindowItemBits; typedef sal_uInt16 SplitWindowItemBits;
...@@ -145,10 +145,10 @@ public: ...@@ -145,10 +145,10 @@ public:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
void InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, void InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nIntoSetId = 0, sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nSetId = 0,
SplitWindowItemBits nBits = 0 ); SplitWindowItemBits nBits = 0 );
void InsertItem( sal_uInt16 nId, long nSize, void InsertItem( sal_uInt16 nId, long nSize,
sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nIntoSetId = 0, sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nSetId = 0,
SplitWindowItemBits nBits = 0 ); SplitWindowItemBits nBits = 0 );
void RemoveItem( sal_uInt16 nId, bool bHide = true ); void RemoveItem( sal_uInt16 nId, bool bHide = true );
void Clear(); void Clear();
......
...@@ -36,13 +36,10 @@ ...@@ -36,13 +36,10 @@
#include <svdata.hxx> #include <svdata.hxx>
#include <svids.hrc> #include <svids.hrc>
// Attention: Must not contain non-PODs because array is enlarged/copied
class ImplSplitItem // with the use of memmove/memcpy.
struct ImplSplitItem
{ {
public:
~ImplSplitItem();
void dispose();
long mnSize; long mnSize;
long mnPixSize; long mnPixSize;
long mnLeft; long mnLeft;
...@@ -68,56 +65,18 @@ public: ...@@ -68,56 +65,18 @@ public:
long mnMaxSize; long mnMaxSize;
}; };
typedef std::vector< ImplSplitItem* > ImplSplitItems; struct ImplSplitSet
class ImplSplitSet
{ {
public: ImplSplitItem* mpItems;
~ImplSplitSet();
void dispose();
ImplSplitItems mpItems;
Wallpaper* mpWallpaper; Wallpaper* mpWallpaper;
Bitmap* mpBitmap; Bitmap* mpBitmap;
long mnLastSize; long mnLastSize;
long mnSplitSize; long mnSplitSize;
sal_uInt16 mnItems;
sal_uInt16 mnId; sal_uInt16 mnId;
bool mbCalcPix; bool mbCalcPix;
}; };
ImplSplitItem::~ImplSplitItem()
{
dispose();
}
void ImplSplitItem::dispose()
{
if (mpSet)
delete mpSet ;
mpWindow.clear();
mpOrgParent.clear();
}
ImplSplitSet::~ImplSplitSet()
{
dispose();
}
void ImplSplitSet::dispose()
{
size_t nItems = mpItems.size();
for ( size_t i = 0; i < nItems; i++ )
delete mpItems[i];
mpItems.clear();
if ( mpWallpaper )
delete mpWallpaper;
if ( mpBitmap )
delete mpBitmap;
}
/** Check whether the given size is inside the valid range defined by /** Check whether the given size is inside the valid range defined by
[rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return [rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
the upper or lower bound, respectively. Otherwise return the given size the upper or lower bound, respectively. Otherwise return the given size
...@@ -126,12 +85,12 @@ void ImplSplitSet::dispose() ...@@ -126,12 +85,12 @@ void ImplSplitSet::dispose()
size has not lower or upper bound. size has not lower or upper bound.
*/ */
namespace { namespace {
long ValidateSize (const long nSize, const ImplSplitItem* pItem) long ValidateSize (const long nSize, const ImplSplitItem &rItem)
{ {
if (pItem->mnMinSize>=0 && nSize<pItem->mnMinSize) if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize)
return pItem->mnMinSize; return rItem.mnMinSize;
else if (pItem->mnMaxSize>0 && nSize>pItem->mnMaxSize) else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize)
return pItem->mnMaxSize; return rItem.mnMaxSize;
else else
return nSize; return nSize;
} }
...@@ -299,20 +258,20 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId ) ...@@ -299,20 +258,20 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
return pSet; return pSet;
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnId == nId ) if ( pItems[i].mnId == nId )
return pItems[i]->mpSet; return pItems[i].mpSet;
} }
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
ImplSplitSet* pFindSet = ImplFindSet( pItems[i]->mpSet, nId ); ImplSplitSet* pFindSet = ImplFindSet( pItems[i].mpSet, nId );
if ( pFindSet ) if ( pFindSet )
return pFindSet; return pFindSet;
} }
...@@ -324,12 +283,12 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId ) ...@@ -324,12 +283,12 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos ) static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos )
{ {
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnId == nId ) if ( pItems[i].mnId == nId )
{ {
rPos = i; rPos = i;
return pSet; return pSet;
...@@ -338,9 +297,9 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1 ...@@ -338,9 +297,9 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
ImplSplitSet* pFindSet = ImplFindItem( pItems[i]->mpSet, nId, rPos ); ImplSplitSet* pFindSet = ImplFindItem( pItems[i].mpSet, nId, rPos );
if ( pFindSet ) if ( pFindSet )
return pFindSet; return pFindSet;
} }
...@@ -352,18 +311,18 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1 ...@@ -352,18 +311,18 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1
static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, vcl::Window* pWindow ) static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, vcl::Window* pWindow )
{ {
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpWindow == pWindow ) if ( pItems[i].mpWindow == pWindow )
return pItems[i]->mnId; return pItems[i].mnId;
else else
{ {
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
sal_uInt16 nId = ImplFindItem( pItems[i]->mpSet, pWindow ); sal_uInt16 nId = ImplFindItem( pItems[i].mpSet, pWindow );
if ( nId ) if ( nId )
return nId; return nId;
} }
...@@ -377,15 +336,15 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos, ...@@ -377,15 +336,15 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
bool bRows, bool bDown = true ) bool bRows, bool bDown = true )
{ {
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnWidth && pItems[i]->mnHeight ) if ( pItems[i].mnWidth && pItems[i].mnHeight )
{ {
Point aPoint( pItems[i]->mnLeft, pItems[i]->mnTop ); Point aPoint( pItems[i].mnLeft, pItems[i].mnTop );
Size aSize( pItems[i]->mnWidth, pItems[i]->mnHeight ); Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
Rectangle aRect( aPoint, aSize ); Rectangle aRect( aPoint, aSize );
if ( bRows ) if ( bRows )
{ {
...@@ -404,13 +363,13 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos, ...@@ -404,13 +363,13 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
if ( aRect.IsInside( rPos ) ) if ( aRect.IsInside( rPos ) )
{ {
if ( pItems[i]->mpSet && !pItems[i]->mpSet->mpItems.empty() ) if ( pItems[i].mpSet && pItems[i].mpSet->mpItems )
{ {
return ImplFindItem( pItems[i]->mpSet, rPos, return ImplFindItem( pItems[i].mpSet, rPos,
((pItems[i]->mnBits & SWIB_COLSET) == 0) ); ((pItems[i].mnBits & SWIB_COLSET) == 0) );
} }
else else
return pItems[i]->mnId; return pItems[i].mnId;
} }
} }
} }
...@@ -418,19 +377,41 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos, ...@@ -418,19 +377,41 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
return 0; return 0;
} }
static void ImplDeleteSet( ImplSplitSet* pSet )
{
sal_uInt16 i;
sal_uInt16 nItems = pSet->mnItems;
ImplSplitItem* pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ )
{
if ( pItems[i].mpSet )
ImplDeleteSet( pItems[i].mpSet );
}
if ( pSet->mpWallpaper )
delete pSet->mpWallpaper;
if ( pSet->mpBitmap )
delete pSet->mpBitmap;
delete [] pItems;
delete pSet;
}
static void ImplCalcSet( ImplSplitSet* pSet, static void ImplCalcSet( ImplSplitSet* pSet,
long nSetLeft, long nSetTop, long nSetLeft, long nSetTop,
long nSetWidth, long nSetHeight, long nSetWidth, long nSetHeight,
bool bRows, bool bDown = true ) bool bRows, bool bDown = true )
{ {
if ( pSet->mpItems.empty() ) if ( !pSet->mpItems )
return; return;
sal_uInt16 i; sal_uInt16 i;
sal_uInt16 j; sal_uInt16 j;
sal_uInt16 nMins; sal_uInt16 nMins;
sal_uInt16 nCalcItems; sal_uInt16 nCalcItems;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
sal_uInt16 nVisItems; sal_uInt16 nVisItems;
sal_uInt16 nAbsItems; sal_uInt16 nAbsItems;
long nCalcSize; long nCalcSize;
...@@ -444,14 +425,14 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -444,14 +425,14 @@ static void ImplCalcSet( ImplSplitSet* pSet,
long nPos; long nPos;
long nMaxPos; long nMaxPos;
long* pSize; long* pSize;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
bool bEmpty; bool bEmpty;
// get number of visible items // get number of visible items
nVisItems = 0; nVisItems = 0;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
nVisItems++; nVisItems++;
} }
...@@ -471,14 +452,14 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -471,14 +452,14 @@ static void ImplCalcSet( ImplSplitSet* pSet,
long nAbsSize = 0; long nAbsSize = 0;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
{ {
if ( pItems[i]->mnBits & SWIB_RELATIVESIZE ) if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
nRelCount += pItems[i]->mnSize; nRelCount += pItems[i].mnSize;
else if ( pItems[i]->mnBits & SWIB_PERCENTSIZE ) else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
nPercent += pItems[i]->mnSize; nPercent += pItems[i].mnSize;
else else
nAbsSize += pItems[i]->mnSize; nAbsSize += pItems[i].mnSize;
} }
} }
// map relative values to percentages (percentage here one tenth of a procent) // map relative values to percentages (percentage here one tenth of a procent)
...@@ -504,25 +485,25 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -504,25 +485,25 @@ static void ImplCalcSet( ImplSplitSet* pSet,
nSizeDelta = nCalcSize-nAbsSize; nSizeDelta = nCalcSize-nAbsSize;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnBits & SWIB_INVISIBLE ) if ( pItems[i].mnBits & SWIB_INVISIBLE )
pItems[i]->mnPixSize = 0; pItems[i].mnPixSize = 0;
else if ( pItems[i]->mnBits & SWIB_RELATIVESIZE ) else if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
{ {
if ( nSizeDelta <= 0 ) if ( nSizeDelta <= 0 )
pItems[i]->mnPixSize = 0; pItems[i].mnPixSize = 0;
else else
pItems[i]->mnPixSize = (nSizeDelta*pItems[i]->mnSize*nRelPercent)/nPercent; pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nRelPercent)/nPercent;
} }
else if ( pItems[i]->mnBits & SWIB_PERCENTSIZE ) else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
{ {
if ( nSizeDelta <= 0 ) if ( nSizeDelta <= 0 )
pItems[i]->mnPixSize = 0; pItems[i].mnPixSize = 0;
else else
pItems[i]->mnPixSize = (nSizeDelta*pItems[i]->mnSize*nPercentFactor)/nPercent; pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nPercentFactor)/nPercent;
} }
else else
pItems[i]->mnPixSize = pItems[i]->mnSize; pItems[i].mnPixSize = pItems[i].mnSize;
nCurSize += pItems[i]->mnPixSize; nCurSize += pItems[i].mnPixSize;
} }
pSet->mbCalcPix = false; pSet->mbCalcPix = false;
...@@ -539,12 +520,12 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -539,12 +520,12 @@ static void ImplCalcSet( ImplSplitSet* pSet,
// first resize absolute items relative // first resize absolute items relative
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
{ {
if ( !(pItems[i]->mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) ) if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
{ {
nAbsItems++; nAbsItems++;
nSizeWinSize += pItems[i]->mnPixSize; nSizeWinSize += pItems[i].mnPixSize;
} }
} }
} }
...@@ -553,12 +534,12 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -553,12 +534,12 @@ static void ImplCalcSet( ImplSplitSet* pSet,
{ {
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
{ {
if ( !(pItems[i]->mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) ) if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
{ {
pItems[i]->mnPixSize += (nSizeDelta*pItems[i]->mnPixSize)/nSizeWinSize; pItems[i].mnPixSize += (nSizeDelta*pItems[i].mnPixSize)/nSizeWinSize;
nNewSizeWinSize += pItems[i]->mnPixSize; nNewSizeWinSize += pItems[i].mnPixSize;
} }
} }
} }
...@@ -576,28 +557,28 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -576,28 +557,28 @@ static void ImplCalcSet( ImplSplitSet* pSet,
{ {
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
pItems[i]->mbSubSize = false; pItems[i].mbSubSize = false;
if ( j >= 2 ) if ( j >= 2 )
pItems[i]->mbSubSize = true; pItems[i].mbSubSize = true;
else else
{ {
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
{ {
if ( (nSizeDelta > 0) || pItems[i]->mnPixSize ) if ( (nSizeDelta > 0) || pItems[i].mnPixSize )
{ {
if ( j >= 1 ) if ( j >= 1 )
pItems[i]->mbSubSize = true; pItems[i].mbSubSize = true;
else else
{ {
if ( (j == 0) && (pItems[i]->mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) ) if ( (j == 0) && (pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
pItems[i]->mbSubSize = true; pItems[i].mbSubSize = true;
} }
} }
} }
} }
if ( pItems[i]->mbSubSize ) if ( pItems[i].mbSubSize )
nCalcItems++; nCalcItems++;
} }
...@@ -610,11 +591,11 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -610,11 +591,11 @@ static void ImplCalcSet( ImplSplitSet* pSet,
nMins = 0; nMins = 0;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnBits & SWIB_INVISIBLE ) if ( pItems[i].mnBits & SWIB_INVISIBLE )
nMins++; nMins++;
else if ( pItems[i]->mbSubSize ) else if ( pItems[i].mbSubSize )
{ {
pSize = &(pItems[i]->mnPixSize); pSize = &(pItems[i].mnPixSize);
if ( nErrorSum ) if ( nErrorSum )
{ {
...@@ -674,24 +655,24 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -674,24 +655,24 @@ static void ImplCalcSet( ImplSplitSet* pSet,
// order windows and adept values // order windows and adept values
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
pItems[i]->mnOldSplitPos = pItems[i]->mnSplitPos; pItems[i].mnOldSplitPos = pItems[i].mnSplitPos;
pItems[i]->mnOldSplitSize = pItems[i]->mnSplitSize; pItems[i].mnOldSplitSize = pItems[i].mnSplitSize;
pItems[i]->mnOldWidth = pItems[i]->mnWidth; pItems[i].mnOldWidth = pItems[i].mnWidth;
pItems[i]->mnOldHeight = pItems[i]->mnHeight; pItems[i].mnOldHeight = pItems[i].mnHeight;
if ( pItems[i]->mnBits & SWIB_INVISIBLE ) if ( pItems[i].mnBits & SWIB_INVISIBLE )
bEmpty = true; bEmpty = true;
else else
{ {
bEmpty = false; bEmpty = false;
if ( bDown ) if ( bDown )
{ {
if ( nPos+pItems[i]->mnPixSize > nMaxPos ) if ( nPos+pItems[i].mnPixSize > nMaxPos )
bEmpty = true; bEmpty = true;
} }
else else
{ {
nPos -= pItems[i]->mnPixSize; nPos -= pItems[i].mnPixSize;
if ( nPos < nMaxPos ) if ( nPos < nMaxPos )
bEmpty = true; bEmpty = true;
} }
...@@ -699,85 +680,85 @@ static void ImplCalcSet( ImplSplitSet* pSet, ...@@ -699,85 +680,85 @@ static void ImplCalcSet( ImplSplitSet* pSet,
if ( bEmpty ) if ( bEmpty )
{ {
pItems[i]->mnWidth = 0; pItems[i].mnWidth = 0;
pItems[i]->mnHeight = 0; pItems[i].mnHeight = 0;
pItems[i]->mnSplitSize = 0; pItems[i].mnSplitSize = 0;
} }
else else
{ {
if ( bRows ) if ( bRows )
{ {
pItems[i]->mnLeft = nSetLeft; pItems[i].mnLeft = nSetLeft;
pItems[i]->mnTop = nPos; pItems[i].mnTop = nPos;
pItems[i]->mnWidth = nSetWidth; pItems[i].mnWidth = nSetWidth;
pItems[i]->mnHeight = pItems[i]->mnPixSize; pItems[i].mnHeight = pItems[i].mnPixSize;
} }
else else
{ {
pItems[i]->mnLeft = nPos; pItems[i].mnLeft = nPos;
pItems[i]->mnTop = nSetTop; pItems[i].mnTop = nSetTop;
pItems[i]->mnWidth = pItems[i]->mnPixSize; pItems[i].mnWidth = pItems[i].mnPixSize;
pItems[i]->mnHeight = nSetHeight; pItems[i].mnHeight = nSetHeight;
} }
if ( i > nItems-1 ) if ( i > nItems-1 )
pItems[i]->mnSplitSize = 0; pItems[i].mnSplitSize = 0;
else else
{ {
pItems[i]->mnSplitSize = pSet->mnSplitSize; pItems[i].mnSplitSize = pSet->mnSplitSize;
if ( bDown ) if ( bDown )
{ {
pItems[i]->mnSplitPos = nPos+pItems[i]->mnPixSize; pItems[i].mnSplitPos = nPos+pItems[i].mnPixSize;
if ( pItems[i]->mnSplitPos+pItems[i]->mnSplitSize > nMaxPos ) if ( pItems[i].mnSplitPos+pItems[i].mnSplitSize > nMaxPos )
pItems[i]->mnSplitSize = nMaxPos-pItems[i]->mnSplitPos; pItems[i].mnSplitSize = nMaxPos-pItems[i].mnSplitPos;
} }
else else
{ {
pItems[i]->mnSplitPos = nPos-pSet->mnSplitSize; pItems[i].mnSplitPos = nPos-pSet->mnSplitSize;
if ( pItems[i]->mnSplitPos < nMaxPos ) if ( pItems[i].mnSplitPos < nMaxPos )
pItems[i]->mnSplitSize = pItems[i]->mnSplitPos+pSet->mnSplitSize-nMaxPos; pItems[i].mnSplitSize = pItems[i].mnSplitPos+pSet->mnSplitSize-nMaxPos;
} }
} }
} }
if ( !(pItems[i]->mnBits & SWIB_INVISIBLE) ) if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
{ {
if ( !bDown ) if ( !bDown )
nPos -= pSet->mnSplitSize; nPos -= pSet->mnSplitSize;
else else
nPos += pItems[i]->mnPixSize+pSet->mnSplitSize; nPos += pItems[i].mnPixSize+pSet->mnSplitSize;
} }
} }
// calculate Sub-Set's // calculate Sub-Set's
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpSet && pItems[i]->mnWidth && pItems[i]->mnHeight ) if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
{ {
ImplCalcSet( pItems[i]->mpSet, ImplCalcSet( pItems[i].mpSet,
pItems[i]->mnLeft, pItems[i]->mnTop, pItems[i].mnLeft, pItems[i].mnTop,
pItems[i]->mnWidth, pItems[i]->mnHeight, pItems[i].mnWidth, pItems[i].mnHeight,
((pItems[i]->mnBits & SWIB_COLSET) == 0) ); ((pItems[i].mnBits & SWIB_COLSET) == 0) );
} }
} }
// set fixed // set fixed
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
pItems[i]->mbFixed = false; pItems[i].mbFixed = false;
if ( pItems[i]->mnBits & SWIB_FIXED ) if ( pItems[i].mnBits & SWIB_FIXED )
pItems[i]->mbFixed = true; pItems[i].mbFixed = true;
else else
{ {
// this item is also fixed if Child-Set is available, // this item is also fixed if Child-Set is available,
// if a child is fixed // if a child is fixed
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
for ( j = 0; j < pItems[i]->mpSet->mpItems.size(); j++ ) for ( j = 0; j < pItems[i].mpSet->mnItems; j++ )
{ {
if ( pItems[i]->mpSet->mpItems[j]->mbFixed ) if ( pItems[i].mpSet->mpItems[j].mbFixed )
{ {
pItems[i]->mbFixed = true; pItems[i].mbFixed = true;
break; break;
} }
} }
...@@ -790,64 +771,64 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b ...@@ -790,64 +771,64 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b
bool bRows, bool /*bDown*/ ) bool bRows, bool /*bDown*/ )
{ {
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate ) if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
{ {
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnSplitSize ) if ( pItems[i].mnSplitSize )
{ {
// invalidate all, if applicable or only a small part // invalidate all, if applicable or only a small part
if ( (pItems[i]->mnOldSplitPos != pItems[i]->mnSplitPos) || if ( (pItems[i].mnOldSplitPos != pItems[i].mnSplitPos) ||
(pItems[i]->mnOldSplitSize != pItems[i]->mnSplitSize) || (pItems[i].mnOldSplitSize != pItems[i].mnSplitSize) ||
(pItems[i]->mnOldWidth != pItems[i]->mnWidth) || (pItems[i].mnOldWidth != pItems[i].mnWidth) ||
(pItems[i]->mnOldHeight != pItems[i]->mnHeight) ) (pItems[i].mnOldHeight != pItems[i].mnHeight) )
{ {
Rectangle aRect; Rectangle aRect;
// invalidate old rectangle // invalidate old rectangle
if ( bRows ) if ( bRows )
{ {
aRect.Left() = pItems[i]->mnLeft; aRect.Left() = pItems[i].mnLeft;
aRect.Right() = pItems[i]->mnLeft+pItems[i]->mnOldWidth-1; aRect.Right() = pItems[i].mnLeft+pItems[i].mnOldWidth-1;
aRect.Top() = pItems[i]->mnOldSplitPos; aRect.Top() = pItems[i].mnOldSplitPos;
aRect.Bottom() = aRect.Top() + pItems[i]->mnOldSplitSize; aRect.Bottom() = aRect.Top() + pItems[i].mnOldSplitSize;
} }
else else
{ {
aRect.Top() = pItems[i]->mnTop; aRect.Top() = pItems[i].mnTop;
aRect.Bottom() = pItems[i]->mnTop+pItems[i]->mnOldHeight-1; aRect.Bottom() = pItems[i].mnTop+pItems[i].mnOldHeight-1;
aRect.Left() = pItems[i]->mnOldSplitPos; aRect.Left() = pItems[i].mnOldSplitPos;
aRect.Right() = aRect.Left() + pItems[i]->mnOldSplitSize; aRect.Right() = aRect.Left() + pItems[i].mnOldSplitSize;
} }
pWindow->Invalidate( aRect ); pWindow->Invalidate( aRect );
// invalidate new rectangle // invalidate new rectangle
if ( bRows ) if ( bRows )
{ {
aRect.Left() = pItems[i]->mnLeft; aRect.Left() = pItems[i].mnLeft;
aRect.Right() = pItems[i]->mnLeft+pItems[i]->mnWidth-1; aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
aRect.Top() = pItems[i]->mnSplitPos; aRect.Top() = pItems[i].mnSplitPos;
aRect.Bottom() = aRect.Top() + pItems[i]->mnSplitSize; aRect.Bottom() = aRect.Top() + pItems[i].mnSplitSize;
} }
else else
{ {
aRect.Top() = pItems[i]->mnTop; aRect.Top() = pItems[i].mnTop;
aRect.Bottom() = pItems[i]->mnTop+pItems[i]->mnHeight-1; aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
aRect.Left() = pItems[i]->mnSplitPos; aRect.Left() = pItems[i].mnSplitPos;
aRect.Right() = aRect.Left() + pItems[i]->mnSplitSize; aRect.Right() = aRect.Left() + pItems[i].mnSplitSize;
} }
pWindow->Invalidate( aRect ); pWindow->Invalidate( aRect );
// invalidate complete set, as these areas // invalidate complete set, as these areas
// are not cluttered by windows // are not cluttered by windows
if ( pItems[i]->mpSet && pItems[i]->mpSet->mpItems.empty() ) if ( pItems[i].mpSet && !pItems[i].mpSet->mpItems )
{ {
aRect.Left() = pItems[i]->mnLeft; aRect.Left() = pItems[i].mnLeft;
aRect.Top() = pItems[i]->mnTop; aRect.Top() = pItems[i].mnTop;
aRect.Right() = pItems[i]->mnLeft+pItems[i]->mnWidth-1; aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
aRect.Bottom() = pItems[i]->mnTop+pItems[i]->mnHeight-1; aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
pWindow->Invalidate( aRect ); pWindow->Invalidate( aRect );
} }
} }
...@@ -858,68 +839,67 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b ...@@ -858,68 +839,67 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b
// position windows // position windows
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
bool bTempHide = bHide; bool bTempHide = bHide;
if ( !pItems[i]->mnWidth || !pItems[i]->mnHeight ) if ( !pItems[i].mnWidth || !pItems[i].mnHeight )
bTempHide = true; bTempHide = true;
ImplCalcSet2( pWindow, pItems[i]->mpSet, bTempHide, ImplCalcSet2( pWindow, pItems[i].mpSet, bTempHide,
((pItems[i]->mnBits & SWIB_COLSET) == 0) ); ((pItems[i].mnBits & SWIB_COLSET) == 0) );
} }
else else
{ {
if ( pItems[i]->mnWidth && pItems[i]->mnHeight && !bHide ) if ( pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
{ {
Point aPos( pItems[i]->mnLeft, pItems[i]->mnTop ); Point aPos( pItems[i].mnLeft, pItems[i].mnTop );
Size aSize( pItems[i]->mnWidth, pItems[i]->mnHeight ); Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
pItems[i]->mpWindow->SetPosSizePixel( aPos, aSize ); pItems[i].mpWindow->SetPosSizePixel( aPos, aSize );
} }
else else
pItems[i]->mpWindow->Hide(); pItems[i].mpWindow->Hide();
} }
} }
// show windows and reset flag // show windows and reset flag
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpWindow && pItems[i]->mnWidth && pItems[i]->mnHeight && !bHide ) if ( pItems[i].mpWindow && pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
pItems[i]->mpWindow->Show(); pItems[i].mpWindow->Show();
} }
} }
static void ImplCalcLogSize( ImplSplitItems pItems, size_t nItems ) static void ImplCalcLogSize( ImplSplitItem* pItems, sal_uInt16 nItems )
{ {
// update original sizes // update original sizes
size_t i; sal_uInt16 i;
long nRelSize = 0; long nRelSize = 0;
long nPerSize = 0; long nPerSize = 0;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnBits & SWIB_RELATIVESIZE ) if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
nRelSize += pItems[i]->mnPixSize; nRelSize += pItems[i].mnPixSize;
else if ( pItems[i]->mnBits & SWIB_PERCENTSIZE ) else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
nPerSize += pItems[i]->mnPixSize; nPerSize += pItems[i].mnPixSize;
} }
nPerSize += nRelSize; nPerSize += nRelSize;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mnBits & SWIB_RELATIVESIZE ) if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
{ {
if ( nRelSize ) if ( nRelSize )
pItems[i]->mnSize = (pItems[i]->mnPixSize+(nRelSize/2))/nRelSize; pItems[i].mnSize = (pItems[i].mnPixSize+(nRelSize/2))/nRelSize;
else else
pItems[i]->mnSize = 1; pItems[i].mnSize = 1;
} }
else if ( pItems[i]->mnBits & SWIB_PERCENTSIZE ) else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
{ {
if ( nPerSize ) if ( nPerSize )
pItems[i]->mnSize = (pItems[i]->mnPixSize*100)/nPerSize; pItems[i].mnSize = (pItems[i].mnPixSize*100)/nPerSize;
else else
pItems[i]->mnSize = 1; pItems[i].mnSize = 1;
} }
else else
pItems[i]->mnSize = pItems[i]->mnPixSize; pItems[i].mnSize = pItems[i].mnPixSize;
} }
} }
...@@ -955,8 +935,8 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, const Rectang ...@@ -955,8 +935,8 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, const Rectang
void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet) void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet)
{ {
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
// also draw background for mainset // also draw background for mainset
if (pSet->mnId == 0) if (pSet->mnId == 0)
...@@ -973,13 +953,13 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* ...@@ -973,13 +953,13 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
for (i = 0; i < nItems; i++) for (i = 0; i < nItems; i++)
{ {
pSet = pItems[i]->mpSet; pSet = pItems[i].mpSet;
if (pSet) if (pSet)
{ {
if (pSet->mpBitmap || pSet->mpWallpaper) if (pSet->mpBitmap || pSet->mpWallpaper)
{ {
Point aPoint(pItems[i]->mnLeft, pItems[i]->mnTop); Point aPoint(pItems[i].mnLeft, pItems[i].mnTop);
Size aSize(pItems[i]->mnWidth, pItems[i]->mnHeight); Size aSize(pItems[i].mnWidth, pItems[i].mnHeight);
Rectangle aRect(aPoint, aSize); Rectangle aRect(aPoint, aSize);
ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper, pSet->mpBitmap); ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper, pSet->mpBitmap);
} }
...@@ -988,36 +968,36 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* ...@@ -988,36 +968,36 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
for (i = 0; i < nItems; i++) for (i = 0; i < nItems; i++)
{ {
if (pItems[i]->mpSet) if (pItems[i].mpSet)
ImplDrawBack(rRenderContext, pItems[i]->mpSet); ImplDrawBack(rRenderContext, pItems[i].mpSet);
} }
} }
static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet, bool bRows, bool bFlat, bool bDown = true) static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet, bool bRows, bool bFlat, bool bDown = true)
{ {
if (pSet->mpItems.empty()) if (!pSet->mpItems)
return; return;
sal_uInt16 i; sal_uInt16 i;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
long nPos; long nPos;
long nTop; long nTop;
long nBottom; long nBottom;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
for (i = 0; i < nItems-1; i++) for (i = 0; i < nItems-1; i++)
{ {
if (pItems[i]->mnSplitSize) if (pItems[i].mnSplitSize)
{ {
nPos = pItems[i]->mnSplitPos; nPos = pItems[i].mnSplitPos;
long nItemSplitSize = pItems[i]->mnSplitSize; long nItemSplitSize = pItems[i].mnSplitSize;
long nSplitSize = pSet->mnSplitSize; long nSplitSize = pSet->mnSplitSize;
if (bRows) if (bRows)
{ {
nTop = pItems[i]->mnLeft; nTop = pItems[i].mnLeft;
nBottom = pItems[i]->mnLeft+pItems[i]->mnWidth-1; nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
if (bFlat) if (bFlat)
nPos--; nPos--;
...@@ -1048,8 +1028,8 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet ...@@ -1048,8 +1028,8 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet
} }
else else
{ {
nTop = pItems[i]->mnTop; nTop = pItems[i].mnTop;
nBottom = pItems[i]->mnTop+pSet->mpItems[i]->mnHeight-1; nBottom = pItems[i].mnTop+pSet->mpItems[i].mnHeight-1;
if (bFlat) if (bFlat)
nPos--; nPos--;
...@@ -1082,9 +1062,9 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet ...@@ -1082,9 +1062,9 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet
for (i = 0; i < nItems; i++) for (i = 0; i < nItems; i++)
{ {
if (pItems[i]->mpSet && pItems[i]->mnWidth && pItems[i]->mnHeight) if (pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight)
{ {
ImplDrawSplit(rRenderContext, pItems[i]->mpSet, ((pItems[i]->mnBits & SWIB_COLSET) == 0), bFlat); ImplDrawSplit(rRenderContext, pItems[i].mpSet, ((pItems[i].mnBits & SWIB_COLSET) == 0), bFlat);
} }
} }
} }
...@@ -1093,18 +1073,18 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, ...@@ -1093,18 +1073,18 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos, long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
bool bRows, bool /*bDown*/ ) bool bRows, bool /*bDown*/ )
{ {
if ( pSet->mpItems.empty() ) if ( !pSet->mpItems )
return 0; return 0;
sal_uInt16 i; sal_uInt16 i;
sal_uInt16 nSplitTest; sal_uInt16 nSplitTest;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
long nMPos1; long nMPos1;
long nMPos2; long nMPos2;
long nPos; long nPos;
long nTop; long nTop;
long nBottom; long nBottom;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
if ( bRows ) if ( bRows )
{ {
...@@ -1119,24 +1099,24 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, ...@@ -1119,24 +1099,24 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
for ( i = 0; i < nItems-1; i++ ) for ( i = 0; i < nItems-1; i++ )
{ {
if ( pItems[i]->mnSplitSize ) if ( pItems[i].mnSplitSize )
{ {
if ( bRows ) if ( bRows )
{ {
nTop = pItems[i]->mnLeft; nTop = pItems[i].mnLeft;
nBottom = pItems[i]->mnLeft+pItems[i]->mnWidth-1; nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
} }
else else
{ {
nTop = pItems[i]->mnTop; nTop = pItems[i].mnTop;
nBottom = pItems[i]->mnTop+pItems[i]->mnHeight-1; nBottom = pItems[i].mnTop+pItems[i].mnHeight-1;
} }
nPos = pItems[i]->mnSplitPos; nPos = pItems[i].mnSplitPos;
if ( (nMPos1 >= nTop) && (nMPos1 <= nBottom) && if ( (nMPos1 >= nTop) && (nMPos1 <= nBottom) &&
(nMPos2 >= nPos) && (nMPos2 <= nPos+pItems[i]->mnSplitSize) ) (nMPos2 >= nPos) && (nMPos2 <= nPos+pItems[i].mnSplitSize) )
{ {
if ( !pItems[i]->mbFixed && !pItems[i+1]->mbFixed ) if ( !pItems[i].mbFixed && !pItems[i+1].mbFixed )
{ {
rMouseOff = nMPos2-nPos; rMouseOff = nMPos2-nPos;
*ppFoundSet = pSet; *ppFoundSet = pSet;
...@@ -1154,11 +1134,11 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, ...@@ -1154,11 +1134,11 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( pItems[i]->mpSet ) if ( pItems[i].mpSet )
{ {
nSplitTest = ImplTestSplit( pItems[i]->mpSet, rPos, nSplitTest = ImplTestSplit( pItems[i].mpSet, rPos,
rMouseOff, ppFoundSet, rFoundPos, rMouseOff, ppFoundSet, rFoundPos,
((pItems[i]->mnBits & SWIB_COLSET) == 0) ); ((pItems[i].mnBits & SWIB_COLSET) == 0) );
if ( nSplitTest ) if ( nSplitTest )
return nSplitTest; return nSplitTest;
} }
...@@ -1214,8 +1194,8 @@ sal_uInt16 SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos, ...@@ -1214,8 +1194,8 @@ sal_uInt16 SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
{ {
rMouseOff = nTPos-nPos; rMouseOff = nTPos-nPos;
*ppFoundSet = pWindow->mpMainSet; *ppFoundSet = pWindow->mpMainSet;
if ( !pWindow->mpMainSet->mpItems.empty() ) if ( pWindow->mpMainSet->mpItems )
rFoundPos = pWindow->mpMainSet->mpItems.size() - 1; rFoundPos = pWindow->mpMainSet->mnItems-1;
else else
rFoundPos = 0; rFoundPos = 0;
if ( pWindow->mbHorz ) if ( pWindow->mbHorz )
...@@ -1267,9 +1247,11 @@ void SplitWindow::ImplDrawSplitTracking(const Point& rPos) ...@@ -1267,9 +1247,11 @@ void SplitWindow::ImplDrawSplitTracking(const Point& rPos)
void SplitWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) void SplitWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
ImplSplitSet* pNewSet = new ImplSplitSet; ImplSplitSet* pNewSet = new ImplSplitSet;
pNewSet->mpItems = NULL;
pNewSet->mpWallpaper = NULL; pNewSet->mpWallpaper = NULL;
pNewSet->mpBitmap = NULL; pNewSet->mpBitmap = NULL;
pNewSet->mnLastSize = 0; pNewSet->mnLastSize = 0;
pNewSet->mnItems = 0;
pNewSet->mnId = 0; pNewSet->mnId = 0;
pNewSet->mnSplitSize = SPLITWIN_SPLITSIZE; pNewSet->mnSplitSize = SPLITWIN_SPLITSIZE;
pNewSet->mbCalcPix = true; pNewSet->mbCalcPix = true;
...@@ -1375,7 +1357,7 @@ void SplitWindow::dispose() ...@@ -1375,7 +1357,7 @@ void SplitWindow::dispose()
{ {
// delete Sets // delete Sets
if (mpMainSet) if (mpMainSet)
delete mpMainSet ; ImplDeleteSet( mpMainSet );
mpMainSet = NULL; //NULL for base-class callbacks during dtoring mpMainSet = NULL; //NULL for base-class callbacks during dtoring
DockingWindow::dispose(); DockingWindow::dispose();
} }
...@@ -1436,15 +1418,15 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) ...@@ -1436,15 +1418,15 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
long nCalcSize = 0; long nCalcSize = 0;
sal_uInt16 i; sal_uInt16 i;
for ( i = 0; i < mpMainSet->mpItems.size(); i++ ) for ( i = 0; i < mpMainSet->mnItems; i++ )
{ {
if ( mpMainSet->mpItems[i]->mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) ) if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
break; break;
else else
nCalcSize += mpMainSet->mpItems[i]->mnSize; nCalcSize += mpMainSet->mpItems[i].mnSize;
} }
if ( i == mpMainSet->mpItems.size() ) if ( i == mpMainSet->mnItems )
{ {
long nDelta = 0; long nDelta = 0;
Point aPos = GetPosPixel(); Point aPos = GetPosPixel();
...@@ -1454,7 +1436,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) ...@@ -1454,7 +1436,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
else else
nCurSize = aNewSize.Width()-mnLeftBorder-mnRightBorder; nCurSize = aNewSize.Width()-mnLeftBorder-mnRightBorder;
nCurSize -= nSplitSize; nCurSize -= nSplitSize;
nCurSize -= (mpMainSet->mpItems.size()-1)*mpMainSet->mnSplitSize; nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
nDelta = nCalcSize-nCurSize; nDelta = nCalcSize-nCurSize;
if ( !nDelta ) if ( !nDelta )
...@@ -1486,7 +1468,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) ...@@ -1486,7 +1468,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
void SplitWindow::ImplCalcLayout() void SplitWindow::ImplCalcLayout()
{ {
if ( !mbCalc || !mbRecalc || mpMainSet->mpItems.empty() ) if ( !mbCalc || !mbRecalc || !mpMainSet->mpItems )
return; return;
long nSplitSize = mpMainSet->mnSplitSize-2; long nSplitSize = mpMainSet->mnSplitSize-2;
...@@ -1501,22 +1483,22 @@ void SplitWindow::ImplCalcLayout() ...@@ -1501,22 +1483,22 @@ void SplitWindow::ImplCalcLayout()
long nCalcSize = 0; long nCalcSize = 0;
sal_uInt16 i; sal_uInt16 i;
for ( i = 0; i < mpMainSet->mpItems.size(); i++ ) for ( i = 0; i < mpMainSet->mnItems; i++ )
{ {
if ( mpMainSet->mpItems[i]->mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) ) if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
break; break;
else else
nCalcSize += mpMainSet->mpItems[i]->mnSize; nCalcSize += mpMainSet->mpItems[i].mnSize;
} }
if ( i == mpMainSet->mpItems.size() ) if ( i == mpMainSet->mnItems )
{ {
if ( mbHorz ) if ( mbHorz )
nCurSize = mnDY-mnTopBorder-mnBottomBorder; nCurSize = mnDY-mnTopBorder-mnBottomBorder;
else else
nCurSize = mnDX-mnLeftBorder-mnRightBorder; nCurSize = mnDX-mnLeftBorder-mnRightBorder;
nCurSize -= nSplitSize; nCurSize -= nSplitSize;
nCurSize -= (mpMainSet->mpItems.size()-1)*mpMainSet->mnSplitSize; nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
mbRecalc = false; mbRecalc = false;
ImplSetWindowSize( nCalcSize-nCurSize ); ImplSetWindowSize( nCalcSize-nCurSize );
...@@ -1571,7 +1553,7 @@ void SplitWindow::ImplUpdate() ...@@ -1571,7 +1553,7 @@ void SplitWindow::ImplUpdate()
if ( IsReallyShown() && IsUpdateMode() && mbRecalc ) if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
{ {
if ( !mpMainSet->mpItems.empty() ) if ( mpMainSet->mpItems )
ImplCalcLayout(); ImplCalcLayout();
else else
Invalidate(); Invalidate();
...@@ -2000,7 +1982,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) ...@@ -2000,7 +1982,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
bool bPropSmaller; bool bPropSmaller;
mnMouseModifier = rMEvt.GetModifier(); mnMouseModifier = rMEvt.GetModifier();
if ( !(mnMouseModifier & KEY_SHIFT) || (static_cast<sal_uInt16>(mnSplitPos+1) >= mpSplitSet->mpItems.size()) ) if ( !(mnMouseModifier & KEY_SHIFT) || (mnSplitPos+1 >= mpSplitSet->mnItems) )
bPropSmaller = false; bPropSmaller = false;
else else
bPropSmaller = true; bPropSmaller = true;
...@@ -2019,13 +2001,13 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) ...@@ -2019,13 +2001,13 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
nCurMaxSize = aSize.Width(); nCurMaxSize = aSize.Width();
} }
if ( !mpSplitSet->mpItems.empty() ) if ( mpSplitSet->mpItems )
{ {
bool bDown = true; bool bDown = true;
if ( (mpSplitSet == mpMainSet) && mbBottomRight ) if ( (mpSplitSet == mpMainSet) && mbBottomRight )
bDown = false; bDown = false;
pSplitItem = mpSplitSet->mpItems[mnSplitPos]; pSplitItem = &(mpSplitSet->mpItems[mnSplitPos]);
maDragRect.Left() = pSplitItem->mnLeft; maDragRect.Left() = pSplitItem->mnLeft;
maDragRect.Top() = pSplitItem->mnTop; maDragRect.Top() = pSplitItem->mnTop;
maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1; maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1;
...@@ -2051,7 +2033,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) ...@@ -2051,7 +2033,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
nTemp = mnSplitPos; nTemp = mnSplitPos;
while ( nTemp ) while ( nTemp )
{ {
pSplitItem = mpSplitSet->mpItems[nTemp-1]; pSplitItem = &(mpSplitSet->mpItems[nTemp-1]);
if ( pSplitItem->mbFixed ) if ( pSplitItem->mbFixed )
break; break;
else else
...@@ -2095,9 +2077,9 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) ...@@ -2095,9 +2077,9 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
else else
{ {
nTemp = mnSplitPos+1; nTemp = mnSplitPos+1;
while ( nTemp < mpSplitSet->mpItems.size() ) while ( nTemp < mpSplitSet->mnItems )
{ {
pSplitItem = mpSplitSet->mpItems[nTemp]; pSplitItem = &(mpSplitSet->mpItems[nTemp]);
if ( pSplitItem->mbFixed ) if ( pSplitItem->mbFixed )
break; break;
else else
...@@ -2155,13 +2137,13 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) ...@@ -2155,13 +2137,13 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
} }
else else
{ {
ImplSplitItems& pItems = mpSplitSet->mpItems; ImplSplitItem* pItems = mpSplitSet->mpItems;
sal_uInt16 nItems = mpSplitSet->mpItems.size(); sal_uInt16 nItems = mpSplitSet->mnItems;
mpLastSizes = new long[nItems*2]; mpLastSizes = new long[nItems*2];
for ( sal_uInt16 i = 0; i < nItems; i++ ) for ( sal_uInt16 i = 0; i < nItems; i++ )
{ {
mpLastSizes[i*2] = pItems[i]->mnSize; mpLastSizes[i*2] = pItems[i].mnSize;
mpLastSizes[i*2+1] = pItems[i]->mnPixSize; mpLastSizes[i*2+1] = pItems[i].mnPixSize;
} }
} }
mnMStartPos = mnMSplitPos; mnMStartPos = mnMSplitPos;
...@@ -2401,12 +2383,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) ...@@ -2401,12 +2383,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
{ {
if ( rTEvt.IsTrackingCanceled() ) if ( rTEvt.IsTrackingCanceled() )
{ {
ImplSplitItems& pItems = mpSplitSet->mpItems; ImplSplitItem* pItems = mpSplitSet->mpItems;
size_t nItems = pItems.size(); sal_uInt16 nItems = mpSplitSet->mnItems;
for ( sal_uInt16 i = 0; i < nItems; i++ ) for ( sal_uInt16 i = 0; i < nItems; i++ )
{ {
pItems[i]->mnSize = mpLastSizes[i*2]; pItems[i].mnSize = mpLastSizes[i*2];
pItems[i]->mnPixSize = mpLastSizes[i*2+1]; pItems[i].mnPixSize = mpLastSizes[i*2+1];
} }
ImplUpdate(); ImplUpdate();
Split(); Split();
...@@ -2434,7 +2416,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) ...@@ -2434,7 +2416,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
bool bPropGreater = (mnMouseModifier & KEY_MOD1) != 0; bool bPropGreater = (mnMouseModifier & KEY_MOD1) != 0;
long nDelta = mnMSplitPos-mnMStartPos; long nDelta = mnMSplitPos-mnMStartPos;
if ( (mnSplitTest & SPLIT_WINDOW) && mpMainSet->mpItems.empty() ) if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
{ {
if ( (mpSplitSet == mpMainSet) && mbBottomRight ) if ( (mpSplitSet == mpMainSet) && mbBottomRight )
nDelta *= -1; nDelta *= -1;
...@@ -2442,12 +2424,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) ...@@ -2442,12 +2424,12 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
} }
else else
{ {
long nNewSize = mpSplitSet->mpItems[mnSplitPos]->mnPixSize; long nNewSize = mpSplitSet->mpItems[mnSplitPos].mnPixSize;
if ( (mpSplitSet == mpMainSet) && mbBottomRight ) if ( (mpSplitSet == mpMainSet) && mbBottomRight )
nNewSize -= nDelta; nNewSize -= nDelta;
else else
nNewSize += nDelta; nNewSize += nDelta;
SplitItem( mpSplitSet->mpItems[mnSplitPos]->mnId, nNewSize, SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
bPropSmaller, bPropGreater ); bPropSmaller, bPropGreater );
} }
...@@ -2631,7 +2613,7 @@ void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -2631,7 +2613,7 @@ void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt )
} }
void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
sal_uInt16 nPos, sal_uInt16 nIntoSetId, sal_uInt16 nPos, sal_uInt16 nSetId,
SplitWindowItemBits nBits ) SplitWindowItemBits nBits )
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
...@@ -2643,7 +2625,7 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ...@@ -2643,7 +2625,7 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
if ( nSize < 1 ) if ( nSize < 1 )
nSize = 1; nSize = 1;
ImplSplitSet* pSet = ImplFindSet( mpMainSet, nIntoSetId ); ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
#ifdef DBG_UTIL #ifdef DBG_UTIL
DBG_ASSERT( pSet, "SplitWindow::InsertItem() - Set not exists" ); DBG_ASSERT( pSet, "SplitWindow::InsertItem() - Set not exists" );
#endif #endif
...@@ -2651,13 +2633,25 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ...@@ -2651,13 +2633,25 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
{ {
return; return;
} }
ImplSplitSet* pNewSet;
ImplSplitItem* pItem;
// Don't insert further than the end // Make room for the new item.
if ( nPos > pSet->mpItems.size() ) if ( nPos > pSet->mnItems )
nPos = pSet->mpItems.size(); nPos = pSet->mnItems;
ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
if ( nPos )
memcpy( pNewItems, pSet->mpItems, sizeof( ImplSplitItem )*nPos );
if ( nPos < pSet->mnItems )
memcpy( pNewItems+nPos+1, pSet->mpItems+nPos, sizeof( ImplSplitItem )*(pSet->mnItems-nPos) );
delete[] pSet->mpItems;
pSet->mpItems = pNewItems;
pSet->mnItems++;
pSet->mbCalcPix = true;
// Create new item // Create and initialize item.
ImplSplitItem* pItem = new ImplSplitItem(); pItem = &(pSet->mpItems[nPos]);
memset( pItem, 0, sizeof( ImplSplitItem ) );
pItem->mnSize = nSize; pItem->mnSize = nSize;
pItem->mnId = nId; pItem->mnId = nId;
pItem->mnBits = nBits; pItem->mnBits = nBits;
...@@ -2666,7 +2660,6 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ...@@ -2666,7 +2660,6 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
if ( pWindow ) if ( pWindow )
{ {
// New VclPtr reference
pItem->mpWindow = pWindow; pItem->mpWindow = pWindow;
pItem->mpOrgParent = pWindow->GetParent(); pItem->mpOrgParent = pWindow->GetParent();
...@@ -2676,10 +2669,12 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ...@@ -2676,10 +2669,12 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
} }
else else
{ {
ImplSplitSet * pNewSet = new ImplSplitSet(); pNewSet = new ImplSplitSet;
pNewSet->mpItems = NULL;
pNewSet->mpWallpaper = NULL; pNewSet->mpWallpaper = NULL;
pNewSet->mpBitmap = NULL; pNewSet->mpBitmap = NULL;
pNewSet->mnLastSize = 0; pNewSet->mnLastSize = 0;
pNewSet->mnItems = 0;
pNewSet->mnId = nId; pNewSet->mnId = nId;
pNewSet->mnSplitSize = pSet->mnSplitSize; pNewSet->mnSplitSize = pSet->mnSplitSize;
pNewSet->mbCalcPix = true; pNewSet->mbCalcPix = true;
...@@ -2687,18 +2682,14 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ...@@ -2687,18 +2682,14 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize,
pItem->mpSet = pNewSet; pItem->mpSet = pNewSet;
} }
// Insert in set
pSet->mpItems.insert( pSet->mpItems.begin() + nPos, pItem );
pSet->mbCalcPix = true;
ImplUpdate(); ImplUpdate();
} }
void SplitWindow::InsertItem( sal_uInt16 nId, long nSize, void SplitWindow::InsertItem( sal_uInt16 nId, long nSize,
sal_uInt16 nPos, sal_uInt16 nIntoSetId, sal_uInt16 nPos, sal_uInt16 nSetId,
SplitWindowItemBits nBits ) SplitWindowItemBits nBits )
{ {
InsertItem( nId, NULL, nSize, nPos, nIntoSetId, nBits ); InsertItem( nId, NULL, nSize, nPos, nSetId, nBits );
} }
void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide ) void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide )
...@@ -2715,19 +2706,27 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide ) ...@@ -2715,19 +2706,27 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide )
if (!pSet) if (!pSet)
return; return;
ImplSplitItem* pItem = pSet->mpItems[nPos]; ImplSplitItem* pItem = &(pSet->mpItems[nPos]);
VclPtr<vcl::Window> pWindow = pItem->mpWindow; vcl::Window* pWindow = pItem->mpWindow;
VclPtr<vcl::Window> pOrgParent = pItem->mpOrgParent; vcl::Window* pOrgParent = pItem->mpOrgParent;
// delete set if required // delete set if required
if ( !pWindow ) { if ( !pWindow )
delete pItem->mpSet ; ImplDeleteSet( pItem->mpSet );
pItem->mpSet = NULL;
}
// remove item // remove item
pSet->mnItems--;
pSet->mbCalcPix = true; pSet->mbCalcPix = true;
pSet->mpItems.erase( pSet->mpItems.begin() + nPos ); if ( pSet->mnItems )
{
memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
(pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
}
else
{
delete[] pSet->mpItems;
pSet->mpItems = NULL;
}
ImplUpdate(); ImplUpdate();
...@@ -2741,23 +2740,20 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide ) ...@@ -2741,23 +2740,20 @@ void SplitWindow::RemoveItem( sal_uInt16 nId, bool bHide )
pWindow->SetParent( pOrgParent ); pWindow->SetParent( pOrgParent );
} }
} }
// Clear and delete
delete pItem;
pWindow.clear();
pOrgParent.clear();
} }
void SplitWindow::Clear() void SplitWindow::Clear()
{ {
// delete all sets // delete all sets
delete mpMainSet ; ImplDeleteSet( mpMainSet );
// create Main-Set again // create Main-Set again
mpMainSet = new ImplSplitSet(); mpMainSet = new ImplSplitSet;
mpMainSet->mpItems = NULL;
mpMainSet->mpWallpaper = NULL; mpMainSet->mpWallpaper = NULL;
mpMainSet->mpBitmap = NULL; mpMainSet->mpBitmap = NULL;
mpMainSet->mnLastSize = 0; mpMainSet->mnLastSize = 0;
mpMainSet->mnItems = 0;
mpMainSet->mnId = 0; mpMainSet->mnId = 0;
mpMainSet->mnSplitSize = SPLITWIN_SPLITSIZE; mpMainSet->mnSplitSize = SPLITWIN_SPLITSIZE;
mpMainSet->mbCalcPix = true; mpMainSet->mbCalcPix = true;
...@@ -2778,8 +2774,8 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2778,8 +2774,8 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
if (!pSet) if (!pSet)
return; return;
size_t nItems = pSet->mpItems.size(); sal_uInt16 nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; ImplSplitItem* pItems = pSet->mpItems;
// When there is an explicit minimum or maximum size then move nNewSize // When there is an explicit minimum or maximum size then move nNewSize
// into that range (when it is not yet already in it.) // into that range (when it is not yet already in it.)
...@@ -2787,11 +2783,11 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2787,11 +2783,11 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
if ( mbCalc ) if ( mbCalc )
{ {
pItems[nPos]->mnSize = nNewSize; pItems[nPos].mnSize = nNewSize;
return; return;
} }
long nDelta = nNewSize-pItems[nPos]->mnPixSize; long nDelta = nNewSize-pItems[nPos].mnPixSize;
if ( !nDelta ) if ( !nDelta )
return; return;
...@@ -2800,7 +2796,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2800,7 +2796,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
sal_uInt16 nMax = nItems; sal_uInt16 nMax = nItems;
for (sal_uInt16 i = 0; i < nItems; ++i) for (sal_uInt16 i = 0; i < nItems; ++i)
{ {
if ( pItems[i]->mbFixed ) if ( pItems[i].mbFixed )
{ {
if ( i < nPos ) if ( i < nPos )
nMin = i+1; nMin = i+1;
...@@ -2814,7 +2810,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2814,7 +2810,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
bool bGreat = true; bool bGreat = true;
if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) ) if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) )
{ {
if ( nPos < pSet->mpItems.size()-1 ) if ( nPos < pSet->mnItems-1 )
{ {
if ( !((bPropSmall && bPropGreat) || if ( !((bPropSmall && bPropGreat) ||
((nDelta > 0) && bPropSmall) || ((nDelta > 0) && bPropSmall) ||
...@@ -2839,7 +2835,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2839,7 +2835,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
bSmall = false; bSmall = false;
bGreat = false; bGreat = false;
} }
else if ( nPos && (nPos >= pSet->mpItems.size()-1) ) else if ( nPos && (nPos >= pSet->mnItems-1) )
{ {
nPos--; nPos--;
nDelta *= -1; nDelta *= -1;
...@@ -2864,7 +2860,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2864,7 +2860,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
{ {
if ( nTempDelta ) if ( nTempDelta )
{ {
pItems[n]->mnPixSize++; pItems[n].mnPixSize++;
nTempDelta++; nTempDelta++;
} }
n++; n++;
...@@ -2874,7 +2870,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2874,7 +2870,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
while ( nTempDelta ); while ( nTempDelta );
} }
else else
pItems[nPos+1]->mnPixSize -= nDelta; pItems[nPos+1].mnPixSize -= nDelta;
} }
if ( bSmall ) if ( bSmall )
...@@ -2886,9 +2882,9 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2886,9 +2882,9 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
n = nPos+1; n = nPos+1;
do do
{ {
if ( nDelta && pItems[n-1]->mnPixSize ) if ( nDelta && pItems[n-1].mnPixSize )
{ {
pItems[n-1]->mnPixSize--; pItems[n-1].mnPixSize--;
nDelta++; nDelta++;
} }
...@@ -2903,14 +2899,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2903,14 +2899,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
n = nPos+1; n = nPos+1;
do do
{ {
if ( pItems[n-1]->mnPixSize+nDelta < 0 ) if ( pItems[n-1].mnPixSize+nDelta < 0 )
{ {
nDelta += pItems[n-1]->mnPixSize; nDelta += pItems[n-1].mnPixSize;
pItems[n-1]->mnPixSize = 0; pItems[n-1].mnPixSize = 0;
} }
else else
{ {
pItems[n-1]->mnPixSize += nDelta; pItems[n-1].mnPixSize += nDelta;
break; break;
} }
n--; n--;
...@@ -2933,7 +2929,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2933,7 +2929,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
{ {
if ( nTempDelta ) if ( nTempDelta )
{ {
pItems[n-1]->mnPixSize++; pItems[n-1].mnPixSize++;
nTempDelta--; nTempDelta--;
} }
n--; n--;
...@@ -2943,7 +2939,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2943,7 +2939,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
while ( nTempDelta ); while ( nTempDelta );
} }
else else
pItems[nPos]->mnPixSize += nDelta; pItems[nPos].mnPixSize += nDelta;
} }
if ( bSmall ) if ( bSmall )
...@@ -2955,9 +2951,9 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2955,9 +2951,9 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
n = nPos+1; n = nPos+1;
do do
{ {
if ( nDelta && pItems[n]->mnPixSize ) if ( nDelta && pItems[n].mnPixSize )
{ {
pItems[n]->mnPixSize--; pItems[n].mnPixSize--;
nDelta--; nDelta--;
} }
...@@ -2972,14 +2968,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, ...@@ -2972,14 +2968,14 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
n = nPos+1; n = nPos+1;
do do
{ {
if ( pItems[n]->mnPixSize-nDelta < 0 ) if ( pItems[n].mnPixSize-nDelta < 0 )
{ {
nDelta -= pItems[n]->mnPixSize; nDelta -= pItems[n].mnPixSize;
pItems[n]->mnPixSize = 0; pItems[n].mnPixSize = 0;
} }
else else
{ {
pItems[n]->mnPixSize -= nDelta; pItems[n].mnPixSize -= nDelta;
break; break;
} }
n++; n++;
...@@ -3005,7 +3001,7 @@ void SplitWindow::SetItemSize( sal_uInt16 nId, long nNewSize ) ...@@ -3005,7 +3001,7 @@ void SplitWindow::SetItemSize( sal_uInt16 nId, long nNewSize )
return; return;
// check if size is changed // check if size is changed
pItem = pSet->mpItems[nPos]; pItem = &(pSet->mpItems[nPos]);
if ( pItem->mnSize != nNewSize ) if ( pItem->mnSize != nNewSize )
{ {
// set new size and re-calculate // set new size and re-calculate
...@@ -3021,7 +3017,7 @@ long SplitWindow::GetItemSize( sal_uInt16 nId ) const ...@@ -3021,7 +3017,7 @@ long SplitWindow::GetItemSize( sal_uInt16 nId ) const
ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos ); ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
if ( pSet ) if ( pSet )
return pSet->mpItems[nPos]->mnSize; return pSet->mpItems[nPos].mnSize;
else else
return 0; return 0;
} }
...@@ -3033,47 +3029,48 @@ long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const ...@@ -3033,47 +3029,48 @@ long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const
if ( pSet ) if ( pSet )
{ {
if ( nBits == pSet->mpItems[nPos]->mnBits ) if ( nBits == pSet->mpItems[nPos].mnBits )
return pSet->mpItems[nPos]->mnSize; return pSet->mpItems[nPos].mnSize;
else else
{ {
const_cast<SplitWindow*>(this)->ImplCalcLayout(); const_cast<SplitWindow*>(this)->ImplCalcLayout();
long nRelSize = 0; long nRelSize = 0;
long nPerSize = 0; long nPerSize = 0;
size_t nItems; ImplSplitItem* pItems;
sal_uInt16 nItems;
SplitWindowItemBits nTempBits; SplitWindowItemBits nTempBits;
sal_uInt16 i; sal_uInt16 i;
nItems = pSet->mpItems.size(); nItems = pSet->mnItems;
ImplSplitItems& pItems = pSet->mpItems; pItems = pSet->mpItems;
for ( i = 0; i < nItems; i++ ) for ( i = 0; i < nItems; i++ )
{ {
if ( i == nPos ) if ( i == nPos )
nTempBits = nBits; nTempBits = nBits;
else else
nTempBits = pItems[i]->mnBits; nTempBits = pItems[i].mnBits;
if ( nTempBits & SWIB_RELATIVESIZE ) if ( nTempBits & SWIB_RELATIVESIZE )
nRelSize += pItems[i]->mnPixSize; nRelSize += pItems[i].mnPixSize;
else if ( nTempBits & SWIB_PERCENTSIZE ) else if ( nTempBits & SWIB_PERCENTSIZE )
nPerSize += pItems[i]->mnPixSize; nPerSize += pItems[i].mnPixSize;
} }
nPerSize += nRelSize; nPerSize += nRelSize;
if ( nBits & SWIB_RELATIVESIZE ) if ( nBits & SWIB_RELATIVESIZE )
{ {
if ( nRelSize ) if ( nRelSize )
return (pItems[nPos]->mnPixSize+(nRelSize/2))/nRelSize; return (pItems[nPos].mnPixSize+(nRelSize/2))/nRelSize;
else else
return 1; return 1;
} }
else if ( nBits & SWIB_PERCENTSIZE ) else if ( nBits & SWIB_PERCENTSIZE )
{ {
if ( nPerSize ) if ( nPerSize )
return (pItems[nPos]->mnPixSize*100)/nPerSize; return (pItems[nPos].mnPixSize*100)/nPerSize;
else else
return 1; return 1;
} }
else else
return pItems[nPos]->mnPixSize; return pItems[nPos].mnPixSize;
} }
} }
else else
...@@ -3087,8 +3084,8 @@ void SplitWindow::SetItemSizeRange (sal_uInt16 nId, const Range& rRange) ...@@ -3087,8 +3084,8 @@ void SplitWindow::SetItemSizeRange (sal_uInt16 nId, const Range& rRange)
if (pSet != NULL) if (pSet != NULL)
{ {
pSet->mpItems[nPos]->mnMinSize = rRange.Min(); pSet->mpItems[nPos].mnMinSize = rRange.Min();
pSet->mpItems[nPos]->mnMaxSize = rRange.Max(); pSet->mpItems[nPos].mnMaxSize = rRange.Max();
} }
} }
...@@ -3131,9 +3128,9 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const ...@@ -3131,9 +3128,9 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const
if ( pSet ) if ( pSet )
{ {
for ( sal_uInt16 i = 0; i < pSet->mpItems.size(); i++ ) for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ )
{ {
if ( pSet->mpItems[i]->mnId == nId ) if ( pSet->mpItems[i].mnId == nId )
{ {
nPos = i; nPos = i;
break; break;
...@@ -3147,8 +3144,8 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const ...@@ -3147,8 +3144,8 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const
sal_uInt16 SplitWindow::GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId ) const sal_uInt16 SplitWindow::GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId ) const
{ {
ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId ); ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
if ( pSet && (nPos < pSet->mpItems.size()) ) if ( pSet && (nPos < pSet->mnItems) )
return pSet->mpItems[nPos]->mnId; return pSet->mpItems[nPos].mnId;
else else
return 0; return 0;
} }
...@@ -3157,7 +3154,7 @@ sal_uInt16 SplitWindow::GetItemCount( sal_uInt16 nSetId ) const ...@@ -3157,7 +3154,7 @@ sal_uInt16 SplitWindow::GetItemCount( sal_uInt16 nSetId ) const
{ {
ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId ); ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
if ( pSet ) if ( pSet )
return pSet->mpItems.size(); return pSet->mnItems;
else else
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment