1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
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. *
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. *
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 ***************************************************************************/
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>
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
)
56 Reference
<XModel
> model(interface
, UNO_QUERY
);
57 assert(0 != model
.get());
58 m_url
= QString::fromUtf16((const sal_Unicode
*)model
->getURL());
62 UpOoPresentation::~UpOoPresentation()
70 void UpOoPresentation::close()
74 QUrl
UpOoPresentation::url() const
83 QString
UpOoPresentation::currentSlideshow()
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()
124 int UpOoPresentation::numSlidesInSlideshow()
129 int UpOoPresentation::currentSlideshowSlide()
134 int UpOoPresentation::stepsInCurrentSlideshowSlide()
139 int UpOoPresentation::currentSlideshowStep()
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();
162 void UpOoPresentation::goToSlide(int index
)
166 void UpOoPresentation::previousSlide()
170 void UpOoPresentation::nextSlide()
174 void UpOoPresentation::previousStep()
178 void UpOoPresentation::nextStep()