diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-15 21:59:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-15 22:03:48 +0100 |
commit | aa3eeb28bcba10d603c15ee850620bed638514f5 (patch) | |
tree | 7c3e84597ca40b733aa157a10a2b7a5352c2654f /svtools | |
parent | These methods are virtual in the base class, so are really virtual (diff) | |
download | core-aa3eeb28bcba10d603c15ee850620bed638514f5.tar.gz core-aa3eeb28bcba10d603c15ee850620bed638514f5.zip |
Resolves: fdo#37279 and #i78701# startEditingAtNode does nothing
inherit class UnoTreeListItem from SvLBoxString instead of SvLBoxItem so that
it really isa SvLBoxString and can be edited with startEditingAtNode
a) remove the unused SvLBoxEntry argument to SvLBoxString's SetText
b) used rtl::OUString instead of XubString
c) rename aStr to maText
d) inherit UnoTreeListItem from SvLBoxString and drop its maText in
favour of that of SvLBoxEntry
Change-Id: Id78f43ae5be8cd6f581e6c2fd2bd6f46de9144ba
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/svlbitm.hxx | 11 | ||||
-rw-r--r-- | svtools/source/contnr/svlbitm.cxx | 20 | ||||
-rw-r--r-- | svtools/source/contnr/svtabbx.cxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/svtreebx.cxx | 7 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 31 |
5 files changed, 21 insertions, 52 deletions
diff --git a/svtools/inc/svtools/svlbitm.hxx b/svtools/inc/svtools/svlbitm.hxx index 7299ec7dcf6c..ae259acd1790 100644 --- a/svtools/inc/svtools/svlbitm.hxx +++ b/svtools/inc/svtools/svlbitm.hxx @@ -122,15 +122,16 @@ inline SvButtonState SvLBoxButtonData::GetActButtonState() const class SVT_DLLPUBLIC SvLBoxString : public SvLBoxItem { - XubString aStr; +protected: + rtl::OUString maText; public: - SvLBoxString( SvLBoxEntry*,sal_uInt16 nFlags,const XubString& rStr); + SvLBoxString(SvLBoxEntry*, sal_uInt16 nFlags, const rtl::OUString& rStr); SvLBoxString(); virtual ~SvLBoxString(); virtual sal_uInt16 IsA(); - virtual void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* ); - XubString GetText() const { return aStr; } - void SetText( SvLBoxEntry*, const XubString& rStr ); + virtual void InitViewData(SvLBox*, SvLBoxEntry*, SvViewDataItem*); + rtl::OUString GetText() const { return maText; } + void SetText( const rtl::OUString& rText ) { maText = rText; } virtual void Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* ); virtual SvLBoxItem* Create() const; virtual void Clone( SvLBoxItem* pSource ); diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index f3a669fdc26f..509654adac96 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -197,11 +197,11 @@ sal_Bool SvLBoxButtonData::IsRadio() { DBG_NAME(SvLBoxString); -SvLBoxString::SvLBoxString( SvLBoxEntry* pEntry,sal_uInt16 nFlags,const XubString& rStr) : - SvLBoxItem( pEntry, nFlags ) +SvLBoxString::SvLBoxString(SvLBoxEntry* pEntry, sal_uInt16 nFlags, const rtl::OUString& rStr) + : SvLBoxItem(pEntry, nFlags) { DBG_CTOR(SvLBoxString,0); - SetText( pEntry, rStr ); + SetText(rStr); } SvLBoxString::SvLBoxString() : SvLBoxItem() @@ -229,10 +229,10 @@ void SvLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 /* nFlags sal_uInt16 nStyle = rDev.IsEnabled() ? 0 : TEXT_DRAW_DISABLE; if ( rDev.IsEntryMnemonicsEnabled() ) nStyle |= TEXT_DRAW_MNEMONIC; - rDev.DrawText( Rectangle(rPos,GetSize(&rDev,_pEntry)),aStr,nStyle); + rDev.DrawText(Rectangle(rPos, GetSize(&rDev,_pEntry)), maText, nStyle); } else - rDev.DrawText( rPos, aStr); + rDev.DrawText(rPos, maText); } @@ -245,13 +245,7 @@ SvLBoxItem* SvLBoxString::Create() const void SvLBoxString::Clone( SvLBoxItem* pSource ) { DBG_CHKTHIS(SvLBoxString,0); - aStr = ((SvLBoxString*)pSource)->aStr; -} - -void SvLBoxString::SetText( SvLBoxEntry*, const XubString& rStr ) -{ - DBG_CHKTHIS(SvLBoxString,0); - aStr = rStr; + maText = ((SvLBoxString*)pSource)->maText; } void SvLBoxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, @@ -260,7 +254,7 @@ void SvLBoxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, DBG_CHKTHIS(SvLBoxString,0); if( !pViewData ) pViewData = pView->GetViewDataItem( pEntry, this ); - pViewData->aSize = Size(pView->GetTextWidth( aStr ), pView->GetTextHeight()); + pViewData->aSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight()); } // *************************************************************** diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index ad019f4c9202..13850f2b4c57 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -341,7 +341,7 @@ void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry, sal aTemp = rtl::OUString(pCurToken, nCurTokenLen); else aTemp.Erase(); // delete all columns without a token - ((SvLBoxString*)pStr)->SetText( pEntry, aTemp ); + ((SvLBoxString*)pStr)->SetText( aTemp ); pCurToken = pNextToken; pNextToken = GetToken( pCurToken, nCurTokenLen ); } @@ -350,7 +350,7 @@ void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry, sal if( !nCol ) { aTemp = rtl::OUString(pCurToken, nCurTokenLen); - ((SvLBoxString*)pStr)->SetText( pEntry, aTemp ); + ((SvLBoxString*)pStr)->SetText( aTemp ); if( !pNextToken ) break; pCurToken = pNextToken; diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 7e6475e4571f..9cb396631060 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -339,8 +339,7 @@ String SvTreeListBox::SearchEntryText( SvLBoxEntry* pEntry ) const while( nCur < nCount ) { pItem = pEntry->GetItem( nCur ); - if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING && - static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 ) + if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING && !static_cast<SvLBoxString*>( pItem )->GetText().isEmpty() ) { sRet = static_cast<SvLBoxString*>( pItem )->GetText(); break; @@ -447,7 +446,7 @@ void SvTreeListBox::SetEntryText( SvLBoxEntry* pEntry, const XubString& aStr) DBG_CHKTHIS(SvTreeListBox,0); SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); DBG_ASSERT(pItem,"SetText:Item not found"); - pItem->SetText( pEntry, aStr ); + pItem->SetText( aStr ); pItem->InitViewData( this, pEntry, 0 ); GetModel()->InvalidateEntry( pEntry ); } @@ -1345,7 +1344,7 @@ void SvTreeListBox::EditedText( const XubString& rStr ) { if( EditedEntry( pEdEntry, rStr ) ) { - ((SvLBoxString*)pEdItem)->SetText( pEdEntry, rStr ); + ((SvLBoxString*)pEdItem)->SetText( rStr ); pModel->InvalidateEntry( pEdEntry ); } if( GetSelectionCount() == 0 ) diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 15bb2da3720c..12fd892910e4 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -112,16 +112,13 @@ private: // -------------------------------------------------------------------- -class UnoTreeListItem : public SvLBoxItem +class UnoTreeListItem : public SvLBoxString { public: UnoTreeListItem( SvLBoxEntry* ); UnoTreeListItem(); virtual ~UnoTreeListItem(); - virtual sal_uInt16 IsA(); void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* ); - OUString GetText() const; - void SetText( const OUString& rText ); Image GetImage() const; void SetImage( const Image& rImage ); OUString GetGraphicURL() const; @@ -131,7 +128,6 @@ public: void Clone( SvLBoxItem* pSource ); private: - OUString maText; OUString maGraphicURL; Image maImage; }; @@ -1601,14 +1597,14 @@ sal_Bool UnoTreeListBoxImpl::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUStri // ==================================================================== UnoTreeListItem::UnoTreeListItem( SvLBoxEntry* pEntry ) -: SvLBoxItem( pEntry, 0 ) +: SvLBoxString(pEntry, 0, rtl::OUString()) { } // -------------------------------------------------------------------- UnoTreeListItem::UnoTreeListItem() -: SvLBoxItem() +: SvLBoxString() { } @@ -1620,13 +1616,6 @@ UnoTreeListItem::~UnoTreeListItem() // -------------------------------------------------------------------- -sal_uInt16 UnoTreeListItem::IsA() -{ - return 0; -} - -// -------------------------------------------------------------------- - void UnoTreeListItem::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 /* nFlags */, SvLBoxEntry* _pEntry) { Point aPos( rPos ); @@ -1674,20 +1663,6 @@ void UnoTreeListItem::Clone( SvLBoxItem* pSource ) // -------------------------------------------------------------------- -OUString UnoTreeListItem::GetText() const -{ - return maText; -} - -// -------------------------------------------------------------------- - -void UnoTreeListItem::SetText( const OUString& rText ) -{ - maText = rText; -} - -// -------------------------------------------------------------------- - void UnoTreeListItem::SetImage( const Image& rImage ) { maImage = rImage; |