summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-11-29 14:17:48 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-11-29 16:34:43 -0500
commit251dab0145e15a372ff0fe41ce9647e9df8e9ffd (patch)
tree813037847c767cb8405b2bceef94356bb6bdd2e4 /svtools/source
parent764878deacb5018539ff5df71af8bf7e6677a93e (diff)
Pass pointer to view data entry to Paint() instead of its raw flag value.
We need to hide these flags away. Change-Id: I112003a88a92174f5012b3356ba261a039eeccc1
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/contnr/svimpbox.cxx48
-rw-r--r--svtools/source/contnr/svlbitm.cxx30
-rw-r--r--svtools/source/contnr/treelistbox.cxx10
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx10
4 files changed, 76 insertions, 22 deletions
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 99612f92fb7a..d3c0eb76ff06 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -38,6 +38,48 @@
#define NODE_BMP_TABDIST_NOTVALID -2000000
#define FIRST_ENTRY_TAB 1
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class stack_printer
+{
+public:
+ explicit stack_printer(const char *msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~stack_printer()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime - mfStartTime));
+ }
+
+ void printTime(int line) const
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime - mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
// #i27063# (pl), #i32300# (pb) never access VCL after DeInitVCL - also no destructors
Image* SvImpLBox::s_pDefCollapsed = NULL;
Image* SvImpLBox::s_pDefExpanded = NULL;
@@ -599,6 +641,7 @@ void SvImpLBox::RecalcFocusRect()
void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect )
{
+ stack_printer __stack_printer__("SvImpLBox::SetCursor");
SvViewDataEntry* pViewDataNewCur = 0;
if( pEntry )
pViewDataNewCur= pView->GetViewDataEntry(pEntry);
@@ -607,6 +650,7 @@ void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect )
pViewDataNewCur->HasFocus() &&
pViewDataNewCur->IsSelected())
{
+ fprintf(stdout, "SvImpLBox::SetCursor: nothing to do\n");
return;
}
@@ -628,9 +672,11 @@ void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect )
pCursor = pEntry;
if( pCursor )
{
+ fprintf(stdout, "SvImpLBox::SetCursor: cp (%d)\n", __LINE__);
pViewDataNewCur->SetFocus( true );
if(!bForceNoSelect && bSimpleTravel && !(nFlags & F_DESEL_ALL) && GetUpdateMode())
{
+ fprintf(stdout, "SvImpLBox::SetCursor: cp (%d)\n", __LINE__);
pView->Select( pCursor, true );
}
// multiple selection: select in cursor move if we're not in
@@ -640,10 +686,12 @@ void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect )
!(nFlags & F_DESEL_ALL) && !aSelEng.IsAddMode() &&
!bForceNoSelect )
{
+ fprintf(stdout, "SvImpLBox::SetCursor: cp (%d)\n", __LINE__);
pView->Select( pCursor, true );
}
else
{
+ fprintf(stdout, "SvImpLBox::SetCursor: cp (%d)\n", __LINE__);
ShowCursor( true );
}
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index 138ae3b5bef2..31ba9fe4a043 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -211,16 +211,17 @@ sal_uInt16 SvLBoxString::GetType() const
return SV_ITEM_ID_LBOXSTRING;
}
-void SvLBoxString::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /* nFlags */,
- SvTreeListEntry* _pEntry)
+void SvLBoxString::Paint(
+ const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
+ const SvTreeListEntry* pEntry)
{
DBG_CHKTHIS(SvLBoxString,0);
- if ( _pEntry )
+ if (pEntry)
{
sal_uInt16 nStyle = rDev.IsEnabled() ? 0 : TEXT_DRAW_DISABLE;
if ( rDev.IsEntryMnemonicsEnabled() )
nStyle |= TEXT_DRAW_MNEMONIC;
- rDev.DrawText(Rectangle(rPos, GetSize(&rDev,_pEntry)), maText, nStyle);
+ rDev.DrawText(Rectangle(rPos, GetSize(&rDev, pEntry)), maText, nStyle);
}
else
rDev.DrawText(rPos, maText);
@@ -279,8 +280,9 @@ void SvLBoxBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
pViewData->maSize = aBmp.GetSizePixel();
}
-void SvLBoxBmp::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /* nFlags */,
- SvTreeListEntry* )
+void SvLBoxBmp::Paint(
+ const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
+ const SvTreeListEntry* /*pEntry*/)
{
DBG_CHKTHIS(SvLBoxBmp,0);
sal_uInt16 nStyle = rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE;
@@ -351,8 +353,9 @@ sal_Bool SvLBoxButton::ClickHdl( SvTreeListBox*, SvTreeListEntry* pEntry )
return sal_False;
}
-void SvLBoxButton::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /* nFlags */,
- SvTreeListEntry* /*pEntry*/ )
+void SvLBoxButton::Paint(
+ const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
+ const SvTreeListEntry* /*pEntry*/)
{
DBG_CHKTHIS(SvLBoxButton,0);
sal_uInt16 nIndex = eKind == SvLBoxButtonKind_staticImage
@@ -528,15 +531,16 @@ void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntr
pViewData->maSize = m_pImpl->m_aImage1.GetSizePixel();
}
-void SvLBoxContextBmp::Paint( const Point& _rPos, SvTreeListBox& _rDev,
- sal_uInt16 _nViewDataEntryFlags, SvTreeListEntry* _pEntry )
+void SvLBoxContextBmp::Paint(
+ const Point& _rPos, SvTreeListBox& _rDev,
+ const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
{
DBG_CHKTHIS(SvLBoxContextBmp,0);
- // get the image
- const Image& rImage = implGetImageStore( 0 == ( _nViewDataEntryFlags & m_pImpl->m_nB2IndicatorFlags ) );
+ // get the image (TODO: Avoid directly referencing the flags).
+ const Image& rImage = implGetImageStore( 0 == (pView->GetFlags() & m_pImpl->m_nB2IndicatorFlags ) );
- sal_Bool _bSemiTransparent = _pEntry && ( 0 != ( SV_ENTRYFLAG_SEMITRANSPARENT & _pEntry->GetFlags( ) ) );
+ sal_Bool _bSemiTransparent = pEntry && ( 0 != ( SV_ENTRYFLAG_SEMITRANSPARENT & pEntry->GetFlags( ) ) );
// draw
sal_uInt16 nStyle = _rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE;
if ( _bSemiTransparent )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 6c4eb5e3a230..c1d80f1f94a3 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1782,20 +1782,20 @@ String SvTreeListBox::SearchEntryText( SvTreeListEntry* pEntry ) const
return sRet;
}
-const Image& SvTreeListBox::GetExpandedEntryBmp(SvTreeListEntry* pEntry) const
+const Image& SvTreeListBox::GetExpandedEntryBmp(const SvTreeListEntry* pEntry) const
{
DBG_CHKTHIS(SvTreeListBox,0);
DBG_ASSERT(pEntry,"Entry?");
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
DBG_ASSERT(pItem,"GetContextBmp:Item not found");
return pItem->GetBitmap2( );
}
-const Image& SvTreeListBox::GetCollapsedEntryBmp( SvTreeListEntry* pEntry ) const
+const Image& SvTreeListBox::GetCollapsedEntryBmp( const SvTreeListEntry* pEntry ) const
{
DBG_CHKTHIS(SvTreeListBox,0);
DBG_ASSERT(pEntry,"Entry?");
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
DBG_ASSERT(pItem,"GetContextBmp:Item not found");
return pItem->GetBitmap1( );
}
@@ -3073,7 +3073,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT
// draw item
// center vertically
aEntryPos.Y() += ( nTempEntryHeight - aSize.Height() ) / 2;
- pItem->Paint( aEntryPos, *this, pViewDataEntry->GetFlags(), pEntry );
+ pItem->Paint(aEntryPos, *this, pViewDataEntry, pEntry);
// division line between tabs
if (pNextTab && pItem->GetType() == SV_ITEM_ID_LBOXSTRING &&
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 8a409090f500..15cdf99f56f6 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -115,7 +115,8 @@ public:
void SetImage( const Image& rImage );
OUString GetGraphicURL() const;
void SetGraphicURL( const OUString& rGraphicURL );
- void Paint( const Point&, SvTreeListBox& rDev, sal_uInt16 nFlags,SvTreeListEntry* );
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
SvLBoxItem* Create() const;
void Clone( SvLBoxItem* pSource );
@@ -1600,12 +1601,13 @@ UnoTreeListItem::~UnoTreeListItem()
// --------------------------------------------------------------------
-void UnoTreeListItem::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /* nFlags */, SvTreeListEntry* _pEntry)
+void UnoTreeListItem::Paint(
+ const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
{
Point aPos( rPos );
- if( _pEntry )
+ if (pEntry)
{
- Size aSize( GetSize(&rDev,_pEntry) );
+ Size aSize( GetSize(&rDev, pEntry) );
if( !!maImage )
{
rDev.DrawImage( aPos, maImage, rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE );