diff options
-rw-r--r-- | vcl/inc/pdf/pdfwriter_impl.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 19 |
3 files changed, 32 insertions, 3 deletions
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index bb48f7c08e9f..e30c8968e59a 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -527,6 +527,8 @@ struct PDFWidget : public PDFAnnotation std::vector<sal_Int32> m_aSelectedEntries; typedef std::unordered_map<OString, SvMemoryStream*> PDFAppearanceStreams; std::unordered_map<OString, PDFAppearanceStreams> m_aAppearances; + sal_Int32 m_nStructParent = -1; + PDFWidget() : m_eType( PDFWriter::PushButton ), m_nTextStyle( DrawTextFlags::NONE ), diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 5dfcc5b19d6e..21f340fc2107 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -97,6 +97,10 @@ struct GlobalSyncData sal_Int32 GetMappedId(); sal_Int32 GetMappedStructId( sal_Int32 ); + /** the way this appears to work: (only) everything that increments mCurId + at recording time must put an item into mParaIds at playback time, + so that the mCurId becomes the eventual index into mParaIds. + */ sal_Int32 mCurId; std::vector< sal_Int32 > mParaIds; std::vector< sal_Int32 > mStructIdMap; @@ -410,7 +414,14 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc std::shared_ptr< PDFWriter::AnyWidget > pControl( mControls.front() ); SAL_WARN_IF( !pControl, "vcl", "PageSyncData::PlaySyncPageAct: invalid widget!" ); if ( pControl ) - rWriter.CreateControl( *pControl ); + { + sal_Int32 const n = rWriter.CreateControl(*pControl); + // resolve AnnotIds structural attribute + ::std::vector<sal_Int32> const annotIds{ sal_Int32(mpGlobalData->mParaIds.size()) }; + rWriter.SetStructureAnnotIds(annotIds); + rWriter.SetLinkPropertyID(n, sal_Int32(mpGlobalData->mParaIds.size())); + mpGlobalData->mParaIds.push_back(n); + } mControls.pop_front(); } break; @@ -849,6 +860,7 @@ void PDFExtOutDevData::CreateControl( const PDFWriter::AnyWidget& rControlType ) std::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() ); mpPageSyncData->mControls.push_back( pClone ); + mpGlobalSyncData->mCurId++; } void PDFExtOutDevData::BeginGroup() diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 52bd77e3ebc4..b2ba4d69555e 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2242,8 +2242,16 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) auto const it(m_aLinkPropertyMap.find(id)); assert(it != m_aLinkPropertyMap.end()); - assert(0 <= it->second && o3tl::make_unsigned(it->second) < m_aScreens.size()); - AppendAnnotKid(rEle, m_aScreens[it->second]); + if (rEle.m_eType == PDFWriter::Form) + { + assert(0 <= it->second && o3tl::make_unsigned(it->second) < m_aWidgets.size()); + AppendAnnotKid(rEle, m_aWidgets[it->second]); + } + else + { + assert(0 <= it->second && o3tl::make_unsigned(it->second) < m_aScreens.size()); + AppendAnnotKid(rEle, m_aScreens[it->second]); + } } } if( ! rEle.m_aKids.empty() ) @@ -4677,6 +4685,13 @@ bool PDFWriterImpl::emitWidgetAnnotations() iRectMargin = 1; } + if (0 < rWidget.m_nStructParent) + { + aLine.append("/StructParent "); + aLine.append(rWidget.m_nStructParent); + aLine.append("\n"); + } + aLine.append("/Rect[" ); appendFixedInt( rWidget.m_aRect.Left()-iRectMargin, aLine ); aLine.append( ' ' ); |