summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPhilipp Lohmann <Philipp.Lohmann@Sun.COM>2009-10-21 15:49:31 +0200
committerPhilipp Lohmann <Philipp.Lohmann@Sun.COM>2009-10-21 15:49:31 +0200
commit9e8d18328987be288a84e686eee1d4c35d8754e9 (patch)
tree49db9ee750cf6d197992eac8025b92028762f8f7 /vcl
parentb40fbbe280b3636369521479f8e3438aefcd544d (diff)
#i103932# allow duplicate field names in PDF export on request
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx37
2 files changed, 22 insertions, 17 deletions
diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index bdf636754c77..a4a6c4d53170 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -546,6 +546,7 @@ The following structure describes the permissions used in PDF security
will be submitted.
*/
PDFWriter::ExportDataFormat SubmitFormat;
+ bool AllowDuplicateFieldNames;
/* the following data members are used to customize the PDF viewer
preferences
*/
@@ -590,6 +591,7 @@ The following structure describes the permissions used in PDF security
Tagged( false ),
EmbedStandardFonts( false ),
SubmitFormat( PDFWriter::FDF ),
+ AllowDuplicateFieldNames( false ),
PDFDocumentMode( PDFWriter::ModeDefault ),
PDFDocumentAction( PDFWriter::ActionDefault ),
Zoom( 100 ),
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7b6d5e7f41aa..dc3ead5d2d6f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -667,26 +667,29 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString )
}
OString aRet = aBuffer.makeStringAndClear();
- std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet );
-
- if( it != m_aFieldNameMap.end() ) // not unique
+ if( ! m_aContext.AllowDuplicateFieldNames )
{
- std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
- OString aTry;
- do
+ std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet );
+
+ if( it != m_aFieldNameMap.end() ) // not unique
{
- OStringBuffer aUnique( aRet.getLength() + 16 );
- aUnique.append( aRet );
- aUnique.append( '_' );
- aUnique.append( it->second );
- it->second++;
- aTry = aUnique.makeStringAndClear();
- check_it = m_aFieldNameMap.find( aTry );
- } while( check_it != m_aFieldNameMap.end() );
- aRet = aTry;
+ std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
+ OString aTry;
+ do
+ {
+ OStringBuffer aUnique( aRet.getLength() + 16 );
+ aUnique.append( aRet );
+ aUnique.append( '_' );
+ aUnique.append( it->second );
+ it->second++;
+ aTry = aUnique.makeStringAndClear();
+ check_it = m_aFieldNameMap.find( aTry );
+ } while( check_it != m_aFieldNameMap.end() );
+ aRet = aTry;
+ }
+ else
+ m_aFieldNameMap[ aRet ] = 2;
}
- else
- m_aFieldNameMap[ aRet ] = 2;
return aRet;
}