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
This commit is contained in:
parent
facd391b7f
commit
aa3eeb28bc
@ -120,7 +120,7 @@ SvLBoxEntry* DBTreeListBox::GetEntryPosByName( const String& aName, SvLBoxEntry*
|
||||
{
|
||||
pEntry = static_cast<SvLBoxEntry*>((*pChildren)[ i ]);
|
||||
SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
|
||||
if ( pItem->GetText().Equals(aName) )
|
||||
if ( pItem->GetText().equals(aName) )
|
||||
{
|
||||
if ( !_pFilter || _pFilter->includeEntry( pEntry ) )
|
||||
// found
|
||||
|
@ -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 );
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
// ***************************************************************
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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;
|
||||
|
@ -100,7 +100,7 @@ SvLBoxColorString::SvLBoxColorString( SvLBoxEntry*pEntry,sal_uInt16 nFlags,const
|
||||
{
|
||||
DBG_CTOR(SvLBoxColorString,0);
|
||||
aPrivColor=rCol;
|
||||
SetText( pEntry, rStr );
|
||||
SetText( rStr );
|
||||
}
|
||||
|
||||
SvLBoxColorString::SvLBoxColorString()
|
||||
|
@ -47,7 +47,7 @@ SvLBoxFontString::SvLBoxFontString(
|
||||
mbUseColor( pColor != NULL )
|
||||
{
|
||||
DBG_CTOR( SvLBoxFontString, 0 );
|
||||
SetText( pEntry, rString );
|
||||
SetText( rString );
|
||||
if( pColor )
|
||||
maFont.SetColor( *pColor );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user