xref: /trunk/main/sd/source/ui/app/sdmod1.cxx (revision dad2ac5bb40510a7412898d3ea2dd7b1a0d98e74)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svl/lckbitem.hxx>
28cdf0e10cSrcweir #include <sfx2/frame.hxx>
29cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
30cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
31cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <svx/dialogs.hrc>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <editeng/langitem.hxx>
36cdf0e10cSrcweir #include <editeng/editdata.hxx>
37cdf0e10cSrcweir #include <vcl/msgbox.hxx>
38cdf0e10cSrcweir #include <editeng/svxenum.hxx>
39cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
40cdf0e10cSrcweir #include <sfx2/request.hxx>
41cdf0e10cSrcweir #include <sfx2/printer.hxx>
42cdf0e10cSrcweir #include <sfx2/docfile.hxx>
43cdf0e10cSrcweir #include <editeng/paperinf.hxx>
44cdf0e10cSrcweir #include <editeng/eeitem.hxx>
45cdf0e10cSrcweir #include <unotools/useroptions.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include "app.hrc"
48cdf0e10cSrcweir #include "glob.hrc"
49cdf0e10cSrcweir #include "strings.hrc"
50cdf0e10cSrcweir #include "res_bmp.hrc"
51cdf0e10cSrcweir 
522155a943Smseidel #define _SD_DLL // for SD_MOD()
53cdf0e10cSrcweir #include "sdmod.hxx"
54cdf0e10cSrcweir #include "sddll.hxx"
55cdf0e10cSrcweir #include "pres.hxx"
56cdf0e10cSrcweir #include "optsitem.hxx"
57cdf0e10cSrcweir #include "ViewShell.hxx"
58cdf0e10cSrcweir #include "sdattr.hxx"
59cdf0e10cSrcweir #include "sdpage.hxx"
60cdf0e10cSrcweir #include "DrawDocShell.hxx"
61cdf0e10cSrcweir #include "drawdoc.hxx"
62cdf0e10cSrcweir #include "assclass.hxx"
63cdf0e10cSrcweir #include "sdenumdef.hxx"
64cdf0e10cSrcweir #include "sdresid.hxx"
65cdf0e10cSrcweir #include "OutlineViewShell.hxx"
66cdf0e10cSrcweir #include "ViewShellBase.hxx"
67cdf0e10cSrcweir #ifndef SD_FRAMW_VIEW_HXX
68cdf0e10cSrcweir #include "FrameView.hxx"
69cdf0e10cSrcweir #endif
70cdf0e10cSrcweir #include "FactoryIds.hxx"
71cdf0e10cSrcweir #include "sdabstdlg.hxx"
72cdf0e10cSrcweir #include <memory>
73cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
74cdf0e10cSrcweir #include <boost/scoped_array.hpp>
75cdf0e10cSrcweir #include "slideshow.hxx"
76cdf0e10cSrcweir 
77cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
78cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp>
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 
81cdf0e10cSrcweir using ::sd::framework::FrameworkHelper;
82cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
83cdf0e10cSrcweir using ::com::sun::star::frame::XFrame;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir namespace {
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class OutlineToImpressFinalizer
88cdf0e10cSrcweir {
89cdf0e10cSrcweir public:
90cdf0e10cSrcweir     OutlineToImpressFinalizer (
91cdf0e10cSrcweir         ::sd::ViewShellBase& rBase,
92cdf0e10cSrcweir         SdDrawDocument& rDocument,
93cdf0e10cSrcweir         SvLockBytes& rBytes);
~OutlineToImpressFinalizer(void)94cdf0e10cSrcweir     virtual ~OutlineToImpressFinalizer (void) {};
95cdf0e10cSrcweir     void operator() (bool bEventSeen);
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir     ::sd::ViewShellBase& mrBase;
98cdf0e10cSrcweir     SdDrawDocument& mrDocument;
99cdf0e10cSrcweir     ::boost::shared_ptr<SvMemoryStream> mpStream;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir } // end of anonymous namespace
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir /*************************************************************************
107cdf0e10cSrcweir |* Execute
108cdf0e10cSrcweir \************************************************************************/
109cdf0e10cSrcweir 
Execute(SfxRequest & rReq)110cdf0e10cSrcweir void SdModule::Execute(SfxRequest& rReq)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     const SfxItemSet* pSet = rReq.GetArgs();
113cdf0e10cSrcweir     sal_uLong nSlotId = rReq.GetSlot();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     switch ( nSlotId )
116cdf0e10cSrcweir     {
117cdf0e10cSrcweir         case SID_NEWDOC:
118cdf0e10cSrcweir         {
119cdf0e10cSrcweir             SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
120cdf0e10cSrcweir         }
121cdf0e10cSrcweir         break;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         case SID_AUTOSPELL_CHECK:
124cdf0e10cSrcweir         {
125*dad2ac5bSMatthias Seidel             // automatische Rechtschreibprüfung
126cdf0e10cSrcweir             const SfxPoolItem* pItem;
127cdf0e10cSrcweir             if( pSet && SFX_ITEM_SET == pSet->GetItemState(
128cdf0e10cSrcweir                         SID_AUTOSPELL_CHECK, sal_False, &pItem ) )
129cdf0e10cSrcweir             {
130cdf0e10cSrcweir                 sal_Bool bOnlineSpelling = ( (const SfxBoolItem*) pItem )->GetValue();
131cdf0e10cSrcweir                 // am Dokument sichern:
132cdf0e10cSrcweir                 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
133cdf0e10cSrcweir                 if( pDocSh )
134cdf0e10cSrcweir                 {
135cdf0e10cSrcweir                     SdDrawDocument* pDoc = pDocSh->GetDoc();
136cdf0e10cSrcweir                     pDoc->SetOnlineSpell( bOnlineSpelling );
137cdf0e10cSrcweir                 }
138cdf0e10cSrcweir             }
139cdf0e10cSrcweir         }
140cdf0e10cSrcweir         break;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir         case SID_ATTR_METRIC:
143cdf0e10cSrcweir         {
144cdf0e10cSrcweir             const SfxPoolItem* pItem;
145cdf0e10cSrcweir             if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, sal_True, &pItem ) )
146cdf0e10cSrcweir             {
147cdf0e10cSrcweir                 FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
148cdf0e10cSrcweir                 switch( eUnit )
149cdf0e10cSrcweir                 {
150cdf0e10cSrcweir                     case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen
151cdf0e10cSrcweir                     case FUNIT_CM:
152cdf0e10cSrcweir                     case FUNIT_INCH:
153cdf0e10cSrcweir                     case FUNIT_PICA:
154cdf0e10cSrcweir                     case FUNIT_POINT:
155cdf0e10cSrcweir                         {
156cdf0e10cSrcweir                             ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
157cdf0e10cSrcweir                             if(pDocSh)
158cdf0e10cSrcweir                             {
159cdf0e10cSrcweir                                 DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
160cdf0e10cSrcweir 
161cdf0e10cSrcweir                                 PutItem( *pItem );
162cdf0e10cSrcweir                                 SdOptions* pOptions = GetSdOptions( eDocType );
163cdf0e10cSrcweir                                 if(pOptions)
164cdf0e10cSrcweir                                     pOptions->SetMetric( (sal_uInt16)eUnit );
165cdf0e10cSrcweir                                 rReq.Done();
166cdf0e10cSrcweir                             }
167cdf0e10cSrcweir                         }
168cdf0e10cSrcweir                         break;
169cdf0e10cSrcweir                     default:
170cdf0e10cSrcweir                         break;
171cdf0e10cSrcweir                     }
172cdf0e10cSrcweir                 }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir         }
175cdf0e10cSrcweir         break;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir         case SID_ATTR_LANGUAGE:
178cdf0e10cSrcweir         case SID_ATTR_CHAR_CJK_LANGUAGE:
179cdf0e10cSrcweir         case SID_ATTR_CHAR_CTL_LANGUAGE:
180cdf0e10cSrcweir         {
181cdf0e10cSrcweir             const SfxPoolItem* pItem;
182cdf0e10cSrcweir             if( pSet &&
183cdf0e10cSrcweir                 (
184cdf0e10cSrcweir                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem ) ||
185cdf0e10cSrcweir                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ) ||
186cdf0e10cSrcweir                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem )
187cdf0e10cSrcweir                 )
188cdf0e10cSrcweir               )
189cdf0e10cSrcweir             {
190cdf0e10cSrcweir                 // am Dokument sichern:
191cdf0e10cSrcweir                 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
192cdf0e10cSrcweir                 if ( pDocSh )
193cdf0e10cSrcweir                 {
194cdf0e10cSrcweir                     LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue();
195cdf0e10cSrcweir                     SdDrawDocument* pDoc = pDocSh->GetDoc();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir                     if( nSlotId == SID_ATTR_CHAR_CJK_LANGUAGE )
198cdf0e10cSrcweir                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CJK );
199cdf0e10cSrcweir                     else if( nSlotId == SID_ATTR_CHAR_CTL_LANGUAGE )
200cdf0e10cSrcweir                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CTL );
201cdf0e10cSrcweir                     else
202cdf0e10cSrcweir                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir                     if( pDoc->GetOnlineSpell() )
205cdf0e10cSrcweir                     {
206cdf0e10cSrcweir                         pDoc->StopOnlineSpelling();
207cdf0e10cSrcweir                         pDoc->StartOnlineSpelling();
208cdf0e10cSrcweir                     }
209cdf0e10cSrcweir                 }
210cdf0e10cSrcweir             }
211cdf0e10cSrcweir         }
212cdf0e10cSrcweir         break;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         case SID_SD_AUTOPILOT:
215cdf0e10cSrcweir         case SID_NEWSD:
216cdf0e10cSrcweir             {
217cdf0e10cSrcweir                 SfxFrame* pFrame = ExecuteNewDocument( rReq );
218cdf0e10cSrcweir                 // #94442# if a frame was created, set it as return value
219cdf0e10cSrcweir                 if(pFrame)
220cdf0e10cSrcweir                     rReq.SetReturnValue(SfxFrameItem(0, pFrame));
221cdf0e10cSrcweir             }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir             break;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         case SID_OPENHYPERLINK:
226cdf0e10cSrcweir         case SID_OPENDOC:
227cdf0e10cSrcweir         {
228cdf0e10cSrcweir             sal_Bool bIntercept = sal_False;
229cdf0e10cSrcweir             ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
230cdf0e10cSrcweir             if (pDocShell)
231cdf0e10cSrcweir             {
232cdf0e10cSrcweir                 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
233cdf0e10cSrcweir                 if (pViewShell)
234cdf0e10cSrcweir                 {
235cdf0e10cSrcweir                     if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
236cdf0e10cSrcweir                     {
237cdf0e10cSrcweir                         // Prevent documents from opening while the slide
238cdf0e10cSrcweir                         // show is running, except when this request comes
239cdf0e10cSrcweir                         // from a shape interaction.
240cdf0e10cSrcweir                         if (rReq.GetArgs() == NULL)
241cdf0e10cSrcweir                         {
242cdf0e10cSrcweir                             bIntercept = sal_True;
243cdf0e10cSrcweir                         }
244cdf0e10cSrcweir                     }
245cdf0e10cSrcweir                 }
246cdf0e10cSrcweir             }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir             if (!bIntercept)
249cdf0e10cSrcweir             {
250cdf0e10cSrcweir                 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
251cdf0e10cSrcweir             }
252cdf0e10cSrcweir             else
253cdf0e10cSrcweir             {
254cdf0e10cSrcweir                 ErrorBox(NULL, WB_OK, String(SdResId(STR_CANT_PERFORM_IN_LIVEMODE))).Execute();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir                 SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, sal_False );
257cdf0e10cSrcweir                 if( pLinkItem )
258cdf0e10cSrcweir                     pLinkItem->GetValue().Call( 0 );
259cdf0e10cSrcweir             }
260cdf0e10cSrcweir         }
261cdf0e10cSrcweir         break;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         case SID_OUTLINE_TO_IMPRESS:
264cdf0e10cSrcweir             OutlineToImpress (rReq);
265cdf0e10cSrcweir             break;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         default:
268cdf0e10cSrcweir         break;
269cdf0e10cSrcweir     }
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 
OutlineToImpress(SfxRequest & rRequest)275cdf0e10cSrcweir void SdModule::OutlineToImpress (SfxRequest& rRequest)
276cdf0e10cSrcweir {
277cdf0e10cSrcweir     const SfxItemSet* pSet = rRequest.GetArgs();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     if (pSet)
280cdf0e10cSrcweir     {
281cdf0e10cSrcweir         SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue();
282cdf0e10cSrcweir 
283cdf0e10cSrcweir         if (pBytes)
284cdf0e10cSrcweir         {
285cdf0e10cSrcweir             SfxObjectShellLock xDocShell;
286cdf0e10cSrcweir             ::sd::DrawDocShell* pDocSh;
287cdf0e10cSrcweir             xDocShell = pDocSh = new ::sd::DrawDocShell(
288cdf0e10cSrcweir                 SFX_CREATE_MODE_STANDARD, sal_False);
289cdf0e10cSrcweir             if(pDocSh)
290cdf0e10cSrcweir             {
291cdf0e10cSrcweir                 pDocSh->DoInitNew(NULL);
292cdf0e10cSrcweir                 SdDrawDocument* pDoc = pDocSh->GetDoc();
293cdf0e10cSrcweir                 if(pDoc)
294cdf0e10cSrcweir                 {
295cdf0e10cSrcweir                     pDoc->CreateFirstPages();
296cdf0e10cSrcweir                     pDoc->StopWorkStartupDelay();
297cdf0e10cSrcweir                 }
298cdf0e10cSrcweir 
299cdf0e10cSrcweir                 SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, sal_False);
300cdf0e10cSrcweir                 SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
301cdf0e10cSrcweir 
302cdf0e10cSrcweir                 ::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir                 if (pViewSh)
305cdf0e10cSrcweir                 {
306*dad2ac5bSMatthias Seidel                     // AutoLayouts müssen fertig sein
307cdf0e10cSrcweir                     pDoc->StopWorkStartupDelay();
308cdf0e10cSrcweir 
309cdf0e10cSrcweir                     SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
310cdf0e10cSrcweir 
311cdf0e10cSrcweir                     // When the view frame has not been just created we have
312cdf0e10cSrcweir                     // to switch synchronously to the outline view.
313cdf0e10cSrcweir                     // (Otherwise the request will be ignored anyway.)
314cdf0e10cSrcweir                     ::sd::ViewShellBase* pBase
315cdf0e10cSrcweir                         = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
316cdf0e10cSrcweir                     if (pBase != NULL)
317cdf0e10cSrcweir                     {
318cdf0e10cSrcweir                         ::boost::shared_ptr<FrameworkHelper> pHelper (
319cdf0e10cSrcweir                             FrameworkHelper::Instance(*pBase));
320cdf0e10cSrcweir                         pHelper->RequestView(
321cdf0e10cSrcweir                             FrameworkHelper::msOutlineViewURL,
322cdf0e10cSrcweir                             FrameworkHelper::msCenterPaneURL);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir                         pHelper->RunOnResourceActivation(
325cdf0e10cSrcweir                             FrameworkHelper::CreateResourceId(
326cdf0e10cSrcweir                             FrameworkHelper::msOutlineViewURL,
327cdf0e10cSrcweir                             FrameworkHelper::msCenterPaneURL),
328cdf0e10cSrcweir                             OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
329cdf0e10cSrcweir                     }
330cdf0e10cSrcweir                 }
331cdf0e10cSrcweir             }
332cdf0e10cSrcweir         }
333cdf0e10cSrcweir     }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     rRequest.IsDone();
336cdf0e10cSrcweir }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 
341cdf0e10cSrcweir /*************************************************************************
342cdf0e10cSrcweir |* GetState
343cdf0e10cSrcweir \************************************************************************/
344cdf0e10cSrcweir 
345cdf0e10cSrcweir static bool bOnce = false;
346cdf0e10cSrcweir 
GetState(SfxItemSet & rItemSet)347cdf0e10cSrcweir void SdModule::GetState(SfxItemSet& rItemSet)
348cdf0e10cSrcweir {
349*dad2ac5bSMatthias Seidel     // Autopilot während der Präsentation disablen
350cdf0e10cSrcweir     if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN)
351cdf0e10cSrcweir     {
352cdf0e10cSrcweir         if (!SvtModuleOptions().IsImpress())
353cdf0e10cSrcweir         {
354cdf0e10cSrcweir             rItemSet.DisableItem(SID_SD_AUTOPILOT);
355cdf0e10cSrcweir         }
356cdf0e10cSrcweir         else
357cdf0e10cSrcweir         {
358cdf0e10cSrcweir             ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
359cdf0e10cSrcweir             if (pDocShell)
360cdf0e10cSrcweir             {
361cdf0e10cSrcweir                 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
362cdf0e10cSrcweir                 if (pViewShell)
363cdf0e10cSrcweir                 {
364cdf0e10cSrcweir                     if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
365cdf0e10cSrcweir                     {
366cdf0e10cSrcweir                         rItemSet.DisableItem(SID_SD_AUTOPILOT);
367cdf0e10cSrcweir                     }
368cdf0e10cSrcweir                 }
369cdf0e10cSrcweir             }
370cdf0e10cSrcweir         }
371cdf0e10cSrcweir     }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_METRIC ) )
374cdf0e10cSrcweir     {
375cdf0e10cSrcweir         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
376cdf0e10cSrcweir         if(pDocSh)
377cdf0e10cSrcweir         {
378cdf0e10cSrcweir             DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
379cdf0e10cSrcweir 
380cdf0e10cSrcweir             SdOptions* pOptions = GetSdOptions(eDocType);
381cdf0e10cSrcweir             rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) );
382cdf0e10cSrcweir         }
383cdf0e10cSrcweir     }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir     // der Status von SID_OPENDOC wird von der Basisklasse bestimmt
386cdf0e10cSrcweir     if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN)
387cdf0e10cSrcweir     {
388cdf0e10cSrcweir         const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface());
389cdf0e10cSrcweir         if (pItem)
390cdf0e10cSrcweir             rItemSet.Put(*pItem);
391cdf0e10cSrcweir     }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     // der Status von SID_OPENHYPERLINK wird von der Basisklasse bestimmt
394cdf0e10cSrcweir     if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN)
395cdf0e10cSrcweir     {
396cdf0e10cSrcweir         const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface());
397cdf0e10cSrcweir         if (pItem)
398cdf0e10cSrcweir             rItemSet.Put(*pItem);
399cdf0e10cSrcweir     }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) )
402cdf0e10cSrcweir     {
403cdf0e10cSrcweir         ::sd::DrawDocShell* pDocSh =
404cdf0e10cSrcweir               PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
405cdf0e10cSrcweir         if( pDocSh )
406cdf0e10cSrcweir         {
407cdf0e10cSrcweir             SdDrawDocument* pDoc = pDocSh->GetDoc();
408cdf0e10cSrcweir             rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) );
409cdf0e10cSrcweir         }
410cdf0e10cSrcweir     }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) )
413cdf0e10cSrcweir     {
414cdf0e10cSrcweir         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
415cdf0e10cSrcweir         if( pDocSh )
416cdf0e10cSrcweir             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ) );
417cdf0e10cSrcweir     }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) )
420cdf0e10cSrcweir     {
421cdf0e10cSrcweir         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
422cdf0e10cSrcweir         if( pDocSh )
423cdf0e10cSrcweir             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE ) );
424cdf0e10cSrcweir     }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) )
427cdf0e10cSrcweir     {
428cdf0e10cSrcweir         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
429cdf0e10cSrcweir         if( pDocSh )
430cdf0e10cSrcweir             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) );
431cdf0e10cSrcweir     }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir     if ( !bOnce )
434cdf0e10cSrcweir     {
435cdf0e10cSrcweir         ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
436cdf0e10cSrcweir         if( pDocShell ) // Impress or Draw?
437cdf0e10cSrcweir         {
438cdf0e10cSrcweir             ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir             if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
441cdf0e10cSrcweir             {
442cdf0e10cSrcweir                 // add our event listener as soon as possible
443cdf0e10cSrcweir                 Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) );
444cdf0e10cSrcweir                 bOnce = true;
445cdf0e10cSrcweir             }
446cdf0e10cSrcweir         }
447cdf0e10cSrcweir     }
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
IMPL_LINK(SdModule,EventListenerHdl,VclSimpleEvent *,pEvent)450cdf0e10cSrcweir IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
453cdf0e10cSrcweir     {
454cdf0e10cSrcweir         const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
455cdf0e10cSrcweir 
456cdf0e10cSrcweir         if( rEvent.GetCommand() == COMMAND_MEDIA )
457cdf0e10cSrcweir         {
458cdf0e10cSrcweir             switch( rEvent.GetMediaCommand() )
459cdf0e10cSrcweir             {
460cdf0e10cSrcweir                 case MEDIA_COMMAND_PLAY:
461cdf0e10cSrcweir                 {
462cdf0e10cSrcweir                     ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
463cdf0e10cSrcweir                     if( pDocShell ) // Impress or Draw?
464cdf0e10cSrcweir                     {
465cdf0e10cSrcweir                         ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
466cdf0e10cSrcweir 
467cdf0e10cSrcweir                         // #i97925# start the presentation if and only if an Impress document is focused
468cdf0e10cSrcweir                         if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
469cdf0e10cSrcweir                             pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION );
470cdf0e10cSrcweir                     }
471cdf0e10cSrcweir                 }
472cdf0e10cSrcweir                     break;
473cdf0e10cSrcweir 
474cdf0e10cSrcweir                 default:
475cdf0e10cSrcweir                     break;
476cdf0e10cSrcweir             }
477cdf0e10cSrcweir         }
478cdf0e10cSrcweir     }
479cdf0e10cSrcweir     return 0;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 
AddSummaryPage(SfxViewFrame * pViewFrame,SdDrawDocument * pDocument)483cdf0e10cSrcweir void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument)
484cdf0e10cSrcweir {
485cdf0e10cSrcweir     if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument )
486cdf0e10cSrcweir         return;
487cdf0e10cSrcweir 
488cdf0e10cSrcweir     pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE,
489cdf0e10cSrcweir         SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
490cdf0e10cSrcweir 
491cdf0e10cSrcweir     OSL_ASSERT (pDocument!=NULL);
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD);
494cdf0e10cSrcweir 
495cdf0e10cSrcweir     // We need at least two pages: the summary page and one to use as
496cdf0e10cSrcweir     // template to take the transition parameters from.
497cdf0e10cSrcweir     if (nPageCount >= 2)
498cdf0e10cSrcweir     {
499cdf0e10cSrcweir         // Get a page from which to retrieve the transition parameters.
500cdf0e10cSrcweir         SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD);
501cdf0e10cSrcweir         OSL_ASSERT (pTemplatePage!=NULL);
502cdf0e10cSrcweir 
503cdf0e10cSrcweir         // The summary page, if it exists, is the last page.
504cdf0e10cSrcweir         SdPage* pSummaryPage = pDocument->GetSdPage (
505cdf0e10cSrcweir             (sal_uInt16)nPageCount-1, PK_STANDARD);
506cdf0e10cSrcweir         OSL_ASSERT (pSummaryPage!=NULL);
507cdf0e10cSrcweir 
508cdf0e10cSrcweir         // Take the change mode of the template page as indication of the
509cdf0e10cSrcweir         // document's kiosk mode.
510cdf0e10cSrcweir         pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
511cdf0e10cSrcweir         pSummaryPage->SetPresChange(pTemplatePage->GetPresChange());
512cdf0e10cSrcweir         pSummaryPage->SetTime(pTemplatePage->GetTime());
513cdf0e10cSrcweir         pSummaryPage->SetSound(pTemplatePage->IsSoundOn());
514cdf0e10cSrcweir         pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile());
515cdf0e10cSrcweir         pSummaryPage->setTransitionType(pTemplatePage->getTransitionType());
516cdf0e10cSrcweir         pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype());
517cdf0e10cSrcweir         pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection());
518cdf0e10cSrcweir         pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor());
519cdf0e10cSrcweir         pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
520cdf0e10cSrcweir     }
521cdf0e10cSrcweir }
522cdf0e10cSrcweir 
CreateFromTemplate(const String & rTemplatePath,const Reference<XFrame> & i_rFrame)523cdf0e10cSrcweir SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame )
524cdf0e10cSrcweir {
525cdf0e10cSrcweir     SfxFrame* pFrame = 0;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     SfxObjectShellLock xDocShell;
528cdf0e10cSrcweir 
529cdf0e10cSrcweir     SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
530cdf0e10cSrcweir     pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
531cdf0e10cSrcweir 
532cdf0e10cSrcweir     sal_uLong lErr = SFX_APP()->LoadTemplate( xDocShell, rTemplatePath, sal_True, pSet );
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     SfxObjectShell* pDocShell = xDocShell;
535cdf0e10cSrcweir 
536cdf0e10cSrcweir     if( lErr )
537cdf0e10cSrcweir     {
538cdf0e10cSrcweir         ErrorHandler::HandleError(lErr);
539cdf0e10cSrcweir     }
540cdf0e10cSrcweir     else if( pDocShell )
541cdf0e10cSrcweir     {
542cdf0e10cSrcweir         SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame );
543cdf0e10cSrcweir         OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
544cdf0e10cSrcweir         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
545cdf0e10cSrcweir     }
546cdf0e10cSrcweir 
547cdf0e10cSrcweir     return pFrame;
548cdf0e10cSrcweir 
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
ExecuteNewDocument(SfxRequest & rReq)551cdf0e10cSrcweir SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
552cdf0e10cSrcweir {
553cdf0e10cSrcweir     SfxFrame* pFrame = 0;
554cdf0e10cSrcweir     if ( SvtModuleOptions().IsImpress() )
555cdf0e10cSrcweir     {
556cdf0e10cSrcweir         Reference< XFrame > xTargetFrame;
557cdf0e10cSrcweir         SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False);
558cdf0e10cSrcweir         if ( pFrmItem )
559cdf0e10cSrcweir             xTargetFrame = pFrmItem->GetFrame();
560cdf0e10cSrcweir 
561cdf0e10cSrcweir         bool bMakeLayoutVisible = false;
562cdf0e10cSrcweir         SfxViewFrame* pViewFrame = NULL;
563cdf0e10cSrcweir 
564cdf0e10cSrcweir         SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
565cdf0e10cSrcweir         bool bStartWithTemplate = pOpt->IsStartWithTemplate();
566cdf0e10cSrcweir 
567cdf0e10cSrcweir         bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD;
568cdf0e10cSrcweir         if( bNewDocDirect && !bStartWithTemplate )
569cdf0e10cSrcweir         {
570cdf0e10cSrcweir             // we start without wizard
571cdf0e10cSrcweir 
57274cbd1f1SMatthias Seidel             // check whether we should load a template document
573cdf0e10cSrcweir             const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) );
574cdf0e10cSrcweir             String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
575cdf0e10cSrcweir 
576cdf0e10cSrcweir             if( aStandardTemplate.Len() > 0 )
577cdf0e10cSrcweir             {
578cdf0e10cSrcweir                 // load a template document
579cdf0e10cSrcweir                 pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame );
580cdf0e10cSrcweir             }
581cdf0e10cSrcweir             else
582cdf0e10cSrcweir             {
583cdf0e10cSrcweir                 // create an empty document
584cdf0e10cSrcweir                 pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame );
585cdf0e10cSrcweir                 bMakeLayoutVisible = true;
586cdf0e10cSrcweir             }
587cdf0e10cSrcweir         }
588cdf0e10cSrcweir         else
589cdf0e10cSrcweir         {
590cdf0e10cSrcweir             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
591cdf0e10cSrcweir             std::auto_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 );
592cdf0e10cSrcweir 
593cdf0e10cSrcweir             // Open the Pilot
594cdf0e10cSrcweir             if( pPilotDlg.get() && pPilotDlg->Execute()==RET_OK )
595cdf0e10cSrcweir             {
596cdf0e10cSrcweir                 const String aDocPath( pPilotDlg->GetDocPath());
597cdf0e10cSrcweir                 const sal_Bool bIsDocEmpty = pPilotDlg->IsDocEmpty();
598cdf0e10cSrcweir 
599cdf0e10cSrcweir                 // So that you can open the document without AutoLayout-Dialog
600cdf0e10cSrcweir                 pOpt->SetStartWithTemplate(sal_False);
601cdf0e10cSrcweir                 if(bNewDocDirect && !pPilotDlg->GetStartWithFlag())
602cdf0e10cSrcweir                     bStartWithTemplate = sal_False;
603cdf0e10cSrcweir 
604cdf0e10cSrcweir                 if( pPilotDlg->GetStartType() == ST_OPEN )
605cdf0e10cSrcweir                 {
606cdf0e10cSrcweir                     String aFileToOpen = aDocPath;
607cdf0e10cSrcweir 
608cdf0e10cSrcweir                     DBG_ASSERT( aFileToOpen.Len()!=0, "The autopilot should have asked for a file itself already!" );
609cdf0e10cSrcweir                     if(aFileToOpen.Len() != 0)
610cdf0e10cSrcweir                     {
611cdf0e10cSrcweir                         const String aPasswrd( pPilotDlg->GetPassword() );
612cdf0e10cSrcweir 
613cdf0e10cSrcweir                         SfxStringItem aFile( SID_FILE_NAME, aFileToOpen );
614cdf0e10cSrcweir                         SfxStringItem aReferer( SID_REFERER, UniString() );
615cdf0e10cSrcweir                         SfxStringItem aPassword( SID_PASSWORD, aPasswrd );
616cdf0e10cSrcweir 
617cdf0e10cSrcweir                         if ( xTargetFrame.is() )
618cdf0e10cSrcweir                         {
619cdf0e10cSrcweir                             SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() );
620cdf0e10cSrcweir                             aSet.Put( aFile );
621cdf0e10cSrcweir                             aSet.Put( aReferer );
622cdf0e10cSrcweir                             // Put the password into the request
623cdf0e10cSrcweir                             // only if it is not empty.
624cdf0e10cSrcweir                             if (aPasswrd.Len() > 0)
625cdf0e10cSrcweir                                 aSet.Put( aPassword );
626cdf0e10cSrcweir 
627cdf0e10cSrcweir                             const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame );
628cdf0e10cSrcweir                             const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
629cdf0e10cSrcweir                             if ( pFrameItem && pFrameItem->GetFrame() )
630cdf0e10cSrcweir                                 pFrame = &pFrameItem->GetFrame()->GetFrame();
631cdf0e10cSrcweir                         }
632cdf0e10cSrcweir                         else
633cdf0e10cSrcweir                         {
634cdf0e10cSrcweir                             SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool());
635cdf0e10cSrcweir                             aRequest.AppendItem (aFile);
636cdf0e10cSrcweir                             aRequest.AppendItem (aReferer);
637cdf0e10cSrcweir                             // Put the password into the request
638cdf0e10cSrcweir                             // only if it is not empty.
639cdf0e10cSrcweir                             if (aPasswrd.Len() > 0)
640cdf0e10cSrcweir                                 aRequest.AppendItem (aPassword);
641cdf0e10cSrcweir                             aRequest.AppendItem (SfxStringItem (
642cdf0e10cSrcweir                                 SID_TARGETNAME,
643cdf0e10cSrcweir                                 String (RTL_CONSTASCII_USTRINGPARAM ("_default"))));
644cdf0e10cSrcweir                             try
645cdf0e10cSrcweir                             {
646cdf0e10cSrcweir                                 const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest);
647cdf0e10cSrcweir                                 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
648cdf0e10cSrcweir                                 if ( pFrameItem )
649cdf0e10cSrcweir                                     pFrame = &pFrameItem->GetFrame()->GetFrame();
650cdf0e10cSrcweir                             }
651cdf0e10cSrcweir                             catch (::com::sun::star::uno::Exception e)
652cdf0e10cSrcweir                             {
653cdf0e10cSrcweir                                 DBG_ASSERT (sal_False, "caught IllegalArgumentException while loading document from Impress autopilot");
654cdf0e10cSrcweir                             }
655cdf0e10cSrcweir                         }
656cdf0e10cSrcweir                     }
657cdf0e10cSrcweir 
658cdf0e10cSrcweir                     pOpt->SetStartWithTemplate(bStartWithTemplate);
659cdf0e10cSrcweir                     if(bNewDocDirect && !bStartWithTemplate)
660cdf0e10cSrcweir                     {
661cdf0e10cSrcweir                         std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
662cdf0e10cSrcweir                         if(pRet.get())
663cdf0e10cSrcweir                             ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
664cdf0e10cSrcweir 
665cdf0e10cSrcweir                     }
666cdf0e10cSrcweir                 }
667cdf0e10cSrcweir                 else
668cdf0e10cSrcweir                 {
669cdf0e10cSrcweir                     SfxObjectShellLock xShell( pPilotDlg->GetDocument() );
670cdf0e10cSrcweir                     SfxObjectShell* pShell = xShell;
671cdf0e10cSrcweir                     if( pShell )
672cdf0e10cSrcweir                     {
673cdf0e10cSrcweir                         pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
674cdf0e10cSrcweir                         DBG_ASSERT( pViewFrame, "no ViewFrame!!" );
675cdf0e10cSrcweir                         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
676cdf0e10cSrcweir 
677cdf0e10cSrcweir                         if(bNewDocDirect && !bStartWithTemplate)
678cdf0e10cSrcweir                         {
679cdf0e10cSrcweir                             std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
680cdf0e10cSrcweir                             if(pRet.get())
681cdf0e10cSrcweir                                 ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
682cdf0e10cSrcweir                         }
683cdf0e10cSrcweir 
684cdf0e10cSrcweir                         if( pShell && pViewFrame )
685cdf0e10cSrcweir                         {
686cdf0e10cSrcweir                             ::sd::DrawDocShell* pDocShell =
687cdf0e10cSrcweir                                   PTR_CAST(::sd::DrawDocShell,pShell);
688cdf0e10cSrcweir                             SdDrawDocument* pDoc = pDocShell->GetDoc();
689cdf0e10cSrcweir 
690cdf0e10cSrcweir                             ::sd::ViewShellBase* pBase =
691cdf0e10cSrcweir                                   ::sd::ViewShellBase::GetViewShellBase (
692cdf0e10cSrcweir                                       pViewFrame);
693cdf0e10cSrcweir                             OSL_ASSERT (pBase!=NULL);
694cdf0e10cSrcweir                             ::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
695cdf0e10cSrcweir                             SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
696cdf0e10cSrcweir 
697cdf0e10cSrcweir                             if (pOptions && pViewSh.get())
698cdf0e10cSrcweir                             {
699cdf0e10cSrcweir                                 // The AutoPilot-document shall be open without its own options
700cdf0e10cSrcweir                                 ::sd::FrameView* pFrameView = pViewSh->GetFrameView();
701cdf0e10cSrcweir                                 pFrameView->Update(pOptions);
702cdf0e10cSrcweir                                 pViewSh->ReadFrameViewData(pFrameView);
703cdf0e10cSrcweir                             }
704cdf0e10cSrcweir 
705cdf0e10cSrcweir                             ChangeMedium( pDocShell, pViewFrame, pPilotDlg->GetOutputMedium() );
706cdf0e10cSrcweir 
707cdf0e10cSrcweir                             if(pPilotDlg->IsSummary())
708cdf0e10cSrcweir                                 AddSummaryPage(pViewFrame, pDoc);
709cdf0e10cSrcweir 
710cdf0e10cSrcweir                             // empty document
711cdf0e10cSrcweir                             if((aDocPath.Len() == 0) && pViewFrame && pViewFrame->GetDispatcher())
712cdf0e10cSrcweir                             {
713cdf0e10cSrcweir                                 SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty);
714cdf0e10cSrcweir                                 SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (sal_uInt32) AUTOLAYOUT_TITLE );
715cdf0e10cSrcweir                                 pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE,
716cdf0e10cSrcweir                                     SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L);
717cdf0e10cSrcweir                             }
718cdf0e10cSrcweir 
719cdf0e10cSrcweir                             // clear document info
720cdf0e10cSrcweir                             using namespace ::com::sun::star;
721cdf0e10cSrcweir                             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
722cdf0e10cSrcweir                                 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
723cdf0e10cSrcweir                             uno::Reference<document::XDocumentProperties>
724cdf0e10cSrcweir                                 xDocProps(xDPS->getDocumentProperties());
725cdf0e10cSrcweir                             DBG_ASSERT(xDocProps.is(), "no DocumentProperties");
726cdf0e10cSrcweir                             xDocProps->resetUserData(
727cdf0e10cSrcweir                                 SvtUserOptions().GetFullName() );
728cdf0e10cSrcweir                             xDocProps->setTemplateName(xDocProps->getTitle());
729cdf0e10cSrcweir                             xDocProps->setTemplateURL(pPilotDlg->GetDocPath());
730cdf0e10cSrcweir 
731cdf0e10cSrcweir                             pDoc->SetChanged(!bIsDocEmpty);
732cdf0e10cSrcweir 
733cdf0e10cSrcweir                             pDocShell->SetUseUserData(sal_True);
734cdf0e10cSrcweir 
735cdf0e10cSrcweir                             // #94652# clear UNDO stack after autopilot
736cdf0e10cSrcweir                             pDocShell->ClearUndoBuffer();
737cdf0e10cSrcweir 
738cdf0e10cSrcweir                             bMakeLayoutVisible = true;
739cdf0e10cSrcweir                         }
740cdf0e10cSrcweir                     }
741cdf0e10cSrcweir                     pOpt->SetStartWithTemplate(bStartWithTemplate);
742cdf0e10cSrcweir                 }
743cdf0e10cSrcweir             }
744cdf0e10cSrcweir         }
745cdf0e10cSrcweir     }
746cdf0e10cSrcweir 
747cdf0e10cSrcweir     return pFrame;
748cdf0e10cSrcweir }
749cdf0e10cSrcweir 
CreateEmptyDocument(DocumentType eDocType,const Reference<XFrame> & i_rFrame)750cdf0e10cSrcweir SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< XFrame >& i_rFrame )
751cdf0e10cSrcweir {
752cdf0e10cSrcweir     SfxFrame* pFrame = 0;
753cdf0e10cSrcweir 
754cdf0e10cSrcweir     SfxObjectShellLock xDocShell;
755cdf0e10cSrcweir     ::sd::DrawDocShell* pNewDocSh;
756cdf0e10cSrcweir     xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,sal_False,eDocType);
757cdf0e10cSrcweir     if(pNewDocSh)
758cdf0e10cSrcweir     {
759cdf0e10cSrcweir         pNewDocSh->DoInitNew(NULL);
760cdf0e10cSrcweir         SdDrawDocument* pDoc = pNewDocSh->GetDoc();
761cdf0e10cSrcweir         if(pDoc)
762cdf0e10cSrcweir         {
763cdf0e10cSrcweir             pDoc->CreateFirstPages();
764cdf0e10cSrcweir             pDoc->StopWorkStartupDelay();
765cdf0e10cSrcweir         }
766cdf0e10cSrcweir 
767cdf0e10cSrcweir         SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
768cdf0e10cSrcweir         OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
769cdf0e10cSrcweir         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
770cdf0e10cSrcweir     }
771cdf0e10cSrcweir 
772cdf0e10cSrcweir     return pFrame;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir 
ChangeMedium(::sd::DrawDocShell * pDocShell,SfxViewFrame * pViewFrame,const sal_Int32 eMedium)775cdf0e10cSrcweir void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium )
776cdf0e10cSrcweir {
777cdf0e10cSrcweir     if( !pDocShell )
778cdf0e10cSrcweir         return;
779cdf0e10cSrcweir 
780cdf0e10cSrcweir     SdDrawDocument* pDoc = pDocShell->GetDoc();
781cdf0e10cSrcweir     if( !pDoc )
782cdf0e10cSrcweir         return;
783cdf0e10cSrcweir 
784cdf0e10cSrcweir     // settings for the Outputmedium
785cdf0e10cSrcweir     Size aNewSize;
786cdf0e10cSrcweir     sal_uInt32 nLeft = 0;
787cdf0e10cSrcweir     sal_uInt32 nRight = 0;
788cdf0e10cSrcweir     sal_uInt32 nLower = 0;
789cdf0e10cSrcweir     sal_uInt32 nUpper = 0;
790cdf0e10cSrcweir     switch(eMedium)
791cdf0e10cSrcweir     {
792cdf0e10cSrcweir         case OUTPUT_PAGE:
793cdf0e10cSrcweir         case OUTPUT_OVERHEAD:
794cdf0e10cSrcweir         {
795cdf0e10cSrcweir             SfxPrinter* pPrinter = pDocShell->GetPrinter(sal_True);
796cdf0e10cSrcweir 
797cdf0e10cSrcweir             if( pPrinter && pPrinter->IsValid())
798cdf0e10cSrcweir             {
799cdf0e10cSrcweir                 // Der Printer gibt leider kein exaktes
800*dad2ac5bSMatthias Seidel                 // Format (z.B. A4) zurück
801cdf0e10cSrcweir                 Size aSize(pPrinter->GetPaperSize());
802cdf0e10cSrcweir                 Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, sal_True);
803cdf0e10cSrcweir 
804cdf0e10cSrcweir                 if (ePaper != PAPER_USER)
805cdf0e10cSrcweir                 {
8062155a943Smseidel                     // Get correct size
807cdf0e10cSrcweir                     aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM);
808cdf0e10cSrcweir                 }
809cdf0e10cSrcweir 
810cdf0e10cSrcweir                 if (aSize.Height() > aSize.Width())
811cdf0e10cSrcweir                 {
812*dad2ac5bSMatthias Seidel                      // Always use Landscape
813cdf0e10cSrcweir                      aNewSize.Width()  = aSize.Height();
814cdf0e10cSrcweir                      aNewSize.Height() = aSize.Width();
815cdf0e10cSrcweir                 }
816cdf0e10cSrcweir                 else
817cdf0e10cSrcweir                 {
818cdf0e10cSrcweir                      aNewSize = aSize;
819cdf0e10cSrcweir                 }
820cdf0e10cSrcweir             }
821cdf0e10cSrcweir             else
822cdf0e10cSrcweir             {
823cdf0e10cSrcweir                 aNewSize=Size(29700, 21000);
824cdf0e10cSrcweir             }
825cdf0e10cSrcweir 
826cdf0e10cSrcweir             if (eMedium == OUTPUT_PAGE)
827cdf0e10cSrcweir             {
828cdf0e10cSrcweir                 nLeft =1000;
829cdf0e10cSrcweir                 nRight=1000;
830cdf0e10cSrcweir                 nUpper=1000;
831cdf0e10cSrcweir                 nLower=1000;
832cdf0e10cSrcweir             }
833cdf0e10cSrcweir             else
834cdf0e10cSrcweir             {
835cdf0e10cSrcweir                 nLeft =0;
836cdf0e10cSrcweir                 nRight=0;
837cdf0e10cSrcweir                 nUpper=0;
838cdf0e10cSrcweir                 nLower=0;
839cdf0e10cSrcweir             }
840cdf0e10cSrcweir         }
841cdf0e10cSrcweir         break;
842cdf0e10cSrcweir 
843*dad2ac5bSMatthias Seidel         case OUTPUT_SCREEN_4_BY_3:
844cdf0e10cSrcweir         {
845cdf0e10cSrcweir             aNewSize = Size(28000, 21000);
846cdf0e10cSrcweir             nLeft =0;
847cdf0e10cSrcweir             nRight=0;
848cdf0e10cSrcweir             nUpper=0;
849cdf0e10cSrcweir             nLower=0;
850cdf0e10cSrcweir         }
851cdf0e10cSrcweir         break;
8522155a943Smseidel 
853*dad2ac5bSMatthias Seidel         case OUTPUT_SCREEN_16_BY_9:
8542155a943Smseidel         {
8552155a943Smseidel             aNewSize = Size(28000, 15750);
8562155a943Smseidel             nLeft =0;
8572155a943Smseidel             nRight=0;
8582155a943Smseidel             nUpper=0;
8592155a943Smseidel             nLower=0;
8602155a943Smseidel         }
8612155a943Smseidel         break;
8622155a943Smseidel 
863*dad2ac5bSMatthias Seidel         case OUTPUT_SCREEN_16_BY_10:
8642155a943Smseidel         {
8652155a943Smseidel             aNewSize = Size(28000, 17500);
8662155a943Smseidel             nLeft =0;
8672155a943Smseidel             nRight=0;
8682155a943Smseidel             nUpper=0;
8692155a943Smseidel             nLower=0;
8702155a943Smseidel         }
8712155a943Smseidel         break;
872cdf0e10cSrcweir     }
873cdf0e10cSrcweir 
874cdf0e10cSrcweir     sal_Bool bScaleAll = sal_True;
875cdf0e10cSrcweir     sal_uInt16 nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD);
876cdf0e10cSrcweir     sal_uInt16 i;
877cdf0e10cSrcweir     SdPage* pPage;
878cdf0e10cSrcweir 
879cdf0e10cSrcweir     // master pages first
880cdf0e10cSrcweir     for (i = 0; i < nPageCnt; i++)
881cdf0e10cSrcweir     {
882cdf0e10cSrcweir         pPage = pDoc->GetMasterSdPage(i, PK_STANDARD);
883cdf0e10cSrcweir 
884cdf0e10cSrcweir         if (pPage)
885cdf0e10cSrcweir         {
886cdf0e10cSrcweir             if(eMedium != OUTPUT_ORIGINAL)
887cdf0e10cSrcweir             {
888cdf0e10cSrcweir                 Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
889cdf0e10cSrcweir                 pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
890cdf0e10cSrcweir                 pPage->SetSize(aNewSize);
891cdf0e10cSrcweir                 pPage->SetBorder(nLeft, nUpper, nRight, nLower);
892cdf0e10cSrcweir             }
893cdf0e10cSrcweir             SdPage* pNotesPage = pDoc->GetMasterSdPage(i, PK_NOTES);
894cdf0e10cSrcweir             DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
895cdf0e10cSrcweir             if( pNotesPage ) pNotesPage->CreateTitleAndLayout();
896cdf0e10cSrcweir             pPage->CreateTitleAndLayout();
897cdf0e10cSrcweir         }
898cdf0e10cSrcweir     }
899cdf0e10cSrcweir 
900cdf0e10cSrcweir     nPageCnt = pDoc->GetSdPageCount(PK_STANDARD);
901cdf0e10cSrcweir 
902cdf0e10cSrcweir     // then slides
903cdf0e10cSrcweir     for (i = 0; i < nPageCnt; i++)
904cdf0e10cSrcweir     {
905cdf0e10cSrcweir         pPage = pDoc->GetSdPage(i, PK_STANDARD);
906cdf0e10cSrcweir 
907cdf0e10cSrcweir         if (pPage)
908cdf0e10cSrcweir         {
909cdf0e10cSrcweir             if(eMedium != OUTPUT_ORIGINAL)
910cdf0e10cSrcweir             {
911cdf0e10cSrcweir                 Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
912cdf0e10cSrcweir                 pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
913cdf0e10cSrcweir                 pPage->SetSize(aNewSize);
914cdf0e10cSrcweir                 pPage->SetBorder(nLeft, nUpper, nRight, nLower);
915cdf0e10cSrcweir             }
916cdf0e10cSrcweir             SdPage* pNotesPage = pDoc->GetSdPage(i, PK_NOTES);
917cdf0e10cSrcweir             DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
918cdf0e10cSrcweir             if( pNotesPage ) pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
919cdf0e10cSrcweir             pPage->SetAutoLayout( pPage->GetAutoLayout() );
920cdf0e10cSrcweir         }
921cdf0e10cSrcweir     }
922cdf0e10cSrcweir 
923cdf0e10cSrcweir     SdPage* pHandoutPage = pDoc->GetSdPage(0, PK_HANDOUT);
924cdf0e10cSrcweir     pHandoutPage->CreateTitleAndLayout(sal_True);
925cdf0e10cSrcweir 
926cdf0e10cSrcweir     if( (eMedium != OUTPUT_ORIGINAL) && pViewFrame && pViewFrame->GetDispatcher())
927cdf0e10cSrcweir     {
928cdf0e10cSrcweir         pViewFrame->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
929cdf0e10cSrcweir     }
930cdf0e10cSrcweir }
931cdf0e10cSrcweir 
932cdf0e10cSrcweir 
933cdf0e10cSrcweir 
934cdf0e10cSrcweir 
935cdf0e10cSrcweir //===== OutlineToImpressFinalize ==============================================
936cdf0e10cSrcweir 
937cdf0e10cSrcweir namespace {
938cdf0e10cSrcweir 
OutlineToImpressFinalizer(::sd::ViewShellBase & rBase,SdDrawDocument & rDocument,SvLockBytes & rBytes)939cdf0e10cSrcweir OutlineToImpressFinalizer::OutlineToImpressFinalizer (
940cdf0e10cSrcweir     ::sd::ViewShellBase& rBase,
941cdf0e10cSrcweir     SdDrawDocument& rDocument,
942cdf0e10cSrcweir     SvLockBytes& rBytes)
943cdf0e10cSrcweir     : mrBase(rBase),
944cdf0e10cSrcweir       mrDocument(rDocument),
945cdf0e10cSrcweir       mpStream()
946cdf0e10cSrcweir {
947cdf0e10cSrcweir     // The given stream has a lifetime shorter than this new
948cdf0e10cSrcweir     // OutlineToImpressFinalizer object. Therefore a local copy of the
949cdf0e10cSrcweir     // stream is created.
950cdf0e10cSrcweir     const SvStream* pStream (rBytes.GetStream());
951cdf0e10cSrcweir     if (pStream != NULL)
952cdf0e10cSrcweir     {
953cdf0e10cSrcweir         // Create a memory stream and prepare to fill it with the content of
954cdf0e10cSrcweir         // the original stream.
955cdf0e10cSrcweir         mpStream.reset(new SvMemoryStream());
956cdf0e10cSrcweir         static const sal_Size nBufferSize = 4096;
957cdf0e10cSrcweir         ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]);
958cdf0e10cSrcweir 
959cdf0e10cSrcweir         sal_Size nReadPosition (0);
960cdf0e10cSrcweir         bool bLoop (true);
961cdf0e10cSrcweir         while (bLoop)
962cdf0e10cSrcweir         {
963cdf0e10cSrcweir             // Read the next part of the original stream.
964cdf0e10cSrcweir             sal_Size nReadByteCount (0);
965cdf0e10cSrcweir             const ErrCode nErrorCode (
966cdf0e10cSrcweir                 rBytes.ReadAt(
967cdf0e10cSrcweir                     nReadPosition,
968cdf0e10cSrcweir                     reinterpret_cast<void*>(pBuffer.get()),
969cdf0e10cSrcweir                     nBufferSize,
970cdf0e10cSrcweir                     &nReadByteCount));
971cdf0e10cSrcweir 
972cdf0e10cSrcweir             // Check the error code and stop copying the stream data when an
97386e1cf34SPedro Giffuni             // error has occurred.
974cdf0e10cSrcweir             switch (nErrorCode)
975cdf0e10cSrcweir             {
976cdf0e10cSrcweir                 case ERRCODE_NONE:
977cdf0e10cSrcweir                     if (nReadByteCount == 0)
978cdf0e10cSrcweir                         bLoop = false;
979cdf0e10cSrcweir                     break;
980cdf0e10cSrcweir                 case ERRCODE_IO_PENDING:
981cdf0e10cSrcweir                     break;
982cdf0e10cSrcweir 
983cdf0e10cSrcweir                 default:
984cdf0e10cSrcweir                     bLoop = false;
985cdf0e10cSrcweir                     nReadByteCount = 0;
986cdf0e10cSrcweir                     break;
987cdf0e10cSrcweir             }
988cdf0e10cSrcweir 
989cdf0e10cSrcweir             // Append the read bytes to the end of the memory stream.
990cdf0e10cSrcweir             if (nReadByteCount > 0)
991cdf0e10cSrcweir             {
992cdf0e10cSrcweir                 mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount);
993cdf0e10cSrcweir                 nReadPosition += nReadByteCount;
994cdf0e10cSrcweir             }
995cdf0e10cSrcweir         }
996cdf0e10cSrcweir 
997cdf0e10cSrcweir         // Rewind the memory stream so that in the operator() method its
998cdf0e10cSrcweir         // content is properly read.
999cdf0e10cSrcweir         mpStream->Seek(STREAM_SEEK_TO_BEGIN);
1000cdf0e10cSrcweir     }
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir 
operator ()(bool)1006cdf0e10cSrcweir void OutlineToImpressFinalizer::operator() (bool)
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir     // Fetch the new outline view shell.
1009cdf0e10cSrcweir     ::sd::OutlineViewShell* pOutlineShell
1010cdf0e10cSrcweir         = dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir     if (pOutlineShell != NULL && mpStream.get() != NULL)
1013cdf0e10cSrcweir     {
1014cdf0e10cSrcweir         sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView());
1015cdf0e10cSrcweir         // mba: the stream can't contain any relative URLs, because we don't
1016cdf0e10cSrcweir         // have any information about a BaseURL!
1017cdf0e10cSrcweir         if ( pOutlineShell->Read(*mpStream, String(), EE_FORMAT_RTF) == 0 )
1018cdf0e10cSrcweir         {
1019cdf0e10cSrcweir /*
1020cdf0e10cSrcweir             sd::OutlineViewPageChangesGuard aGuard( pView );
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir             // Remove the first empty pages
1023cdf0e10cSrcweir             sal_uInt16 nPageCount = mrDocument.GetPageCount();
1024cdf0e10cSrcweir             mrDocument.RemovePage( --nPageCount ); // notes page
1025cdf0e10cSrcweir             mrDocument.RemovePage( --nPageCount ); // standard page
1026cdf0e10cSrcweir */
1027cdf0e10cSrcweir         }
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir         // Call UpdatePreview once for every slide to resync the
1030cdf0e10cSrcweir         // document with the outliner of the OutlineViewShell.
1031cdf0e10cSrcweir         sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PK_STANDARD));
1032cdf0e10cSrcweir         for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
1033cdf0e10cSrcweir         {
1034cdf0e10cSrcweir             SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD);
1035cdf0e10cSrcweir             // Make the page the actual page so that the
1036cdf0e10cSrcweir             // following UpdatePreview() call accesses the
1037cdf0e10cSrcweir             // correct paragraphs.
1038cdf0e10cSrcweir             pView->SetActualPage(pPage);
1039cdf0e10cSrcweir             pOutlineShell->UpdatePreview(pPage, true);
1040cdf0e10cSrcweir         }
1041cdf0e10cSrcweir         // Select the first slide.
1042cdf0e10cSrcweir         SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD);
1043cdf0e10cSrcweir         pView->SetActualPage(pPage);
1044cdf0e10cSrcweir         pOutlineShell->UpdatePreview(pPage, true);
1045cdf0e10cSrcweir     }
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir     // #97231# Undo-Stack needs to be cleared, else the user may remove the
1049cdf0e10cSrcweir     // only drawpage and this is a state we cannot handle ATM.
1050cdf0e10cSrcweir     ::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh();
1051cdf0e10cSrcweir     if( pDocShell )
1052cdf0e10cSrcweir         pDocShell->ClearUndoBuffer();
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir } // end of anonymous namespace
10572155a943Smseidel 
10582155a943Smseidel /* vim: set noet sw=4 ts=4: */
1059