[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4a' - 18 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 21 17:28:43 UTC 2018
Rebased ref, commits from common ancestor:
commit 025d6754534c9ec2ee27924fadb810dc95248413
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 17:50:28 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: fix SwDoubleLinePortion/SwMultiCreator/SwBracket
Missing TextFrameIndex conversion.
Change-Id: Ie7b58b74aa6bb1e2ff8199031a9f59f5c3ba68c0
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 347d6f8f860f..44d7f26f4ff9 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -285,7 +285,7 @@ SwDoubleLinePortion::SwDoubleLinePortion(
else
{
const SwTextAttr& rAttr = *rCreate.pAttr;
- pBracket->nStart = rAttr.GetStart();
+ pBracket->nStart = rCreate.nStartOfAttr;
const SfxPoolItem * const pItem =
CharFormat::GetItem( rAttr, RES_CHRATR_TWO_LINES );
@@ -941,6 +941,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
pRet->pItem = nullptr;
pRet->pAttr = nullptr;
+ pRet->nStartOfAttr = TextFrameIndex(-1);
pRet->nId = SwMultiCreatorId::Bidi;
pRet->nLevel = nCurrLevel + 1;
return pRet;
@@ -1046,6 +1047,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
pRet->pItem = nullptr;
pRet->pAttr = pRuby;
+ pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
pRet->nId = SwMultiCreatorId::Ruby;
pRet->nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
return pRet;
@@ -1069,6 +1071,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
pRet->pItem = nullptr;
pRet->pAttr = pActiveTwoLinesHint;
+ pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
if (pNodeTwoLinesItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1086,6 +1089,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
pRet->pItem = pNodeTwoLinesItem;
pRet->pAttr = nullptr;
+ pRet->nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
pRet->nId = SwMultiCreatorId::Double;
@@ -1298,6 +1302,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
pRet->pItem = nullptr;
pRet->pAttr = pActiveRotateHint;
+ pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
if (pNodeRotateItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1313,6 +1318,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
pRet->pItem = pNodeRotateItem;
pRet->pAttr = nullptr;
+ pRet->nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
for (sw::MergedAttrIterMulti iter = iterAtStartOfNode; ; )
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index 7d3f0348a0cf..43e25a83153a 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -52,6 +52,7 @@ enum class RubyPosition : sal_uInt16
struct SwMultiCreator
{
+ TextFrameIndex nStartOfAttr;
const SwTextAttr* pAttr;
const SfxPoolItem* pItem;
SwMultiCreatorId nId;
commit 3640116a76a65cea1128d1f37d7a00e38d07ef93
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 16:53:30 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: finish conversions guess.cxx,itrcrsr.cxx,porfld.cxx
Change-Id: I847a9441b73cdfc9bd826fad2c9075a9aa1d7d2d
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index f24fdef51094..3d225c139105 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -156,7 +156,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
.getIDocumentSettingAccess().get(DocumentSettingId::UNBREAKABLE_NUMBERINGS);
// first check if everything fits to line
- if ( ( nLineWidth * 2 > SwTwips(nMaxLen) * nPorHeight ) ||
+ if ( ( nLineWidth * 2 > SwTwips(sal_Int32(nMaxLen)) * nPorHeight ) ||
( bUnbreakableNumberings && rPor.IsNumberPortion() ) )
{
// call GetTextSize with maximum compression (for kanas)
@@ -314,8 +314,9 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
aDebugString = rInf.GetText();
#endif
+ // this is pretty nutso... reverted at the end...
OUString& rOldText = const_cast<OUString&> (rInf.GetText());
- rOldText = rOldText.replaceAt( rInf.GetIdx() - 1, 1, aText );
+ rOldText = rOldText.replaceAt(sal_Int32(rInf.GetIdx()) - 1, 1, aText);
rInf.SetIdx( rInf.GetIdx() + nFieldDiff );
}
else
@@ -518,7 +519,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
OUString& rOldText = const_cast<OUString&> (rInf.GetText());
OUString aReplacement( cFieldChr );
- rOldText = rOldText.replaceAt( nOldIdx - 1, nFieldDiff + 1, aReplacement);
+ rOldText = rOldText.replaceAt(sal_Int32(nOldIdx) - 1, sal_Int32(nFieldDiff) + 1, aReplacement);
rInf.SetIdx( nOldIdx );
#if OSL_DEBUG_LEVEL > 0
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index eeca36566455..1aa6a311fc6d 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1670,7 +1670,7 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
// get position inside field portion?
if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
{
- pCMS->m_pSpecialPos->nCharOfst = nLength;
+ pCMS->m_pSpecialPos->nCharOfst = sal_Int32(nLength);
nLength = TextFrameIndex(0);
}
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 4027834b7a98..be4bf770dd59 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -171,7 +171,7 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP
pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
pInf->SetIdx(TextFrameIndex(0));
}
- else if(nIdx < pOldText->getLength())
+ else if (nIdx < TextFrameIndex(pOldText->getLength()))
{
aText = (*pOldText).replaceAt(sal_Int32(nIdx), 1, aText);
}
commit 939370684c728517946a0683dd7f39ca5dd8ba4f
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 14:06:40 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
SwEditShell::GetLineCount()
Change-Id: Ib9a13eab25b02b919d472ae864213b110e7794c7
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index be3f6fee007e..27bc3125e79e 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -856,7 +856,15 @@ sal_uInt16 SwEditShell::GetLineCount()
{
if( nullptr != ( pContentFrame = pCNd->getLayoutFrame( GetLayout() ) ) && pContentFrame->IsTextFrame() )
{
- nRet = nRet + static_cast<SwTextFrame*>(pContentFrame)->GetLineCount(TextFrameIndex(COMPLETE_STRING));
+ SwTextFrame *const pFrame(static_cast<SwTextFrame*>(pContentFrame));
+ nRet = nRet + pFrame->GetLineCount(TextFrameIndex(COMPLETE_STRING));
+ if (GetLayout()->IsHideRedlines())
+ {
+ if (auto const*const pMerged = pFrame->GetMergedPara())
+ {
+ aStart = *pMerged->pLastNode;
+ }
+ }
}
}
return nRet;
commit 465238ed0ee9e3da5337edfd1787985b48d38370
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 13:01:50 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: convert SwTextNode::GetMinMaxSize()
Change-Id: I1ac09d3dfd95f2a98142c4bfe51aad04926e2d38
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 4879f4c2cecb..458212f8fd17 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -835,7 +835,7 @@ bool SwTextNode::IsSymbolAt(const sal_Int32 nBegin) const
{
SwScriptInfo aScriptInfo;
SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo );
- aIter.Seek( nBegin );
+ aIter.Seek( TextFrameIndex(nBegin) );
return aIter.GetFnt()->IsSymbol( getIDocumentLayoutAccess().GetCurrentViewShell() );
}
@@ -976,6 +976,7 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn )
/**
* Changing this method very likely requires changing of GetScalingOfSelectedText
+ * This one is called exclusively from import filters, so there is no layout.
*/
void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax,
sal_uLong& rAbsMin ) const
@@ -1032,23 +1033,23 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
SwScriptInfo aScriptInfo;
SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo );
- sal_Int32 nIdx = 0;
+ TextFrameIndex nIdx(0);
aIter.SeekAndChgAttrIter( nIdx, pOut );
- sal_Int32 nLen = m_Text.getLength();
+ TextFrameIndex nLen(m_Text.getLength());
long nCurrentWidth = 0;
long nAdd = 0;
SwMinMaxArgs aArg( pOut, pSh, rMin, rAbsMin );
while( nIdx < nLen )
{
- sal_Int32 nNextChg = aIter.GetNextAttr();
- sal_Int32 nStop = aScriptInfo.NextScriptChg( nIdx );
+ TextFrameIndex nNextChg = aIter.GetNextAttr();
+ TextFrameIndex nStop = aScriptInfo.NextScriptChg( nIdx );
if( nNextChg > nStop )
nNextChg = nStop;
SwTextAttr *pHint = nullptr;
sal_Unicode cChar = CH_BLANK;
nStop = nIdx;
while( nStop < nLen && nStop < nNextChg &&
- CH_TAB != ( cChar = m_Text[nStop] ) &&
+ CH_TAB != (cChar = m_Text[sal_Int32(nStop)]) &&
CH_BREAK != cChar && CHAR_HARDBLANK != cChar &&
CHAR_HARDHYPHEN != cChar && CHAR_SOFTHYPHEN != cChar &&
!pHint )
@@ -1057,7 +1058,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
|| ( nullptr == ( pHint = aIter.GetAttr( nStop ) ) ) )
++nStop;
}
- if ( lcl_MinMaxString( aArg, aIter.GetFnt(), m_Text, nIdx, nStop ) )
+ if (lcl_MinMaxString(aArg, aIter.GetFnt(), m_Text, sal_Int32(nIdx), sal_Int32(nStop)))
{
nAdd = 20;
}
@@ -1087,7 +1088,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
case CHAR_HARDHYPHEN:
{
OUString sTmp( cChar );
- SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess().GetCurrentViewShell(),
+ SwDrawTextInfo aDrawInf( pSh,
*pOut, sTmp, 0, 1, 0, false );
nCurrentWidth = aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
aArg.nWordWidth += nCurrentWidth;
@@ -1095,7 +1096,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
if( static_cast<long>(rAbsMin) < aArg.nWordWidth )
rAbsMin = aArg.nWordWidth;
aArg.Minimum( aArg.nWordWidth + aArg.nWordAdd );
- aArg.nNoLineBreak = nIdx++;
+ aArg.nNoLineBreak = sal_Int32(nIdx++);
}
break;
case CH_TXTATR_BREAKWORD:
@@ -1161,8 +1162,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
case RES_TXTATR_ANNOTATION :
{
SwField *pField = const_cast<SwField*>(pHint->GetFormatField().GetField());
- const OUString aText = pField->ExpandField(true,
- pSh ? pSh->GetLayout() : nullptr);
+ const OUString aText = pField->ExpandField(true, nullptr);
if( lcl_MinMaxString( aArg, aIter.GetFnt(), aText, 0,
aText.getLength() ) )
nAdd = 20;
commit 50f78e5b8887888ea3abd4818d8f748fc9028367
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 12:28:03 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: convert SwEditShell::GetScalingOfSelectedText()
Move SwTextNode::GetScalingOfSelectedText() to SwTextFrame & simplify.
Change-Id: I9e9f0059665fb128de6be12a15ca2b4a95ebc5ff
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 64eef11f9221..4c0e6468fb9b 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -775,8 +775,6 @@ public:
bool IsFirstOfNumRule(SwRootFrame const& rLayout) const;
- sal_uInt16 GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd ) const;
-
SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextContent> const& GetXParagraph() const
{ return m_wXParagraph; }
SAL_DLLPRIVATE void SetXParagraph(css::uno::Reference<css::text::XTextContent> const& xParagraph)
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 678363ccad81..5b61dbe0ed86 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -840,14 +840,15 @@ sal_uInt16 SwEditShell::GetScalingOfSelectedText() const
sal_uInt16 nScaleWidth;
if( pTNd )
{
- const SwPosition* pEnd = pStt == pCursor->GetPoint()
- ? pCursor->GetMark()
- : pCursor->GetPoint();
- const sal_Int32 nStt = pStt->nContent.GetIndex();
- const sal_Int32 nEnd = pStt->nNode == pEnd->nNode
- ? pEnd->nContent.GetIndex()
- : pTNd->GetText().getLength();
- nScaleWidth = pTNd->GetScalingOfSelectedText( nStt, nEnd );
+ SwTextFrame *const pFrame(static_cast<SwTextFrame *>(
+ pTNd->getLayoutFrame(GetLayout(), pStt)));
+ assert(pFrame); // shell cursor must be positioned in node with frame
+ TextFrameIndex const nStart(pFrame->MapModelToViewPos(*pStt));
+ TextFrameIndex const nEnd(
+ sw::FrameContainsNode(*pFrame, pCursor->End()->nNode.GetIndex())
+ ? pFrame->MapModelToViewPos(*pCursor->End())
+ : TextFrameIndex(pFrame->GetText().getLength()));
+ nScaleWidth = pFrame->GetScalingOfSelectedText(nStart, nEnd);
}
else
nScaleWidth = 100; // default are no scaling -> 100%
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index f0adb57b5bbb..ea7f3d2c82fc 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -756,6 +756,7 @@ public:
bool IsSymbolAt(TextFrameIndex) const;
OUString GetCurWord(SwPosition const&) const;
+ sal_uInt16 GetScalingOfSelectedText(TextFrameIndex nStt, TextFrameIndex nEnd);
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
};
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 1ae7e8e23469..4879f4c2cecb 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1199,60 +1199,50 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
}
/**
- * Calculates the width of the text part specified by nStt and nEnd,
- * the height of the line containing nStt is divided by this width,
+ * Calculates the width of the text part specified by nStart and nEnd,
+ * the height of the line containing nStart is divided by this width,
* indicating the scaling factor, if the text part is rotated.
* Having CH_BREAKs in the text part, this method returns the scaling
* factor for the longest of the text parts separated by the CH_BREAK
*
* Changing this method very likely requires changing of "GetMinMaxSize"
*/
-sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
- const
+sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
+ TextFrameIndex nStart, TextFrameIndex nEnd)
{
- SwViewShell const * pSh = GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
- OutputDevice* pOut = nullptr;
-
- if ( pSh )
- pOut = &pSh->GetRefDev();
- else
- {
- // Access via StarONE, there's no need for an existing or active shell
- if ( getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE) )
- pOut = Application::GetDefaultDevice();
- else
- pOut = getIDocumentDeviceAccess().getReferenceDevice( true );
- }
-
- OSL_ENSURE( pOut, "GetScalingOfSelectedText without outdev" );
+ assert(GetOfst() <= nStart && (!GetFollow() || nStart < GetFollow()->GetOfst()));
+ SwViewShell const*const pSh = getRootFrame()->GetCurrShell();
+ assert(pSh);
+ OutputDevice *const pOut = &pSh->GetRefDev();
+ assert(pOut);
MapMode aOldMap( pOut->GetMapMode() );
pOut->SetMapMode( MapMode( MapUnit::MapTwip ) );
- if ( nStt == nEnd )
+ if (nStart == nEnd)
{
assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo );
- aIter.SeekAndChgAttrIter( nStt, pOut );
+ SwAttrIter aIter(*GetTextNodeFirst(), aScriptInfo, this);
+ aIter.SeekAndChgAttrIter( nStart, pOut );
- Boundary aBound =
- g_pBreakIt->GetBreakIter()->getWordBoundary( GetText(), nStt,
+ Boundary aBound = g_pBreakIt->GetBreakIter()->getWordBoundary(
+ GetText(), sal_Int32(nStart),
g_pBreakIt->GetLocale( aIter.GetFnt()->GetLanguage() ),
WordType::DICTIONARY_WORD, true );
- if ( nStt == aBound.startPos )
+ if (sal_Int32(nStart) == aBound.startPos)
{
// cursor is at left or right border of word
pOut->SetMapMode( aOldMap );
return 100;
}
- nStt = aBound.startPos;
- nEnd = aBound.endPos;
+ nStart = TextFrameIndex(aBound.startPos);
+ nEnd = TextFrameIndex(aBound.endPos);
- if ( nStt == nEnd )
+ if (nStart == nEnd)
{
pOut->SetMapMode( aOldMap );
return 100;
@@ -1260,18 +1250,18 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
}
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *const_cast<SwTextNode*>(this), aScriptInfo );
+ SwAttrIter aIter(*GetTextNodeFirst(), aScriptInfo, this);
// We do not want scaling attributes to be considered during this
// calculation. For this, we push a temporary scaling attribute with
// scaling value 100 and priority flag on top of the scaling stack
SwAttrHandler& rAH = aIter.GetAttrHandler();
SvxCharScaleWidthItem aItem(100, RES_CHRATR_SCALEW);
- SwTextAttrEnd aAttr( aItem, nStt, nEnd );
+ SwTextAttrEnd aAttr( aItem, 0, COMPLETE_STRING );
aAttr.SetPriorityAttr( true );
rAH.PushAndChg( aAttr, *(aIter.GetFnt()) );
- sal_Int32 nIdx = nStt;
+ TextFrameIndex nIdx = nStart;
sal_uLong nWidth = 0;
sal_uLong nProWidth = 0;
@@ -1281,16 +1271,16 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
aIter.SeekAndChgAttrIter( nIdx, pOut );
// scan for end of portion
- const sal_Int32 nNextChg = std::min(aIter.GetNextAttr(), aScriptInfo.NextScriptChg(nIdx));
+ TextFrameIndex const nNextChg = std::min(aIter.GetNextAttr(), aScriptInfo.NextScriptChg(nIdx));
- sal_Int32 nStop = nIdx;
+ TextFrameIndex nStop = nIdx;
sal_Unicode cChar = CH_BLANK;
SwTextAttr* pHint = nullptr;
// stop at special characters in [ nIdx, nNextChg ]
while( nStop < nEnd && nStop < nNextChg )
{
- cChar = m_Text[nStop];
+ cChar = GetText()[sal_Int32(nStop)];
if (
CH_TAB == cChar ||
CH_BREAK == cChar ||
@@ -1312,7 +1302,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
// calculate text widths up to cChar
if ( nStop > nIdx )
{
- SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), nIdx, nStop - nIdx);
+ SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), sal_Int32(nIdx), sal_Int32(nStop - nIdx));
nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
}
@@ -1329,7 +1319,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
{
// tab receives width of one space
OUString sTmp( CH_BLANK );
- SwDrawTextInfo aDrawInf( pSh, *pOut, sTmp, 0, 1 );
+ SwDrawTextInfo aDrawInf(pSh, *pOut, sTmp, 0, 1);
nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
nIdx++;
}
@@ -1338,7 +1328,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
else if ( cChar == CHAR_HARDBLANK || cChar == CHAR_HARDHYPHEN )
{
OUString sTmp( cChar );
- SwDrawTextInfo aDrawInf( pSh, *pOut, sTmp, 0, 1 );
+ SwDrawTextInfo aDrawInf(pSh, *pOut, sTmp, 0, 1);
nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
nIdx++;
}
@@ -1359,7 +1349,7 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
case RES_TXTATR_ANNOTATION :
{
SwField *pField = const_cast<SwField*>(pHint->GetFormatField().GetField());
- OUString const aText = pField->ExpandField(true, pSh->GetLayout());
+ OUString const aText = pField->ExpandField(true, getRootFrame());
SwDrawTextInfo aDrawInf(pSh, *pOut, aText, 0, aText.getLength());
nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width();
@@ -1377,37 +1367,23 @@ sal_uInt16 SwTextNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd
nWidth = std::max( nWidth, nProWidth );
- // search for a text frame this node belongs to
- SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aFrameIter(*this);
- SwTextFrame* pFrame = nullptr;
- for( SwTextFrame* pTmpFrame = aFrameIter.First(); pTmpFrame; pTmpFrame = aFrameIter.Next() )
- {
- if ( pTmpFrame->GetOfst() <= nStt &&
- ( !pTmpFrame->GetFollow() ||
- pTmpFrame->GetFollow()->GetOfst() > nStt ) )
- {
- pFrame = pTmpFrame;
- break;
- }
- }
-
- // search for the line containing nStt
- if ( pFrame && pFrame->HasPara() )
+ // search for the line containing nStart
+ if (HasPara())
{
- SwTextInfo aInf( pFrame );
- SwTextIter aLine( pFrame, &aInf );
- aLine.CharToLine( nStt );
+ SwTextInfo aInf(this);
+ SwTextIter aLine(this, &aInf);
+ aLine.CharToLine( nStart );
pOut->SetMapMode( aOldMap );
return static_cast<sal_uInt16>( nWidth ?
( ( 100 * aLine.GetCurr()->Height() ) / nWidth ) : 0 );
}
// no frame or no paragraph, we take the height of the character
- // at nStt as line height
+ // at nStart as line height
- aIter.SeekAndChgAttrIter( nStt, pOut );
+ aIter.SeekAndChgAttrIter( nStart, pOut );
pOut->SetMapMode( aOldMap );
- SwDrawTextInfo aDrawInf( pSh, *pOut, GetText(), nStt, 1 );
+ SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), sal_Int32(nStart), 1);
return static_cast<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
}
commit fbd97cafa62e6c6036278f301f08ea98434ed565
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Nov 21 11:15:01 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: fix the number handling in SwEditShell::GetScriptType()
This is really to complicated & should be simplified, but while it seems
reasonable to assume that a frame always exists (or that nodes without
frames should be skipped), there needs to be a way to update a
SwScriptInfo if it turns out to be invalid...
Change-Id: I185733c2e1e93b0c4d2453eeb3ea48cd4b9b6779
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index b2c2eab75197..678363ccad81 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -599,15 +599,15 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
if ( bNum )
{
bRet = false;
-
- if (sw::IsParaPropsNode(rLayout, rTNd) && rTNd.IsInList())
+ SwTextNode const*const pPropsNode(sw::GetParaPropsNode(rLayout, rTNd));
+ if (pPropsNode->IsInList())
{
- OSL_ENSURE( rTNd.GetNumRule(),
+ OSL_ENSURE( pPropsNode->GetNumRule(),
"<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." );
- const SwNumRule* pNumRule = rTNd.GetNumRule();
+ const SwNumRule* pNumRule = pPropsNode->GetNumRule();
if(pNumRule)
{
- int nListLevel = rTNd.GetActualListLevel();
+ int nListLevel = pPropsNode->GetActualListLevel();
if (nListLevel < 0)
nListLevel = 0;
@@ -621,7 +621,7 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
if ( SVX_NUM_CHAR_SPECIAL == rNumFormat.GetNumberingType() )
sExp = OUString(rNumFormat.GetBulletChar());
else
- sExp = rTNd.GetNumString();
+ sExp = pPropsNode->GetNumString(true, MAXLEVEL, &rLayout);
}
}
}
@@ -741,6 +741,9 @@ SvtScriptType SwEditShell::GetScriptType() const
if (nEndPos > rText.getLength())
nEndPos = rText.getLength();
+ bool const isUntilEnd(pScriptInfo
+ ? pFrame->MapViewToModelPos(TextFrameIndex(pFrame->GetText().getLength())) <= *pEnd
+ : rText.getLength() == nEndPos);
sal_uInt16 nScript;
while( nChg < nEndPos )
{
@@ -753,8 +756,10 @@ SvtScriptType SwEditShell::GetScriptType() const
rText, nChg );
if (!lcl_IsNoEndTextAttrAtPos(*GetLayout(), *pTNd, nChg, nRet, true,
- 0 == nChg && rText.getLength() == nEndPos))
+ TextFrameIndex(0) == iChg && isUntilEnd))
+ {
nRet |= lcl_SetScriptFlags( nScript );
+ }
if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
SvtScriptType::COMPLEX) == nRet )
commit 73a5780898f1769cd712a0c70ec6d2fbb5b23cb2
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:26:18 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
SwEditShell::IsMoveLeftMargin(), MoveLeftMargin()
Change-Id: I2bc29816af93ae265c0f0d11977b2d694e00ad6c
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2a259413a5f3..a12024ffbd36 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1378,7 +1378,8 @@ public:
/** Adjust left margin via object bar (similar to adjustment of numerations).
One can either change the margin "by" adding or subtracting a given
offset or set it "to" this position (bModulus = true). */
- void MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus );
+ void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
+ SwRootFrame const* pLayout = nullptr);
// Query NumberFormatter.
inline SvNumberFormatter* GetNumberFormatter( bool bCreate = true );
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index e88f986d5b70..0b7d3a170ba1 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1638,7 +1638,8 @@ SwFormat* SwDoc::FindFormatByName( const SwFormatsBase& rFormatArr,
return pFnd;
}
-void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
+void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
+ SwRootFrame const*const pLayout)
{
SwHistory* pHistory = nullptr;
if (GetIDocumentUndoRedo().DoesUndo())
@@ -1658,6 +1659,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
if( pTNd )
{
+ pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
SvxLRSpaceItem aLS( static_cast<const SvxLRSpaceItem&>(pTNd->SwContentNode::GetAttr( RES_LR_SPACE )) );
// #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
@@ -1693,6 +1695,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
SwRegHistory aRegH( pTNd, *pTNd, pHistory );
pTNd->SetAttr( aLS );
+ aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx).second;
}
++aIdx;
}
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 53712252e315..b2c2eab75197 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -524,6 +524,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n )
if( nullptr != ( pCNd = GetDoc()->GetNodes()[ n ]->GetTextNode() ))
{
+ pCNd = sw::GetParaPropsNode(*GetLayout(), *pCNd);
const SvxLRSpaceItem& rLS = static_cast<const SvxLRSpaceItem&>(
pCNd->GetAttr( RES_LR_SPACE ));
if( bRight )
@@ -563,10 +564,10 @@ void SwEditShell::MoveLeftMargin( bool bRight, bool bModulus )
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->MoveLeftMargin( aRangeArr.SetPam( n, aPam ),
- bRight, bModulus );
+ bRight, bModulus, GetLayout() );
}
else
- GetDoc()->MoveLeftMargin( *pCursor, bRight, bModulus );
+ GetDoc()->MoveLeftMargin( *pCursor, bRight, bModulus, GetLayout() );
EndUndo( SwUndoId::END );
EndAllAction();
commit 11e4708b4725ef26a33c56491551a0ccbef2f60e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:26:12 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
SwEditShell::GetPaMTextFormatColl()
Change-Id: I10dcee40b98b752a30942a64c1115116dfc668be
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index efd9b459146c..53712252e315 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -299,6 +299,7 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* pPaM ) const
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell::GetItemWithPaM( sal_uInt16 nWhich )
{
+ assert(isCHRATR(nWhich)); // sw_redlinehide: only thing that works
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItem;
for(SwPaM& rCurrentPaM : GetCursor()->GetRingContainer())
{ // for all the point and mark (selections)
commit fe89dcd548ff77ec5caccca88a35070b84923e31
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:00:27 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
adapt SwEditShell::GetPaMParAttr()
Change-Id: I97a2081a142fd1f74a5d6be534f094fdc4db45ab
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 2171a4230115..efd9b459146c 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -216,10 +216,16 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
// get the node
SwNode* pNd = GetDoc()->GetNodes()[ n ];
+ if (GetLayout()->IsHideRedlines()
+ && pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ continue;
+ }
+
if( pNd->IsTextNode() )
{
// get the node (paragraph) attributes
- static_cast<SwContentNode*>(pNd)->GetAttr(*pSet);
+ sw::GetAttrMerged(*pSet, *pNd->GetTextNode(), GetLayout());
if( pSet != &rSet && aSet.Count() )
{
commit 927507759881370021da541cb61cc895f6872af7
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 16:32:04 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
sw_redlinehide_4a: adapt SwEditShell::FillByEx()
Change-Id: I8a85d1fe580ce8c8a52d0ee00d36e499b5e903dc
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 7454156c2362..a38e5e70fdbe 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -77,6 +77,7 @@
#include <unoprnms.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
+#include <txtfrm.hxx>
#include <rdfhelper.hxx>
#include <sfx2/watermarkitem.hxx>
@@ -2203,6 +2204,10 @@ void SwEditShell::FillByEx(SwTextFormatColl* pColl)
{
SwPaM * pCursor = GetCursor();
SwContentNode * pCnt = pCursor->GetContentNode();
+ if (pCnt->IsTextNode()) // uhm... what nonsense would happen if not?
+ { // only need properties-node because BREAK/PAGEDESC filtered anyway!
+ pCnt = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
+ }
const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
if( pSet )
{
commit 47f5a4e5e52367e4d78362e7d35f0e1d7749901c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 15:28:38 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
SwEditShell::ResetAttr()
Change-Id: I5131f5a3ff261a4d86e65b4afff3eb8cdd98cebf
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 964d8ffe1361..14b0b48f9676 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -42,7 +42,7 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
}
for(SwPaM& rCurrentCursor : pCursor->GetRingContainer())
- GetDoc()->ResetAttrs(rCurrentCursor, true, attrs);
+ GetDoc()->ResetAttrs(rCurrentCursor, true, attrs, GetLayout());
if( bUndoGroup )
{
commit 64a76d81973f4378852fdb6f05efc0a12ec9fe91
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 15:27:45 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
more SetCounted / SetNumRule
Change-Id: I4dd3973a758f4afcc30f905b7351e9687d050e33
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4905ede420ee..2a259413a5f3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1030,7 +1030,7 @@ public:
const OUString& sContinuedListId = OUString(),
bool bSetItem = true,
const bool bResetIndentAttrs = false );
- void SetCounted( const SwPaM&, bool bCounted);
+ void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
void MakeUniqueNumRules(const SwPaM & rPaM);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 58491be5e587..ca221414f81c 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -64,7 +64,8 @@
namespace {
- void lcl_ResetIndentAttrs(SwDoc *pDoc, const SwPaM &rPam, sal_uInt16 marker )
+ void lcl_ResetIndentAttrs(SwDoc *pDoc, const SwPaM &rPam, sal_uInt16 marker,
+ SwRootFrame const*const pLayout)
{
std::set<sal_uInt16> aResetAttrsArray;
aResetAttrsArray.insert( marker );
@@ -78,11 +79,11 @@ namespace {
rPam.End()->nNode );
aPam.Start()->nContent = 0;
aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTextNode()->Len();
- pDoc->ResetAttrs( aPam, false, aResetAttrsArray );
+ pDoc->ResetAttrs( aPam, false, aResetAttrsArray, pLayout );
}
else
{
- pDoc->ResetAttrs( rPam, false, aResetAttrsArray );
+ pDoc->ResetAttrs( rPam, false, aResetAttrsArray, pLayout );
}
}
@@ -913,7 +914,9 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
}
if (!sListId.isEmpty())
{
- getIDocumentContentOperations().InsertPoolItem(aPam, SfxStringItem(RES_PARATR_LIST_ID, sListId));
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ SfxStringItem(RES_PARATR_LIST_ID, sListId),
+ SetAttrMode::DEFAULT, pLayout);
}
}
@@ -954,13 +957,15 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem )
{
- getIDocumentContentOperations().InsertPoolItem(aPam, SwNumRuleItem(pNewOrChangedNumRule->GetName()));
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ SwNumRuleItem(pNewOrChangedNumRule->GetName()),
+ SetAttrMode::DEFAULT, pLayout);
}
if ( bResetIndentAttrs
&& pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- ::lcl_ResetIndentAttrs(this, aPam, RES_LR_SPACE);
+ ::lcl_ResetIndentAttrs(this, aPam, RES_LR_SPACE, pLayout);
}
if (GetIDocumentUndoRedo().DoesUndo())
@@ -973,15 +978,18 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
return sListId;
}
-void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
+void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted,
+ SwRootFrame const*const pLayout)
{
if ( bCounted )
{
- ::lcl_ResetIndentAttrs(this, rPam, RES_PARATR_LIST_ISCOUNTED);
+ ::lcl_ResetIndentAttrs(this, rPam, RES_PARATR_LIST_ISCOUNTED, pLayout);
}
else
{
- getIDocumentContentOperations().InsertPoolItem( rPam, SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, false ) );
+ getIDocumentContentOperations().InsertPoolItem(rPam,
+ SfxBoolItem(RES_PARATR_LIST_ISCOUNTED, false),
+ SetAttrMode::DEFAULT, pLayout);
}
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index ee35d6e8be8e..8a484b085406 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -798,7 +798,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
bCreateNewList = false;
}
- GetDoc()->SetCounted( aPam, true );
+ GetDoc()->SetCounted(aPam, true, GetLayout());
}
}
else
@@ -806,7 +806,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
GetDoc()->SetNumRule( *pCursor, rRule,
bCreateNewList, GetLayout(), rContinuedListId,
true, bResetIndentAttrs );
- GetDoc()->SetCounted( *pCursor, true );
+ GetDoc()->SetCounted( *pCursor, true, GetLayout() );
}
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
commit 0dd246c8cd62396fa7c2ec0ab3f5502ed0bb8ce4
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 14:38:55 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:22:44 2018 +0100
Reset
Change-Id: I1bcbf209bdf5bf4ab8eb9f42d61eb0fe94b6f88b
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 196bea0a202d..4905ede420ee 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -692,8 +692,10 @@ public:
void ResetAttrs( const SwPaM &rRg,
bool bTextAttr = true,
const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
- const bool bSendDataChangedEvents = true );
- void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false, bool bExactRange = false );
+ const bool bSendDataChangedEvents = true,
+ SwRootFrame const* pLayout = nullptr);
+ void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
+ bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
/** Set attribute in given format.1y
* If Undo is enabled, the old values is added to the Undo history. */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 116e170cc124..e88f986d5b70 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -52,6 +52,7 @@
#include <IDocumentStylePoolAccess.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
+#include <txtfrm.hxx>
#include <hints.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
@@ -103,6 +104,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
{
const sw::DocumentContentOperationsManager::ParaRstFormat* pPara = static_cast<sw::DocumentContentOperationsManager::ParaRstFormat*>(pArgs);
SwContentNode* pNode = rpNd->GetContentNode();
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines()
+ && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true;
+ }
if( pNode && pNode->HasSwAttrSet() )
{
const bool bLocked = pNode->IsModifyLocked();
@@ -224,7 +230,8 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
return true;
}
-void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRange )
+void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark,
+ bool bExactRange, SwRootFrame const*const pLayout)
{
SwHistory* pHst = nullptr;
SwDataChanged aTmp( rRg );
@@ -235,7 +242,8 @@ void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRang
GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
}
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout );
aPara.bInclRefToxMark = bInclRefToxMark;
aPara.bExactRange = bExactRange;
GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
@@ -246,7 +254,8 @@ void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRang
void SwDoc::ResetAttrs( const SwPaM &rRg,
bool bTextAttr,
const std::set<sal_uInt16> &rAttrs,
- const bool bSendDataChangedEvents )
+ const bool bSendDataChangedEvents,
+ SwRootFrame const*const pLayout)
{
SwPaM* pPam = const_cast<SwPaM*>(&rRg);
if( !bTextAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
@@ -318,7 +327,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
}
const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout);
// mst: not including META here; it seems attrs with CH_TXTATR are omitted
sal_uInt16 const aResetableSetRange[] {
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 3a4f94d280fd..7454156c2362 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2177,7 +2177,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
aPaM.Start()->nContent = 0;
aPaM.End()->nContent = pEndTextNode->GetText().getLength();
}
- GetDoc()->RstTextAttrs(aPaM, /*bInclRefToxMark=*/false, /*bExactRange=*/true);
+ GetDoc()->RstTextAttrs(aPaM, /*bInclRefToxMark=*/false, /*bExactRange=*/true, GetLayout());
}
}
commit 50cd3a8517d9e25a4047d6711b1d44aebf0361bc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 14:37:40 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:19:12 2018 +0100
SwEditShell::SetTextFormatColl()
Change-Id: I9c511e87c431bd39dc6efdcddf2cad9bbf18c592
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 1230304fae5e..196bea0a202d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -782,7 +782,8 @@ public:
that <bReset = true> and the paragraph style has a list style attribute set. */
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
const bool bReset = true,
- const bool bResetListAttrs = false);
+ const bool bResetListAttrs = false,
+ SwRootFrame const* pLayout = nullptr);
SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
{ return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); }
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 59960e71e700..116e170cc124 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1008,6 +1008,18 @@ static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
sw::DocumentContentOperationsManager::ParaRstFormat* pPara = static_cast<sw::DocumentContentOperationsManager::ParaRstFormat*>(pArgs);
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines())
+ {
+ if (pCNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true;
+ }
+ if (pCNd->IsTextNode())
+ {
+ pCNd = sw::GetParaPropsNode(*pPara->pLayout, SwNodeIndex(*pCNd));
+ }
+ }
+
SwTextFormatColl* pFormat = static_cast<SwTextFormatColl*>(pPara->pFormatColl);
if ( pPara->bReset )
{
@@ -1070,7 +1082,8 @@ static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
bool SwDoc::SetTextFormatColl(const SwPaM &rRg,
SwTextFormatColl *pFormat,
const bool bReset,
- const bool bResetListAttrs)
+ const bool bResetListAttrs,
+ SwRootFrame const*const pLayout)
{
SwDataChanged aTmp( rRg );
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -1086,7 +1099,8 @@ bool SwDoc::SetTextFormatColl(const SwPaM &rRg,
GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
}
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout);
aPara.pFormatColl = pFormat;
aPara.bReset = bReset;
// #i62675#
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 5da40eb2555b..3a4f94d280fd 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2168,7 +2168,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) )
{
// Change the paragraph style to pLocal and remove all direct paragraph formatting.
- GetDoc()->SetTextFormatColl( rPaM, pLocal, true, bResetListAttrs );
+ GetDoc()->SetTextFormatColl(rPaM, pLocal, true, bResetListAttrs, GetLayout());
// If there are hints on the nodes which cover the whole node, then remove those, too.
SwPaM aPaM(*rPaM.Start(), *rPaM.End());
commit f669e963acea6e9a98366dd7864ba3adfd5923d8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 11:04:41 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:19:12 2018 +0100
sw_redlinehide_4a: adapt SwEditShell::ReplaceDropText()/GetDropText()
Change-Id: Iaf6101f02bd5dbeb9a07e796932186b5e2b1a563
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 111fec2ae91f..be3f6fee007e 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -490,12 +490,17 @@ OUString SwEditShell::GetDropText( const sal_Int32 nChars ) const
}
}
- SwTextNode* pTextNd = pCursor->GetNode( !pCursor->HasMark() ).GetTextNode();
+ SwTextNode const*const pTextNd = pCursor->GetNode(false).GetTextNode();
if( pTextNd )
{
- sal_Int32 nDropLen = pTextNd->GetDropLen( nChars );
- if( nDropLen )
- aText = pTextNd->GetText().copy(0, nDropLen);
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ pTextNd->getLayoutFrame(GetLayout())));
+ SAL_WARN_IF(!pTextFrame, "sw.core", "GetDropText cursor has no frame?");
+ if (pTextFrame)
+ {
+ TextFrameIndex const nDropLen(pTextFrame->GetDropLen(TextFrameIndex(nChars)));
+ aText = pTextFrame->GetText().copy(0, sal_Int32(nDropLen));
+ }
}
return aText;
@@ -511,6 +516,14 @@ void SwEditShell::ReplaceDropText( const OUString &rStr, SwPaM* pPaM )
const SwNodeIndex& rNd = pCursor->GetPoint()->nNode;
SwPaM aPam( rNd, rStr.getLength(), rNd, 0 );
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ rNd.GetNode().GetTextNode()->getLayoutFrame(GetLayout())));
+ if (pTextFrame)
+ {
+ *aPam.GetPoint() = pTextFrame->MapViewToModelPos(TextFrameIndex(0));
+ *aPam.GetMark() = pTextFrame->MapViewToModelPos(TextFrameIndex(
+ std::min(rStr.getLength(), pTextFrame->GetText().getLength())));
+ }
if( !GetDoc()->getIDocumentContentOperations().Overwrite( aPam, rStr ) )
{
OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
commit 8d5eb96ab9063a2b4aef99ad7bcef9bf040218e9
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 19 17:44:37 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:19:12 2018 +0100
sw_redlinehide_4a: InsertItemSet/InsertPoolItem
It's really quite annoying to have RES_BREAK applied to all nodes; so
apply the node-items only to the first-/properties-node and skip hidden
nodes.
Keep applying text/character items as before, except skip over hidden
nodes.
Change-Id: I085afd59af78caf1ca8dac4080c53bdbdb4e56a1
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index fb4006334a15..f761b27aa331 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -37,6 +37,7 @@ class SwFrameFormat;
class SwDrawFrameFormat;
class SwFlyFrameFormat;
class SwNodeIndex;
+class SwRootFrame;
namespace utl { class TransliterationWrapper; }
namespace svt { class EmbeddedObjectRef; }
@@ -212,10 +213,13 @@ public:
false.
*/
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr,
+ bool bExpandCharToPara=false) = 0;
virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr) = 0;
/** Removes any leading white space from the paragraph
*/
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 2727b3e39274..ceb468b7b1ae 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -45,6 +45,7 @@
#include <SwStyleNameMapper.hxx>
#include <redline.hxx>
#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <unocrsr.hxx>
#include <mvsave.hxx>
#include <ndtxt.hxx>
@@ -1013,6 +1014,81 @@ namespace
namespace //local functions originally from docfmt.cxx
{
+
+ bool lcl_ApplyOtherSet(
+ SwContentNode & rNode,
+ SwHistory *const pHistory,
+ SfxItemSet const& rOtherSet,
+ SfxItemSet const& rFirstSet,
+ SfxItemSet const& rPropsSet,
+ SwRootFrame const*const pLayout,
+ SwNodeIndex *const o_pIndex = nullptr)
+ {
+ assert(rOtherSet.Count());
+
+ bool ret(false);
+ SwTextNode *const pTNd = rNode.GetTextNode();
+ sw::MergedPara const* pMerged(nullptr);
+ if (pLayout && pLayout->IsHideRedlines() && pTNd)
+ {
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ pTNd->getLayoutFrame(pLayout)));
+ if (pTextFrame)
+ {
+ pMerged = pTextFrame->GetMergedPara();
+ }
+ if (pMerged)
+ {
+ if (rFirstSet.Count())
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(pMerged->pFirstNode, *pMerged->pFirstNode, pHistory);
+ ret = pMerged->pFirstNode->SetAttr(rFirstSet);
+ }
+ else
+ {
+ ret = pMerged->pFirstNode->SetAttr(rFirstSet);
+ }
+ }
+ if (rPropsSet.Count())
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(pMerged->pParaPropsNode, *pMerged->pParaPropsNode, pHistory);
+ ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
+ }
+ else
+ {
+ ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
+ }
+ }
+ if (o_pIndex)
+ {
+ *o_pIndex = *pMerged->pLastNode; // skip hidden
+ }
+ }
+ }
+
+ // input cursor can't be on hidden node, and iteration skips them
+ assert(!pLayout || !pLayout->IsHideRedlines()
+ || rNode.GetRedlineMergeFlag() != SwNode::Merge::Hidden);
+
+ if (!pMerged)
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(&rNode, rNode, pHistory);
+ ret = rNode.SetAttr( rOtherSet );
+ }
+ else
+ {
+ ret = rNode.SetAttr( rOtherSet );
+ }
+ }
+ return ret;
+ }
+
#define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
/// Insert Hints according to content types;
@@ -1024,6 +1100,7 @@ namespace //local functions originally from docfmt.cxx
const SfxItemSet& rChgSet,
const SetAttrMode nFlags,
SwUndoAttr *const pUndo,
+ SwRootFrame const*const pLayout,
const bool bExpandCharToPara=false)
{
// Divide the Sets (for selections in Nodes)
@@ -1106,6 +1183,10 @@ namespace //local functions originally from docfmt.cxx
if (rRg.IsInFrontOfLabel())
{
SwTextNode * pTextNd = pNode->GetTextNode();
+ if (pLayout)
+ {
+ pTextNd = sw::GetParaPropsNode(*pLayout, *pTextNd);
+ }
SwNumRule * pNumRule = pTextNd->GetNumRule();
if ( !pNumRule )
@@ -1246,8 +1327,13 @@ namespace //local functions originally from docfmt.cxx
}
else
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- bRet = pNode->SetAttr( aNew ) || bRet;
+ SwContentNode * pFirstNode(pNode);
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ pFirstNode = sw::GetFirstAndLastNode(*pLayout, pStt->nNode).first;
+ }
+ SwRegHistory aRegH( pFirstNode, *pFirstNode, pHistory );
+ bRet = pFirstNode->SetAttr( aNew ) || bRet;
}
}
@@ -1309,6 +1395,21 @@ namespace //local functions originally from docfmt.cxx
}
}
+ SfxItemSet firstSet(pDoc->GetAttrPool(),
+ svl::Items<RES_PAGEDESC, RES_BREAK>{});
+ if (pOtherSet && pOtherSet->Count())
+ { // actually only RES_BREAK is possible here...
+ firstSet.Put(*pOtherSet);
+ }
+ SfxItemSet propsSet(pDoc->GetAttrPool(),
+ svl::Items<RES_PARATR_BEGIN, RES_PAGEDESC,
+ RES_BREAK+1, RES_FRMATR_END,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST+1>{});
+ if (pOtherSet && pOtherSet->Count())
+ {
+ propsSet.Put(*pOtherSet);
+ }
+
if( !rRg.HasMark() ) // no range
{
if( !pNode )
@@ -1387,15 +1488,13 @@ namespace //local functions originally from docfmt.cxx
}
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
-
// Need to check for unique item for DrawingLayer items of type NameOrIndex
// and evtl. correct that item to ensure unique names for that type. This call may
// modify/correct entries inside of the given SfxItemSet
SfxItemSet aTempLocalCopy(*pOtherSet);
pDoc->CheckForUniqueItemForLineFillNameOrIndex(aTempLocalCopy);
- bRet = pNode->SetAttr(aTempLocalCopy) || bRet;
+ bRet = lcl_ApplyOtherSet(*pNode, pHistory, aTempLocalCopy, firstSet, propsSet, pLayout) || bRet;
}
DELETECHARSETS
@@ -1435,8 +1534,7 @@ namespace //local functions originally from docfmt.cxx
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- bRet = pNode->SetAttr( *pOtherSet ) || bRet;
+ bRet = lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout) || bRet;
}
// Only selection in a Node.
@@ -1495,8 +1593,7 @@ namespace //local functions originally from docfmt.cxx
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- pNode->SetAttr( *pOtherSet );
+ lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout);
}
++nNodes;
@@ -1517,7 +1614,8 @@ namespace //local functions originally from docfmt.cxx
// Reset all attributes from the set!
if( pCharSet && pCharSet->Count() && !( SetAttrMode::DONTREPLACE & nFlags ) )
{
- ::sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHistory, pCharSet );
+ ::sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHistory, pCharSet, pLayout);
pDoc->GetNodes().ForEach( aSt, aEnd, ::sw::DocumentContentOperationsManager::lcl_RstTextAttr, &aPara );
}
@@ -1525,18 +1623,23 @@ namespace //local functions originally from docfmt.cxx
SfxItemState::SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, false ) ||
SfxItemState::SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, false ) );
- for(; aSt < aEnd; ++aSt )
+ for (SwNodeIndex current = aSt; current < aEnd; ++current)
{
- pNode = aSt.GetNode().GetContentNode();
- if( !pNode )
+ SwTextNode *const pTNd = current.GetNode().GetTextNode();
+ if (!pTNd)
continue;
- SwTextNode* pTNd = pNode->GetTextNode();
+ if (pLayout && pLayout->IsHideRedlines()
+ && pTNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ { // not really sure what to do here, but applying to hidden
+ continue; // nodes doesn't make sense...
+ }
+
if( pHistory )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
+ SwRegHistory aRegH( pTNd, *pTNd, pHistory );
- if( pTNd && pCharSet && pCharSet->Count() )
+ if (pCharSet && pCharSet->Count())
{
SwpHints *pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
: pTNd->GetpSwpHints();
@@ -1547,19 +1650,28 @@ namespace //local functions originally from docfmt.cxx
if( pSwpHints )
pSwpHints->DeRegister();
}
- if( pOtherSet && pOtherSet->Count() )
- pNode->SetAttr( *pOtherSet );
}
else
{
- if( pTNd && pCharSet && pCharSet->Count() )
+ if (pCharSet && pCharSet->Count())
pTNd->SetAttr(*pCharSet, 0, pTNd->GetText().getLength(), nFlags);
- if( pOtherSet && pOtherSet->Count() )
- pNode->SetAttr( *pOtherSet );
}
++nNodes;
}
+ if (pOtherSet && pOtherSet->Count())
+ {
+ for (; aSt < aEnd; ++aSt)
+ {
+ pNode = aSt.GetNode().GetContentNode();
+ if (!pNode)
+ continue;
+
+ lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout, &aSt);
+ ++nNodes;
+ }
+ }
+
//The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc,
//which is set in SW MS Word Binary filter WW8ImplRreader. With this flag on, means that
//current setting attribute set is a character range properties set and comes from a MS Word
@@ -3101,6 +3213,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
const SwPaM &rRg,
const SfxPoolItem &rHt,
const SetAttrMode nFlags,
+ SwRootFrame const*const pLayout,
const bool bExpandCharToPara)
{
if (utl::ConfigManager::IsFuzzing())
@@ -3116,7 +3229,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
SfxItemSet aSet( m_rDoc.GetAttrPool(), {{rHt.Which(), rHt.Which()}} );
aSet.Put( rHt );
- const bool bRet = lcl_InsAttr( &m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), bExpandCharToPara );
+ const bool bRet = lcl_InsAttr(&m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, bExpandCharToPara);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -3131,7 +3244,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
}
void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet,
- const SetAttrMode nFlags )
+ const SetAttrMode nFlags, SwRootFrame const*const pLayout)
{
SwDataChanged aTmp( rRg );
std::unique_ptr<SwUndoAttr> pUndoAttr;
@@ -3141,7 +3254,7 @@ void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const S
pUndoAttr.reset(new SwUndoAttr( rRg, rSet, nFlags ));
}
- bool bRet = lcl_InsAttr( &m_rDoc, rRg, rSet, nFlags, pUndoAttr.get() );
+ bool bRet = lcl_InsAttr(&m_rDoc, rRg, rSet, nFlags, pUndoAttr.get(), pLayout);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -3531,6 +3644,11 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
bool DocumentContentOperationsManager::lcl_RstTextAttr( const SwNodePtr& rpNd, void* pArgs )
{
ParaRstFormat* pPara = static_cast<ParaRstFormat*>(pArgs);
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines()
+ && rpNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true; // skip hidden, since new items aren't applied
+ }
SwTextNode * pTextNode = rpNd->GetTextNode();
if( pTextNode && pTextNode->GetpSwpHints() )
{
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 6e58be8cee1e..964d8ffe1361 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -110,7 +110,7 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags )
if( rPaM.HasMark() && ( bIsTableMode ||
*rPaM.GetPoint() != *rPaM.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags, GetLayout());
}
}
@@ -120,7 +120,7 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags )
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->getIDocumentContentOperations().InsertPoolItem( *pCursor, rHint, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertPoolItem(*pCursor, rHint, nFlags, GetLayout());
}
EndAllAction();
}
@@ -141,7 +141,7 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, SwPaM*
if( rTmpCursor.HasMark() && ( bIsTableMode ||
*rTmpCursor.GetPoint() != *rTmpCursor.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCursor, rSet, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCursor, rSet, nFlags, GetLayout());
}
}
@@ -151,7 +151,7 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, SwPaM*
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, rSet, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertItemSet(*pCursor, rSet, nFlags, GetLayout());
}
EndAllAction();
}
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index c60676617b78..e276d4e61238 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -87,10 +87,13 @@ public:
// Add a para for the char attribute exp...
bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) override;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr,
+ bool bExpandCharToPara=false) override;
void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT) override;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr) override;
void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
@@ -117,6 +120,7 @@ public:
SwHistory* pHistory;
const SwPosition *pSttNd, *pEndNd;
const SfxItemSet* pDelSet;
+ SwRootFrame const*const pLayout;
sal_uInt16 nWhich;
bool bReset;
bool bResetListAttrs; // #i62575#
@@ -126,12 +130,14 @@ public:
bool bExactRange;
ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
- SwHistory* pHst, const SfxItemSet* pSet = nullptr)
+ SwHistory* pHst, const SfxItemSet* pSet = nullptr,
+ SwRootFrame const*const pLay = nullptr)
: pFormatColl(nullptr)
, pHistory(pHst)
, pSttNd(pStt)
, pEndNd(pEnd)
, pDelSet(pSet)
+ , pLayout(pLay)
, nWhich(0)
, bReset(false) // #i62675#
, bResetListAttrs(false)
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 8b219d2b60b3..e737167c5c1f 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -795,7 +795,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
if (rEntry.IsParaEnd())
{
- pDoc->getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.pAttr, SetAttrMode::DEFAULT, true);
+ pDoc->getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.pAttr, SetAttrMode::DEFAULT, nullptr, true);
}
else
{
commit 81b9be2ae64f3d723cac9d032151dc863780ba6c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 19 12:47:59 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:19:12 2018 +0100
sw_redlinehide_4a: ignore hidden nodes in SwEditShell::GetPaMAttr()
MergeValues would set everything to invalid.
Change-Id: I45795fe9bd113399e276ac42851cbf5a198c9694
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 65da45aca713..2171a4230115 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -159,7 +159,13 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
if( pNd )
{
if( pSet != &rSet )
- rSet.MergeValues( aSet );
+ {
+ if (!GetLayout()->IsHideRedlines()
+ || pNd->GetRedlineMergeFlag() != SwNode::Merge::Hidden)
+ {
+ rSet.MergeValues( aSet );
+ }
+ }
if( aSet.Count() )
aSet.ClearItem();
commit 71d442165e52cb7421ed74b9b5be449d2234f4d6
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 16 18:52:32 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Nov 21 18:16:16 2018 +0100
sw_redlinehide_4a: add layout to SwTextNode::GetParaAttr()
Merge items from first-node and props-node, as they are used in the
text formatting.
Change-Id: I4cbab55bc3b0f8bc6dc5bd3577da53b3160018a3
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 0818fde96434..64eef11f9221 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -305,7 +305,8 @@ public:
bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
const bool bOnlyTextAttr = false,
const bool bGetFromChrFormat = true,
- const bool bMergeIndentValuesOfNumRule = false ) const;
+ const bool bMergeIndentValuesOfNumRule = false,
+ SwRootFrame const* pLayout = nullptr) const;
/// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
void FormatToTextAttr( SwTextNode* pNd );
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 5fe78b683964..65da45aca713 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -143,7 +143,8 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
static_cast<SwTextNode*>(pNd)->GetParaAttr(*pSet, nStt, nEnd,
false, true,
- bMergeIndentValuesOfNumRule );
+ bMergeIndentValuesOfNumRule,
+ GetLayout());
}
break;
case SwNodeType::Grf:
diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx
index 6816bd84172a..a2142249b5c7 100644
--- a/sw/source/core/edit/edfmt.cxx
+++ b/sw/source/core/edit/edfmt.cxx
@@ -93,7 +93,7 @@ void SwEditShell::FillByEx(SwCharFormat* pCharFormat)
SfxItemSet aSet( mxDoc->GetAttrPool(),
pCharFormat->GetAttrSet().GetRanges() );
- pTextNode->GetParaAttr( aSet, nStt, nEnd );
+ pTextNode->GetParaAttr(aSet, nStt, nEnd, false, true, false, GetLayout());
pCharFormat->SetFormatAttr( aSet );
}
else if( pCNd->HasSwAttrSet() )
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 00bd58d12fe9..f0adb57b5bbb 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -107,6 +107,9 @@ SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
std::pair<SwTextNode *, SwTextNode *>
GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos);
+SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
+ SwTextNode const& rNode, SwRootFrame const* pLayout);
+
void GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout);
void GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout);
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 70d34dc4ff91..1bdc051665c4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -368,6 +368,53 @@ namespace sw {
return std::make_pair(pTextNode, pTextNode);
}
+ SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
+ SwTextNode const& rNode, SwRootFrame const*const pLayout)
+ {
+ rNode.SwContentNode::GetAttr(rFormatSet);
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ if (sw::MergedPara const*const pMerged =
+ static_cast<SwTextFrame*>(rNode.getLayoutFrame(pLayout))->GetMergedPara())
+ {
+ if (pMerged->pFirstNode != &rNode)
+ {
+ rFormatSet.ClearItem(RES_PAGEDESC);
+ rFormatSet.ClearItem(RES_BREAK);
+ static_assert(RES_PAGEDESC + 1 == sal_uInt16(RES_BREAK));
+ SfxItemSet firstSet(*rFormatSet.GetPool(),
+ svl::Items<RES_PAGEDESC, RES_BREAK>{});
+ pMerged->pFirstNode->SwContentNode::GetAttr(firstSet);
+ rFormatSet.Put(firstSet);
+
+ }
+ if (pMerged->pParaPropsNode != &rNode)
+ {
+ for (sal_uInt16 i = RES_PARATR_BEGIN; i != RES_FRMATR_END; ++i)
+ {
+ if (i != RES_PAGEDESC && i != RES_BREAK)
+ {
+ rFormatSet.ClearItem(i);
+ }
+ }
+ for (sal_uInt16 i = XATTR_FILL_FIRST; i <= XATTR_FILL_LAST; ++i)
+ {
+ rFormatSet.ClearItem(i);
+ }
+ SfxItemSet propsSet(*rFormatSet.GetPool(),
+ svl::Items<RES_PARATR_BEGIN, RES_PAGEDESC,
+ RES_BREAK+1, RES_FRMATR_END,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST+1>{});
+ pMerged->pParaPropsNode->SwContentNode::GetAttr(propsSet);
+ rFormatSet.Put(propsSet);
+ return *pMerged->pParaPropsNode;
+ }
+ // keep all the CHRATR/UNKNOWNATR anyway...
+ }
+ }
+ return rNode;
+ }
+
} // namespace sw
/// Switches width and height of the text frame
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index c319d135d93f..83aa88513688 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -65,6 +65,7 @@
#include <pam.hxx>
#include <ndtxt.hxx>
#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <rolbck.hxx>
#include <ddefld.hxx>
#include <docufld.hxx>
@@ -2050,18 +2051,28 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
// request the attributes of the TextNode at the range
bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
const bool bOnlyTextAttr, const bool bGetFromChrFormat,
- const bool bMergeIndentValuesOfNumRule ) const
+ const bool bMergeIndentValuesOfNumRule,
+ SwRootFrame const*const pLayout) const
{
assert(!rSet.Count()); // handled inconsistently, typically an error?
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ if (GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return false; // ignore deleted node
+ }
+ }
+
// get the node's automatic attributes
SfxItemSet aFormatSet( *rSet.GetPool(), rSet.GetRanges() );
if (!bOnlyTextAttr)
{
- SwContentNode::GetAttr( aFormatSet );
- if ( bMergeIndentValuesOfNumRule )
+ SwTextNode const& rParaPropsNode(
+ sw::GetAttrMerged(aFormatSet, *this, pLayout));
+ if (bMergeIndentValuesOfNumRule)
{
- lcl_MergeListLevelIndentAsLRSpaceItem( *this, aFormatSet );
+ lcl_MergeListLevelIndentAsLRSpaceItem(rParaPropsNode, aFormatSet);
}
}
More information about the Libreoffice-commits
mailing list