20 #include <com/sun/star/embed/XEmbeddedObject.hpp>
21 #include <com/sun/star/i18n/ScriptType.hpp>
22 #include <com/sun/star/drawing/XShape.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <section.hxx>
80 #include <strings.hrc>
99 #if OSL_DEBUG_LEVEL > 1
131 const char aTableHeadingName[] =
"Table Heading";
132 const char aQuotations[] =
"Quotations";
133 const char aCaption[] =
"Caption";
134 const char aHeading[] =
"Heading";
135 const char aQuotation[] =
"Quotation";
136 const char aSourceText[] =
"Source Text";
139 constexpr OUStringLiteral aDocumentString =
u"Document";
140 constexpr OUStringLiteral aDivString =
u"Div";
141 constexpr OUStringLiteral aSectString =
u"Sect";
142 constexpr OUStringLiteral aHString =
u"H";
143 constexpr OUStringLiteral aH1String =
u"H1";
144 constexpr OUStringLiteral aH2String =
u"H2";
145 constexpr OUStringLiteral aH3String =
u"H3";
146 constexpr OUStringLiteral aH4String =
u"H4";
147 constexpr OUStringLiteral aH5String =
u"H5";
148 constexpr OUStringLiteral aH6String =
u"H6";
149 constexpr OUStringLiteral aListString =
u"L";
150 constexpr OUStringLiteral aListItemString =
u"LI";
151 constexpr OUStringLiteral aListBodyString =
u"LBody";
152 constexpr OUStringLiteral aBlockQuoteString =
u"BlockQuote";
153 constexpr OUStringLiteral aCaptionString =
u"Caption";
154 constexpr OUStringLiteral aIndexString =
u"Index";
155 constexpr OUStringLiteral aTOCString =
u"TOC";
156 constexpr OUStringLiteral aTOCIString =
u"TOCI";
157 constexpr OUStringLiteral aTableString =
u"Table";
158 constexpr OUStringLiteral aTRString =
u"TR";
159 constexpr OUStringLiteral aTDString =
u"TD";
160 constexpr OUStringLiteral aTHString =
u"TH";
161 constexpr OUStringLiteral aBibEntryString =
u"BibEntry";
162 constexpr OUStringLiteral aQuoteString =
u"Quote";
163 constexpr OUStringLiteral aSpanString =
u"Span";
164 constexpr OUStringLiteral aCodeString =
u"Code";
165 constexpr OUStringLiteral aFigureString =
u"Figure";
166 constexpr OUStringLiteral aFormulaString =
u"Formula";
167 constexpr OUStringLiteral aLinkString =
u"Link";
168 constexpr OUStringLiteral aNoteString =
u"Note";
171 bool lcl_IsHeadlineCell(
const SwCellFrame& rCellFrame )
183 bRet = sStyleName == aTableHeadingName;
190 bool lcl_IsInNonStructEnv(
const SwFrame& rFrame )
202 if ( rFrame.
GetUpper() != pTabFrame &&
211 void* lcl_GetKeyFromFrame(
const SwFrame& rFrame )
213 void* pKey =
nullptr;
216 pKey = const_cast<void*>(static_cast<void const *>(&(static_cast<const SwPageFrame&>(rFrame).GetFormat()->getIDocumentSettingAccess())));
218 pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrame&>(rFrame).GetTextNodeFirst()));
220 pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwSectionFrame&>(rFrame).GetSection()));
222 pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTabFrame&>(rFrame).GetTable()));
224 pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwRowFrame&>(rFrame).GetTabLine()));
229 pKey =
const_cast<void*
>(
static_cast<void const *
>(&
static_cast<const SwCellFrame&
>(rFrame).GetTabBox()->FindStartOfRowSpan( *pTable )));
241 const SwNode* pNode = &rNode;
248 if (aIdx.GetNode().IsTextNode())
251 *rTextFrame.
getRootFrame(), *aIdx.GetNode().GetTextNode());
256 if ( (pPrevNumRule == pNumRule) &&
263 pNode = &aIdx.GetNode();
277 rShell.SwCursorShell::ClearMark();
289 : m_nEndStructureElement( 0 ),
290 m_nRestoreCurrentTag( -1 ),
291 mpNumInfo( pNumInfo ),
292 mpFrameInfo( pFrameInfo ),
293 mpPorInfo( pPorInfo )
301 #if OSL_DEBUG_LEVEL > 1
314 #if OSL_DEBUG_LEVEL > 1
317 (
void)nCurrentStruct;
326 #if OSL_DEBUG_LEVEL > 1
332 #if OSL_DEBUG_LEVEL > 1
335 (
void)nCurrentStruct;
342 sal_Int32 nReopenTag = -1;
343 bool bContinue =
false;
348 const SwFrame* pKeyFrame =
nullptr;
367 static_cast<const SwFlyFrame*
>(&rFrame)->GetFormat()->GetAnchor();
368 if ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
369 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()) ||
372 pKeyFrame =
static_cast<const SwFlyFrame&
>(rFrame).GetAnchorFrame();
379 void* pKey = lcl_GetKeyFromFrame( *pKeyFrame );
384 const FrameTagIdMap::const_iterator aIter = rFrameTagIdMap.find( pKey );
385 if ( aIter != rFrameTagIdMap.end() )
386 nReopenTag = (*aIter).second;
391 if ( -1 != nReopenTag )
395 OSL_ENSURE( bSuccess,
"Failed to reopen tag" );
397 #if OSL_DEBUG_LEVEL > 1
404 return bRet && !bContinue;
412 OSL_ENSURE( bSuccess,
"Failed to restore reopened tag" );
414 #if OSL_DEBUG_LEVEL > 1
426 #if OSL_DEBUG_LEVEL > 1
427 aStructStack.push_back( static_cast<sal_uInt16>(eType) );
447 rNumListIdMap[ pNodeNum ] = nId;
452 rNumListBodyIdMap[ pNodeNum ] = nId;
465 const void* pKey = lcl_GetKeyFromFrame( rFrame );
470 rFrameTagIdMap[ pKey ] = nId;
482 #if OSL_DEBUG_LEVEL > 1
501 bool bPlacement =
false;
502 bool bWritingMode =
false;
503 bool bSpaceBefore =
false;
504 bool bSpaceAfter =
false;
505 bool bStartIndent =
false;
506 bool bEndIndent =
false;
507 bool bTextIndent =
false;
508 bool bTextAlign =
false;
510 bool bHeight =
false;
512 bool bRowSpan =
false;
634 OSL_ENSURE( pFrame->
IsTextFrame(),
"Frame type <-> tag attribute mismatch" );
636 static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
637 nVal = rSpace.GetTextFirstLineOffset();
644 OSL_ENSURE( pFrame->
IsTextFrame(),
"Frame type <-> tag attribute mismatch" );
645 const SwAttrSet& aSet =
static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet();
646 const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
647 if ( SvxAdjust::Block == nAdjust || SvxAdjust::Center == nAdjust ||
649 (!pFrame->
IsRightToLeft() && SvxAdjust::Right == nAdjust) ) )
651 eVal = SvxAdjust::Block == nAdjust ?
653 SvxAdjust::Center == nAdjust ?
682 !
static_cast<const SwTabFrame*
>(pFrame)->IsFollow() &&
683 !
static_cast<const SwTabFrame*
>(pFrame)->HasFollow() ) )
708 const TableColumnsMapEntry::const_iterator aLeftIter = rCols.find( nLeft );
709 const TableColumnsMapEntry::const_iterator aRightIter = rCols.find( nRight );
711 OSL_ENSURE( aLeftIter != rCols.end() && aRightIter != rCols.end(),
"Colspan trouble" );
712 if ( aLeftIter != rCols.end() && aRightIter != rCols.end() )
714 nVal = std::distance( aLeftIter, aRightIter );
730 bool bActualText =
false;
731 bool bBaselineShift =
false;
732 bool bTextDecorationType =
false;
733 bool bLinkAttribute =
false;
734 bool bLanguage =
false;
749 bTextDecorationType =
755 bTextDecorationType =
767 OUString aActualText;
769 aActualText = OUString(
u'\x00ad');
775 if ( bBaselineShift )
779 if ( nVal > 0 ) nVal = 33;
780 else if ( nVal < 0 ) nVal = -33;
784 nVal = nVal * pPor->
Height() / 100;
789 if ( bTextDecorationType )
807 if ( nDefaultLang != nCurrentLanguage )
811 if ( bLinkAttribute )
817 auto aIter = std::find_if(rLinkIdMap.begin(), rLinkIdMap.end(),
818 [&aPorCenter](
const IdMapEntry& rEntry) {
return rEntry.first.IsInside(aPorCenter); });
819 if (aIter != rLinkIdMap.end())
821 sal_Int32 nLinkId = (*aIter).second;
830 OSL_ENSURE(
mpNumInfo,
"List without mpNumInfo?" );
835 OSL_ENSURE( rFrame.
IsTextFrame(),
"numbered only for text frames" );
840 if ( lcl_IsInNonStructEnv( rTextFrame ) || rTextFrame.IsFollow() )
843 const SwTextNode *
const pTextNd = rTextFrame.GetTextNodeForParaProps();
845 const SwNodeNum* pNodeNum = pTextNd->
GetNum(rTextFrame.getRootFrame());
847 const bool bNumbered = !pTextNd->
IsOutline() && pNodeNum && pNodeNum->
GetParent() && pNumRule;
856 const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(rTextFrame, *pTextNd);
859 if ( bSameNumbering )
861 sal_Int32 nReopenTag = -1;
871 if ( bNewSubListStart || bNoLabel )
876 if ( bNewSubListStart )
880 NumListBodyIdMap::const_iterator aIter;
883 aIter = rNumListBodyIdMap.find( pParent );
884 while ( aIter == rNumListBodyIdMap.end() &&
nullptr != ( pParent = pParent->
GetParent() ) );
886 if ( aIter != rNumListBodyIdMap.end() )
887 nReopenTag = (*aIter).second;
898 const NumListBodyIdMap::const_iterator aIter = rNumListBodyIdMap.find( pPrevious );
899 if ( aIter != rNumListBodyIdMap.end() )
901 nReopenTag = (*aIter).second;
905 pPrevious = pPrevious->
GetPred(
true);
921 const NumListIdMap::const_iterator aIter = rNumListIdMap.find( pPrevious );
922 if ( aIter != rNumListIdMap.end() )
924 nReopenTag = (*aIter).second;
928 pPrevious = pPrevious->
GetPred(
true);
932 if ( -1 != nReopenTag )
937 #if OSL_DEBUG_LEVEL > 1
946 rNumListIdMap.clear();
948 rNumListBodyIdMap.clear();
971 if ( lcl_IsInNonStructEnv( *pFrame ) )
993 aPDFType = aDocumentString;
1009 aPDFType = aDivString;
1019 aPDFType = aNoteString;
1037 aPDFType = aIndexString;
1042 aPDFType = aTOCString;
1049 aPDFType = aSectString;
1061 static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps();
1066 OUString sStyleName;
1067 OUString sParentStyleName;
1071 if ( pParentTextFormat)
1078 aPDFType = sStyleName;
1082 if (sStyleName == aQuotations)
1085 aPDFType = aBlockQuoteString;
1090 else if (sStyleName == aCaption)
1093 aPDFType = aCaptionString;
1098 else if (sParentStyleName == aCaption)
1101 aPDFType = sStyleName + aCaptionString;
1106 else if (sStyleName == aHeading)
1109 aPDFType = aHString;
1118 nRealLevel = std::min(nRealLevel, 5);
1124 aPDFType = aH1String;
1127 aPDFType = aH2String;
1130 aPDFType = aH3String;
1133 aPDFType = aH4String;
1136 aPDFType = aH5String;
1139 aPDFType = aH6String;
1169 aPDFType = aTableString;
1177 const TableColumnsMap::const_iterator aIter = rTableColumnsMap.find( pTable );
1179 if ( aIter == rTableColumnsMap.end() )
1186 while ( pMasterFrame )
1195 rCols.insert( nLeft );
1197 while ( pCellFrame )
1200 rCols.insert( nRight );
1201 pCellFrame = pCellFrame->
GetNext();
1205 pMasterFrame = pMasterFrame->
GetFollow();
1220 if ( !static_cast<const SwRowFrame*>(pFrame)->IsRepeatedHeadline() )
1223 aPDFType = aTRString;
1237 if ( pTable->
IsInHeadline( *pFrame ) || lcl_IsHeadlineCell( *static_cast<const SwCellFrame*>(pFrame) ) )
1240 aPDFType = aTHString;
1245 aPDFType = aTDString;
1262 bool bFormula =
false;
1269 uno::Reference< embed::XEmbeddedObject > aRef = aOLEObj.
GetOleRef();
1278 aPDFType = aFormulaString;
1283 aPDFType = aFigureString;
1289 aPDFType = aDivString;
1299 BeginTag( static_cast<vcl::PDFWriter::StructElement>(nPDFType), aPDFType );
1322 if ( lcl_IsInNonStructEnv( *pFrame ) )
1336 aPDFType = aSpanString;
1343 std::pair<SwTextNode const*, sal_Int32>
const pos(
1348 OUString sStyleName;
1349 if ( !pInetFormatAttr )
1351 std::vector<SwTextAttr *>
const charAttrs(
1355 ? (*charAttrs.begin())->GetCharFormat().GetCharFormat() :
nullptr;
1361 if( pInetFormatAttr )
1364 aPDFType = aLinkString;
1367 else if (sStyleName == aQuotation)
1370 aPDFType = aQuoteString;
1372 else if (sStyleName == aSourceText)
1375 aPDFType = aCodeString;
1389 nCurrentLanguage != nDefaultLang ||
1390 !sStyleName.isEmpty())
1393 if (!sStyleName.isEmpty())
1394 aPDFType = sStyleName;
1396 aPDFType = aSpanString;
1404 aPDFType = aLinkString;
1420 aPDFType = aLinkString;
1425 aPDFType = aBibEntryString;
1442 BeginTag( static_cast<vcl::PDFWriter::StructElement>(nPDFType), aPDFType );
1454 const OUString& rPageRange,
1455 bool bSkipEmptyPages,
1456 bool bEditEngineOnly,
1460 mbSkipEmptyPages( bSkipEmptyPages ),
1461 mbEditEngineOnly( bEditEngineOnly ),
1462 mrPrintData( rPrintData )
1464 if ( !rPageRange.isEmpty() )
1472 sal_Int32 nPageNumber = 0;
1475 if ( pCurrPage->IsEmptyPage() )
1480 pCurrPage =
static_cast<const SwPageFrame*
>( pCurrPage->GetNext() );
1490 #if OSL_DEBUG_LEVEL > 1
1497 if ( i18n::ScriptType::ASIAN == nScript )
1499 else if ( i18n::ScriptType::COMPLEX == nScript )
1521 double fScale = 0.75;
1522 aRectSize.
setWidth( aRectSize.Width() * fScale );
1523 aRectSize.setHeight( aRectSize.Height() * fScale );
1529 aRect.
Move(0, nShiftY);
1539 if ( !pPDFExtOutDevData )
1551 aMapMode.SetMapUnit( MapUnit::MapTwip );
1557 mrSh.SwCursorShell::Push();
1558 mrSh.SwCursorShell::ClearMark();
1569 std::vector<SwFormatField*> vpFields;
1571 for(
auto pFormatField : vpFields)
1573 const SwTextNode* pTNd = pFormatField->GetTextField()->GetpTextNode();
1574 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing");
1575 if(!lcl_TryMoveToNonHiddenField(
mrSh, *pTNd, *pFormatField))
1583 for (sal_Int32 aNotePageNum : aNotePageNums)
1592 const Color* pColor;
1593 pNumFormatter->
GetOutputString(aDateDiff.GetDate(), nFormat, sDate, &pColor);
1603 pPDFExtOutDevData->
CreateNote(aRect, aNote, aNotePageNum);
1605 mrSh.SwCursorShell::ClearMark();
1613 for(
auto &rAttr : aArr )
1616 OSL_ENSURE(
nullptr != p,
"Enhanced pdf export - SwGetINetAttr is missing" );
1619 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
1639 const bool bIntern =
'#' == aURL[0];
1647 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
1648 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
1654 sal_Int32 nDestId = -1;
1657 aURL = aURL.copy( 1 );
1658 mrSh.SwCursorShell::ClearMark();
1674 if ( -1 != nDestPageNum )
1677 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1681 if ( !bIntern || -1 != nDestId )
1688 const size_t nNumOfRects = aTmp.size();
1689 for (
size_t i = 0;
i < nNumOfRects; ++
i )
1692 const SwRect& rLinkRect( aTmp[
i ] );
1697 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1701 const sal_Int32 nLinkId =
1702 pPDFExtOutDevData->
CreateLink(aRect, aLinkPageNum);
1705 const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
1710 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1712 pPDFExtOutDevData->
SetLinkURL( nLinkId, aURL );
1715 if ( bHeaderFooter )
1722 mrSh.SwCursorShell::ClearMark();
1728 const size_t nSpzFrameFormatsCount = pTable->
size();
1729 for(
size_t n = 0;
n < nSpzFrameFormatsCount; ++
n )
1740 OUString
aURL( static_cast<const SwFormatURL*>(pItem)->GetURL() );
1741 const bool bIntern = !aURL.isEmpty() &&
'#' == aURL[0];
1744 sal_Int32 nDestId = -1;
1747 aURL = aURL.copy( 1 );
1748 mrSh.SwCursorShell::ClearMark();
1763 if ( -1 != nDestPageNum )
1766 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1770 if ( !bIntern || -1 != nDestId )
1779 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1782 const sal_Int32 nLinkId =
1783 pPDFExtOutDevData->
CreateLink(aRect, aLinkPageNum);
1787 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1789 pPDFExtOutDevData->
SetLinkURL( nLinkId, aURL );
1793 if (RndStdIds::FLY_AT_PAGE != rAnch.
GetAnchorId())
1813 if (aScreenPageNums.empty())
1816 uno::Reference<drawing::XShape> xShape(
pObject->getUnoShape(), uno::UNO_QUERY);
1817 if (xShape->getShapeType() ==
"com.sun.star.drawing.MediaShape")
1819 uno::Reference<beans::XPropertySet> xShapePropSet(xShape, uno::UNO_QUERY);
1821 xShapePropSet->getPropertyValue(
"MediaURL") >>= aMediaURL;
1822 if (!aMediaURL.isEmpty())
1826 for (sal_Int32 nScreenPageNum : aScreenPageNums)
1828 sal_Int32 nScreenId = pPDFExtOutDevData->
CreateScreen(aPDFRect, nScreenPageNum);
1829 if (aMediaURL.startsWith(
"vnd.sun.star.Package:"))
1832 OUString aTempFileURL;
1833 xShapePropSet->getPropertyValue(
"PrivateTempFileURL") >>= aTempFileURL;
1844 mrSh.SwCursorShell::ClearMark();
1849 std::vector<SwFormatField*> vpFields;
1851 for(
auto pFormatField : vpFields )
1853 if( pFormatField->GetTextField() && pFormatField->IsFieldInDoc() )
1855 const SwTextNode* pTNd = pFormatField->GetTextField()->GetpTextNode();
1856 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
1857 if(!lcl_TryMoveToNonHiddenField(
mrSh, *pTNd, *pFormatField))
1860 mrSh.SwCursorShell::SetMark();
1865 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
1866 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
1868 mrSh.SwCursorShell::ClearMark();
1881 if ( -1 != nDestPageNum )
1885 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1892 const size_t nNumOfRects = aTmp.size();
1893 for (
size_t i = 0;
i < nNumOfRects; ++
i )
1896 const SwRect& rLinkRect( aTmp[
i ] );
1901 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1905 const sal_Int32 nLinkId =
1906 pPDFExtOutDevData->
CreateLink(aRect, aLinkPageNum);
1909 const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
1913 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1916 if ( bHeaderFooter )
1924 mrSh.SwCursorShell::ClearMark();
1932 for (
size_t nIdx = 0; nIdx < nFootnoteCount; ++nIdx )
1953 mrSh.SwCursorShell::SetMark();
1958 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
1959 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
1962 mrSh.SwCursorShell::ClearMark();
1967 const SwRect aLinkRect( aTmp[ 0 ] );
1984 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1988 const sal_Int32 nLinkId =
1989 pPDFExtOutDevData->
CreateLink(aRect, aLinkPageNum);
1992 const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
1995 if ( -1 != nDestPageNum )
1999 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(rDestRect.
SVRect(), nDestPageNum);
2002 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
2012 typedef std::pair< sal_Int8, sal_Int32 > StackEntry;
2013 std::stack< StackEntry > aOutlineStack;
2014 aOutlineStack.push( StackEntry( -1, -1 ) );
2022 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
2032 sal_Int8 nLevelOnTopOfStack = aOutlineStack.top().first;
2033 while ( nLevelOnTopOfStack >= nLevel &&
2034 nLevelOnTopOfStack != -1 )
2036 aOutlineStack.pop();
2037 nLevelOnTopOfStack = aOutlineStack.top().first;
2039 const sal_Int32 nParent = aOutlineStack.top().second;
2051 if ( -1 != nDestPageNum )
2055 const sal_Int32 nDestId =
2056 pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
2063 const sal_Int32 nOutlineId =
2067 aOutlineStack.push( StackEntry( nLevel, nOutlineId ) );
2085 const ::sw::mark::IMark* pBkmk = *ppMark;
2086 mrSh.SwCursorShell::ClearMark();
2087 const OUString& sBkName = pBkmk->GetName();
2105 if ( -1 != nDestPageNum )
2111 mrSh.SwCursorShell::ClearMark();
2120 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->
GetBookmarks();
2121 for (
const auto& rBookmark : rBookmarks )
2123 OUString aBookmarkName( rBookmark.aBookmark );
2124 const bool bIntern =
'#' == aBookmarkName[0];
2127 aBookmarkName = aBookmarkName.copy( 1 );
2139 if ( -1 != nDestPageNum )
2142 if ( rBookmark.nLinkId != -1 )
2145 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
2148 pPDFExtOutDevData->
SetLinkDest( rBookmark.nLinkId, nDestId );
2157 pPDFExtOutDevData->
SetLinkURL( rBookmark.nLinkId, aBookmarkName );
2171 if (!pPDFExtOutDevData)
2176 std::vector<SwFormatField*> aFields;
2185 for (
const auto pFormatField : aFields)
2187 if (!pFormatField->GetTextField() || !pFormatField->IsFieldInDoc())
2192 const auto& rAuthorityField
2194 if (!rAuthorityField.HasURL())
2201 if (!lcl_TryMoveToNonHiddenField(
mrSh, rTextNode, *pFormatField))
2207 mrSh.SwCursorShell::SetMark();
2211 for (
const auto& rLinkRect : *
mrSh.SwCursorShell::GetCursor_())
2216 sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, rLinkPageNum);
2219 pPDFExtOutDevData->SetLinkURL(nLinkId, rURL);
2223 mrSh.SwCursorShell::ClearMark();
2232 if ( !aPageNums.empty() )
2233 return aPageNums[0];
2241 const SwRect& rRect )
const
2243 std::vector< sal_Int32 > aPageNums;
2247 if ( nPageNumOfRect < 0 )
2259 sal_Int32 nOutputPageNum = 0;
2262 for ( ; aIter != aEnd; ++aIter )
2264 if ( *aIter == nPageNumOfRect )
2265 aPageNums.push_back( nOutputPageNum );
2274 sal_Int32 nOutputPageNum = 0;
2279 if (
i == static_cast<size_t>( nPageNumOfRect ) )
2281 aPageNums.push_back( nOutputPageNum );
2289 aPageNums.push_back( nPageNumOfRect );
2299 const OUString& rURL,
2300 bool bIntern )
const
2311 SwRect aHFLinkRect( rLinkRect );
2317 if ( aHFLinkRect.
Pos() != rLinkRect.
Pos() )
2322 for (sal_Int32 aHFLinkPageNum : aHFLinkPageNums)
2326 const sal_Int32 nHFLinkId =
2327 rPDFExtOutDevData.
CreateLink(aRect, aHFLinkPageNum);
2331 rPDFExtOutDevData.
SetLinkDest( nHFLinkId, nDestId );
2333 rPDFExtOutDevData.
SetLinkURL( nHFLinkId, rURL );
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Instances of SwFields and those derived from it occur 0 to n times.
SwFrame * FindFooterOrHeader()
OUString const & GetAuthorField(ToxAuthorityField ePos) const
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
tools::Long GetRight(const SwRect &rRect) const
const Por_Info * mpPorInfo
static LanguageType GetDefaultLanguage()
sal_uInt8 m_nEndStructureElement
const SwSortedObjs * GetDrawObjs() const
Marks a position in the document model.
void EndStructureElements()
const SwNodes & GetNodes() const
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
bool JumpToSwMark(SwViewShell const *pVwSh, const OUString &rMark)
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr) const
LanguageType GetLanguage() const
Language at field position.
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
A tree of numbered nodes.
void setWidth(tools::Long nWidth)
sal_uInt16 Height() const
SwPostItMode GetPrintPostIts() const
const SwOLEObj & GetOLEObj() const
const OUString & GetText() const
bool IsOutline() const
Returns if this text node is an outline.
SwTextAttr * GetAttr(TextFrameIndex nPos) const
Returns the attribute for a position.
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
virtual OUString getOutlineText(const tSortedOutlineNodeList::size_type nIdx, SwRootFrame const *pLayout, const bool bWithNumber=true, const bool bWithSpacesForLevel=false, const bool bWithFootnote=true) const =0
vcl::PDFExtOutDevData * mpPDFExtOutDevData
tools::Long GetLeftMargin(const SwFrame &rFrame) const
void CheckRestoreTag() const
const SwTable * GetTable() const
bool SetCurrentStructureElement(sal_Int32 nElement)
static TableColumnsMap s_aTableColumnsMap
std::unique_ptr< StringRangeEnumerator > mpRangeEnum
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
SwFrameType GetType() const
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
SwNumberTreeNode * GetPred(bool bSibling=false) const
Returns the greatest descendant of the root that is smaller than this node, aka the predecessor of th...
void SetScreenURL(sal_Int32 nScreenId, const OUString &rURL)
void BeginTag(vcl::PDFWriter::StructElement aTagRole, const OUString &rTagName)
Base class of all fields.
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
SwNumberTreeNode * GetParent() const
Returns the parent of this node.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
static LinkIdMap s_aLinkIdMap
static LanguageType s_eLanguageDefault
SwNode * DocumentSectionStartNode(SwNode *pNode) const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
static FrameTagIdMap s_aFrameTagIdMap
Provides access to the marks of a document.
void SetStructureAttribute(PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal)
virtual OUString GetPar1() const override
Author.
void MakeHeaderFooterLinks(vcl::PDFExtOutDevData &rPDFExtOutDevData, const SwTextNode &rTNd, const SwRect &rLinkRect, sal_Int32 nDestId, const OUString &rURL, bool bIntern) const
const MapMode & GetMapMode() const
bool IsFootnoteDeleted(IDocumentRedlineAccess const &rIDRA, SwTextFootnote const &rTextFootnote)
bool IsFirst(const SwNumberTreeNode *pNode) const
Return if a node is first non-phantom child of this node.
void Pos(const Point &rNew)
FontStrikeout GetStrikeout() const
IDocumentMarkAccess * getIDocumentMarkAccess()
std::vector< IdMapEntry > LinkIdMap
sal_Int32 m_nRestoreCurrentTag
Of course Writer needs its own rectangles.
tools::Long GetWidth(const SwRect &rRect) const
const SwPrintData & mrPrintData
static SwFlowFrame * CastFlowFrame(SwFrame *pFrame)
bool IsListRestart() const
EmbeddedObjectRef * pObject
const SwFrameFormats * GetSpzFrameFormats() const
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
int GetAttrOutlineLevel() const
Returns outline level of this text node.
void GetINetAttrs(SwGetINetAttrs &rArr)
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
sal_Int32 getRowSpan() const
void SetAttributes(vcl::PDFWriter::StructElement eType)
bool SelectHiddenRange()
If the current cursor position is inside a hidden range, the hidden range is selected.
bool GetIsExportNamedDestinations() const
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
const SwLinePortion & mrPor
const SwTableBox * GetTabBox() const
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
const SwRect & getFrameArea() const
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
bool GotoFootnoteText()
jump from content to footnote
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
std::vector< SwGetINetAttr > SwGetINetAttrs
const OUString & GetText() const
const SwRowFrame * IsInSplitTableRow() const
SwTextPaintInfo & GetInfo()
sal_Int32 GetStart() const
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
const SwFormatField & GetFormatField() const
FontEmphasisMark GetEmphasisMark() const
tools::Long GetLeft(const SwRect &rRect) const
static sal_uInt16 IsMath(const SvGlobalName &rName)
static FrameTagIdMap & GetFrameTagIdMap()
void ExportAuthorityEntryLinks()
Exports bibliography entry links.
sal_Int32 GetCurrentStructureElement() const
static NumListIdMap s_aNumListIdMap
SwFontScript GetActual() const
SwAuthEntry * GetAuthEntry() const
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
SwShellCursor * GetCursor_()
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
SwTextNode const * GetTextNodeForParaProps() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
A helper class to save cursor state (position).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
void BeginNumberedListStructureElements()
sal_uInt16 GetPageCount() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
std::map< const SwTable *, TableColumnsMapEntry > TableColumnsMap
const Num_Info * mpNumInfo
const SwPosition * GetPoint() const
bool GetIsExportTaggedPDF() const
SwIndex & Assign(SwIndexReg *, sal_Int32)
const SwTOXBase * GetTOXBase() const
void SetStructureAttributeNumerical(PDFWriter::StructAttribute eAttr, sal_Int32 nValue)
SwPageFrame * FindPageFrame()
const SwTextINetFormat & rINetAttr
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
const SwTextPainter & mrTextPainter
const SwFrame * Lower() const
tools::Long GetHeight(const SwRect &rRect) const
FontLineStyle GetOverline() const
SwTaggedPDFHelper(const Num_Info *pNumInfo, const Frame_Info *pFrameInfo, const Por_Info *pPorInfo, OutputDevice const &rOut)
bool GotoINetAttr(const SwTextINetFormat &rAttr)
std::pair< SwRect, sal_Int32 > IdMapEntry
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
SwLayoutFrame * GetUpper()
std::set< tools::Long, lt_TableColumn > TableColumnsMapEntry
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
static sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
void CalcRect(const SwLinePortion &rPor, SwRect *pRect, SwRect *pIntersect=nullptr, const bool bInsideBox=false) const
Calculate the rectangular area where the portion takes place.
virtual tSortedOutlineNodeList::size_type getOutlineNodesCount() const =0
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
sal_Int32 CalcOutputPageNum(const SwRect &rRect) const
static bool IsExportTaggedPDF(const OutputDevice &rOut)
bool GetIsExportNotes() const
const SwRowFrame * IsInFollowFlowRow() const
tools::Long GetTopMargin(const SwFrame &rFrame) const
TextFrameIndex GetIdx() const
Marks a node in the document model.
std::vector< sal_Int32 > maPageNumberMap
The problem is that numbers in StringRangeEnumerator aren't accordant to real page numbers if mbSkipE...
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
OUString SwResId(const char *pId)
~SwEnhancedPDFExportHelper()
tools::Long GetRightMargin(const SwFrame &rFrame) const
const SwTextNode * GetpTextNode() const
TextFrameIndex GetLen() const
A page of the document layout.
void BeginInlineStructureElements()
SwTextFrame * GetTextFrame()
sal_Int32 BeginStructureElement(PDFWriter::StructElement eType, const OUString &rAlias=OUString())
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
SwPostItMode
this must match the definitions in css::text::NotePrintMode
sal_Int32 CreateScreen(const tools::Rectangle &rRect, sal_Int32 nPageNr)
SwTable is one table in the document model, containing rows (which contain cells).
const OUString & GetText() const
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
SwSectionFrame * FindSctFrame()
FontLineStyle GetUnderline() const
const LanguageTag & getLocale()
void DescribeRegisteredDest(sal_Int32 nDestId, const tools::Rectangle &rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
Base class for anything that can be part of a line in the Writer layout.
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
std::map< const SwNumberTreeNode *, sal_Int32 > NumListBodyIdMap
SwTextNode is a paragraph in the document model.
void CreateNote(const tools::Rectangle &rRect, const PDFNote &rNote, sal_Int32 nPageNr=-1)
For querying the INet-attributes for Navigator.
const Frame_Info * mpFrameInfo
LanguageType GetLanguage() const
std::vector< SwRect > SwRects
const SwContentNode * GetNode() const
std::map< const SwNumberTreeNode *, sal_Int32 > NumListIdMap
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
SwFieldIds Which() const
ResId.
tools::Rectangle SVRect() const
tools::Long GetBottomMargin(const SwFrame &rFrame) const
general base class for all free-flowing frames
static std::vector< sal_uInt16 > aStructStack
static TableColumnsMap & GetTableColumnsMap()
PortionType GetWhichPor() const
sal_Int32 GetPageNumAndSetOffsetForPDF(OutputDevice &rOut, const SwRect &rRect) const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
std::vector< PDFExtOutDevBookmarkEntry > & GetBookmarks()
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
bool IsCountedInList() const
bool IsNoTextFrame() const
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
LanguageType GetAppLanguage()
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
bool IsRightToLeft() const
sal_Int32 CreateLink(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
const SwRect & GetCharRect() const
std::map< const void *, sal_Int32 > FrameTagIdMap
const OUString & GetSetRefName() const
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
const Point & GetOrigin() const
std::vector< sal_Int32 > CalcOutputPageNums(const SwRect &rRect) const
void SetDocumentLocale(const css::lang::Locale &rLoc)
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
sal_Int32 CreateOutlineItem(sal_Int32 nParent, const OUString &rText, sal_Int32 nDestID)
static NumListIdMap & GetNumListIdMap()
void GotoPrevLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
void BeginBlockStructureElements()
const SwTabFrame * GetFollow() const
static NumListBodyIdMap s_aNumListBodyIdMap
void SetActualText(const OUString &rText)
const sal_uInt16 CRSR_SKIP_CHARS
bool GetIsExportBookmarks() const
SwFootnoteIdxs & GetFootnoteIdxs()
vcl::ExtOutDevData * GetExtOutDevData() const
SwFormatColl * GetFormatColl() const
static LinkIdMap & GetLinkIdMap()
virtual bool IsCounted() const
Return if this node is counted.
void SetScreenStream(sal_Int32 nScreenId, const OUString &rURL)
SectionType GetType() const
SwEnhancedPDFExportHelper(SwEditShell &rSh, OutputDevice &rOut, const OUString &rPageRange, bool bSkipEmptyPages, bool bEditEngineOnly, const SwPrintData &rPrintData)
std::vector< SwNode * >::size_type size_type
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
static NumListBodyIdMap & GetNumListBodyIdMap()
SwRootFrame * GetLayout() const
void Push(PushFlags nFlags=PushFlags::ALL)
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
short GetEscapement() const
void SetStructureBoundingBox(const tools::Rectangle &rRect)
bool GotoOutline(const OUString &rName)
void Height(tools::Long nNew)
tools::Rectangle SwRectToPDFRect(const SwPageFrame *pCurrPage, const tools::Rectangle &rRectangle) const
void EndStructureElement()
virtual sal_uInt16 GetSubType() const override
Get/set sub type.
bool GotoFormatField(const SwFormatField &rField)
bool IsFooterFrame() const
SwRootFrame * getRootFrame()
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
bool IsViewLocked() const
SwCellFrame is one table cell in the document layout.
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
const SwFormatINetFormat & GetINetFormat() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwRowFrame is one table row in the document layout.
bool IsHeaderFrame() const
bool IsInHeadline(const SwFrame &rFrame) const
SwTabFrame * FindTabFrame()
Base class of the Writer document model elements.
static OUString decode(OUString const &rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)