1*02c50d82SAndre Fischer /**************************************************************
2*02c50d82SAndre Fischer *
3*02c50d82SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one
4*02c50d82SAndre Fischer * or more contributor license agreements. See the NOTICE file
5*02c50d82SAndre Fischer * distributed with this work for additional information
6*02c50d82SAndre Fischer * regarding copyright ownership. The ASF licenses this file
7*02c50d82SAndre Fischer * to you under the Apache License, Version 2.0 (the
8*02c50d82SAndre Fischer * "License"); you may not use this file except in compliance
9*02c50d82SAndre Fischer * with the License. You may obtain a copy of the License at
10*02c50d82SAndre Fischer *
11*02c50d82SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0
12*02c50d82SAndre Fischer *
13*02c50d82SAndre Fischer * Unless required by applicable law or agreed to in writing,
14*02c50d82SAndre Fischer * software distributed under the License is distributed on an
15*02c50d82SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*02c50d82SAndre Fischer * KIND, either express or implied. See the License for the
17*02c50d82SAndre Fischer * specific language governing permissions and limitations
18*02c50d82SAndre Fischer * under the License.
19*02c50d82SAndre Fischer *
20*02c50d82SAndre Fischer *************************************************************/
21*02c50d82SAndre Fischer
22*02c50d82SAndre Fischer #include "precompiled_sd.hxx"
23*02c50d82SAndre Fischer
24*02c50d82SAndre Fischer #include "MasterPageContainerProviders.hxx"
25*02c50d82SAndre Fischer
26*02c50d82SAndre Fischer #include "DrawDocShell.hxx"
27*02c50d82SAndre Fischer #include "drawdoc.hxx"
28*02c50d82SAndre Fischer #include "PreviewRenderer.hxx"
29*02c50d82SAndre Fischer #include <comphelper/processfactory.hxx>
30*02c50d82SAndre Fischer #include <sfx2/app.hxx>
31*02c50d82SAndre Fischer #include <sfx2/sfxsids.hrc>
32*02c50d82SAndre Fischer #include <unotools/ucbstreamhelper.hxx>
33*02c50d82SAndre Fischer #include <vcl/image.hxx>
34*02c50d82SAndre Fischer #include <vcl/pngread.hxx>
35*02c50d82SAndre Fischer #include <com/sun/star/embed/ElementModes.hpp>
36*02c50d82SAndre Fischer #include <tools/diagnose_ex.h>
37*02c50d82SAndre Fischer
38*02c50d82SAndre Fischer using namespace ::com::sun::star;
39*02c50d82SAndre Fischer using namespace ::com::sun::star::uno;
40*02c50d82SAndre Fischer
41*02c50d82SAndre Fischer namespace sd { namespace sidebar {
42*02c50d82SAndre Fischer
43*02c50d82SAndre Fischer
44*02c50d82SAndre Fischer //===== PagePreviewProvider ===================================================
45*02c50d82SAndre Fischer
PagePreviewProvider(void)46*02c50d82SAndre Fischer PagePreviewProvider::PagePreviewProvider (void)
47*02c50d82SAndre Fischer {
48*02c50d82SAndre Fischer }
49*02c50d82SAndre Fischer
50*02c50d82SAndre Fischer
51*02c50d82SAndre Fischer
52*02c50d82SAndre Fischer
operator ()(int nWidth,SdPage * pPage,::sd::PreviewRenderer & rRenderer)53*02c50d82SAndre Fischer Image PagePreviewProvider::operator () (
54*02c50d82SAndre Fischer int nWidth,
55*02c50d82SAndre Fischer SdPage* pPage,
56*02c50d82SAndre Fischer ::sd::PreviewRenderer& rRenderer)
57*02c50d82SAndre Fischer {
58*02c50d82SAndre Fischer Image aPreview;
59*02c50d82SAndre Fischer
60*02c50d82SAndre Fischer if (pPage != NULL)
61*02c50d82SAndre Fischer {
62*02c50d82SAndre Fischer // Use the given renderer to create a preview of the given page
63*02c50d82SAndre Fischer // object.
64*02c50d82SAndre Fischer aPreview = rRenderer.RenderPage(
65*02c50d82SAndre Fischer pPage,
66*02c50d82SAndre Fischer nWidth,
67*02c50d82SAndre Fischer String::CreateFromAscii(""),
68*02c50d82SAndre Fischer false);
69*02c50d82SAndre Fischer }
70*02c50d82SAndre Fischer
71*02c50d82SAndre Fischer return aPreview;
72*02c50d82SAndre Fischer }
73*02c50d82SAndre Fischer
74*02c50d82SAndre Fischer
75*02c50d82SAndre Fischer
76*02c50d82SAndre Fischer
GetCostIndex(void)77*02c50d82SAndre Fischer int PagePreviewProvider::GetCostIndex (void)
78*02c50d82SAndre Fischer {
79*02c50d82SAndre Fischer return 5;
80*02c50d82SAndre Fischer }
81*02c50d82SAndre Fischer
82*02c50d82SAndre Fischer
83*02c50d82SAndre Fischer
84*02c50d82SAndre Fischer
NeedsPageObject(void)85*02c50d82SAndre Fischer bool PagePreviewProvider::NeedsPageObject (void)
86*02c50d82SAndre Fischer {
87*02c50d82SAndre Fischer return true;
88*02c50d82SAndre Fischer }
89*02c50d82SAndre Fischer
90*02c50d82SAndre Fischer
91*02c50d82SAndre Fischer
92*02c50d82SAndre Fischer
93*02c50d82SAndre Fischer //===== TemplatePreviewProvider ===============================================
94*02c50d82SAndre Fischer
TemplatePreviewProvider(const::rtl::OUString & rsURL)95*02c50d82SAndre Fischer TemplatePreviewProvider::TemplatePreviewProvider (const ::rtl::OUString& rsURL)
96*02c50d82SAndre Fischer : msURL(rsURL)
97*02c50d82SAndre Fischer {
98*02c50d82SAndre Fischer }
99*02c50d82SAndre Fischer
100*02c50d82SAndre Fischer
101*02c50d82SAndre Fischer
102*02c50d82SAndre Fischer
operator ()(int nWidth,SdPage * pPage,::sd::PreviewRenderer & rRenderer)103*02c50d82SAndre Fischer Image TemplatePreviewProvider::operator() (
104*02c50d82SAndre Fischer int nWidth,
105*02c50d82SAndre Fischer SdPage* pPage,
106*02c50d82SAndre Fischer ::sd::PreviewRenderer& rRenderer)
107*02c50d82SAndre Fischer {
108*02c50d82SAndre Fischer // Unused parameters.
109*02c50d82SAndre Fischer (void)nWidth;
110*02c50d82SAndre Fischer (void)pPage;
111*02c50d82SAndre Fischer (void)rRenderer;
112*02c50d82SAndre Fischer
113*02c50d82SAndre Fischer // Load the thumbnail from a template document.
114*02c50d82SAndre Fischer uno::Reference<io::XInputStream> xIStream;
115*02c50d82SAndre Fischer
116*02c50d82SAndre Fischer uno::Reference< lang::XMultiServiceFactory > xServiceManager (
117*02c50d82SAndre Fischer ::comphelper::getProcessServiceFactory());
118*02c50d82SAndre Fischer if (xServiceManager.is())
119*02c50d82SAndre Fischer {
120*02c50d82SAndre Fischer try
121*02c50d82SAndre Fischer {
122*02c50d82SAndre Fischer uno::Reference<lang::XSingleServiceFactory> xStorageFactory(
123*02c50d82SAndre Fischer xServiceManager->createInstance(
124*02c50d82SAndre Fischer ::rtl::OUString::createFromAscii(
125*02c50d82SAndre Fischer "com.sun.star.embed.StorageFactory")),
126*02c50d82SAndre Fischer uno::UNO_QUERY);
127*02c50d82SAndre Fischer
128*02c50d82SAndre Fischer if (xStorageFactory.is())
129*02c50d82SAndre Fischer {
130*02c50d82SAndre Fischer uno::Sequence<uno::Any> aArgs (2);
131*02c50d82SAndre Fischer aArgs[0] <<= msURL;
132*02c50d82SAndre Fischer aArgs[1] <<= embed::ElementModes::READ;
133*02c50d82SAndre Fischer uno::Reference<embed::XStorage> xDocStorage (
134*02c50d82SAndre Fischer xStorageFactory->createInstanceWithArguments(aArgs),
135*02c50d82SAndre Fischer uno::UNO_QUERY);
136*02c50d82SAndre Fischer
137*02c50d82SAndre Fischer try
138*02c50d82SAndre Fischer {
139*02c50d82SAndre Fischer if (xDocStorage.is())
140*02c50d82SAndre Fischer {
141*02c50d82SAndre Fischer uno::Reference<embed::XStorage> xStorage (
142*02c50d82SAndre Fischer xDocStorage->openStorageElement(
143*02c50d82SAndre Fischer ::rtl::OUString::createFromAscii("Thumbnails"),
144*02c50d82SAndre Fischer embed::ElementModes::READ));
145*02c50d82SAndre Fischer if (xStorage.is())
146*02c50d82SAndre Fischer {
147*02c50d82SAndre Fischer uno::Reference<io::XStream> xThumbnailCopy (
148*02c50d82SAndre Fischer xStorage->cloneStreamElement(
149*02c50d82SAndre Fischer ::rtl::OUString::createFromAscii(
150*02c50d82SAndre Fischer "thumbnail.png")));
151*02c50d82SAndre Fischer if (xThumbnailCopy.is())
152*02c50d82SAndre Fischer xIStream = xThumbnailCopy->getInputStream();
153*02c50d82SAndre Fischer }
154*02c50d82SAndre Fischer }
155*02c50d82SAndre Fischer }
156*02c50d82SAndre Fischer catch (uno::Exception& rException)
157*02c50d82SAndre Fischer {
158*02c50d82SAndre Fischer OSL_TRACE (
159*02c50d82SAndre Fischer "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s",
160*02c50d82SAndre Fischer ::rtl::OUStringToOString(msURL,
161*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr(),
162*02c50d82SAndre Fischer ::rtl::OUStringToOString(rException.Message,
163*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr());
164*02c50d82SAndre Fischer }
165*02c50d82SAndre Fischer
166*02c50d82SAndre Fischer try
167*02c50d82SAndre Fischer {
168*02c50d82SAndre Fischer // An (older) implementation had a bug - The storage
169*02c50d82SAndre Fischer // name was "Thumbnail" instead of "Thumbnails". The
170*02c50d82SAndre Fischer // old name is still used as fallback but this code can
171*02c50d82SAndre Fischer // be removed soon.
172*02c50d82SAndre Fischer if ( ! xIStream.is())
173*02c50d82SAndre Fischer {
174*02c50d82SAndre Fischer uno::Reference<embed::XStorage> xStorage (
175*02c50d82SAndre Fischer xDocStorage->openStorageElement(
176*02c50d82SAndre Fischer ::rtl::OUString::createFromAscii("Thumbnail"),
177*02c50d82SAndre Fischer embed::ElementModes::READ));
178*02c50d82SAndre Fischer if (xStorage.is())
179*02c50d82SAndre Fischer {
180*02c50d82SAndre Fischer uno::Reference<io::XStream> xThumbnailCopy (
181*02c50d82SAndre Fischer xStorage->cloneStreamElement(
182*02c50d82SAndre Fischer ::rtl::OUString::createFromAscii(
183*02c50d82SAndre Fischer "thumbnail.png")));
184*02c50d82SAndre Fischer if (xThumbnailCopy.is())
185*02c50d82SAndre Fischer xIStream = xThumbnailCopy->getInputStream();
186*02c50d82SAndre Fischer }
187*02c50d82SAndre Fischer }
188*02c50d82SAndre Fischer }
189*02c50d82SAndre Fischer catch (uno::Exception& rException)
190*02c50d82SAndre Fischer {
191*02c50d82SAndre Fischer OSL_TRACE (
192*02c50d82SAndre Fischer "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s",
193*02c50d82SAndre Fischer ::rtl::OUStringToOString(msURL,
194*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr(),
195*02c50d82SAndre Fischer ::rtl::OUStringToOString(rException.Message,
196*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr());
197*02c50d82SAndre Fischer }
198*02c50d82SAndre Fischer }
199*02c50d82SAndre Fischer }
200*02c50d82SAndre Fischer catch (uno::Exception& rException)
201*02c50d82SAndre Fischer {
202*02c50d82SAndre Fischer OSL_TRACE (
203*02c50d82SAndre Fischer "caught exception while trying to access tuhmbnail of %s: %s",
204*02c50d82SAndre Fischer ::rtl::OUStringToOString(msURL,
205*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr(),
206*02c50d82SAndre Fischer ::rtl::OUStringToOString(rException.Message,
207*02c50d82SAndre Fischer RTL_TEXTENCODING_UTF8).getStr());
208*02c50d82SAndre Fischer }
209*02c50d82SAndre Fischer }
210*02c50d82SAndre Fischer
211*02c50d82SAndre Fischer // Extract the image from the stream.
212*02c50d82SAndre Fischer BitmapEx aThumbnail;
213*02c50d82SAndre Fischer if (xIStream.is())
214*02c50d82SAndre Fischer {
215*02c50d82SAndre Fischer ::std::auto_ptr<SvStream> pStream (
216*02c50d82SAndre Fischer ::utl::UcbStreamHelper::CreateStream (xIStream));
217*02c50d82SAndre Fischer ::vcl::PNGReader aReader (*pStream);
218*02c50d82SAndre Fischer aThumbnail = aReader.Read ();
219*02c50d82SAndre Fischer }
220*02c50d82SAndre Fischer
221*02c50d82SAndre Fischer // Note that the preview is returned without scaling it to the desired
222*02c50d82SAndre Fischer // width. This gives the caller the chance to take advantage of a
223*02c50d82SAndre Fischer // possibly larger resolution then was asked for.
224*02c50d82SAndre Fischer return aThumbnail;
225*02c50d82SAndre Fischer }
226*02c50d82SAndre Fischer
227*02c50d82SAndre Fischer
228*02c50d82SAndre Fischer
229*02c50d82SAndre Fischer
GetCostIndex(void)230*02c50d82SAndre Fischer int TemplatePreviewProvider::GetCostIndex (void)
231*02c50d82SAndre Fischer {
232*02c50d82SAndre Fischer return 10;
233*02c50d82SAndre Fischer }
234*02c50d82SAndre Fischer
235*02c50d82SAndre Fischer
236*02c50d82SAndre Fischer
237*02c50d82SAndre Fischer
NeedsPageObject(void)238*02c50d82SAndre Fischer bool TemplatePreviewProvider::NeedsPageObject (void)
239*02c50d82SAndre Fischer {
240*02c50d82SAndre Fischer return false;
241*02c50d82SAndre Fischer }
242*02c50d82SAndre Fischer
243*02c50d82SAndre Fischer
244*02c50d82SAndre Fischer
245*02c50d82SAndre Fischer
246*02c50d82SAndre Fischer //===== TemplatePageObjectProvider =============================================
247*02c50d82SAndre Fischer
TemplatePageObjectProvider(const::rtl::OUString & rsURL)248*02c50d82SAndre Fischer TemplatePageObjectProvider::TemplatePageObjectProvider (const ::rtl::OUString& rsURL)
249*02c50d82SAndre Fischer : msURL(rsURL),
250*02c50d82SAndre Fischer mxDocumentShell()
251*02c50d82SAndre Fischer {
252*02c50d82SAndre Fischer }
253*02c50d82SAndre Fischer
254*02c50d82SAndre Fischer
255*02c50d82SAndre Fischer
256*02c50d82SAndre Fischer
operator ()(SdDrawDocument * pContainerDocument)257*02c50d82SAndre Fischer SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument)
258*02c50d82SAndre Fischer {
259*02c50d82SAndre Fischer // Unused parameters.
260*02c50d82SAndre Fischer (void)pContainerDocument;
261*02c50d82SAndre Fischer
262*02c50d82SAndre Fischer SdPage* pPage = NULL;
263*02c50d82SAndre Fischer
264*02c50d82SAndre Fischer mxDocumentShell = NULL;
265*02c50d82SAndre Fischer ::sd::DrawDocShell* pDocumentShell = NULL;
266*02c50d82SAndre Fischer try
267*02c50d82SAndre Fischer {
268*02c50d82SAndre Fischer // Load the template document and return its first page.
269*02c50d82SAndre Fischer pDocumentShell = LoadDocument (msURL);
270*02c50d82SAndre Fischer if (pDocumentShell != NULL)
271*02c50d82SAndre Fischer {
272*02c50d82SAndre Fischer SdDrawDocument* pDocument = pDocumentShell->GetDoc();
273*02c50d82SAndre Fischer if (pDocument != NULL)
274*02c50d82SAndre Fischer {
275*02c50d82SAndre Fischer pPage = pDocument->GetMasterSdPage(0, PK_STANDARD);
276*02c50d82SAndre Fischer // In order to make the newly loaded master page deletable
277*02c50d82SAndre Fischer // when copied into documents it is marked as no "precious".
278*02c50d82SAndre Fischer // When it is modified then it is marked as "precious".
279*02c50d82SAndre Fischer if (pPage != NULL)
280*02c50d82SAndre Fischer pPage->SetPrecious(false);
281*02c50d82SAndre Fischer }
282*02c50d82SAndre Fischer }
283*02c50d82SAndre Fischer }
284*02c50d82SAndre Fischer catch (uno::RuntimeException)
285*02c50d82SAndre Fischer {
286*02c50d82SAndre Fischer DBG_UNHANDLED_EXCEPTION();
287*02c50d82SAndre Fischer pPage = NULL;
288*02c50d82SAndre Fischer }
289*02c50d82SAndre Fischer
290*02c50d82SAndre Fischer return pPage;
291*02c50d82SAndre Fischer }
292*02c50d82SAndre Fischer
293*02c50d82SAndre Fischer
294*02c50d82SAndre Fischer
295*02c50d82SAndre Fischer
LoadDocument(const::rtl::OUString & sFileName)296*02c50d82SAndre Fischer ::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const ::rtl::OUString& sFileName)
297*02c50d82SAndre Fischer {
298*02c50d82SAndre Fischer SfxApplication* pSfxApp = SFX_APP();
299*02c50d82SAndre Fischer SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool());
300*02c50d82SAndre Fischer pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True));
301*02c50d82SAndre Fischer pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True));
302*02c50d82SAndre Fischer if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet))
303*02c50d82SAndre Fischer {
304*02c50d82SAndre Fischer mxDocumentShell = NULL;
305*02c50d82SAndre Fischer }
306*02c50d82SAndre Fischer SfxObjectShell* pShell = mxDocumentShell;
307*02c50d82SAndre Fischer return PTR_CAST(::sd::DrawDocShell,pShell);
308*02c50d82SAndre Fischer }
309*02c50d82SAndre Fischer
310*02c50d82SAndre Fischer
311*02c50d82SAndre Fischer
312*02c50d82SAndre Fischer
GetCostIndex(void)313*02c50d82SAndre Fischer int TemplatePageObjectProvider::GetCostIndex (void)
314*02c50d82SAndre Fischer {
315*02c50d82SAndre Fischer return 20;
316*02c50d82SAndre Fischer }
317*02c50d82SAndre Fischer
318*02c50d82SAndre Fischer
319*02c50d82SAndre Fischer
320*02c50d82SAndre Fischer
operator ==(const PageObjectProvider & rProvider)321*02c50d82SAndre Fischer bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider)
322*02c50d82SAndre Fischer {
323*02c50d82SAndre Fischer const TemplatePageObjectProvider* pTemplatePageObjectProvider
324*02c50d82SAndre Fischer = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider);
325*02c50d82SAndre Fischer if (pTemplatePageObjectProvider != NULL)
326*02c50d82SAndre Fischer return (msURL == pTemplatePageObjectProvider->msURL);
327*02c50d82SAndre Fischer else
328*02c50d82SAndre Fischer return false;
329*02c50d82SAndre Fischer }
330*02c50d82SAndre Fischer
331*02c50d82SAndre Fischer
332*02c50d82SAndre Fischer
333*02c50d82SAndre Fischer
334*02c50d82SAndre Fischer //===== DefaultPageObjectProvider ==============================================
335*02c50d82SAndre Fischer
DefaultPageObjectProvider(void)336*02c50d82SAndre Fischer DefaultPageObjectProvider::DefaultPageObjectProvider (void)
337*02c50d82SAndre Fischer {
338*02c50d82SAndre Fischer }
339*02c50d82SAndre Fischer
340*02c50d82SAndre Fischer
341*02c50d82SAndre Fischer
342*02c50d82SAndre Fischer
operator ()(SdDrawDocument * pContainerDocument)343*02c50d82SAndre Fischer SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument)
344*02c50d82SAndre Fischer {
345*02c50d82SAndre Fischer SdPage* pLocalMasterPage = NULL;
346*02c50d82SAndre Fischer if (pContainerDocument != NULL)
347*02c50d82SAndre Fischer {
348*02c50d82SAndre Fischer sal_Int32 nIndex (0);
349*02c50d82SAndre Fischer SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD);
350*02c50d82SAndre Fischer if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage())
351*02c50d82SAndre Fischer pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage());
352*02c50d82SAndre Fischer }
353*02c50d82SAndre Fischer
354*02c50d82SAndre Fischer if (pLocalMasterPage == NULL)
355*02c50d82SAndre Fischer {
356*02c50d82SAndre Fischer DBG_ASSERT(false, "can not create master page for slide");
357*02c50d82SAndre Fischer }
358*02c50d82SAndre Fischer
359*02c50d82SAndre Fischer return pLocalMasterPage;
360*02c50d82SAndre Fischer }
361*02c50d82SAndre Fischer
362*02c50d82SAndre Fischer
363*02c50d82SAndre Fischer
364*02c50d82SAndre Fischer
GetCostIndex(void)365*02c50d82SAndre Fischer int DefaultPageObjectProvider::GetCostIndex (void)
366*02c50d82SAndre Fischer {
367*02c50d82SAndre Fischer return 15;
368*02c50d82SAndre Fischer }
369*02c50d82SAndre Fischer
370*02c50d82SAndre Fischer
371*02c50d82SAndre Fischer
372*02c50d82SAndre Fischer
operator ==(const PageObjectProvider & rProvider)373*02c50d82SAndre Fischer bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider)
374*02c50d82SAndre Fischer {
375*02c50d82SAndre Fischer return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL);
376*02c50d82SAndre Fischer }
377*02c50d82SAndre Fischer
378*02c50d82SAndre Fischer
379*02c50d82SAndre Fischer
380*02c50d82SAndre Fischer
381*02c50d82SAndre Fischer //===== ExistingPageProvider ==================================================
382*02c50d82SAndre Fischer
ExistingPageProvider(SdPage * pPage)383*02c50d82SAndre Fischer ExistingPageProvider::ExistingPageProvider (SdPage* pPage)
384*02c50d82SAndre Fischer : mpPage(pPage)
385*02c50d82SAndre Fischer {
386*02c50d82SAndre Fischer }
387*02c50d82SAndre Fischer
388*02c50d82SAndre Fischer
389*02c50d82SAndre Fischer
390*02c50d82SAndre Fischer
operator ()(SdDrawDocument * pDocument)391*02c50d82SAndre Fischer SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument)
392*02c50d82SAndre Fischer {
393*02c50d82SAndre Fischer (void)pDocument; // Unused parameter.
394*02c50d82SAndre Fischer
395*02c50d82SAndre Fischer return mpPage;
396*02c50d82SAndre Fischer }
397*02c50d82SAndre Fischer
398*02c50d82SAndre Fischer
399*02c50d82SAndre Fischer
400*02c50d82SAndre Fischer
GetCostIndex(void)401*02c50d82SAndre Fischer int ExistingPageProvider::GetCostIndex (void)
402*02c50d82SAndre Fischer {
403*02c50d82SAndre Fischer return 0;
404*02c50d82SAndre Fischer }
405*02c50d82SAndre Fischer
406*02c50d82SAndre Fischer
407*02c50d82SAndre Fischer
408*02c50d82SAndre Fischer
operator ==(const PageObjectProvider & rProvider)409*02c50d82SAndre Fischer bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider)
410*02c50d82SAndre Fischer {
411*02c50d82SAndre Fischer const ExistingPageProvider* pExistingPageProvider
412*02c50d82SAndre Fischer = dynamic_cast<const ExistingPageProvider*>(&rProvider);
413*02c50d82SAndre Fischer if (pExistingPageProvider != NULL)
414*02c50d82SAndre Fischer return (mpPage == pExistingPageProvider->mpPage);
415*02c50d82SAndre Fischer else
416*02c50d82SAndre Fischer return false;
417*02c50d82SAndre Fischer }
418*02c50d82SAndre Fischer
419*02c50d82SAndre Fischer
420*02c50d82SAndre Fischer } } // end of namespace sd::sidebar
421