editeng: simplify and clean-up struct in for ImpEditEng
Change-Id: I8ca190f957e6bf15f6c0aa8b8e22a26e896a9374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163198 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
890229e367
commit
d0317669ac
@@ -2252,7 +2252,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
|
||||
|
||||
if (HasSelection() && mbClickedInSelection)
|
||||
{
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo());
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2263,7 +2263,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
|
||||
const SvxFieldItem* pField = GetField( aMousePos, &nPara, &nPos );
|
||||
if ( pField )
|
||||
{
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo());
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo);
|
||||
mpDragAndDropInfo->pField = pField;
|
||||
ContentNode* pNode = getEditEngine().GetEditDoc().GetObject( nPara );
|
||||
aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) );
|
||||
@@ -2274,7 +2274,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
|
||||
}
|
||||
else if ( IsBulletArea( aMousePos, &nPara ) )
|
||||
{
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo());
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo);
|
||||
mpDragAndDropInfo->bOutlinerMode = true;
|
||||
EditPaM aStartPaM(getEditEngine().GetEditDoc().GetObject(nPara), 0);
|
||||
EditPaM aEndPaM( aStartPaM );
|
||||
@@ -2487,7 +2487,7 @@ void ImpEditView::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEv
|
||||
SolarMutexGuard aVclGuard;
|
||||
|
||||
if (!mpDragAndDropInfo)
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo());
|
||||
mpDragAndDropInfo.reset(new DragAndDropInfo);
|
||||
|
||||
mpDragAndDropInfo->bHasValidData = false;
|
||||
|
||||
|
||||
@@ -100,49 +100,55 @@ struct CursorFlags
|
||||
|
||||
struct DragAndDropInfo
|
||||
{
|
||||
tools::Rectangle aCurCursor;
|
||||
tools::Rectangle aCurSavedCursor;
|
||||
sal_uInt16 nSensibleRange;
|
||||
sal_uInt16 nCursorWidth;
|
||||
ESelection aBeginDragSel;
|
||||
EditPaM aDropDest;
|
||||
sal_Int32 nOutlinerDropDest;
|
||||
ESelection aDropSel;
|
||||
VclPtr<VirtualDevice> pBackground;
|
||||
const SvxFieldItem* pField;
|
||||
bool bVisCursor : 1;
|
||||
bool bDroppedInMe : 1;
|
||||
bool bStarterOfDD : 1;
|
||||
bool bHasValidData : 1;
|
||||
bool bUndoAction : 1;
|
||||
bool bOutlinerMode : 1;
|
||||
bool bDragAccepted : 1;
|
||||
tools::Rectangle aCurCursor;
|
||||
tools::Rectangle aCurSavedCursor;
|
||||
sal_uInt16 nSensibleRange = 0;
|
||||
sal_uInt16 nCursorWidth = 0;
|
||||
ESelection aBeginDragSel;
|
||||
EditPaM aDropDest;
|
||||
sal_Int32 nOutlinerDropDest = 0;
|
||||
ESelection aDropSel;
|
||||
VclPtr<VirtualDevice> pBackground = nullptr;
|
||||
const SvxFieldItem* pField = nullptr;
|
||||
bool bVisCursor : 1 = false;
|
||||
bool bDroppedInMe : 1 = false;
|
||||
bool bStarterOfDD : 1 = false;
|
||||
bool bHasValidData : 1 = false;
|
||||
bool bUndoAction : 1 = false;
|
||||
bool bOutlinerMode : 1 = false;
|
||||
bool bDragAccepted : 1 = false;
|
||||
|
||||
DragAndDropInfo()
|
||||
: nSensibleRange(0), nCursorWidth(0), nOutlinerDropDest(0), pBackground(nullptr),
|
||||
pField(nullptr), bVisCursor(false), bDroppedInMe(false), bStarterOfDD(false),
|
||||
bHasValidData(false), bUndoAction(false), bOutlinerMode(false), bDragAccepted(false)
|
||||
{
|
||||
}
|
||||
~DragAndDropInfo()
|
||||
{
|
||||
pBackground.disposeAndClear();
|
||||
pBackground.disposeAndClear();
|
||||
}
|
||||
};
|
||||
|
||||
struct ImplIMEInfos
|
||||
{
|
||||
OUString aOldTextAfterStartPos;
|
||||
OUString aOldTextAfterStartPos;
|
||||
std::unique_ptr<ExtTextInputAttr[]> pAttribs;
|
||||
EditPaM aPos;
|
||||
sal_Int32 nLen;
|
||||
bool bWasCursorOverwrite;
|
||||
EditPaM aPos;
|
||||
sal_Int32 nLen = 0;
|
||||
bool bWasCursorOverwrite = false;
|
||||
|
||||
ImplIMEInfos( const EditPaM& rPos, OUString aOldTextAfterStartPos );
|
||||
~ImplIMEInfos();
|
||||
ImplIMEInfos(const EditPaM& rPos, OUString _aOldTextAfterStartPos)
|
||||
: aOldTextAfterStartPos(std::move(_aOldTextAfterStartPos))
|
||||
, aPos(rPos)
|
||||
{}
|
||||
|
||||
void CopyAttribs( const ExtTextInputAttr* pA, sal_uInt16 nL );
|
||||
void DestroyAttribs();
|
||||
void CopyAttribs(const ExtTextInputAttr* pInputAttributes, sal_uInt16 nInputLength)
|
||||
{
|
||||
nLen = nInputLength;
|
||||
pAttribs.reset(new ExtTextInputAttr[nInputLength]);
|
||||
memcpy(pAttribs.get(), pInputAttributes, nInputLength * sizeof(ExtTextInputAttr));
|
||||
}
|
||||
|
||||
void DestroyAttribs()
|
||||
{
|
||||
pAttribs.reset();
|
||||
nLen = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// #i18881# to be able to identify the positions of changed words
|
||||
@@ -151,28 +157,24 @@ typedef std::vector<EditSelection> SpellContentSelections;
|
||||
|
||||
struct SpellInfo
|
||||
{
|
||||
EditPaM aCurSentenceStart;
|
||||
svx::SpellPortions aLastSpellPortions;
|
||||
SpellContentSelections aLastSpellContentSelections;
|
||||
EESpellState eState;
|
||||
EPaM aSpellStart;
|
||||
EPaM aSpellTo;
|
||||
bool bSpellToEnd;
|
||||
bool bMultipleDoc;
|
||||
SpellInfo() : eState(EESpellState::Ok), bSpellToEnd(true), bMultipleDoc(false)
|
||||
{ }
|
||||
EditPaM aCurSentenceStart;
|
||||
svx::SpellPortions aLastSpellPortions;
|
||||
SpellContentSelections aLastSpellContentSelections;
|
||||
EESpellState eState = EESpellState::Ok;
|
||||
EPaM aSpellStart;
|
||||
EPaM aSpellTo;
|
||||
bool bSpellToEnd : 1 = true;
|
||||
bool bMultipleDoc : 1 = false;
|
||||
};
|
||||
|
||||
// used for text conversion
|
||||
struct ConvInfo
|
||||
{
|
||||
EPaM aConvStart;
|
||||
EPaM aConvTo;
|
||||
EPaM aConvContinue; // position to start search for next text portion (word) with
|
||||
bool bConvToEnd;
|
||||
bool bMultipleDoc;
|
||||
|
||||
ConvInfo() : bConvToEnd(true), bMultipleDoc(false) {}
|
||||
EPaM aConvStart;
|
||||
EPaM aConvTo;
|
||||
EPaM aConvContinue; // position to start search for next text portion (word) with
|
||||
bool bConvToEnd : 1 = true;
|
||||
bool bMultipleDoc : 1 = false;
|
||||
};
|
||||
|
||||
struct FormatterFontMetric
|
||||
@@ -189,20 +191,21 @@ struct FormatterFontMetric
|
||||
class IdleFormattter : public Idle
|
||||
{
|
||||
private:
|
||||
EditView* pView;
|
||||
int nRestarts;
|
||||
EditView* mpView = nullptr;
|
||||
int mnRestarts = 0;
|
||||
|
||||
public:
|
||||
IdleFormattter();
|
||||
virtual ~IdleFormattter() override;
|
||||
IdleFormattter();
|
||||
virtual ~IdleFormattter() override;
|
||||
|
||||
void DoIdleFormat( EditView* pV );
|
||||
void ForceTimeout();
|
||||
void ResetRestarts() { nRestarts = 0; }
|
||||
EditView* GetView() { return pView; }
|
||||
void DoIdleFormat(EditView* pView);
|
||||
void ForceTimeout();
|
||||
void ResetRestarts() { mnRestarts = 0; }
|
||||
EditView* GetView() { return mpView; }
|
||||
};
|
||||
|
||||
class ImpEditView;
|
||||
|
||||
/// This is meant just for Calc, where all positions in logical units (twips for LOK) are computed by
|
||||
/// doing independent pixel-alignment for each cell's size. LOKSpecialPositioning stores
|
||||
/// both 'output-area' and 'visible-doc-position' in pure logical unit (twips for LOK).
|
||||
|
||||
@@ -791,23 +791,21 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode )
|
||||
IdleFormattter::IdleFormattter()
|
||||
: Idle("editeng::ImpEditEngine aIdleFormatter")
|
||||
{
|
||||
pView = nullptr;
|
||||
nRestarts = 0;
|
||||
}
|
||||
|
||||
IdleFormattter::~IdleFormattter()
|
||||
{
|
||||
pView = nullptr;
|
||||
mpView = nullptr;
|
||||
}
|
||||
|
||||
void IdleFormattter::DoIdleFormat( EditView* pV )
|
||||
void IdleFormattter::DoIdleFormat(EditView* pView)
|
||||
{
|
||||
pView = pV;
|
||||
mpView = pView;
|
||||
|
||||
if ( IsActive() )
|
||||
nRestarts++;
|
||||
if (IsActive())
|
||||
mnRestarts++;
|
||||
|
||||
if ( nRestarts > 4 )
|
||||
if (mnRestarts > 4)
|
||||
ForceTimeout();
|
||||
else
|
||||
Start();
|
||||
@@ -815,36 +813,12 @@ void IdleFormattter::DoIdleFormat( EditView* pV )
|
||||
|
||||
void IdleFormattter::ForceTimeout()
|
||||
{
|
||||
if ( IsActive() )
|
||||
if (IsActive())
|
||||
{
|
||||
Stop();
|
||||
Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
ImplIMEInfos::ImplIMEInfos( const EditPaM& rPos, OUString _aOldTextAfterStartPos )
|
||||
: aOldTextAfterStartPos(std::move( _aOldTextAfterStartPos )),
|
||||
aPos(rPos),
|
||||
nLen(0),
|
||||
bWasCursorOverwrite(false)
|
||||
{
|
||||
}
|
||||
|
||||
ImplIMEInfos::~ImplIMEInfos()
|
||||
{
|
||||
}
|
||||
|
||||
void ImplIMEInfos::CopyAttribs( const ExtTextInputAttr* pA, sal_uInt16 nL )
|
||||
{
|
||||
nLen = nL;
|
||||
pAttribs.reset( new ExtTextInputAttr[ nL ] );
|
||||
memcpy( pAttribs.get(), pA, nL*sizeof(ExtTextInputAttr) );
|
||||
}
|
||||
|
||||
void ImplIMEInfos::DestroyAttribs()
|
||||
{
|
||||
pAttribs.reset();
|
||||
nLen = 0;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user