summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-12-11 17:29:44 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-12-18 22:30:15 +0100
commit6018a9270aab389711d082edb55f081b3a793248 (patch)
tree48adc3ce161d72fb549589d856db33eb11a8cedd /sw
parent9da6aabe989ae5a04a5eac315ee78a1abc6fbd5d (diff)
sw_redlinehide_4b: visibility checks for EnhancedPDFExport links
SwEnhancedPDFExportHelper should not create links to things that are hidden by the layout: * SwCursorShell::GotoFormatField() skips deleted fields (this triggers an assert in GetCharRect() with ooo69593-1.odt) * SwEditShell::GetINetAttrs() skips deleted INet attributes (which, as an additional bonus, hides then in the Navigator too) * SwDoc::GotoOutline() skips outline nodes where we know they have been deleted (as seen in ooo66088-9.odt) * SwFlyFrameFormats are skipped by EnhancedPDFExportHelper itself * footnotes dito Change-Id: Ife77dc7724688631d20cbaf8531b3c826a8ece94 (cherry picked from commit 7d481f7ac1971be622520258a4b13ada29282844)
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/crstrvl.cxx10
-rw-r--r--sw/source/core/doc/docnum.cxx21
-rw-r--r--sw/source/core/edit/editsh.cxx12
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx17
4 files changed, 47 insertions, 13 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 7b14d3156938..9d9497492bd4 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -855,7 +855,11 @@ bool SwCursorShell::MoveFieldType(
bool SwCursorShell::GotoFormatField( const SwFormatField& rField )
{
bool bRet = false;
- if( rField.GetTextField() )
+ SwTextField const*const pTextField(rField.GetTextField());
+ if (pTextField
+ && (!GetLayout()->IsHideRedlines()
+ || !sw::IsFieldDeletedInModel(
+ GetDoc()->getIDocumentRedlineAccess(), *pTextField)))
{
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
@@ -863,9 +867,9 @@ bool SwCursorShell::GotoFormatField( const SwFormatField& rField )
SwCursor* pCursor = getShellCursor( true );
SwCursorSaveState aSaveState( *pCursor );
- SwTextNode* pTNd = rField.GetTextField()->GetpTextNode();
+ SwTextNode* pTNd = pTextField->GetpTextNode();
pCursor->GetPoint()->nNode = *pTNd;
- pCursor->GetPoint()->nContent.Assign( pTNd, rField.GetTextField()->GetStart() );
+ pCursor->GetPoint()->nContent.Assign( pTNd, pTextField->GetStart() );
bRet = !pCursor->IsSelOvr();
if( bRet )
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 63be0e158b7d..a6e1c267f0f1 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -594,6 +594,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type
static SwTextNode* lcl_FindOutlineName(const SwOutlineNodes& rOutlNds,
SwRootFrame const*const pLayout, const OUString& rName, bool const bExact)
{
+ SwTextNode * pExactButDeleted(nullptr);
SwTextNode* pSavedNode = nullptr;
for( auto pOutlNd : rOutlNds )
{
@@ -603,10 +604,18 @@ static SwTextNode* lcl_FindOutlineName(const SwOutlineNodes& rOutlNds,
{
if (sText.getLength() == rName.getLength())
{
- // Found "exact", set Pos to the Node
- return pTextNd;
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTextNd))
+ {
+ pExactButDeleted = pTextNd;
+ }
+ else
+ {
+ // Found "exact", set Pos to the Node
+ return pTextNd;
+ }
}
- if( !bExact && !pSavedNode )
+ if (!bExact && !pSavedNode
+ && (!pLayout || sw::IsParaPropsNode(*pLayout, *pTextNd)))
{
// maybe we just found the text's first part
pSavedNode = pTextNd;
@@ -614,7 +623,7 @@ static SwTextNode* lcl_FindOutlineName(const SwOutlineNodes& rOutlNds,
}
}
- return pSavedNode;
+ return bExact ? pExactButDeleted : pSavedNode;
}
static SwTextNode* lcl_FindOutlineNum(const SwOutlineNodes& rOutlNds,
@@ -749,6 +758,10 @@ bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame con
SwTextNode *pTmpNd = ::lcl_FindOutlineName(rOutlNds, pLayout, sName, true);
if ( pTmpNd ) // found via the Name
{
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTmpNd))
+ { // found the correct node but it's deleted!
+ return false; // avoid fallback to inexact search
+ }
pNd = pTmpNd;
}
}
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 27bc3125e79e..7dd875749d8f 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -694,15 +694,21 @@ void SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
{
rArr.clear();
- const SwTextNode* pTextNd;
const SwCharFormats* pFormats = GetDoc()->GetCharFormats();
for( auto n = pFormats->size(); 1 < n; )
{
SwIterator<SwTextINetFormat,SwCharFormat> aIter(*(*pFormats)[--n]);
for( SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
{
- if( nullptr != ( pTextNd = pFnd->GetpTextNode()) &&
- pTextNd->GetNodes().IsDocNodes() )
+ SwTextNode const*const pTextNd(pFnd->GetpTextNode());
+ SwTextFrame const*const pFrame(pTextNd
+ ? static_cast<SwTextFrame const*>(pTextNd->getLayoutFrame(GetLayout()))
+ : nullptr);
+ if (nullptr != pTextNd && nullptr != pFrame
+ && pTextNd->GetNodes().IsDocNodes()
+ // check it's not fully deleted
+ && pFrame->MapModelToView(pTextNd, pFnd->GetStart())
+ != pFrame->MapModelToView(pTextNd, *pFnd->GetEnd()))
{
SwTextINetFormat& rAttr = *pFnd;
OUString sText( pTextNd->GetExpandText(GetLayout(),
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index a3e97f716409..26863e24ca86 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1662,7 +1662,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
{
aURL = aURL.copy( 1 );
mrSh.SwCursorShell::ClearMark();
- JumpToSwMark( &mrSh, aURL );
+ if (! JumpToSwMark( &mrSh, aURL ))
+ {
+ continue; // target deleted
+ }
// Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect();
@@ -1734,6 +1737,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
SwFrameFormat* pFrameFormat = (*pTable)[n];
const SfxPoolItem* pItem;
if ( RES_DRAWFRMFMT != pFrameFormat->Which() &&
+ GetFrameOfModify(mrSh.GetLayout(), *pFrameFormat, SwFrameType::Fly) &&
SfxItemState::SET == pFrameFormat->GetAttrSet().GetItemState( RES_URL, true, &pItem ) )
{
const SwPageFrame* pCurrPage =
@@ -1748,7 +1752,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
{
aURL = aURL.copy( 1 );
mrSh.SwCursorShell::ClearMark();
- JumpToSwMark( &mrSh, aURL );
+ if (! JumpToSwMark( &mrSh, aURL ))
+ {
+ continue; // target deleted
+ }
// Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect();
@@ -1947,8 +1954,12 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// 1. Check if the whole paragraph is hidden
// 2. Check for hidden text attribute
- if ( rTNd.GetTextNode()->IsHidden() || mrSh.SelectHiddenRange() )
+ if (rTNd.GetTextNode()->IsHidden() || mrSh.SelectHiddenRange()
+ || (mrSh.GetLayout()->IsHideRedlines()
+ && sw::IsFootnoteDeleted(pDoc->getIDocumentRedlineAccess(), *pTextFootnote)))
+ {
continue;
+ }
SwCursorSaveState aSaveState( *mrSh.GetCursor_() );