diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-08-07 22:09:06 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-08 23:25:28 +0200 |
commit | 03eb15938e04a8a28fc08ca7528b2f7068fe1c7a (patch) | |
tree | 64a56e0d605757410bed25ad88735f5ac4339e73 /sw | |
parent | af2d474ff9a91645043c1d4292891c313cceef5e (diff) |
vcl, sw: fix the inheritance of SwComboBox from ComboBox a bit
Remove the silly overloading, and introduce virtual methods.
Change-Id: If54a6a3fb7464283f80d3387ae23db234690f8a3
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/cctrl/swlbox.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/config/optload.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/inc/swlbox.hxx | 23 | ||||
-rw-r--r-- | sw/source/ui/misc/bookmark.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/uiview/view.cxx | 2 |
5 files changed, 36 insertions, 29 deletions
diff --git a/sw/source/ui/cctrl/swlbox.cxx b/sw/source/ui/cctrl/swlbox.cxx index c3694efcfaa3..d66cebcf3645 100644 --- a/sw/source/ui/cctrl/swlbox.cxx +++ b/sw/source/ui/cctrl/swlbox.cxx @@ -79,19 +79,25 @@ SwComboBox::~SwComboBox() { } -void SwComboBox::InsertEntry(const SwBoxEntry& rEntry) +void SwComboBox::InsertSwEntry(const SwBoxEntry& rEntry) { InsertSorted(new SwBoxEntry(rEntry)); } -void SwComboBox::RemoveEntry(sal_uInt16 nPos) +sal_uInt16 SwComboBox::InsertEntry(const OUString& rStr, sal_uInt16) +{ + InsertSwEntry(SwBoxEntry(rStr)); + return 0; +} + +void SwComboBox::RemoveEntryAt(sal_uInt16 const nPos) { if(nPos >= aEntryLst.size()) return; // Remove old element SwBoxEntry* pEntry = &aEntryLst[nPos]; - ComboBox::RemoveEntry(nPos); + ComboBox::RemoveEntryAt(nPos); // Don't add new entries to the list if(pEntry->bNew) @@ -106,12 +112,12 @@ void SwComboBox::RemoveEntry(sal_uInt16 nPos) } } -sal_uInt16 SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const +sal_uInt16 SwComboBox::GetSwEntryPos(const SwBoxEntry& rEntry) const { return ComboBox::GetEntryPos(rEntry.aName); } -const SwBoxEntry& SwComboBox::GetEntry(sal_uInt16 nPos) const +const SwBoxEntry& SwComboBox::GetSwEntry(sal_uInt16 const nPos) const { if(nPos < aEntryLst.size()) return aEntryLst[nPos]; diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 2b19c92ec50a..d3bc1a6ea31f 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -641,7 +641,7 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl) InsCaptionOpt* pOpt = (InsCaptionOpt*)pSelEntry->GetUserData(); aCategoryBox.Clear(); - aCategoryBox.InsertEntry(String(m_sNone)); //FIXME + aCategoryBox.InsertEntry(m_sNone); if (pSh) { sal_uInt16 nCount = pMgr->GetFldTypeCount(); @@ -651,15 +651,15 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl) SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i ); if( pType->Which() == RES_SETEXPFLD && ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) - aCategoryBox.InsertEntry(SwBoxEntry(pType->GetName())); + aCategoryBox.InsertSwEntry(SwBoxEntry(pType->GetName())); } } else { - aCategoryBox.InsertEntry(SwBoxEntry(m_sIllustration)); - aCategoryBox.InsertEntry(SwBoxEntry(m_sTable)); - aCategoryBox.InsertEntry(SwBoxEntry(m_sText)); - aCategoryBox.InsertEntry(SwBoxEntry(m_sDrawing)); + aCategoryBox.InsertSwEntry(SwBoxEntry(m_sIllustration)); + aCategoryBox.InsertSwEntry(SwBoxEntry(m_sTable)); + aCategoryBox.InsertSwEntry(SwBoxEntry(m_sText)); + aCategoryBox.InsertSwEntry(SwBoxEntry(m_sDrawing)); } if(pOpt->GetCategory().Len()) @@ -679,7 +679,7 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl) case TABLE_CAP: nPos = 2; break; case FRAME_CAP: nPos = 3; break; } - aCategoryBox.SetText(aCategoryBox.GetEntry(nPos).GetName()); + aCategoryBox.SetText(aCategoryBox.GetSwEntry(nPos).GetName()); } for (sal_uInt16 i = 0; i < aFormatBox.GetEntryCount(); i++) diff --git a/sw/source/ui/inc/swlbox.hxx b/sw/source/ui/inc/swlbox.hxx index 26b8e917a630..fe0b9af96ac4 100644 --- a/sw/source/ui/inc/swlbox.hxx +++ b/sw/source/ui/inc/swlbox.hxx @@ -75,36 +75,33 @@ class SW_DLLPUBLIC SwComboBox : public ComboBox SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry); SW_DLLPRIVATE void Init(); - using ComboBox::InsertEntry; - using ComboBox::RemoveEntry; + using Window::GetStyle; using Window::SetStyle; public: - using ComboBox::GetEntryPos; - SwComboBox(Window* pParent, sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL); SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL); ~SwComboBox(); - virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; - void InsertEntry(const SwBoxEntry&); - sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 = 0) - { InsertEntry( SwBoxEntry( rStr ) ); return 0; } + void InsertSwEntry(const SwBoxEntry&); + virtual sal_uInt16 InsertEntry(const OUString& rStr, sal_uInt16 = 0) SAL_OVERRIDE; - void RemoveEntry(sal_uInt16 nPos); + virtual void RemoveEntryAt(sal_uInt16 nPos) SAL_OVERRIDE; - sal_uInt16 GetEntryPos(const SwBoxEntry& rEntry) const; - const SwBoxEntry& GetEntry(sal_uInt16) const; + sal_uInt16 GetSwEntryPos(const SwBoxEntry& rEntry) const; + const SwBoxEntry& GetSwEntry(sal_uInt16) const; sal_uInt16 GetRemovedCount() const; const SwBoxEntry& GetRemovedEntry(sal_uInt16 nPos) const; - sal_uInt16 GetStyle() const { return nStyle; } - void SetStyle(const sal_uInt16 nSt) { nStyle = nSt; } + // FIXME ??? what is this + sal_uInt16 GetSwStyle() const { return nStyle; } + void SetSwStyle(const sal_uInt16 nSt) { nStyle = nSt; } OUString GetText() const; }; diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 1a520f7537cc..245d164f048e 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -75,7 +75,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, DeleteHdl) // remove text marks from the ComboBox for (sal_uInt16 i = m_pBookmarkBox->GetSelectEntryCount(); i; i-- ) - m_pBookmarkBox->RemoveEntry(m_pBookmarkBox->GetSelectEntryPos(i - 1)); + m_pBookmarkBox->RemoveEntryAt(m_pBookmarkBox->GetSelectEntryPos(i - 1)); m_pBookmarkBox->SetText(aEmptyStr); m_pDeleteBtn->Enable(sal_False); // no further entries there @@ -105,7 +105,8 @@ void SwInsertBookmarkDlg::Apply() // insert text mark SwBoxEntry aTmpEntry(m_pBookmarkBox->GetText(), 0 ); - if ( !m_pBookmarkBox->GetText().isEmpty() && (m_pBookmarkBox->GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) + if (!m_pBookmarkBox->GetText().isEmpty() && + (m_pBookmarkBox->GetSwEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND)) { String sEntry(comphelper::string::remove(m_pBookmarkBox->GetText(), m_pBookmarkBox->GetMultiSelectionSeparator())); @@ -143,7 +144,10 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRe ++ppBookmark) { if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) - m_pBookmarkBox->InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) ); + { + m_pBookmarkBox->InsertSwEntry( + SwBoxEntry(ppBookmark->get()->GetName(), nId++)); + } } sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING)); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index aeff407a3546..0323f6d87b73 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -239,7 +239,7 @@ void SwView::SelectShell() } m_pLastTableFormat = pCurTableFmt; - //SEL_TBL and SEL_TBL_CELLS can be changed! + //SEL_TBL and SEL_TBL_CELLS can be ORed! int nNewSelectionType = (m_pWrtShell->GetSelectionType() & ~nsSelectionType::SEL_TBL_CELLS); |