View | Details | Raw Unified | Return to issue 51154
Collapse All | Expand All

(-)sfx2/source.orig/appl/sfxpicklist.cxx (-23 / +50 lines)
Lines 391-409 Link Here
391
			}
391
			}
392
            break;
392
            break;
393
393
394
            case SFX_EVENT_OPENDOC:
394
            case SFX_EVENT_SAVEASDOCDONE:
395
            {
395
            {
396
                SfxMedium *pMed = pDocSh->GetMedium();
396
                SfxMedium *pMed = pDocSh->GetMedium();
397
                if( !pMed )
397
                if( !pMed )
398
                    return;
398
                    return;
399
399
400
                // unbenannt-Docs und embedded-Docs nicht in History
400
                // embedded docs should not be saved to history
401
                if ( !pDocSh->HasName() ||
401
                if ( SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() )
402
                     SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() )
403
                    return;
402
                    return;
404
403
405
                // Hilfe nicht in History
404
                // Help documents are not saved to history
406
				INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) );
405
                INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) );
407
                if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP )
406
                if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP )
408
                    return;
407
                    return;
409
408
Lines 413-443 Link Here
413
                if ( pFilter )
412
                if ( pFilter )
414
                    aFilter = pFilter->GetFilterName();
413
                    aFilter = pFilter->GetFilterName();
415
414
415
                // Now add into picklist (File->Recent Documents) if required
416
417
                // add no document that forbids this (for example Message-Body)
418
                SFX_ITEMSET_ARG( pMed->GetItemSet(), pPicklistItem, SfxBoolItem, SID_PICKLIST, sal_False );
419
                if (
420
                    (pPicklistItem && !pPicklistItem->GetValue()) ||
421
                    (!(pDocSh->Get_Impl()->bWaitingForPicklist) )
422
                   )
423
                    return;
424
425
                // ignore hidden documents
426
                if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) )
427
                    return;
428
416
                // add to svtool history options
429
                // add to svtool history options
417
                SvtHistoryOptions().AppendItem( eHISTORY,
430
                SvtHistoryOptions().AppendItem( ePICKLIST,
418
                        aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
431
                        aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
419
                        aFilter,
432
                        aFilter,
420
                        aTitle,
433
                        aTitle,
421
                        SfxStringEncode( aURL.GetPass() ) );
434
                        SfxStringEncode( aURL.GetPass() ) );
435
436
                pDocSh->Get_Impl()->bWaitingForPicklist = sal_False;
437
438
                if ( aURL.GetProtocol() == INET_PROT_FILE )
439
                    SystemShell::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() );
422
            }
440
            }
423
            break;
441
            break;
424
442
425
			case SFX_EVENT_CLOSEDOC:
443
            case SFX_EVENT_OPENDOC:
426
			{
444
            {
427
				SfxMedium *pMed = pDocSh->GetMedium();
445
                SfxMedium *pMed = pDocSh->GetMedium();
428
				if( !pMed )
446
                if( !pMed )
429
					return;
447
                    return;
430
448
431
				// unbenannt-Docs und embedded-Docs nicht in Pickliste
449
                // untitled and embedded docs should not be saved to history
432
				if ( !pDocSh->HasName() ||
450
                if ( !pDocSh->HasName() ||
433
					 SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() )
451
                     SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() )
434
					return;
452
                    return;
435
453
436
                // Hilfe nicht in History
454
                // Help documents are not saved to history
437
				INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) );
455
				INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) );
438
                if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP )
456
                if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP )
439
                    return;
457
                    return;
440
458
459
                ::rtl::OUString  aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST);
460
                ::rtl::OUString  aFilter;
461
                const SfxFilter* pFilter = pMed->GetOrigFilter();
462
                if ( pFilter )
463
                    aFilter = pFilter->GetFilterName();
464
465
                // add to svtool history options
466
                SvtHistoryOptions().AppendItem( eHISTORY,
467
                        aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
468
                        aFilter,
469
                        aTitle,
470
                        SfxStringEncode( aURL.GetPass() ) );
471
472
                // Now add into picklist (File->Recent Documents) if required
473
441
                // only add r/w document into picklist
474
                // only add r/w document into picklist
442
                if ( pDocSh->IsReadOnly() || !pMed->IsUpdatePickList() )
475
                if ( pDocSh->IsReadOnly() || !pMed->IsUpdatePickList() )
443
                    return;
476
                    return;
Lines 454-465 Link Here
454
                if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) )
487
                if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) )
455
                    return;
488
                    return;
456
489
457
                ::rtl::OUString	 aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST);
458
                ::rtl::OUString	 aFilter;
459
                const SfxFilter* pFilter = pMed->GetOrigFilter();
460
                if ( pFilter )
461
                    aFilter = pFilter->GetFilterName();
462
463
                // add to svtool history options
490
                // add to svtool history options
464
                SvtHistoryOptions().AppendItem( ePICKLIST,
491
                SvtHistoryOptions().AppendItem( ePICKLIST,
465
                        aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
492
                        aURL.GetURLNoPass( INetURLObject::NO_DECODE ),

Return to issue 51154