vcl: split off IdleFormatter to own source files

Change-Id: I9f463ed77fbabd6158ce3eb2b045e12fdb0705c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179712
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Christopher Sherlock
2025-01-03 19:43:35 +11:00
committed by Michael Weghorn
parent 7dddd44906
commit 77bfb60031
7 changed files with 124 additions and 59 deletions

View File

@@ -14589,6 +14589,8 @@ vcl/source/control/tabctrl.cxx
vcl/source/control/throbber.cxx
vcl/source/control/wizardmachine.cxx
vcl/source/control/wizimpldata.hxx
vcl/source/edit/IdleFormatter.cxx
vcl/source/edit/IdleFormatter.hxx
vcl/source/edit/TextLine.hxx
vcl/source/edit/textdat2.hxx
vcl/source/edit/textdata.cxx

View File

@@ -263,6 +263,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/control/tabctrl \
vcl/source/control/throbber \
vcl/source/control/wizardmachine \
vcl/source/edit/IdleFormatter \
vcl/source/edit/vclmedit \
vcl/source/edit/textdata \
vcl/source/edit/textdoc \

View File

@@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/config.h>
#include <vcl/weld.hxx>
#include "IdleFormatter.hxx"
#include "TextLine.hxx"
#include <cstddef>
#include <utility>
IdleFormatter::IdleFormatter()
: Idle("vcl::TextEngine mpIdleFormatter")
, mpView(nullptr)
, mnRestarts(0)
{
SetPriority(TaskPriority::HIGH_IDLE);
}
IdleFormatter::~IdleFormatter()
{
mpView = nullptr;
}
void IdleFormatter::DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts )
{
mpView = pV;
if ( IsActive() )
mnRestarts++;
if ( mnRestarts > nMaxRestarts )
{
mnRestarts = 0;
Invoke();
}
else
{
Start();
}
}
void IdleFormatter::ForceTimeout()
{
if ( IsActive() )
{
Stop();
mnRestarts = 0;
Invoke();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View File

@@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <cstddef>
#include <limits>
#include <vector>
#include <vcl/idle.hxx>
class TextLine;
class TextNode;
class TextView;
class IdleFormatter : public Idle
{
private:
TextView* mpView;
sal_uInt16 mnRestarts;
public:
IdleFormatter();
virtual ~IdleFormatter() override;
void DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts );
void ForceTimeout();
TextView* GetView() { return mpView; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View File

@@ -19,10 +19,9 @@
#pragma once
#include <vcl/seleng.hxx>
#include <tools/long.hxx>
#include <vcl/cursor.hxx>
#include <vcl/idle.hxx>
#include <vcl/textdata.hxx>
#include <cstddef>
#include <limits>
@@ -188,21 +187,6 @@ public:
virtual void DestroyAnchor() override;
};
class IdleFormatter : public Idle
{
private:
TextView* mpView;
sal_uInt16 mnRestarts;
public:
IdleFormatter();
virtual ~IdleFormatter() override;
void DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts );
void ForceTimeout();
TextView* GetView() { return mpView; }
};
struct TextDDInfo
{
vcl::Cursor maCursor;

View File

@@ -269,47 +269,6 @@ TEParaPortions::~TEParaPortions()
{
}
IdleFormatter::IdleFormatter()
: Idle("vcl::TextEngine mpIdleFormatter")
, mpView(nullptr)
, mnRestarts(0)
{
SetPriority(TaskPriority::HIGH_IDLE);
}
IdleFormatter::~IdleFormatter()
{
mpView = nullptr;
}
void IdleFormatter::DoIdleFormat( TextView* pV, sal_uInt16 nMaxRestarts )
{
mpView = pV;
if ( IsActive() )
mnRestarts++;
if ( mnRestarts > nMaxRestarts )
{
mnRestarts = 0;
Invoke();
}
else
{
Start();
}
}
void IdleFormatter::ForceTimeout()
{
if ( IsActive() )
{
Stop();
mnRestarts = 0;
Invoke();
}
}
TextHint::TextHint( SfxHintId Id ) : SfxHint( Id ), mnValue(0)
{
}

View File

@@ -36,6 +36,7 @@
#include <osl/diagnose.h>
#include "TextLine.hxx"
#include "IdleFormatter.hxx"
#include <com/sun/star/i18n/XBreakIterator.hpp>