[Libreoffice-commits] .: Branch 'feature/orcus-update' - 9 commits - cui/source dbaccess/source sd/source svtools/inc svtools/Library_svt.mk svtools/Package_inc.mk svtools/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 27 12:07:58 PST 2012
cui/source/customize/cfg.cxx | 4
dbaccess/source/ui/app/AppDetailView.cxx | 2
dbaccess/source/ui/control/listviewitems.cxx | 2
sd/source/ui/animations/CustomAnimationList.cxx | 8 -
svtools/Library_svt.mk | 1
svtools/Package_inc.mk | 1
svtools/inc/svtools/treelist.hxx | 120 +-----------------------
svtools/inc/svtools/treelistbox.hxx | 34 +-----
svtools/inc/svtools/viewdataentry.hxx | 78 +++++++++++++++
svtools/source/contnr/fileview.cxx | 1
svtools/source/contnr/svimpbox.cxx | 2
svtools/source/contnr/svlbitm.cxx | 8 -
svtools/source/contnr/treelist.cxx | 104 ++++++++++++--------
svtools/source/contnr/treelistbox.cxx | 47 +--------
svtools/source/contnr/viewdataentry.cxx | 117 +++++++++++++++++++++++
svtools/source/uno/treecontrolpeer.cxx | 12 +-
svx/source/form/filtnav.cxx | 4
17 files changed, 298 insertions(+), 247 deletions(-)
New commits:
commit 9b2598da9629f2f12e3871626f26264ccbf90b28
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 14:55:47 2012 -0500
Fix various build breaks.
Change-Id: Ie33a4a02f9820e0d52ca3f17c6b410ebe1e6e8f0
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 97bf17a..d657db0 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1377,9 +1377,9 @@ public:
}
SvViewDataItem* pItem = rOutDev.GetViewDataItem( pEntry, this );
- nX -= pItem->aSize.Height();
+ nX -= pItem->maSize.Height();
- long nSize = pItem->aSize.Height() / 2;
+ long nSize = pItem->maSize.Height() / 2;
long nHalfSize = nSize / 2;
long nY = rPos.Y() + nHalfSize;
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index d0f3dc5..afb6c95 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -162,7 +162,7 @@ Rectangle OCreationList::GetFocusRect( SvTreeListEntry* _pEntry, long _nLine )
SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : NULL;
OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" );
if ( pTab && pItemData )
- aRect.Left() = pTab->GetPos() - pItemData->aSize.Width() / 2;
+ aRect.Left() = pTab->GetPos() - pItemData->maSize.Width() / 2;
// inflate the rectangle a little bit - looks better, too
aRect.Left() = ::std::max< long >( 0, aRect.Left() - 2 );
diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx
index 1d2cc2d..81d4ea0 100644
--- a/dbaccess/source/ui/control/listviewitems.cxx
+++ b/dbaccess/source/ui/control/listviewitems.cxx
@@ -39,7 +39,7 @@ namespace dbaui
Font aFont( pView->GetFont());
aFont.SetWeight(WEIGHT_BOLD);
pView->Control::SetFont( aFont );
- _pViewData->aSize = Size(pView->GetTextWidth(GetText()), pView->GetTextHeight());
+ _pViewData->maSize = Size(pView->GetTextWidth(GetText()), pView->GetTextHeight());
pView->Pop();
}
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index e3cd06c..6540ed2 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -250,7 +250,7 @@ void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeLis
Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() );
if( aSize.Height() < 19 )
aSize.Height() = 19;
- pViewData->aSize = aSize;
+ pViewData->maSize = aSize;
}
// --------------------------------------------------------------------
@@ -261,7 +261,7 @@ void CustomAnimationListEntryItem::Paint( const Point& rPos, SvTreeListBox& rDev
SvViewDataItem* pViewData = mpParent->GetViewDataItem( pEntry, this );
Point aPos( rPos );
- Size aSize( pViewData->aSize );
+ Size aSize( pViewData->maSize );
sal_Int16 nNodeType = mpEffect->getNodeType();
if( nNodeType == EffectNodeType::ON_CLICK )
@@ -403,7 +403,7 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree
Size aSize(pView->GetTextWidth( maDescription ) + 2 * 19, pView->GetTextHeight() );
if( aSize.Height() < 19 )
aSize.Height() = 19;
- pViewData->aSize = aSize;
+ pViewData->maSize = aSize;
}
// --------------------------------------------------------------------
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index bc85129..fda722a 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1091,7 +1091,7 @@ void FmFilterItemsString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pE
Size aSize(pView->GetTextWidth(GetText()), pView->GetTextHeight());
aSize.Width() += nxDBmp;
- pViewData->aSize = aSize;
+ pViewData->maSize = aSize;
}
//========================================================================
@@ -1129,7 +1129,7 @@ void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
Size aSize(pView->GetTextWidth(m_aName), pView->GetTextHeight());
pView->Control::SetFont( aOldFont );
aSize.Width() += pView->GetTextWidth(GetText()) + nxD;
- pViewData->aSize = aSize;
+ pViewData->maSize = aSize;
}
//------------------------------------------------------------------------
commit d867ca09ce5005c6bfb7ffc7a774959eb1e4fe45
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 14:26:31 2012 -0500
Finally merge SvViewData and SvViewDataEntry.
Change-Id: Ic85e2a239990aeaa017eaef95ea25487dd1ec968
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 0df9767..e3cd06c 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -676,7 +676,7 @@ void CustomAnimationList::update()
aDescription += getShapeDescription( xShape, false );
pLBoxEntry->AddItem( new CustomAnimationTriggerEntryItem( pLBoxEntry, 0, aDescription ) );
Insert( pLBoxEntry );
- SvViewData* pViewData = GetViewData( pLBoxEntry );
+ SvViewDataEntry* pViewData = GetViewData( pLBoxEntry );
if( pViewData )
pViewData->SetSelectable(false);
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 1c4d664..ff31dc4 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -46,7 +46,7 @@
class SvTreeListEntry;
class SvListView;
-class SvViewData;
+class SvViewDataEntry;
enum SvSortMode { SortAscending, SortDescending, SortNone };
@@ -236,7 +236,7 @@ class SVT_DLLPUBLIC SvListView
{
friend class SvTreeList;
- typedef boost::ptr_map<SvTreeListEntry*, SvViewData> SvDataTable;
+ typedef boost::ptr_map<SvTreeListEntry*, SvViewDataEntry> SvDataTable;
sal_uLong nVisibleCount;
sal_uLong nSelectionCount;
@@ -343,13 +343,13 @@ public:
sal_Bool IsSelected( SvTreeListEntry* pEntry ) const;
sal_Bool HasEntryFocus( SvTreeListEntry* pEntry ) const;
void SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus );
- const SvViewData* GetViewData( const SvTreeListEntry* pEntry ) const;
- SvViewData* GetViewData( SvTreeListEntry* pEntry );
+ const SvViewDataEntry* GetViewData( const SvTreeListEntry* pEntry ) const;
+ SvViewDataEntry* GetViewData( SvTreeListEntry* pEntry );
sal_Bool HasViewData() const
{ return maDataTable.size() > 1; } // There's always a ROOT
- virtual SvViewData* CreateViewData( SvTreeListEntry* pEntry );
- virtual void InitViewData( SvViewData*, SvTreeListEntry* pEntry );
+ virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* pEntry );
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
virtual void ModelHasCleared();
virtual void ModelHasInserted( SvTreeListEntry* pEntry );
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 1a591fd..ff2cd94 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -310,10 +310,10 @@ protected:
bool IsEmptyTextAllowed() const;
// Return value must be derived from SvViewDataEntry!
- virtual SvViewData* CreateViewData( SvTreeListEntry* );
+ virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* );
// InitViewData is called right after CreateViewData
// The Entry is has not yet been added to the View in InitViewData!
- virtual void InitViewData( SvViewData*, SvTreeListEntry* pEntry );
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
// Calls InitViewData for all Items
void RecalcViewData();
// Callback of RecalcViewData
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index fa1969e..35b9a58 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -38,18 +38,24 @@ struct SvViewDataItem
Size maSize;
};
-class SVT_DLLPUBLIC SvViewData
+/**
+ * View-dependent data for an Entry is created in the virtual function
+ * SvTreeListBox::CreateViewData. The View creation of Items should not be
+ * changed.
+ */
+class SVT_DLLPUBLIC SvViewDataEntry
{
-friend class SvTreeList;
-friend class SvListView;
+ friend class SvTreeList;
+ friend class SvListView;
+ std::vector<SvViewDataItem> maItems;
sal_uLong nVisPos;
-protected:
sal_uInt16 nFlags;
+
public:
- SvViewData();
- SvViewData( const SvViewData& );
- virtual ~SvViewData();
+ SvViewDataEntry();
+ SvViewDataEntry( const SvViewDataEntry& );
+ ~SvViewDataEntry();
bool IsSelected() const;
bool IsExpanded() const;
@@ -60,17 +66,6 @@ public:
void SetCursored( bool bCursored );
sal_uInt16 GetFlags() const;
void SetSelectable( bool bSelectable );
-};
-
-// View-dependent data for an Entry is created in the virtual function
-// SvTreeListBox::CreateViewData. The View creation of Items cannot be
-// changed (because it's an array)
-class SvViewDataEntry : public SvViewData
-{
- std::vector<SvViewDataItem> maItems;
-public:
- SvViewDataEntry();
- virtual ~SvViewDataEntry();
void Init(size_t nSize);
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index a81ec76..99612f9 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -2590,8 +2590,6 @@ void SvImpLBox::LoseFocus()
SvTreeListEntry* pEntry = pView->FirstSelected();
while( pEntry )
{
- //SvViewData* pViewData = pView->GetViewData( pEntry );
- //pViewData->SetCursored( true );
InvalidateEntry( pEntry );
pEntry = pView->NextSelected( pEntry );
}
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 4750c61..9d752ef 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -588,7 +588,7 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry* p
((SvListView*)pView)->nVisibleCount = 0;
GetVisibleCount( const_cast<SvListView*>(pView) );
}
- const SvViewData* pViewData = pView->GetViewData( pEntry );
+ const SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
return pViewData->nVisPos;
}
@@ -604,7 +604,7 @@ sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const
SvTreeListEntry* pEntry = First(); // first entry is always visible
while ( pEntry )
{
- SvViewData* pViewData = pView->GetViewData( pEntry );
+ SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
pViewData->nVisPos = nPos;
nPos++;
pEntry = NextVisible( pView, pEntry );
@@ -939,7 +939,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry )
DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries.");
- SvViewData* pViewData = pView->GetViewData(pEntry);
+ SvViewDataEntry* pViewData = pView->GetViewData(pEntry);
pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED;
SvTreeListEntry* pParent = pEntry->pParent;
// if parent is visible, invalidate status data
@@ -958,7 +958,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry )
DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries.");
- SvViewData* pViewData = pView->GetViewData( pEntry );
+ SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED);
SvTreeListEntry* pParent = pEntry->pParent;
@@ -972,7 +972,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry )
sal_Bool SvTreeList::Select( SvListView* pView, SvTreeListEntry* pEntry, sal_Bool bSelect )
{
DBG_ASSERT(pView&&pEntry,"Select:View/Entry?");
- SvViewData* pViewData = pView->GetViewData( pEntry );
+ SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
if ( bSelect )
{
if ( pViewData->IsSelected() || !pViewData->IsSelectable() )
@@ -1053,7 +1053,7 @@ void SvTreeList::SelectAll( SvListView* pView, sal_Bool bSelect )
SvTreeListEntry* pEntry = First();
while ( pEntry )
{
- SvViewData* pViewData = pView->GetViewData( pEntry );
+ SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
if ( bSelect )
pViewData->nFlags |= SVLISTENTRYFLAG_SELECTED;
else
@@ -1197,11 +1197,11 @@ void SvListView::InitTable()
}
SvTreeListEntry* pEntry;
- SvViewData* pViewData;
+ SvViewDataEntry* pViewData;
// insert root entry
pEntry = pModel->pRootItem;
- pViewData = new SvViewData;
+ pViewData = new SvViewDataEntry;
pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
maDataTable.insert( pEntry, pViewData );
// now all the other entries
@@ -1216,10 +1216,10 @@ void SvListView::InitTable()
}
}
-SvViewData* SvListView::CreateViewData( SvTreeListEntry* )
+SvViewDataEntry* SvListView::CreateViewData( SvTreeListEntry* )
{
DBG_CHKTHIS(SvListView,0);
- return new SvViewData;
+ return new SvViewDataEntry;
}
void SvListView::Clear()
@@ -1232,7 +1232,7 @@ void SvListView::Clear()
{
// insert root entry
SvTreeListEntry* pEntry = pModel->pRootItem;
- SvViewData* pViewData = new SvViewData;
+ SvViewDataEntry* pViewData = new SvViewDataEntry;
pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
maDataTable.insert( pEntry, pViewData );
}
@@ -1307,7 +1307,7 @@ void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLon
DBG_ASSERT(pParent,"Model not consistent");
if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1)
{
- SvViewData* pViewData = maDataTable.find( pParent )->second;
+ SvViewDataEntry* pViewData = maDataTable.find( pParent )->second;
pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
}
// vorlaeufig
@@ -1328,7 +1328,7 @@ void SvListView::ActionInserted( SvTreeListEntry* pEntry )
{
DBG_CHKTHIS(SvListView,0);
DBG_ASSERT(pEntry,"Insert:No Entry");
- SvViewData* pData = CreateViewData( pEntry );
+ SvViewDataEntry* pData = CreateViewData( pEntry );
InitViewData( pData, pEntry );
#ifdef DBG_UTIL
std::pair<SvDataTable::iterator, bool> aSuccess =
@@ -1356,7 +1356,7 @@ void SvListView::ActionInsertedTree( SvTreeListEntry* pEntry )
while( pCurEntry )
{
DBG_ASSERT(maDataTable.find(pCurEntry) != maDataTable.end(),"Entry already in Table");
- SvViewData* pViewData = CreateViewData( pCurEntry );
+ SvViewDataEntry* pViewData = CreateViewData( pCurEntry );
DBG_ASSERT(pViewData,"No ViewData");
InitViewData( pViewData, pEntry );
maDataTable.insert( pCurEntry, pViewData );
@@ -1385,7 +1385,7 @@ void SvListView::ActionRemoving( SvTreeListEntry* pEntry )
DBG_CHKTHIS(SvListView,0);
DBG_ASSERT(pEntry,"Remove:No Entry");
- SvViewData* pViewData = maDataTable.find( pEntry )->second;
+ SvViewDataEntry* pViewData = maDataTable.find( pEntry )->second;
sal_uLong nSelRemoved = 0;
if ( pViewData->IsSelected() )
nSelRemoved = 1 + pModel->GetChildSelectionCount( this, pEntry );
@@ -1477,7 +1477,7 @@ void SvListView::ModelNotification( sal_uInt16 nActionId, SvTreeListEntry* pEntr
}
}
-void SvListView::InitViewData( SvViewData*, SvTreeListEntry* )
+void SvListView::InitViewData( SvViewDataEntry*, SvTreeListEntry* )
{
}
@@ -1513,14 +1513,14 @@ void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus )
itr->second->SetFocus(bFocus);
}
-const SvViewData* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
+const SvViewDataEntry* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
{
SvDataTable::const_iterator itr = maDataTable.find( const_cast<SvTreeListEntry*>(pEntry) );
DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
return itr->second;
}
-SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry )
+SvViewDataEntry* SvListView::GetViewData( SvTreeListEntry* pEntry )
{
SvDataTable::iterator itr = maDataTable.find( pEntry );
DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 296a036..6c4eb5e 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -951,14 +951,14 @@ const SvViewDataItem* SvTreeListBox::GetViewDataItem(const SvTreeListEntry* pEnt
return pEntryData->GetItem(nItemPos);
}
-SvViewData* SvTreeListBox::CreateViewData( SvTreeListEntry* )
+SvViewDataEntry* SvTreeListBox::CreateViewData( SvTreeListEntry* )
{
DBG_CHKTHIS(SvTreeListBox,0);
SvViewDataEntry* pEntryData = new SvViewDataEntry;
- return (SvViewData*)pEntryData;
+ return (SvViewDataEntry*)pEntryData;
}
-void SvTreeListBox::InitViewData( SvViewData* pData, SvTreeListEntry* pEntry )
+void SvTreeListBox::InitViewData( SvViewDataEntry* pData, SvTreeListEntry* pEntry )
{
DBG_CHKTHIS(SvTreeListBox,0);
SvTreeListEntry* pInhEntry = (SvTreeListEntry*)pEntry;
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index 0fda3dd..5288466 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -21,58 +21,56 @@
#include "tools/debug.hxx"
-DBG_NAME(SvViewData);
+DBG_NAME(SvViewDataEntry);
-SvViewData::SvViewData()
+SvViewDataEntry::SvViewDataEntry() :
+ nVisPos(0), nFlags(0)
{
- DBG_CTOR(SvViewData,0);
- nFlags = 0;
- nVisPos = 0;
+ DBG_CTOR(SvViewDataEntry,0);
}
-SvViewData::SvViewData( const SvViewData& rData )
+SvViewDataEntry::SvViewDataEntry( const SvViewDataEntry& rData ) :
+ nVisPos(rData.nVisPos), nFlags(rData.nFlags)
{
- DBG_CTOR(SvViewData,0);
- nFlags = rData.nFlags;
+ DBG_CTOR(SvViewDataEntry,0);
nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED );
- nVisPos = rData.nVisPos;
}
-SvViewData::~SvViewData()
+SvViewDataEntry::~SvViewDataEntry()
{
- DBG_DTOR(SvViewData,0);
+ DBG_DTOR(SvViewDataEntry,0);
#ifdef DBG_UTIL
nVisPos = 0x12345678;
nFlags = 0x1234;
#endif
}
-bool SvViewData::IsSelected() const
+bool SvViewDataEntry::IsSelected() const
{
return (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
}
-bool SvViewData::IsExpanded() const
+bool SvViewDataEntry::IsExpanded() const
{
return (nFlags & SVLISTENTRYFLAG_EXPANDED) != 0;
}
-bool SvViewData::HasFocus() const
+bool SvViewDataEntry::HasFocus() const
{
return (nFlags & SVLISTENTRYFLAG_FOCUSED) != 0;
}
-bool SvViewData::IsCursored() const
+bool SvViewDataEntry::IsCursored() const
{
return (nFlags & SVLISTENTRYFLAG_CURSORED) != 0;
}
-bool SvViewData::IsSelectable() const
+bool SvViewDataEntry::IsSelectable() const
{
return (nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0;
}
-void SvViewData::SetFocus( bool bFocus )
+void SvViewDataEntry::SetFocus( bool bFocus )
{
if ( !bFocus )
nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
@@ -80,7 +78,7 @@ void SvViewData::SetFocus( bool bFocus )
nFlags |= SVLISTENTRYFLAG_FOCUSED;
}
-void SvViewData::SetCursored( bool bCursored )
+void SvViewDataEntry::SetCursored( bool bCursored )
{
if ( !bCursored )
nFlags &= (~SVLISTENTRYFLAG_CURSORED);
@@ -88,12 +86,12 @@ void SvViewData::SetCursored( bool bCursored )
nFlags |= SVLISTENTRYFLAG_CURSORED;
}
-sal_uInt16 SvViewData::GetFlags() const
+sal_uInt16 SvViewDataEntry::GetFlags() const
{
return nFlags;
}
-void SvViewData::SetSelectable( bool bSelectable )
+void SvViewDataEntry::SetSelectable( bool bSelectable )
{
if( bSelectable )
nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
@@ -101,19 +99,6 @@ void SvViewData::SetSelectable( bool bSelectable )
nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
}
-DBG_NAME(SvViewDataEntry);
-
-SvViewDataEntry::SvViewDataEntry()
- : SvViewData()
-{
- DBG_CTOR(SvViewDataEntry,0);
-}
-
-SvViewDataEntry::~SvViewDataEntry()
-{
- DBG_DTOR(SvViewDataEntry,0);
-}
-
void SvViewDataEntry::Init(size_t nSize)
{
maItems.resize(nSize);
commit f46c317ae6300a292becb7ceb2de084fe7dd6d46
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 14:11:30 2012 -0500
Use std::vector over c-style pointer array.
Change-Id: I91ab1fb269070deb8389cf4e8473a223c1bbca1d
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 0aa4177..1a591fd 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -145,7 +145,7 @@ public:
const Size& GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos) const
{
- const SvViewDataItem* pIData = pData->pItemData + nItemPos;
+ const SvViewDataItem* pIData = pData->GetItem(nItemPos);
return pIData->maSize;
}
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index 4e14bc5..fa1969e 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -24,6 +24,8 @@
#include "tools/solar.h"
#include "tools/gen.hxx"
+#include <vector>
+
// Entryflags that are attached to the View
#define SVLISTENTRYFLAG_SELECTED 0x0001
#define SVLISTENTRYFLAG_EXPANDED 0x0002
@@ -65,12 +67,15 @@ public:
// changed (because it's an array)
class SvViewDataEntry : public SvViewData
{
+ std::vector<SvViewDataItem> maItems;
public:
- SvViewDataItem* pItemData; // An array of SvViewDataItems
- sal_uInt16 nItmCnt; // Item count for delete operator
-
SvViewDataEntry();
virtual ~SvViewDataEntry();
+
+ void Init(size_t nSize);
+
+ const SvViewDataItem* GetItem(size_t nPos) const;
+ SvViewDataItem* GetItem(size_t nPos);
};
#endif
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index f7fe4d8..296a036 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -947,9 +947,8 @@ const SvViewDataItem* SvTreeListBox::GetViewDataItem(const SvTreeListEntry* pEnt
{
const SvViewDataEntry* pEntryData = (const SvViewDataEntry*)SvListView::GetViewData(pEntry);
DBG_ASSERT(pEntryData,"Entry not in View");
- DBG_ASSERT(pEntryData->pItemData,"No ItemData");
sal_uInt16 nItemPos = pEntry->GetPos(pItem);
- return (pEntryData->pItemData + nItemPos);
+ return pEntryData->GetItem(nItemPos);
}
SvViewData* SvTreeListBox::CreateViewData( SvTreeListEntry* )
@@ -965,14 +964,13 @@ void SvTreeListBox::InitViewData( SvViewData* pData, SvTreeListEntry* pEntry )
SvTreeListEntry* pInhEntry = (SvTreeListEntry*)pEntry;
SvViewDataEntry* pEntryData = (SvViewDataEntry*)pData;
- pEntryData->pItemData = new SvViewDataItem[ pInhEntry->ItemCount() ];
- SvViewDataItem* pItemData = pEntryData->pItemData;
- pEntryData->nItmCnt = pInhEntry->ItemCount(); // number of items to delete
+ pEntryData->Init(pInhEntry->ItemCount());
sal_uInt16 nCount = pInhEntry->ItemCount();
sal_uInt16 nCurPos = 0;
while( nCurPos < nCount )
{
SvLBoxItem* pItem = pInhEntry->GetItem( nCurPos );
+ SvViewDataItem* pItemData = pEntryData->GetItem(nCurPos);
pItem->InitViewData( this, pInhEntry, pItemData );
pItemData++;
nCurPos++;
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index 3b35c75..0fda3dd 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -107,13 +107,26 @@ SvViewDataEntry::SvViewDataEntry()
: SvViewData()
{
DBG_CTOR(SvViewDataEntry,0);
- pItemData = 0;
}
SvViewDataEntry::~SvViewDataEntry()
{
DBG_DTOR(SvViewDataEntry,0);
- delete [] pItemData;
+}
+
+void SvViewDataEntry::Init(size_t nSize)
+{
+ maItems.resize(nSize);
+}
+
+const SvViewDataItem* SvViewDataEntry::GetItem(size_t nPos) const
+{
+ return &maItems[nPos];
+}
+
+SvViewDataItem* SvViewDataEntry::GetItem(size_t nPos)
+{
+ return &maItems[nPos];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 68656d1715a54873af5c224e68cd70cac311b7f2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 14:00:27 2012 -0500
Make SvViewDataItem a struct, with only one public data member...
Change-Id: Ib6b710f87fcdfe465fb78a397100f82da11b3611
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 6624934..0aa4177 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -146,7 +146,7 @@ public:
const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos) const
{
const SvViewDataItem* pIData = pData->pItemData + nItemPos;
- return pIData->aSize;
+ return pIData->maSize;
}
virtual void Paint( const Point& rPos, SvTreeListBox& rOutDev,
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index 87def0a..4e14bc5 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -31,7 +31,10 @@
#define SVLISTENTRYFLAG_CURSORED 0x0008
#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010
-class SvViewDataItem;
+struct SvViewDataItem
+{
+ Size maSize;
+};
class SVT_DLLPUBLIC SvViewData
{
@@ -70,15 +73,6 @@ public:
virtual ~SvViewDataEntry();
};
-class SvViewDataItem
-{
-public:
- Size aSize;
-
- SvViewDataItem();
- ~SvViewDataItem();
-};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index 1545543..138ae3b 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -245,7 +245,7 @@ void SvLBoxString::InitViewData(
DBG_CHKTHIS(SvLBoxString,0);
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->aSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight());
+ pViewData->maSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight());
}
// ***************************************************************
@@ -276,7 +276,7 @@ void SvLBoxBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
DBG_CHKTHIS(SvLBoxBmp,0);
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->aSize = aBmp.GetSizePixel();
+ pViewData->maSize = aBmp.GetSizePixel();
}
void SvLBoxBmp::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /* nFlags */,
@@ -447,7 +447,7 @@ void SvLBoxButton::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
if ( eKind != SvLBoxButtonKind_staticImage && pView )
ImplAdjustBoxSize( aSize, eCtrlType, pView );
- pViewData->aSize = aSize;
+ pViewData->maSize = aSize;
}
bool SvLBoxButton::CheckModification() const
@@ -525,7 +525,7 @@ void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntr
DBG_CHKTHIS(SvLBoxContextBmp,0);
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->aSize = m_pImpl->m_aImage1.GetSizePixel();
+ pViewData->maSize = m_pImpl->m_aImage1.GetSizePixel();
}
void SvLBoxContextBmp::Paint( const Point& _rPos, SvTreeListBox& _rDev,
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 5f8a40b..f7fe4d8 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -363,7 +363,7 @@ const Size& SvLBoxItem::GetSize(const SvTreeListBox* pView, const SvTreeListEntr
{
DBG_CHKTHIS(SvLBoxItem,0);
const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
- return pViewData->aSize;
+ return pViewData->maSize;
}
struct SvTreeListBoxImpl
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index 544bb03..3b35c75 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -116,16 +116,4 @@ SvViewDataEntry::~SvViewDataEntry()
delete [] pItemData;
}
-DBG_NAME(SvViewDataItem);
-
-SvViewDataItem::SvViewDataItem()
-{
- DBG_CTOR(SvViewDataItem,0);
-}
-
-SvViewDataItem::~SvViewDataItem()
-{
- DBG_DTOR(SvViewDataItem,0);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index cd9e13f..8a40909 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -1673,18 +1673,18 @@ void UnoTreeListItem::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->aSize = maImage.GetSizePixel();
+ pViewData->maSize = maImage.GetSizePixel();
const Size aTextSize(pView->GetTextWidth( maText ), pView->GetTextHeight());
- if( pViewData->aSize.Width() )
+ if( pViewData->maSize.Width() )
{
- pViewData->aSize.Width() += 6 + aTextSize.Width();
- if( pViewData->aSize.Height() < aTextSize.Height() )
- pViewData->aSize.Height() = aTextSize.Height();
+ pViewData->maSize.Width() += 6 + aTextSize.Width();
+ if( pViewData->maSize.Height() < aTextSize.Height() )
+ pViewData->maSize.Height() = aTextSize.Height();
}
else
{
- pViewData->aSize = aTextSize;
+ pViewData->maSize = aTextSize;
}
}
commit 8863535f04609b917fce548ba19d2c82382993a9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 13:55:44 2012 -0500
sal_Bool to bool.
Change-Id: I63bff9f8ba19e8f037edf29bc82555b8c6e77d1e
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index 594a1c0..87def0a 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -51,8 +51,8 @@ public:
bool HasFocus() const;
bool IsCursored() const;
bool IsSelectable() const;
- void SetFocus( sal_Bool bFocus);
- void SetCursored( sal_Bool bCursored );
+ void SetFocus( bool bFocus );
+ void SetCursored( bool bCursored );
sal_uInt16 GetFlags() const;
void SetSelectable( bool bSelectable );
};
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index f26ad15..544bb03 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -72,7 +72,7 @@ bool SvViewData::IsSelectable() const
return (nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0;
}
-void SvViewData::SetFocus( sal_Bool bFocus)
+void SvViewData::SetFocus( bool bFocus )
{
if ( !bFocus )
nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
@@ -80,7 +80,7 @@ void SvViewData::SetFocus( sal_Bool bFocus)
nFlags |= SVLISTENTRYFLAG_FOCUSED;
}
-void SvViewData::SetCursored( sal_Bool bCursored )
+void SvViewData::SetCursored( bool bCursored )
{
if ( !bCursored )
nFlags &= (~SVLISTENTRYFLAG_CURSORED);
commit 69cd934f3d1ca44029b52f54a50fb9ebc1d31ba8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 13:50:31 2012 -0500
Deliver this new header file.
Change-Id: I71c4ec404acfef12cc2a9bf0fc9c0e98bf45cb2d
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index 551d66f..a7265f3 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -169,6 +169,7 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/unoevent.hxx,svtools/u
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/unoimap.hxx,svtools/unoimap.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/urlcontrol.hxx,svtools/urlcontrol.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/valueset.hxx,svtools/valueset.hxx))
+$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/viewdataentry.hxx,svtools/viewdataentry.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wallitem.hxx,svtools/wallitem.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizardmachine.hxx,svtools/wizardmachine.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizdlg.hxx,svtools/wizdlg.hxx))
commit 3f9ad14ad528c485d8065b83a8de1bf78d76808a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 13:48:44 2012 -0500
Move SvViewDataEntry and SvViewDataItem into these files too.
Change-Id: Ib25e7b4ff692804e4e4b617ffba228c4b2cae1db
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 11e36c1..6624934 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -132,31 +132,6 @@ public:
};
// *********************************************************************
-// *********************** View-dependent data *************************
-// *********************************************************************
-
-class SvViewDataItem
-{
-public:
- Size aSize;
- SvViewDataItem();
- ~SvViewDataItem();
-};
-
-// View-dependent data for an Entry is created in the virtual function
-// SvTreeListBox::CreateViewData. The View creation of Items cannot be
-// changed (because it's an array)
-class SvViewDataEntry : public SvViewData
-{
-public:
- SvViewDataItem* pItemData; // An array of SvViewDataItems
- sal_uInt16 nItmCnt; // Item count for delete operator
-
- SvViewDataEntry();
- virtual ~SvViewDataEntry();
-};
-
-// *********************************************************************
// ****************************** Items ********************************
// *********************************************************************
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index b657cbc..594a1c0 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -22,6 +22,7 @@
#include "svtdllapi.h"
#include "tools/solar.h"
+#include "tools/gen.hxx"
// Entryflags that are attached to the View
#define SVLISTENTRYFLAG_SELECTED 0x0001
@@ -30,6 +31,8 @@
#define SVLISTENTRYFLAG_CURSORED 0x0008
#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010
+class SvViewDataItem;
+
class SVT_DLLPUBLIC SvViewData
{
friend class SvTreeList;
@@ -54,6 +57,28 @@ public:
void SetSelectable( bool bSelectable );
};
+// View-dependent data for an Entry is created in the virtual function
+// SvTreeListBox::CreateViewData. The View creation of Items cannot be
+// changed (because it's an array)
+class SvViewDataEntry : public SvViewData
+{
+public:
+ SvViewDataItem* pItemData; // An array of SvViewDataItems
+ sal_uInt16 nItmCnt; // Item count for delete operator
+
+ SvViewDataEntry();
+ virtual ~SvViewDataEntry();
+};
+
+class SvViewDataItem
+{
+public:
+ Size aSize;
+
+ SvViewDataItem();
+ ~SvViewDataItem();
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index a5cd300..5f8a40b 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -366,37 +366,6 @@ const Size& SvLBoxItem::GetSize(const SvTreeListBox* pView, const SvTreeListEntr
return pViewData->aSize;
}
-DBG_NAME(SvViewDataItem);
-
-SvViewDataItem::SvViewDataItem()
-{
- DBG_CTOR(SvViewDataItem,0);
-}
-
-SvViewDataItem::~SvViewDataItem()
-{
- DBG_DTOR(SvViewDataItem,0);
-}
-
-// ***************************************************************
-// class SvLBoxViewData
-// ***************************************************************
-
-DBG_NAME(SvViewDataEntry);
-
-SvViewDataEntry::SvViewDataEntry()
- : SvViewData()
-{
- DBG_CTOR(SvViewDataEntry,0);
- pItemData = 0;
-}
-
-SvViewDataEntry::~SvViewDataEntry()
-{
- DBG_DTOR(SvViewDataEntry,0);
- delete [] pItemData;
-}
-
struct SvTreeListBoxImpl
{
bool m_bIsEmptyTextAllowed:1;
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index b0efde0..f26ad15 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -101,4 +101,31 @@ void SvViewData::SetSelectable( bool bSelectable )
nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
}
+DBG_NAME(SvViewDataEntry);
+
+SvViewDataEntry::SvViewDataEntry()
+ : SvViewData()
+{
+ DBG_CTOR(SvViewDataEntry,0);
+ pItemData = 0;
+}
+
+SvViewDataEntry::~SvViewDataEntry()
+{
+ DBG_DTOR(SvViewDataEntry,0);
+ delete [] pItemData;
+}
+
+DBG_NAME(SvViewDataItem);
+
+SvViewDataItem::SvViewDataItem()
+{
+ DBG_CTOR(SvViewDataItem,0);
+}
+
+SvViewDataItem::~SvViewDataItem()
+{
+ DBG_DTOR(SvViewDataItem,0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 209bbca18d3449178cfd4fd5404b1c2e1e86ff52
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 13:41:05 2012 -0500
Make these methods non-inline.
Change-Id: Ifa0a78213edbdf997985bf89bc769219223feab9
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
index 769381a..b657cbc 100644
--- a/svtools/inc/svtools/viewdataentry.hxx
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -35,55 +35,23 @@ class SVT_DLLPUBLIC SvViewData
friend class SvTreeList;
friend class SvListView;
- sal_uLong nVisPos;
+ sal_uLong nVisPos;
protected:
- sal_uInt16 nFlags;
+ sal_uInt16 nFlags;
public:
- SvViewData();
- SvViewData( const SvViewData& );
- virtual ~SvViewData();
-
- sal_Bool IsSelected() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_SELECTED) != 0; }
-
- sal_Bool IsExpanded() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_EXPANDED) != 0; }
-
- sal_Bool HasFocus() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_FOCUSED) != 0; }
-
- sal_Bool IsCursored() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_CURSORED) != 0; }
-
- bool IsSelectable() const
- { return (bool)(nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0; }
-
- void SetFocus( sal_Bool bFocus)
- {
- if ( !bFocus )
- nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
- else
- nFlags |= SVLISTENTRYFLAG_FOCUSED;
- }
-
- void SetCursored( sal_Bool bCursored )
- {
- if ( !bCursored )
- nFlags &= (~SVLISTENTRYFLAG_CURSORED);
- else
- nFlags |= SVLISTENTRYFLAG_CURSORED;
- }
-
- sal_uInt16 GetFlags() const
- { return nFlags; }
-
- void SetSelectable( bool bSelectable )
- {
- if( bSelectable )
- nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
- else
- nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
- }
+ SvViewData();
+ SvViewData( const SvViewData& );
+ virtual ~SvViewData();
+
+ bool IsSelected() const;
+ bool IsExpanded() const;
+ bool HasFocus() const;
+ bool IsCursored() const;
+ bool IsSelectable() const;
+ void SetFocus( sal_Bool bFocus);
+ void SetCursored( sal_Bool bCursored );
+ sal_uInt16 GetFlags() const;
+ void SetSelectable( bool bSelectable );
};
#endif
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
index 4508782..b0efde0 100644
--- a/svtools/source/contnr/viewdataentry.cxx
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -47,4 +47,58 @@ SvViewData::~SvViewData()
#endif
}
+bool SvViewData::IsSelected() const
+{
+ return (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
+}
+
+bool SvViewData::IsExpanded() const
+{
+ return (nFlags & SVLISTENTRYFLAG_EXPANDED) != 0;
+}
+
+bool SvViewData::HasFocus() const
+{
+ return (nFlags & SVLISTENTRYFLAG_FOCUSED) != 0;
+}
+
+bool SvViewData::IsCursored() const
+{
+ return (nFlags & SVLISTENTRYFLAG_CURSORED) != 0;
+}
+
+bool SvViewData::IsSelectable() const
+{
+ return (nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0;
+}
+
+void SvViewData::SetFocus( sal_Bool bFocus)
+{
+ if ( !bFocus )
+ nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
+ else
+ nFlags |= SVLISTENTRYFLAG_FOCUSED;
+}
+
+void SvViewData::SetCursored( sal_Bool bCursored )
+{
+ if ( !bCursored )
+ nFlags &= (~SVLISTENTRYFLAG_CURSORED);
+ else
+ nFlags |= SVLISTENTRYFLAG_CURSORED;
+}
+
+sal_uInt16 SvViewData::GetFlags() const
+{
+ return nFlags;
+}
+
+void SvViewData::SetSelectable( bool bSelectable )
+{
+ if( bSelectable )
+ nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
+ else
+ nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 26540beb488ce2300805ed339c8188391db25457
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Nov 27 13:35:46 2012 -0500
Extract SvViewData into separate header/source files.
I'll merge it with SvViewDataEntry next...
Change-Id: I542732213f52a3efafaa059dd46668888d4c20f1
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index fd81beb..d35cb26 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/contnr/treelist \
svtools/source/contnr/treelistbox \
svtools/source/contnr/treelistentry \
+ svtools/source/contnr/viewdataentry \
svtools/source/control/asynclink \
svtools/source/control/calendar \
svtools/source/control/collatorres \
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 9886207..1c4d664 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -44,71 +44,9 @@
#define LISTACTION_RESORTED 10
#define LISTACTION_CLEARED 11
-// Entryflags that are attached to the View
-#define SVLISTENTRYFLAG_SELECTED 0x0001
-#define SVLISTENTRYFLAG_EXPANDED 0x0002
-#define SVLISTENTRYFLAG_FOCUSED 0x0004
-#define SVLISTENTRYFLAG_CURSORED 0x0008
-#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010
-
class SvTreeListEntry;
class SvListView;
-
-class SvViewData
-{
-friend class SvTreeList;
-friend class SvListView;
-
- sal_uLong nVisPos;
-protected:
- sal_uInt16 nFlags;
-public:
- SvViewData();
- SvViewData( const SvViewData& );
- virtual ~SvViewData();
-
- sal_Bool IsSelected() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_SELECTED) != 0; }
-
- sal_Bool IsExpanded() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_EXPANDED) != 0; }
-
- sal_Bool HasFocus() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_FOCUSED) != 0; }
-
- sal_Bool IsCursored() const
- { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_CURSORED) != 0; }
-
- bool IsSelectable() const
- { return (bool)(nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0; }
-
- void SetFocus( sal_Bool bFocus)
- {
- if ( !bFocus )
- nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
- else
- nFlags |= SVLISTENTRYFLAG_FOCUSED;
- }
-
- void SetCursored( sal_Bool bCursored )
- {
- if ( !bCursored )
- nFlags &= (~SVLISTENTRYFLAG_CURSORED);
- else
- nFlags |= SVLISTENTRYFLAG_CURSORED;
- }
-
- sal_uInt16 GetFlags() const
- { return nFlags; }
-
- void SetSelectable( bool bSelectable )
- {
- if( bSelectable )
- nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
- else
- nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
- }
-};
+class SvViewData;
enum SvSortMode { SortAscending, SortDescending, SortNone };
@@ -427,52 +365,6 @@ public:
virtual void ModelHasEntryInvalidated( SvTreeListEntry* pEntry );
};
-inline sal_Bool SvListView::IsExpanded( SvTreeListEntry* pEntry ) const
-{
- DBG_ASSERT(pEntry,"IsExpanded:No Entry");
- SvDataTable::const_iterator itr = maDataTable.find(pEntry);
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
- return itr->second->IsExpanded();
-}
-
-inline sal_Bool SvListView::IsSelected( SvTreeListEntry* pEntry ) const
-{
- DBG_ASSERT(pEntry,"IsExpanded:No Entry");
- SvDataTable::const_iterator itr = maDataTable.find(pEntry );
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
- return itr->second->IsSelected();
-}
-
-inline sal_Bool SvListView::HasEntryFocus( SvTreeListEntry* pEntry ) const
-{
- DBG_ASSERT(pEntry,"IsExpanded:No Entry");
- SvDataTable::const_iterator itr = maDataTable.find(pEntry );
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
- return itr->second->HasFocus();
-}
-
-inline void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus )
-{
- DBG_ASSERT(pEntry,"SetEntryFocus:No Entry");
- SvDataTable::iterator itr = maDataTable.find(pEntry);
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
- itr->second->SetFocus(bFocus);
-}
-
-inline const SvViewData* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
-{
- SvDataTable::const_iterator itr = maDataTable.find( const_cast<SvTreeListEntry*>(pEntry) );
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
- return itr->second;
-}
-
-inline SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry )
-{
- SvDataTable::iterator itr = maDataTable.find( pEntry );
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
- return itr->second;
-}
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 549e859..11e36c1 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -37,6 +37,7 @@
#include <tools/contnr.hxx>
#include <svtools/treelist.hxx>
#include <svtools/transfer.hxx>
+#include "svtools/viewdataentry.hxx"
class Application;
class SvTreeListBox;
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx
new file mode 100644
index 0000000..769381a
--- /dev/null
+++ b/svtools/inc/svtools/viewdataentry.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_VIEWDATAENTRY_HXX__
+#define __SVTOOLS_VIEWDATAENTRY_HXX__
+
+#include "svtdllapi.h"
+#include "tools/solar.h"
+
+// Entryflags that are attached to the View
+#define SVLISTENTRYFLAG_SELECTED 0x0001
+#define SVLISTENTRYFLAG_EXPANDED 0x0002
+#define SVLISTENTRYFLAG_FOCUSED 0x0004
+#define SVLISTENTRYFLAG_CURSORED 0x0008
+#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010
+
+class SVT_DLLPUBLIC SvViewData
+{
+friend class SvTreeList;
+friend class SvListView;
+
+ sal_uLong nVisPos;
+protected:
+ sal_uInt16 nFlags;
+public:
+ SvViewData();
+ SvViewData( const SvViewData& );
+ virtual ~SvViewData();
+
+ sal_Bool IsSelected() const
+ { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_SELECTED) != 0; }
+
+ sal_Bool IsExpanded() const
+ { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_EXPANDED) != 0; }
+
+ sal_Bool HasFocus() const
+ { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_FOCUSED) != 0; }
+
+ sal_Bool IsCursored() const
+ { return (sal_Bool)(nFlags & SVLISTENTRYFLAG_CURSORED) != 0; }
+
+ bool IsSelectable() const
+ { return (bool)(nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0; }
+
+ void SetFocus( sal_Bool bFocus)
+ {
+ if ( !bFocus )
+ nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
+ else
+ nFlags |= SVLISTENTRYFLAG_FOCUSED;
+ }
+
+ void SetCursored( sal_Bool bCursored )
+ {
+ if ( !bCursored )
+ nFlags &= (~SVLISTENTRYFLAG_CURSORED);
+ else
+ nFlags |= SVLISTENTRYFLAG_CURSORED;
+ }
+
+ sal_uInt16 GetFlags() const
+ { return nFlags; }
+
+ void SetSelectable( bool bSelectable )
+ {
+ if( bSelectable )
+ nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
+ else
+ nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 9888277..676e008 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -26,6 +26,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtabbx.hxx>
#include <svtools/svtools.hrc>
+#include "svtools/viewdataentry.hxx"
#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index b18f1c0..4750c61 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -23,32 +23,6 @@
#include <stdio.h>
-DBG_NAME(SvViewData);
-
-SvViewData::SvViewData()
-{
- DBG_CTOR(SvViewData,0);
- nFlags = 0;
- nVisPos = 0;
-}
-
-SvViewData::SvViewData( const SvViewData& rData )
-{
- DBG_CTOR(SvViewData,0);
- nFlags = rData.nFlags;
- nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED );
- nVisPos = rData.nVisPos;
-}
-
-SvViewData::~SvViewData()
-{
- DBG_DTOR(SvViewData,0);
-#ifdef DBG_UTIL
- nVisPos = 0x12345678;
- nFlags = 0x1234;
-#endif
-}
-
SvTreeList::SvTreeList()
{
nEntryCount = 0;
@@ -1507,6 +1481,52 @@ void SvListView::InitViewData( SvViewData*, SvTreeListEntry* )
{
}
+sal_Bool SvListView::IsExpanded( SvTreeListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"IsExpanded:No Entry");
+ SvDataTable::const_iterator itr = maDataTable.find(pEntry);
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+ return itr->second->IsExpanded();
+}
+
+sal_Bool SvListView::IsSelected( SvTreeListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"IsExpanded:No Entry");
+ SvDataTable::const_iterator itr = maDataTable.find(pEntry );
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+ return itr->second->IsSelected();
+}
+
+sal_Bool SvListView::HasEntryFocus( SvTreeListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"IsExpanded:No Entry");
+ SvDataTable::const_iterator itr = maDataTable.find(pEntry );
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+ return itr->second->HasFocus();
+}
+
+void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus )
+{
+ DBG_ASSERT(pEntry,"SetEntryFocus:No Entry");
+ SvDataTable::iterator itr = maDataTable.find(pEntry);
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+ itr->second->SetFocus(bFocus);
+}
+
+const SvViewData* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
+{
+ SvDataTable::const_iterator itr = maDataTable.find( const_cast<SvTreeListEntry*>(pEntry) );
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
+ return itr->second;
+}
+
+SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry )
+{
+ SvDataTable::iterator itr = maDataTable.find( pEntry );
+ DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
+ return itr->second;
+}
+
StringCompare SvTreeList::Compare(const SvTreeListEntry* pLeft, const SvTreeListEntry* pRight) const
{
if( aCompareLink.IsSet())
diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx
new file mode 100644
index 0000000..4508782
--- /dev/null
+++ b/svtools/source/contnr/viewdataentry.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "svtools/viewdataentry.hxx"
+
+#include "tools/debug.hxx"
+
+DBG_NAME(SvViewData);
+
+SvViewData::SvViewData()
+{
+ DBG_CTOR(SvViewData,0);
+ nFlags = 0;
+ nVisPos = 0;
+}
+
+SvViewData::SvViewData( const SvViewData& rData )
+{
+ DBG_CTOR(SvViewData,0);
+ nFlags = rData.nFlags;
+ nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED );
+ nVisPos = rData.nVisPos;
+}
+
+SvViewData::~SvViewData()
+{
+ DBG_DTOR(SvViewData,0);
+#ifdef DBG_UTIL
+ nVisPos = 0x12345678;
+ nFlags = 0x1234;
+#endif
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list