editeng/source/outliner/outlin2.cxx  |    9 ----
 editeng/source/outliner/outliner.cxx |   28 ++++++++-----
 editeng/source/outliner/paralist.cxx |   12 -----
 include/editeng/outliner.hxx         |   73 ++++++++++++++++++++++++++++++-----
 4 files changed, 80 insertions(+), 42 deletions(-)

New commits:
commit d8e1e390585681135be9fa0b5faa568ba0c4b65c
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Jan 19 13:00:43 2026 +0900
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Jan 19 21:08:13 2026 +0100

    sd: Fix different rendering when in view and edit when scaling
    
    If the text box is scaled and the scaling changes, we need to
    invalidate the bullet sizes, but we only do this when scaling
    is set from the outside. If the scaling adjustment is done
    internally we don't invalidate the bullet size, which results to
    different rendering.
    
    So instead of relying that the bullet size is invalidated at some
    point, we store the scaling factor with the bullet and recalculate
    it when it doesn't match with the current scaling factor.
    
    Change-Id: I116249f111bd8dd57ab38c4066d4ab51ae396f49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197536
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit 173622396620a4f08bf2ed09cc812c795b19927c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197610
    Tested-by: Andras Timar <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/editeng/source/outliner/outlin2.cxx 
b/editeng/source/outliner/outlin2.cxx
index a0e384d1388f..5107b4b0d362 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -479,15 +479,6 @@ const ScalingParameters & Outliner::getScalingParameters() 
const
 
 void Outliner::setScalingParameters(ScalingParameters const& 
rScalingParameters)
 {
-    // reset bullet size
-    sal_Int32 nParagraphs = pParaList->GetParagraphCount();
-    for ( sal_Int32 nPara = 0; nPara < nParagraphs; nPara++ )
-    {
-        Paragraph* pPara = pParaList->GetParagraph( nPara );
-        if ( pPara )
-            pPara->aBulSize.setWidth( -1 );
-    }
-
     pEditEngine->setScalingParameters(rScalingParameters);
 }
 
diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 4ff4c5a46751..0531f11035de 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -26,6 +26,7 @@
 #include <editeng/lrspitem.hxx>
 
 #include <math.h>
+#include <rtl/math.hxx>
 #include <svl/style.hxx>
 #include <editeng/outliner.hxx>
 #include "paralist.hxx"
@@ -677,7 +678,7 @@ void Outliner::ImplCheckNumBulletItem( sal_Int32 nPara )
 {
     Paragraph* pPara = pParaList->GetParagraph( nPara );
     if (pPara)
-        pPara->aBulSize.setWidth( -1 );
+        pPara->Invalidate();
 }
 
 void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
@@ -1015,14 +1016,14 @@ void Outliner::PaintBullet(sal_Int32 nPara, const 
Point& rStartPos, const Point&
                         DrawBulletInfo aDrawBulletInfo(
                             *pFmt->GetBrush()->GetGraphicObject(),
                             aBulletPos,
-                            pPara->aBulSize);
+                            pPara->GetBulletSize());
 
                         aDrawBulletHdl.Call(&aDrawBulletInfo);
                     }
                 }
                 else
                 {
-                    pFmt->GetBrush()->GetGraphicObject()->Draw(rOutDev, 
aBulletPos, pPara->aBulSize);
+                    pFmt->GetBrush()->GetGraphicObject()->Draw(rOutDev, 
aBulletPos, pPara->GetBulletSize());
                 }
             }
         }
@@ -1377,14 +1378,16 @@ Size Outliner::ImplGetBulletSize( sal_Int32 nPara )
     if (!pPara)
         return Size();
 
-    if( pPara->aBulSize.Width() == -1 )
+    auto aScalingParameters = getScalingParameters();
+    Size aSize;
+
+    if (pPara->IsBulletInvalid(aScalingParameters))
     {
         const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
         assert(pFmt && "ImplGetBulletSize - no Bullet!");
-
         if ( pFmt->GetNumberingType() == SVX_NUM_NUMBER_NONE )
         {
-            pPara->aBulSize = Size( 0, 0 );
+            aSize = Size(0, 0);
         }
         else if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
         {
@@ -1393,19 +1396,22 @@ Size Outliner::ImplGetBulletSize( sal_Int32 nPara )
             vcl::Font aBulletFont( ImpCalcBulletFont( nPara ) );
             vcl::Font aRefFont( pRefDev->GetFont());
             pRefDev->SetFont( aBulletFont );
-            pPara->aBulSize.setWidth( pRefDev->GetTextWidth( aBulletText ) );
-            pPara->aBulSize.setHeight( pRefDev->GetTextHeight() );
+            tools::Long x = pRefDev->GetTextWidth(aBulletText);
+            tools::Long y = pRefDev->GetTextHeight();
+            aSize = Size(x, y);
             pRefDev->SetFont( aRefFont );
         }
         else
         {
-            pPara->aBulSize = 
OutputDevice::LogicToLogic(pFmt->GetGraphicSize(),
+            aSize = OutputDevice::LogicToLogic(pFmt->GetGraphicSize(),
                     MapMode(MapUnit::Map100thMM),
                     pEditEngine->GetRefDevice()->GetMapMode());
         }
+
+        pPara->SetBulletSize(aSize, aScalingParameters);
     }
 
-    return pPara->aBulSize;
+    return pPara->GetBulletSize();
 }
 
 void Outliner::ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd )
@@ -1864,7 +1870,7 @@ void Outliner::SetFlatMode( bool bFlat )
     if( bFlat != pEditEngine->IsFlatMode() )
     {
         for ( sal_Int32 nPara = pParaList->GetParagraphCount(); nPara; )
-            pParaList->GetParagraph( --nPara )->aBulSize.setWidth( -1 );
+            pParaList->GetParagraph( --nPara )->Invalidate();
 
         pEditEngine->SetFlatMode( bFlat );
     }
diff --git a/editeng/source/outliner/paralist.cxx 
b/editeng/source/outliner/paralist.cxx
index d25a00b18207..d46fc8cf7d48 100644
--- a/editeng/source/outliner/paralist.cxx
+++ b/editeng/source/outliner/paralist.cxx
@@ -43,30 +43,18 @@ bool ParagraphData::operator==(const ParagraphData& 
rCandidate) const
 }
 
 Paragraph::Paragraph( sal_Int16 nDDepth )
-: aBulSize( -1, -1)
 {
-
     DBG_ASSERT(  ( nDDepth >= -1 ) && ( nDDepth < SVX_MAX_NUM ), 
"Paragraph-CTOR: nDepth invalid!" );
-
     nDepth = nDDepth;
-    nFlags = ParaFlag::NONE;
-    bVisible = true;
 }
 
 Paragraph::Paragraph( const ParagraphData& rData )
-: aBulSize( -1, -1)
-, nFlags( ParaFlag::NONE )
-, bVisible( true )
 {
     nDepth = rData.nDepth;
     mnNumberingStartValue = rData.mnNumberingStartValue;
     mbParaIsNumberingRestart = rData.mbParaIsNumberingRestart;
 }
 
-Paragraph::~Paragraph()
-{
-}
-
 void Paragraph::SetNumberingStartValue( sal_Int16 nNumberingStartValue )
 {
     mnNumberingStartValue = nNumberingStartValue;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 6dc9a02a3d97..19c94012fa11 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -116,6 +116,15 @@ namespace o3tl
 #define OLUNDO_INSERT           EDITUNDO_USER+6
 // #define OLUNDO_MOVEPARAGRAPHS    EDITUNDO_USER+7
 
+/** Information about the bullet in the paragraph*/
+struct BulletInfo
+{
+public:
+    OUString maText;
+    Size maSize = Size(-1, -1);
+    ScalingParameters maScalingParameters;
+};
+
 class Paragraph : protected ParagraphData
 {
 private:
@@ -129,17 +138,61 @@ private:
 
     Paragraph& operator=(const Paragraph& rPara ) = delete;
 
-    OUString            aBulText;
-    Size                aBulSize;
-    ParaFlag            nFlags;
-    bool                bVisible;
+    BulletInfo maBullet;
+    ParaFlag nFlags = ParaFlag::NONE;
+    bool bVisible = true;
 
     bool                IsVisible() const { return bVisible; }
-    void                SetText( const OUString& rText ) { aBulText = rText; 
aBulSize.setWidth(-1); }
-    void                Invalidate() { aBulSize.setWidth(-1); }
-    void                SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; 
aBulSize.setWidth(-1); }
-    const OUString&     GetText() const { return aBulText; }
 
+    void SetText(const OUString& rText)
+    {
+        maBullet.maText = rText;
+        Invalidate();
+    }
+
+    /// Sets the bullet size as well as the scaling parameters used to 
calculate the size
+    void SetBulletSize(Size const& rSize, ScalingParameters const& 
rScalingParameters)
+    {
+        maBullet.maSize = rSize;
+        maBullet.maScalingParameters = rScalingParameters;
+    }
+
+    /// Current size of the bullet
+    Size const& GetBulletSize()
+    {
+        return maBullet.maSize;
+    }
+
+    /// Is the bullet size invalid for the current scaling parameters
+    bool IsBulletInvalid(ScalingParameters const& rCurrentScalingParameters)
+    {
+        return rCurrentScalingParameters != maBullet.maScalingParameters
+            || maBullet.maSize.Width() == -1
+            || maBullet.maSize.Height() == -1;
+    }
+
+    /// Invalidate paragraph calculated information: bullet size
+    void Invalidate()
+    {
+        maBullet.maSize.setWidth(-1);
+        maBullet.maSize.setHeight(-1);
+    }
+
+    void SetDepth(sal_Int16 nNewDepth)
+    {
+        nDepth = nNewDepth;
+        Invalidate();
+    }
+
+    const OUString& GetText() const
+    {
+        return maBullet.maText;
+    }
+
+    BulletInfo const& GetBullet()
+    {
+        return maBullet;
+    }
                         Paragraph( sal_Int16 nDepth );
                         Paragraph( const Paragraph& ) = delete;
                         Paragraph( const ParagraphData& );
@@ -155,9 +208,9 @@ private:
     void                SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
     void                RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
     bool                HasFlag( ParaFlag nFlag ) const { return bool(nFlags & 
nFlag); }
+
 public:
-                        ~Paragraph();
-    void                dumpAsXml(xmlTextWriterPtr pWriter) const;
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 struct ParaRange

Reply via email to