Kaydet (Commit) cb65f5e1 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide: SwScriptInfo::GetScriptInfo() should return frame too

The SwScriptInfo comes from the frame, and if both are used together
they have to match.

Change-Id: I3de0754d9ff316180fc04708889886684d6868e5
üst 40f6dab9
......@@ -129,14 +129,16 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
if ( nPrevPos )
--nPrevPos;
SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( static_cast<SwTextNode&>(rNode), true );
SwTextFrame const* pFrame;
SwScriptInfo *const pSI = SwScriptInfo::GetScriptInfo(
static_cast<SwTextNode&>(rNode), &pFrame, true);
sal_uInt8 nLevel = 0;
if ( ! pSI )
{
// seems to be an empty paragraph.
Point aPt; // why ???
SwTextFrame *const pFrame = static_cast<SwTextFrame*>(
pFrame = static_cast<SwTextFrame*>(
static_cast<SwTextNode&>(rNode).getLayoutFrame(
GetLayout(), &aPt, pTmpCursor->GetPoint(), false));
......@@ -149,10 +151,6 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
{
if (TextFrameIndex(COMPLETE_STRING) != pSI->GetInvalidityA())
{
// note: if pSI was found, there must be a frame
SwTextFrame *const pFrame = static_cast<SwTextFrame*>(
static_cast<SwTextNode&>(rNode).getLayoutFrame(
GetLayout(), nullptr, pTmpCursor->GetPoint(), false));
// mystery why this doesn't use the other overload?
pSI->InitScriptInfo(static_cast<SwTextNode&>(rNode), pFrame->GetMergedPara());
}
......
......@@ -28,6 +28,7 @@
#include "TextFrameIndex.hxx"
class SwTextNode;
class SwTextFrame;
class Point;
class MultiSelection;
typedef std::vector< sal_Int32 > PositionList;
......@@ -366,8 +367,11 @@ public:
TextFrameIndex nLen, LanguageType aLang,
long nSpaceAdd, bool bIsSpaceStop );
/// return a frame for the node, ScriptInfo is its member...
/// (many clients need both frame and SI, and both have to match)
static SwScriptInfo* GetScriptInfo( const SwTextNode& rNode,
bool bAllowInvalid = false );
SwTextFrame const** o_pFrame = nullptr,
bool bAllowInvalid = false);
SwFontScript WhichFont(TextFrameIndex nIdx) const;
static SwFontScript WhichFont(sal_Int32 nIdx, OUString const & rText);
......
......@@ -2081,7 +2081,8 @@ TextFrameIndex SwScriptInfo::ThaiJustify( const OUString& rText, long* pKernArra
}
SwScriptInfo* SwScriptInfo::GetScriptInfo( const SwTextNode& rTNd,
bool bAllowInvalid )
SwTextFrame const**const o_ppFrame,
bool const bAllowInvalid)
{
SwIterator<SwTextFrame,SwTextNode> aIter( rTNd );
SwScriptInfo* pScriptInfo = nullptr;
......@@ -2093,7 +2094,13 @@ SwScriptInfo* SwScriptInfo::GetScriptInfo( const SwTextNode& rTNd,
{
if (bAllowInvalid ||
TextFrameIndex(COMPLETE_STRING) == pScriptInfo->GetInvalidityA())
{
if (o_ppFrame)
{
*o_ppFrame = pLast;
}
break;
}
pScriptInfo = nullptr;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment