summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-08 13:46:03 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:49:27 +0100
commit1cfe06a6ac01d8b16659938be460a1ced78ff870 (patch)
tree389c03894527974c2676e9b5e08b1a32c3812c7d /sw/source/core
parent12cbb804a5ad8b076dd330bb7e2ea67d4bb1bba1 (diff)
sw_redlinehide_3: pass current layout through ModelToViewHelper
The expansion of footnotes (and soon text fields) depends on the layout's mode. In SwXFlatParagraphIterator, just use whatever is SwDoc's "current" layout, should be good enough... Change-Id: Ica3b9eae56b14910c435c0f9c3f8ab6dbcda105f
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/docedt.cxx3
-rw-r--r--sw/source/core/edit/edlingu.cxx12
-rw-r--r--sw/source/core/tox/ToxTextGenerator.cxx2
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx5
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx4
-rw-r--r--sw/source/core/txtnode/txtedt.cxx6
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx6
7 files changed, 21 insertions, 17 deletions
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 2691b8d0b5f4..9fceec0533a6 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -501,6 +501,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
uno::Reference< XSpellChecker1 > const &xSpeller,
sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
bool bGrammarCheck,
+ SwRootFrame const*const pLayout,
SwConversionArgs *pConvArgs ) const
{
SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End();
@@ -602,7 +603,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
{
uno::Reference< lang::XComponent > xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
// Expand the string:
- const ModelToViewHelper aConversionMap(*pNd->GetTextNode());
+ const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
const OUString& aExpandText = aConversionMap.getViewText();
// get XFlatParagraph to use...
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index bcb24e45abe3..2590c5ee641b 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -301,7 +301,7 @@ uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
*pMySh->GetCursor()->GetPoint() = *GetCurr();
*pMySh->GetCursor()->GetMark() = *GetEnd();
pMySh->GetDoc()->Spell(*pMySh->GetCursor(),
- xSpeller, pPageCnt, pPageSt, false ) >>= xSpellRet;
+ xSpeller, pPageCnt, pPageSt, false, pMySh->GetLayout()) >>= xSpellRet;
bGoOn = GetCursorCnt() > 1;
if( xSpellRet.is() )
{
@@ -367,7 +367,7 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
// call function to find next text portion to be converted
uno::Reference< linguistic2::XSpellChecker1 > xEmpty;
pMySh->GetDoc()->Spell( *pMySh->GetCursor(),
- xEmpty, pPageCnt, pPageSt, false, &rArgs ) >>= aConvText;
+ xEmpty, pPageCnt, pPageSt, false, pMySh->GetLayout(), &rArgs) >>= aConvText;
bGoOn = GetCursorCnt() > 1;
if( !aConvText.isEmpty() )
@@ -978,7 +978,7 @@ bool SwEditShell::GetGrammarCorrection(
uno::Reference< lang::XComponent > xDoc( mxDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
// Expand the string:
- const ModelToViewHelper aConversionMap(*pNode);
+ const ModelToViewHelper aConversionMap(*pNode, GetLayout());
const OUString& aExpandText = aConversionMap.getViewText();
// get XFlatParagraph to use...
uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNode, aExpandText, aConversionMap );
@@ -1329,7 +1329,7 @@ bool SwSpellIter::SpellSentence(svx::SpellPortions& rPortions, bool bIsGrammarCh
}
uno::Any aSpellRet =
pMySh->GetDoc()->Spell(*pCursor,
- xSpeller, nullptr, nullptr, bIsGrammarCheck );
+ xSpeller, nullptr, nullptr, bIsGrammarCheck, pMySh->GetLayout());
aSpellRet >>= xSpellRet;
aSpellRet >>= aGrammarResult;
bGoOn = GetCursorCnt() > 1;
@@ -1397,7 +1397,7 @@ bool SwSpellIter::SpellSentence(svx::SpellPortions& rPortions, bool bIsGrammarCh
pMySh->GoEndSentence();
if( bGrammarErrorFound )
{
- const ModelToViewHelper aConversionMap(static_cast<SwTextNode&>(pCursor->GetNode()));
+ const ModelToViewHelper aConversionMap(static_cast<SwTextNode&>(pCursor->GetNode()), pMySh->GetLayout());
const OUString& aExpandText = aConversionMap.getViewText();
sal_Int32 nSentenceEnd =
aConversionMap.ConvertToViewPosition( aGrammarResult.nBehindEndOfSentencePosition );
@@ -1429,7 +1429,7 @@ bool SwSpellIter::SpellSentence(svx::SpellPortions& rPortions, bool bIsGrammarCh
xSpellRet = nullptr;
// don't search for grammar errors here anymore!
pMySh->GetDoc()->Spell(*pCursor,
- xSpeller, nullptr, nullptr, false ) >>= xSpellRet;
+ xSpeller, nullptr, nullptr, false, pMySh->GetLayout()) >>= xSpellRet;
if ( *pCursor->GetPoint() > *pCursor->GetMark() )
pCursor->Exchange();
SetCurr( new SwPosition( *pCursor->GetPoint() ));
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index 9ff14b6eedb6..31dab3d5b2fe 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -316,7 +316,7 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& po
result.autoFormats.push_back(std::move(clone));
- ModelToViewHelper aConversionMap( *pSrc, ExpandMode::ExpandFields );
+ ModelToViewHelper aConversionMap(*pSrc, nullptr, ExpandMode::ExpandFields);
result.startPositions.push_back(
stripper.GetPositionInStrippedString(aConversionMap.ConvertToViewPosition(
hint->GetStart() )));
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 6b6dcb855e4c..8302e34604ce 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -80,7 +80,8 @@ struct containsPos
}
};
-ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, ExpandMode eMode)
+ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
+ SwRootFrame const*const pLayout, ExpandMode eMode)
{
const OUString& rNodeText = rNode.GetText();
m_aRetText = rNodeText;
@@ -162,7 +163,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, ExpandMode eMode)
const SwDoc *pDoc = rNode.GetDoc();
aFieldResult.m_sExpand = (eMode & ExpandMode::ReplaceMode)
? OUString(CHAR_ZWSP)
- : rFootnote.GetViewNumStr(*pDoc, nullptr/*TODO?*/);
+ : rFootnote.GetViewNumStr(*pDoc, pLayout);
aFieldResult.m_eType = FieldResult::FOOTNOTE;
}
break;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index cbf522687445..7dbacee6596d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3390,8 +3390,8 @@ OUString SwTextNode::GetExpandText( const sal_Int32 nIdx,
{
ExpandMode eMode = ExpandMode::ExpandFields | eAdditionalMode;
- ModelToViewHelper aConversionMap(*this, eMode);
- const OUString& aExpandText = aConversionMap.getViewText();
+ ModelToViewHelper aConversionMap(*this, nullptr/*TODO*/, eMode);
+ const OUString aExpandText = aConversionMap.getViewText();
const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx );
sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen;
const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 74b33c963af8..d3e640531f79 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1507,7 +1507,7 @@ SwRect SwTextFrame::SmartTagScan(SwTextNode & rNode)
if ( nBegin < nEnd )
{
// Expand the string:
- const ModelToViewHelper aConversionMap(*pNode /*TODO - replace or expand fields for smart tags?*/);
+ const ModelToViewHelper aConversionMap(*pNode, getRootFrame() /*TODO - replace or expand fields for smart tags?*/);
const OUString& aExpandText = aConversionMap.getViewText();
// Ownership ov ConversionMap is passed to SwXTextMarkup object!
@@ -2064,7 +2064,9 @@ bool SwTextNode::CountWords( SwDocStat& rStat,
}
// ConversionMap to expand fields, remove invisible and redline deleted text for scanner
- const ModelToViewHelper aConversionMap(*this, ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::HideInvisible | ExpandMode::HideDeletions);
+ const ModelToViewHelper aConversionMap(*this,
+ getIDocumentLayoutAccess().GetCurrentLayout(),
+ ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::HideInvisible | ExpandMode::HideDeletions);
const OUString& aExpandText = aConversionMap.getViewText();
if (aExpandText.isEmpty() && !bCountNumbering)
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index fe9a20658b7b..e63caf187e9f 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -487,7 +487,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara()
if ( pRet )
{
// Expand the string:
- const ModelToViewHelper aConversionMap(*pRet);
+ const ModelToViewHelper aConversionMap(*pRet, mpDoc->getIDocumentLayoutAccess().GetCurrentLayout());
const OUString& aExpandText = aConversionMap.getViewText();
xRet = new SwXFlatParagraph( *pRet, aExpandText, aConversionMap );
@@ -537,7 +537,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co
if ( pNextTextNode )
{
// Expand the string:
- const ModelToViewHelper aConversionMap(*pNextTextNode);
+ const ModelToViewHelper aConversionMap(*pNextTextNode, mpDoc->getIDocumentLayoutAccess().GetCurrentLayout());
const OUString& aExpandText = aConversionMap.getViewText();
xRet = new SwXFlatParagraph( *pNextTextNode, aExpandText, aConversionMap );
@@ -583,7 +583,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c
if ( pPrevTextNode )
{
// Expand the string:
- const ModelToViewHelper aConversionMap(*pPrevTextNode);
+ const ModelToViewHelper aConversionMap(*pPrevTextNode, mpDoc->getIDocumentLayoutAccess().GetCurrentLayout());
const OUString& aExpandText = aConversionMap.getViewText();
xRet = new SwXFlatParagraph( *pPrevTextNode, aExpandText, aConversionMap );