diff options
Diffstat (limited to 'sd/source/ui/slidesorter/shell')
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/slidesorter/shell/SlideSorter.cxx | 139 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterService.cxx | 60 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 124 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/slidesorter/shell/makefile.mk | 0 |
5 files changed, 204 insertions, 123 deletions
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx index 47f3f56bc1c9..0c75e7a047dc 100644..100755 --- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx @@ -34,7 +34,10 @@ #include "SlideSorterViewShell.hxx" #include "controller/SlideSorterController.hxx" #include "controller/SlsScrollBarManager.hxx" +#include "controller/SlsProperties.hxx" +#include "controller/SlsAnimator.hxx" #include "view/SlideSorterView.hxx" +#include "view/SlsTheme.hxx" #include "model/SlideSorterModel.hxx" #include "glob.hrc" @@ -133,10 +136,13 @@ SlideSorter::SlideSorter ( mpViewShell(&rViewShell), mpViewShellBase(&rViewShell.GetViewShellBase()), mpContentWindow(rpContentWindow), + mbOwnesContentWindow(false), mpHorizontalScrollBar(rpHorizontalScrollBar), mpVerticalScrollBar(rpVerticalScrollBar), mpScrollBarBox(rpScrollBarBox), - mbLayoutPending(true) + mbLayoutPending(true), + mpProperties(new controller::Properties()), + mpTheme(new view::Theme(mpProperties)) { } @@ -155,10 +161,13 @@ SlideSorter::SlideSorter ( mpViewShell(pViewShell), mpViewShellBase(&rBase), mpContentWindow(new ContentWindow(rParentWindow,*this )), + mbOwnesContentWindow(true), mpHorizontalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))), mpVerticalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))), mpScrollBarBox(new ScrollBarBox(&rParentWindow)), - mbLayoutPending(true) + mbLayoutPending(true), + mpProperties(new controller::Properties()), + mpTheme(new view::Theme(mpProperties)) { } @@ -170,24 +179,37 @@ void SlideSorter::Init (void) if (mpViewShellBase != NULL) mxControllerWeak = mpViewShellBase->GetController(); + // Reinitialize colors in Properties with window specific values. + if (mpContentWindow) + { + mpProperties->SetBackgroundColor( + mpContentWindow->GetSettings().GetStyleSettings().GetWindowColor()); + mpProperties->SetTextColor( + mpContentWindow->GetSettings().GetStyleSettings().GetWindowTextColor()); + mpProperties->SetSelectionColor( + mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor()); + mpProperties->SetHighlightColor( + mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor()); + } + CreateModelViewController (); SetupListeners (); // Initialize the window. - ::sd::Window* pWindow = GetActiveWindow(); - if (pWindow != NULL) + SharedSdWindow pContentWindow (GetContentWindow()); + if (pContentWindow) { - ::Window* pParentWindow = pWindow->GetParent(); + ::Window* pParentWindow = pContentWindow->GetParent(); if (pParentWindow != NULL) pParentWindow->SetBackground(Wallpaper()); - pWindow->SetBackground(Wallpaper()); - pWindow->SetViewOrigin (Point(0,0)); + pContentWindow->SetBackground(Wallpaper()); + pContentWindow->SetViewOrigin (Point(0,0)); // We do our own scrolling while dragging a page selection. - pWindow->SetUseDropScroll (false); + pContentWindow->SetUseDropScroll (false); // Change the winbits so that the active window accepts the focus. - pWindow->SetStyle ((pWindow->GetStyle() & ~WB_DIALOGCONTROL) | WB_TABSTOP); - pWindow->Hide(); + pContentWindow->SetStyle ((pContentWindow->GetStyle() & ~WB_DIALOGCONTROL) | WB_TABSTOP); + pContentWindow->Hide(); // Set view pointer of base class. SetupControls(pParentWindow); @@ -205,6 +227,12 @@ SlideSorter::~SlideSorter (void) ReleaseListeners(); + // Dispose model, view and controller to avoid calls between them when + // they are being destructed and one or two of them are already gone. + mpSlideSorterController->Dispose(); + mpSlideSorterView->Dispose(); + mpSlideSorterModel->Dispose(); + // Reset the auto pointers explicitly to control the order of destruction. mpSlideSorterController.reset(); mpSlideSorterView.reset(); @@ -213,6 +241,17 @@ SlideSorter::~SlideSorter (void) mpHorizontalScrollBar.reset(); mpVerticalScrollBar.reset(); mpScrollBarBox.reset(); + + if (mbOwnesContentWindow) + { + OSL_ASSERT(mpContentWindow.unique()); + } + else + { + // Assume that outside this class only the owner holds a reference + // to the content window. + OSL_ASSERT(mpContentWindow.use_count()==2); + } mpContentWindow.reset(); } @@ -298,7 +337,7 @@ void SlideSorter::Paint (const Rectangle& rRepaintArea) -::boost::shared_ptr<sd::Window> SlideSorter::GetContentWindow (void) const +::SharedSdWindow SlideSorter::GetContentWindow (void) const { return mpContentWindow; } @@ -306,17 +345,6 @@ void SlideSorter::Paint (const Rectangle& rRepaintArea) -::sd::Window* SlideSorter::GetActiveWindow (void) const -{ - if (mpViewShell != NULL) - return mpViewShell->GetActiveWindow(); - else - return mpContentWindow.get(); -} - - - - ViewShellBase* SlideSorter::GetViewShellBase (void) const { return mpViewShellBase; @@ -344,8 +372,8 @@ void SlideSorter::SetupControls (::Window* ) void SlideSorter::SetupListeners (void) { - ::sd::Window* pWindow = GetActiveWindow(); - if (pWindow != NULL) + SharedSdWindow pWindow (GetContentWindow()); + if (pWindow) { ::Window* pParentWindow = pWindow->GetParent(); if (pParentWindow != NULL) @@ -376,10 +404,9 @@ void SlideSorter::ReleaseListeners (void) { mpSlideSorterController->GetScrollBarManager().Disconnect(); - ::sd::Window* pWindow = GetActiveWindow(); - if (pWindow != NULL) + SharedSdWindow pWindow (GetContentWindow()); + if (pWindow) { - pWindow->RemoveEventListener( LINK(mpSlideSorterController.get(), controller::SlideSorterController, @@ -414,7 +441,12 @@ void SlideSorter::CreateModelViewController (void) mpSlideSorterController.reset(CreateController()); DBG_ASSERT (mpSlideSorterController.get()!=NULL, "Can not create controller for slide browser"); + + // Now that model, view, and controller are constructed, do the + // initialization that relies on all three being in place. + mpSlideSorterModel->Init(); mpSlideSorterController->Init(); + mpSlideSorterView->Init(); } @@ -461,26 +493,21 @@ void SlideSorter::ArrangeGUIElements ( { Point aOrigin (rOffset); - if (rSize.Width()!=0 && rSize.Height()!=0) + if (rSize.Width()>0 + && rSize.Height()>0 + && GetContentWindow() + && GetContentWindow()->IsVisible()) { // Prevent untimely redraws while the view is not yet correctly // resized. - mpSlideSorterView->LockRedraw (TRUE); - if (GetActiveWindow() != NULL) - GetActiveWindow()->EnablePaint (FALSE); + view::SlideSorterView::DrawLock aLock (*this); + GetContentWindow()->EnablePaint (sal_False); - // maAllWindowRectangle = mpSlideSorterController->Resize (Rectangle(aOrigin, rSize)); - if (GetActiveWindow() != NULL) - GetActiveWindow()->EnablePaint (TRUE); + GetContentWindow()->EnablePaint (sal_True); mbLayoutPending = false; - mpSlideSorterView->LockRedraw (FALSE); - } - else - { - // maAllWindowRectangle = Rectangle(); } } @@ -507,6 +534,9 @@ SvBorder SlideSorter::GetBorder (void) bool SlideSorter::RelocateToWindow (::Window* pParentWindow) { + // Stop all animations for they have been started for the old window. + mpSlideSorterController->GetAnimator()->RemoveAllAnimations(); + ReleaseListeners(); if (mpViewShell != NULL) @@ -518,8 +548,8 @@ bool SlideSorter::RelocateToWindow (::Window* pParentWindow) // For accessibility we have to shortly hide the content window. This // triggers the construction of a new accessibility object for the new // view shell. (One is created earlier while the construtor of the base - // class is executed. At that time the correct accessibility object can - // not be constructed.) + // class is executed. But because at that time the correct + // accessibility object can not be constructed we do that now.) if (mpContentWindow.get() !=NULL) { mpContentWindow->Hide(); @@ -541,9 +571,8 @@ void SlideSorter::SetCurrentFunction (const FunctionReference& rpFunction) } else { - ::boost::shared_ptr<ContentWindow> pWindow - = ::boost::dynamic_pointer_cast<ContentWindow>(GetContentWindow()); - if (pWindow.get() != NULL) + ContentWindow* pWindow = dynamic_cast<ContentWindow*>(GetContentWindow().get()); + if (pWindow != NULL) pWindow->SetCurrentFunction(rpFunction); } } @@ -551,6 +580,24 @@ void SlideSorter::SetCurrentFunction (const FunctionReference& rpFunction) +::boost::shared_ptr<controller::Properties> SlideSorter::GetProperties (void) const +{ + OSL_ASSERT(mpProperties); + return mpProperties; +} + + + + +::boost::shared_ptr<view::Theme> SlideSorter::GetTheme (void) const +{ + OSL_ASSERT(mpTheme); + return mpTheme; +} + + + + //===== ContentWindow ========================================================= namespace { @@ -645,10 +692,12 @@ long ContentWindow::Notify (NotifyEvent& rEvent) - } // end of anonymous namespace + + + } } // end of namespace ::sd::slidesorter /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx index 79b14e6f4ccd..e78fa4218c74 100644..100755 --- a/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterChildWindow.cxx @@ -41,7 +41,7 @@ namespace sd { namespace slidesorter { SlideSorterChildWindow::SlideSorterChildWindow ( ::Window* pParentWindow, - USHORT nId, + sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow (pParentWindow, nId) @@ -52,7 +52,7 @@ SlideSorterChildWindow::SlideSorterChildWindow ( pParentWindow); eChildAlignment = SFX_ALIGN_LEFT; static_cast<SfxDockingWindow*>(pWindow)->Initialize (pInfo); - // SetHideNotDelete (TRUE); + // SetHideNotDelete (sal_True); } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx index 41f55fcc6be5..de3affaa1f5d 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx @@ -35,6 +35,7 @@ #include "model/SlideSorterModel.hxx" #include "model/SlsPageDescriptor.hxx" #include "view/SlideSorterView.hxx" +#include "view/SlsLayouter.hxx" #include "DrawController.hxx" #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -47,7 +48,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; -using ::sd::slidesorter::view::SlideSorterView; +using ::sd::slidesorter::view::Layouter; namespace sd { namespace slidesorter { @@ -267,7 +268,7 @@ void SAL_CALL SlideSorterService::setCurrentPage(const Reference<drawing::XDrawP { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL) - mpSlideSorter->GetController().GetCurrentSlideManager()->CurrentSlideHasChanged( + mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange( mpSlideSorter->GetModel().GetIndex(rxSlide)); } @@ -318,7 +319,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsHighlightCurrentSlide (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return false; else - return mpSlideSorter->GetController().GetProperties()->IsHighlightCurrentSlide(); + return mpSlideSorter->GetProperties()->IsHighlightCurrentSlide(); } @@ -330,7 +331,7 @@ void SAL_CALL SlideSorterService::setIsHighlightCurrentSlide (sal_Bool bValue) ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) { - mpSlideSorter->GetController().GetProperties()->SetHighlightCurrentSlide(bValue); + mpSlideSorter->GetProperties()->SetHighlightCurrentSlide(bValue); controller::SlideSorterController::ModelChangeLock aLock (mpSlideSorter->GetController()); mpSlideSorter->GetController().HandleModelChange(); } @@ -346,7 +347,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsShowSelection (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return false; else - return mpSlideSorter->GetController().GetProperties()->IsShowSelection(); + return mpSlideSorter->GetProperties()->IsShowSelection(); } @@ -357,7 +358,7 @@ void SAL_CALL SlideSorterService::setIsShowSelection (sal_Bool bValue) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetShowSelection(bValue); + mpSlideSorter->GetProperties()->SetShowSelection(bValue); } @@ -370,7 +371,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsShowFocus (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return false; else - return mpSlideSorter->GetController().GetProperties()->IsShowFocus(); + return mpSlideSorter->GetProperties()->IsShowFocus(); } @@ -381,7 +382,7 @@ void SAL_CALL SlideSorterService::setIsShowFocus (sal_Bool bValue) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetShowFocus(bValue); + mpSlideSorter->GetProperties()->SetShowFocus(bValue); } @@ -394,7 +395,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsCenterSelection (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return false; else - return mpSlideSorter->GetController().GetProperties()->IsCenterSelection(); + return mpSlideSorter->GetProperties()->IsCenterSelection(); } @@ -405,7 +406,7 @@ void SAL_CALL SlideSorterService::setIsCenterSelection (sal_Bool bValue) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetCenterSelection(bValue); + mpSlideSorter->GetProperties()->SetCenterSelection(bValue); } @@ -418,7 +419,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsSuspendPreviewUpdatesDuringFullScreen if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return true; else - return mpSlideSorter->GetController().GetProperties() + return mpSlideSorter->GetProperties() ->IsSuspendPreviewUpdatesDuringFullScreenPresentation(); } @@ -431,7 +432,7 @@ void SAL_CALL SlideSorterService::setIsSuspendPreviewUpdatesDuringFullScreenPres { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties() + mpSlideSorter->GetProperties() ->SetSuspendPreviewUpdatesDuringFullScreenPresentation(bValue); } @@ -445,7 +446,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsOrientationVertical (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return true; else - return mpSlideSorter->GetView().GetOrientation() == SlideSorterView::VERTICAL; + return mpSlideSorter->GetView().GetOrientation() != Layouter::HORIZONTAL; } @@ -457,8 +458,8 @@ void SAL_CALL SlideSorterService::setIsOrientationVertical (sal_Bool bValue) ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) mpSlideSorter->GetView().SetOrientation(bValue - ? SlideSorterView::VERTICAL - : SlideSorterView::HORIZONTAL); + ? Layouter::GRID + : Layouter::HORIZONTAL); } @@ -471,7 +472,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsSmoothScrolling (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return false; else - return mpSlideSorter->GetController().GetProperties()->IsSmoothSelectionScrolling(); + return mpSlideSorter->GetProperties()->IsSmoothSelectionScrolling(); } @@ -482,7 +483,7 @@ void SAL_CALL SlideSorterService::setIsSmoothScrolling (sal_Bool bValue) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetSmoothSelectionScrolling(bValue); + mpSlideSorter->GetProperties()->SetSmoothSelectionScrolling(bValue); } @@ -496,7 +497,7 @@ util::Color SAL_CALL SlideSorterService::getBackgroundColor (void) return util::Color(); else return util::Color( - mpSlideSorter->GetController().GetProperties()->GetBackgroundColor().GetColor()); + mpSlideSorter->GetProperties()->GetBackgroundColor().GetColor()); } @@ -507,8 +508,7 @@ void SAL_CALL SlideSorterService::setBackgroundColor (util::Color aBackgroundCol { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetBackgroundColor( - Color(aBackgroundColor)); + mpSlideSorter->GetProperties()->SetBackgroundColor(Color(aBackgroundColor)); } @@ -522,7 +522,7 @@ util::Color SAL_CALL SlideSorterService::getTextColor (void) return util::Color(); else return util::Color( - mpSlideSorter->GetController().GetProperties()->GetTextColor().GetColor()); + mpSlideSorter->GetProperties()->GetTextColor().GetColor()); } @@ -533,8 +533,7 @@ void SAL_CALL SlideSorterService::setTextColor (util::Color aTextColor) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetTextColor( - Color(aTextColor)); + mpSlideSorter->GetProperties()->SetTextColor(Color(aTextColor)); } @@ -548,7 +547,7 @@ util::Color SAL_CALL SlideSorterService::getSelectionColor (void) return util::Color(); else return util::Color( - mpSlideSorter->GetController().GetProperties()->GetSelectionColor().GetColor()); + mpSlideSorter->GetProperties()->GetSelectionColor().GetColor()); } @@ -559,8 +558,7 @@ void SAL_CALL SlideSorterService::setSelectionColor (util::Color aSelectionColor { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetSelectionColor( - Color(aSelectionColor)); + mpSlideSorter->GetProperties()->SetSelectionColor(Color(aSelectionColor)); } @@ -574,7 +572,7 @@ util::Color SAL_CALL SlideSorterService::getHighlightColor (void) return util::Color(); else return util::Color( - mpSlideSorter->GetController().GetProperties()->GetHighlightColor().GetColor()); + mpSlideSorter->GetProperties()->GetHighlightColor().GetColor()); } @@ -585,8 +583,7 @@ void SAL_CALL SlideSorterService::setHighlightColor (util::Color aHighlightColor { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetHighlightColor( - Color(aHighlightColor)); + mpSlideSorter->GetProperties()->SetHighlightColor(Color(aHighlightColor)); } @@ -598,7 +595,7 @@ sal_Bool SAL_CALL SlideSorterService::getIsUIReadOnly (void) if (mpSlideSorter.get() == NULL || ! mpSlideSorter->IsValid()) return true; else - return mpSlideSorter->GetController().GetProperties()->IsUIReadOnly(); + return mpSlideSorter->GetProperties()->IsUIReadOnly(); } @@ -609,8 +606,7 @@ void SAL_CALL SlideSorterService::setIsUIReadOnly (sal_Bool bIsUIReadOnly) { ThrowIfDisposed(); if (mpSlideSorter.get() != NULL && mpSlideSorter->IsValid()) - mpSlideSorter->GetController().GetProperties()->SetUIReadOnly( - bIsUIReadOnly); + mpSlideSorter->GetProperties()->SetUIReadOnly(bIsUIReadOnly); } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 635ff7096d4a..11c002c97d1f 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -40,6 +40,8 @@ #include "controller/SlsSlotManager.hxx" #include "controller/SlsCurrentSlideManager.hxx" #include "controller/SlsSelectionManager.hxx" +#include "controller/SlsSelectionFunction.hxx" +#include "controller/SlsProperties.hxx" #include "view/SlideSorterView.hxx" #include "view/SlsLayouter.hxx" #include "model/SlideSorterModel.hxx" @@ -98,8 +100,11 @@ TYPEINIT1(SlideSorterViewShell, ViewShell); SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, - FrameView* pFrameViewArgument) + FrameView* pFrameViewArgument, + const bool bIsCenterPane) { + (void)bIsCenterPane; + ::boost::shared_ptr<SlideSorterViewShell> pViewShell; try { @@ -125,7 +130,8 @@ SlideSorterViewShell::SlideSorterViewShell ( ::Window* pParentWindow, FrameView* pFrameViewArgument) : ViewShell (pFrame, pParentWindow, rViewShellBase), - mpSlideSorter() + mpSlideSorter(), + mbIsArrangeGUIElementsPending(true) { meShellType = ST_SLIDE_SORTER; @@ -189,8 +195,8 @@ void SlideSorterViewShell::Initialize (void) // the new view shell. (One is created earlier while the construtor // of the base class is executed. At that time the correct // accessibility object can not be constructed.) - ::Window* pWindow = mpSlideSorter->GetActiveWindow(); - if (pWindow != NULL) + SharedSdWindow pWindow (mpSlideSorter->GetContentWindow()); + if (pWindow) { pWindow->Hide(); pWindow->Show(); @@ -306,14 +312,23 @@ SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const bool SlideSorterViewShell::RelocateToParentWindow (::Window* pParentWindow) { - OSL_ASSERT(mpSlideSorter.get()!=NULL); - return mpSlideSorter->RelocateToWindow(pParentWindow); + OSL_ASSERT(mpSlideSorter); + if ( ! mpSlideSorter) + return false; + + if (pParentWindow == NULL) + WriteFrameViewData(); + const bool bSuccess (mpSlideSorter->RelocateToWindow(pParentWindow)); + if (pParentWindow != NULL) + ReadFrameViewData(mpFrameView); + + return bSuccess; } -SfxUndoManager* SlideSorterViewShell::ImpGetUndoManager (void) const +::svl::IUndoManager* SlideSorterViewShell::ImpGetUndoManager (void) const { SfxShell* pObjectBar = GetViewShellBase().GetViewShellManager()->GetTopShell(); if (pObjectBar != NULL) @@ -384,6 +399,11 @@ SdPage* SlideSorterViewShell::GetActualPage (void) pCurrentPage = pDescriptor->GetPage(); } + if (pCurrentPage == NULL) + { + + } + return pCurrentPage; } @@ -503,23 +523,13 @@ void SlideSorterViewShell::ExecStatusBar (SfxRequest& rRequest) -void SlideSorterViewShell::PrePaint() -{ - OSL_ASSERT(mpSlideSorter.get()!=NULL); - if (mpSlideSorter.get() != NULL) - mpSlideSorter->GetController().PrePaint(); -} - - - - void SlideSorterViewShell::Paint ( const Rectangle& rBBox, ::sd::Window* pWindow) { SetActiveWindow (pWindow); - OSL_ASSERT(mpSlideSorter.get()!=NULL); - if (mpSlideSorter.get() != NULL) + OSL_ASSERT(mpSlideSorter); + if (mpSlideSorter) mpSlideSorter->GetController().Paint(rBBox,pWindow); } @@ -528,10 +538,24 @@ void SlideSorterViewShell::Paint ( void SlideSorterViewShell::ArrangeGUIElements (void) { - OSL_ASSERT(mpSlideSorter.get()!=NULL); - mpSlideSorter->ArrangeGUIElements( - maViewPos, - maViewSize); + if (IsActive()) + { + OSL_ASSERT(mpSlideSorter.get()!=NULL); + mpSlideSorter->ArrangeGUIElements(maViewPos, maViewSize); + mbIsArrangeGUIElementsPending = false; + } + else + mbIsArrangeGUIElementsPending = true; +} + + + + +void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate) +{ + ViewShell::Activate(bIsMDIActivate); + if (mbIsArrangeGUIElementsPending) + ArrangeGUIElements(); } @@ -565,35 +589,45 @@ void SlideSorterViewShell::ReadFrameViewData (FrameView* pFrameView) { view::SlideSorterView& rView (mpSlideSorter->GetView()); - USHORT nSlidesPerRow (pFrameView->GetSlidesPerRow()); - if (nSlidesPerRow == 0 || ! IsMainViewShell()) + sal_uInt16 nSlidesPerRow (pFrameView->GetSlidesPerRow()); + if (nSlidesPerRow > 0 + && rView.GetOrientation() == view::Layouter::GRID + && IsMainViewShell()) { - // When a value of 0 (automatic) is given or the the slide - // sorter is displayed in a side pane then we ignore the value - // of the frame view and adapt the number of columns - // automatically to the window width. - rView.GetLayouter().SetColumnCount(1,5); - } - else rView.GetLayouter().SetColumnCount(nSlidesPerRow,nSlidesPerRow); + } + if (IsMainViewShell()) + mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange( + mpFrameView->GetSelectedPage()); mpSlideSorter->GetController().Rearrange(true); // DrawMode for 'main' window if (GetActiveWindow()->GetDrawMode() != pFrameView->GetDrawMode() ) GetActiveWindow()->SetDrawMode( pFrameView->GetDrawMode() ); } + + // When this slide sorter is not displayed in the main window then we do + // not share the same frame view and have to find other ways to acquire + // certain values. + if ( ! IsMainViewShell()) + { + ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell(); + if (pMainViewShell.get() != NULL) + mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange( + pMainViewShell->getCurrentPage()); + } } -void SlideSorterViewShell::WriteFrameViewData() +void SlideSorterViewShell::WriteFrameViewData (void) { OSL_ASSERT(mpSlideSorter.get()!=NULL); if (mpFrameView != NULL) { view::SlideSorterView& rView (mpSlideSorter->GetView()); - mpFrameView->SetSlidesPerRow((USHORT)rView.GetLayouter().GetColumnCount()); + mpFrameView->SetSlidesPerRow((sal_uInt16)rView.GetLayouter().GetColumnCount()); // DrawMode for 'main' window if( mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode() ) @@ -602,16 +636,18 @@ void SlideSorterViewShell::WriteFrameViewData() SdPage* pActualPage = GetActualPage(); if (pActualPage != NULL) { + if (IsMainViewShell()) + mpFrameView->SetSelectedPage((pActualPage->GetPageNum()- 1) / 2); + // else // The slide sorter is not expected to switch the current page // other then by double clicks. That is handled seperatly. - // mpFrameView->SetSelectedPage((pActualPage->GetPageNum()- 1) / 2); } else { // We have no current page to set but at least we can make sure // that the index of the frame view has a legal value. if (mpFrameView->GetSelectedPage() >= mpSlideSorter->GetModel().GetPageCount()) - mpFrameView->SetSelectedPage((USHORT)mpSlideSorter->GetModel().GetPageCount()-1); + mpFrameView->SetSelectedPage((sal_uInt16)mpSlideSorter->GetModel().GetPageCount()-1); } } } @@ -626,13 +662,13 @@ void SlideSorterViewShell::SetZoom (long int ) // the window. } + + + void SlideSorterViewShell::SetZoomRect (const Rectangle& rZoomRect) { OSL_ASSERT(mpSlideSorter.get()!=NULL); - Size aPageSize (mpSlideSorter->GetView().GetPageBoundingBox( - 0, - view::SlideSorterView::CS_MODEL, - view::SlideSorterView::BBT_SHAPE).GetSize()); + Size aPageSize (mpSlideSorter->GetView().GetLayouter().GetPageObjectSize()); Rectangle aRect(rZoomRect); @@ -708,8 +744,8 @@ sal_Int8 SlideSorterViewShell::AcceptDrop ( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper, ::sd::Window* pTargetWindow, - USHORT nPage, - USHORT nLayer) + sal_uInt16 nPage, + sal_uInt16 nLayer) { OSL_ASSERT(mpSlideSorter.get()!=NULL); return mpSlideSorter->GetController().GetClipboard().AcceptDrop ( @@ -727,8 +763,8 @@ sal_Int8 SlideSorterViewShell::ExecuteDrop ( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper, ::sd::Window* pTargetWindow, - USHORT nPage, - USHORT nLayer) + sal_uInt16 nPage, + sal_uInt16 nLayer) { OSL_ASSERT(mpSlideSorter.get()!=NULL); return mpSlideSorter->GetController().GetClipboard().ExecuteDrop ( diff --git a/sd/source/ui/slidesorter/shell/makefile.mk b/sd/source/ui/slidesorter/shell/makefile.mk index 94209c34dc2b..94209c34dc2b 100644..100755 --- a/sd/source/ui/slidesorter/shell/makefile.mk +++ b/sd/source/ui/slidesorter/shell/makefile.mk |