summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-05 18:32:31 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commitb779974fbaff3bb99924c1bddfcf0fc387289ac4 (patch)
treeff3d51c13aa170feadde7472cdc3ff64c324f403
parent739006a68f4bd19abcf47bce11e9e191906b6423 (diff)
sw_redlinehide_3: hide deleted numbered nodes in field dialog
This reuses the IDocumentOutlineNodes code for IDocumentListItems; the only client of it is the field dialog cross reference page. Adapt SwCursorShell::GetContentAtPos() too. Change-Id: I9a9ed464b176dd26bf39969ba94041f995ba8c7e
-rw-r--r--sw/inc/IDocumentListItems.hxx8
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/doc/DocumentListItemsManager.cxx19
-rw-r--r--sw/source/core/doc/DocumentOutlineNodesManager.cxx41
-rw-r--r--sw/source/core/inc/DocumentListItemsManager.hxx6
-rw-r--r--sw/source/core/inc/txtfrm.hxx5
-rw-r--r--sw/source/ui/fldui/fldref.cxx8
7 files changed, 62 insertions, 27 deletions
diff --git a/sw/inc/IDocumentListItems.hxx b/sw/inc/IDocumentListItems.hxx
index e8573e59879f..b5d1e8083b48 100644
--- a/sw/inc/IDocumentListItems.hxx
+++ b/sw/inc/IDocumentListItems.hxx
@@ -22,6 +22,8 @@
#include <vector>
#include <rtl/ustring.hxx>
+
+class SwRootFrame;
class SwNodeNum;
/** Provides numbered items of a document.
@@ -34,7 +36,11 @@ public:
virtual void addListItem( const SwNodeNum& rNodeNum ) = 0;
virtual void removeListItem( const SwNodeNum& rNodeNum ) = 0;
- virtual OUString getListItemText( const SwNodeNum& rNodeNum ) const = 0;
+ virtual OUString getListItemText(const SwNodeNum& rNodeNum,
+ SwRootFrame const& rLayout) const = 0;
+
+ virtual bool isNumberedInLayout(SwNodeNum const& rNodeNum,
+ SwRootFrame const& rLayout) const = 0;
/** get vector of all list items, which are numbered
*/
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 4a3c90dc9326..a7edee8146b9 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1291,7 +1291,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( pONd )
{
rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
- rContentAtPos.sStr = pONd->GetExpandText( 0, -1, true, true );
+ rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), *pONd, true, false, ExpandMode(0));
bRet = true;
}
}
diff --git a/sw/source/core/doc/DocumentListItemsManager.cxx b/sw/source/core/doc/DocumentListItemsManager.cxx
index edb859a6e57a..8d88fba75cf1 100644
--- a/sw/source/core/doc/DocumentListItemsManager.cxx
+++ b/sw/source/core/doc/DocumentListItemsManager.cxx
@@ -18,7 +18,9 @@
*/
#include <DocumentListItemsManager.hxx>
+
#include <SwNodeNum.hxx>
+#include <txtfrm.hxx>
#include <ndtxt.hxx>
#include <osl/diagnose.h>
@@ -66,12 +68,19 @@ void DocumentListItemsManager::removeListItem( const SwNodeNum& rNodeNum )
}
}
-OUString DocumentListItemsManager::getListItemText( const SwNodeNum& rNodeNum ) const
+OUString DocumentListItemsManager::getListItemText(const SwNodeNum& rNodeNum,
+ SwRootFrame const& rLayout) const
+{
+ SwTextNode const*const pNode(rNodeNum.GetTextNode());
+ assert(pNode);
+ return sw::GetExpandTextMerged(&rLayout, *pNode, true, true, ExpandMode(0));
+}
+
+bool DocumentListItemsManager::isNumberedInLayout(
+ SwNodeNum const& rNodeNum, // note: this is the non-hidden Num ...
+ SwRootFrame const& rLayout) const
{
- return rNodeNum.GetTextNode()
- ? rNodeNum.GetTextNode()->GetExpandText( 0, -1, true/*bWithNumber*/,
- true/*bWithNumber*/, true/*bWithSpacesForLevel*/ )
- : OUString();
+ return sw::IsParaPropsNode(rLayout, *rNodeNum.GetTextNode());
}
void DocumentListItemsManager::getNumItems( tSortedNodeNumList& orNodeNumList ) const
diff --git a/sw/source/core/doc/DocumentOutlineNodesManager.cxx b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
index 3654c5032eb4..12945c76ae6e 100644
--- a/sw/source/core/doc/DocumentOutlineNodesManager.cxx
+++ b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
@@ -41,36 +41,31 @@ int DocumentOutlineNodesManager::getOutlineLevel( const tSortedOutlineNodeList::
GetTextNode()->GetAttrOutlineLevel()-1;
}
-OUString DocumentOutlineNodesManager::getOutlineText(
- const tSortedOutlineNodeList::size_type nIdx,
- SwRootFrame const*const pLayout,
- const bool bWithNumber,
- const bool bWithSpacesForLevel,
- const bool bWithFootnote ) const
+OUString GetExpandTextMerged(SwRootFrame const*const pLayout,
+ SwTextNode const& rNode, bool const bWithNumber,
+ bool const bWithSpacesForLevel, ExpandMode const i_mode)
{
- SwTextNode const*const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
if (pLayout && pLayout->IsHideRedlines())
{
- SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pLayout)));
+ SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(rNode.getLayoutFrame(pLayout)));
if (pFrame)
{
sw::MergedPara const*const pMerged = pFrame->GetMergedPara();
if (pMerged)
{
- if (pNode != pMerged->pParaPropsNode)
+ if (&rNode != pMerged->pParaPropsNode)
{
return OUString();
}
else
{
- ExpandMode const mode(ExpandMode::HideDeletions |
- (bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0)));
- OUStringBuffer ret(pNode->GetExpandText(0, -1, bWithNumber,
+ ExpandMode const mode(ExpandMode::HideDeletions | i_mode);
+ OUStringBuffer ret(rNode.GetExpandText(0, -1, bWithNumber,
bWithNumber, bWithSpacesForLevel, mode));
- for (sal_uLong i = pNode->GetIndex() + 1;
+ for (sal_uLong i = rNode.GetIndex() + 1;
i <= pMerged->pLastNode->GetIndex(); ++i)
{
- SwNode *const pTmp(pNode->GetNodes()[i]);
+ SwNode *const pTmp(rNode.GetNodes()[i]);
if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
{
ret.append(pTmp->GetTextNode()->GetExpandText(
@@ -82,9 +77,21 @@ OUString DocumentOutlineNodesManager::getOutlineText(
}
}
}
- return pNode->GetExpandText( 0, -1, bWithNumber,
- bWithNumber, bWithSpacesForLevel,
- bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0));
+ return rNode.GetExpandText( 0, -1, bWithNumber,
+ bWithNumber, bWithSpacesForLevel, i_mode);
+}
+
+OUString DocumentOutlineNodesManager::getOutlineText(
+ const tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const*const pLayout,
+ const bool bWithNumber,
+ const bool bWithSpacesForLevel,
+ const bool bWithFootnote ) const
+{
+ SwTextNode const*const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
+ return GetExpandTextMerged(pLayout, *pNode,
+ bWithNumber, bWithSpacesForLevel,
+ (bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0)));
}
SwTextNode* DocumentOutlineNodesManager::getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const
diff --git a/sw/source/core/inc/DocumentListItemsManager.hxx b/sw/source/core/inc/DocumentListItemsManager.hxx
index 36e56e015d7a..7508a2b5df41 100644
--- a/sw/source/core/inc/DocumentListItemsManager.hxx
+++ b/sw/source/core/inc/DocumentListItemsManager.hxx
@@ -36,7 +36,11 @@ public:
void addListItem( const SwNodeNum& rNodeNum ) override;
void removeListItem( const SwNodeNum& rNodeNum ) override;
- OUString getListItemText( const SwNodeNum& rNodeNum ) const override;
+ OUString getListItemText(const SwNodeNum& rNodeNum,
+ SwRootFrame const& rLayout) const override;
+
+ bool isNumberedInLayout(SwNodeNum const& rNodeNum,
+ SwRootFrame const& rLayout) const override;
void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const override;
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 5cb4c55facf5..1b145bda9bd0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -44,6 +44,7 @@ struct SwCursorMoveState;
struct SwFillData;
class SwPortionHandler;
class SwScriptInfo;
+enum class ExpandMode;
#define NON_PRINTING_CHARACTER_COLOR Color(0x26, 0x8b, 0xd2)
@@ -124,6 +125,10 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode(
SwTextFrame & rFrame, SwTextNode & rTextNode,
std::set<sal_uLong> *pSkipped);
+OUString GetExpandTextMerged(SwRootFrame const* pLayout,
+ SwTextNode const& rNode, bool bWithNumber,
+ bool bWithSpacesForLevel, ExpandMode i_mode);
+
} // namespace sw
/// Represents the visualization of a paragraph. Typical upper is an
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 2860f9a30a6c..ba94bc890781 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -627,11 +627,15 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool bCertainTextNodeSelected( false );
for ( size_t nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
{
- bool isSubstring = MatchSubstring(pIDoc->getListItemText( *maNumItems[nNumItemIdx] ), filterString);
+ if (!pIDoc->isNumberedInLayout(*maNumItems[nNumItemIdx], *pSh->GetLayout()))
+ {
+ continue; // skip it
+ }
+ bool isSubstring = MatchSubstring(pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()), filterString);
if(isSubstring)
{
SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
- pIDoc->getListItemText( *maNumItems[nNumItemIdx] ) );
+ pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()));
pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
if ( ( IsFieldEdit() &&
pRefField->GetReferencedTextNode() == maNumItems[nNumItemIdx]->GetTextNode() ) ||