diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-30 08:11:04 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-30 08:26:27 +0100 |
commit | 56019dcb79475606952a954fe732a3109441ffec (patch) | |
tree | 0c3d3935066297bab322bd6af68d5b03db16a45c /sw/source/uibase/ribbar/workctrl.cxx | |
parent | 6b50523f86fd875bd74ae49ad6b7909ccdafed92 (diff) |
cleanup: We re-init this member all the time anyway.
Also kill some unused measuring.
Change-Id: I69521d36e4da4b50cd58f346f0adb0e5563c8bec
Diffstat (limited to 'sw/source/uibase/ribbar/workctrl.cxx')
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index ef1e5b7fceeb..d191cfdcf394 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -49,8 +49,6 @@ #include <vcl/svapp.hxx> - - // Size check #define NAVI_ENTRIES 20 #if NAVI_ENTRIES != NID_COUNT @@ -164,8 +162,7 @@ SwTbxAutoTextCtrl::SwTbxAutoTextCtrl( sal_uInt16 nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ), - pPopup(0), - pView(0) + pPopup(0) { rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); } @@ -177,46 +174,38 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl() SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow() { - pView = ::GetActiveView(); + SwView* pView = ::GetActiveView(); if(pView && !pView->GetDocShell()->IsReadOnly() && !pView->GetWrtShell().HasReadonlySel() ) { - ToolBox& rBox = GetToolBox(); + Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl); - Rectangle aItemRect( rBox.GetItemRect( GetId() ) ); - Point aPt(rBox.OutputToScreenPixel(aItemRect.TopLeft())); - aPt.X() += aItemRect.GetWidth()/2; - aPt.Y() += aItemRect.GetHeight()/2; - if(pView) + pPopup = new PopupMenu; + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + const size_t nGroupCount = pGlossaryList->GetGroupCount(); + for(size_t i = 1; i <= nGroupCount; ++i) { - Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl); - - pPopup = new PopupMenu; - SwGlossaryList* pGlossaryList = ::GetGlossaryList(); - const size_t nGroupCount = pGlossaryList->GetGroupCount(); - for(size_t i = 1; i <= nGroupCount; ++i) + OUString sTitle = pGlossaryList->GetGroupTitle(i - 1); + const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1); + if(nBlockCount) { - OUString sTitle = pGlossaryList->GetGroupTitle(i - 1); - const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1); - if(nBlockCount) + sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i); + // but insert without extension + pPopup->InsertItem( i, sTitle); + PopupMenu* pSub = new PopupMenu; + pSub->SetSelectHdl(aLnk); + pPopup->SetPopupMenu(i, pSub); + for(sal_uInt16 j = 0; j < nBlockCount; j++) { - sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i); - // but insert without extension - pPopup->InsertItem( i, sTitle); - PopupMenu* pSub = new PopupMenu; - pSub->SetSelectHdl(aLnk); - pPopup->SetPopupMenu(i, pSub); - for(sal_uInt16 j = 0; j < nBlockCount; j++) - { - OUString sLongName(pGlossaryList->GetBlockLongName(i - 1, j)); - OUString sShortName(pGlossaryList->GetBlockShortName(i - 1, j)); - - OUString sEntry = sShortName + " - " + sLongName; - pSub->InsertItem(++nIndex, sEntry); - } + OUString sLongName(pGlossaryList->GetBlockLongName(i - 1, j)); + OUString sShortName(pGlossaryList->GetBlockShortName(i - 1, j)); + + OUString sEntry = sShortName + " - " + sLongName; + pSub->InsertItem(++nIndex, sEntry); } } } + ToolBox* pToolBox = &GetToolBox(); sal_uInt16 nId = GetId(); pToolBox->SetItemDown( nId, true ); @@ -256,7 +245,7 @@ IMPL_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*, pMenu) OUString sShortName = pGlossaryList->GetBlockShortName(nBlock - 1, nId - (100 * nBlock) - 1); - SwGlossaryHdl* pGlosHdl = pView->GetGlosHdl(); + SwGlossaryHdl* pGlosHdl = ::GetActiveView()->GetGlosHdl(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); |