diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-04-10 12:21:24 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-04-10 12:21:24 +0100 |
commit | 306e688216c1399ca9807b4e6be3058745a4ddfa (patch) | |
tree | fa3301624e12b13ac3fbf3899a3e0d243aef8180 | |
parent | more excessive whitespace redux. (diff) | |
download | core-306e688216c1399ca9807b4e6be3058745a4ddfa.tar.gz core-306e688216c1399ca9807b4e6be3058745a4ddfa.zip |
initial, horrible attempt at slidejockey / search pane.
Apparently integrating with the View is really not entirely trivial.
Change-Id: Id9db5fdb69b17d26d3ade9e09714c2fd49d744bd
-rw-r--r-- | sd/source/ui/inc/SlideSorterViewShell.hxx | 20 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 131 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlideSorterView.cxx | 11 |
3 files changed, 159 insertions, 3 deletions
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index 656622ffd1ba..17568b51dfe4 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -31,10 +31,15 @@ namespace sd { namespace slidesorter { namespace controller { class SlotManager; } } } +class Edit; +class VclVBox; +class VclHBox; +class FixedText; namespace sd { namespace slidesorter { class SlideSorter; +class SlideSorterContainer; class SlideSorterViewShell : public ViewShell @@ -195,7 +200,7 @@ protected: ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView); - void Initialize (void); + virtual void Initialize (void); /** This method overwrites the one from our base class: We do our own scroll bar and the base class call is thus unnecessary. It simply @@ -211,11 +216,18 @@ class SlideJockeyViewShell : public SlideSorterViewShell { friend class controller::SlotManager; + ::std::auto_ptr<VclVBox> mpPaned; + ::std::auto_ptr<VclHBox> mpTopHBox; + ::std::auto_ptr<FixedText> mpLabel; + ::std::auto_ptr<Edit> mpSearchEdit; + ::std::auto_ptr<SlideSorterContainer> mpSorterContainer; public: TYPEINFO(); SFX_DECL_INTERFACE(SD_IF_SDSLIDEJOCKEYVIEWSHELL) + virtual ~SlideJockeyViewShell(); + static ::boost::shared_ptr<SlideJockeyViewShell> Create( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, @@ -223,6 +235,12 @@ public: FrameView* pFrameView, const bool bIsCenterPane); + /// Place and size our contents + virtual void ArrangeGUIElements (void); + +protected: + virtual void Initialize (void); + private: SlideJockeyViewShell ( SfxViewFrame* pFrame, diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index d2e3ce755144..4444e5905260 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -62,6 +62,11 @@ #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> +// pieces for SlideJockeyView which doesn't truly belong here. +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/layout.hxx> + using namespace ::sd::slidesorter; #define SlideSorterViewShell #define SlideJockeyViewShell @@ -688,9 +693,15 @@ SlideJockeyViewShell::SlideJockeyViewShell ( SfxViewFrame* _pFrame, FrameView* _pFrameView ) : SlideSorterViewShell( _pFrame, _rViewShellBase, _pParentWindow, _pFrameView ) { - fprintf( stderr, "Create slide jockey\n" ); meShellType = ST_JOCKEY_SORTER; - SetName (OUString("SlideJockeyViewShell")); + SetName(OUString("SlideJockeyViewShell")); +} + +SlideJockeyViewShell::~SlideJockeyViewShell() +{ + // FIXME: need to delete this early - it holds references on random widgets. + mpSlideSorter.reset(); + fprintf(stderr, "Delete slide jockey %p\n", this); } ::boost::shared_ptr<SlideJockeyViewShell> SlideJockeyViewShell::Create ( @@ -718,6 +729,122 @@ SlideJockeyViewShell::SlideJockeyViewShell ( SfxViewFrame* _pFrame, return pViewShell; } +class SlideSorterContainer : public VclBin +{ +public: + ::boost::shared_ptr<SlideSorter> mpSlideSorter; + Size maRequisition; + + SlideSorterContainer( VclContainer *pParent, SlideJockeyViewShell *pShell ) + : VclBin( pParent ) + { + mpSlideSorter = SlideSorter::CreateSlideSorter( pShell->GetViewShellBase(), pShell, *pParent ); + Show(); + mpSlideSorter->GetContentWindow()->Show(); + } + virtual void setAllocation(const Size& rAllocation) + { + fprintf(stderr, "setAllocation %d,%d %dx%d\n", + (int)GetPosPixel().X(), (int)GetPosPixel().Y(), + (int)rAllocation.Width(), (int)rAllocation.Height()); + + mpSlideSorter->ArrangeGUIElements(GetPosPixel(), rAllocation); + + VclBin::setAllocation( rAllocation ); + } + virtual Size calculateRequisition() const + { + return maRequisition; + } + void setRequisition(const Size &rSize) + { + maRequisition = rSize; + Resize(); + } + virtual void Paint( const Rectangle& rRect ) + { // for reasons unknown the background is not painted at all here [!] + // who should do that ? + fprintf(stderr,"SlideSortercontainer::Paint ...\n"); + Erase(); + VclBin::Paint( rRect ); + } +/* virtual Window *get_child() + { + return mpSlideSorter->GetView().Show(); + } */ +}; + +void SlideJockeyViewShell::Initialize (void) +{ + fprintf( stderr, "Create custom slide jockey layout\n" ); + +// FIXME: I need to write a layout enabled GtkPaned replacement +// using a splitter manually is just -too- bad ... + + mpPaned.reset( new VclVBox( mpContentWindow.get(), true, 8 ) ); + mpPaned->set_fill( true ); + mpPaned->Show(); + + mpTopHBox.reset( new VclHBox( mpPaned.get(), false, 8 ) ); + mpTopHBox->set_pack_type( VCL_PACK_START ); + mpTopHBox->set_vexpand( false ); + mpTopHBox->set_fill( false ); + mpTopHBox->Show(); + mpLabel.reset( new FixedText( mpTopHBox.get() ) ); + mpLabel->SetText( "Search:" ); // FIXME: i18n ... + mpLabel->set_hexpand( false ); + mpLabel->set_fill( true ); + mpLabel->Show(); + mpSearchEdit.reset( new Edit( mpTopHBox.get() ) ); + mpSearchEdit->set_hexpand( true ); + mpSearchEdit->SetPlaceholderText( "<enter slide search terms>" ); // FIXME: i18n ... + mpSearchEdit->Show(); + + mpSorterContainer.reset( new ::SlideSorterContainer( mpPaned.get(), this ) ); + mpSorterContainer->set_vexpand( true ); + mpSorterContainer->set_hexpand( true ); + mpSorterContainer->set_fill( true ); + mpSlideSorter = mpSorterContainer->mpSlideSorter; + mpView = &mpSlideSorter->GetView(); + + doShow(); + + SetPool( &GetDoc()->GetPool() ); + SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() ); + + // 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.) + SharedSdWindow pWindow( mpSlideSorter->GetContentWindow() ); + if ( pWindow ) + { + pWindow->Hide(); + pWindow->Show(); + } +} + +void SlideJockeyViewShell::ArrangeGUIElements (void) +{ + if (IsActive()) + { + fprintf(stderr, "Arrange elements size %d %d\n", + (int) maViewSize.Width(), (int)maViewSize.Height() ); + + OSL_ASSERT(mpSlideSorter.get()!=NULL); + + mpPaned->SetPosSizePixel(maViewPos, maViewSize); +// FIXME: should trickle down the stack ... +// mpSorterContainer->setRequisition( maViewSize ); +// mpSorterContainer->Resize(); + + mbIsArrangeGUIElementsPending = false; + } + else + mbIsArrangeGUIElementsPending = true; +} + } } // end of namespace ::sd::slidesorter /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index 622f96d27876..fecd7d7f4379 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -523,6 +523,9 @@ void SlideSorterView::DeterminePageObjectVisibilities (void) mbPageObjectVisibilitiesValid = true; Rectangle aViewArea (pWindow->PixelToLogic(Rectangle(Point(0,0),pWindow->GetSizePixel()))); + fprintf(stderr ,"SlideSorterView::DeterminePageObjectvisi %ld,%ld %ldx%ld\n", + aViewArea.getX(), aViewArea.getY(), + aViewArea.getWidth(), aViewArea.getHeight()); const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(aViewArea)); const Range aUnion( ::std::min(maVisiblePageRange.Min(), aRange.Min()), @@ -757,9 +760,16 @@ void SlideSorterView::Paint ( OutputDevice& rDevice, const Rectangle& rRepaintArea) { + fprintf(stderr ,"SlideSorterView::Paint %ld,%ld %ldx%ld\n", + rRepaintArea.getX(), rRepaintArea.getY(), + rRepaintArea.getWidth(), rRepaintArea.getHeight()); + if ( ! mpPageObjectPainter) if ( ! GetPageObjectPainter()) + { + fprintf(stderr, "bail early !\n"); return; + } // Update the page visibilities when they have been invalidated. if ( ! mbPageObjectVisibilitiesValid) @@ -774,6 +784,7 @@ void SlideSorterView::Paint ( // Paint all page objects that are fully or partially inside the // repaint region. const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(rRepaintArea)); + fprintf(stderr, "Visible slides are: %d -> %d\n", (int) aRange.Min(), (int)aRange.Max()); for (sal_Int32 nIndex=aRange.Min(); nIndex<=aRange.Max(); ++nIndex) { model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex)); |