Kaydet (Commit) 9e6b3a07 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up odd non-static member functions with pThis paramter

...and get member function const'ness right overall

Change-Id: Idb422039108d1dde9f6a8b881f6dff742030f6f0
üst eba8515c
...@@ -187,7 +187,7 @@ private: ...@@ -187,7 +187,7 @@ private:
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const; SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const;
SAL_DLLPRIVATE bool ImplCalcItem(); SAL_DLLPRIVATE bool ImplCalcItem();
SAL_DLLPRIVATE sal_uInt16 ImplCalcBreaks( long nWidth, long* pMaxLineWidth, bool bCalcHorz ); SAL_DLLPRIVATE sal_uInt16 ImplCalcBreaks( long nWidth, long* pMaxLineWidth, bool bCalcHorz ) const;
SAL_DLLPRIVATE void ImplFormat( bool bResize = false ); SAL_DLLPRIVATE void ImplFormat( bool bResize = false );
SAL_DLLPRIVATE void ImplDrawSpin(vcl::RenderContext& rRenderContext); SAL_DLLPRIVATE void ImplDrawSpin(vcl::RenderContext& rRenderContext);
SAL_DLLPRIVATE void ImplDrawSeparator(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, const Rectangle& rRect); SAL_DLLPRIVATE void ImplDrawSeparator(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, const Rectangle& rRect);
...@@ -206,7 +206,7 @@ private: ...@@ -206,7 +206,7 @@ private:
SAL_DLLPRIVATE void ImplShowFocus(); SAL_DLLPRIVATE void ImplShowFocus();
SAL_DLLPRIVATE void ImplHideFocus(); SAL_DLLPRIVATE void ImplHideFocus();
SAL_DLLPRIVATE void ImplUpdateInputEnable(); SAL_DLLPRIVATE void ImplUpdateInputEnable();
SAL_DLLPRIVATE void ImplFillLayoutData() const; SAL_DLLPRIVATE void ImplFillLayoutData();
SAL_DLLPRIVATE bool ImplHasClippedItems(); SAL_DLLPRIVATE bool ImplHasClippedItems();
SAL_DLLPRIVATE Point ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const; SAL_DLLPRIVATE Point ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const;
SAL_DLLPRIVATE bool ImplIsFloatingMode() const; SAL_DLLPRIVATE bool ImplIsFloatingMode() const;
...@@ -228,12 +228,13 @@ public: ...@@ -228,12 +228,13 @@ public:
SAL_DLLPRIVATE void ImplFloatControl( bool bStart, FloatingWindow* pWindow ); SAL_DLLPRIVATE void ImplFloatControl( bool bStart, FloatingWindow* pWindow );
SAL_DLLPRIVATE void ImplDisableFlatButtons(); SAL_DLLPRIVATE void ImplDisableFlatButtons();
static SAL_DLLPRIVATE int ImplGetDragWidth( ToolBox* pThis ); SAL_DLLPRIVATE int ImplGetDragWidth() const;
static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::RenderContext& rRenderContext, static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::RenderContext& rRenderContext,
bool bHorz ); bool bHorz );
static SAL_DLLPRIVATE void ImplUpdateDragArea( ToolBox *pThis ); SAL_DLLPRIVATE void ImplUpdateDragArea() const;
static SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop, SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
long& rRight, long& rBottom, const ToolBox *pThis ); long& rRight, long& rBottom ) const;
SAL_DLLPRIVATE void ImplCheckUpdate();
static SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext, static SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext,
const Rectangle &aDragArea, int nDragWidth, const Rectangle &aDragArea, int nDragWidth,
WindowAlign eAlign, bool bHorz); WindowAlign eAlign, bool bHorz);
...@@ -248,20 +249,20 @@ public: ...@@ -248,20 +249,20 @@ public:
SAL_DLLPRIVATE void ImplErase(vcl::RenderContext& rRenderContext, const Rectangle &rRect, bool bHighlight, bool bHasOpenPopup = false ); SAL_DLLPRIVATE void ImplErase(vcl::RenderContext& rRenderContext, const Rectangle &rRect, bool bHighlight, bool bHasOpenPopup = false );
SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext); SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
static SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem( const ToolBox* pThis ); SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem() const;
static SAL_DLLPRIVATE Size ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode = 0 ); SAL_DLLPRIVATE Size ImplCalcSize( sal_uInt16 nCalcLines, sal_uInt16 nCalcMode = 0 );
static SAL_DLLPRIVATE void ImplCalcFloatSizes( ToolBox* pThis ); SAL_DLLPRIVATE void ImplCalcFloatSizes();
static SAL_DLLPRIVATE Size ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines ); SAL_DLLPRIVATE Size ImplCalcFloatSize( sal_uInt16& rLines );
static SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize ); SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( Size& rMinSize, Size& rMaxSize );
static SAL_DLLPRIVATE void ImplSetMinMaxFloatSize( ToolBox *pThis ); SAL_DLLPRIVATE void ImplSetMinMaxFloatSize();
static SAL_DLLPRIVATE sal_uInt16 ImplCalcLines( ToolBox* pThis, long nToolSize ); SAL_DLLPRIVATE sal_uInt16 ImplCalcLines( long nToolSize ) const;
static SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( ToolBox* pThis, const Point& rPos ); SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( const Point& rPos ) const;
static SAL_DLLPRIVATE void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode ); SAL_DLLPRIVATE void ImplLineSizing( const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode );
static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( ToolBox* pBox, const Point& rPos ); SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( const Point& rPos ) const;
static SAL_DLLPRIVATE ImplToolItems::size_type ImplFindItemPos( const ImplToolItem* pItem, const ImplToolItems& rList ); static SAL_DLLPRIVATE ImplToolItems::size_type ImplFindItemPos( const ImplToolItem* pItem, const ImplToolItems& rList );
SAL_DLLPRIVATE void ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight); SAL_DLLPRIVATE void ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight);
SAL_DLLPRIVATE void ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow); SAL_DLLPRIVATE void ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow);
static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis ); SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks() const;
SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; }
protected: protected:
...@@ -359,12 +360,12 @@ public: ...@@ -359,12 +360,12 @@ public:
sal_uInt16 GetItemId( const Point& rPos ) const; sal_uInt16 GetItemId( const Point& rPos ) const;
/// Map the command name (like .uno:Save) back to item id. /// Map the command name (like .uno:Save) back to item id.
sal_uInt16 GetItemId( const OUString& rCommand ) const; sal_uInt16 GetItemId( const OUString& rCommand ) const;
Rectangle GetItemRect( sal_uInt16 nItemId ) const; Rectangle GetItemRect( sal_uInt16 nItemId );
Rectangle GetItemPosRect( ImplToolItems::size_type nPos ) const; Rectangle GetItemPosRect( ImplToolItems::size_type nPos );
Rectangle GetOverflowRect() const; Rectangle GetOverflowRect() const;
/// Returns size of the bitmap / text that is inside this toolbox item. /// Returns size of the bitmap / text that is inside this toolbox item.
Size GetItemContentSize( sal_uInt16 nItemId ) const; Size GetItemContentSize( sal_uInt16 nItemId );
sal_uInt16 GetCurItemId() const { return mnCurItemId; } sal_uInt16 GetCurItemId() const { return mnCurItemId; }
sal_uInt16 GetDownItemId() const { return mnDownItemId; } sal_uInt16 GetDownItemId() const { return mnDownItemId; }
...@@ -429,20 +430,20 @@ public: ...@@ -429,20 +430,20 @@ public:
OString GetHelpId( sal_uInt16 nItemId ) const; OString GetHelpId( sal_uInt16 nItemId ) const;
// window size according to current alignment, floating state and number of lines // window size according to current alignment, floating state and number of lines
Size CalcWindowSizePixel() const; Size CalcWindowSizePixel();
// window size according to current alignment, floating state and a given number of lines // window size according to current alignment, floating state and a given number of lines
Size CalcWindowSizePixel( sal_uInt16 nCalcLines ) const; Size CalcWindowSizePixel( sal_uInt16 nCalcLines );
// window size according to current floating state and a given number of lines and a given alignment // window size according to current floating state and a given number of lines and a given alignment
Size CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const; Size CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign );
// floating window size according to number of lines (uses the number of line breaks) // floating window size according to number of lines (uses the number of line breaks)
Size CalcFloatingWindowSizePixel() const; Size CalcFloatingWindowSizePixel();
// floating window size with a given number of lines // floating window size with a given number of lines
Size CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const; Size CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines );
// automatic window size for popup mode // automatic window size for popup mode
Size CalcPopupWindowSizePixel() const; Size CalcPopupWindowSizePixel();
// computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button) // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
Size CalcMinimumWindowSizePixel() const; Size CalcMinimumWindowSizePixel();
sal_uInt16 GetFloatingLines() const; sal_uInt16 GetFloatingLines() const;
...@@ -507,10 +508,10 @@ public: ...@@ -507,10 +508,10 @@ public:
// returns the bounding box for the character at index nIndex // returns the bounding box for the character at index nIndex
// where nIndex is relative to the starting index of the item // where nIndex is relative to the starting index of the item
// with id nItemId (in coordinates of the displaying window) // with id nItemId (in coordinates of the displaying window)
Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const; Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex );
// -1 is returned if no character is at that point // -1 is returned if no character is at that point
// if an index is found the corresponding item id is filled in (else 0) // if an index is found the corresponding item id is filled in (else 0)
long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID );
static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize); static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize);
Size GetDefaultImageSize() const; Size GetDefaultImageSize() const;
...@@ -532,7 +533,7 @@ inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const ...@@ -532,7 +533,7 @@ inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const
return (GetItemState( nItemId ) == TRISTATE_TRUE); return (GetItemState( nItemId ) == TRISTATE_TRUE);
} }
inline Size ToolBox::CalcWindowSizePixel() const inline Size ToolBox::CalcWindowSizePixel()
{ {
return CalcWindowSizePixel( mnLines ); return CalcWindowSizePixel( mnLines );
} }
......
...@@ -174,9 +174,9 @@ int ToolBox::ImplGetDragWidth( const vcl::RenderContext& rRenderContext, bool bH ...@@ -174,9 +174,9 @@ int ToolBox::ImplGetDragWidth( const vcl::RenderContext& rRenderContext, bool bH
return nWidth; return nWidth;
} }
int ToolBox::ImplGetDragWidth( ToolBox* pThis ) int ToolBox::ImplGetDragWidth() const
{ {
return ToolBox::ImplGetDragWidth( *pThis, pThis->mbHorz ); return ToolBox::ImplGetDragWidth( *this, mbHorz );
} }
ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ) ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
...@@ -193,37 +193,37 @@ ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ) ...@@ -193,37 +193,37 @@ ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
return tmpButtonType; return tmpButtonType;
} }
void ToolBox::ImplUpdateDragArea( ToolBox *pThis ) void ToolBox::ImplUpdateDragArea() const
{ {
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( pThis ); ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
if( pWrapper ) if( pWrapper )
{ {
if ( pThis->ImplIsFloatingMode() || pWrapper->IsLocked() ) if ( ImplIsFloatingMode() || pWrapper->IsLocked() )
pWrapper->SetDragArea( Rectangle() ); pWrapper->SetDragArea( Rectangle() );
else else
{ {
if( pThis->meAlign == WindowAlign::Top || pThis->meAlign == WindowAlign::Bottom ) if( meAlign == WindowAlign::Top || meAlign == WindowAlign::Bottom )
pWrapper->SetDragArea( Rectangle( 0, 0, ImplGetDragWidth( pThis ), pThis->GetOutputSizePixel().Height() ) ); pWrapper->SetDragArea( Rectangle( 0, 0, ImplGetDragWidth(), GetOutputSizePixel().Height() ) );
else else
pWrapper->SetDragArea( Rectangle( 0, 0, pThis->GetOutputSizePixel().Width(), ImplGetDragWidth( pThis ) ) ); pWrapper->SetDragArea( Rectangle( 0, 0, GetOutputSizePixel().Width(), ImplGetDragWidth() ) );
} }
} }
} }
void ToolBox::ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop, void ToolBox::ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
long& rRight, long& rBottom, const ToolBox *pThis ) long& rRight, long& rBottom ) const
{ {
if( pThis->ImplIsFloatingMode() || !(pThis->mnWinStyle & WB_BORDER) ) if( ImplIsFloatingMode() || !(mnWinStyle & WB_BORDER) )
{ {
// no border in floating mode // no border in floating mode
rLeft = rTop = rRight = rBottom = 0; rLeft = rTop = rRight = rBottom = 0;
return; return;
} }
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( pThis ); ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
// reserve DragArea only for dockable toolbars // reserve DragArea only for dockable toolbars
int dragwidth = ( pWrapper && !pWrapper->IsLocked() ) ? ImplGetDragWidth( const_cast<ToolBox*>(pThis) ) : 0; int dragwidth = ( pWrapper && !pWrapper->IsLocked() ) ? ImplGetDragWidth() : 0;
// no shadow border for dockable toolbars // no shadow border for dockable toolbars
int borderwidth = pWrapper ? 0: 2; int borderwidth = pWrapper ? 0: 2;
...@@ -258,7 +258,7 @@ void ToolBox::ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop, ...@@ -258,7 +258,7 @@ void ToolBox::ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
} }
} }
static void ImplCheckUpdate(ToolBox* pThis) void ToolBox::ImplCheckUpdate()
{ {
// remove any pending invalidates to avoid // remove any pending invalidates to avoid
// have them triggered when paint is locked (see mpData->mbIsPaintLocked) // have them triggered when paint is locked (see mpData->mbIsPaintLocked)
...@@ -266,8 +266,8 @@ static void ImplCheckUpdate(ToolBox* pThis) ...@@ -266,8 +266,8 @@ static void ImplCheckUpdate(ToolBox* pThis)
// this must not be done when we're already in Paint() // this must not be done when we're already in Paint()
// this is only required for transparent toolbars (see ImplDrawTransparentBackground() ) // this is only required for transparent toolbars (see ImplDrawTransparentBackground() )
if( !pThis->IsBackground() && pThis->HasPaintEvent() && !pThis->IsInPaint() ) if( !IsBackground() && HasPaintEvent() && !IsInPaint() )
pThis->Update(); Update();
} }
void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext, void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext,
...@@ -330,9 +330,9 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext) ...@@ -330,9 +330,9 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext)
if( pWrapper && !pWrapper->GetDragArea().IsEmpty() ) if( pWrapper && !pWrapper->GetDragArea().IsEmpty() )
{ {
// execute pending paint requests // execute pending paint requests
ImplCheckUpdate(this); ImplCheckUpdate();
ImplDrawGrip( rRenderContext, pWrapper->GetDragArea(), ImplDrawGrip( rRenderContext, pWrapper->GetDragArea(),
ImplGetDragWidth(this), meAlign, mbHorz ); ImplGetDragWidth(), meAlign, mbHorz );
} }
} }
...@@ -384,7 +384,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext, Imp ...@@ -384,7 +384,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext, Imp
} }
long nLeft, nTop, nRight, nBottom; long nLeft, nTop, nRight, nBottom;
ImplCalcBorder(meAlign, nLeft, nTop, nRight, nBottom, this); ImplCalcBorder(meAlign, nLeft, nTop, nRight, nBottom);
Size aTopLineSz(aLineSz); Size aTopLineSz(aLineSz);
Size aBottomLineSz(aLineSz); Size aBottomLineSz(aLineSz);
...@@ -504,7 +504,7 @@ void ToolBox::ImplDrawConstantBackground(vcl::RenderContext& rRenderContext, con ...@@ -504,7 +504,7 @@ void ToolBox::ImplDrawConstantBackground(vcl::RenderContext& rRenderContext, con
void ToolBox::ImplDrawBackground(vcl::RenderContext& rRenderContext, const Rectangle& rRect) void ToolBox::ImplDrawBackground(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{ {
// execute pending paint requests // execute pending paint requests
ImplCheckUpdate(this); ImplCheckUpdate();
ImplDockingWindowWrapper* pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper(this); ImplDockingWindowWrapper* pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper(this);
bool bIsInPopupMode = ImplIsInPopupMode(); bool bIsInPopupMode = ImplIsInPopupMode();
...@@ -652,11 +652,11 @@ static bool ImplIsFixedControl( const ImplToolItem *pItem ) ...@@ -652,11 +652,11 @@ static bool ImplIsFixedControl( const ImplToolItem *pItem )
pItem->mpWindow->GetType() == WindowType::GROUPBOX) ); pItem->mpWindow->GetType() == WindowType::GROUPBOX) );
} }
const ImplToolItem *ToolBox::ImplGetFirstClippedItem( const ToolBox* pThis ) const ImplToolItem *ToolBox::ImplGetFirstClippedItem() const
{ {
ImplToolItems::const_iterator it; ImplToolItems::const_iterator it;
it = pThis->mpData->m_aItems.begin(); it = mpData->m_aItems.begin();
while ( it != pThis->mpData->m_aItems.end() ) while ( it != mpData->m_aItems.end() )
{ {
if( it->IsClipped() ) if( it->IsClipped() )
return &(*it); return &(*it);
...@@ -665,7 +665,7 @@ const ImplToolItem *ToolBox::ImplGetFirstClippedItem( const ToolBox* pThis ) ...@@ -665,7 +665,7 @@ const ImplToolItem *ToolBox::ImplGetFirstClippedItem( const ToolBox* pThis )
return nullptr; return nullptr;
} }
Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode ) Size ToolBox::ImplCalcSize( sal_uInt16 nCalcLines, sal_uInt16 nCalcMode )
{ {
long nMax; long nMax;
long nLeft = 0; long nLeft = 0;
...@@ -673,125 +673,125 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn ...@@ -673,125 +673,125 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
long nRight = 0; long nRight = 0;
long nBottom = 0; long nBottom = 0;
Size aSize; Size aSize;
WindowAlign eOldAlign = pThis->meAlign; WindowAlign eOldAlign = meAlign;
bool bOldHorz = pThis->mbHorz; bool bOldHorz = mbHorz;
bool bOldAssumeDocked = pThis->mpData->mbAssumeDocked; bool bOldAssumeDocked = mpData->mbAssumeDocked;
bool bOldAssumeFloating = pThis->mpData->mbAssumeFloating; bool bOldAssumeFloating = mpData->mbAssumeFloating;
if ( nCalcMode ) if ( nCalcMode )
{ {
bool bOldFloatingMode = pThis->ImplIsFloatingMode(); bool bOldFloatingMode = ImplIsFloatingMode();
pThis->mpData->mbAssumeDocked = false; mpData->mbAssumeDocked = false;
pThis->mpData->mbAssumeFloating = false; mpData->mbAssumeFloating = false;
if ( nCalcMode == TB_CALCMODE_HORZ ) if ( nCalcMode == TB_CALCMODE_HORZ )
{ {
pThis->mpData->mbAssumeDocked = true; // force non-floating mode during calculation mpData->mbAssumeDocked = true; // force non-floating mode during calculation
ImplCalcBorder( WindowAlign::Top, nLeft, nTop, nRight, nBottom, pThis ); ImplCalcBorder( WindowAlign::Top, nLeft, nTop, nRight, nBottom );
const_cast<ToolBox*>(pThis)->mbHorz = true; mbHorz = true;
if ( pThis->mbHorz != bOldHorz ) if ( mbHorz != bOldHorz )
const_cast<ToolBox*>(pThis)->meAlign = WindowAlign::Top; meAlign = WindowAlign::Top;
} }
else if ( nCalcMode == TB_CALCMODE_VERT ) else if ( nCalcMode == TB_CALCMODE_VERT )
{ {
pThis->mpData->mbAssumeDocked = true; // force non-floating mode during calculation mpData->mbAssumeDocked = true; // force non-floating mode during calculation
ImplCalcBorder( WindowAlign::Left, nLeft, nTop, nRight, nBottom, pThis ); ImplCalcBorder( WindowAlign::Left, nLeft, nTop, nRight, nBottom );
const_cast<ToolBox*>(pThis)->mbHorz = false; mbHorz = false;
if ( pThis->mbHorz != bOldHorz ) if ( mbHorz != bOldHorz )
const_cast<ToolBox*>(pThis)->meAlign = WindowAlign::Left; meAlign = WindowAlign::Left;
} }
else if ( nCalcMode == TB_CALCMODE_FLOAT ) else if ( nCalcMode == TB_CALCMODE_FLOAT )
{ {
pThis->mpData->mbAssumeFloating = true; // force non-floating mode during calculation mpData->mbAssumeFloating = true; // force non-floating mode during calculation
nLeft = nTop = nRight = nBottom = 0; nLeft = nTop = nRight = nBottom = 0;
const_cast<ToolBox*>(pThis)->mbHorz = true; mbHorz = true;
if ( pThis->mbHorz != bOldHorz ) if ( mbHorz != bOldHorz )
const_cast<ToolBox*>(pThis)->meAlign = WindowAlign::Top; meAlign = WindowAlign::Top;
} }
if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) || if ( (meAlign != eOldAlign) || (mbHorz != bOldHorz) ||
(pThis->ImplIsFloatingMode() != bOldFloatingMode ) ) (ImplIsFloatingMode() != bOldFloatingMode ) )
const_cast<ToolBox*>(pThis)->mbCalc = true; mbCalc = true;
} }
else else
ImplCalcBorder( pThis->meAlign, nLeft, nTop, nRight, nBottom, pThis ); ImplCalcBorder( meAlign, nLeft, nTop, nRight, nBottom );
const_cast<ToolBox*>(pThis)->ImplCalcItem(); ImplCalcItem();
if( !nCalcMode && pThis->ImplIsFloatingMode() ) if( !nCalcMode && ImplIsFloatingMode() )
{ {
aSize = ImplCalcFloatSize( const_cast<ToolBox*>(pThis), nCalcLines ); aSize = ImplCalcFloatSize( nCalcLines );
} }
else else
{ {
if ( pThis->mbHorz ) if ( mbHorz )
{ {
if ( pThis->mnWinHeight > pThis->mnMaxItemHeight ) if ( mnWinHeight > mnMaxItemHeight )
aSize.Height() = nCalcLines * pThis->mnWinHeight; aSize.Height() = nCalcLines * mnWinHeight;
else else
aSize.Height() = nCalcLines * pThis->mnMaxItemHeight; aSize.Height() = nCalcLines * mnMaxItemHeight;
if ( pThis->mnWinStyle & WB_LINESPACING ) if ( mnWinStyle & WB_LINESPACING )
aSize.Height() += (nCalcLines-1)*TB_LINESPACING; aSize.Height() += (nCalcLines-1)*TB_LINESPACING;
if ( pThis->mnWinStyle & WB_BORDER ) if ( mnWinStyle & WB_BORDER )
aSize.Height() += (TB_BORDER_OFFSET2*2) + nTop + nBottom; aSize.Height() += (TB_BORDER_OFFSET2*2) + nTop + nBottom;
nMax = 0; nMax = 0;
const_cast<ToolBox*>(pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz ); ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, mbHorz );
if ( nMax ) if ( nMax )
aSize.Width() += nMax; aSize.Width() += nMax;
if ( pThis->mnWinStyle & WB_BORDER ) if ( mnWinStyle & WB_BORDER )
aSize.Width() += (TB_BORDER_OFFSET1*2) + nLeft + nRight; aSize.Width() += (TB_BORDER_OFFSET1*2) + nLeft + nRight;
} }
else else
{ {
aSize.Width() = nCalcLines * pThis->mnMaxItemWidth; aSize.Width() = nCalcLines * mnMaxItemWidth;
if ( pThis->mnWinStyle & WB_LINESPACING ) if ( mnWinStyle & WB_LINESPACING )
aSize.Width() += (nCalcLines-1)*TB_LINESPACING; aSize.Width() += (nCalcLines-1)*TB_LINESPACING;
if ( pThis->mnWinStyle & WB_BORDER ) if ( mnWinStyle & WB_BORDER )
aSize.Width() += (TB_BORDER_OFFSET2*2) + nLeft + nRight; aSize.Width() += (TB_BORDER_OFFSET2*2) + nLeft + nRight;
nMax = 0; nMax = 0;
const_cast<ToolBox*>(pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz ); ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, mbHorz );
if ( nMax ) if ( nMax )
aSize.Height() += nMax; aSize.Height() += nMax;
if ( pThis->mnWinStyle & WB_BORDER ) if ( mnWinStyle & WB_BORDER )
aSize.Height() += (TB_BORDER_OFFSET1*2) + nTop + nBottom; aSize.Height() += (TB_BORDER_OFFSET1*2) + nTop + nBottom;
} }
} }
// restore previous values // restore previous values
if ( nCalcMode ) if ( nCalcMode )
{ {
pThis->mpData->mbAssumeDocked = bOldAssumeDocked; mpData->mbAssumeDocked = bOldAssumeDocked;
pThis->mpData->mbAssumeFloating = bOldAssumeFloating; mpData->mbAssumeFloating = bOldAssumeFloating;
if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) ) if ( (meAlign != eOldAlign) || (mbHorz != bOldHorz) )
{ {
const_cast<ToolBox*>(pThis)->meAlign = eOldAlign; meAlign = eOldAlign;
const_cast<ToolBox*>(pThis)->mbHorz = bOldHorz; mbHorz = bOldHorz;
const_cast<ToolBox*>(pThis)->mbCalc = true; mbCalc = true;
} }
} }
return aSize; return aSize;
} }
void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) void ToolBox::ImplCalcFloatSizes()
{ {
if ( !pThis->maFloatSizes.empty() ) if ( !maFloatSizes.empty() )
return; return;
// calculate the minimal size, i.e. where the biggest item just fits // calculate the minimal size, i.e. where the biggest item just fits
long nCalcSize = 0; long nCalcSize = 0;
ImplToolItems::const_iterator it; ImplToolItems::const_iterator it;
it = pThis->mpData->m_aItems.begin(); it = mpData->m_aItems.begin();
while ( it != pThis->mpData->m_aItems.end() ) while ( it != mpData->m_aItems.end() )
{ {
if ( it->mbVisible ) if ( it->mbVisible )
{ {
...@@ -811,33 +811,33 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) ...@@ -811,33 +811,33 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis )
} }
// calc an upper bound for ImplCalcBreaks below // calc an upper bound for ImplCalcBreaks below
long upperBoundWidth = nCalcSize * pThis->mpData->m_aItems.size(); long upperBoundWidth = nCalcSize * mpData->m_aItems.size();
sal_uInt16 nLines; sal_uInt16 nLines;
sal_uInt16 nCalcLines; sal_uInt16 nCalcLines;
sal_uInt16 nTempLines; sal_uInt16 nTempLines;
long nMaxLineWidth; long nMaxLineWidth;
nCalcLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, true ); nCalcLines = ImplCalcBreaks( nCalcSize, &nMaxLineWidth, true );
pThis->maFloatSizes.reserve( nCalcLines ); maFloatSizes.reserve( nCalcLines );
nTempLines = nLines = nCalcLines; nTempLines = nLines = nCalcLines;
while ( nLines ) while ( nLines )
{ {
long nHeight = ImplCalcSize( pThis, nTempLines, TB_CALCMODE_FLOAT ).Height(); long nHeight = ImplCalcSize( nTempLines, TB_CALCMODE_FLOAT ).Height();
ImplToolSize aSize; ImplToolSize aSize;
aSize.mnWidth = nMaxLineWidth+(TB_BORDER_OFFSET1*2); aSize.mnWidth = nMaxLineWidth+(TB_BORDER_OFFSET1*2);
aSize.mnHeight = nHeight; aSize.mnHeight = nHeight;
aSize.mnLines = nTempLines; aSize.mnLines = nTempLines;
pThis->maFloatSizes.push_back( aSize ); maFloatSizes.push_back( aSize );
nLines--; nLines--;
if ( nLines ) if ( nLines )
{ {
do do
{ {
nCalcSize += pThis->mnMaxItemWidth; nCalcSize += mnMaxItemWidth;
nTempLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, true ); nTempLines = ImplCalcBreaks( nCalcSize, &nMaxLineWidth, true );
} }
while ( (nCalcSize < upperBoundWidth) && (nLines < nTempLines) && (nTempLines != 1) ); while ( (nCalcSize < upperBoundWidth) && (nLines < nTempLines) && (nTempLines != 1) );
if ( nTempLines < nLines ) if ( nTempLines < nLines )
...@@ -846,87 +846,87 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis ) ...@@ -846,87 +846,87 @@ void ToolBox::ImplCalcFloatSizes( ToolBox* pThis )
} }
} }
Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines ) Size ToolBox::ImplCalcFloatSize( sal_uInt16& rLines )
{ {
ImplCalcFloatSizes( pThis ); ImplCalcFloatSizes();
if ( !rLines ) if ( !rLines )
{ {
rLines = pThis->mnFloatLines; rLines = mnFloatLines;
if ( !rLines ) if ( !rLines )
rLines = pThis->mnLines; rLines = mnLines;
} }
sal_uInt16 i = 0; sal_uInt16 i = 0;
while ( i + 1u < pThis->maFloatSizes.size() && rLines < pThis->maFloatSizes[i].mnLines ) while ( i + 1u < maFloatSizes.size() && rLines < maFloatSizes[i].mnLines )
{ {
i++; i++;
} }
Size aSize( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight ); Size aSize( maFloatSizes[i].mnWidth, maFloatSizes[i].mnHeight );
rLines = pThis->maFloatSizes[i].mnLines; rLines = maFloatSizes[i].mnLines;
return aSize; return aSize;
} }
void ToolBox::ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize ) void ToolBox::ImplCalcMinMaxFloatSize( Size& rMinSize, Size& rMaxSize )
{ {
ImplCalcFloatSizes( pThis ); ImplCalcFloatSizes();
sal_uInt16 i = 0; sal_uInt16 i = 0;
rMinSize = Size( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight ); rMinSize = Size( maFloatSizes[i].mnWidth, maFloatSizes[i].mnHeight );
rMaxSize = Size( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight ); rMaxSize = Size( maFloatSizes[i].mnWidth, maFloatSizes[i].mnHeight );
while ( ++i < pThis->maFloatSizes.size() ) while ( ++i < maFloatSizes.size() )
{ {
if( pThis->maFloatSizes[i].mnWidth < rMinSize.Width() ) if( maFloatSizes[i].mnWidth < rMinSize.Width() )
rMinSize.Width() = pThis->maFloatSizes[i].mnWidth; rMinSize.Width() = maFloatSizes[i].mnWidth;
if( pThis->maFloatSizes[i].mnHeight < rMinSize.Height() ) if( maFloatSizes[i].mnHeight < rMinSize.Height() )
rMinSize.Height() = pThis->maFloatSizes[i].mnHeight; rMinSize.Height() = maFloatSizes[i].mnHeight;
if( pThis->maFloatSizes[i].mnWidth > rMaxSize.Width() ) if( maFloatSizes[i].mnWidth > rMaxSize.Width() )
rMaxSize.Width() = pThis->maFloatSizes[i].mnWidth; rMaxSize.Width() = maFloatSizes[i].mnWidth;
if( pThis->maFloatSizes[i].mnHeight > rMaxSize.Height() ) if( maFloatSizes[i].mnHeight > rMaxSize.Height() )
rMaxSize.Height() = pThis->maFloatSizes[i].mnHeight; rMaxSize.Height() = maFloatSizes[i].mnHeight;
} }
} }
void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis ) void ToolBox::ImplSetMinMaxFloatSize()
{ {
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( pThis ); ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
Size aMinSize, aMaxSize; Size aMinSize, aMaxSize;
ImplCalcMinMaxFloatSize( pThis, aMinSize, aMaxSize ); ImplCalcMinMaxFloatSize( aMinSize, aMaxSize );
if( pWrapper ) if( pWrapper )
{ {
pWrapper->SetMinOutputSizePixel( aMinSize ); pWrapper->SetMinOutputSizePixel( aMinSize );
pWrapper->SetMaxOutputSizePixel( aMaxSize ); pWrapper->SetMaxOutputSizePixel( aMaxSize );
pWrapper->ShowTitleButton( TitleButton::Menu, bool( pThis->GetMenuType() & ToolBoxMenuType::Customize) ); pWrapper->ShowTitleButton( TitleButton::Menu, bool( GetMenuType() & ToolBoxMenuType::Customize) );
} }
else else
{ {
// TODO: change SetMinOutputSizePixel to be not inline // TODO: change SetMinOutputSizePixel to be not inline
pThis->SetMinOutputSizePixel( aMinSize ); SetMinOutputSizePixel( aMinSize );
pThis->SetMaxOutputSizePixel( aMaxSize ); SetMaxOutputSizePixel( aMaxSize );
} }
} }
sal_uInt16 ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize ) sal_uInt16 ToolBox::ImplCalcLines( long nToolSize ) const
{ {
long nLineHeight; long nLineHeight;
if ( pThis->mbHorz ) if ( mbHorz )
{ {
if ( pThis->mnWinHeight > pThis->mnMaxItemHeight ) if ( mnWinHeight > mnMaxItemHeight )
nLineHeight = pThis->mnWinHeight; nLineHeight = mnWinHeight;
else else
nLineHeight = pThis->mnMaxItemHeight; nLineHeight = mnMaxItemHeight;
} }
else else
nLineHeight = pThis->mnMaxItemWidth; nLineHeight = mnMaxItemWidth;
if ( pThis->mnWinStyle & WB_BORDER ) if ( mnWinStyle & WB_BORDER )
nToolSize -= TB_BORDER_OFFSET2*2; nToolSize -= TB_BORDER_OFFSET2*2;
if ( pThis->mnWinStyle & WB_LINESPACING ) if ( mnWinStyle & WB_LINESPACING )
{ {
nLineHeight += TB_LINESPACING; nLineHeight += TB_LINESPACING;
nToolSize += TB_LINESPACING; nToolSize += TB_LINESPACING;
...@@ -940,21 +940,21 @@ sal_uInt16 ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize ) ...@@ -940,21 +940,21 @@ sal_uInt16 ToolBox::ImplCalcLines( ToolBox* pThis, long nToolSize )
return static_cast<sal_uInt16>(nLines); return static_cast<sal_uInt16>(nLines);
} }
sal_uInt16 ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos ) sal_uInt16 ToolBox::ImplTestLineSize( const Point& rPos ) const
{ {
if ( !pThis->ImplIsFloatingMode() && if ( !ImplIsFloatingMode() &&
(!pThis->mbScroll || (pThis->mnLines > 1) || (pThis->mnCurLines > pThis->mnVisLines)) ) (!mbScroll || (mnLines > 1) || (mnCurLines > mnVisLines)) )
{ {
WindowAlign eAlign = pThis->GetAlign(); WindowAlign eAlign = GetAlign();
if ( eAlign == WindowAlign::Left ) if ( eAlign == WindowAlign::Left )
{ {
if ( rPos.X() > pThis->mnDX-DOCK_LINEOFFSET ) if ( rPos.X() > mnDX-DOCK_LINEOFFSET )
return DOCK_LINEHSIZE | DOCK_LINERIGHT; return DOCK_LINEHSIZE | DOCK_LINERIGHT;
} }
else if ( eAlign == WindowAlign::Top ) else if ( eAlign == WindowAlign::Top )
{ {
if ( rPos.Y() > pThis->mnDY-DOCK_LINEOFFSET ) if ( rPos.Y() > mnDY-DOCK_LINEOFFSET )
return DOCK_LINEVSIZE | DOCK_LINEBOTTOM; return DOCK_LINEVSIZE | DOCK_LINEBOTTOM;
} }
else if ( eAlign == WindowAlign::Right ) else if ( eAlign == WindowAlign::Right )
...@@ -972,7 +972,7 @@ sal_uInt16 ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos ) ...@@ -972,7 +972,7 @@ sal_uInt16 ToolBox::ImplTestLineSize( ToolBox* pThis, const Point& rPos )
return 0; return 0;
} }
void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode ) void ToolBox::ImplLineSizing( const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode )
{ {
bool bHorz; bool bHorz;
long nOneLineSize; long nOneLineSize;
...@@ -1007,21 +1007,21 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec ...@@ -1007,21 +1007,21 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
bHorz = false; bHorz = false;
} }
Size aWinSize = pThis->GetSizePixel(); Size aWinSize = GetSizePixel();
sal_uInt16 nMaxLines = (pThis->mnLines > pThis->mnCurLines) ? pThis->mnLines : pThis->mnCurLines; sal_uInt16 nMaxLines = (mnLines > mnCurLines) ? mnLines : mnCurLines;
if ( nMaxLines > TB_MAXLINES ) if ( nMaxLines > TB_MAXLINES )
nMaxLines = TB_MAXLINES; nMaxLines = TB_MAXLINES;
if ( bHorz ) if ( bHorz )
{ {
nOneLineSize = ImplCalcSize( pThis, 1 ).Height(); nOneLineSize = ImplCalcSize( 1 ).Height();
nMaxSize = pThis->maOutDockRect.GetHeight() - 20; nMaxSize = maOutDockRect.GetHeight() - 20;
if ( nMaxSize < aWinSize.Height() ) if ( nMaxSize < aWinSize.Height() )
nMaxSize = aWinSize.Height(); nMaxSize = aWinSize.Height();
} }
else else
{ {
nOneLineSize = ImplCalcSize( pThis, 1 ).Width(); nOneLineSize = ImplCalcSize( 1 ).Width();
nMaxSize = pThis->maOutDockRect.GetWidth() - 20; nMaxSize = maOutDockRect.GetWidth() - 20;
if ( nMaxSize < aWinSize.Width() ) if ( nMaxSize < aWinSize.Width() )
nMaxSize = aWinSize.Width(); nMaxSize = aWinSize.Width();
} }
...@@ -1035,7 +1035,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec ...@@ -1035,7 +1035,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
while ( (nSize < nCurSize) && (i < nMaxLines) ) while ( (nSize < nCurSize) && (i < nMaxLines) )
{ {
i++; i++;
aSize = ImplCalcSize( pThis, i ); aSize = ImplCalcSize( i );
if ( bHorz ) if ( bHorz )
nSize = aSize.Height(); nSize = aSize.Height();
else else
...@@ -1043,7 +1043,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec ...@@ -1043,7 +1043,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
if ( nSize > nMaxSize ) if ( nSize > nMaxSize )
{ {
i--; i--;
aSize = ImplCalcSize( pThis, i ); aSize = ImplCalcSize( i );
if ( bHorz ) if ( bHorz )
nSize = aSize.Height(); nSize = aSize.Height();
else else
...@@ -1062,15 +1062,15 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec ...@@ -1062,15 +1062,15 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
else else
rRect.Top() = rRect.Bottom()-nSize; rRect.Top() = rRect.Bottom()-nSize;
pThis->mnDockLines = i; mnDockLines = i;
} }
sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos ) sal_uInt16 ToolBox::ImplFindItemPos( const Point& rPos ) const
{ {
sal_uInt16 nPos = 0; sal_uInt16 nPos = 0;
long nLast = 0; long nLast = 0;
Point aPos = rPos; Point aPos = rPos;
Size aSize( pBox->mnDX, pBox->mnDY ); Size aSize( mnDX, mnDY );
if ( aPos.X() > aSize.Width()-TB_BORDER_OFFSET1 ) if ( aPos.X() > aSize.Width()-TB_BORDER_OFFSET1 )
aPos.X() = aSize.Width()-TB_BORDER_OFFSET1; aPos.X() = aSize.Width()-TB_BORDER_OFFSET1;
...@@ -1078,14 +1078,14 @@ sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos ) ...@@ -1078,14 +1078,14 @@ sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos )
aPos.Y() = aSize.Height()-TB_BORDER_OFFSET1; aPos.Y() = aSize.Height()-TB_BORDER_OFFSET1;
// Item suchen, das geklickt wurde // Item suchen, das geklickt wurde
ImplToolItems::const_iterator it = pBox->mpData->m_aItems.begin(); ImplToolItems::const_iterator it = mpData->m_aItems.begin();
while ( it != pBox->mpData->m_aItems.end() ) while ( it != mpData->m_aItems.end() )
{ {
if ( it->mbVisible ) if ( it->mbVisible )
{ {
if ( nLast || !it->maRect.IsEmpty() ) if ( nLast || !it->maRect.IsEmpty() )
{ {
if ( pBox->mbHorz ) if ( mbHorz )
{ {
if ( nLast && if ( nLast &&
((nLast < it->maRect.Top()) || it->maRect.IsEmpty()) ) ((nLast < it->maRect.Top()) || it->maRect.IsEmpty()) )
...@@ -1218,7 +1218,7 @@ void ImplTBDragMgr::Dragging( const Point& rPos ) ...@@ -1218,7 +1218,7 @@ void ImplTBDragMgr::Dragging( const Point& rPos )
{ {
if ( mnLineMode ) if ( mnLineMode )
{ {
ToolBox::ImplLineSizing( mpDragBox, rPos, maRect, mnLineMode ); mpDragBox->ImplLineSizing( rPos, maRect, mnLineMode );
Point aOff = mpDragBox->OutputToScreenPixel( Point() ); Point aOff = mpDragBox->OutputToScreenPixel( Point() );
maRect.Move( aOff.X(), aOff.Y() ); maRect.Move( aOff.X(), aOff.Y() );
mpDragBox->Docking( rPos, maRect ); mpDragBox->Docking( rPos, maRect );
...@@ -1311,7 +1311,7 @@ void ImplTBDragMgr::EndDragging( bool bOK ) ...@@ -1311,7 +1311,7 @@ void ImplTBDragMgr::EndDragging( bool bOK )
} }
aPos = pDropBox->ScreenToOutputPixel( aPos ); aPos = pDropBox->ScreenToOutputPixel( aPos );
ToolBox::ImplFindItemPos( pDropBox, aPos ); pDropBox->ImplFindItemPos( aPos );
} }
} }
} }
...@@ -1972,7 +1972,7 @@ bool ToolBox::ImplCalcItem() ...@@ -1972,7 +1972,7 @@ bool ToolBox::ImplCalcItem()
return false; return false;
} }
sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, bool bCalcHorz ) sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, bool bCalcHorz ) const
{ {
sal_uLong nLineStart = 0; sal_uLong nLineStart = 0;
sal_uLong nGroupStart = 0; sal_uLong nGroupStart = 0;
...@@ -2132,9 +2132,9 @@ Size ToolBox::ImplGetOptimalFloatingSize() ...@@ -2132,9 +2132,9 @@ Size ToolBox::ImplGetOptimalFloatingSize()
// try to preserve current height // try to preserve current height
// calc number of floating lines for current window height // calc number of floating lines for current window height
sal_uInt16 nFloatLinesHeight = ImplCalcLines( this, mnDY ); sal_uInt16 nFloatLinesHeight = ImplCalcLines( mnDY );
// calc window size according to this number // calc window size according to this number
aSize1 = ImplCalcFloatSize( this, nFloatLinesHeight ); aSize1 = ImplCalcFloatSize( nFloatLinesHeight );
if( aCurrentSize == aSize1 ) if( aCurrentSize == aSize1 )
return aSize1; return aSize1;
...@@ -2149,7 +2149,7 @@ Size ToolBox::ImplGetOptimalFloatingSize() ...@@ -2149,7 +2149,7 @@ Size ToolBox::ImplGetOptimalFloatingSize()
sal_uInt16 nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz ); sal_uInt16 nLines = ImplCalcBreaks( aSz.Width()-nBorderX, &maxX, mbHorz );
sal_uInt16 manyLines = 1000; sal_uInt16 manyLines = 1000;
Size aMinimalFloatSize = ImplCalcFloatSize( this, manyLines ); Size aMinimalFloatSize = ImplCalcFloatSize( manyLines );
aSz.Height() = nBorderY + nLineHeight * nLines; aSz.Height() = nBorderY + nLineHeight * nLines;
// line space when more than one line // line space when more than one line
...@@ -2160,7 +2160,7 @@ Size ToolBox::ImplGetOptimalFloatingSize() ...@@ -2160,7 +2160,7 @@ Size ToolBox::ImplGetOptimalFloatingSize()
// avoid clipping of any items // avoid clipping of any items
if( aSz.Width() < aMinimalFloatSize.Width() ) if( aSz.Width() < aMinimalFloatSize.Width() )
aSize2 = ImplCalcFloatSize( this, nLines ); aSize2 = ImplCalcFloatSize( nLines );
else else
aSize2 = aSz; aSize2 = aSz;
...@@ -2240,13 +2240,13 @@ void ToolBox::ImplFormat( bool bResize ) ...@@ -2240,13 +2240,13 @@ void ToolBox::ImplFormat( bool bResize )
maFloatSizes.clear(); maFloatSizes.clear();
// compute border sizes // compute border sizes
ImplCalcBorder( meAlign, mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder, this ); ImplCalcBorder( meAlign, mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
// update drag area (where the 'grip' will be placed) // update drag area (where the 'grip' will be placed)
Rectangle aOldDragRect; Rectangle aOldDragRect;
if( pWrapper ) if( pWrapper )
aOldDragRect = pWrapper->GetDragArea(); aOldDragRect = pWrapper->GetDragArea();
ImplUpdateDragArea( this ); ImplUpdateDragArea();
if ( ImplCalcItem() ) if ( ImplCalcItem() )
bMustFullPaint = true; bMustFullPaint = true;
...@@ -2258,7 +2258,7 @@ void ToolBox::ImplFormat( bool bResize ) ...@@ -2258,7 +2258,7 @@ void ToolBox::ImplFormat( bool bResize )
if ( ImplIsFloatingMode() ) if ( ImplIsFloatingMode() )
{ {
if ( bResize ) if ( bResize )
mnFloatLines = ImplCalcLines( this, mnDY ); mnFloatLines = ImplCalcLines( mnDY );
else else
SetOutputSizePixel( ImplGetOptimalFloatingSize() ); SetOutputSizePixel( ImplGetOptimalFloatingSize() );
} }
...@@ -2276,7 +2276,7 @@ void ToolBox::ImplFormat( bool bResize ) ...@@ -2276,7 +2276,7 @@ void ToolBox::ImplFormat( bool bResize )
if ( mbScroll ) if ( mbScroll )
{ {
nMax = mnDX; nMax = mnDX;
mnVisLines = ImplCalcLines( this, mnDY ); mnVisLines = ImplCalcLines( mnDY );
} }
else else
{ {
...@@ -2316,7 +2316,7 @@ void ToolBox::ImplFormat( bool bResize ) ...@@ -2316,7 +2316,7 @@ void ToolBox::ImplFormat( bool bResize )
if ( mbScroll ) if ( mbScroll )
{ {
mnVisLines = ImplCalcLines( this, mnDX ); mnVisLines = ImplCalcLines( mnDX );
nMax = mnDY; nMax = mnDY;
} }
else else
...@@ -2848,7 +2848,7 @@ void ToolBox::ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighl ...@@ -2848,7 +2848,7 @@ void ToolBox::ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighl
return; return;
// execute pending paint requests // execute pending paint requests
ImplCheckUpdate(this); ImplCheckUpdate();
rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
...@@ -2976,7 +2976,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si ...@@ -2976,7 +2976,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
return; return;
// execute pending paint requests // execute pending paint requests
ImplCheckUpdate(this); ImplCheckUpdate();
ImplDisableFlatButtons(); ImplDisableFlatButtons();
...@@ -3666,7 +3666,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) ...@@ -3666,7 +3666,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
{ {
if ( rMEvt.GetMode() & MouseEventModifiers::SIMPLEMOVE ) if ( rMEvt.GetMode() & MouseEventModifiers::SIMPLEMOVE )
{ {
sal_uInt16 nLinePtr = ImplTestLineSize( this, rMEvt.GetPosPixel() ); sal_uInt16 nLinePtr = ImplTestLineSize( rMEvt.GetPosPixel() );
if ( nLinePtr & DOCK_LINEHSIZE ) if ( nLinePtr & DOCK_LINEHSIZE )
{ {
if ( meAlign == WindowAlign::Left ) if ( meAlign == WindowAlign::Left )
...@@ -3982,7 +3982,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -3982,7 +3982,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
// Linesizing testen // Linesizing testen
if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING ) if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING )
{ {
sal_uInt16 nLineMode = ImplTestLineSize( this, aMousePos ); sal_uInt16 nLineMode = ImplTestLineSize( aMousePos );
if ( nLineMode ) if ( nLineMode )
{ {
ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
...@@ -4583,8 +4583,8 @@ void ToolBox::ToggleFloatingMode() ...@@ -4583,8 +4583,8 @@ void ToolBox::ToggleFloatingMode()
if( bOldHorz != mbHorz ) if( bOldHorz != mbHorz )
mbCalc = true; // orientation was changed ! mbCalc = true; // orientation was changed !
ImplSetMinMaxFloatSize( this ); ImplSetMinMaxFloatSize();
SetOutputSizePixel( ImplCalcFloatSize( this, mnFloatLines ) ); SetOutputSizePixel( ImplCalcFloatSize( mnFloatLines ) );
} }
else else
{ {
...@@ -4637,7 +4637,7 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect ) ...@@ -4637,7 +4637,7 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect )
// so the calculation only depends on the position of the rectangle, not the current // so the calculation only depends on the position of the rectangle, not the current
// docking state of the window // docking state of the window
sal_uInt16 nTemp = 0; sal_uInt16 nTemp = 0;
aDockingRect.SetSize( ImplCalcFloatSize( this, nTemp ) ); aDockingRect.SetSize( ImplCalcFloatSize( nTemp ) );
// in this mode docking is never done by keyboard, so it's OK to use the mouse position // in this mode docking is never done by keyboard, so it's OK to use the mouse position
aDockingRect.SetPos( ImplGetFrameWindow()->GetPointerPosPixel() ); aDockingRect.SetPos( ImplGetFrameWindow()->GetPointerPosPixel() );
...@@ -4648,8 +4648,8 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect ) ...@@ -4648,8 +4648,8 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect )
{ {
Rectangle aInRect = maInDockRect; Rectangle aInRect = maInDockRect;
Size aDockSize; Size aDockSize;
aDockSize.Width() = ImplCalcSize( this, mnLines, TB_CALCMODE_VERT ).Width(); aDockSize.Width() = ImplCalcSize( mnLines, TB_CALCMODE_VERT ).Width();
aDockSize.Height() = ImplCalcSize( this, mnLines, TB_CALCMODE_HORZ ).Height(); aDockSize.Height() = ImplCalcSize( mnLines, TB_CALCMODE_HORZ ).Height();
aInRect.Left() += aDockSize.Width()/2; aInRect.Left() += aDockSize.Width()/2;
aInRect.Top() += aDockSize.Height()/2; aInRect.Top() += aDockSize.Height()/2;
aInRect.Right() -= aDockSize.Width()/2; aInRect.Right() -= aDockSize.Width()/2;
...@@ -4732,7 +4732,7 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect ) ...@@ -4732,7 +4732,7 @@ bool ToolBox::Docking( const Point& rPos, Rectangle& rRect )
if ( !mbLastFloatMode ) if ( !mbLastFloatMode )
{ {
sal_uInt16 nTemp = 0; sal_uInt16 nTemp = 0;
aDockingRect.SetSize( ImplCalcFloatSize( this, nTemp ) ); aDockingRect.SetSize( ImplCalcFloatSize( nTemp ) );
} }
} }
...@@ -4761,7 +4761,7 @@ void ToolBox::Resizing( Size& rSize ) ...@@ -4761,7 +4761,7 @@ void ToolBox::Resizing( Size& rSize )
sal_uInt16 nTemp; sal_uInt16 nTemp;
// Alle Floatinggroessen berechnen // Alle Floatinggroessen berechnen
ImplCalcFloatSizes( this ); ImplCalcFloatSizes();
if ( !mnLastResizeDY ) if ( !mnLastResizeDY )
mnLastResizeDY = mnDY; mnLastResizeDY = mnDY;
...@@ -4769,22 +4769,22 @@ void ToolBox::Resizing( Size& rSize ) ...@@ -4769,22 +4769,22 @@ void ToolBox::Resizing( Size& rSize )
// Ist vertikales Resizing angesagt // Ist vertikales Resizing angesagt
if ( (mnLastResizeDY != rSize.Height()) && (mnDY != rSize.Height()) ) if ( (mnLastResizeDY != rSize.Height()) && (mnDY != rSize.Height()) )
{ {
nCalcLines = ImplCalcLines( this, rSize.Height() ); nCalcLines = ImplCalcLines( rSize.Height() );
if ( nCalcLines < 1 ) if ( nCalcLines < 1 )
nCalcLines = 1; nCalcLines = 1;
rSize = ImplCalcFloatSize( this, nCalcLines ); rSize = ImplCalcFloatSize( nCalcLines );
} }
else else
{ {
nCalcLines = 1; nCalcLines = 1;
nTemp = nCalcLines; nTemp = nCalcLines;
Size aTempSize = ImplCalcFloatSize( this, nTemp ); Size aTempSize = ImplCalcFloatSize( nTemp );
while ( (aTempSize.Width() > rSize.Width()) && while ( (aTempSize.Width() > rSize.Width()) &&
(nCalcLines <= maFloatSizes[0].mnLines) ) (nCalcLines <= maFloatSizes[0].mnLines) )
{ {
nCalcLines++; nCalcLines++;
nTemp = nCalcLines; nTemp = nCalcLines;
aTempSize = ImplCalcFloatSize( this, nTemp ); aTempSize = ImplCalcFloatSize( nTemp );
} }
rSize = aTempSize; rSize = aTempSize;
} }
...@@ -4813,7 +4813,7 @@ Size ToolBox::GetOptimalSize() const ...@@ -4813,7 +4813,7 @@ Size ToolBox::GetOptimalSize() const
} }
} }
Size aSize(ImplCalcSize( this, mnLines )); Size aSize(const_cast<ToolBox *>(this)->ImplCalcSize( mnLines ));
for (std::map<vcl::Window*, Size>::iterator aI = aExpandables.begin(); aI != aExpandables.end(); ++aI) for (std::map<vcl::Window*, Size>::iterator aI = aExpandables.begin(); aI != aExpandables.end(); ++aI)
{ {
...@@ -4825,23 +4825,23 @@ Size ToolBox::GetOptimalSize() const ...@@ -4825,23 +4825,23 @@ Size ToolBox::GetOptimalSize() const
return aSize; return aSize;
} }
Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines ) const Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines )
{ {
return ImplCalcSize( this, nCalcLines ); return ImplCalcSize( nCalcLines );
} }
Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const Size ToolBox::CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign )
{ {
return ImplCalcSize( this, nCalcLines, return ImplCalcSize( nCalcLines,
(eAlign == WindowAlign::Top || eAlign == WindowAlign::Bottom) ? TB_CALCMODE_HORZ : TB_CALCMODE_VERT ); (eAlign == WindowAlign::Top || eAlign == WindowAlign::Bottom) ? TB_CALCMODE_HORZ : TB_CALCMODE_VERT );
} }
sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) sal_uInt16 ToolBox::ImplCountLineBreaks() const
{ {
sal_uInt16 nLines = 0; sal_uInt16 nLines = 0;
ImplToolItems::const_iterator it = const_cast<ToolBox*>(pThis)->mpData->m_aItems.begin(); ImplToolItems::const_iterator it = mpData->m_aItems.begin();
while ( it != const_cast<ToolBox*>(pThis)->mpData->m_aItems.end() ) while ( it != mpData->m_aItems.end() )
{ {
if( it->meType == ToolBoxItemType::BREAK ) if( it->meType == ToolBoxItemType::BREAK )
++nLines; ++nLines;
...@@ -4850,10 +4850,10 @@ sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis ) ...@@ -4850,10 +4850,10 @@ sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis )
return nLines; return nLines;
} }
Size ToolBox::CalcPopupWindowSizePixel() const Size ToolBox::CalcPopupWindowSizePixel()
{ {
// count number of breaks and calc corresponding floating window size // count number of breaks and calc corresponding floating window size
sal_uInt16 nLines = ImplCountLineBreaks( this ); sal_uInt16 nLines = ImplCountLineBreaks();
if( nLines ) if( nLines )
++nLines; // add the first line ++nLines; // add the first line
...@@ -4864,45 +4864,43 @@ Size ToolBox::CalcPopupWindowSizePixel() const ...@@ -4864,45 +4864,43 @@ Size ToolBox::CalcPopupWindowSizePixel() const
} }
bool bPopup = mpData->mbAssumePopupMode; bool bPopup = mpData->mbAssumePopupMode;
ToolBox *pThis = const_cast<ToolBox*>(this); mpData->mbAssumePopupMode = true;
pThis->mpData->mbAssumePopupMode = true;
Size aSize = CalcFloatingWindowSizePixel( nLines ); Size aSize = CalcFloatingWindowSizePixel( nLines );
pThis->mpData->mbAssumePopupMode = bPopup; mpData->mbAssumePopupMode = bPopup;
return aSize; return aSize;
} }
Size ToolBox::CalcFloatingWindowSizePixel() const Size ToolBox::CalcFloatingWindowSizePixel()
{ {
sal_uInt16 nLines = ImplCountLineBreaks( this ); sal_uInt16 nLines = ImplCountLineBreaks();
++nLines; // add the first line ++nLines; // add the first line
return CalcFloatingWindowSizePixel( nLines ); return CalcFloatingWindowSizePixel( nLines );
} }
Size ToolBox::CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const Size ToolBox::CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines )
{ {
bool bFloat = mpData->mbAssumeFloating; bool bFloat = mpData->mbAssumeFloating;
bool bDocking = mpData->mbAssumeDocked; bool bDocking = mpData->mbAssumeDocked;
// simulate floating mode and force reformat before calculating // simulate floating mode and force reformat before calculating
ToolBox *pThis = const_cast<ToolBox*>(this); mpData->mbAssumeFloating = true;
pThis->mpData->mbAssumeFloating = true; mpData->mbAssumeDocked = false;
pThis->mpData->mbAssumeDocked = false;
Size aSize = ImplCalcFloatSize( const_cast<ToolBox*>(this), nCalcLines ); Size aSize = ImplCalcFloatSize( nCalcLines );
pThis->mbFormat = true; mbFormat = true;
pThis->mpData->mbAssumeFloating = bFloat; mpData->mbAssumeFloating = bFloat;
pThis->mpData->mbAssumeDocked = bDocking; mpData->mbAssumeDocked = bDocking;
return aSize; return aSize;
} }
Size ToolBox::CalcMinimumWindowSizePixel() const Size ToolBox::CalcMinimumWindowSizePixel()
{ {
if( ImplIsFloatingMode() ) if( ImplIsFloatingMode() )
return ImplCalcSize( this, mnFloatLines ); return ImplCalcSize( mnFloatLines );
else else
{ {
// create dummy toolbox for measurements // create dummy toolbox for measurements
...@@ -5497,7 +5495,7 @@ bool ToolBox::ImplChangeHighlightUpDn( bool bUp, bool bNoCycle ) ...@@ -5497,7 +5495,7 @@ bool ToolBox::ImplChangeHighlightUpDn( bool bUp, bool bNoCycle )
} }
// select the menu button if a clipped item would be selected // select the menu button if a clipped item would be selected
if( (it != mpData->m_aItems.end() && &(*it) == ImplGetFirstClippedItem( this )) && IsMenuEnabled() ) if( (it != mpData->m_aItems.end() && &(*it) == ImplGetFirstClippedItem()) && IsMenuEnabled() )
{ {
ImplChangeHighlight( nullptr ); ImplChangeHighlight( nullptr );
InvalidateMenuButton(); InvalidateMenuButton();
......
...@@ -775,10 +775,10 @@ sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const ...@@ -775,10 +775,10 @@ sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const
return 0; return 0;
} }
Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) const Size ToolBox::GetItemContentSize( sal_uInt16 nItemId )
{ {
if ( mbCalc || mbFormat ) if ( mbCalc || mbFormat )
(const_cast<ToolBox*>(this))->ImplFormat(); ImplFormat();
ImplToolItems::size_type nPos = GetItemPos( nItemId ); ImplToolItems::size_type nPos = GetItemPos( nItemId );
if ( nPos < mpData->m_aItems.size() ) if ( nPos < mpData->m_aItems.size() )
...@@ -855,19 +855,19 @@ Point ToolBox::ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) ...@@ -855,19 +855,19 @@ Point ToolBox::ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize )
return aPos; return aPos;
} }
Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) const Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId )
{ {
if ( mbCalc || mbFormat ) if ( mbCalc || mbFormat )
const_cast<ToolBox*>(this)->ImplFormat(); ImplFormat();
ImplToolItems::size_type nPos = GetItemPos( nItemId ); ImplToolItems::size_type nPos = GetItemPos( nItemId );
return GetItemPosRect( nPos ); return GetItemPosRect( nPos );
} }
Rectangle ToolBox::GetItemPosRect( ImplToolItems::size_type nPos ) const Rectangle ToolBox::GetItemPosRect( ImplToolItems::size_type nPos )
{ {
if ( mbCalc || mbFormat ) if ( mbCalc || mbFormat )
const_cast<ToolBox*>(this)->ImplFormat(); ImplFormat();
if ( nPos < mpData->m_aItems.size() ) if ( nPos < mpData->m_aItems.size() )
return mpData->m_aItems[nPos].maRect; return mpData->m_aItems[nPos].maRect;
...@@ -1471,7 +1471,7 @@ void ToolBox::ImplUpdateInputEnable() ...@@ -1471,7 +1471,7 @@ void ToolBox::ImplUpdateInputEnable()
mpData->mbKeyInputDisabled = true; mpData->mbKeyInputDisabled = true;
} }
void ToolBox::ImplFillLayoutData() const void ToolBox::ImplFillLayoutData()
{ {
mpData->m_pLayoutData = new ToolBoxLayoutData; mpData->m_pLayoutData = new ToolBoxLayoutData;
...@@ -1482,18 +1482,18 @@ void ToolBox::ImplFillLayoutData() const ...@@ -1482,18 +1482,18 @@ void ToolBox::ImplFillLayoutData() const
// only draw, if the rectangle is within PaintRectangle // only draw, if the rectangle is within PaintRectangle
if (!pItem->maRect.IsEmpty()) if (!pItem->maRect.IsEmpty())
const_cast<ToolBox*>(this)->InvalidateItem(i); InvalidateItem(i);
} }
} }
OUString ToolBox::GetDisplayText() const OUString ToolBox::GetDisplayText() const
{ {
if( ! mpData->m_pLayoutData ) if( ! mpData->m_pLayoutData )
ImplFillLayoutData(); const_cast<ToolBox *>(this)->ImplFillLayoutData();
return mpData->m_pLayoutData ? OUString(mpData->m_pLayoutData->m_aDisplayText) : OUString(); return mpData->m_pLayoutData ? OUString(mpData->m_pLayoutData->m_aDisplayText) : OUString();
} }
Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex )
{ {
long nItemIndex = -1; long nItemIndex = -1;
if( ! mpData->m_pLayoutData ) if( ! mpData->m_pLayoutData )
...@@ -1512,7 +1512,7 @@ Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const ...@@ -1512,7 +1512,7 @@ Rectangle ToolBox::GetCharacterBounds( sal_uInt16 nItemID, long nIndex ) const
return (mpData->m_pLayoutData && nItemIndex != -1) ? mpData->m_pLayoutData->GetCharacterBounds( nItemIndex+nIndex ) : Rectangle(); return (mpData->m_pLayoutData && nItemIndex != -1) ? mpData->m_pLayoutData->GetCharacterBounds( nItemIndex+nIndex ) : Rectangle();
} }
long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID )
{ {
long nIndex = -1; long nIndex = -1;
rItemID = 0; rItemID = 0;
...@@ -1555,7 +1555,7 @@ void ToolBox::SetMenuType( ToolBoxMenuType aType ) ...@@ -1555,7 +1555,7 @@ void ToolBox::SetMenuType( ToolBoxMenuType aType )
mbFormat = true; mbFormat = true;
ImplFormat(); ImplFormat();
ImplSetMinMaxFloatSize( this ); ImplSetMinMaxFloatSize();
} }
else else
{ {
......
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