1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sd.hxx" 26 27 #include "DrawDocShell.hxx" 28 #include <com/sun/star/document/PrinterIndependentLayout.hpp> 29 #include <tools/urlobj.hxx> 30 #include <sfx2/progress.hxx> 31 #include <vcl/waitobj.hxx> 32 #ifndef _SVXIDS_HRC 33 #include <svx/svxids.hrc> 34 #endif 35 #include <editeng/flstitem.hxx> 36 #include <editeng/eeitem.hxx> 37 #include <svl/aeitem.hxx> 38 #include <svl/flagitem.hxx> 39 #include <sot/storage.hxx> 40 #include <sfx2/docfile.hxx> 41 #include <sfx2/docfilt.hxx> 42 #ifndef _DISPATCH_HXX //autogen 43 #include <sfx2/dispatch.hxx> 44 #endif 45 #include <svx/svdotext.hxx> 46 #include <svl/style.hxx> 47 #include <sfx2/printer.hxx> 48 #include <svtools/ctrltool.hxx> 49 #ifndef _SFX_ECODE_HXX //autogen 50 #include <svtools/sfxecode.hxx> 51 #endif 52 #include <sot/clsids.hxx> 53 #include <sot/formats.hxx> 54 #include <sfx2/request.hxx> 55 #ifdef TF_STARONE 56 #include "unomodel.hxx" 57 #endif 58 59 #include <unotools/fltrcfg.hxx> 60 #include <sfx2/frame.hxx> 61 #include <sfx2/viewfrm.hxx> 62 //#include <svx/svxmsbas.hxx> 63 #include <unotools/saveopt.hxx> 64 #include <com/sun/star/drawing/XDrawPage.hpp> 65 #include <com/sun/star/drawing/XDrawView.hpp> 66 #include <comphelper/processfactory.hxx> 67 68 #include "app.hrc" 69 #include "glob.hrc" 70 #include "strings.hrc" 71 #include "strmname.h" 72 #ifndef SD_FRAMW_VIEW_HXX 73 #include "FrameView.hxx" 74 #endif 75 #include "optsitem.hxx" 76 #include "Outliner.hxx" 77 #include "sdattr.hxx" 78 #include "drawdoc.hxx" 79 #include "ViewShell.hxx" 80 #include "app.hxx" 81 #include "View.hxx" 82 #include "sdpage.hxx" 83 #include "sdresid.hxx" 84 #include "DrawViewShell.hxx" 85 #include "ViewShellBase.hxx" 86 #include "Window.hxx" 87 #include "sdmod.hxx" 88 #include "OutlineViewShell.hxx" 89 #include "sdxmlwrp.hxx" 90 #include "sdpptwrp.hxx" 91 #include "sdcgmfilter.hxx" 92 #include "sdgrffilter.hxx" 93 #include "sdhtmlfilter.hxx" 94 #include "framework/FrameworkHelper.hxx" 95 96 //IAccessibility2 Implementation 2009----- 97 #include <sfx2/viewfrm.hxx> 98 #include "SdUnoDrawView.hxx" 99 //-----IAccessibility2 Implementation 2009 100 using namespace ::com::sun::star; 101 using namespace ::com::sun::star::uno; 102 using ::sd::framework::FrameworkHelper; 103 104 105 namespace sd { 106 107 /************************************************************************* 108 |* 109 |* SfxPrinter ggf. erzeugen und zurueckgeben 110 |* 111 \************************************************************************/ 112 113 SfxPrinter* DrawDocShell::GetPrinter(sal_Bool bCreate) 114 { 115 if (bCreate && !mpPrinter) 116 { 117 // ItemSet mit speziellem Poolbereich anlegen 118 SfxItemSet* pSet = new SfxItemSet( GetPool(), 119 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, 120 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 121 ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, 122 0 ); 123 // PrintOptionsSet setzen 124 SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT, 125 SD_MOD()->GetSdOptions(mpDoc->GetDocumentType())); 126 SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC ); 127 sal_uInt16 nFlags = 0; 128 129 nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) | 130 (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0); 131 aFlagItem.SetValue( nFlags ); 132 133 pSet->Put( aPrintItem ); 134 pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) ); 135 pSet->Put( aFlagItem ); 136 137 mpPrinter = new SfxPrinter(pSet); 138 mbOwnPrinter = sal_True; 139 140 // Ausgabequalitaet setzen 141 sal_uInt16 nQuality = aPrintItem.GetOptionsPrint().GetOutputQuality(); 142 143 sal_uLong nMode = DRAWMODE_DEFAULT; 144 145 if( nQuality == 1 ) 146 nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT; 147 else if( nQuality == 2 ) 148 nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT; 149 150 mpPrinter->SetDrawMode( nMode ); 151 152 MapMode aMM (mpPrinter->GetMapMode()); 153 aMM.SetMapUnit(MAP_100TH_MM); 154 mpPrinter->SetMapMode(aMM); 155 UpdateRefDevice(); 156 } 157 return mpPrinter; 158 } 159 160 /************************************************************************* 161 |* 162 |* neuen SfxPrinter setzen (Eigentuemeruebergang) 163 |* 164 \************************************************************************/ 165 166 void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) 167 { 168 if ( mpViewShell ) 169 { 170 ::sd::View* pView = mpViewShell->GetView(); 171 if ( pView->IsTextEdit() ) 172 pView->SdrEndTextEdit(); 173 } 174 175 if ( mpPrinter && mbOwnPrinter && (mpPrinter != pNewPrinter) ) 176 { 177 delete mpPrinter; 178 } 179 180 mpPrinter = pNewPrinter; 181 mbOwnPrinter = sal_True; 182 if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED ) 183 UpdateFontList(); 184 UpdateRefDevice(); 185 } 186 187 void DrawDocShell::UpdateFontList() 188 { 189 delete mpFontList; 190 OutputDevice* pRefDevice = NULL; 191 if ( mpDoc->GetPrinterIndependentLayout() == ::com::sun::star::document::PrinterIndependentLayout::DISABLED ) 192 pRefDevice = GetPrinter(sal_True); 193 else 194 pRefDevice = SD_MOD()->GetVirtualRefDevice(); 195 mpFontList = new FontList( pRefDevice, NULL, sal_False ); 196 SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST ); 197 PutItem( aFontListItem ); 198 } 199 200 /************************************************************************* 201 |* 202 |* 203 |* 204 \************************************************************************/ 205 Printer* DrawDocShell::GetDocumentPrinter() 206 { 207 return GetPrinter(sal_False); 208 } 209 210 /************************************************************************* 211 |* 212 |* 213 |* 214 \************************************************************************/ 215 void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter) 216 { 217 // if we already have a printer, see if its the same 218 if( mpPrinter ) 219 { 220 // easy case 221 if( mpPrinter == pNewPrinter ) 222 return; 223 224 // compare if its the same printer with the same job setup 225 if( (mpPrinter->GetName() == pNewPrinter->GetName()) && 226 (mpPrinter->GetJobSetup() == pNewPrinter->GetJobSetup())) 227 return; 228 } 229 230 // if (mpPrinter->IsA(SfxPrinter)) 231 { 232 // Da kein RTTI verfuegbar, wird hart gecasted (...) 233 SetPrinter((SfxPrinter*) pNewPrinter); 234 235 // Printer gehoert dem Container 236 mbOwnPrinter = sal_False; 237 } 238 } 239 240 /************************************************************************* 241 |* 242 |* 243 |* 244 \************************************************************************/ 245 void DrawDocShell::UpdateRefDevice() 246 { 247 if( mpDoc ) 248 { 249 // Determine the device for which the output will be formatted. 250 OutputDevice* pRefDevice = NULL; 251 switch (mpDoc->GetPrinterIndependentLayout()) 252 { 253 case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: 254 pRefDevice = mpPrinter; 255 break; 256 257 case ::com::sun::star::document::PrinterIndependentLayout::ENABLED: 258 pRefDevice = SD_MOD()->GetVirtualRefDevice(); 259 break; 260 261 default: 262 // We are confronted with an invalid or un-implemented 263 // layout mode. Use the printer as formatting device 264 // as a fall-back. 265 DBG_ASSERT(false, "DrawDocShell::UpdateRefDevice(): Unexpected printer layout mode"); 266 267 pRefDevice = mpPrinter; 268 break; 269 } 270 mpDoc->SetRefDevice( pRefDevice ); 271 272 ::sd::Outliner* pOutl = mpDoc->GetOutliner( sal_False ); 273 274 if( pOutl ) 275 pOutl->SetRefDevice( pRefDevice ); 276 277 ::sd::Outliner* pInternalOutl = mpDoc->GetInternalOutliner( sal_False ); 278 279 if( pInternalOutl ) 280 pInternalOutl->SetRefDevice( pRefDevice ); 281 } 282 } 283 284 /************************************************************************* 285 |* 286 |* InitNew, (Dokument wird neu erzeugt): Streams oeffnen 287 |* 288 \************************************************************************/ 289 290 sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) 291 { 292 sal_Bool bRet = sal_False; 293 294 bRet = SfxObjectShell::InitNew( xStorage ); 295 296 Rectangle aVisArea( Point(0, 0), Size(14100, 10000) ); 297 SetVisArea(aVisArea); 298 299 if (bRet) 300 { 301 if( !mbSdDataObj ) 302 mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling 303 // NewOrLoadCompleted(NEW_LOADED) in 304 // SdDrawDocument::AllocModel() 305 } 306 return bRet; 307 } 308 309 /************************************************************************* 310 |* 311 |* Load: Pools und Dokument laden 312 |* 313 \************************************************************************/ 314 315 sal_Bool DrawDocShell::Load( SfxMedium& rMedium ) 316 { 317 mbNewDocument = sal_False; 318 319 sal_Bool bRet = sal_False; 320 bool bStartPresentation = false; 321 ErrCode nError = ERRCODE_NONE; 322 323 SfxItemSet* pSet = rMedium.GetItemSet(); 324 325 326 if( pSet ) 327 { 328 if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() ) 329 { 330 mpDoc->SetStarDrawPreviewMode( sal_True ); 331 } 332 333 if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&& 334 ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() ) 335 { 336 bStartPresentation = true; 337 mpDoc->SetStartWithPresentation( true ); 338 } 339 } 340 341 bRet = SfxObjectShell::Load( rMedium ); 342 if( bRet ) 343 { 344 bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); 345 } 346 347 if( bRet ) 348 { 349 UpdateTablePointers(); 350 351 // #108451# If we're an embedded OLE object, use tight bounds 352 // for our visArea. No point in showing the user lots of empty 353 // space. Had to remove the check for empty VisArea below, 354 // since XML load always sets a VisArea before. 355 //TODO/LATER: looks a little bit strange! 356 if( ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) && SfxObjectShell::GetVisArea( ASPECT_CONTENT ).IsEmpty() ) 357 { 358 SdPage* pPage = mpDoc->GetSdPage( 0, PK_STANDARD ); 359 360 if( pPage ) 361 SetVisArea( Rectangle( pPage->GetAllObjBoundRect() ) ); 362 } 363 364 FinishedLoading( SFX_LOADED_ALL ); 365 366 const INetURLObject aUrl; 367 SfxObjectShell::SetAutoLoad( aUrl, 0, sal_False ); 368 } 369 else 370 { 371 if( nError == ERRCODE_IO_BROKENPACKAGE ) 372 SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 373 374 // TODO/LATER: correct error handling?! 375 //pStore->SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 376 else 377 SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 378 } 379 380 // tell SFX to change viewshell when in preview mode 381 if( IsPreview() || bStartPresentation ) 382 { 383 SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); 384 if( pMediumSet ) 385 pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) ); 386 } 387 388 return bRet; 389 } 390 391 /************************************************************************* 392 |* 393 |* LoadFrom: Inhalte fuer Organizer laden 394 |* 395 \************************************************************************/ 396 397 sal_Bool DrawDocShell::LoadFrom( SfxMedium& rMedium ) 398 { 399 mbNewDocument = sal_False; 400 401 WaitObject* pWait = NULL; 402 if( mpViewShell ) 403 pWait = new WaitObject( (Window*) mpViewShell->GetActiveWindow() ); 404 405 sal_Bool bRet = sal_False; 406 407 /* 408 // #90691# return to old behaviour (before #80365#): construct own medium 409 SfxMedium aMedium(xStorage); 410 411 // #90691# for having a progress bar nonetheless for XML copy it 412 // from the local DocShell medium (GetMedium()) to the constructed one 413 SfxMedium* pLocalMedium = GetMedium(); 414 if(pLocalMedium) 415 { 416 SfxItemSet* pLocalItemSet = pLocalMedium->GetItemSet(); 417 SfxItemSet* pDestItemSet = aMedium.GetItemSet(); 418 419 if(pLocalItemSet && pDestItemSet) 420 { 421 const SfxUnoAnyItem* pItem = static_cast< 422 const SfxUnoAnyItem*>( 423 pLocalItemSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL)); 424 425 if(pItem) 426 { 427 pDestItemSet->Put(*pItem); 428 } 429 } 430 } */ 431 432 mpDoc->NewOrLoadCompleted( NEW_DOC ); 433 mpDoc->CreateFirstPages(); 434 mpDoc->StopWorkStartupDelay(); 435 436 // TODO/LATER: nobody is interested in the error code?! 437 ErrCode nError = ERRCODE_NONE; 438 bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Organizer, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); 439 440 441 // tell SFX to change viewshell when in preview mode 442 if( IsPreview() ) 443 { 444 SfxItemSet *pSet = GetMedium()->GetItemSet(); 445 446 if( pSet ) 447 pSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) ); 448 } 449 450 delete pWait; 451 452 return bRet; 453 } 454 455 /************************************************************************* 456 |* 457 |* ConvertFrom: aus Fremdformat laden 458 |* 459 \************************************************************************/ 460 461 sal_Bool DrawDocShell::ConvertFrom( SfxMedium& rMedium ) 462 { 463 mbNewDocument = sal_False; 464 465 const String aFilterName( rMedium.GetFilter()->GetFilterName() ); 466 sal_Bool bRet = sal_False; 467 bool bStartPresentation = false; 468 469 SetWaitCursor( sal_True ); 470 471 SfxItemSet* pSet = rMedium.GetItemSet(); 472 if( pSet ) 473 { 474 if( ( SFX_ITEM_SET == pSet->GetItemState(SID_PREVIEW ) ) && ( (SfxBoolItem&) ( pSet->Get( SID_PREVIEW ) ) ).GetValue() ) 475 { 476 mpDoc->SetStarDrawPreviewMode( sal_True ); 477 } 478 479 if( SFX_ITEM_SET == pSet->GetItemState(SID_DOC_STARTPRESENTATION)&& 480 ( (SfxBoolItem&) ( pSet->Get( SID_DOC_STARTPRESENTATION ) ) ).GetValue() ) 481 { 482 bStartPresentation = true; 483 mpDoc->SetStartWithPresentation( true ); 484 } 485 } 486 487 if( aFilterName == pFilterPowerPoint97 || aFilterName == pFilterPowerPoint97Template) 488 { 489 mpDoc->StopWorkStartupDelay(); 490 bRet = SdPPTFilter( rMedium, *this, sal_True ).Import(); 491 } 492 else if (aFilterName.SearchAscii("impress8" ) != STRING_NOTFOUND || 493 aFilterName.SearchAscii("draw8") != STRING_NOTFOUND ) 494 { 495 // TODO/LATER: nobody is interested in the error code?! 496 mpDoc->CreateFirstPages(); 497 mpDoc->StopWorkStartupDelay(); 498 ErrCode nError = ERRCODE_NONE; 499 bRet = SdXMLFilter( rMedium, *this, sal_True ).Import( nError ); 500 501 } 502 else if (aFilterName.SearchAscii("StarOffice XML (Draw)" ) != STRING_NOTFOUND || aFilterName.SearchAscii("StarOffice XML (Impress)") != STRING_NOTFOUND ) 503 { 504 // TODO/LATER: nobody is interested in the error code?! 505 mpDoc->CreateFirstPages(); 506 mpDoc->StopWorkStartupDelay(); 507 ErrCode nError = ERRCODE_NONE; 508 bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ).Import( nError ); 509 } 510 else if( aFilterName.EqualsAscii( "CGM - Computer Graphics Metafile" ) ) 511 { 512 mpDoc->CreateFirstPages(); 513 mpDoc->StopWorkStartupDelay(); 514 bRet = SdCGMFilter( rMedium, *this, sal_True ).Import(); 515 } 516 else 517 { 518 mpDoc->CreateFirstPages(); 519 mpDoc->StopWorkStartupDelay(); 520 bRet = SdGRFFilter( rMedium, *this ).Import(); 521 } 522 523 FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES ); 524 525 // tell SFX to change viewshell when in preview mode 526 if( IsPreview() ) 527 { 528 SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); 529 530 if( pMediumSet ) 531 pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, 5 ) ); 532 } 533 SetWaitCursor( sal_False ); 534 535 // tell SFX to change viewshell when in preview mode 536 if( IsPreview() || bStartPresentation ) 537 { 538 SfxItemSet *pMediumSet = GetMedium()->GetItemSet(); 539 if( pMediumSet ) 540 pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, bStartPresentation ? 1 : 5 ) ); 541 } 542 543 return bRet; 544 } 545 546 /************************************************************************* 547 |* 548 |* Save: Pools und Dokument in die offenen Streams schreiben 549 |* 550 \************************************************************************/ 551 552 sal_Bool DrawDocShell::Save() 553 { 554 mpDoc->StopWorkStartupDelay(); 555 556 //TODO/LATER: why this?! 557 if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 558 SfxObjectShell::SetVisArea( Rectangle() ); 559 560 sal_Bool bRet = SfxObjectShell::Save(); 561 562 if( bRet ) 563 { 564 // #86834# Call UpdateDocInfoForSave() before export 565 UpdateDocInfoForSave(); 566 567 bRet = SdXMLFilter( *GetMedium(), *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( GetMedium()->GetStorage() ) ).Export(); 568 } 569 570 return bRet; 571 } 572 573 /************************************************************************* 574 |* 575 |* SaveAs: Pools und Dokument in den angegebenen Storage sichern 576 |* 577 \************************************************************************/ 578 579 sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium ) 580 { 581 //IAccessibility2 Implementation 2009----- 582 mpDoc->setDocAccTitle(String()); 583 SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this ); 584 if (pFrame1) 585 { 586 ::Window* pWindow = &pFrame1->GetWindow(); 587 if ( pWindow ) 588 { 589 ::Window* pSysWin = pWindow->GetSystemWindow(); 590 if ( pSysWin ) 591 { 592 pSysWin->SetAccessibleName(String()); 593 } 594 } 595 } 596 //-----IAccessibility2 Implementation 2009 597 mpDoc->StopWorkStartupDelay(); 598 599 //TODO/LATER: why this?! 600 if( GetCreateMode() == SFX_CREATE_MODE_STANDARD ) 601 SfxObjectShell::SetVisArea( Rectangle() ); 602 603 sal_uInt32 nVBWarning = ERRCODE_NONE; 604 sal_Bool bRet = SfxObjectShell::SaveAs( rMedium ); 605 606 if( bRet ) 607 { 608 // #86834# Call UpdateDocInfoForSave() before export 609 UpdateDocInfoForSave(); 610 bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Export(); 611 } 612 613 if( GetError() == ERRCODE_NONE ) 614 SetError( nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 615 616 return bRet; 617 } 618 619 /************************************************************************* 620 |* 621 |* ConvertTo: im Fremdformat speichern 622 |* 623 \************************************************************************/ 624 625 sal_Bool DrawDocShell::ConvertTo( SfxMedium& rMedium ) 626 { 627 sal_Bool bRet = sal_False; 628 629 if( mpDoc->GetPageCount() ) 630 { 631 const SfxFilter* pMediumFilter = rMedium.GetFilter(); 632 const String aTypeName( pMediumFilter->GetTypeName() ); 633 SdFilter* pFilter = NULL; 634 635 if( aTypeName.SearchAscii( "graphic_HTML" ) != STRING_NOTFOUND ) 636 { 637 pFilter = new SdHTMLFilter( rMedium, *this, sal_True ); 638 } 639 else if( aTypeName.SearchAscii( "MS_PowerPoint_97" ) != STRING_NOTFOUND ) 640 { 641 pFilter = new SdPPTFilter( rMedium, *this, sal_True ); 642 ((SdPPTFilter*)pFilter)->PreSaveBasic(); 643 } 644 else if ( aTypeName.SearchAscii( "CGM_Computer_Graphics_Metafile" ) != STRING_NOTFOUND ) 645 { 646 pFilter = new SdCGMFilter( rMedium, *this, sal_True ); 647 } 648 else if( ( aTypeName.SearchAscii( "draw8" ) != STRING_NOTFOUND ) || 649 ( aTypeName.SearchAscii( "impress8" ) != STRING_NOTFOUND ) ) 650 { 651 pFilter = new SdXMLFilter( rMedium, *this, sal_True ); 652 UpdateDocInfoForSave(); 653 } 654 else if( ( aTypeName.SearchAscii( "StarOffice_XML_Impress" ) != STRING_NOTFOUND ) || 655 ( aTypeName.SearchAscii( "StarOffice_XML_Draw" ) != STRING_NOTFOUND ) ) 656 { 657 pFilter = new SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 ); 658 UpdateDocInfoForSave(); 659 } 660 else 661 { 662 pFilter = new SdGRFFilter( rMedium, *this ); 663 } 664 665 if( pFilter ) 666 { 667 const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode(); 668 669 mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); 670 671 bRet = pFilter->Export(); 672 if( !bRet ) 673 mpDoc->SetSwapGraphicsMode( nOldSwapMode ); 674 675 delete pFilter; 676 } 677 } 678 679 return bRet; 680 } 681 682 /************************************************************************* 683 |* 684 |* SaveCompleted: die eigenen Streams wieder oeffnen, damit kein anderer 685 |* sie "besetzt" 686 |* 687 \************************************************************************/ 688 689 sal_Bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) 690 { 691 sal_Bool bRet = sal_False; 692 693 if( SfxObjectShell::SaveCompleted(xStorage) ) 694 { 695 mpDoc->NbcSetChanged( sal_False ); 696 697 if( mpViewShell ) 698 { 699 if( mpViewShell->ISA( OutlineViewShell ) ) 700 static_cast<OutlineView*>(mpViewShell->GetView()) 701 ->GetOutliner()->ClearModifyFlag(); 702 703 SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner(); 704 if( pOutl ) 705 { 706 SdrObject* pObj = mpViewShell->GetView()->GetTextEditObject(); 707 if( pObj ) 708 pObj->NbcSetOutlinerParaObject( pOutl->CreateParaObject() ); 709 710 pOutl->ClearModifyFlag(); 711 } 712 } 713 714 bRet = sal_True; 715 716 SfxViewFrame* pFrame = ( mpViewShell && mpViewShell->GetViewFrame() ) ? 717 mpViewShell->GetViewFrame() : 718 SfxViewFrame::Current(); 719 720 if( pFrame ) 721 pFrame->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False ); 722 } 723 return bRet; 724 } 725 726 /************************************************************************* 727 |* 728 |* Referenz auf Dokument 729 |* 730 \************************************************************************/ 731 732 SdDrawDocument* DrawDocShell::GetDoc() 733 { 734 return mpDoc; 735 } 736 737 /************************************************************************* 738 |* 739 |* Referenz auf Dokument 740 |* 741 \************************************************************************/ 742 743 SfxStyleSheetBasePool* DrawDocShell::GetStyleSheetPool() 744 { 745 return( (SfxStyleSheetBasePool*) mpDoc->GetStyleSheetPool() ); 746 } 747 748 /************************************************************************* 749 |* 750 |* Sprung zu Bookmark 751 |* 752 \************************************************************************/ 753 754 sal_Bool DrawDocShell::GotoBookmark(const String& rBookmark) 755 { 756 sal_Bool bFound = sal_False; 757 758 if (mpViewShell && mpViewShell->ISA(DrawViewShell)) 759 { 760 DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell); 761 ViewShellBase& rBase (mpViewShell->GetViewShellBase()); 762 763 sal_Bool bIsMasterPage = sal_False; 764 sal_uInt16 nPageNumber = SDRPAGE_NOTFOUND; 765 SdrObject* pObj = NULL; 766 767 rtl::OUString sBookmark( rBookmark ); 768 const rtl::OUString sInteraction( RTL_CONSTASCII_USTRINGPARAM( "action?" ) ); 769 if ( sBookmark.match( sInteraction ) ) 770 { 771 const rtl::OUString sJump( RTL_CONSTASCII_USTRINGPARAM( "jump=" ) ); 772 if ( sBookmark.match( sJump, sInteraction.getLength() ) ) 773 { 774 rtl::OUString aDestination( sBookmark.copy( sInteraction.getLength() + sJump.getLength() ) ); 775 if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "firstslide" ) ) ) ) 776 { 777 nPageNumber = 1; 778 } 779 else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "lastslide" ) ) ) ) 780 { 781 nPageNumber = mpDoc->GetPageCount() - 2; 782 } 783 else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "previousslide" ) ) ) ) 784 { 785 SdPage* pPage = pDrawViewShell->GetActualPage(); 786 nPageNumber = pPage->GetPageNum(); 787 nPageNumber = nPageNumber > 2 ? nPageNumber - 2 : SDRPAGE_NOTFOUND; 788 } 789 else if ( aDestination.match( String( RTL_CONSTASCII_USTRINGPARAM( "nextslide" ) ) ) ) 790 { 791 SdPage* pPage = pDrawViewShell->GetActualPage(); 792 nPageNumber = pPage->GetPageNum() + 2; 793 if ( nPageNumber >= mpDoc->GetPageCount() ) 794 nPageNumber = SDRPAGE_NOTFOUND; 795 } 796 } 797 } 798 else 799 { 800 String aBookmark( rBookmark ); 801 802 // Ist das Bookmark eine Seite? 803 nPageNumber = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); 804 805 if (nPageNumber == SDRPAGE_NOTFOUND) 806 { 807 // Ist das Bookmark ein Objekt? 808 pObj = mpDoc->GetObj(aBookmark); 809 810 if (pObj) 811 { 812 nPageNumber = pObj->GetPage()->GetPageNum(); 813 } 814 } 815 } 816 if (nPageNumber != SDRPAGE_NOTFOUND) 817 { 818 // Jump to the bookmarked page. This is done in three steps. 819 820 bFound = sal_True; 821 SdPage* pPage; 822 if (bIsMasterPage) 823 pPage = (SdPage*) mpDoc->GetMasterPage(nPageNumber); 824 else 825 pPage = (SdPage*) mpDoc->GetPage(nPageNumber); 826 827 // 1.) Change the view shell to the edit view, the notes view, 828 // or the handout view. 829 PageKind eNewPageKind = pPage->GetPageKind(); 830 831 if( (eNewPageKind != PK_STANDARD) && (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) ) 832 return sal_False; 833 834 if (eNewPageKind != pDrawViewShell->GetPageKind()) 835 { 836 // Arbeitsbereich wechseln 837 GetFrameView()->SetPageKind(eNewPageKind); 838 ::rtl::OUString sViewURL; 839 switch (eNewPageKind) 840 { 841 case PK_STANDARD: 842 sViewURL = FrameworkHelper::msImpressViewURL; 843 break; 844 case PK_NOTES: 845 sViewURL = FrameworkHelper::msNotesViewURL; 846 break; 847 case PK_HANDOUT: 848 sViewURL = FrameworkHelper::msHandoutViewURL; 849 break; 850 default: 851 break; 852 } 853 if (sViewURL.getLength() > 0) 854 { 855 ::boost::shared_ptr<FrameworkHelper> pHelper ( 856 FrameworkHelper::Instance(rBase)); 857 pHelper->RequestView( 858 sViewURL, 859 FrameworkHelper::msCenterPaneURL); 860 pHelper->WaitForUpdate(); 861 862 // Get the new DrawViewShell. 863 mpViewShell = pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL).get(); 864 pDrawViewShell = dynamic_cast<sd::DrawViewShell*>(mpViewShell); 865 } 866 else 867 { 868 pDrawViewShell = NULL; 869 } 870 } 871 872 if (pDrawViewShell != NULL) 873 { 874 // Set the edit mode to either the normal edit mode or the 875 // master page mode. 876 EditMode eNewEditMode = EM_PAGE; 877 if (bIsMasterPage) 878 { 879 eNewEditMode = EM_MASTERPAGE; 880 } 881 882 if (eNewEditMode != pDrawViewShell->GetEditMode()) 883 { 884 // EditMode setzen 885 pDrawViewShell->ChangeEditMode(eNewEditMode, sal_False); 886 } 887 888 // Make the bookmarked page the current page. This is done 889 // by using the API because this takes care of all the 890 // little things to be done. Especially writing the view 891 // data to the frame view (see bug #107803#). 892 sal_uInt16 nSdPgNum = (nPageNumber - 1) / 2; 893 Reference<drawing::XDrawView> xController (rBase.GetController(), UNO_QUERY); 894 if (xController.is()) 895 { 896 Reference<drawing::XDrawPage> xDrawPage (pPage->getUnoPage(), UNO_QUERY); 897 xController->setCurrentPage (xDrawPage); 898 } 899 else 900 { 901 // As a fall back switch to the page via the core. 902 DBG_ASSERT (xController.is(), 903 "DrawDocShell::GotoBookmark: can't switch page via API"); 904 pDrawViewShell->SwitchPage(nSdPgNum); 905 } 906 907 if (pObj != NULL) 908 { 909 // Objekt einblenden und selektieren 910 pDrawViewShell->MakeVisible(pObj->GetLogicRect(), 911 *pDrawViewShell->GetActiveWindow()); 912 pDrawViewShell->GetView()->UnmarkAll(); 913 pDrawViewShell->GetView()->MarkObj( 914 pObj, 915 pDrawViewShell->GetView()->GetSdrPageView(), sal_False); 916 } 917 } 918 } 919 920 SfxBindings& rBindings = (pDrawViewShell->GetViewFrame()!=NULL 921 ? pDrawViewShell->GetViewFrame() 922 : SfxViewFrame::Current() )->GetBindings(); 923 924 rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False); 925 rBindings.Invalidate(SID_NAVIGATOR_PAGENAME); 926 } 927 928 return (bFound); 929 } 930 931 //IAccessibility2 Implementation 2009----- 932 //Solution: If object is marked , return true , else return false . 933 sal_Bool DrawDocShell::IsMarked( SdrObject* pObject ) 934 { 935 sal_Bool bisMarked =sal_False; 936 937 if (mpViewShell && mpViewShell->ISA(DrawViewShell)) 938 { 939 DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; 940 if (pObject ) 941 { 942 bisMarked = pDrViewSh->GetView()->IsObjMarked(pObject); 943 } 944 } 945 return bisMarked; 946 } 947 //Solution: If object is marked , return true , else return false . 948 sal_Bool DrawDocShell::GetObjectIsmarked(const String& rBookmark) 949 { 950 OSL_TRACE("GotoBookmark %s", 951 ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); 952 sal_Bool bUnMark = sal_False; 953 954 if (mpViewShell && mpViewShell->ISA(DrawViewShell)) 955 { 956 DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; 957 958 String aBookmark( rBookmark ); 959 960 if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') ) 961 aBookmark = rBookmark.Copy( 1 ); 962 963 // Ist das Bookmark eine Seite? 964 sal_Bool bIsMasterPage; 965 sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); 966 SdrObject* pObj = NULL; 967 968 if (nPgNum == SDRPAGE_NOTFOUND) 969 { 970 // Ist das Bookmark ein Objekt? 971 pObj = mpDoc->GetObj(aBookmark); 972 973 if (pObj) 974 { 975 nPgNum = pObj->GetPage()->GetPageNum(); 976 } 977 } 978 979 if (nPgNum != SDRPAGE_NOTFOUND) 980 { 981 /********************************************************** 982 * Zur Seite springen 983 **********************************************************/ 984 985 SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum); 986 987 PageKind eNewPageKind = pPage->GetPageKind(); 988 989 if (eNewPageKind != pDrViewSh->GetPageKind()) 990 { 991 // Arbeitsbereich wechseln 992 GetFrameView()->SetPageKind(eNewPageKind); 993 ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? 994 mpViewShell->GetViewFrame() : SfxViewFrame::Current() )-> 995 GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); 996 997 // Die aktuelle ViewShell hat sich geaendert! 998 pDrViewSh = (DrawViewShell*) mpViewShell; 999 } 1000 1001 EditMode eNewEditMode = EM_PAGE; 1002 1003 if( bIsMasterPage ) 1004 { 1005 eNewEditMode = EM_MASTERPAGE; 1006 } 1007 1008 if (eNewEditMode != pDrViewSh->GetEditMode()) 1009 { 1010 // EditMode setzen 1011 pDrViewSh->ChangeEditMode(eNewEditMode, sal_False); 1012 } 1013 1014 // Jump to the page. This is done by using the API because this 1015 // takes care of all the little things to be done. Especially 1016 // writing the view data to the frame view (see bug #107803#). 1017 sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; 1018 SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( 1019 pDrViewSh->GetViewShellBase().GetDrawController(), 1020 *pDrViewSh, 1021 *pDrViewSh->GetView()); 1022 if (pUnoDrawView != NULL) 1023 { 1024 ::com::sun::star::uno::Reference< 1025 ::com::sun::star::drawing::XDrawPage> xDrawPage ( 1026 pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); 1027 pUnoDrawView->setCurrentPage (xDrawPage); 1028 } 1029 else 1030 { 1031 // As a fall back switch to the page via the core. 1032 DBG_ASSERT (pUnoDrawView!=NULL, 1033 "SdDrawDocShell::GotoBookmark: can't switch page via API"); 1034 pDrViewSh->SwitchPage(nSdPgNum); 1035 } 1036 delete pUnoDrawView; 1037 1038 1039 if (pObj) 1040 { 1041 // Objekt einblenden und selektieren 1042 pDrViewSh->MakeVisible(pObj->GetLogicRect(), 1043 *pDrViewSh->GetActiveWindow()); 1044 1045 bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj); 1046 1047 1048 } 1049 } 1050 } 1051 1052 return ( bUnMark); 1053 } 1054 //Solution: realize multi-selection of objects 1055 sal_Bool DrawDocShell::GotoTreeBookmark(const String& rBookmark) 1056 { 1057 OSL_TRACE("GotoBookmark %s", 1058 ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); 1059 sal_Bool bFound = sal_False; 1060 1061 if (mpViewShell && mpViewShell->ISA(DrawViewShell)) 1062 { 1063 DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell; 1064 1065 String aBookmark( rBookmark ); 1066 1067 if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') ) 1068 aBookmark = rBookmark.Copy( 1 ); 1069 1070 // Ist das Bookmark eine Seite? 1071 sal_Bool bIsMasterPage; 1072 sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage ); 1073 SdrObject* pObj = NULL; 1074 1075 if (nPgNum == SDRPAGE_NOTFOUND) 1076 { 1077 // Ist das Bookmark ein Objekt? 1078 pObj = mpDoc->GetObj(aBookmark); 1079 1080 if (pObj) 1081 { 1082 nPgNum = pObj->GetPage()->GetPageNum(); 1083 } 1084 } 1085 1086 if (nPgNum != SDRPAGE_NOTFOUND) 1087 { 1088 /********************************************************** 1089 * Zur Seite springen 1090 **********************************************************/ 1091 bFound = sal_True; 1092 SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum); 1093 1094 PageKind eNewPageKind = pPage->GetPageKind(); 1095 1096 if (eNewPageKind != pDrViewSh->GetPageKind()) 1097 { 1098 // Arbeitsbereich wechseln 1099 GetFrameView()->SetPageKind(eNewPageKind); 1100 ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? 1101 mpViewShell->GetViewFrame() : SfxViewFrame::Current() )-> 1102 GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); 1103 1104 // Die aktuelle ViewShell hat sich geaendert! 1105 pDrViewSh = (DrawViewShell*) mpViewShell; 1106 } 1107 1108 EditMode eNewEditMode = EM_PAGE; 1109 1110 if( bIsMasterPage ) 1111 { 1112 eNewEditMode = EM_MASTERPAGE; 1113 } 1114 1115 if (eNewEditMode != pDrViewSh->GetEditMode()) 1116 { 1117 // EditMode setzen 1118 pDrViewSh->ChangeEditMode(eNewEditMode, sal_False); 1119 } 1120 1121 // Jump to the page. This is done by using the API because this 1122 // takes care of all the little things to be done. Especially 1123 // writing the view data to the frame view (see bug #107803#). 1124 sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; 1125 SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( 1126 pDrViewSh->GetViewShellBase().GetDrawController(), 1127 *pDrViewSh, 1128 *pDrViewSh->GetView()); 1129 if (pUnoDrawView != NULL) 1130 { 1131 ::com::sun::star::uno::Reference< 1132 ::com::sun::star::drawing::XDrawPage> xDrawPage ( 1133 pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); 1134 pUnoDrawView->setCurrentPage (xDrawPage); 1135 } 1136 else 1137 { 1138 // As a fall back switch to the page via the core. 1139 DBG_ASSERT (pUnoDrawView!=NULL, 1140 "SdDrawDocShell::GotoBookmark: can't switch page via API"); 1141 pDrViewSh->SwitchPage(nSdPgNum); 1142 } 1143 delete pUnoDrawView; 1144 1145 1146 if (pObj) 1147 { 1148 // Objekt einblenden und selektieren 1149 pDrViewSh->MakeVisible(pObj->GetLogicRect(), 1150 *pDrViewSh->GetActiveWindow()); 1151 sal_Bool bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj); 1152 pDrViewSh->GetView()->MarkObj(pObj, pDrViewSh->GetView()->GetSdrPageView(), bUnMark); 1153 } 1154 } 1155 1156 SfxBindings& rBindings = ( ( mpViewShell && mpViewShell->GetViewFrame() ) ? 1157 mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings(); 1158 1159 rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False); 1160 rBindings.Invalidate(SID_NAVIGATOR_PAGENAME); 1161 } 1162 1163 return (bFound); 1164 } 1165 //-----IAccessibility2 Implementation 2009 1166 /************************************************************************* 1167 |* 1168 |* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll, 1169 |* 1170 \************************************************************************/ 1171 #include <tools/urlobj.hxx> 1172 1173 sal_Bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium ) 1174 { 1175 1176 const SfxFilter* pFilter = rMedium.GetFilter(); 1177 1178 if (pFilter->IsOwnTemplateFormat()) 1179 { 1180 // jetzt die StarDraw-Spezialitaeten: 1181 // die Layoutvorlagen der ersten Seite werden mit dem jetzt 1182 // bekannten Layoutnamen versehen, die Layoutnamen der betroffenen 1183 // Masterpages und Seiten werden gesetzt; 1184 // alle Textobjekte der betroffenen Standard-, Notiz- und 1185 // Masterpages werden ueber die Namensaenderung informiert 1186 1187 String aLayoutName; 1188 1189 SfxStringItem* pLayoutItem; 1190 if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, sal_False, (const SfxPoolItem**) & pLayoutItem ) == SFX_ITEM_SET ) 1191 { 1192 aLayoutName = pLayoutItem->GetValue(); 1193 } 1194 else 1195 { 1196 INetURLObject aURL( rMedium.GetName() ); 1197 aURL.removeExtension(); 1198 aLayoutName = aURL.getName(); 1199 } 1200 1201 if( aLayoutName.Len() ) 1202 { 1203 sal_uInt32 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD); 1204 for(sal_uInt32 i = 0; i < nCount; i++) 1205 { 1206 String aOldPageLayoutName = mpDoc->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName(); 1207 String aNewLayoutName = aLayoutName; 1208 // Don't add suffix for the first master page 1209 if( i > 0 ) 1210 aNewLayoutName += String::CreateFromInt32(i); 1211 1212 mpDoc->RenameLayoutTemplate(aOldPageLayoutName, aNewLayoutName); 1213 } 1214 } 1215 } 1216 1217 return SfxObjectShell::SaveAsOwnFormat(rMedium); 1218 } 1219 1220 /************************************************************************* 1221 |* 1222 |* FillClass 1223 |* 1224 \************************************************************************/ 1225 1226 void DrawDocShell::FillClass(SvGlobalName* pClassName, 1227 sal_uInt32* pFormat, 1228 String* , 1229 String* pFullTypeName, 1230 String* pShortTypeName, 1231 sal_Int32 nFileFormat, 1232 sal_Bool bTemplate /* = sal_False */) const 1233 { 1234 if (nFileFormat == SOFFICE_FILEFORMAT_60) 1235 { 1236 if ( meDocType == DOCUMENT_TYPE_DRAW ) 1237 { 1238 *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60); 1239 *pFormat = SOT_FORMATSTR_ID_STARDRAW_60; 1240 *pFullTypeName = String(SdResId(STR_GRAPHIC_DOCUMENT_FULLTYPE_60)); 1241 } 1242 else 1243 { 1244 *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60); 1245 *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_60; 1246 *pFullTypeName = String(SdResId(STR_IMPRESS_DOCUMENT_FULLTYPE_60)); 1247 } 1248 } 1249 else if (nFileFormat == SOFFICE_FILEFORMAT_8) 1250 { 1251 if ( meDocType == DOCUMENT_TYPE_DRAW ) 1252 { 1253 *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60); 1254 *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE : SOT_FORMATSTR_ID_STARDRAW_8; 1255 *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Draw 8")); // HACK: method will be removed with new storage API 1256 } 1257 else 1258 { 1259 *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60); 1260 *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE : SOT_FORMATSTR_ID_STARIMPRESS_8; 1261 *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Impress 8")); // HACK: method will be removed with new storage API 1262 } 1263 } 1264 1265 *pShortTypeName = String(SdResId( (meDocType == DOCUMENT_TYPE_DRAW) ? 1266 STR_GRAPHIC_DOCUMENT : STR_IMPRESS_DOCUMENT )); 1267 } 1268 1269 OutputDevice* DrawDocShell::GetDocumentRefDev (void) 1270 { 1271 OutputDevice* pReferenceDevice = SfxObjectShell::GetDocumentRefDev (); 1272 // Only when our parent does not have a reference device then we return 1273 // our own. 1274 if (pReferenceDevice == NULL && mpDoc != NULL) 1275 pReferenceDevice = mpDoc->GetRefDevice (); 1276 return pReferenceDevice; 1277 } 1278 1279 /** executes the SID_OPENDOC slot to let the framework open a document 1280 with the given URL and this document as a referer */ 1281 void DrawDocShell::OpenBookmark( const String& rBookmarkURL ) 1282 { 1283 SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL ); 1284 SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() ); 1285 const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, 0 }; 1286 ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs ); 1287 } 1288 1289 //IAccessibility2 Implementation 2009----- 1290 void DrawDocShell::setDocAccTitle( const String& rTitle ) 1291 { 1292 if (mpDoc ) 1293 { 1294 mpDoc->setDocAccTitle( rTitle ); 1295 } 1296 } 1297 const String DrawDocShell::getDocAccTitle() const 1298 { 1299 String sRet; 1300 if (mpDoc) 1301 { 1302 sRet = mpDoc->getDocAccTitle(); 1303 } 1304 1305 return sRet; 1306 } 1307 void DrawDocShell::setDocReadOnly( sal_Bool bReadOnly) 1308 { 1309 if (mpDoc ) 1310 { 1311 mpDoc->setDocReadOnly( bReadOnly ); 1312 } 1313 } 1314 sal_Bool DrawDocShell::getDocReadOnly() const 1315 { 1316 if (mpDoc) 1317 { 1318 return mpDoc->getDocReadOnly(); 1319 } 1320 1321 return sal_False; 1322 } 1323 //-----IAccessibility2 Implementation 2009 1324 } // end of namespace sd 1325