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>
101#if OSL_DEBUG_LEVEL > 1
133const char aTableHeadingName[] =
"Table Heading";
134const char aQuotations[] =
"Quotations";
135const char aCaption[] =
"Caption";
136const char aHeading[] =
"Heading";
137const char aQuotation[] =
"Quotation";
138const char aSourceText[] =
"Source Text";
141constexpr OUStringLiteral aDocumentString =
u"Document";
142constexpr OUStringLiteral aDivString =
u"Div";
143constexpr OUStringLiteral aSectString =
u"Sect";
144constexpr OUStringLiteral aHString =
u"H";
145constexpr OUStringLiteral aH1String =
u"H1";
146constexpr OUStringLiteral aH2String =
u"H2";
147constexpr OUStringLiteral aH3String =
u"H3";
148constexpr OUStringLiteral aH4String =
u"H4";
149constexpr OUStringLiteral aH5String =
u"H5";
150constexpr OUStringLiteral aH6String =
u"H6";
151constexpr OUStringLiteral aListString =
u"L";
152constexpr OUStringLiteral aListItemString =
u"LI";
153constexpr OUStringLiteral aListBodyString =
u"LBody";
154constexpr OUStringLiteral aBlockQuoteString =
u"BlockQuote";
155constexpr OUStringLiteral aCaptionString =
u"Caption";
156constexpr OUStringLiteral aIndexString =
u"Index";
157constexpr OUStringLiteral aTOCString =
u"TOC";
158constexpr OUStringLiteral aTOCIString =
u"TOCI";
159constexpr OUStringLiteral aTableString =
u"Table";
160constexpr OUStringLiteral aTRString =
u"TR";
161constexpr OUStringLiteral aTDString =
u"TD";
162constexpr OUStringLiteral aTHString =
u"TH";
163constexpr OUStringLiteral aBibEntryString =
u"BibEntry";
164constexpr OUStringLiteral aQuoteString =
u"Quote";
165constexpr OUStringLiteral aSpanString =
u"Span";
166constexpr OUStringLiteral aCodeString =
u"Code";
167constexpr OUStringLiteral aFigureString =
u"Figure";
168constexpr OUStringLiteral aFormulaString =
u"Formula";
169constexpr OUStringLiteral aLinkString =
u"Link";
170constexpr OUStringLiteral aNoteString =
u"Note";
173bool lcl_IsHeadlineCell(
const SwCellFrame& rCellFrame )
185 bRet = sStyleName == aTableHeadingName;
192bool lcl_IsInNonStructEnv(
const SwFrame& rFrame )
204 if ( rFrame.
GetUpper() != pTabFrame &&
205 pTabFrame->IsFollow() && pTabFrame->
IsInHeadline( rFrame ) )
213void* lcl_GetKeyFromFrame(
const SwFrame& rFrame )
215 void* pKey =
nullptr;
218 pKey =
const_cast<void*
>(
static_cast<void const *
>(&(
static_cast<const SwPageFrame&
>(rFrame).
GetFormat()->getIDocumentSettingAccess())));
224 pKey =
const_cast<void*
>(
static_cast<void const *
>(
static_cast<const SwTabFrame&
>(rFrame).
GetTable()));
226 pKey =
const_cast<void*
>(
static_cast<void const *
>(
static_cast<const SwRowFrame&
>(rFrame).
GetTabLine()));
231 pKey =
const_cast<void*
>(
static_cast<void const *
>(&
static_cast<const SwCellFrame&
>(rFrame).GetTabBox()->FindStartOfRowSpan( *pTable )));
243 const SwNode* pNode = &rNode;
250 if (aIdx.GetNode().IsTextNode())
253 *rTextFrame.
getRootFrame(), *aIdx.GetNode().GetTextNode());
258 if ( (pPrevNumRule == pNumRule) &&
265 pNode = &aIdx.GetNode();
279 rShell.SwCursorShell::ClearMark();
291 : m_nEndStructureElement( 0 ),
292 m_nRestoreCurrentTag( -1 ),
293 mpNumInfo( pNumInfo ),
294 mpFrameInfo( pFrameInfo ),
295 mpPorInfo( pPorInfo )
303#if OSL_DEBUG_LEVEL > 1
316#if OSL_DEBUG_LEVEL > 1
319 (void)nCurrentStruct;
328#if OSL_DEBUG_LEVEL > 1
334#if OSL_DEBUG_LEVEL > 1
337 (void)nCurrentStruct;
343 void const*
const pKey = lcl_GetKeyFromFrame(rFrame);
348 auto const it(rFrameTagIdMap.find(pKey));
349 if (it != rFrameTagIdMap.end())
366 sal_Int32 nReopenTag = -1;
367 bool bContinue =
false;
372 const SwFrame* pKeyFrame =
nullptr;
382 ( rFrame.
IsFlowFrame() && SwFlowFrame::CastFlowFrame(&rFrame)->IsFollow() ) ||
392 if ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
393 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()) ||
396 pKeyFrame =
static_cast<const SwFlyFrame&
>(rFrame).GetAnchorFrame();
407 if ( -1 != nReopenTag )
411 OSL_ENSURE( bSuccess,
"Failed to reopen tag" );
413#if OSL_DEBUG_LEVEL > 1
420 return bRet && !bContinue;
428 OSL_ENSURE( bSuccess,
"Failed to restore reopened tag" );
430#if OSL_DEBUG_LEVEL > 1
442#if OSL_DEBUG_LEVEL > 1
463 rNumListIdMap[ pNodeNum ] =
nId;
468 rNumListBodyIdMap[ pNodeNum ] =
nId;
476 ( rFrame.
IsFlowFrame() && !SwFlowFrame::CastFlowFrame(&rFrame)->IsFollow() && SwFlowFrame::CastFlowFrame(&rFrame)->HasFollow() ) ||
481 const void* pKey = lcl_GetKeyFromFrame( rFrame );
486 rFrameTagIdMap[ pKey ] =
nId;
498#if OSL_DEBUG_LEVEL > 1
517 bool bPlacement =
false;
518 bool bWritingMode =
false;
519 bool bSpaceBefore =
false;
520 bool bSpaceAfter =
false;
521 bool bStartIndent =
false;
522 bool bEndIndent =
false;
523 bool bTextIndent =
false;
524 bool bTextAlign =
false;
526 bool bHeight =
false;
528 bool bRowSpan =
false;
529 bool bAltText =
false;
663 OSL_ENSURE( pFrame->
IsTextFrame(),
"Frame type <-> tag attribute mismatch" );
665 static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
673 OSL_ENSURE( pFrame->
IsTextFrame(),
"Frame type <-> tag attribute mismatch" );
674 const SwAttrSet& aSet =
static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet();
676 if ( SvxAdjust::Block ==
nAdjust || SvxAdjust::Center ==
nAdjust ||
680 eVal = SvxAdjust::Block ==
nAdjust ?
702 ? OUString() : OUString(
" - "));
704 if (!altText.isEmpty())
727 !
static_cast<const SwTabFrame*
>(pFrame)->IsFollow() &&
728 !
static_cast<const SwTabFrame*
>(pFrame)->HasFollow() ) )
753 const TableColumnsMapEntry::const_iterator aLeftIter = rCols.find( nLeft );
754 const TableColumnsMapEntry::const_iterator aRightIter = rCols.find( nRight );
756 OSL_ENSURE( aLeftIter != rCols.end() && aRightIter != rCols.end(),
"Colspan trouble" );
757 if ( aLeftIter != rCols.end() && aRightIter != rCols.end() )
759 nVal = std::distance( aLeftIter, aRightIter );
775 bool bActualText =
false;
776 bool bBaselineShift =
false;
777 bool bTextDecorationType =
false;
778 bool bLinkAttribute =
false;
779 bool bLanguage =
false;
794 bTextDecorationType =
800 bTextDecorationType =
812 OUString aActualText;
814 aActualText = OUString(
u'\x00ad');
820 if ( bBaselineShift )
824 if ( nVal > 0 ) nVal = 33;
825 else if ( nVal < 0 ) nVal = -33;
829 nVal = nVal * pPor->
Height() / 100;
834 if ( bTextDecorationType )
852 if ( nDefaultLang != nCurrentLanguage )
856 if ( bLinkAttribute )
862 auto aIter = std::find_if(rLinkIdMap.begin(), rLinkIdMap.end(),
863 [&aPorCenter](
const IdMapEntry& rEntry) { return rEntry.first.Contains(aPorCenter); });
864 if (aIter != rLinkIdMap.end())
866 sal_Int32 nLinkId = (*aIter).second;
875 OSL_ENSURE(
mpNumInfo,
"List without mpNumInfo?" );
880 OSL_ENSURE( rFrame.
IsTextFrame(),
"numbered only for text frames" );
885 if ( lcl_IsInNonStructEnv( rTextFrame ) || rTextFrame.IsFollow() )
892 const bool bNumbered = !pTextNd->
IsOutline() && pNodeNum && pNodeNum->
GetParent() && pNumRule;
901 const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(rTextFrame, *pTextNd);
904 if ( bSameNumbering )
906 sal_Int32 nReopenTag = -1;
916 if ( bNewSubListStart || bNoLabel )
921 if ( bNewSubListStart )
925 NumListBodyIdMap::const_iterator aIter;
928 aIter = rNumListBodyIdMap.find( pParent );
929 while ( aIter == rNumListBodyIdMap.end() &&
nullptr != ( pParent = pParent->
GetParent() ) );
931 if ( aIter != rNumListBodyIdMap.end() )
932 nReopenTag = (*aIter).second;
943 const NumListBodyIdMap::const_iterator aIter = rNumListBodyIdMap.find( pPrevious );
944 if ( aIter != rNumListBodyIdMap.end() )
946 nReopenTag = (*aIter).second;
950 pPrevious = pPrevious->
GetPred(
true);
966 const NumListIdMap::const_iterator aIter = rNumListIdMap.find( pPrevious );
967 if ( aIter != rNumListIdMap.end() )
969 nReopenTag = (*aIter).second;
973 pPrevious = pPrevious->
GetPred(
true);
977 if ( -1 != nReopenTag )
982#if OSL_DEBUG_LEVEL > 1
991 rNumListIdMap.clear();
993 rNumListBodyIdMap.clear();
1016 if (lcl_IsInNonStructEnv(*pFrame) && !pFrame->
IsFlyFrame())
1024 sal_uInt16 nPDFType = USHRT_MAX;
1038 aPDFType = aDocumentString;
1054 aPDFType = aDivString;
1064 aPDFType = aNoteString;
1082 aPDFType = aIndexString;
1087 aPDFType = aTOCString;
1094 aPDFType = aSectString;
1106 static_cast<const SwTextFrame*
>(pFrame)->GetTextNodeForParaProps();
1111 OUString sStyleName;
1112 OUString sParentStyleName;
1116 if ( pParentTextFormat)
1123 aPDFType = sStyleName;
1127 if (sStyleName == aQuotations)
1130 aPDFType = aBlockQuoteString;
1135 else if (sStyleName == aCaption)
1138 aPDFType = aCaptionString;
1143 else if (sParentStyleName == aCaption)
1146 aPDFType = sStyleName + aCaptionString;
1151 else if (sStyleName == aHeading)
1154 aPDFType = aHString;
1163 nRealLevel =
std::min(nRealLevel, 5);
1169 aPDFType = aH1String;
1172 aPDFType = aH2String;
1175 aPDFType = aH3String;
1178 aPDFType = aH4String;
1181 aPDFType = aH5String;
1184 aPDFType = aH6String;
1214 aPDFType = aTableString;
1222 const TableColumnsMap::const_iterator aIter = rTableColumnsMap.find( pTable );
1224 if ( aIter == rTableColumnsMap.end() )
1229 const SwTabFrame* pMasterFrame = pTabFrame->IsFollow() ? pTabFrame->
FindMaster(
true ) : pTabFrame;
1231 while ( pMasterFrame )
1240 rCols.insert( nLeft );
1242 while ( pCellFrame )
1245 rCols.insert( nRight );
1246 pCellFrame = pCellFrame->
GetNext();
1250 pMasterFrame = pMasterFrame->
GetFollow();
1268 aPDFType = aTRString;
1285 aPDFType = aTHString;
1290 aPDFType = aTDString;
1312 bool bFormula =
false;
1319 uno::Reference< embed::XEmbeddedObject > aRef = aOLEObj.
GetOleRef();
1328 aPDFType = aFormulaString;
1333 aPDFType = aFigureString;
1339 aPDFType = aDivString;
1347 if ( USHRT_MAX != nPDFType )
1372 if ( lcl_IsInNonStructEnv( *pFrame ) )
1375 sal_uInt16 nPDFType = USHRT_MAX;
1386 aPDFType = aSpanString;
1393 std::pair<SwTextNode const*, sal_Int32>
const pos(
1398 OUString sStyleName;
1399 if ( !pInetFormatAttr )
1401 std::vector<SwTextAttr *>
const charAttrs(
1405 ? (*charAttrs.begin())->GetCharFormat().GetCharFormat() :
nullptr;
1411 if( pInetFormatAttr )
1414 aPDFType = aLinkString;
1417 else if (sStyleName == aQuotation)
1420 aPDFType = aQuoteString;
1422 else if (sStyleName == aSourceText)
1425 aPDFType = aCodeString;
1439 nCurrentLanguage != nDefaultLang ||
1440 !sStyleName.isEmpty())
1443 if (!sStyleName.isEmpty())
1444 aPDFType = sStyleName;
1446 aPDFType = aSpanString;
1454 aPDFType = aLinkString;
1470 aPDFType = aLinkString;
1475 aPDFType = aBibEntryString;
1490 if ( USHRT_MAX != nPDFType )
1504 const OUString& rPageRange,
1505 bool bSkipEmptyPages,
1506 bool bEditEngineOnly,
1510 mbSkipEmptyPages( bSkipEmptyPages ),
1511 mbEditEngineOnly( bEditEngineOnly ),
1512 mrPrintData( rPrintData )
1514 if ( !rPageRange.isEmpty() )
1522 sal_Int32 nPageNumber = 0;
1540#if OSL_DEBUG_LEVEL > 1
1547 if ( i18n::ScriptType::ASIAN == nScript )
1549 else if ( i18n::ScriptType::COMPLEX == nScript )
1571 double fScale = 0.75;
1579 aRect.
Move(0, nShiftY);
1589 if ( !pPDFExtOutDevData )
1607 mrSh.SwCursorShell::Push();
1608 mrSh.SwCursorShell::ClearMark();
1619 std::vector<SwFormatField*> vpFields;
1621 for(
auto pFormatField : vpFields)
1623 const SwTextNode* pTNd = pFormatField->GetTextField()->GetpTextNode();
1624 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing");
1625 if(!lcl_TryMoveToNonHiddenField(
mrSh, *pTNd, *pFormatField))
1633 for (sal_Int32 aNotePageNum : aNotePageNums)
1642 const Color* pColor;
1653 pPDFExtOutDevData->
CreateNote(aRect, aNote, aNotePageNum);
1655 mrSh.SwCursorShell::ClearMark();
1663 for(
auto &rAttr :
aArr )
1666 OSL_ENSURE(
nullptr !=
p,
"Enhanced pdf export - SwGetINetAttr is missing" );
1668 const SwTextNode* pTNd =
p->rINetAttr.GetpTextNode();
1669 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
1685 p->rINetAttr.GetINetFormat().GetValue(),
1689 const bool bIntern =
'#' ==
aURL[0];
1697 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
1698 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
1705 sal_Int32 nDestId = -1;
1709 mrSh.SwCursorShell::ClearMark();
1725 if ( -1 != nDestPageNum )
1728 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1732 if ( !bIntern || -1 != nDestId )
1738 const size_t nNumOfRects = aTmp.size();
1739 for (
size_t i = 0;
i < nNumOfRects; ++
i )
1742 const SwRect& rLinkRect( aTmp[
i ] );
1747 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1751 const sal_Int32 nLinkId =
1752 pPDFExtOutDevData->
CreateLink(aRect, altText, aLinkPageNum);
1755 const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
1760 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1765 if ( bHeaderFooter )
1772 mrSh.SwCursorShell::ClearMark();
1778 const size_t nSpzFrameFormatsCount = pTable->
size();
1779 for(
size_t n = 0;
n < nSpzFrameFormatsCount; ++
n )
1793 const bool bIntern =
'#' ==
aURL[0];
1796 sal_Int32 nDestId = -1;
1800 mrSh.SwCursorShell::ClearMark();
1815 if ( -1 != nDestPageNum )
1818 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1822 if ( !bIntern || -1 != nDestId )
1826 OUString
const formatName(pFrameFormat->
GetName());
1831 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1834 const sal_Int32 nLinkId =
1835 pPDFExtOutDevData->
CreateLink(aRect, formatName, aLinkPageNum);
1839 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1845 if (RndStdIds::FLY_AT_PAGE != rAnch.
GetAnchorId())
1865 if (aScreenPageNums.empty())
1868 uno::Reference<drawing::XShape> xShape(
pObject->getUnoShape(), uno::UNO_QUERY);
1869 if (xShape->getShapeType() ==
"com.sun.star.drawing.MediaShape")
1871 uno::Reference<beans::XPropertySet> xShapePropSet(xShape, uno::UNO_QUERY);
1873 xShapePropSet->getPropertyValue(
"MediaURL") >>= aMediaURL;
1874 if (!aMediaURL.isEmpty())
1878 for (sal_Int32 nScreenPageNum : aScreenPageNums)
1880 sal_Int32 nScreenId = pPDFExtOutDevData->
CreateScreen(aPDFRect, nScreenPageNum);
1881 if (aMediaURL.startsWith(
"vnd.sun.star.Package:"))
1884 OUString aTempFileURL;
1885 xShapePropSet->getPropertyValue(
"PrivateTempFileURL") >>= aTempFileURL;
1896 mrSh.SwCursorShell::ClearMark();
1901 std::vector<SwFormatField*> vpFields;
1903 for(
auto pFormatField : vpFields )
1905 if( pFormatField->GetTextField() && pFormatField->IsFieldInDoc() )
1907 const SwTextNode* pTNd = pFormatField->GetTextField()->GetpTextNode();
1908 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
1909 if(!lcl_TryMoveToNonHiddenField(
mrSh, *pTNd, *pFormatField))
1912 mrSh.SwCursorShell::SetMark();
1917 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
1918 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
1920 mrSh.SwCursorShell::ClearMark();
1933 if ( -1 != nDestPageNum )
1937 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
1944 const size_t nNumOfRects = aTmp.size();
1945 for (
size_t i = 0;
i < nNumOfRects; ++
i )
1948 const SwRect& rLinkRect( aTmp[
i ] );
1953 for (sal_Int32 aLinkPageNum : aLinkPageNums)
1957 const sal_Int32 nLinkId =
1958 pPDFExtOutDevData->
CreateLink(aRect, content, aLinkPageNum);
1961 const IdMapEntry aLinkEntry( rLinkRect, nLinkId );
1965 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
1968 if ( bHeaderFooter )
1976 mrSh.SwCursorShell::ClearMark();
1984 for (
size_t nIdx = 0; nIdx < nFootnoteCount; ++nIdx )
2004 mrSh.SwCursorShell::SetMark();
2009 aTmp.insert( aTmp.begin(),
mrSh.SwCursorShell::GetCursor_()->begin(),
mrSh.SwCursorShell::GetCursor_()->end() );
2010 OSL_ENSURE( !aTmp.empty(),
"Enhanced pdf export - rectangles are missing" );
2013 mrSh.SwCursorShell::ClearMark();
2018 const SwRect aLinkRect( aTmp[ 0 ] );
2026 if ( -1 != nDestPageNum )
2037 fnSymbolRect =
SwRect(rDestRect.
Pos().X(),fnSymbolTop,rDestRect.
Width(),symbolHeight);
2042 fnSymbolRect =
SwRect(rDestRect.
Pos().X(),rDestRect.
Pos().Y(),symbolWidth,rDestRect.
Height());
2046 fnSymbolRect =
SwRect(fnSymbolLeft,rDestRect.
Pos().Y(),symbolWidth,rDestRect.
Height());
2055 const sal_Int32 nBackLinkId = pPDFExtOutDevData->
CreateLink(aFootnoteSymbolRect, numStrSymbol, nDestPageNum);
2057 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
2064 const sal_Int32 nLinkId = pPDFExtOutDevData->
CreateLink(aRect, numStrRef, aLinkPageNum);
2066 const sal_Int32 nBackDestId = pPDFExtOutDevData->
CreateDest(aRect, aLinkPageNum);
2068 const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
2072 const IdMapEntry aBackLinkEntry( aFootnoteSymbolRect, nBackLinkId );
2075 pPDFExtOutDevData->
SetLinkDest( nLinkId, nDestId );
2076 pPDFExtOutDevData->
SetLinkDest( nBackLinkId, nBackDestId );
2085 typedef std::pair< sal_Int8, sal_Int32 > StackEntry;
2086 std::stack< StackEntry > aOutlineStack;
2087 aOutlineStack.push( StackEntry( -1, -1 ) );
2095 OSL_ENSURE(
nullptr != pTNd,
"Enhanced pdf export - text node is missing" );
2105 sal_Int8 nLevelOnTopOfStack = aOutlineStack.top().first;
2106 while ( nLevelOnTopOfStack >= nLevel &&
2107 nLevelOnTopOfStack != -1 )
2109 aOutlineStack.pop();
2110 nLevelOnTopOfStack = aOutlineStack.top().first;
2112 const sal_Int32 nParent = aOutlineStack.top().second;
2124 if ( -1 != nDestPageNum )
2128 const sal_Int32 nDestId =
2129 pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
2136 const sal_Int32 nOutlineId =
2140 aOutlineStack.push( StackEntry( nLevel, nOutlineId ) );
2158 const ::sw::mark::IMark* pBkmk = *ppMark;
2159 mrSh.SwCursorShell::ClearMark();
2160 const OUString& sBkName = pBkmk->GetName();
2178 if ( -1 != nDestPageNum )
2184 mrSh.SwCursorShell::ClearMark();
2193 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->
GetBookmarks();
2194 for (
const auto& rBookmark : rBookmarks )
2196 OUString aBookmarkName( rBookmark.aBookmark );
2197 const bool bIntern =
'#' == aBookmarkName[0];
2200 aBookmarkName = aBookmarkName.copy( 1 );
2212 if ( -1 != nDestPageNum )
2215 if ( rBookmark.nLinkId != -1 )
2218 const sal_Int32 nDestId = pPDFExtOutDevData->
CreateDest(aRect, nDestPageNum);
2221 pPDFExtOutDevData->
SetLinkDest( rBookmark.nLinkId, nDestId );
2230 pPDFExtOutDevData->
SetLinkURL( rBookmark.nLinkId, aBookmarkName );
2244 if (!pPDFExtOutDevData)
2249 std::vector<SwFormatField*> aFields;
2258 for (
const auto pFormatField : aFields)
2260 if (!pFormatField->GetTextField() || !pFormatField->IsFieldInDoc())
2265 const auto& rAuthorityField
2267 if (!rAuthorityField.HasURL())
2274 if (!lcl_TryMoveToNonHiddenField(
mrSh, rTextNode, *pFormatField))
2279 OUString
const content(rAuthorityField.ExpandField(
true,
mrSh.
GetLayout()));
2282 mrSh.SwCursorShell::SetMark();
2286 for (
const auto& rLinkRect : *
mrSh.SwCursorShell::GetCursor_())
2291 sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, content, rLinkPageNum);
2294 pPDFExtOutDevData->SetLinkURL(nLinkId, rURL);
2298 mrSh.SwCursorShell::ClearMark();
2307 if ( !aPageNums.empty() )
2308 return aPageNums[0];
2316 const SwRect& rRect )
const
2318 std::vector< sal_Int32 > aPageNums;
2322 if ( nPageNumOfRect < 0 )
2334 sal_Int32 nOutputPageNum = 0;
2337 for ( ; aIter != aEnd; ++aIter )
2339 if ( *aIter == nPageNumOfRect )
2340 aPageNums.push_back( nOutputPageNum );
2349 sal_Int32 nOutputPageNum = 0;
2354 if (
i ==
static_cast<size_t>( nPageNumOfRect ) )
2356 aPageNums.push_back( nOutputPageNum );
2364 aPageNums.push_back( nPageNumOfRect );
2374 const OUString& rURL,
2376 OUString
const& rContent)
const
2387 SwRect aHFLinkRect( rLinkRect );
2393 if ( aHFLinkRect.
Pos() != rLinkRect.
Pos() )
2398 for (sal_Int32 aHFLinkPageNum : aHFLinkPageNums)
2402 const sal_Int32 nHFLinkId =
2403 rPDFExtOutDevData.
CreateLink(aRect, rContent, aHFLinkPageNum);
2407 rPDFExtOutDevData.
SetLinkDest( nHFLinkId, nDestId );
2409 rPDFExtOutDevData.
SetLinkURL( nHFLinkId, rURL );
static std::vector< sal_uInt16 > aStructStack
static auto GetReopenTagFromFrame(SwFrame const &rFrame) -> sal_Int32
std::set< tools::Long, lt_TableColumn > TableColumnsMapEntry
std::map< const SwNumberTreeNode *, sal_Int32 > NumListIdMap
std::map< const SwNumberTreeNode *, sal_Int32 > NumListBodyIdMap
std::vector< IdMapEntry > LinkIdMap
std::map< const void *, sal_Int32 > FrameTagIdMap
std::map< const SwTable *, TableColumnsMapEntry > TableColumnsMap
std::pair< SwRect, sal_Int32 > IdMapEntry
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...
sal_Int32 GetDate() const
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual tSortedOutlineNodeList::size_type getOutlineNodesCount() const =0
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
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
void SetMapUnit(MapUnit eUnit)
const Point & GetOrigin() const
vcl::ExtOutDevData * GetExtOutDevData() const
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static sal_uInt16 IsMath(const SvGlobalName &rName)
SvxAdjust GetAdjust() const
short GetTextFirstLineOffset() const
const SwFrame * GetAnchorFrame() const
SwTextAttr * GetAttr(TextFrameIndex nPos) const
Returns the attribute for a position.
const SvxAdjustItem & GetAdjust(bool=true) const
OUString const & GetAuthorField(ToxAuthorityField ePos) const
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
SwAuthEntry * GetAuthEntry() const
SwCellFrame is one table cell in the document layout.
const SwTableBox * GetTabBox() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwFormatColl * GetFormatColl() const
A helper class to save cursor state (position).
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
SwShellCursor * GetCursor_()
const SwRect & GetCharRect() const
bool GotoFootnoteAnchor()
jump from footnote to anchor
OUString GetSelText() const
get selected text of a node at current cursor
bool GotoFootnoteText()
jump from content to footnote
bool GotoOutline(const OUString &rName)
bool GotoFormatField(const SwFormatField &rField)
bool GotoINetAttr(const SwTextINetFormat &rAttr)
bool SelectHiddenRange()
If the current cursor position is inside a hidden range, the hidden range is selected.
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
SwFootnoteIdxs & GetFootnoteIdxs()
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
IDocumentMarkAccess * getIDocumentMarkAccess()
const SwFrameFormats * GetSpzFrameFormats() const
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
bool IsInHeaderFooter(const SwNode &) const
void GetINetAttrs(SwGetINetAttrs &rArr, bool bIncludeInToxContent=true)
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
static TableColumnsMap & GetTableColumnsMap()
static LinkIdMap s_aLinkIdMap
static NumListIdMap s_aNumListIdMap
static FrameTagIdMap s_aFrameTagIdMap
static NumListBodyIdMap & GetNumListBodyIdMap()
sal_Int32 CalcOutputPageNum(const SwRect &rRect) const
static FrameTagIdMap & GetFrameTagIdMap()
SwEnhancedPDFExportHelper(SwEditShell &rSh, OutputDevice &rOut, const OUString &rPageRange, bool bSkipEmptyPages, bool bEditEngineOnly, const SwPrintData &rPrintData)
static TableColumnsMap s_aTableColumnsMap
static LanguageType GetDefaultLanguage()
static NumListBodyIdMap s_aNumListBodyIdMap
static NumListIdMap & GetNumListIdMap()
std::vector< sal_Int32 > CalcOutputPageNums(const SwRect &rRect) const
void ExportAuthorityEntryLinks()
Exports bibliography entry links.
const SwPrintData & mrPrintData
std::vector< sal_Int32 > maPageNumberMap
The problem is that numbers in StringRangeEnumerator aren't accordant to real page numbers if mbSkipE...
tools::Rectangle SwRectToPDFRect(const SwPageFrame *pCurrPage, const tools::Rectangle &rRectangle) const
void MakeHeaderFooterLinks(vcl::PDFExtOutDevData &rPDFExtOutDevData, const SwTextNode &rTNd, const SwRect &rLinkRect, sal_Int32 nDestId, const OUString &rURL, bool bIntern, OUString const &rContent) const
static LanguageType s_eLanguageDefault
static LinkIdMap & GetLinkIdMap()
std::unique_ptr< StringRangeEnumerator > mpRangeEnum
~SwEnhancedPDFExportHelper()
Instances of SwFields and those derived from it occur 0 to n times.
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Base class of all fields.
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
SwFieldIds Which() const
ResId.
LanguageType GetLanguage() const
Language at field position.
general base class for all free-flowing frames
virtual SwFrameFormat & GetFrameFormat() override
FontLineStyle GetUnderline() const
short GetEscapement() const
FontStrikeout GetStrikeout() const
FontEmphasisMark GetEmphasisMark() const
SwFontScript GetActual() const
FontLineStyle GetOverline() const
LanguageType GetLanguage() const
const SwRect & getFrameArea() const
Base class of the Writer layout elements.
tools::Long GetLeftMargin() const
tools::Long GetRightMargin() const
SwSectionFrame * FindSctFrame()
SwTabFrame * FindTabFrame()
SwFrameType GetType() const
bool IsHeaderFrame() const
const SwSortedObjs * GetDrawObjs() const
bool IsRightToLeft() const
const SwRowFrame * IsInFollowFlowRow() const
SwLayoutFrame * GetNextCellLeaf()
bool IsFooterFrame() const
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
bool IsNoTextFrame() const
SwPageFrame * FindPageFrame()
const SwRowFrame * IsInSplitTableRow() const
SwFrame * FindFooterOrHeader()
tools::Long GetTopMargin() const
SwLayoutFrame * GetPrevCellLeaf()
virtual sal_uInt16 GetSubType() const override
Get/set sub type.
const OUString & GetSetRefName() const
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
const SwFrame * Lower() const
Base class for anything that can be part of a line in the Writer layout.
PortionType GetWhichPor() const
TextFrameIndex GetLen() const
const SwContentNode * GetNode() const
Marks a node in the document model.
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
SwNode * DocumentSectionStartNode(SwNode *pNode) const
A tree of numbered nodes.
virtual bool IsCounted() const
Return if this node is counted.
bool IsFirst(const SwNumberTreeNode *pNode) const
Return if a node is first non-phantom child of this node.
SwNumberTreeNode * GetPred(bool bSibling=false) const
Returns the greatest descendant of the root that is smaller than this node, aka the predecessor of th...
SwNumberTreeNode * GetParent() const
Returns the parent of this node.
const SwOLEObj & GetOLEObj() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
const SwPosition * GetPoint() const
A page of the document layout.
virtual OUString GetPar1() const override
Author.
const OUString & GetText() const
SwPostItMode GetPrintPostIts() const
tools::Long GetHeight(const SwRect &rRect) const
tools::Long GetRightMargin(const SwFrame &rFrame) const
tools::Long GetTopMargin(const SwFrame &rFrame) const
tools::Long GetWidth(const SwRect &rRect) const
tools::Long GetBottomMargin(const SwFrame &rFrame) const
tools::Long GetLeftMargin(const SwFrame &rFrame) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetRight(const SwRect &rRect) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Pos(const Point &rNew)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
SwPageFrame * GetPageByPageNum(sal_uInt16 _nPageNum) const
Get page frame by physical page number looping through the lowers, which are page frame,...
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 IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
SwRowFrame is one table row in the document layout.
bool IsRepeatedHeadline() const
const SwTableLine * GetTabLine() const
const SwTOXBase * GetTOXBase() const
SectionType GetType() const
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
const SwTabFrame * GetFollow() const
const SwTable * GetTable() const
bool IsInHeadline(const SwFrame &rFrame) const
sal_Int32 getRowSpan() const
SwTable is one table in the document model, containing rows (which contain cells).
const Frame_Info * mpFrameInfo
void BeginInlineStructureElements()
const Por_Info * mpPorInfo
void SetAttributes(vcl::PDFWriter::StructElement eType)
static bool IsExportTaggedPDF(const OutputDevice &rOut)
void CheckRestoreTag() const
void EndStructureElements()
const Num_Info * mpNumInfo
void BeginBlockStructureElements()
void BeginNumberedListStructureElements()
SwTaggedPDFHelper(const Num_Info *pNumInfo, const Frame_Info *pFrameInfo, const Por_Info *pPorInfo, OutputDevice const &rOut)
sal_Int32 m_nRestoreCurrentTag
vcl::PDFExtOutDevData * mpPDFExtOutDevData
sal_uInt8 m_nEndStructureElement
void BeginTag(vcl::PDFWriter::StructElement aTagRole, const OUString &rTagName)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
const SwFormatField & GetFormatField() const
Represents the visualization of a paragraph.
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
SwTextNode * GetTextNodeFirst()
SwTextNode const * GetTextNodeForParaProps() const
SwTextNode is a paragraph in the document model.
bool IsOutline() const
Returns if this text node is an outline.
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
bool IsCountedInList() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
bool IsListRestart() const
int GetAttrOutlineLevel() const
Returns outline level of this text node.
const OUString & GetText() const
void CalcRect(const SwLinePortion &rPor, SwRect *pRect, SwRect *pIntersect=nullptr, const bool bInsideBox=false) const
Calculate the rectangular area where the portion takes place.
SwTextPaintInfo & GetInfo()
SwTextFrame * GetTextFrame()
const OUString & GetText() const
TextFrameIndex GetIdx() const
bool IsViewLocked() const
sal_Int32 GetPageNumAndSetOffsetForPDF(OutputDevice &rOut, const SwRect &rRect) const
const SwNodes & GetNodes() const
SwRootFrame * GetLayout() const
sal_uInt16 GetPageCount() const
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
std::vector< Value >::size_type size_type
bool SetCurrentStructureElement(sal_Int32 nElement)
void SetStructureBoundingBox(const tools::Rectangle &rRect)
void CreateNote(const tools::Rectangle &rRect, const PDFNote &rNote, sal_Int32 nPageNr=-1)
sal_Int32 CreateDest(const tools::Rectangle &rRect, sal_Int32 nPageNr=-1, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
std::vector< PDFExtOutDevBookmarkEntry > & GetBookmarks()
bool GetIsExportTaggedPDF() const
void SetDocumentLocale(const css::lang::Locale &rLoc)
void SetStructureAttributeNumerical(PDFWriter::StructAttribute eAttr, sal_Int32 nValue)
bool GetIsExportNotes() const
void SetScreenStream(sal_Int32 nScreenId, const OUString &rURL)
void SetAlternateText(const OUString &rText)
sal_Int32 GetCurrentStructureElement() const
void SetStructureAttribute(PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal)
void SetActualText(const OUString &rText)
void SetScreenURL(sal_Int32 nScreenId, const OUString &rURL)
void DescribeRegisteredDest(sal_Int32 nDestId, const tools::Rectangle &rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType=PDFWriter::DestAreaType::XYZ)
void SetLinkURL(sal_Int32 nLinkId, const OUString &rURL)
bool GetIsExportBookmarks() const
sal_Int32 CreateOutlineItem(sal_Int32 nParent, const OUString &rText, sal_Int32 nDestID)
sal_Int32 BeginStructureElement(PDFWriter::StructElement eType, const OUString &rAlias=OUString())
bool GetIsExportNamedDestinations() const
sal_Int32 CreateNamedDest(const OUString &sDestName, const tools::Rectangle &rRect, sal_Int32 nPageNr=-1)
sal_Int32 CreateScreen(const tools::Rectangle &rRect, sal_Int32 nPageNr)
sal_Int32 CreateLink(const tools::Rectangle &rRect, OUString const &rAltText, sal_Int32 nPageNr=-1)
void EndStructureElement()
void SetLinkDest(sal_Int32 nLinkId, sal_Int32 nDestId)
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
std::vector< SwGetINetAttr > SwGetINetAttrs
bool JumpToSwMark(SwViewShell const *pVwSh, std::u16string_view rMark)
EmbeddedObjectRef * pObject
constexpr TypedWhichId< SfxBoolItem > RES_DECORATIVE(134)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
LanguageType GetAppLanguage()
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
const LanguageTag & getLocale()
void GotoPrevLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
bool IsFootnoteDeleted(IDocumentRedlineAccess const &rIDRA, SwTextFootnote const &rTextFootnote)
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNode const &rNode)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwPostItMode
this must match the definitions in css::text::NotePrintMode
const SwLinePortion & mrPor
const SwTextPainter & mrTextPainter
For querying the INet-attributes for Navigator.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
OUString SwResId(TranslateId aId)
std::vector< SwRect > SwRects