diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2011-07-13 14:20:14 +0200 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2011-07-14 08:19:55 +0200 |
commit | 28ee3e903dfed99d66b0dd190ccef91306d0c8c1 (patch) | |
tree | e55e715f64069b99f977192ddf72e97ef2126344 /vcl | |
parent | e8d4b4ffa0cb615e712e4a33879ab96901c8c321 (diff) |
callcatcher: ToolBox cleanup
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/toolbox.hxx | 29 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 132 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 182 |
3 files changed, 0 insertions, 343 deletions
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 5badbc2d13bd..4542a51984b7 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -274,7 +274,6 @@ private: SAL_DLLPRIVATE sal_Bool ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False ); SAL_DLLPRIVATE sal_uInt16 ImplGetItemLine( ImplToolItem* pCurrentItem ); SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( sal_uInt16 nLine ); - SAL_DLLPRIVATE ImplToolItem* ImplGetLastValidItem( sal_uInt16 nLine ); SAL_DLLPRIVATE sal_Bool ImplOpenItem( KeyCode aKeyCode ); SAL_DLLPRIVATE sal_Bool ImplActivateItem( KeyCode aKeyCode ); SAL_DLLPRIVATE void ImplShowFocus(); @@ -332,9 +331,6 @@ public: static SAL_DLLPRIVATE void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlack, sal_Bool bColTransform, sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, long nSize = 6 ); - static SAL_DLLPRIVATE void SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False, - long nSize = 6 ); static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ); static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis ); SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } @@ -401,12 +397,9 @@ public: sal_uInt16 nPixSize = 0 ); void InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND ); void RemoveItem( sal_uInt16 nPos ); - void MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); - void CopyItems( const ToolBox& rToolBox ); void Clear(); - void RecalcItems(); const ImageList& GetImageList() const { return maImageList; } void SetImageList( const ImageList& rImageList ); @@ -429,7 +422,6 @@ public: // Used to enable/disable scrolling one page at a time for toolbar void SetPageScroll( sal_Bool b ); - sal_Bool GetPageScroll(); void SetNextToolBox( const XubString& rStr ); const XubString& GetNextToolBox() const { return maNextToolBoxStr; } @@ -442,14 +434,12 @@ public: sal_uInt16 GetItemId( const Point& rPos ) const; Rectangle GetItemRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosRect( sal_uInt16 nPos ) const; - Rectangle GetItemDropDownRect( sal_uInt16 nItemId ) const; Rectangle GetItemPosDropDownRect( sal_uInt16 nPos ) const; // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown) Point GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const; Rectangle GetScrollRect() const; - Rectangle GetMenubuttonRect() const; sal_uInt16 GetCurItemId() const { return mnCurItemId; } sal_uInt16 GetDownItemId() const { return mnDownItemId; } sal_uInt16 GetClicks() const { return mnMouseClicks; } @@ -464,11 +454,7 @@ public: void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ); - long GetItemImageAngle( sal_uInt16 nItemId ) const; void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ); - sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const; - void SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ); - Image GetItemHighImage( sal_uInt16 nItemId ) const; void SetItemText( sal_uInt16 nItemId, const XubString& rText ); const XubString& GetItemText( sal_uInt16 nItemId ) const; void SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow ); @@ -479,7 +465,6 @@ public: void EndSelection(); void SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True ); - sal_Bool IsItemDown( sal_uInt16 nItemId ) const; void SetItemState( sal_uInt16 nItemId, TriState eState ); TriState GetItemState( sal_uInt16 nItemId ) const; @@ -552,14 +537,8 @@ public: void EnableCustomize( sal_Bool bEnable = sal_True ); sal_Bool IsCustomize() { return mbCustomize; } - void StartCustomize( const Rectangle& rRect, void* pData = NULL ); - void SetCustomizeMode( sal_Bool ); sal_Bool IsInCustomizeMode() const { return mbCustomizeMode; } - static void StartCustomizeMode(); - static void EndCustomizeMode(); - static sal_Bool IsCustomizeMode(); - void SetHelpText( const XubString& rText ) { DockingWindow::SetHelpText( rText ); } const XubString& GetHelpText() const @@ -600,7 +579,6 @@ public: PopupMenu* GetMenu() const; void UpdateCustomMenu(); void SetMenuButtonHdl( const Link& rLink ); - const Link& GetMenuButtonHdl() const; // open custommenu void ExecuteCustomMenu(); @@ -625,13 +603,6 @@ public: // -1 is returned if no character is at that point // if an index is found the corresponding item id is filled in (else 0) long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; - // returns the number of portions in the result of GetDisplayText() - long GetTextCount() const; - // returns the interval [start,end] of text portion nText - // returns [-1,-1] for an invalid text number - Pair GetTextStartEnd( long nText ) const; - // returns the item id for text portion nText or 0 if nText is invalid - sal_uInt16 GetDisplayItemId( long nText ) const; const Size& GetDefaultImageSize() const; void ChangeHighlight( sal_uInt16 nPos ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 8ffe04c4208a..e43f1c1fc8bd 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -195,8 +195,6 @@ public: DECL_LINK( SelectHdl, Accelerator* ); void StartCustomizeMode(); - void EndCustomizeMode(); - sal_Bool IsCustomizeMode() { return mbCustomizeMode; } sal_Bool IsResizeMode() { return mbResizeMode; } }; @@ -3178,60 +3176,6 @@ void ToolBox::ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlac } } -void ToolBox::SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, - sal_Bool bLeft, sal_Bool bTop, long nSize ) -{ - WindowAlign eAlign = pBox->meAlign; - long nHalfSize; - if ( bLeft ) - eAlign = WINDOWALIGN_RIGHT; - else if ( bTop ) - eAlign = WINDOWALIGN_BOTTOM; - - nHalfSize = nSize/2; - - Point p[6]; - - switch ( eAlign ) - { - case WINDOWALIGN_LEFT: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nSize+1; - p[2].X() = nX+1; p[2].Y() = nY+nSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nHalfSize-1; - p[5].X() = nX+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_TOP: - p[0].X() = nX-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+1; - p[2].X() = nX+nHalfSize-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize+1; p[3].Y() = nY+nHalfSize+1; - p[4].X() = nX+nSize+1; p[4].Y() = nY+1; - p[5].X() = nX+nSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_RIGHT: - p[0].X() = nX+nHalfSize-1; p[0].Y() = nY-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize-1; - p[2].X() = nX-1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nHalfSize-1; p[3].Y() = nY+nSize+1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY+nSize+1; - p[5].X() = nX+nHalfSize+1; p[5].Y() = nY-1; - break; - case WINDOWALIGN_BOTTOM: - p[0].X() = nX-1; p[0].Y() = nY+nHalfSize-1; - p[1].X() = nX-1; p[1].Y() = nY+nHalfSize+1; - p[2].X() = nX+nSize+1; p[2].Y() = nY+nHalfSize+1; - p[3].X() = nX+nSize+1; p[3].Y() = nY+nHalfSize-1; - p[4].X() = nX+nHalfSize+1; p[4].Y() = nY-1; - p[5].X() = nX+nHalfSize-1; p[5].Y() = nY-1; - break; - } - Polygon aPoly(6,p); - Region aRgn( aPoly ); - pBox->SetClipRegion( aRgn ); -} - // ----------------------------------------------------------------------- void ToolBox::ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight ) @@ -3868,14 +3812,6 @@ void ToolBox::ImplStartCustomizeMode() } } -void ToolBox::SetCustomizeMode( sal_Bool bSet ) -{ - if ( bSet ) - ImplStartCustomizeMode(); - else - ImplEndCustomizeMode(); -} - // ----------------------------------------------------------------------- void ToolBox::ImplEndCustomizeMode() @@ -5545,33 +5481,6 @@ void ToolBox::EnableCustomize( sal_Bool bEnable ) // ----------------------------------------------------------------------- -void ToolBox::StartCustomize( const Rectangle& rRect, void* pData ) -{ - DBG_ASSERT( mbCustomize, - "ToolBox::StartCustomize(): ToolBox must be customized" ); - - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - Point aMousePos = GetPointerPosPixel(); - Point aPos = ScreenToOutputPixel( rRect.TopLeft() ); - Rectangle aRect( aPos.X(), aPos.Y(), - aPos.X()+rRect.GetWidth()+SMALLBUTTON_HSIZE, - aPos.Y()+rRect.GetHeight()+SMALLBUTTON_VSIZE ); - aMousePos = ScreenToOutputPixel( aPos ); - Pointer aPtr; - SetPointer( aPtr ); - pMgr->StartDragging( this, aMousePos, aRect, 0, sal_False, pData ); -} - -// ----------------------------------------------------------------------- - -void ToolBox::StartCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - pMgr->StartCustomizeMode(); -} - -// ----------------------------------------------------------------------- - void ToolBox::EndCustomizeMode() { ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); @@ -5580,14 +5489,6 @@ void ToolBox::EndCustomizeMode() // ----------------------------------------------------------------------- -sal_Bool ToolBox::IsCustomizeMode() -{ - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - return pMgr->IsCustomizeMode(); -} - -// ----------------------------------------------------------------------- - void ToolBox::GetFocus() { DockingWindow::GetFocus(); @@ -5985,39 +5886,6 @@ ImplToolItem* ToolBox::ImplGetFirstValidItem( sal_uInt16 nLine ) return (it == mpData->m_aItems.end()) ? NULL : &(*it); } -// returns the last displayable item in the given line -ImplToolItem* ToolBox::ImplGetLastValidItem( sal_uInt16 nLine ) -{ - if( !nLine || nLine > mnCurLines ) - return NULL; - - nLine--; - ImplToolItem *pFound = NULL; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - while( it != mpData->m_aItems.end() ) - { - // find correct line - if ( it->mbBreak ) - nLine--; - if( !nLine ) - { - // find last useful item - while( it != mpData->m_aItems.end() && ((it->meType == TOOLBOXITEM_BUTTON) && - /*it->mbEnabled &&*/ it->mbVisible && !ImplIsFixedControl( &(*it) )) ) - { - pFound = &(*it); - ++it; - if( it == mpData->m_aItems.end() || it->mbBreak ) - return pFound; // end of line: return last useful item - } - return pFound; - } - ++it; - } - - return pFound; -} - // ----------------------------------------------------------------------- sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ) diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 348ecec00104..3e32f5d02bf2 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -828,41 +828,6 @@ void ToolBox::RemoveItem( sal_uInt16 nPos ) // ----------------------------------------------------------------------- -void ToolBox::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos == nNewPos ) - return; - - if ( nPos < nNewPos ) - nNewPos--; - - // Existiert Item - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - { - // ToolBox-Item in der Liste verschieben - ImplToolItem aItem = mpData->m_aItems[nPos]; - mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos ); - mpData->m_aItems.insert( (nNewPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nNewPos : mpData->m_aItems.end(), aItem ); - mpData->ImplClearLayoutData(); - - // ToolBox neu ausgeben - ImplInvalidate( sal_False ); - - // Notify - if( nPos < nNewPos ) // only send one event, all indices above this item are invalid anyway - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMREMOVED, reinterpret_cast< void* >( nPos ) ); - else - { - sal_uInt16 nNewPos2 = sal::static_int_cast<sal_uInt16>(( nNewPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nNewPos); - ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos2 ) ); - } - } -} - -// ----------------------------------------------------------------------- - void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos ) { @@ -893,29 +858,6 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, // ----------------------------------------------------------------------- -void ToolBox::CopyItems( const ToolBox& rToolBox ) -{ - mpData->ImplClearLayoutData(); - mpData->m_aItems = rToolBox.mpData->m_aItems; - // Absichern gegen das Loeschen im Select-Handler - mnCurItemId = 0; - mnHighItemId = 0; - - for( std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); - it != mpData->m_aItems.end(); ++it ) - { - it->mpWindow = NULL; - it->mbShowWindow = sal_False; - } - - ImplInvalidate( sal_True, sal_True ); - - // Notify - ImplCallEventListeners( VCLEVENT_TOOLBOX_ALLITEMSCHANGED ); -} - -// ----------------------------------------------------------------------- - void ToolBox::Clear() { mpData->m_aItems.clear(); @@ -1043,11 +985,6 @@ void ToolBox::SetPageScroll( sal_Bool b ) mpData->mbPageScroll = b; } -sal_Bool ToolBox::GetPageScroll() -{ - return mpData->mbPageScroll; -} - // ----------------------------------------------------------------------- void ToolBox::SetNextToolBox( const XubString& rStr ) @@ -1225,16 +1162,6 @@ Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const } // ----------------------------------------------------------------------- -Rectangle ToolBox::GetItemDropDownRect( sal_uInt16 nItemId ) const -{ - if ( mbCalc || mbFormat ) - ((ToolBox*)this)->ImplFormat(); - - sal_uInt16 nPos = GetItemPos( nItemId ); - return GetItemPosDropDownRect( nPos ); -} - -// ----------------------------------------------------------------------- Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const { @@ -1249,11 +1176,6 @@ Rectangle ToolBox::GetItemPosDropDownRect( sal_uInt16 nPos ) const // ----------------------------------------------------------------------- -Rectangle ToolBox::GetMenubuttonRect() const -{ - return mpData->maMenubuttonItem.maRect; -} - sal_Bool ToolBox::ImplHasExternalMenubutton() { // check if the borderwindow (i.e. the decoration) provides the menu button @@ -1459,55 +1381,6 @@ Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -long ToolBox::GetItemImageAngle( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mnImageAngle; - else - return 0; -} - -// ----------------------------------------------------------------------- - -sal_Bool ToolBox::GetItemImageMirrorMode( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->mbMirrorMode; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void ToolBox::SetItemHighImage( sal_uInt16 nItemId, const Image& rImage ) -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - if ( pItem ) - { - DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) || - ((!rImage) == sal_True), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" ); - pItem->maHighImage = rImage; - } -} - -// ----------------------------------------------------------------------- - -Image ToolBox::GetItemHighImage( sal_uInt16 nItemId ) const -{ - ImplToolItem* pItem = ImplGetItem( nItemId ); - - if ( pItem ) - return pItem->maHighImage; - else - return Image(); -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1668,18 +1541,6 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease // ----------------------------------------------------------------------- -sal_Bool ToolBox::IsItemDown( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - - if ( nPos != TOOLBOX_ITEM_NOTFOUND ) - return (nPos == mnCurPos); - else - return sal_False; -} - -// ----------------------------------------------------------------------- - void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) { sal_uInt16 nPos = GetItemPos( nItemId ); @@ -1969,13 +1830,6 @@ void ToolBox::SetOutStyle( sal_uInt16 nNewStyle ) // ----------------------------------------------------------------------- -void ToolBox::RecalcItems() -{ - ImplInvalidate( sal_True ); -} - -// ----------------------------------------------------------------------- - // disable key input if all items are disabled void ToolBox::ImplUpdateInputEnable() @@ -2066,37 +1920,6 @@ long ToolBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const // ----------------------------------------------------------------------- -long ToolBox::GetTextCount() const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineCount() : 0; -} - -// ----------------------------------------------------------------------- - -Pair ToolBox::GetTextStartEnd( long nText ) const -{ - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - return mpData->m_pLayoutData ? mpData->m_pLayoutData->GetLineStartEnd( nText ) : Pair( -1, -1 ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 ToolBox::GetDisplayItemId( long nText ) const -{ - sal_uInt16 nItemId = 0; - if( ! mpData->m_pLayoutData ) - ImplFillLayoutData(); - if( mpData->m_pLayoutData && nText >= 0 && (sal_uLong)nText < mpData->m_pLayoutData->m_aLineItemIds.size() ) - nItemId = mpData->m_pLayoutData->m_aLineItemIds[nText]; - return nItemId; -} - - -// ----------------------------------------------------------------------- - void ToolBox::SetDropdownClickHdl( const Link& rLink ) { mpData->maDropdownClickHdl = rLink; @@ -2154,11 +1977,6 @@ void ToolBox::SetMenuButtonHdl( const Link& rLink ) mpData->maMenuButtonHdl = rLink; } -const Link& ToolBox::GetMenuButtonHdl() const -{ - return mpData->maMenuButtonHdl; -} - // ----------------------------------------------------------------------- sal_Bool ToolBox::ImplHasClippedItems() |