diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-03-25 13:58:04 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2011-03-25 13:58:04 +0100 |
commit | 34813ca20cb27acef60670d8ad341dcd755fc072 (patch) | |
tree | 8f6c2fe978e7d28db3e40d82fcd89c2d4a628f37 | |
parent | 5a7ee0fbf9f6183319571cad6e60652a8addd655 (diff) | |
parent | d26d7768d7315d783fd143765ae68bc802c4445b (diff) |
calcvba: rebase to DEV300_m104
-rw-r--r-- | svl/inc/svl/nfkeytab.hxx | 14 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 14 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 20 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 22 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 2 | ||||
-rw-r--r-- | svtools/source/uno/unoiface.cxx | 1 | ||||
-rw-r--r-- | toolkit/inc/toolkit/helper/formpdfexport.hxx | 14 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 18 | ||||
-rw-r--r-- | toolkit/source/helper/formpdfexport.cxx | 58 | ||||
-rw-r--r-- | vcl/inc/vcl/pdfextoutdevdata.hxx | 34 | ||||
-rw-r--r-- | vcl/inc/vcl/pdfwriter.hxx | 23 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 53 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 8 |
17 files changed, 208 insertions, 92 deletions
diff --git a/svl/inc/svl/nfkeytab.hxx b/svl/inc/svl/nfkeytab.hxx index 7c3fef4b88cc..34d483ab4d86 100644 --- a/svl/inc/svl/nfkeytab.hxx +++ b/svl/inc/svl/nfkeytab.hxx @@ -28,6 +28,7 @@ #ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX #define INCLUDED_SVTOOLS_NFKEYTAB_HXX +#include <vector> #include <tools/string.hxx> //! For ImpSvNumberformatScan: first the short symbols, then the long symbols! @@ -111,7 +112,18 @@ enum NfKeywordIndex NF_KEYWORD_ENTRIES_COUNT }; -typedef String NfKeywordTable [NF_KEYWORD_ENTRIES_COUNT]; +class NfKeywordTable +{ + typedef ::std::vector<String> Keywords_t; + Keywords_t m_keywords; + +public: + NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {}; + virtual ~NfKeywordTable() {} + + String & operator[] (Keywords_t::size_type n) { return m_keywords[n]; } + const String & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; } +}; #endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index ebc1fa673fe2..d4d0f8550907 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -939,10 +939,10 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang ) { ChangeIntl( eLang ); - const String* pTable = pFormatScanner->GetKeywords(); + const NfKeywordTable & rTable = pFormatScanner->GetKeywords(); for ( sal_uInt16 i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i ) { - rKeywords[i] = pTable[i]; + rKeywords[i] = rTable[i]; } } @@ -950,9 +950,9 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, String SvNumberFormatter::GetKeyword( LanguageType eLnge, sal_uInt16 nIndex ) { ChangeIntl(eLnge); - const String* pTable = pFormatScanner->GetKeywords(); - if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT ) - return pTable[nIndex]; + const NfKeywordTable & rTable = pFormatScanner->GetKeywords(); + if ( nIndex < NF_KEYWORD_ENTRIES_COUNT ) + return rTable[nIndex]; DBG_ERROR("GetKeyword: invalid index"); return String(); @@ -2589,8 +2589,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, sal_Bool bLoadi CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); // Week of year must be appended here because of nNewExtended - const String* pKeyword = pFormatScanner->GetKeywords(); - aSingleFormatCode.Code = pKeyword[NF_KEY_WW]; + const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); + aSingleFormatCode.Code = rKeyword[NF_KEY_WW]; ImpInsertNewStandardFormat( aSingleFormatCode, CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 92398792077d..9b01c2ee91be 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1149,7 +1149,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, xub_StrLen nLen = rString.Len(); ScanState eState = SsStart; sSymbol.Erase(); - const String* pKeywords = rScan.GetKeywords(); + const NfKeywordTable & rKeywords = rScan.GetKeywords(); while (nPos < nLen && eState != SsStop) { cToken = rString.GetChar(nPos); @@ -1267,9 +1267,9 @@ short SvNumberformat::ImpNextSymbol(String& rString, BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); eState = SsGetPrefix; } - else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + else if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S { sSymbol += cToken; eState = SsGetTime; @@ -1306,9 +1306,9 @@ short SvNumberformat::ImpNextSymbol(String& rString, else { sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0); - if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S { if (cLetter == cToken) { @@ -4230,10 +4230,10 @@ String SvNumberformat::GetMappedFormatstring( const String& rColorName = NumFor[n].GetColorName(); if ( rColorName.Len() ) { - const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR; - for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ ) + const NfKeywordTable & rKey = rScan.GetKeywords(); + for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++ ) { - if ( *pKey == rColorName ) + if ( rKey[j] == rColorName ) { aPrefix += '['; aPrefix += rKeywords[j]; diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 000649a6de80..83dbd512a4e2 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -473,10 +473,10 @@ void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec) Color* ImpSvNumberformatScan::GetColor(String& sStr) { String sString = pFormatter->GetCharClass()->upper(sStr); - const String* pKeyword = GetKeywords(); + const NfKeywordTable & rKeyword = GetKeywords(); size_t i = 0; while (i < NF_MAX_DEFAULT_COLORS && - sString != pKeyword[NF_KEY_FIRSTCOLOR+i] ) + sString != rKeyword[NF_KEY_FIRSTCOLOR+i] ) i++; if ( i >= NF_MAX_DEFAULT_COLORS ) { @@ -492,7 +492,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) Color* pResult = NULL; if (i >= NF_MAX_DEFAULT_COLORS) { - const String& rColorWord = pKeyword[NF_KEY_COLOR]; + const String& rColorWord = rKeyword[NF_KEY_COLOR]; xub_StrLen nPos = sString.Match(rColorWord); if (nPos > 0) { @@ -529,7 +529,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) pFormatter->ChangeIntl(eTmpLnge); } else - sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; + sStr = rKeyword[NF_KEY_FIRSTCOLOR+i]; pResult = &(StandardColor[i]); } @@ -540,16 +540,16 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos ) { String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos ); - const String* pKeyword = GetKeywords(); + const NfKeywordTable & rKeyword = GetKeywords(); // #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere - if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 ) + if ( sString.Search( rKeyword[NF_KEY_GENERAL] ) == 0 ) return NF_KEY_GENERAL; //! MUST be a reverse search to find longer strings first short i = NF_KEYWORD_ENTRIES_COUNT-1; sal_Bool bFound = sal_False; for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i ) { - bFound = sString.Search(pKeyword[i]) == 0; + bFound = sString.Search(rKeyword[i]) == 0; if ( bFound ) { break; @@ -559,15 +559,15 @@ short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos if ( !bFound ) { // skip the gap of colors et al between new and old keywords and search on i = NF_KEY_LASTKEYWORD; - while ( i > 0 && sString.Search(pKeyword[i]) != 0 ) + while ( i > 0 && sString.Search(rKeyword[i]) != 0 ) i--; - if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] ) + if ( i > NF_KEY_LASTOLDKEYWORD && sString != rKeyword[i] ) { // found something, but maybe it's something else? // e.g. new NNN is found in NNNN, for NNNN we must search on short j = i - 1; - while ( j > 0 && sString.Search(pKeyword[j]) != 0 ) + while ( j > 0 && sString.Search(rKeyword[j]) != 0 ) j--; - if ( j && pKeyword[j].Len() > pKeyword[i].Len() ) + if ( j && rKeyword[j].Len() > rKeyword[i].Len() ) return j; } } diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index 9b04921cb7f4..a1372866a46e 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -66,7 +66,7 @@ public: const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); } CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); } - const String* GetKeywords() const + const NfKeywordTable & GetKeywords() const { if ( bKeywordsNeedInit ) InitKeywords(); diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index a60a210e8fa7..18af2c696a8c 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -80,6 +80,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: if ( pParent ) { pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB); + static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus(); *ppNewComp = new VCLXMultiLineEdit; } else diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx index 502f25520145..cafcb5d00d38 100644 --- a/toolkit/inc/toolkit/helper/formpdfexport.hxx +++ b/toolkit/inc/toolkit/helper/formpdfexport.hxx @@ -28,22 +28,21 @@ #ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX -#ifndef TOOLKIT_DLLAPI_H #include <toolkit/dllapi.h> -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ #include <com/sun/star/awt/XControl.hpp> -#endif /** === end UNO includes === **/ -#ifndef _VCL_PDFWRITER_HXX #include <vcl/pdfwriter.hxx> -#endif #include <memory> +namespace vcl +{ + class PDFExtOutDevData; +} + //........................................................................ namespace toolkitform { @@ -53,7 +52,8 @@ namespace toolkitform */ void TOOLKIT_DLLPUBLIC describePDFControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, - ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, + ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()); //........................................................................ diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 7fbac44035c6..38f2fd7c2603 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -92,17 +92,6 @@ static const LanguageDependentProp aLanguageDependentProp[] = { 0, 0 } }; -WorkWindow* lcl_GetDefaultWindow() -{ - static WorkWindow* pW = NULL; - if ( !pW ) - { - pW = new WorkWindow( NULL, 0 ); - pW->EnableChildTransparentMode(); - } - return pW; -} - static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel ) { Sequence< ::rtl::OUString> aNames; @@ -238,14 +227,15 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE Reference< XControl > xMe; OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe; - WorkWindow* pWW; + Window* pParentWindow( NULL ); { osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() ); - pWW = lcl_GetDefaultWindow(); + pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() ); + ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" ); } try { - xMe->createPeer( NULL, pWW->GetComponentInterface( sal_True ) ); + xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) ); } catch( const Exception& ) { diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index bff2d6008d10..1bde6f66a3c0 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -28,58 +28,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #include <toolkit/helper/formpdfexport.hxx> -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include <com/sun/star/container/XIndexAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include <com/sun/star/container/XNameContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_ #include <com/sun/star/form/XForm.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include <com/sun/star/container/XChild.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include <com/sun/star/form/FormComponentType.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include <com/sun/star/awt/TextAlign.hpp> -#endif -#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_ #include <com/sun/star/style/VerticalAlignment.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_ #include <com/sun/star/form/FormButtonType.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_ #include <com/sun/star/form/FormSubmitMethod.hpp> -#endif /** === end UNO includes === **/ -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/helper/vclunohelper.hxx> -#endif -#ifndef _VCL_PDFEXTOUTDEVDATA_HXX +#include <tools/diagnose_ex.h> #include <vcl/pdfextoutdevdata.hxx> -#endif -#ifndef _SV_OUTDEV_HXX #include <vcl/outdev.hxx> -#endif #include <functional> #include <algorithm> @@ -315,7 +284,8 @@ namespace toolkitform //-------------------------------------------------------------------- /** creates a PDF compatible control descriptor for the given control */ - void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(()) + void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()) { _rpDescriptor.reset( NULL ); OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" ); @@ -529,7 +499,25 @@ namespace toolkitform } else if ( eButtonType == FormButtonType_URL ) { - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL); + ::rtl::OUString sURL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL ); + const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' ); + if ( bDocumentLocalTarget ) + { + const ::rtl::OUString sDestinationName( sURL.copy(1) ); + // Register the destination for for future handling ... + pButtonWidget->Dest = i_pdfExportData.RegisterDest(); + + // and put it into the bookmarks, to ensure the future handling really happens + ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() ); + ::vcl::PDFExtOutDevBookmarkEntry aBookmark; + aBookmark.nDestId = pButtonWidget->Dest; + aBookmark.aBookmark = sURL; + rBookmarks.push_back( aBookmark ); + } + else + pButtonWidget->URL = sURL; + pButtonWidget->Submit = false; } @@ -630,7 +618,7 @@ namespace toolkitform } catch( const Exception& ) { - OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx index f1e203a84431..bf2a09c1dd42 100644 --- a/vcl/inc/vcl/pdfextoutdevdata.hxx +++ b/vcl/inc/vcl/pdfextoutdevdata.hxx @@ -52,8 +52,24 @@ namespace vcl */ struct PDFExtOutDevBookmarkEntry { + /** ID of the link pointing to the bookmark, or -1 if the entry denotes a destination instead of a link. + */ sal_Int32 nLinkId; + + /** ID of the named destination denoted by the bookmark, or -1 if the entry denotes a link instead of a named destination. + */ + sal_Int32 nDestId; + + /** link target name, respectively destination name + */ rtl::OUString aBookmark; + + PDFExtOutDevBookmarkEntry() + :nLinkId( -1 ) + ,nDestId( -1 ) + ,aBookmark() + { + } }; /* @@ -195,6 +211,24 @@ public : -1 if page id does not exist */ sal_Int32 CreateNamedDest( const String& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + + /** registers a destination for which a destinatin ID needs to be known immediately, instead of later on setting it via + SetLinkDest. + + This is used in contexts where a destination is referenced by means other than a link. + + Later in the export process, a call to DescribeRegisteredDest must be made, providing the information about + the destination. + + @return + the unique Id of the destination + */ + sal_Int32 RegisterDest(); + + /** provides detailed information about a destination range which previously has been registered using RegisterDest. + */ + void DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + //<---i56629 /** Create a new destination to be used in a link diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 4e792ef40f57..09a8a08d5aca 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -939,6 +939,29 @@ The following structure describes the permissions used in PDF security -1 if page id does not exist */ sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); + + /** creates a destination which is not intended to be referred to by a link, but by a public destination Id. + + Form widgets, for instance, might refer to a destination, without ever actually creating a source link to + point to this destination. In such cases, a public destination Id will be assigned to the form widget, + and later on, the concrete destination data for this public Id will be registered using RegisterDestReference. + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the internal destination Id. + */ + sal_Int32 RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ ); + + /** Set the destination for a link <p>will change a URL type link to a dest link if necessary</p> diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index c075e1b108f3..115d0afbb24d 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -370,7 +370,9 @@ void DeInitVCL() aBuf.append( rtl::OUStringToOString( pWin->GetText(), osl_getThreadTextEncoding() ) ); aBuf.append( "\" type = \"" ); aBuf.append( typeid(*pWin).name() ); - aBuf.append( "\"\n" ); + aBuf.append( "\", ptr = 0x" ); + aBuf.append( sal_Int64( pWin ), 16 ); + aBuf.append( "\n" ); } } DBG_ASSERT( nBadTopWindows==0, aBuf.getStr() ); diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 77458d2b26fd..c47b034e1011 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -31,22 +31,25 @@ #include "vcl/graph.hxx" #include "vcl/outdev.hxx" #include "vcl/gfxlink.hxx" +#include "vcl/dllapi.h" #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" #include <boost/shared_ptr.hpp> #include <set> +#include <map> namespace vcl { -struct PDFExtOutDevDataSync +struct SAL_DLLPRIVATE PDFExtOutDevDataSync { enum Action{ CreateNamedDest, CreateDest, CreateLink, SetLinkDest, SetLinkURL, + RegisterDest, CreateOutlineItem, SetOutlineItemParent, SetOutlineItemText, @@ -73,7 +76,15 @@ struct PDFExtOutDevDataSync Action eAct; }; -struct GlobalSyncData +struct SAL_DLLPRIVATE PDFLinkDestination +{ + Rectangle mRect; + MapMode mMapMode; + sal_Int32 mPageNr; + PDFWriter::DestAreaType mAreaType; +}; + +struct SAL_DLLPRIVATE GlobalSyncData { std::deque< PDFExtOutDevDataSync::Action > mActions; std::deque< MapMode > mParaMapModes; @@ -84,6 +95,7 @@ struct GlobalSyncData std::deque< PDFWriter::DestAreaType > mParaDestAreaTypes; std::deque< PDFNote > mParaPDFNotes; std::deque< PDFWriter::PageTransition > mParaPageTransitions; + ::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations; sal_Int32 GetMappedId(); sal_Int32 GetMappedStructId( sal_Int32 ); @@ -145,7 +157,7 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) { switch( *aIter ) { - case PDFExtOutDevDataSync::CreateNamedDest : //i56629 + case PDFExtOutDevDataSync::CreateNamedDest : //i56629 { rWriter.Push( PUSH_MAPMODE ); rWriter.SetMapMode( mParaMapModes.front() ); @@ -197,6 +209,21 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) mParaOUStrings.pop_front(); } break; + case PDFExtOutDevDataSync::RegisterDest : + { + const sal_Int32 nDestId = mParaInts.front(); + mParaInts.pop_front(); + OSL_ENSURE( mFutureDestinations.find( nDestId ) != mFutureDestinations.end(), + "GlobalSyncData::PlayGlobalActions: DescribeRegisteredRequest has not been called for that destination!" ); + + PDFLinkDestination& rDest = mFutureDestinations[ nDestId ]; + + rWriter.Push( PUSH_MAPMODE ); + rWriter.SetMapMode( rDest.mMapMode ); + mParaIds.push_back( rWriter.RegisterDestReference( nDestId, rDest.mRect, rDest.mPageNr, rDest.mAreaType ) ); + rWriter.Pop(); + } + break; case PDFExtOutDevDataSync::CreateOutlineItem : { sal_Int32 nParent = GetMappedId(); @@ -459,6 +486,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM case PDFExtOutDevDataSync::CreateLink: case PDFExtOutDevDataSync::SetLinkDest: case PDFExtOutDevDataSync::SetLinkURL: + case PDFExtOutDevDataSync::RegisterDest: case PDFExtOutDevDataSync::CreateOutlineItem: case PDFExtOutDevDataSync::SetOutlineItemParent: case PDFExtOutDevDataSync::SetOutlineItemText: @@ -617,9 +645,28 @@ sal_Int32 PDFExtOutDevData::CreateNamedDest(const String& sDestName, const Rect mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() ); mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr ); mpGlobalSyncData->mParaDestAreaTypes.push_back( eType ); + return mpGlobalSyncData->mCurId++; } //<---i56629 +sal_Int32 PDFExtOutDevData::RegisterDest() +{ + const sal_Int32 nLinkDestID = mpGlobalSyncData->mCurId++; + mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::RegisterDest ); + mpGlobalSyncData->mParaInts.push_back( nLinkDestID ); + + return nLinkDestID; +} +void PDFExtOutDevData::DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) +{ + OSL_PRECOND( nDestId != -1, "PDFExtOutDevData::DescribeRegisteredDest: invalid destination Id!" ); + PDFLinkDestination aLinkDestination; + aLinkDestination.mRect = rRect; + aLinkDestination.mMapMode = mrOutDev.GetMapMode(); + aLinkDestination.mPageNr = nPageNr == -1 ? mnPage : nPageNr; + aLinkDestination.mAreaType = eType; + mpGlobalSyncData->mFutureDestinations[ nDestId ] = aLinkDestination; +} sal_Int32 PDFExtOutDevData::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest ); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 445365e83dd4..d6c5aed6b52a 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -420,6 +420,10 @@ sal_Int32 PDFWriter::CreateLink( const Rectangle& rRect, sal_Int32 nPageNr ) { return ((PDFWriterImpl*)pImplementation)->createLink( rRect, nPageNr ); } +sal_Int32 PDFWriter::RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType ) +{ + return ((PDFWriterImpl*)pImplementation)->registerDestReference( nDestId, rRect, nPageNr, eType ); +} //--->i56629 sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4a37d3a5d601..f8a2bbc051a0 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5613,7 +5613,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if(!m_bIsPDF_A1) { OStringBuffer aDest; - if( rWidget.m_nDest != -1 && appendDest( rWidget.m_nDest, aDest ) ) + if( rWidget.m_nDest != -1 && appendDest( m_aDestinationIdTranslation[ rWidget.m_nDest ], aDest ) ) { aLine.append( "/AA<</D<</Type/Action/S/GoTo/D " ); aLine.append( aDest.makeStringAndClear() ); @@ -10839,6 +10839,11 @@ sal_Int32 PDFWriterImpl::createDest( const Rectangle& rRect, sal_Int32 nPageNr, return nRet; } +sal_Int32 PDFWriterImpl::registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) +{ + return m_aDestinationIdTranslation[ nDestId ] = createDest( rRect, nPageNr, eType ); +} + sal_Int32 PDFWriterImpl::setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ) { if( nLinkId < 0 || nLinkId >= (sal_Int32)m_aLinks.size() ) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index c73be7c037e5..5cfe1be8d0f1 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -613,6 +613,9 @@ private: dest id is always the dest's position in this vector */ std::vector<PDFDest> m_aDests; + /** contains destinations accessible via a public Id, instead of being linked to by an ordinary link + */ + ::std::map< sal_Int32, sal_Int32 > m_aDestinationIdTranslation; /* contains all links ever set during PDF creation, link id is always the link's position in this vector */ @@ -1279,6 +1282,7 @@ public: // links sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + sal_Int32 registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); sal_Int32 setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); sal_Int32 setLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL ); void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId ); diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 9cb38756e770..795bea17a3b9 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1646,7 +1646,13 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ) // #i42750# presentation wants to be informed about resize // as early as possible WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow->ImplGetWindowImpl()->mpClientWindow); - if( pWorkWindow && pWorkWindow->IsPresentationMode() ) + if( ! pWorkWindow || pWorkWindow->IsPresentationMode() ) + bStartTimer = false; + } + else + { + WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pWindow); + if( ! pWorkWindow || pWorkWindow->IsPresentationMode() ) bStartTimer = false; } } |