summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2010-04-29 16:58:41 +0200
committerAndre Fischer <af@openoffice.org>2010-04-29 16:58:41 +0200
commit648716ed790e8f9c9e4bf515a0ec4f3a57dbd78c (patch)
tree193c5fb6b15afba7edd8ee71ba2dcd9c1171e0c0 /sd
parent735c902c49ff973f7d44c12dc683d2e8c4ed1e90 (diff)
renaissance1: #i107215# Fixed paint problem on initialization. Removed some OSL_TRACEs.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/SlideSorterViewShell.hxx3
-rw-r--r--sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx2
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx46
-rw-r--r--sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx8
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx2
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx36
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx16
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx53
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx4
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx18
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx1
12 files changed, 88 insertions, 105 deletions
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index 443802a751e6..624c0b274baa 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -129,6 +129,8 @@ public:
virtual bool HandleScrollCommand (const CommandEvent& rEvent, ::sd::Window* pWindow);
+ virtual void Activate (BOOL IsMDIActivate);
+
//===== Drag and Drop =====================================================
virtual void StartDrag (
@@ -205,6 +207,7 @@ protected:
private:
::boost::shared_ptr<SlideSorter> mpSlideSorter;
+ bool mbIsArrangeGUIElementsPending;
SlideSorterViewShell (
SfxViewFrame* pFrame,
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
index b860bd4c8e2a..386adf7d5042 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
@@ -65,14 +65,12 @@ GenericPageCache::GenericPageCache (
GenericPageCache::~GenericPageCache (void)
{
- OSL_TRACE("terminating queue processor %p", mpQueueProcessor.get());
if (mpQueueProcessor.get() != NULL)
mpQueueProcessor->Stop();
maRequestQueue.Clear();
if (mpQueueProcessor.get() != NULL)
mpQueueProcessor->Terminate();
mpQueueProcessor.reset();
- OSL_TRACE("queue processor stopped and terminated");
if (mpBitmapCache.get() != NULL)
PageCacheManager::Instance()->ReleaseCache(mpBitmapCache);
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx
index 08ca63284ea6..e813a5ac5f2b 100644
--- a/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx
@@ -128,7 +128,6 @@ template <class Queue, class Request, class Cache, class Factory>
mrQueue (rQueue),
mrCache (rCache)
{
- OSL_TRACE("QueueProcessorThread::constructor %p", this);
create();
}
@@ -139,7 +138,6 @@ template <class Queue, class Request, class Cache, class Factory>
QueueProcessorThread<Queue, Request, Cache, Factory>
::~QueueProcessorThread (void)
{
- OSL_TRACE("QueueProcessorThread::destructor %p", this);
}
@@ -148,16 +146,12 @@ template <class Queue, class Request, class Cache, class Factory>
template <class Queue, class Request, class Cache, class Factory>
void SAL_CALL QueueProcessorThread<Queue, Request, Cache, Factory>::run (void)
{
- OSL_TRACE("QueueProcessorThread::run(): running thread %p", this);
while ( ! mbIsTerminated)
{
- OSL_TRACE("QueueProcessorThread::run(): still running thread %p: %d", this, mbIsTerminated?1:0);
if (mrQueue.IsEmpty())
{
// Sleep while the queue is empty.
- OSL_TRACE("QueueProcessorThread::run(): suspending thread %p", this);
suspend();
- OSL_TRACE("QueueProcessorThread::run(): running again thread %p", this);
}
else if (GetpApp()->AnyInput())
@@ -168,19 +162,15 @@ void SAL_CALL QueueProcessorThread<Queue, Request, Cache, Factory>::run (void)
TimeValue aTimeToWait;
aTimeToWait.Seconds = 0;
aTimeToWait.Nanosec = 50*1000*1000;
- OSL_TRACE("QueueProcessorThread::run(): input pending: waiting %d nanoseconds",
- aTimeToWait.Nanosec);
wait (aTimeToWait);
}
else
{
- OSL_TRACE ("QueueProcessorThread::run(): Processing Query");
ProcessQueueEntry();
yield ();
}
}
- OSL_TRACE("QueueProcessorThread::run(): exiting run %p", this);
}
@@ -196,7 +186,6 @@ void QueueProcessorThread<Queue, Request, Cache, Factory>
do
{
- OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry(): testing for mbIsTerminated %p", this);
{
::osl::MutexGuard aGuard (maMutex);
if (mbIsTerminated)
@@ -204,7 +193,6 @@ void QueueProcessorThread<Queue, Request, Cache, Factory>
if (mrQueue.IsEmpty())
break;
}
- OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry():acquiring mutex for bitmap creation %p", this);
::vos::OGuard aSolarGuard (Application::GetSolarMutex());
::osl::MutexGuard aGuard (maMutex);
if (mbIsTerminated)
@@ -213,18 +201,12 @@ void QueueProcessorThread<Queue, Request, Cache, Factory>
if (mrQueue.IsEmpty())
break;
- OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry(): have mutexes %p", this);
-
// Get the requeuest with the highest priority from the queue.
nPriorityClass = mrQueue.GetFrontPriorityClass();
pRequest = &mrQueue.GetFront();
mrQueue.PopFront();
bRequestIsValid = true;
-
- OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry():using request %p for creating bitmap", pRequest);
- OSL_TRACE ("QueueProcessorThread::ProcessQueueEntry():processing request for page %d with priority class ",
- pRequest->GetPage()->GetPageNum(), nPriorityClass);
try
{
// Create a new preview bitmap and store it in the cache.
@@ -260,7 +242,6 @@ void QueueProcessorThread<
Queue, RequestData, BitmapCache, BitmapFactory
>::Start (void)
{
- OSL_TRACE ("QueueProcessorThread::Start %p", this);
resume ();
}
@@ -275,7 +256,6 @@ void QueueProcessorThread<
Queue, RequestData, BitmapCache, BitmapFactory
>::Stop (void)
{
- OSL_TRACE ("QueueProcessorThread::Stop %p", this);
suspend();
}
@@ -290,7 +270,6 @@ void QueueProcessorThread<
Queue, RequestData, BitmapCache, BitmapFactory
>::RemoveRequest (RequestData& rRequest)
{
- OSL_TRACE ("QueueProcessorThread::RemoveRequest %p", this);
// Do nothing else then wait for the mutex to be released.
::osl::MutexGuard aGuard (mrQueue.GetMutex());
}
@@ -307,11 +286,9 @@ void QueueProcessorThread<
>::Terminate (void)
{
// ::vos::OGuard aSolarGuard (Application::GetSolarMutex());
- OSL_TRACE("QueueProcessorThread::Terminate(): terminating thread %p", this);
::osl::Thread::terminate ();
{
::osl::MutexGuard aGuard (maMutex);
- OSL_TRACE("QueueProcessorThread::Terminate(): starting to join %p, %d", this, mbIsTerminated?1:0);
mbIsTerminated = true;
}
Start();
@@ -332,29 +309,6 @@ void SAL_CALL QueueProcessorThread<
{
::osl::MutexGuard aGuard (maMutex);
mbCanBeJoined = true;
- /*
- OSL_TRACE("QueueProcessorThread::Terminate():join %p, %d", this, mbIsTerminated?1:0);
- while (true)
- {
- {
- ::osl::MutexGuard aGuard (maMutex);
- if (mbCanBeJoined)
- break;
- }
- Start();
- TimeValue aTimeToWait;
- aTimeToWait.Seconds = 0;
- aTimeToWait.Nanosec = 50*1000*1000;
- OSL_TRACE("QueueProcessorThread::Terminate(): waiting for join");
- wait (aTimeToWait);
- }
- if (mbCanBeJoined)
- join();
- else
- OSL_TRACE("Can not join");
- OSL_TRACE("QueueProcessorThread::Terminate():terminated thread %p :%d",
- this, mbIsTerminated?1:0);
- */
}
diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
index a0b70aa1ed23..ff5cfd284c92 100644
--- a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
@@ -149,10 +149,6 @@ void InsertionIndicatorHandler::UpdatePosition (
const Point& rMouseModelPosition,
const Mode eMode)
{
- OSL_TRACE("InsertionIndicatorHandler::UpdatePosition %d,%d, %d",
- rMouseModelPosition.X(),
- rMouseModelPosition.Y(),
- eMode);
if ( ! mbIsActive)
return;
@@ -228,8 +224,6 @@ void InsertionIndicatorHandler::SetPosition (
mbIsInsertionTrivial = IsInsertionTrivial(maInsertPosition.GetIndex(), eMode);
if (maInsertPosition.GetIndex()>=0 && ! mbIsInsertionTrivial)
{
- OSL_TRACE("A insertion at %d is %strivial",
- maInsertPosition.GetIndex(), mbIsInsertionTrivial?"":"not ");
mpInsertionIndicatorOverlay->SetLocation(maInsertPosition.GetLocation());
GetInsertAnimator()->SetInsertPosition(maInsertPosition);
@@ -237,8 +231,6 @@ void InsertionIndicatorHandler::SetPosition (
}
else
{
- OSL_TRACE("B insertion at %d is %strivial",
- maInsertPosition.GetIndex(), mbIsInsertionTrivial?"":"not ");
GetInsertAnimator()->Reset(Animator::AM_Animated);
mpInsertionIndicatorOverlay->Hide();
}
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index f9c4c1ad4f0a..c6a6302dc90d 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -100,10 +100,6 @@ void VisibleAreaManager::RequestVisible (
if (rpDescriptor)
{
const sal_Int32 nIndex (rpDescriptor->GetPageIndex());
- if (nIndex > 20)
- {
- OSL_TRACE("%d", nIndex);
- }
maVisibleRequests.push_back(
mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
rpDescriptor->GetPageIndex(),
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 4afc5a74ccf0..19a213ef976e 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -266,12 +266,14 @@ private:
Region maRedrawRegion;
SharedILayerPainter mpBackgroundPainter;
::boost::scoped_ptr<ButtonBar> mpButtonBar;
+ bool mbIsRearrangePending;
/** Determine the visibility of all page objects.
*/
void DeterminePageObjectVisibilities (void);
void UpdatePreciousFlags (void);
+ void RequestRearrange (void);
void Rearrange (void);
};
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index e49d42368c8a..de5f044e898a 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -66,24 +66,48 @@ namespace {
Reference<drawing::XDrawPage> mxSlide;
};
+ bool PrintModel (const SlideSorterModel& rModel)
+ {
+ for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ {
+ OSL_TRACE("%d %d %d %d %x",
+ nIndex,
+ pDescriptor->GetPageIndex(),
+ pDescriptor->GetVisualState().mnPageId,
+ FromCoreIndex(pDescriptor->GetPage()->GetPageNum()),
+ pDescriptor->GetPage());
+ }
+ else
+ {
+ OSL_TRACE("%d", nIndex);
+ }
+ }
+
+ return true;
+ }
bool CheckModel (const SlideSorterModel& rModel)
{
for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
{
SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
- OSL_TRACE("%d %d %d %d %x",
- nIndex,
- pDescriptor->GetPageIndex(),
- pDescriptor->GetVisualState().mnPageId,
- FromCoreIndex(pDescriptor->GetPage()->GetPageNum()),
- pDescriptor->GetPage());
+ if ( ! pDescriptor)
+ {
+ PrintModel(rModel);
+ OSL_ASSERT(pDescriptor);
+ return false;
+ }
if (nIndex != pDescriptor->GetPageIndex())
{
+ PrintModel(rModel);
OSL_ASSERT(nIndex == pDescriptor->GetPageIndex());
return false;
}
if (nIndex != pDescriptor->GetVisualState().mnPageId)
{
+ PrintModel(rModel);
OSL_ASSERT(nIndex == pDescriptor->GetVisualState().mnPageId);
return false;
}
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 3212e8f74760..6ead8bb13062 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -129,7 +129,8 @@ SlideSorterViewShell::SlideSorterViewShell (
::Window* pParentWindow,
FrameView* pFrameViewArgument)
: ViewShell (pFrame, pParentWindow, rViewShellBase),
- mpSlideSorter()
+ mpSlideSorter(),
+ mbIsArrangeGUIElementsPending(true)
{
meShellType = ST_SLIDE_SORTER;
@@ -560,7 +561,10 @@ void SlideSorterViewShell::ArrangeGUIElements (void)
{
OSL_ASSERT(mpSlideSorter.get()!=NULL);
mpSlideSorter->ArrangeGUIElements(maViewPos, maViewSize);
+ mbIsArrangeGUIElementsPending = false;
}
+ else
+ mbIsArrangeGUIElementsPending = true;
}
@@ -607,6 +611,16 @@ bool SlideSorterViewShell::HandleScrollCommand (const CommandEvent& rEvent, ::sd
+void SlideSorterViewShell::Activate (BOOL bIsMDIActivate)
+{
+ ViewShell::Activate(bIsMDIActivate);
+ if (mbIsArrangeGUIElementsPending)
+ ArrangeGUIElements();
+}
+
+
+
+
SvBorder SlideSorterViewShell::GetBorder (bool )
{
OSL_ASSERT(mpSlideSorter.get()!=NULL);
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index dad31c8b2617..95aeadd97813 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -171,7 +171,8 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
mpSelectionPainter(),
mpBackgroundPainter(
new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Background))),
- mpButtonBar(new ButtonBar(mrSlideSorter))
+ mpButtonBar(new ButtonBar(mrSlideSorter)),
+ mbIsRearrangePending(true)
{
// Hide the page that contains the page objects.
SetPageVisible (FALSE);
@@ -307,7 +308,7 @@ void SlideSorterView::PostModelChange (void)
model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
// The new page objects have to be scaled and positioned.
- Rearrange();
+ RequestRearrange();
RequestRepaint();
}
@@ -363,6 +364,15 @@ void SlideSorterView::Resize (void)
UpdateOrientation();
mpLayeredDevice->Resize();
+ RequestRearrange();
+}
+
+
+
+
+void SlideSorterView::RequestRearrange (void)
+{
+ mbIsRearrangePending = true;
Rearrange();
}
@@ -371,22 +381,30 @@ void SlideSorterView::Resize (void)
void SlideSorterView::Rearrange (void)
{
+ if ( ! mbIsRearrangePending)
+ return;
+ if (mrModel.GetPageCount() <= 0)
+ return;
+
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (mrModel.GetPageCount()>0 && pWindow)
+ if ( ! pWindow)
+ return;
+ const Size aWindowSize (pWindow->GetSizePixel());
+ if (aWindowSize.Width()<=0 || aWindowSize.Height()<=0)
+ return;
+
+ const bool bRearrangeSuccess (
+ mpLayouter->Rearrange (
+ meOrientation,
+ aWindowSize,
+ mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
+ mrModel.GetPageCount()));
+ if (bRearrangeSuccess)
{
- const bool bRearrangeSuccess (
- mpLayouter->Rearrange (
- meOrientation,
- pWindow->GetSizePixel(),
- mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
- mrModel.GetPageCount()));
-
- if (bRearrangeSuccess)
- {
- Layout();
- UpdatePageUnderMouse(false);
- RequestRepaint();
- }
+ mbIsRearrangePending = false;
+ Layout();
+ UpdatePageUnderMouse(false);
+ // RequestRepaint();
}
}
@@ -750,6 +768,9 @@ void SlideSorterView::Paint (
if (mbPreciousFlagUpdatePending)
UpdatePreciousFlags();
+ if (mbIsRearrangePending)
+ Rearrange();
+
// Paint all page objects that are fully or partially inside the
// repaint region.
const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(rRepaintArea));
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 57cba55f71eb..6d5c1746541e 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -373,10 +373,6 @@ void ButtonBar::PaintButtonBackground (
AlphaMask aMask (pBitmap->GetSizePixel(), &aTransparency);
rDevice.DrawBitmapEx(maBoundingBox.TopLeft()+aOffset, BitmapEx(*pBitmap, aMask));
}
- else
- {
- OSL_TRACE("not painting background");
- }
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index c3b6b5fac8ce..a6a027c1266a 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -204,8 +204,6 @@ void LayeredDevice::RegisterPainter (
const SharedILayerPainter& rpPainter,
const sal_Int32 nLayer)
{
- OSL_TRACE("layered device at %x registering painter %x at layer %d",
- this, rpPainter.get(), nLayer);
OSL_ASSERT(mpLayers);
if ( ! rpPainter)
{
@@ -243,8 +241,6 @@ void LayeredDevice::RemovePainter (
const SharedILayerPainter& rpPainter,
const sal_Int32 nLayer)
{
- OSL_TRACE("layered device at %x removing painter %x from layer %d",
- this, rpPainter.get(), nLayer);
if ( ! rpPainter)
{
OSL_ASSERT(rpPainter);
@@ -441,13 +437,6 @@ void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
void Layer::InvalidateRectangle (const Rectangle& rInvalidationBox)
{
- /*
- OSL_TRACE("invalidating layer %x %d %d %d %d", this,
- rInvalidationBox.Left(),
- rInvalidationBox.Top(),
- rInvalidationBox.GetWidth(),
- rInvalidationBox.GetHeight());
- */
maInvalidationRegion.Union(rInvalidationBox);
}
@@ -483,13 +472,6 @@ void Layer::ValidateRectangle (const Rectangle& rBox)
{
if ( ! mpLayerDevice)
return;
- /*
- OSL_TRACE("validating layer %x %d %d %d %d", this,
- rBox.Left(),
- rBox.Top(),
- rBox.GetWidth(),
- rBox.GetHeight());
- */
const Region aSavedClipRegion (mpLayerDevice->GetClipRegion());
mpLayerDevice->IntersectClipRegion(rBox);
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index dac2b20647c8..21310de901c1 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -651,6 +651,7 @@ bool Layouter::Implementation::Rearrange (
{
mnPageCount = nPageCount;
+ // Return early when the window or the model have not yet been initialized.
if (rWindowSize.Width()<=0 || rWindowSize.Height()<=0)
return false;
if (rPreviewModelSize.Width()<=0 || rPreviewModelSize.Height()<=0)