Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "DrawDocShell.hxx"
31 : : #include <com/sun/star/document/PrinterIndependentLayout.hpp>
32 : : #include <tools/urlobj.hxx>
33 : : #include <sfx2/progress.hxx>
34 : : #include <vcl/waitobj.hxx>
35 : : #include <svx/svxids.hrc>
36 : : #include <editeng/flstitem.hxx>
37 : : #include <editeng/eeitem.hxx>
38 : : #include <svl/aeitem.hxx>
39 : : #include <svl/flagitem.hxx>
40 : : #include <sot/storage.hxx>
41 : : #include <sfx2/docfile.hxx>
42 : : #include <sfx2/docfilt.hxx>
43 : : #include <sfx2/dispatch.hxx>
44 : : #include <svx/svdotext.hxx>
45 : : #include <svl/style.hxx>
46 : : #include <sfx2/printer.hxx>
47 : : #include <svtools/ctrltool.hxx>
48 : : #include <svtools/sfxecode.hxx>
49 : : #include <sot/clsids.hxx>
50 : : #include <sot/formats.hxx>
51 : : #include <sfx2/request.hxx>
52 : : #include <unotools/fltrcfg.hxx>
53 : : #include <sfx2/frame.hxx>
54 : : #include <sfx2/viewfrm.hxx>
55 : : #include <unotools/saveopt.hxx>
56 : : #include <com/sun/star/drawing/XDrawPage.hpp>
57 : : #include <com/sun/star/drawing/XDrawView.hpp>
58 : : #include <comphelper/processfactory.hxx>
59 : :
60 : : #include "app.hrc"
61 : : #include "glob.hrc"
62 : : #include "strings.hrc"
63 : : #include "strmname.h"
64 : : #include "FrameView.hxx"
65 : : #include "optsitem.hxx"
66 : : #include "Outliner.hxx"
67 : : #include "sdattr.hxx"
68 : : #include "drawdoc.hxx"
69 : : #include "ViewShell.hxx"
70 : : #include "app.hxx"
71 : : #include "View.hxx"
72 : : #include "sdpage.hxx"
73 : : #include "sdresid.hxx"
74 : : #include "DrawViewShell.hxx"
75 : : #include "ViewShellBase.hxx"
76 : : #include "Window.hxx"
77 : : #include "sdmod.hxx"
78 : : #include "OutlineViewShell.hxx"
79 : : #include "sdxmlwrp.hxx"
80 : : #include "sdpptwrp.hxx"
81 : : #include "sdcgmfilter.hxx"
82 : : #include "sdgrffilter.hxx"
83 : : #include "sdhtmlfilter.hxx"
84 : : #include "framework/FrameworkHelper.hxx"
85 : :
86 : : using namespace ::com::sun::star;
87 : : using namespace ::com::sun::star::uno;
88 : : using ::sd::framework::FrameworkHelper;
89 : :
90 : :
91 : : namespace sd {
92 : :
93 : : /*************************************************************************
94 : : |*
95 : : |* SfxPrinter ggf. erzeugen und zurueckgeben
96 : : |*
97 : : \************************************************************************/
98 : :
99 : 1421 : SfxPrinter* DrawDocShell::GetPrinter(sal_Bool bCreate)
100 : : {
101 [ - + ][ # # ]: 1421 : if (bCreate && !mpPrinter)
102 : : {
103 : : // ItemSet mit speziellem Poolbereich anlegen
104 : 0 : SfxItemSet* pSet = new SfxItemSet( GetPool(),
105 : : SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
106 : : SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
107 : : ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
108 [ # # ][ # # ]: 0 : 0 );
109 : : // PrintOptionsSet setzen
110 : : SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT,
111 [ # # ][ # # ]: 0 : SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()));
[ # # ]
112 [ # # ]: 0 : SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC );
113 : 0 : sal_uInt16 nFlags = 0;
114 : :
115 [ # # ]: 0 : nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) |
116 [ # # ][ # # ]: 0 : (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0);
[ # # ]
117 : 0 : aFlagItem.SetValue( nFlags );
118 : :
119 [ # # ]: 0 : pSet->Put( aPrintItem );
120 [ # # ][ # # ]: 0 : pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) );
[ # # ][ # # ]
121 [ # # ]: 0 : pSet->Put( aFlagItem );
122 : :
123 [ # # ][ # # ]: 0 : mpPrinter = new SfxPrinter(pSet);
124 : 0 : mbOwnPrinter = sal_True;
125 : :
126 : : // Ausgabequalitaet setzen
127 [ # # ]: 0 : sal_uInt16 nQuality = aPrintItem.GetOptionsPrint().GetOutputQuality();
128 : :
129 : 0 : sal_uLong nMode = DRAWMODE_DEFAULT;
130 : :
131 [ # # ]: 0 : if( nQuality == 1 )
132 : 0 : nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT;
133 [ # # ]: 0 : else if( nQuality == 2 )
134 : 0 : nMode = DRAWMODE_BLACKLINE | DRAWMODE_WHITEFILL | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT;
135 : :
136 [ # # ]: 0 : mpPrinter->SetDrawMode( nMode );
137 : :
138 [ # # ]: 0 : MapMode aMM (mpPrinter->GetMapMode());
139 [ # # ]: 0 : aMM.SetMapUnit(MAP_100TH_MM);
140 [ # # ]: 0 : mpPrinter->SetMapMode(aMM);
141 [ # # ][ # # ]: 0 : UpdateRefDevice();
[ # # ][ # # ]
142 : : }
143 : 1421 : return mpPrinter;
144 : : }
145 : :
146 : : /*************************************************************************
147 : : |*
148 : : |* neuen SfxPrinter setzen (Eigentuemeruebergang)
149 : : |*
150 : : \************************************************************************/
151 : :
152 : 3 : void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter)
153 : : {
154 [ - + ]: 3 : if ( mpViewShell )
155 : : {
156 : 0 : ::sd::View* pView = mpViewShell->GetView();
157 [ # # ]: 0 : if ( pView->IsTextEdit() )
158 : 0 : pView->SdrEndTextEdit();
159 : : }
160 : :
161 [ - + ][ # # ]: 3 : if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) )
[ # # ]
162 : : {
163 [ # # ]: 0 : delete mpPrinter;
164 : : }
165 : :
166 : 3 : mpPrinter = pNewPrinter;
167 : 3 : mbOwnPrinter = sal_True;
168 [ - + ]: 3 : if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED )
169 : 0 : UpdateFontList();
170 : 3 : UpdateRefDevice();
171 : 3 : }
172 : :
173 : 183 : void DrawDocShell::UpdateFontList()
174 : : {
175 [ + + ][ + - ]: 183 : delete mpFontList;
176 : 183 : OutputDevice* pRefDevice = NULL;
177 [ + - ][ - + ]: 183 : if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED )
178 [ # # ]: 0 : pRefDevice = GetPrinter(sal_True);
179 : : else
180 [ + - ][ + - ]: 183 : pRefDevice = SD_MOD()->GetVirtualRefDevice();
181 [ + - ][ + - ]: 183 : mpFontList = new FontList( pRefDevice, NULL, sal_False );
182 [ + - ]: 183 : SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST );
183 [ + - ][ + - ]: 183 : PutItem( aFontListItem );
184 : 183 : }
185 : :
186 : 0 : Printer* DrawDocShell::GetDocumentPrinter()
187 : : {
188 : 0 : return GetPrinter(sal_False);
189 : : }
190 : :
191 : 0 : void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter)
192 : : {
193 : : // if we already have a printer, see if its the same
194 [ # # ]: 0 : if( mpPrinter )
195 : : {
196 : : // easy case
197 [ # # ]: 0 : if( mpPrinter == pNewPrinter )
198 : 0 : return;
199 : :
200 : : // compare if its the same printer with the same job setup
201 [ # # # # ]: 0 : if( (mpPrinter->GetName() == pNewPrinter->GetName()) &&
[ # # ]
202 : 0 : (mpPrinter->GetJobSetup() == pNewPrinter->GetJobSetup()))
203 : 0 : return;
204 : : }
205 : :
206 : : // if (mpPrinter->IsA(SfxPrinter))
207 : : {
208 : : // Da kein RTTI verfuegbar, wird hart gecasted (...)
209 : 0 : SetPrinter((SfxPrinter*) pNewPrinter);
210 : :
211 : : // Printer gehoert dem Container
212 : 0 : mbOwnPrinter = sal_False;
213 : : }
214 : : }
215 : :
216 : 358 : void DrawDocShell::UpdateRefDevice()
217 : : {
218 [ + + ]: 358 : if( mpDoc )
219 : : {
220 : : // Determine the device for which the output will be formatted.
221 : 186 : OutputDevice* pRefDevice = NULL;
222 [ - + - ]: 186 : switch (mpDoc->GetPrinterIndependentLayout())
223 : : {
224 : : case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
225 : 0 : pRefDevice = mpPrinter;
226 : 0 : break;
227 : :
228 : : case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
229 : 186 : pRefDevice = SD_MOD()->GetVirtualRefDevice();
230 : 186 : break;
231 : :
232 : : default:
233 : : // We are confronted with an invalid or un-implemented
234 : : // layout mode. Use the printer as formatting device
235 : : // as a fall-back.
236 : : DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode");
237 : :
238 : 0 : pRefDevice = mpPrinter;
239 : 0 : break;
240 : : }
241 : 186 : mpDoc->SetRefDevice( pRefDevice );
242 : :
243 : 186 : ::sd::Outliner* pOutl = mpDoc->GetOutliner( sal_False );
244 : :
245 [ - + ]: 186 : if( pOutl )
246 : 0 : pOutl->SetRefDevice( pRefDevice );
247 : :
248 : 186 : ::sd::Outliner* pInternalOutl = mpDoc->GetInternalOutliner( sal_False );
249 : :
250 [ + + ]: 186 : if( pInternalOutl )
251 : 14 : pInternalOutl->SetRefDevice( pRefDevice );
252 : : }
253 : 358 : }
254 : :
255 : : /*************************************************************************
256 : : |*
257 : : |* InitNew, (Dokument wird neu erzeugt): Streams oeffnen
258 : : |*
259 : : \************************************************************************/
260 : :
261 : 146 : sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
262 : : {
263 : 146 : sal_Bool bRet = sal_False;
264 : :
265 [ + - ]: 146 : bRet = SfxObjectShell::InitNew( xStorage );
266 : :
267 [ + - ]: 146 : Rectangle aVisArea( Point(0, 0), Size(14100, 10000) );
268 [ + - ]: 146 : SetVisArea(aVisArea);
269 : :
270 [ + - ]: 146 : if (bRet)
271 : : {
272 [ + - ]: 146 : mpDoc->SetDrawingLayerPoolDefaults();
273 [ + - ]: 146 : if( !mbSdDataObj )
274 [ + - ]: 146 : mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling
275 : : // NewOrLoadCompleted(NEW_LOADED) in
276 : : // SdDrawDocument::AllocModel()
277 : : }
278 : 146 : return bRet;
279 : : }
280 : :
281 : : /*************************************************************************
282 : : |*
283 : : |* Load: Pools und Dokument laden
284 : : |*
285 : : \************************************************************************/
286 : :
287 : 11 : sal_Bool DrawDocShell::Load( SfxMedium& rMedium )
288 : : {
289 : 11 : mbNewDocument = sal_False;
290 : :
291 : 11 : sal_Bool bRet = sal_False;
292 : 11 : bool bStartPresentation = false;
293 : 11 : ErrCode nError = ERRCODE_NONE;
294 : :
295 [ + - ]: 11 : SfxItemSet* pSet = rMedium.GetItemSet();
296 : :
297 : :
298 [ + - ]: 11 : if( pSet )
299 : : {
300 [ + - ][ - + ]: 11 : if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() )
[ # # ][ # # ]
[ - + ]
301 : : {
302 [ # # ]: 0 : mpDoc->SetStarDrawPreviewMode( sal_True );
303 : : }
304 : :
305 [ + - ]: 11 : if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
[ - + # # ]
[ - + ]
306 [ # # ]: 0 : ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
307 : : {
308 : 0 : bStartPresentation = true;
309 [ # # ]: 0 : mpDoc->SetStartWithPresentation( true );
310 : : }
311 : : }
312 : :
313 [ + - ]: 11 : bRet = SfxObjectShell::Load( rMedium );
314 [ + - ]: 11 : if( bRet )
315 : : {
316 [ + - ][ + - ]: 11 : bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError );
[ + - ][ + - ]
[ + - ]
317 : : }
318 : :
319 [ + - ]: 11 : if( bRet )
320 : : {
321 [ + - ]: 11 : UpdateTablePointers();
322 : :
323 : : // If we're an embedded OLE object, use tight bounds
324 : : // for our visArea. No point in showing the user lots of empty
325 : : // space. Had to remove the check for empty VisArea below,
326 : : // since XML load always sets a VisArea before.
327 : : //TODO/LATER: looks a little bit strange!
328 [ + + ][ + - ]: 11 : if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxObjectShell::GetVisArea( ASPECT_CONTENT ).IsEmpty() )
[ + - ][ - + ]
[ + + ]
[ - + # # ]
329 : : {
330 [ # # ]: 0 : SdPage* pPage = mpDoc->GetSdPage( 0, PK_STANDARD );
331 : :
332 [ # # ]: 0 : if( pPage )
333 [ # # ][ # # ]: 0 : SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) );
334 : : }
335 : :
336 [ + - ]: 11 : FinishedLoading( SFX_LOADED_ALL );
337 : :
338 [ + - ]: 11 : const INetURLObject aUrl;
339 [ + - ][ + - ]: 11 : SfxObjectShell::SetAutoLoad( aUrl, 0, sal_False );
340 : : }
341 : : else
342 : : {
343 [ # # ]: 0 : if( nError == ERRCODE_IO_BROKENPACKAGE )
344 [ # # ]: 0 : SetError( ERRCODE_IO_BROKENPACKAGE, OSL_LOG_PREFIX );
345 : :
346 : : // TODO/LATER: correct error handling?!
347 : : //pStore->SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
348 : : else
349 [ # # ]: 0 : SetError( ERRCODE_ABORT, OSL_LOG_PREFIX );
350 : : }
351 : :
352 : : // tell SFX to change viewshell when in preview mode
353 [ + - ][ + - ]: 11 : if( IsPreview() || bStartPresentation )
[ - + ][ - + ]
354 : : {
355 [ # # ]: 0 : SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
356 [ # # ]: 0 : if( pMediumSet )
357 [ # # ][ # # ]: 0 : pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
[ # # ][ # # ]
358 : : }
359 : :
360 : 11 : return bRet;
361 : : }
362 : :
363 : : /*************************************************************************
364 : : |*
365 : : |* LoadFrom: Inhalte fuer Organizer laden
366 : : |*
367 : : \************************************************************************/
368 : :
369 : 0 : sal_Bool DrawDocShell::LoadFrom( SfxMedium& rMedium )
370 : : {
371 : 0 : mbNewDocument = sal_False;
372 : :
373 : 0 : WaitObject* pWait = NULL;
374 [ # # ]: 0 : if( mpViewShell )
375 [ # # ][ # # ]: 0 : pWait = new WaitObject( (Window*) mpViewShell->GetActiveWindow() );
[ # # ]
376 : :
377 : 0 : sal_Bool bRet = sal_False;
378 : :
379 [ # # ]: 0 : mpDoc->NewOrLoadCompleted( NEW_DOC );
380 [ # # ]: 0 : mpDoc->CreateFirstPages();
381 [ # # ]: 0 : mpDoc->StopWorkStartupDelay();
382 : :
383 : : // TODO/LATER: nobody is interested in the error code?!
384 : 0 : ErrCode nError = ERRCODE_NONE;
385 [ # # ][ # # ]: 0 : bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Organizer, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError );
[ # # ][ # # ]
[ # # ]
386 : :
387 : :
388 : : // tell SFX to change viewshell when in preview mode
389 [ # # ][ # # ]: 0 : if( IsPreview() )
390 : : {
391 [ # # ]: 0 : SfxItemSet *pSet = GetMedium()->GetItemSet();
392 : :
393 [ # # ]: 0 : if( pSet )
394 [ # # ][ # # ]: 0 : pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
[ # # ]
395 : : }
396 : :
397 [ # # ][ # # ]: 0 : delete pWait;
398 : :
399 : 0 : return bRet;
400 : : }
401 : :
402 : : /*************************************************************************
403 : : |*
404 : : |* ImportFrom: load from 3rd party format
405 : : |*
406 : : \************************************************************************/
407 : :
408 : 9 : sal_Bool DrawDocShell::ImportFrom( SfxMedium &rMedium, bool bInsert )
409 : : {
410 : 9 : const sal_Bool bRet=SfxObjectShell::ImportFrom(rMedium, bInsert);
411 : :
412 : 9 : SfxItemSet* pSet = rMedium.GetItemSet();
413 [ + - ]: 9 : if( pSet )
414 : : {
415 [ - + # # ]: 9 : if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
[ - + ]
416 : 0 : ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
417 : : {
418 : 0 : mpDoc->SetStartWithPresentation( true );
419 : :
420 : : // tell SFX to change viewshell when in preview mode
421 [ # # ]: 0 : if( IsPreview() )
422 : : {
423 : 0 : SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
424 [ # # ]: 0 : if( pMediumSet )
425 [ # # ]: 0 : pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 1 ) );
426 : : }
427 : : }
428 : : }
429 : :
430 : 9 : return bRet;
431 : : }
432 : :
433 : : /*************************************************************************
434 : : |*
435 : : |* ConvertFrom: aus Fremdformat laden
436 : : |*
437 : : \************************************************************************/
438 : :
439 : 15 : sal_Bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
440 : : {
441 : 15 : mbNewDocument = sal_False;
442 : :
443 [ + - ][ + - ]: 15 : const rtl::OUString aFilterName( rMedium.GetFilter()->GetFilterName() );
444 : 15 : sal_Bool bRet = sal_False;
445 : 15 : bool bStartPresentation = false;
446 : :
447 [ + - ]: 15 : SetWaitCursor( sal_True );
448 : :
449 [ + - ]: 15 : SfxItemSet* pSet = rMedium.GetItemSet();
450 [ + - ]: 15 : if( pSet )
451 : : {
452 [ + - ][ - + ]: 15 : if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() )
[ # # ][ # # ]
[ - + ]
453 : : {
454 [ # # ]: 0 : mpDoc->SetStarDrawPreviewMode( sal_True );
455 : : }
456 : :
457 [ + - ]: 15 : if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&&
[ - + # # ]
[ - + ]
458 [ # # ]: 0 : ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() )
459 : : {
460 : 0 : bStartPresentation = true;
461 [ # # ]: 0 : mpDoc->SetStartWithPresentation( true );
462 : : }
463 : : }
464 : :
465 [ - + # # : 15 : if( aFilterName == pFilterPowerPoint97
# # ][ + - ]
466 : 0 : || aFilterName == pFilterPowerPoint97Template
467 : 0 : || aFilterName == pFilterPowerPoint97AutoPlay)
468 : : {
469 [ + - ]: 15 : mpDoc->StopWorkStartupDelay();
470 [ + - ][ + - ]: 15 : bRet = SdPPTFilter( rMedium, *this, sal_True ).Import();
[ + - ]
471 : : }
472 [ # # # # ]: 0 : else if (aFilterName.indexOf("impress8") >= 0 ||
[ # # ]
473 : 0 : aFilterName.indexOf("draw8") >= 0)
474 : : {
475 : : // TODO/LATER: nobody is interested in the error code?!
476 [ # # ]: 0 : mpDoc->CreateFirstPages();
477 [ # # ]: 0 : mpDoc->StopWorkStartupDelay();
478 : 0 : ErrCode nError = ERRCODE_NONE;
479 [ # # ][ # # ]: 0 : bRet = SdXMLFilter( rMedium, *this, sal_True ).Import( nError );
[ # # ]
480 : :
481 : : }
482 [ # # # # ]: 0 : else if (aFilterName.indexOf("StarOffice XML (Draw)") >= 0 ||
[ # # ]
483 : 0 : aFilterName.indexOf("StarOffice XML (Impress)") >= 0)
484 : : {
485 : : // TODO/LATER: nobody is interested in the error code?!
486 [ # # ]: 0 : mpDoc->CreateFirstPages();
487 [ # # ]: 0 : mpDoc->StopWorkStartupDelay();
488 : 0 : ErrCode nError = ERRCODE_NONE;
489 [ # # ][ # # ]: 0 : bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ).Import( nError );
[ # # ]
490 : : }
491 [ # # ]: 0 : else if( aFilterName.equals( "CGM - Computer Graphics Metafile" ) )
492 : : {
493 [ # # ]: 0 : mpDoc->CreateFirstPages();
494 [ # # ]: 0 : mpDoc->StopWorkStartupDelay();
495 [ # # ][ # # ]: 0 : bRet = SdCGMFilter( rMedium, *this, sal_True ).Import();
[ # # ]
496 : : }
497 : : else
498 : : {
499 [ # # ]: 0 : mpDoc->CreateFirstPages();
500 [ # # ]: 0 : mpDoc->StopWorkStartupDelay();
501 [ # # ][ # # ]: 0 : bRet = SdGRFFilter( rMedium, *this ).Import();
[ # # ]
502 : : }
503 : :
504 [ + - ]: 15 : FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
505 : :
506 : : // tell SFX to change viewshell when in preview mode
507 [ + - ][ - + ]: 15 : if( IsPreview() )
508 : : {
509 [ # # ]: 0 : SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
510 : :
511 [ # # ]: 0 : if( pMediumSet )
512 [ # # ][ # # ]: 0 : pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) );
[ # # ]
513 : : }
514 [ + - ]: 15 : SetWaitCursor( sal_False );
515 : :
516 : : // tell SFX to change viewshell when in preview mode
517 [ + - ][ + - ]: 15 : if( IsPreview() || bStartPresentation )
[ - + ][ - + ]
518 : : {
519 [ # # ]: 0 : SfxItemSet *pMediumSet = GetMedium()->GetItemSet();
520 [ # # ]: 0 : if( pMediumSet )
521 [ # # ][ # # ]: 0 : pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) );
[ # # ][ # # ]
522 : : }
523 : :
524 : 15 : return bRet;
525 : : }
526 : :
527 : : /*************************************************************************
528 : : |*
529 : : |* Save: Pools und Dokument in die offenen Streams schreiben
530 : : |*
531 : : \************************************************************************/
532 : :
533 : 0 : sal_Bool DrawDocShell::Save()
534 : : {
535 : 0 : mpDoc->StopWorkStartupDelay();
536 : :
537 : : //TODO/LATER: why this?!
538 [ # # ]: 0 : if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
539 [ # # ]: 0 : SfxObjectShell::SetVisArea( Rectangle() );
540 : :
541 : 0 : sal_Bool bRet = SfxObjectShell::Save();
542 : :
543 [ # # ]: 0 : if( bRet )
544 : : {
545 : : // Call UpdateDocInfoForSave() before export
546 : 0 : UpdateDocInfoForSave();
547 : :
548 [ # # ][ # # ]: 0 : bRet = SdXMLFilter( *GetMedium(), *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( GetMedium()->GetStorage() ) ).Export();
[ # # ][ # # ]
549 : : }
550 : :
551 : 0 : return bRet;
552 : : }
553 : :
554 : : /*************************************************************************
555 : : |*
556 : : |* SaveAs: Pools und Dokument in den angegebenen Storage sichern
557 : : |*
558 : : \************************************************************************/
559 : :
560 : 8 : sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium )
561 : : {
562 : 8 : mpDoc->StopWorkStartupDelay();
563 : :
564 : : //TODO/LATER: why this?!
565 [ + - ]: 8 : if( GetCreateMode() == SFX_CREATE_MODE_STANDARD )
566 [ + - ]: 8 : SfxObjectShell::SetVisArea( Rectangle() );
567 : :
568 : 8 : sal_uInt32 nVBWarning = ERRCODE_NONE;
569 : 8 : sal_Bool bRet = SfxObjectShell::SaveAs( rMedium );
570 : :
571 [ + - ]: 8 : if( bRet )
572 : : {
573 : : // Call UpdateDocInfoForSave() before export
574 : 8 : UpdateDocInfoForSave();
575 [ + - ][ + - ]: 8 : bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Export();
[ + - ][ + - ]
576 : : }
577 : :
578 [ + - ]: 8 : if( GetError() == ERRCODE_NONE )
579 [ + - ]: 8 : SetError( nVBWarning, OSL_LOG_PREFIX );
580 : :
581 : 8 : return bRet;
582 : : }
583 : :
584 : : /*************************************************************************
585 : : |*
586 : : |* ConvertTo: im Fremdformat speichern
587 : : |*
588 : : \************************************************************************/
589 : :
590 : 0 : sal_Bool DrawDocShell::ConvertTo( SfxMedium& rMedium )
591 : : {
592 : 0 : sal_Bool bRet = sal_False;
593 : :
594 [ # # ]: 0 : if( mpDoc->GetPageCount() )
595 : : {
596 [ # # ]: 0 : const SfxFilter* pMediumFilter = rMedium.GetFilter();
597 [ # # ]: 0 : const rtl::OUString aTypeName( pMediumFilter->GetTypeName() );
598 : 0 : SdFilter* pFilter = NULL;
599 : :
600 [ # # ]: 0 : if( aTypeName.indexOf( "graphic_HTML" ) >= 0 )
601 : : {
602 [ # # ][ # # ]: 0 : pFilter = new SdHTMLFilter( rMedium, *this, sal_True );
603 : : }
604 [ # # ]: 0 : else if( aTypeName.indexOf( "MS_PowerPoint_97" ) >= 0 )
605 : : {
606 [ # # ][ # # ]: 0 : pFilter = new SdPPTFilter( rMedium, *this, sal_True );
607 [ # # ]: 0 : ((SdPPTFilter*)pFilter)->PreSaveBasic();
608 : : }
609 [ # # ]: 0 : else if ( aTypeName.indexOf( "CGM_Computer_Graphics_Metafile" ) >= 0 )
610 : : {
611 [ # # ][ # # ]: 0 : pFilter = new SdCGMFilter( rMedium, *this, sal_True );
612 : : }
613 [ # # # # ]: 0 : else if( aTypeName.indexOf( "draw8" ) >= 0 ||
[ # # ]
614 : 0 : aTypeName.indexOf( "impress8" ) >= 0 )
615 : : {
616 [ # # ][ # # ]: 0 : pFilter = new SdXMLFilter( rMedium, *this, sal_True );
617 [ # # ]: 0 : UpdateDocInfoForSave();
618 : : }
619 [ # # # # ]: 0 : else if( aTypeName.indexOf( "StarOffice_XML_Impress" ) >= 0 ||
[ # # ]
620 : 0 : aTypeName.indexOf( "StarOffice_XML_Draw" ) >= 0 )
621 : : {
622 [ # # ][ # # ]: 0 : pFilter = new SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 );
623 [ # # ]: 0 : UpdateDocInfoForSave();
624 : : }
625 : : else
626 : : {
627 [ # # ][ # # ]: 0 : pFilter = new SdGRFFilter( rMedium, *this );
628 : : }
629 : :
630 [ # # ]: 0 : if( pFilter )
631 : : {
632 : 0 : const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode();
633 : :
634 : 0 : mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
635 : :
636 [ # # ]: 0 : bRet = pFilter->Export();
637 [ # # ]: 0 : if( !bRet )
638 : 0 : mpDoc->SetSwapGraphicsMode( nOldSwapMode );
639 : :
640 [ # # ][ # # ]: 0 : delete pFilter;
641 : 0 : }
642 : : }
643 : :
644 : 0 : return bRet;
645 : : }
646 : :
647 : : /*************************************************************************
648 : : |*
649 : : |* SaveCompleted: die eigenen Streams wieder oeffnen, damit kein anderer
650 : : |* sie "besetzt"
651 : : |*
652 : : \************************************************************************/
653 : :
654 : 8 : sal_Bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
655 : : {
656 : 8 : sal_Bool bRet = sal_False;
657 : :
658 [ + - ]: 8 : if( SfxObjectShell::SaveCompleted(xStorage) )
659 : : {
660 : 8 : mpDoc->NbcSetChanged( sal_False );
661 : :
662 [ + - ]: 8 : if( mpViewShell )
663 : : {
664 [ - + ]: 8 : if( mpViewShell->ISA( OutlineViewShell ) )
665 : 0 : static_cast<OutlineView*>(mpViewShell->GetView())
666 : 0 : ->GetOutliner()->ClearModifyFlag();
667 : :
668 : 8 : SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner();
669 [ - + ]: 8 : if( pOutl )
670 : : {
671 : 0 : SdrObject* pObj = mpViewShell->GetView()->GetTextEditObject();
672 [ # # ]: 0 : if( pObj )
673 : 0 : pObj->NbcSetOutlinerParaObject( pOutl->CreateParaObject() );
674 : :
675 : 0 : pOutl->ClearModifyFlag();
676 : : }
677 : : }
678 : :
679 : 8 : bRet = sal_True;
680 : :
681 : 8 : SfxViewFrame* pFrame = ( mpViewShell && mpViewShell->GetViewFrame() ) ?
682 : 8 : mpViewShell->GetViewFrame() :
683 [ + - + - ]: 16 : SfxViewFrame::Current();
684 : :
685 [ + - ]: 8 : if( pFrame )
686 : 8 : pFrame->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
687 : : }
688 : 8 : return bRet;
689 : : }
690 : :
691 : : /*************************************************************************
692 : : |*
693 : : |* Referenz auf Dokument
694 : : |*
695 : : \************************************************************************/
696 : :
697 : 4464 : SdDrawDocument* DrawDocShell::GetDoc()
698 : : {
699 : 4464 : return mpDoc;
700 : : }
701 : :
702 : : /*************************************************************************
703 : : |*
704 : : |* Referenz auf Dokument
705 : : |*
706 : : \************************************************************************/
707 : :
708 : 11 : SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool()
709 : : {
710 : 11 : return( (SfxStyleSheetBasePool*) mpDoc->GetStyleSheetPool() );
711 : : }
712 : :
713 : : /*************************************************************************
714 : : |*
715 : : |* Sprung zu Bookmark
716 : : |*
717 : : \************************************************************************/
718 : :
719 : 0 : sal_Bool DrawDocShell::GotoBookmark(const String& rBookmark)
720 : : {
721 : 0 : sal_Bool bFound = sal_False;
722 : :
723 [ # # ][ # # ]: 0 : if (mpViewShell && mpViewShell->ISA(DrawViewShell))
[ # # ]
724 : : {
725 : 0 : DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
726 [ # # ]: 0 : ViewShellBase& rBase (mpViewShell->GetViewShellBase());
727 : :
728 : 0 : sal_Bool bIsMasterPage = sal_False;
729 : 0 : sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND;
730 : 0 : SdrObject* pObj = NULL;
731 : :
732 [ # # ]: 0 : rtl::OUString sBookmark( rBookmark );
733 : 0 : const rtl::OUString sInteraction( "action?" );
734 [ # # ]: 0 : if ( sBookmark.match( sInteraction ) )
735 : : {
736 : 0 : const rtl::OUString sJump( "jump=" );
737 [ # # ]: 0 : if ( sBookmark.match( sJump, sInteraction.getLength() ) )
738 : : {
739 : 0 : rtl::OUString aDestination( sBookmark.copy( sInteraction.getLength() + sJump.getLength() ) );
740 [ # # ]: 0 : if ( aDestination.match( "firstslide" ) )
741 : : {
742 : 0 : nPageNumber = 1;
743 : : }
744 [ # # ]: 0 : else if ( aDestination.match( "lastslide" ) )
745 : : {
746 [ # # ]: 0 : nPageNumber = mpDoc->GetPageCount() - 2;
747 : : }
748 [ # # ]: 0 : else if ( aDestination.match( "previousslide" ) )
749 : : {
750 [ # # ]: 0 : SdPage* pPage = pDrawViewShell->GetActualPage();
751 [ # # ]: 0 : nPageNumber = pPage->GetPageNum();
752 [ # # ]: 0 : nPageNumber = nPageNumber > 2 ? nPageNumber - 2 : SDRPAGE_NOTFOUND;
753 : : }
754 [ # # ]: 0 : else if ( aDestination.match( "nextslide" ) )
755 : : {
756 [ # # ]: 0 : SdPage* pPage = pDrawViewShell->GetActualPage();
757 [ # # ]: 0 : nPageNumber = pPage->GetPageNum() + 2;
758 [ # # ][ # # ]: 0 : if ( nPageNumber >= mpDoc->GetPageCount() )
759 : 0 : nPageNumber = SDRPAGE_NOTFOUND;
760 : 0 : }
761 : 0 : }
762 : : }
763 : : else
764 : : {
765 [ # # ]: 0 : String aBookmark( rBookmark );
766 : :
767 : : // Ist das Bookmark eine Seite?
768 [ # # ]: 0 : nPageNumber = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
769 : :
770 [ # # ]: 0 : if (nPageNumber == SDRPAGE_NOTFOUND)
771 : : {
772 : : // Ist das Bookmark ein Objekt?
773 [ # # ]: 0 : pObj = mpDoc->GetObj(aBookmark);
774 : :
775 [ # # ]: 0 : if (pObj)
776 : : {
777 [ # # ][ # # ]: 0 : nPageNumber = pObj->GetPage()->GetPageNum();
778 : : }
779 [ # # ]: 0 : }
780 : : }
781 [ # # ]: 0 : if (nPageNumber != SDRPAGE_NOTFOUND)
782 : : {
783 : : // Jump to the bookmarked page. This is done in three steps.
784 : :
785 : 0 : bFound = sal_True;
786 : : SdPage* pPage;
787 [ # # ]: 0 : if (bIsMasterPage)
788 [ # # ]: 0 : pPage = (SdPage*) mpDoc->GetMasterPage(nPageNumber);
789 : : else
790 [ # # ]: 0 : pPage = (SdPage*) mpDoc->GetPage(nPageNumber);
791 : :
792 : : // 1.) Change the view shell to the edit view, the notes view,
793 : : // or the handout view.
794 : 0 : PageKind eNewPageKind = pPage->GetPageKind();
795 : :
796 [ # # ][ # # ]: 0 : if( (eNewPageKind != PK_STANDARD) && (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
[ # # ]
797 : 0 : return sal_False;
798 : :
799 [ # # ]: 0 : if (eNewPageKind != pDrawViewShell->GetPageKind())
800 : : {
801 : : // Arbeitsbereich wechseln
802 [ # # ]: 0 : GetFrameView()->SetPageKind(eNewPageKind);
803 : 0 : ::rtl::OUString sViewURL;
804 [ # # # # ]: 0 : switch (eNewPageKind)
805 : : {
806 : : case PK_STANDARD:
807 : 0 : sViewURL = FrameworkHelper::msImpressViewURL;
808 : 0 : break;
809 : : case PK_NOTES:
810 : 0 : sViewURL = FrameworkHelper::msNotesViewURL;
811 : 0 : break;
812 : : case PK_HANDOUT:
813 : 0 : sViewURL = FrameworkHelper::msHandoutViewURL;
814 : 0 : break;
815 : : default:
816 : 0 : break;
817 : : }
818 [ # # ]: 0 : if (!sViewURL.isEmpty())
819 : : {
820 : : ::boost::shared_ptr<FrameworkHelper> pHelper (
821 [ # # ]: 0 : FrameworkHelper::Instance(rBase));
822 : : pHelper->RequestView(
823 : : sViewURL,
824 [ # # ]: 0 : FrameworkHelper::msCenterPaneURL);
825 [ # # ]: 0 : pHelper->WaitForUpdate();
826 : :
827 : : // Get the new DrawViewShell.
828 [ # # ][ # # ]: 0 : mpViewShell = pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
829 [ # # ][ # # ]: 0 : pDrawViewShell = dynamic_cast<sd::DrawViewShell*>(mpViewShell);
830 : : }
831 : : else
832 : : {
833 : 0 : pDrawViewShell = NULL;
834 : 0 : }
835 : : }
836 : :
837 [ # # ]: 0 : if (pDrawViewShell != NULL)
838 : : {
839 : : // Set the edit mode to either the normal edit mode or the
840 : : // master page mode.
841 : 0 : EditMode eNewEditMode = EM_PAGE;
842 [ # # ]: 0 : if (bIsMasterPage)
843 : : {
844 : 0 : eNewEditMode = EM_MASTERPAGE;
845 : : }
846 : :
847 [ # # ]: 0 : if (eNewEditMode != pDrawViewShell->GetEditMode())
848 : : {
849 : : // EditMode setzen
850 [ # # ]: 0 : pDrawViewShell->ChangeEditMode(eNewEditMode, sal_False);
851 : : }
852 : :
853 : : // Make the bookmarked page the current page. This is done
854 : : // by using the API because this takes care of all the
855 : : // little things to be done. Especially writing the view
856 : : // data to the frame view.
857 : 0 : sal_uInt16 nSdPgNum = (nPageNumber - 1) / 2;
858 [ # # ][ # # ]: 0 : Reference<drawing::XDrawView> xController (rBase.GetController(), UNO_QUERY);
859 [ # # ]: 0 : if (xController.is())
860 : : {
861 [ # # ][ # # ]: 0 : Reference<drawing::XDrawPage> xDrawPage (pPage->getUnoPage(), UNO_QUERY);
862 [ # # ][ # # ]: 0 : xController->setCurrentPage (xDrawPage);
863 : : }
864 : : else
865 : : {
866 : : // As a fall back switch to the page via the core.
867 : : DBG_ASSERT (xController.is(),
868 : : "DrawDocShell::GotoBookmark: can't switch page via API");
869 [ # # ]: 0 : pDrawViewShell->SwitchPage(nSdPgNum);
870 : : }
871 : :
872 [ # # ]: 0 : if (pObj != NULL)
873 : : {
874 : : // Objekt einblenden und selektieren
875 [ # # ]: 0 : pDrawViewShell->MakeVisible(pObj->GetLogicRect(),
876 [ # # ][ # # ]: 0 : *pDrawViewShell->GetActiveWindow());
877 [ # # ]: 0 : pDrawViewShell->GetView()->UnmarkAll();
878 : 0 : pDrawViewShell->GetView()->MarkObj(
879 : : pObj,
880 [ # # ]: 0 : pDrawViewShell->GetView()->GetSdrPageView(), sal_False);
881 : 0 : }
882 : : }
883 : : }
884 : :
885 [ # # ]: 0 : SfxBindings& rBindings = (pDrawViewShell->GetViewFrame()!=NULL
886 : 0 : ? pDrawViewShell->GetViewFrame()
887 [ # # ][ # # ]: 0 : : SfxViewFrame::Current() )->GetBindings();
[ # # ]
888 : :
889 [ # # ]: 0 : rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False);
890 [ # # ][ # # ]: 0 : rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
[ # # ]
891 : : }
892 : :
893 : 0 : return (bFound);
894 : : }
895 : :
896 : : /*************************************************************************
897 : : |*
898 : : |* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll,
899 : : |*
900 : : \************************************************************************/
901 : :
902 : 8 : sal_Bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
903 : : {
904 : :
905 : 8 : const SfxFilter* pFilter = rMedium.GetFilter();
906 : :
907 [ - + ]: 8 : if (pFilter->IsOwnTemplateFormat())
908 : : {
909 : : // jetzt die StarDraw-Spezialitaeten:
910 : : // die Layoutvorlagen der ersten Seite werden mit dem jetzt
911 : : // bekannten Layoutnamen versehen, die Layoutnamen der betroffenen
912 : : // Masterpages und Seiten werden gesetzt;
913 : : // alle Textobjekte der betroffenen Standard-, Notiz- und
914 : : // Masterpages werden ueber die Namensaenderung informiert
915 : :
916 [ # # ]: 0 : String aLayoutName;
917 : :
918 : : SfxStringItem* pLayoutItem;
919 [ # # ][ # # ]: 0 : if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, sal_False, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET )
[ # # ]
920 : : {
921 [ # # ]: 0 : aLayoutName = pLayoutItem->GetValue();
922 : : }
923 : : else
924 : : {
925 [ # # ][ # # ]: 0 : INetURLObject aURL( rMedium.GetName() );
926 [ # # ]: 0 : aURL.removeExtension();
927 [ # # ][ # # ]: 0 : aLayoutName = aURL.getName();
[ # # ]
928 : : }
929 : :
930 [ # # ]: 0 : if( aLayoutName.Len() )
931 : : {
932 [ # # ][ # # ]: 0 : String aOldPageLayoutName = mpDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
933 [ # # ][ # # ]: 0 : mpDoc->RenameLayoutTemplate(aOldPageLayoutName, aLayoutName);
934 [ # # ]: 0 : }
935 : : }
936 : :
937 : 8 : return SfxObjectShell::SaveAsOwnFormat(rMedium);
938 : : }
939 : :
940 : : /*************************************************************************
941 : : |*
942 : : |* FillClass
943 : : |*
944 : : \************************************************************************/
945 : :
946 : 156 : void DrawDocShell::FillClass(SvGlobalName* pClassName,
947 : : sal_uInt32* pFormat,
948 : : String* ,
949 : : String* pFullTypeName,
950 : : String* pShortTypeName,
951 : : sal_Int32 nFileFormat,
952 : : sal_Bool bTemplate /* = sal_False */) const
953 : : {
954 [ + + ]: 156 : if (nFileFormat == SOFFICE_FILEFORMAT_60)
955 : : {
956 [ + + ]: 4 : if ( meDocType == DOCUMENT_TYPE_DRAW )
957 : : {
958 [ + - ]: 2 : *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
959 : 2 : *pFormat = SOT_FORMATSTR_ID_STARDRAW_60;
960 [ + - ][ + - ]: 2 : *pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_60));
[ + - ]
961 : : }
962 : : else
963 : : {
964 [ + - ]: 2 : *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
965 : 2 : *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60;
966 [ + - ][ + - ]: 2 : *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_60));
[ + - ]
967 : : }
968 : : }
969 [ + - ]: 152 : else if (nFileFormat == SOFFICE_FILEFORMAT_8)
970 : : {
971 [ + + ]: 152 : if ( meDocType == DOCUMENT_TYPE_DRAW )
972 : : {
973 [ + - ]: 104 : *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
974 [ - + ]: 104 : *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE : SOT_FORMATSTR_ID_STARDRAW_8;
975 [ + - ]: 104 : *pFullTypeName = "Draw 8"; // HACK: method will be removed with new storage API
976 : : }
977 : : else
978 : : {
979 [ + - ]: 48 : *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
980 [ - + ]: 48 : *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE : SOT_FORMATSTR_ID_STARIMPRESS_8;
981 [ + - ]: 48 : *pFullTypeName = "Impress 8"; // HACK: method will be removed with new storage API
982 : : }
983 : : }
984 : :
985 : : *pShortTypeName = String(SdResId( (meDocType == DOCUMENT_TYPE_DRAW) ?
986 [ + + ][ + - ]: 156 : STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT ));
[ + - ][ + - ]
987 : 156 : }
988 : :
989 : 0 : OutputDevice* DrawDocShell::GetDocumentRefDev (void)
990 : : {
991 : 0 : OutputDevice* pReferenceDevice = SfxObjectShell::GetDocumentRefDev ();
992 : : // Only when our parent does not have a reference device then we return
993 : : // our own.
994 [ # # ][ # # ]: 0 : if (pReferenceDevice == NULL && mpDoc != NULL)
995 : 0 : pReferenceDevice = mpDoc->GetRefDevice ();
996 : 0 : return pReferenceDevice;
997 : : }
998 : :
999 : : /** executes the SID_OPENDOC slot to let the framework open a document
1000 : : with the given URL and this document as a referer */
1001 : 0 : void DrawDocShell::OpenBookmark( const String& rBookmarkURL )
1002 : : {
1003 [ # # ]: 0 : SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL );
1004 [ # # ][ # # ]: 0 : SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() );
[ # # ][ # # ]
1005 : 0 : const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, 0 };
1006 [ # # ][ # # ]: 0 : ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
[ # # ][ # # ]
[ # # ][ # # ]
1007 : 0 : }
1008 : :
1009 [ + - ][ + - ]: 75 : } // end of namespace sd
1010 : :
1011 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|