Update kpresenter2 unipresent backend to correspond to latest koffice patch
[kworship.git] / unipresent / openoffice.org / UpOoPresentation.cpp
blobc1ec614cdd22eac373539cc5adff5a8836eea19a
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 /**
21 * @file UpOoPresentation.cpp
22 * @brief OpenOffice.org presentation.
23 * @author James Hogan <james@albanarts.com>
26 #include "UpOoPresentation.h"
27 #include "UpOoSlide.h"
28 #include "UpOoBackend.h"
30 #include <com/sun/star/container/XIndexAccess.hpp>
31 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
32 #include <com/sun/star/drawing/XDrawPages.hpp>
33 #include <com/sun/star/drawing/XDrawPage.hpp>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
36 #include <com/sun/star/presentation/XPresentation.hpp>
38 #include <cassert>
40 using namespace com::sun::star::drawing;
41 using namespace com::sun::star::frame;
42 using namespace com::sun::star::presentation;
43 using namespace com::sun::star::uno;
46 * Constructors + destructor
49 /// Primary constructor.
50 UpOoPresentation::UpOoPresentation(uno::XInterface* interface, UpOoBackend* parent)
51 : UpPresentation(parent)
52 , m_interface(interface)
53 , m_url()
55 // Get the url
56 Reference<XModel> model(interface, UNO_QUERY);
57 assert(0 != model.get());
58 m_url = QString::fromUtf16((const sal_Unicode*)model->getURL());
61 /// Destructor.
62 UpOoPresentation::~UpOoPresentation()
67 * Main interface
70 void UpOoPresentation::close()
74 QUrl UpOoPresentation::url() const
76 return m_url;
80 * Custom slideshows
83 QString UpOoPresentation::currentSlideshow()
85 return "All slides";
88 QStringList UpOoPresentation::slideshows()
90 return QStringList() << "All slides";
93 void UpOoPresentation::setSlideshow(QString slideshow)
97 int UpOoPresentation::numSlides()
99 Reference<XDrawPagesSupplier> drawPagesSupplier(m_interface, UNO_QUERY);
100 assert(0 != drawPagesSupplier.get());
101 Reference<XDrawPages> drawPages = drawPagesSupplier->getDrawPages();
102 return drawPages->getCount();
105 UpSlide* UpOoPresentation::slide(int index)
107 Reference<XDrawPagesSupplier> drawPagesSupplier(m_interface, UNO_QUERY);
108 assert(0 != drawPagesSupplier.get());
109 Reference<XDrawPages> drawPages = drawPagesSupplier->getDrawPages();
110 Reference<XDrawPage> drawPage;
111 drawPages->getByIndex(index) >>= drawPage;
112 return new UpOoSlide(drawPage.get(), this);
116 * Slideshow accessors
119 bool UpOoPresentation::isSlideshowRunning()
121 return false;
124 int UpOoPresentation::numSlidesInSlideshow()
126 return 0;
129 int UpOoPresentation::currentSlideshowSlide()
131 return 0;
134 int UpOoPresentation::stepsInCurrentSlideshowSlide()
136 return 1;
139 int UpOoPresentation::currentSlideshowStep()
141 return 0;
145 * Slideshow control
148 void UpOoPresentation::startSlideshow()
150 Reference<XPresentationSupplier> presentationSupplier(m_interface, UNO_QUERY);
151 Reference<XPresentation> presentation = presentationSupplier->getPresentation();
152 presentation->start();
155 void UpOoPresentation::stopSlideshow()
157 Reference<XPresentationSupplier> presentationSupplier(m_interface, UNO_QUERY);
158 Reference<XPresentation> presentation = presentationSupplier->getPresentation();
159 presentation->end();
162 void UpOoPresentation::goToSlide(int index)
166 void UpOoPresentation::previousSlide()
170 void UpOoPresentation::nextSlide()
174 void UpOoPresentation::previousStep()
178 void UpOoPresentation::nextStep()