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

(-)officecfg/registry/schema/org/openoffice/Office/Common.xcs (+54 lines)
Lines 5297-5302 Dymamic border coloring means that when Link Here
5297
						<value>true</value>
5297
						<value>true</value>
5298
					</prop>
5298
					</prop>
5299
					<!-- END PDF Encryption -->
5299
					<!-- END PDF Encryption -->
5300
                                        <!-- PDF Relative Link -->
5301
					<prop oor:name="SaveLinksRelativeFsys" oor:type="xs:boolean">
5302
						<info>
5303
							<author>beppec56</author>
5304
							<desc>Specifies that the file ssytem related links (file://) present in the document will be exported relative to the source document location.</desc>
5305
						</info>
5306
						<value>false</value>
5307
					</prop>
5308
					<prop oor:name="DefaultPDFLinkAction" oor:type="xs:int">
5309
						<info>
5310
							<author>beppec56</author>
5311
							<desc>Specifies the default behavior of a link exported in PDF</desc>
5312
						</info>
5313
						<constraints>
5314
							<enumeration oor:value="0">
5315
								<info>
5316
									<desc>Open as URI action.</desc>
5317
								</info>
5318
							</enumeration>
5319
							<enumeration oor:value="1">
5320
								<info>
5321
									<desc>Open using the application.</desc>
5322
								</info>
5323
							</enumeration>
5324
							<enumeration oor:value="2">
5325
								<info>
5326
									<desc>Open with PDF reader action (GoToR).</desc>
5327
								</info>
5328
							</enumeration>
5329
						</constraints>
5330
						<value>0</value>
5331
					</prop>
5332
					<prop oor:name="ConvertOOoTargetToPDFTarget" oor:type="xs:boolean">
5333
						<info>
5334
							<author>beppec56</author>
5335
							<desc>.</desc>
5336
						</info>
5337
						<value>false</value>
5338
					</prop>
5339
					<prop oor:name="ForceGoToRAsPDFAction" oor:type="xs:boolean">
5340
						<info>
5341
							<author>beppec56</author>
5342
							<desc>.</desc>
5343
						</info>
5344
						<value>false</value>
5345
					</prop>
5346
					<prop oor:name="ExportBookmarksToPDFDestination" oor:type="xs:boolean">
5347
						<info>
5348
							<author>beppec56</author>
5349
							<desc>Specifies that the bookmarks contained in the source OpenOffice,org file should be exportet to the PDF file as Named Destination (see PDF 1.4 section 8.2.1).</desc>
5350
						</info>
5351
						<value>false</value>
5352
					</prop>
5353
                                        <!-- END PDF Relative Link -->
5300
				</group>
5354
				</group>
5301
			</group>
5355
			</group>
5302
		</group>
5356
		</group>
(-)vcl/inc/vcl/pdfextoutdevdata.hxx (+26 lines)
Lines 86-91 class VCL_DLLPUBLIC PDFExtOutDevData : p Link Here
86
	sal_Bool					mbReduceImageResolution;
86
	sal_Bool					mbReduceImageResolution;
87
    sal_Bool                    mbExportFormFields;
87
    sal_Bool                    mbExportFormFields;
88
    sal_Bool                    mbExportBookmarks;
88
    sal_Bool                    mbExportBookmarks;
89
    sal_Bool                    mbExportNDests;
89
	sal_Int32					mnFormsFormat;
90
	sal_Int32					mnFormsFormat;
90
	sal_Int32					mnPage;
91
	sal_Int32					mnPage;
91
92
Lines 125-130 public : Link Here
125
    sal_Bool    GetIsExportBookmarks() const;
126
    sal_Bool    GetIsExportBookmarks() const;
126
    void        SetIsExportBookmarks( const sal_Bool bExportBookmarks );
127
    void        SetIsExportBookmarks( const sal_Bool bExportBookmarks );
127
128
129
    sal_Bool    GetIsExportNamedDestinations() const;
130
    void        SetIsExportNamedDestinations( const sal_Bool bExportNDests );
131
    
128
	// PageNumber, Compression is being set by the PDFExport
132
	// PageNumber, Compression is being set by the PDFExport
129
	sal_Int32	GetCurrentPageNumber() const;
133
	sal_Int32	GetCurrentPageNumber() const;
130
	void		SetCurrentPageNumber( const sal_Int32 nPage );
134
	void		SetCurrentPageNumber( const sal_Int32 nPage );
Lines 178-183 public : Link Here
178
                          const Rectangle& 	rOutputRect,
182
                          const Rectangle& 	rOutputRect,
179
                          const Rectangle& 	rVisibleOutputRect );
183
                          const Rectangle& 	rVisibleOutputRect );
180
184
185
    /** Create a new named destination to be used in a link to this document from another PDF document
186
 (see PDF spec 1.4, 8.2.1)
187
 
188
    @parm sDestName
189
    the name this destination will be addressed with from others PDF document
190
191
    @param rRect
192
    target rectangle on page to be displayed if dest is jumped to
193
    
194
    @param nPageNr
195
    number of page the dest is on (as returned by NewPage)
196
    or -1 in which case the current page is used
197
198
    @param eType
199
    what dest type to use
200
201
    @returns
202
    the destination id (to be used in SetLinkDest) or
203
    -1 if page id does not exist
204
    */
205
	sal_Int32 CreateNamedDest( const String& sDestName,  const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
206
    
181
    /** Create a new destination to be used in a link
207
    /** Create a new destination to be used in a link
182
208
183
    @param rRect
209
    @param rRect
(-)vcl/inc/vcl/pdfwriter.hxx (+48 lines)
Lines 477-482 public: Link Here
477
        ContinuousFacing
477
        ContinuousFacing
478
    };
478
    };
479
479
480
    // These emuns are treated as integer while reading/writing to configuration
481
    //what default action to generate in a PDF hyperlink to external document/site
482
    enum PDFLinkDefaultAction
483
    {
484
        URIAction,
485
        LaunchAction,
486
        GoToRAction
487
    };
488
480
/*
489
/*
481
The following structure describes the permissions used in PDF security
490
The following structure describes the permissions used in PDF security
482
 */
491
 */
Lines 509-514 The following structure describes the pe Link Here
509
    {
518
    {
510
        /* must be a valid file: URL usable by osl */
519
        /* must be a valid file: URL usable by osl */
511
        rtl::OUString					URL;
520
        rtl::OUString					URL;
521
        /* the URL of the document being exported, used for relative links*/
522
        rtl::OUString					BaseURL;
523
        /*if relative to file system should be formed*/
524
        bool                            RelFsys;
525
        /*if relative to Internet should be formed*/		
526
        bool                            RelInet;
527
        /*the action to set the PDF hyperlink to*/
528
        PDFWriter::PDFLinkDefaultAction DefaultLinkAction;
529
        //convert the .od? target file type in a link to a .pdf type
530
        //this is examined before doing anything else
531
        bool                            ConvertOOoTargetToPDFTarget;
532
        //when the file type is .pdf, force the GoToR action
533
        bool                            ForcePDFAction;
534
        
512
        /* decides the PDF language level to be produced */
535
        /* decides the PDF language level to be produced */
513
        PDFVersion						Version;
536
        PDFVersion						Version;
514
        /* valid for PDF >= 1.4
537
        /* valid for PDF >= 1.4
Lines 553-558 The following structure describes the pe Link Here
553
		rtl::OUString					UserPassword; // user password for PDF, in clear text
576
		rtl::OUString					UserPassword; // user password for PDF, in clear text
554
577
555
        PDFWriterContext() :
578
        PDFWriterContext() :
579
                RelFsys( false ),
580
                RelInet( false ),
581
                DefaultLinkAction( PDFWriter::URIAction ),
582
                ConvertOOoTargetToPDFTarget( false ),
583
                ForcePDFAction( false ),
556
                Version( PDFWriter::PDF_1_4 ),
584
                Version( PDFWriter::PDF_1_4 ),
557
                Tagged( false ),
585
                Tagged( false ),
558
                SubmitFormat( PDFWriter::FDF ),
586
                SubmitFormat( PDFWriter::FDF ),
Lines 797-802 The following structure describes the pe Link Here
797
    */
825
    */
798
    void				DrawJPGBitmap( SvStream& rJPGData, bool bIsTrueColor, const Size& rSrcSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask );
826
    void				DrawJPGBitmap( SvStream& rJPGData, bool bIsTrueColor, const Size& rSrcSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask );
799
827
828
    /** Create a new named destination to be used in a link from another PDF document
829
830
    @parm sDestName
831
    the name (label) of the bookmark, to be used to jump to
832
833
    @param rRect
834
    target rectangle on page to be displayed if dest is jumped to
835
    
836
    @param nPageNr
837
    number of page the dest is on (as returned by NewPage)
838
    or -1 in which case the current page is used
839
840
    @param eType
841
    what dest type to use
842
843
    @returns
844
    the destination id (to be used in SetLinkDest) or
845
    -1 if page id does not exist
846
    */
847
    sal_Int32			CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ );
800
    /** Create a new destination to be used in a link
848
    /** Create a new destination to be used in a link
801
849
802
    @param rRect
850
    @param rRect
(-)vcl/source/gdi/pdfextoutdevdata.cxx (-1 / +37 lines)
Lines 57-63 namespace vcl Link Here
57
{
57
{
58
struct PDFExtOutDevDataSync
58
struct PDFExtOutDevDataSync
59
{
59
{
60
    enum Action{	CreateDest,
60
    enum Action{    CreateNamedDest,
61
                    CreateDest,
61
					CreateLink,
62
					CreateLink,
62
					SetLinkDest,
63
					SetLinkDest,
63
					SetLinkURL,
64
					SetLinkURL,
Lines 159-164 void GlobalSyncData::PlayGlobalActions( Link Here
159
	{
160
	{
160
		switch( *aIter )
161
		switch( *aIter )
161
		{
162
		{
163
        case PDFExtOutDevDataSync::CreateNamedDest : //i56629
164
			{
165
 				rWriter.Push( PUSH_MAPMODE );
166
				rWriter.SetMapMode( mParaMapModes.front() );
167
				mParaMapModes.pop_front();
168
				mParaIds.push_back( rWriter.CreateNamedDest( mParaOUStrings.front(), mParaRects.front(), mParaInts.front(), mParaDestAreaTypes.front() ) );
169
                mParaOUStrings.pop_front();
170
				mParaRects.pop_front();
171
				mParaInts.pop_front();
172
				mParaDestAreaTypes.pop_front();
173
				rWriter.Pop();
174
			}
175
			break;
162
			case PDFExtOutDevDataSync::CreateDest :
176
			case PDFExtOutDevDataSync::CreateDest :
163
			{
177
			{
164
				rWriter.Push( PUSH_MAPMODE );
178
				rWriter.Push( PUSH_MAPMODE );
Lines 454-459 sal_Bool PageSyncData::PlaySyncPageAct( Link Here
454
				}
468
				}
455
			}
469
			}
456
			break;
470
			break;
471
            case PDFExtOutDevDataSync::CreateNamedDest:
457
            case PDFExtOutDevDataSync::CreateDest:
472
            case PDFExtOutDevDataSync::CreateDest:
458
            case PDFExtOutDevDataSync::CreateLink:
473
            case PDFExtOutDevDataSync::CreateLink:
459
            case PDFExtOutDevDataSync::SetLinkDest:
474
            case PDFExtOutDevDataSync::SetLinkDest:
Lines 484-489 PDFExtOutDevData::PDFExtOutDevData( cons Link Here
484
	mbTransitionEffects		( sal_True ),
499
	mbTransitionEffects		( sal_True ),
485
	mbUseLosslessCompression( sal_True ),
500
	mbUseLosslessCompression( sal_True ),
486
	mbReduceImageResolution	( sal_False ),
501
	mbReduceImageResolution	( sal_False ),
502
    mbExportNDests          ( sal_False ),
487
	mnFormsFormat			( 0 ),
503
	mnFormsFormat			( 0 ),
488
	mnPage					( -1 ),
504
	mnPage					( -1 ),
489
	mpPageSyncData			( NULL ),
505
	mpPageSyncData			( NULL ),
Lines 574-579 std::vector< PDFExtOutDevBookmarkEntry > Link Here
574
{
590
{
575
	return maBookmarks;
591
	return maBookmarks;
576
}
592
}
593
sal_Bool PDFExtOutDevData::GetIsExportNamedDestinations() const
594
{
595
    return mbExportNDests;
596
}
597
void PDFExtOutDevData::SetIsExportNamedDestinations( const sal_Bool bExportNDests )
598
{
599
    mbExportNDests = bExportNDests;
600
}
577
void PDFExtOutDevData::ResetSyncData()
601
void PDFExtOutDevData::ResetSyncData()
578
{
602
{
579
	*mpPageSyncData = PageSyncData( mpGlobalSyncData );
603
	*mpPageSyncData = PageSyncData( mpGlobalSyncData );
Lines 590-595 void PDFExtOutDevData::PlayGlobalActions Link Here
590
/* global actions, syncronisation to the recorded metafile isn't needed,
614
/* global actions, syncronisation to the recorded metafile isn't needed,
591
   all actions will be played after the last page was recorded
615
   all actions will be played after the last page was recorded
592
*/
616
*/
617
//--->i56629
618
sal_Int32 PDFExtOutDevData::CreateNamedDest(const String& sDestName,  const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
619
{
620
    mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateNamedDest );    
621
    mpGlobalSyncData->mParaOUStrings.push_back( sDestName );
622
    mpGlobalSyncData->mParaRects.push_back( rRect );
623
    mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
624
    mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
625
    mpGlobalSyncData->mParaDestAreaTypes.push_back( eType );
626
    return mpGlobalSyncData->mCurId++;
627
}
628
//<---
593
sal_Int32 PDFExtOutDevData::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
629
sal_Int32 PDFExtOutDevData::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
594
{
630
{
595
	mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest );
631
	mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest );
(-)vcl/source/gdi/pdfwriter.cxx (-1 / +6 lines)
Lines 419-425 sal_Int32 PDFWriter::CreateLink( const R Link Here
419
{
419
{
420
    return ((PDFWriterImpl*)pImplementation)->createLink( rRect, nPageNr );
420
    return ((PDFWriterImpl*)pImplementation)->createLink( rRect, nPageNr );
421
}
421
}
422
422
//--->i56629
423
sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
424
{
425
    return ((PDFWriterImpl*)pImplementation)->createNamedDest( sDestName, rRect, nPageNr, eType );
426
}
427
//<---
423
sal_Int32 PDFWriter::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
428
sal_Int32 PDFWriter::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
424
{
429
{
425
    return ((PDFWriterImpl*)pImplementation)->createDest( rRect, nPageNr, eType );
430
    return ((PDFWriterImpl*)pImplementation)->createDest( rRect, nPageNr, eType );
(-)vcl/source/gdi/pdfwriter_impl.cxx (-3 / +228 lines)
Lines 48-53 Link Here
48
#include <tools/debug.hxx>
48
#include <tools/debug.hxx>
49
#include <tools/zcodec.hxx>
49
#include <tools/zcodec.hxx>
50
#include <tools/stream.hxx>
50
#include <tools/stream.hxx>
51
52
#include <tools/urlobj.hxx> //for relative url
53
51
#include <vcl/virdev.hxx>
54
#include <vcl/virdev.hxx>
52
#include <vcl/bmpacc.hxx>
55
#include <vcl/bmpacc.hxx>
53
#include <vcl/bitmapex.hxx>
56
#include <vcl/bitmapex.hxx>
Lines 3849-3856 bool PDFWriterImpl::emitLinkAnnotations( Link Here
3849
        }
3852
        }
3850
        else
3853
        else
3851
        {
3854
        {
3852
            aLine.append( "/A<</Type/Action/S/URI/URI" );
3855
/*--->i56629
3853
            appendLiteralStringEncrypt( rLink.m_aURL, rLink.m_nObject, aLine );
3856
destination is external to the document, so
3857
we check in the following sequence:
3858
3859
 if target type is neither .pdf, nor .od?, nor then
3860
          check if relative or absolute and act accordingly (URI or 'launch application' as requested)
3861
                             end processing
3862
 else if target is .od[tpd]: then
3863
      if conversion of type from od[tpd]  to pdf is requested, convert it and this becomes the new target file
3864
      processing continue
3865
      
3866
 if (new)target is .pdf : then
3867
     if GotToR is requested, then
3868
           convert the target in GoToR where the fragment of the URI is
3869
           considered the named destination in the target file, set relative or absolute as requested
3870
     else strip the fragment from URL and then set URI or 'launch application' as requested
3871
*/
3872
//FIXME: check if the decode mechanism for URL processing is the correct one!!
3873
//extract target file type
3874
            INetURLObject aUrlObj( m_aContext.BaseURL );
3875
            INetURLObject aTargetURL( rLink.m_aURL );
3876
            sal_Int32   nChangeFileExtensionToPDF = 0;
3877
            sal_Int32   nSetGoToRMode = 0;
3878
            rtl::OUString aFileExtension = aTargetURL.GetFileExtension();
3879
            if( aFileExtension.getLength() > 0 )
3880
            {
3881
                if( m_aContext.ConvertOOoTargetToPDFTarget )
3882
                {
3883
//examine the file type (.odt. .odp, odg, ods
3884
                    if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odt" ) ) ) )
3885
                        nChangeFileExtensionToPDF++;
3886
                    else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odp" ) ) ) )
3887
                        nChangeFileExtensionToPDF++;
3888
                    else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odg" ) ) ) )
3889
                        nChangeFileExtensionToPDF++;
3890
                    else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ods" ) ) ) )
3891
                        nChangeFileExtensionToPDF++;
3892
                    if( nChangeFileExtensionToPDF )
3893
                        aTargetURL.setExtension(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) );
3894
                }
3895
//check if extension is pdf, see if GoToR should be forced
3896
                if( m_aContext.ForcePDFAction&&
3897
                          aTargetURL.GetFileExtension().equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) ) )
3898
                    nSetGoToRMode++;
3899
            }
3900
//prepare the URL, if relative or not            
3901
            INetProtocol eBaseProtocol = aUrlObj.GetProtocol();
3902
            INetProtocol eTargetProtocol = aTargetURL.GetProtocol();
3903
//queue the string common to all types of actions            
3904
            aLine.append( "/A<</Type/Action/S");
3905
            sal_Int32 nSetRelative = 0;
3906
//check if relative file link is requested and if the protocol is 'file://'
3907
            if( m_aContext.RelFsys && eBaseProtocol == eTargetProtocol && eTargetProtocol == INET_PROT_FILE )
3908
                nSetRelative++;
3909
3910
            if( nSetGoToRMode == 0 )
3911
                switch( m_aContext.DefaultLinkAction )
3912
                {
3913
                default:
3914
                case PDFWriter::URIAction :
3915
					aLine.append( "/URI/URI" );
3916
                    break;
3917
                case PDFWriter::LaunchAction:
3918
                    aLine.append( "/Launch/F" );
3919
                    break;
3920
                case PDFWriter::GoToRAction:
3921
                    nSetGoToRMode++;
3922
                    break;
3923
                }
3924
            if( nSetGoToRMode )
3925
            {//add the fragment
3926
                rtl::OUString aFragment = aTargetURL.GetMark( INetURLObject::NO_DECODE /*DECODE_WITH_CHARSET*/ ); //fragment as is,
3927
                //the same coding as in the Named destination processing
3928
                rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET );
3929
                aLine.append("/GoToR");
3930
                if( aFragment.getLength() > 0 )
3931
                {
3932
                    aLine.append("/D/");
3933
                    appendName( aFragment , aLine );
3934
                }
3935
                aLine.append("/F");
3936
                appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark ) :
3937
                                                               aURLNoMark, rLink.m_nObject, aLine );
3938
            }            
3939
            else
3940
            {
3941
                rtl::OUString aURL = aTargetURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET );
3942
                appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL ) :
3943
                                                               aURL , rLink.m_nObject, aLine );
3944
            }
3945
//<---
3854
            aLine.append( ">>\n" );
3946
            aLine.append( ">>\n" );
3855
        }
3947
        }
3856
        if( rLink.m_nStructParent > 0 )
3948
        if( rLink.m_nStructParent > 0 )
Lines 4817-4822 bool PDFWriterImpl::emitCatalog() Link Here
4817
        if( ! it->emit( nTreeNode ) )
4909
        if( ! it->emit( nTreeNode ) )
4818
            return false;
4910
            return false;
4819
4911
4912
    sal_Int32 nNamedDestinationsDictionary = emitNamedDestinations();
4913
    
4820
    sal_Int32 nOutlineDict = emitOutline();
4914
    sal_Int32 nOutlineDict = emitOutline();
4821
4915
4822
    sal_Int32 nStructureDict = 0;
4916
    sal_Int32 nStructureDict = 0;
Lines 4882-4888 bool PDFWriterImpl::emitCatalog() Link Here
4882
                  "<</Type/Catalog/Pages " );
4976
                  "<</Type/Catalog/Pages " );
4883
    aLine.append( nTreeNode );
4977
    aLine.append( nTreeNode );
4884
    aLine.append( " 0 R\n" );
4978
    aLine.append( " 0 R\n" );
4885
4979
//--->i56629    
4980
//check if there are named destinations to emit (root must be inside the catalog)
4981
    if( nNamedDestinationsDictionary )
4982
    {
4983
        aLine.append("/Dests ");
4984
        aLine.append( nNamedDestinationsDictionary );
4985
        aLine.append( " 0 R\n" );
4986
    }
4987
    
4886
    if( m_aContext.PageLayout != PDFWriter::DefaultLayout )
4988
    if( m_aContext.PageLayout != PDFWriter::DefaultLayout )
4887
        switch(  m_aContext.PageLayout )
4989
        switch(  m_aContext.PageLayout )
4888
        {
4990
        {
Lines 5103-5108 sal_Int32 PDFWriterImpl::emitInfoDict( ) Link Here
5103
    return nObject;
5205
    return nObject;
5104
}
5206
}
5105
5207
5208
//--->i56629
5209
// part of this it may be shared with method appendDest
5210
//
5211
sal_Int32 PDFWriterImpl::emitNamedDestinations()
5212
{
5213
    sal_Int32  nCount = m_aNamedDests.size();
5214
    if( nCount <= 0 )
5215
        return 0;//define internal error
5216
    
5217
//get the object number for all the destinations
5218
    sal_Int32 nObject = createObject();
5219
5220
    if( updateObject( nObject ) )
5221
    {
5222
//emit the dictionary        
5223
        OStringBuffer aLine( 1024 );
5224
        aLine.append( nObject );
5225
        aLine.append( " 0 obj\n"
5226
                      "<<" );
5227
5228
        sal_Int32  nDestID;
5229
        for( nDestID = 0; nDestID < nCount; nDestID++ )
5230
        {
5231
5232
            const PDFNamedDest& rDest   = m_aNamedDests[ nDestID ];
5233
// In order to correctly function both under an Internet browser and directly with a reader (provided the reader has
5234
// the feature) we need to set the name of the destination the same way it will be encoded
5235
// in an Internet link
5236
            INetURLObject aLocalURL( OUString( RTL_CONSTASCII_USTRINGPARAM( "http://ahost.ax" ) ) ); //dummy location, won't be used
5237
            aLocalURL.SetMark( rDest.m_aDestName );
5238
5239
            const rtl::OUString aName   = aLocalURL.GetMark( INetURLObject::NO_DECODE ); //same coding as
5240
            // in link creation ( see PDFWriterImpl::emitLinkAnnotations )
5241
            const PDFPage& rDestPage    = m_aPages[ rDest.m_nPage ];
5242
            
5243
            aLine.append( '/' );
5244
            appendName( aName, aLine ); // this conversion must be done wen using link to target ( see in emitCatalog )
5245
            aLine.append(' '); //verificare !!
5246
            aLine.append( '[' );
5247
            aLine.append( rDestPage.m_nPageObject );
5248
            aLine.append( " 0 R" );
5249
5250
            switch( rDest.m_eType )
5251
            {
5252
            case PDFWriter::XYZ:
5253
            default:
5254
                aLine.append( "/XYZ " );
5255
                appendFixedInt( rDest.m_aRect.Left(), aLine );
5256
                aLine.append( ' ' );
5257
                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
5258
                aLine.append( " 0" );
5259
                break;
5260
            case PDFWriter::Fit:
5261
                aLine.append( "/Fit" );
5262
                break;
5263
            case PDFWriter::FitRectangle:
5264
                aLine.append( "/FitR " );
5265
                appendFixedInt( rDest.m_aRect.Left(), aLine );
5266
                aLine.append( ' ' );
5267
                appendFixedInt( rDest.m_aRect.Top(), aLine );
5268
                aLine.append( ' ' );
5269
                appendFixedInt( rDest.m_aRect.Right(), aLine );
5270
                aLine.append( ' ' );
5271
                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
5272
                break;
5273
            case PDFWriter::FitHorizontal:
5274
                aLine.append( "/FitH " );
5275
                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
5276
                break;
5277
            case PDFWriter::FitVertical:
5278
                aLine.append( "/FitV " );
5279
                appendFixedInt( rDest.m_aRect.Left(), aLine );
5280
                break;
5281
            case PDFWriter::FitPageBoundingBox:
5282
                aLine.append( "/FitB" );
5283
                break;
5284
            case PDFWriter::FitPageBoundingBoxHorizontal:
5285
                aLine.append( "/FitBH " );
5286
                appendFixedInt( rDest.m_aRect.Bottom(), aLine );
5287
                break;
5288
            case PDFWriter::FitPageBoundingBoxVertical:
5289
                aLine.append( "/FitBV " );
5290
                appendFixedInt( rDest.m_aRect.Left(), aLine );
5291
                break;
5292
            }
5293
            aLine.append( ']' );
5294
5295
        }
5296
//close
5297
        aLine.append( ">>\nendobj\n\n" );
5298
        if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
5299
            nObject = 0; 
5300
    }
5301
    else
5302
        nObject = 0;
5303
5304
    return nObject;
5305
}
5306
//<---
5307
5106
bool PDFWriterImpl::emitTrailer()
5308
bool PDFWriterImpl::emitTrailer()
5107
{
5309
{
5108
    // emit doc info
5310
    // emit doc info
Lines 9221-9226 sal_Int32 PDFWriterImpl::createLink( con Link Here
9221
    return nRet;
9423
    return nRet;
9222
}
9424
}
9223
9425
9426
//--->i56629
9427
sal_Int32 PDFWriterImpl::createNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
9428
{
9429
    if( nPageNr < 0 )
9430
        nPageNr = m_nCurrentPage;
9431
9432
    if( nPageNr < 0 || nPageNr >= (sal_Int32)m_aPages.size() )
9433
        return -1;
9434
9435
    sal_Int32 nRet = m_aNamedDests.size();
9436
9437
    m_aNamedDests.push_back( PDFNamedDest() );
9438
    m_aNamedDests.back().m_aDestName = sDestName;
9439
    m_aNamedDests.back().m_nPage = nPageNr;
9440
    m_aNamedDests.back().m_eType = eType;
9441
    m_aNamedDests.back().m_aRect = rRect;
9442
    // convert to default user space now, since the mapmode may change
9443
    m_aPages[nPageNr].convertRect( m_aNamedDests.back().m_aRect );
9444
9445
    return nRet;
9446
}
9447
//<---
9448
9224
sal_Int32 PDFWriterImpl::createDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
9449
sal_Int32 PDFWriterImpl::createDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType )
9225
{
9450
{
9226
    if( nPageNr < 0 )
9451
    if( nPageNr < 0 )
(-)vcl/source/gdi/pdfwriter_impl.hxx (+18 lines)
Lines 364-369 public: Link Here
364
        Rectangle					m_aRect;
364
        Rectangle					m_aRect;
365
    };
365
    };
366
366
367
    struct PDFNamedDest
368
    {
369
        rtl::OUString               m_aDestName;
370
        sal_Int32					m_nPage;
371
        PDFWriter::DestAreaType		m_eType;
372
        Rectangle					m_aRect;
373
    };
374
367
    struct PDFOutlineEntry
375
    struct PDFOutlineEntry
368
    {
376
    {
369
        sal_Int32					m_nParentID;
377
        sal_Int32					m_nParentID;
Lines 580-585 private: Link Here
580
    std::list< BitmapEmit >				m_aBitmaps;
588
    std::list< BitmapEmit >				m_aBitmaps;
581
    /* contains JPG streams until written to file     */
589
    /* contains JPG streams until written to file     */
582
    std::list<JPGEmit>					m_aJPGs;
590
    std::list<JPGEmit>					m_aJPGs;
591
    /*--->i56629 contains all named dests ever set during the PDF creation,
592
       dest id is always the dest's position in this vector
593
     */
594
    std::vector<PDFNamedDest>		    m_aNamedDests;
595
    //<---
583
    /* contains all dests ever set during the PDF creation,
596
    /* contains all dests ever set during the PDF creation,
584
       dest id is always the dest's position in this vector
597
       dest id is always the dest's position in this vector
585
     */
598
     */
Lines 958-963 i12626 Link Here
958
    bool emitAnnotations();
971
    bool emitAnnotations();
959
    // writes the dest dict for the catalog
972
    // writes the dest dict for the catalog
960
    sal_Int32 emitDestDict();
973
    sal_Int32 emitDestDict();
974
    //write the named destination stuff
975
    sal_Int32 emitNamedDestinations();
961
    // writes outline dict and tree
976
    // writes outline dict and tree
962
    sal_Int32 emitOutline();
977
    sal_Int32 emitOutline();
963
    // puts the attribute objects of a structure element into the returned string,
978
    // puts the attribute objects of a structure element into the returned string,
Lines 1213-1218 public: Link Here
1213
1228
1214
    void emitComment( const char* pComment );
1229
    void emitComment( const char* pComment );
1215
1230
1231
    //named destinations
1232
    sal_Int32 createNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
1233
1216
    // links
1234
    // links
1217
    sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
1235
    sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 );
1218
    sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
1236
    sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ );
(-)filter/source/pdf/impdialog.cxx (-1 / +120 lines)
Lines 133-139 ImpPDFTabDialog::ImpPDFTabDialog( Window Link Here
133
    mbIsRangeChecked( sal_False ),
133
    mbIsRangeChecked( sal_False ),
134
    msPageRange( ' ' ),
134
    msPageRange( ' ' ),
135
135
136
    mbSelectionIsChecked( sal_False )
136
    mbSelectionIsChecked( sal_False ),
137
	mbSaveRelativeFsysLinks( sal_False ),
138
    mbOpnDefaultMode( 0 ),
139
    mbConvertOOoTargets( sal_False ),
140
    mbForcePDFAction( sal_False ),
141
    mbExportBmkToPDFDestination( sal_False )
137
{
142
{
138
    FreeResource();
143
    FreeResource();
139
    mprResMgr = &rResMgr;
144
    mprResMgr = &rResMgr;
Lines 239-245 ImpPDFTabDialog::ImpPDFTabDialog( Window Link Here
239
    mbCanCopyOrExtract = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), sal_True );
244
    mbCanCopyOrExtract = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), sal_True );
240
    mbCanExtractForAccessibility = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), sal_True );
245
    mbCanExtractForAccessibility = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), sal_True );
241
246
247
//prepare values for relative links
248
	mbSaveRelativeFsysLinks = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "SaveLinksRelativeFsys" ) ), sal_False );
249
    
250
	mbOpnDefaultMode = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultPDFLinkAction" ) ), 0 );
251
    
252
    mbConvertOOoTargets = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), sal_False );
253
    mbForcePDFAction = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ForceGoToRAsPDFAction" ) ), sal_False );
254
    mbExportBmkToPDFDestination = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), sal_False );
255
242
//queue the tab pages for later creation (created when first shown)
256
//queue the tab pages for later creation (created when first shown)
257
	AddTabPage( RID_PDF_TAB_RELLINK, ImpPDFTabRelativeLinkPage::Create, 0 );   
243
    AddTabPage( RID_PDF_TAB_SECURITY, ImpPDFTabSecurityPage::Create, 0 );
258
    AddTabPage( RID_PDF_TAB_SECURITY, ImpPDFTabSecurityPage::Create, 0 );
244
    AddTabPage( RID_PDF_TAB_VPREFER, ImpPDFTabViewerPage::Create, 0 );
259
    AddTabPage( RID_PDF_TAB_VPREFER, ImpPDFTabViewerPage::Create, 0 );
245
    AddTabPage( RID_PDF_TAB_OPNFTR, ImpPDFTabOpnFtrPage::Create, 0 );
260
    AddTabPage( RID_PDF_TAB_OPNFTR, ImpPDFTabOpnFtrPage::Create, 0 );
Lines 269-274 ImpPDFTabDialog::~ImpPDFTabDialog() Link Here
269
    RemoveTabPage( RID_PDF_TAB_VPREFER );
284
    RemoveTabPage( RID_PDF_TAB_VPREFER );
270
    RemoveTabPage( RID_PDF_TAB_OPNFTR );
285
    RemoveTabPage( RID_PDF_TAB_OPNFTR );
271
    RemoveTabPage( RID_PDF_TAB_SECURITY );
286
    RemoveTabPage( RID_PDF_TAB_SECURITY );
287
    RemoveTabPage( RID_PDF_TAB_RELLINK );
272
}
288
}
273
289
274
// -----------------------------------------------------------------------------
290
// -----------------------------------------------------------------------------
Lines 289-294 void ImpPDFTabDialog::PageCreated( USHOR Link Here
289
    case RID_PDF_TAB_SECURITY:
305
    case RID_PDF_TAB_SECURITY:
290
        ( ( ImpPDFTabSecurityPage* )&_rPage )->SetFilterConfigItem( this );
306
        ( ( ImpPDFTabSecurityPage* )&_rPage )->SetFilterConfigItem( this );
291
        break;
307
        break;
308
    case RID_PDF_TAB_RELLINK:
309
        ( ( ImpPDFTabRelativeLinkPage* )&_rPage )->SetFilterConfigItem( this );
310
        break;
292
    }
311
    }
293
}
312
}
294
313
Lines 359-364 Sequence< PropertyValue > ImpPDFTabDialo Link Here
359
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), mbCanCopyOrExtract );
378
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), mbCanCopyOrExtract );
360
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), mbCanExtractForAccessibility );
379
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), mbCanExtractForAccessibility );
361
380
381
    if( GetTabPage( RID_PDF_TAB_RELLINK ) )
382
        ( ( ImpPDFTabRelativeLinkPage* )GetTabPage( RID_PDF_TAB_RELLINK ) )->GetFilterConfigItem( this );
383
384
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "SaveLinksRelativeFsys" ) ), mbSaveRelativeFsysLinks );
385
	maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultPDFLinkAction" ) ), mbOpnDefaultMode );
386
	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), mbConvertOOoTargets );
387
	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ForceGoToRAsPDFAction" ) ), mbForcePDFAction );
388
	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), mbExportBmkToPDFDestination );
389
362
    Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
390
    Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
363
391
364
	int nElementAdded = 5;
392
	int nElementAdded = 5;
Lines 530-535 void ImpPDFTabGeneralPage::GetFilterConf Link Here
530
    paParent->mbUseTaggedPDF =  maCbTaggedPDF.IsChecked();
558
    paParent->mbUseTaggedPDF =  maCbTaggedPDF.IsChecked();
531
    paParent->mbExportNotesBoth = maCbExportNotes.IsChecked();
559
    paParent->mbExportNotesBoth = maCbExportNotes.IsChecked();
532
    paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
560
    paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
561
    
533
562
534
    paParent->mbIsSkipEmptyPages =  !maCbExportEmptyPages.IsChecked();
563
    paParent->mbIsSkipEmptyPages =  !maCbExportEmptyPages.IsChecked();
535
    paParent->mbAddStream = maCbAddStream.IsVisible() && maCbAddStream.IsChecked();
564
    paParent->mbAddStream = maCbAddStream.IsVisible() && maCbAddStream.IsChecked();
Lines 1109-1111 IMPL_LINK( ImpPDFTabSecurityPage, Clickm Link Here
1109
1138
1110
	return 0;
1139
	return 0;
1111
}
1140
}
1141
1142
////////////////////////////////////////////////////////
1143
// The relative link preferences tab page, temporary; may have a different name when finished
1144
// -----------------------------------------------------------------------------
1145
ImpPDFTabRelativeLinkPage::ImpPDFTabRelativeLinkPage( Window* pParent,
1146
											  const SfxItemSet& rCoreSet,
1147
											  ResMgr& rResMgr ) :
1148
	SfxTabPage( pParent, ResId( RID_PDF_TAB_RELLINK, rResMgr ), rCoreSet ),
1149
    maFlExperReminder( this,  ResId( FL_EXPERIMENTAL , rResMgr ) ),
1150
 	maCbSaveRelativeFsysLinks( this, ResId( CB_ENAB_RELLINKFSYS , rResMgr ) ),
1151
1152
    maFlDefaultTitle( this,  ResId( FL_DEFAULT_LINK_ACTION , rResMgr ) ),
1153
	maRbOpnLnksURI( this, ResId( RB_OPENS_IN_BROWSER , rResMgr ) ),
1154
	maRbOpnLnksLaunch( this, ResId( RB_OPEN_INDEFAPP , rResMgr ) ),
1155
    maRbOpnLnksGoToR( this,  ResId( RB_OPEN_GOTOR , rResMgr ) ),
1156
1157
    maCbOOoToPDFTargets( this,  ResId( CB_CNV_OOO_DOCTOPDF , rResMgr ) ),
1158
	maCbForcePDFToGoToR( this, ResId( CB_CNV_PDF_FORCE_GOTOR , rResMgr ) ),
1159
	maCbExprtBmkrToNmDst( this, ResId( CB_EXP_BMRK_TO_DEST , rResMgr ) )
1160
	
1161
{
1162
	mpaResMgr = &rResMgr;
1163
	FreeResource();
1164
}
1165
1166
// -----------------------------------------------------------------------------
1167
ImpPDFTabRelativeLinkPage::~ImpPDFTabRelativeLinkPage()
1168
{
1169
	delete mpaResMgr;
1170
}
1171
1172
// -----------------------------------------------------------------------------
1173
SfxTabPage*  ImpPDFTabRelativeLinkPage::Create( Window* pParent,
1174
                                          const SfxItemSet& rAttrSet)
1175
{
1176
	ByteString aResMgrName( "pdffilter" );
1177
	aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
1178
	ResMgr * paResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
1179
	return ( new  ImpPDFTabRelativeLinkPage( pParent, rAttrSet, *paResMgr ) );
1180
}
1181
1182
// -----------------------------------------------------------------------------
1183
void ImpPDFTabRelativeLinkPage::GetFilterConfigItem( ImpPDFTabDialog* paParent  )
1184
{
1185
	paParent->mbSaveRelativeFsysLinks = maCbSaveRelativeFsysLinks.IsChecked();
1186
1187
    paParent->mbOpnDefaultMode = 0;
1188
    if(	maRbOpnLnksLaunch.IsChecked() )
1189
        paParent->mbOpnDefaultMode = 1;
1190
    else if( maRbOpnLnksGoToR.IsChecked() )
1191
        paParent->mbOpnDefaultMode = 2;
1192
    
1193
	paParent->mbConvertOOoTargets = maCbOOoToPDFTargets.IsChecked();
1194
	paParent->mbForcePDFAction = maCbForcePDFToGoToR.IsChecked();
1195
	paParent->mbExportBmkToPDFDestination = maCbExprtBmkrToNmDst.IsChecked();
1196
}
1197
1198
// -----------------------------------------------------------------------------
1199
void ImpPDFTabRelativeLinkPage::SetFilterConfigItem( const  ImpPDFTabDialog* paParent )
1200
{
1201
	maCbSaveRelativeFsysLinks.Check( paParent->mbSaveRelativeFsysLinks );
1202
    switch( paParent->mbOpnDefaultMode )
1203
    {
1204
    default:
1205
    case 0:
1206
        maRbOpnLnksURI.Check();
1207
        break;
1208
    case 1:
1209
        maRbOpnLnksLaunch.Check();
1210
        break;
1211
    case 2:
1212
        maRbOpnLnksGoToR.Check();
1213
        break;
1214
    }
1215
        
1216
    maCbOOoToPDFTargets.Check( paParent->mbConvertOOoTargets );
1217
	maCbForcePDFToGoToR.Check( paParent->mbForcePDFAction );
1218
	maCbExprtBmkrToNmDst.Check( paParent->mbExportBmkToPDFDestination );
1219
    
1220
//	TogglemaCbSaveRelativeFsysLinksHdl( NULL );
1221
}
1222
1223
// IMPL_LINK( ImpPDFTabRelativeLinkPage, TogglemaCbSaveRelativeFsysLinksHdl, void*, p )
1224
// {
1225
// 	p = p; //for compiler warning
1226
// //	maRbOpnLnksURI.Enable( maCbSaveRelativeFsysLinks.IsChecked() );
1227
// //	maRbOpnLnksLaunch.Enable( maCbSaveRelativeFsysLinks.IsChecked() );
1228
// 	return 0;
1229
// }
1230
(-)filter/source/pdf/impdialog.hrc (+12 lines)
Lines 40-45 Link Here
40
#define RID_PDF_TAB_VPREFER         (RID_PDF_DIALOG_START +   2)
40
#define RID_PDF_TAB_VPREFER         (RID_PDF_DIALOG_START +   2)
41
#define RID_PDF_TAB_OPNFTR          (RID_PDF_DIALOG_START +   3)
41
#define RID_PDF_TAB_OPNFTR          (RID_PDF_DIALOG_START +   3)
42
#define RID_PDF_TAB_SECURITY        (RID_PDF_DIALOG_START +   4)
42
#define RID_PDF_TAB_SECURITY        (RID_PDF_DIALOG_START +   4)
43
#define RID_PDF_TAB_RELLINK			(RID_PDF_DIALOG_START +   12)
43
//strings
44
//strings
44
#define STR_PDF_EXPORT              (RID_PDF_DIALOG_START +   5)
45
#define STR_PDF_EXPORT              (RID_PDF_DIALOG_START +   5)
45
46
Lines 159-161 Link Here
159
#define RB_CHANGES_ANY_NOCOPY	137
160
#define RB_CHANGES_ANY_NOCOPY	137
160
#define CB_ENDAB_COPY			138
161
#define CB_ENDAB_COPY			138
161
#define CB_ENAB_ACCESS			139
162
#define CB_ENAB_ACCESS			139
163
164
//controls for link management
165
#define CB_ENAB_RELLINKFSYS		150
166
#define FL_DEFAULT_LINK_ACTION  151
167
#define RB_OPENS_IN_BROWSER		152
168
#define RB_OPEN_INDEFAPP		153
169
#define RB_OPEN_GOTOR           154
170
#define CB_CNV_OOO_DOCTOPDF		155
171
#define CB_CNV_PDF_FORCE_GOTOR  156
172
#define CB_EXP_BMRK_TO_DEST		157
173
#define FL_EXPERIMENTAL         158
(-)filter/source/pdf/impdialog.hxx (+43 lines)
Lines 125-136 protected: Link Here
125
    String                      msPageRange;
125
    String                      msPageRange;
126
    sal_Bool                    mbSelectionIsChecked;
126
    sal_Bool                    mbSelectionIsChecked;
127
127
128
	sal_Bool				    mbSaveRelativeFsysLinks;
129
	sal_Int32	                mbOpnDefaultMode;
130
	sal_Bool					mbConvertOOoTargets;
131
	sal_Bool					mbForcePDFAction;
132
	sal_Bool					mbExportBmkToPDFDestination;
133
    
134
128
public:
135
public:
129
136
130
    friend class				ImpPDFTabGeneralPage;
137
    friend class				ImpPDFTabGeneralPage;
131
    friend class				ImpPDFTabViewerPage;
138
    friend class				ImpPDFTabViewerPage;
132
    friend class				ImpPDFTabOpnFtrPage;
139
    friend class				ImpPDFTabOpnFtrPage;
133
    friend class				ImpPDFTabSecurityPage;
140
    friend class				ImpPDFTabSecurityPage;
141
    friend class				ImpPDFTabRelativeLinkPage;
134
142
135
    ImpPDFTabDialog( Window* pParent, ResMgr& rResMgr,
143
    ImpPDFTabDialog( Window* pParent, ResMgr& rResMgr,
136
                     Sequence< PropertyValue >& rFilterData,
144
                     Sequence< PropertyValue >& rFilterData,
Lines 344-347 public: Link Here
344
	void	SetFilterConfigItem( const ImpPDFTabDialog* paParent );
352
	void	SetFilterConfigItem( const ImpPDFTabDialog* paParent );
345
};
353
};
346
354
355
356
357
class ImpPDFTabRelativeLinkPage : public SfxTabPage
358
{
359
	FixedLine					maFlExperReminder;
360
    CheckBox                    maCbSaveRelativeFsysLinks;
361
362
    FixedLine					maFlDefaultTitle;
363
	RadioButton					maRbOpnLnksURI;
364
	RadioButton					maRbOpnLnksLaunch;
365
	RadioButton					maRbOpnLnksGoToR;
366
367
	CheckBox					maCbOOoToPDFTargets;
368
	CheckBox					maCbForcePDFToGoToR;
369
	CheckBox					maCbExprtBmkrToNmDst;
370
371
	ResMgr*						mpaResMgr;
372
373
	long nWidth;
374
375
// 	DECL_LINK( TogglemaCbSaveRelativeFsysLinksHdl, void* );
376
377
public:
378
	ImpPDFTabRelativeLinkPage( Window* pParent,
379
						   const SfxItemSet& rSet,
380
						   ResMgr& rResMgr );
381
382
	~ImpPDFTabRelativeLinkPage();
383
	static SfxTabPage*		Create( Window* pParent,
384
									const SfxItemSet& rAttrSet );
385
386
	void	GetFilterConfigItem( ImpPDFTabDialog* paParent);
387
	void	SetFilterConfigItem( const ImpPDFTabDialog* paParent );
388
};
389
347
#endif // IMPDIALOG_HXX
390
#endif // IMPDIALOG_HXX
(-)filter/source/pdf/impdialog.src (+80 lines)
Lines 637-642 TabPage RID_PDF_TAB_SECURITY Link Here
637
};
637
};
638
638
639
//----------------------------------------------------------
639
//----------------------------------------------------------
640
//tab page for PDF Export, links management
641
TabPage  RID_PDF_TAB_RELLINK
642
{
643
    HelpId = 0 ;
644
	Text [ en-US ] = "---";
645
    TAB_PDF_SIZE;
646
    Hide = TRUE;
647
648
    FixedLine FL_EXPERIMENTAL
649
    {
650
        Pos = MAP_APPFONT ( 6 , 3 ) ;
651
        Size = MAP_APPFONT (156  , 8 ) ;
652
        Text[ en-US ] = "----- THESE SELECTIONS ARE EXPERIMENTAL STUFF ! -------" ;
653
    };
654
    
655
    CheckBox CB_ENAB_RELLINKFSYS
656
    {
657
        Pos = MAP_APPFONT ( 6 , 14 ) ;
658
        Size = MAP_APPFONT ( 166 , 12 ) ;
659
        TabStop = TRUE ;
660
        Text[ en-US ] = "Links relative to file location (local file system only)" ;
661
    };
662
663
    FixedLine FL_DEFAULT_LINK_ACTION
664
    {
665
        Pos = MAP_APPFONT ( 6 , 25 ) ;
666
        Size = MAP_APPFONT (156  , 8 ) ;
667
        Text[ en-US ] = "Default link action" ;
668
    };
669
670
	RadioButton RB_OPENS_IN_BROWSER
671
	{
672
		Pos = MAP_APPFONT ( 12 , 36 ) ;
673
        Size = MAP_APPFONT ( 156 , 10 ) ;
674
		Text[ en-US ] = "Open link in browser (URI action)";
675
	};
676
	RadioButton RB_OPEN_INDEFAPP
677
	{
678
		Pos = MAP_APPFONT ( 12 , 47 ) ;
679
        Size = MAP_APPFONT ( 156 , 10 ) ;
680
		Text[ en-US ] = "Open link in application (launch action)";
681
	};
682
683
	RadioButton RB_OPEN_GOTOR
684
	{
685
		Pos = MAP_APPFONT ( 12 , 58 ) ;
686
        Size = MAP_APPFONT ( 156 , 10 ) ;
687
		Text[ en-US ] = "Open link with PDF reader (bookmark becomes destination in target file)";
688
	};
689
690
    CheckBox CB_CNV_OOO_DOCTOPDF
691
    {
692
        Pos = MAP_APPFONT ( 6 , 70 ) ;
693
        Size = MAP_APPFONT ( 166 , 12 ) ;
694
        TabStop = TRUE ;
695
        Text[ en-US ] = "Convert OOo targets into PDF targets" ;
696
    };
697
    CheckBox CB_CNV_PDF_FORCE_GOTOR
698
    {
699
        Pos = MAP_APPFONT ( 6 , 81 ) ;
700
        Size = MAP_APPFONT ( 166 , 12 ) ;
701
        TabStop = TRUE ;
702
        Text[ en-US ] = "Force PDF target as GoToR action" ;
703
    };
704
    CheckBox CB_EXP_BMRK_TO_DEST
705
    {
706
        Pos = MAP_APPFONT ( 6 , 92 ) ;
707
        Size = MAP_APPFONT ( 166 , 12 ) ;
708
        TabStop = TRUE ;
709
        Text[ en-US ] = "Export bookmarks into PDF named destinations" ;
710
    };
711
};
712
713
//----------------------------------------------------------
640
TabDialog  RID_PDF_EXPORT_DLG
714
TabDialog  RID_PDF_EXPORT_DLG
641
{
715
{
642
    HelpId = HID_FILTER_PDF_OPTIONS ;
716
    HelpId = HID_FILTER_PDF_OPTIONS ;
Lines 671-676 TabDialog RID_PDF_EXPORT_DLG Link Here
671
                Identifier = RID_PDF_TAB_SECURITY;
745
                Identifier = RID_PDF_TAB_SECURITY;
672
                Text [ en-US ] = "Security";
746
                Text [ en-US ] = "Security";
673
            };
747
            };
748
            PageItem
749
            {
750
                Identifier = RID_PDF_TAB_RELLINK;
751
                Text [ en-US ] = "Links";
752
            };
753
			
674
        };
754
        };
675
    };
755
    };
676
};
756
};
(-)filter/source/pdf/pdfexport.cxx (-1 / +57 lines)
Lines 58-63 Link Here
58
#include <svtools/FilterConfigItem.hxx>
58
#include <svtools/FilterConfigItem.hxx>
59
#include <svtools/filter.hxx>
59
#include <svtools/filter.hxx>
60
#include <svtools/solar.hrc>
60
#include <svtools/solar.hrc>
61
62
#include <svtools/saveopt.hxx> // only for testing of relative saving options in PDF
63
61
#include <vcl/graphictools.hxx>
64
#include <vcl/graphictools.hxx>
62
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
65
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
63
#include <com/sun/star/beans/XPropertySet.hpp>
66
#include <com/sun/star/beans/XPropertySet.hpp>
Lines 180-186 PDFExport::PDFExport( const Reference< X Link Here
180
    mbCanCopyOrExtract			( sal_True ),
183
    mbCanCopyOrExtract			( sal_True ),
181
    mbCanExtractForAccessibility( sal_True ),
184
    mbCanExtractForAccessibility( sal_True ),
182
    
185
    
183
    mnCachePatternId            ( -1 )
186
    mnCachePatternId            ( -1 ),
187
188
//--->i56629
189
    mbSaveRelativeFsysLinks	    ( sal_False ),
190
    mnDefaultLinkAction         ( 0 ),
191
    mbConvertOOoTargetToPDFTarget( sal_False ),
192
    mbForcePDFAction			( sal_False ),
193
    mbExportBmkToDest			( sal_False )
194
//<---
184
{
195
{
185
}
196
}
186
197
Lines 522-527 sal_Bool PDFExport::Export( const OUStri Link Here
522
					rFilterData[ nData ].Value >>= mbCanCopyOrExtract;
533
					rFilterData[ nData ].Value >>= mbCanCopyOrExtract;
523
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ) )
534
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ) )
524
					rFilterData[ nData ].Value >>= mbCanExtractForAccessibility;
535
					rFilterData[ nData ].Value >>= mbCanExtractForAccessibility;
536
//--->i56629 links extra (relative links and other related stuff)
537
 				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "SaveLinksRelativeFsys" ) ) )
538
 					rFilterData[ nData ].Value >>= mbSaveRelativeFsysLinks;
539
540
 				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultPDFLinkAction" ) ) )
541
 					rFilterData[ nData ].Value >>= mnDefaultLinkAction;
542
 				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ) )
543
 					rFilterData[ nData ].Value >>= mbConvertOOoTargetToPDFTarget;
544
  				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ForceGoToRAsPDFAction" ) ) )
545
  					rFilterData[ nData ].Value >>= mbForcePDFAction;
546
  				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ) )
547
  					rFilterData[ nData ].Value >>= mbExportBmkToDest;
548
//<---                
525
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ) )
549
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ) )
526
					rFilterData[ nData ].Value >>= mbExportBookmarks;
550
					rFilterData[ nData ].Value >>= mbExportBookmarks;
527
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ) )
551
				else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ) )
Lines 685-690 sal_Bool PDFExport::Export( const OUStri Link Here
685
                    break;
709
                    break;
686
            }
710
            }
687
711
712
			{
713
//---> i56629 Relative link stuff				
714
//set the base URL of the file:
715
//get model
716
				Reference< frame::XModel > xModel( mxSrcDoc, UNO_QUERY );
717
//then base URL
718
				aContext.BaseURL = xModel->getURL();
719
// get options
720
				SvtSaveOptions aSaveOpt;
721
//currently relative link options are caught from the general ones (e.g. Tool > Options > Load/Save > General, then the relative check box items)
722
//should they be private to PDF Export filter?
723
				aContext.RelFsys = mbSaveRelativeFsysLinks;
724
				aContext.RelInet = aSaveOpt.IsSaveRelINet();
725
//determine the default acton for PDF links
726
                switch( mnDefaultLinkAction )
727
                {
728
                default:
729
                case 0:
730
                    aContext.DefaultLinkAction = PDFWriter::URIAction;
731
                    break;
732
                case 1:
733
                    aContext.DefaultLinkAction = PDFWriter::LaunchAction;
734
                    break;
735
                case 2:
736
                    aContext.DefaultLinkAction = PDFWriter::GoToRAction;
737
                    break;
738
                }
739
                aContext.ConvertOOoTargetToPDFTarget = mbConvertOOoTargetToPDFTarget;
740
                aContext.ForcePDFAction = mbForcePDFAction;
741
//<---
742
			}
688
// all context data set, time to create the printing device
743
// all context data set, time to create the printing device
689
            PDFWriter*			pPDFWriter = new PDFWriter( aContext );
744
            PDFWriter*			pPDFWriter = new PDFWriter( aContext );
690
            OutputDevice*		pOut = pPDFWriter->GetReferenceDevice();
745
            OutputDevice*		pOut = pPDFWriter->GetReferenceDevice();
Lines 752-757 sal_Bool PDFExport::Export( const OUStri Link Here
752
                pPDFExtOutDevData->SetIsExportBookmarks( mbExportBookmarks );
807
                pPDFExtOutDevData->SetIsExportBookmarks( mbExportBookmarks );
753
				pPDFExtOutDevData->SetIsLosslessCompression( mbUseLosslessCompression );
808
				pPDFExtOutDevData->SetIsLosslessCompression( mbUseLosslessCompression );
754
				pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
809
				pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
810
                pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest );
755
811
756
                Sequence< PropertyValue > aRenderOptions( 6 );
812
                Sequence< PropertyValue > aRenderOptions( 6 );
757
				aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
813
				aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
(-)filter/source/pdf/pdfexport.hxx (+7 lines)
Lines 115-120 private: Link Here
115
    SvtGraphicFill          maCacheFill;
115
    SvtGraphicFill          maCacheFill;
116
    sal_Int32               mnCachePatternId;
116
    sal_Int32               mnCachePatternId;
117
117
118
//--->i56629
119
	sal_Bool				mbSaveRelativeFsysLinks;
120
    sal_Int32               mnDefaultLinkAction;
121
	sal_Bool				mbConvertOOoTargetToPDFTarget;
122
	sal_Bool				mbForcePDFAction;
123
    sal_Bool				mbExportBmkToDest;
124
//<---
118
	sal_Bool                ImplExportPage( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData& rPDFExtOutDevData,
125
	sal_Bool                ImplExportPage( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData& rPDFExtOutDevData,
119
												const GDIMetaFile& rMtf );
126
												const GDIMetaFile& rMtf );
120
    sal_Bool                ImplWriteActions( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData* pPDFExtOutDevData,
127
    sal_Bool                ImplWriteActions( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData* pPDFExtOutDevData,
(-)sd/source/ui/unoidl/unomodel.cxx (-2 / +21 lines)
Lines 2100-2106 void SAL_CALL SdXImpressDocument::render Link Here
2100
							Point aPoint( 0, 0 );
2100
							Point aPoint( 0, 0 );
2101
							Rectangle	aPageRect( aPoint, aPageSize );
2101
							Rectangle	aPageRect( aPoint, aPageSize );
2102
2102
2103
							// resolving links
2103
							// resolving links, found in this page by the method ImpEditEngine::Paint
2104
							std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
2104
							std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
2105
							std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
2105
							std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
2106
							std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
2106
							std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
Lines 2114-2125 void SAL_CALL SdXImpressDocument::render Link Here
2114
								aIBeg++;
2114
								aIBeg++;
2115
							}
2115
							}
2116
							rBookmarks.clear();
2116
							rBookmarks.clear();
2117
                            //get this page bookmark (the page name)
2118
                            String aPageName = mpDoc->GetSdPage( (USHORT)nPageNumber - 1 , PK_STANDARD )->GetName();
2117
2119
2120
                            if( aPageName.Len() > 0 )
2121
                            {
2122
                                //insert the bookmark to this page into the NamedDestinations
2123
                                if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
2124
                                    pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect,  nPageNumber - 1 );
2125
                                //
2126
                                // add the name to the outline
2127
                                //
2128
                                if( pPDFExtOutDevData->GetIsExportBookmarks() )
2129
                                {
2130
                                    // Destination Export
2131
                                    const sal_Int32 nDestId =
2132
                                        pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
2133
    
2134
                                    // Create a new outline item:
2135
                                    pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
2136
                                }                            
2137
                            }
2118
						}
2138
						}
2119
						catch( uno::Exception& )
2139
						catch( uno::Exception& )
2120
						{
2140
						{
2121
						}
2141
						}
2122
2123
					}
2142
					}
2124
            	}
2143
            	}
2125
            	else
2144
            	else
(-)sw/source/core/text/EnhancedPDFExportHelper.cxx (+42 lines)
Lines 173-178 Link Here
173
173
174
#include <tools/globname.hxx>
174
#include <tools/globname.hxx>
175
175
176
//--->i56629
177
#ifndef _BOOKMRK_HXX
178
#include <bookmrk.hxx>
179
#endif
180
//<---
181
176
//
182
//
177
// Some global data structures
183
// Some global data structures
178
//
184
//
Lines 1645-1650 void SwEnhancedPDFExportHelper::Enhanced Link Here
1645
                }
1651
                }
1646
            }
1652
            }
1647
        }
1653
        }
1654
1655
        if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
1656
        {
1657
        // i56629 the iteration to convert the OOo bookmark (#bookmark)
1658
        // into PDF named destination, see section 8.2.1 in PDF 1.4 spec
1659
        // We need:
1660
        // 1. a name for the destination, formed from the standard OOo bookmark name
1661
        // 2. the destination, obtained from where the bookmark destination lies
1662
            const SwBookmarks& rBkmks = mrSh.GetDoc()->getBookmarks();
1663
            //iterate trhrough bookmarks
1664
            sal_uInt16 nBkmks = rBkmks.Count(), nCnt;
1665
            for(nCnt = 0; nCnt < nBkmks; nCnt++)
1666
            {
1667
//get the name
1668
                SwBookmark* pBkmk = rBkmks[ nCnt ];
1669
//jump to it
1670
                mrSh.SwCrsrShell::ClearMark();
1671
1672
                rtl::OUString sBkName = pBkmk->GetName();
1673
 
1674
                JumpToSwMark( &mrSh, sBkName );
1675
1676
                // Destination Rectangle
1677
                const SwRect& rDestRect = mrSh.GetCharRect();
1678
1679
                // Destination PageNum
1680
                const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
1681
1682
                // Destination Export
1683
                if ( -1 != nDestPageNum )
1684
                {                    
1685
                    pPDFExtOutDevData->CreateNamedDest( sBkName, rDestRect.SVRect(), nDestPageNum );
1686
                }
1687
            }
1688
            mrSh.SwCrsrShell::ClearMark();
1689
        }
1648
    }
1690
    }
1649
    else
1691
    else
1650
    {
1692
    {

Return to issue 56629