editeng/Library_editeng.mk          |    1 
 editeng/inc/EditLine.hxx            |    4 +
 editeng/inc/EditLineList.hxx        |   45 ++++++++++++++++++
 editeng/inc/editdoc.hxx             |   23 ---------
 editeng/source/editeng/EditLine.cxx |   90 ++++++++++++++++++++++++++++++++++++
 editeng/source/editeng/editdoc.cxx  |   66 --------------------------
 solenv/clang-format/excludelist     |    1 
 7 files changed, 142 insertions(+), 88 deletions(-)

New commits:
commit 4acb0979b10bf35cf929078e53ccccea249e1416
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sun Dec 24 23:55:58 2023 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat Dec 30 14:17:08 2023 +0100

    editeng: move EditLineList to its own header file
    
    Change-Id: Ic19aa0826050a768e9976d8d3db9eadb108607f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161360
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/editeng/inc/EditLineList.hxx b/editeng/inc/EditLineList.hxx
new file mode 100644
index 000000000000..2b3874913cad
--- /dev/null
+++ b/editeng/inc/EditLineList.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 <vector>
+#include <sal/types.h>
+
+class EditLineList
+{
+    typedef std::vector<std::unique_ptr<EditLine>> LinesType;
+    LinesType maLines;
+
+public:
+    EditLineList();
+    ~EditLineList();
+
+    void Reset();
+    void DeleteFromLine(sal_Int32 nDelFrom);
+    sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd);
+    sal_Int32 Count() const;
+    const EditLine& operator[](sal_Int32 nPos) const;
+    EditLine& operator[](sal_Int32 nPos);
+
+    void Append(EditLine* p);
+    void Insert(sal_Int32 nPos, EditLine* p);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index c53abc62949c..3db8a8a64a63 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -34,6 +34,7 @@
 #include "ItemList.hxx"
 #include "ContentNode.hxx"
 #include "EditLine.hxx"
+#include "EditLineList.hxx"
 
 #include <cstddef>
 #include <memory>
@@ -159,28 +160,6 @@ public:
     sal_Int32 GetPos(const TextPortion* p) const;
 };
 
-class EditLineList
-{
-    typedef std::vector<std::unique_ptr<EditLine> > LinesType;
-    LinesType maLines;
-
-public:
-            EditLineList();
-            ~EditLineList();
-
-    void Reset();
-    void DeleteFromLine(sal_Int32 nDelFrom);
-    sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd);
-    sal_Int32 Count() const;
-    const EditLine& operator[](sal_Int32 nPos) const;
-    EditLine& operator[](sal_Int32 nPos);
-
-    void Append(EditLine* p);
-    void Insert(sal_Int32 nPos, EditLine* p);
-};
-
-
-
 class ParaPortion
 {
     friend class ImpEditEngine; // to adjust the height
commit 9a62dcf59af3513a82fb5640314021d064d8b9b7
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sun Dec 24 22:45:54 2023 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat Dec 30 14:16:59 2023 +0100

    editeng: move impl. of EditLine methods to own cxx sourcefile
    
    Change-Id: I9856302967de59368dc60b3e01f4a36fdb97e00e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161359
    Tested-by: Tomaž Vajngerl <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index e0834b96f983..49225b910d14 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
     editeng/source/editeng/editdbg \
     editeng/source/editeng/editdoc \
     editeng/source/editeng/editeng \
+    editeng/source/editeng/EditLine \
     editeng/source/editeng/editobj \
     editeng/source/editeng/editsel \
     editeng/source/editeng/editundo \
diff --git a/editeng/inc/EditLine.hxx b/editeng/inc/EditLine.hxx
index df1dec9f0ae2..165f3fcf0a59 100644
--- a/editeng/inc/EditLine.hxx
+++ b/editeng/inc/EditLine.hxx
@@ -19,6 +19,10 @@
 
 #pragma once
 
+#include <vector>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
 class ParaPortion;
 
 class EditLine
diff --git a/editeng/source/editeng/EditLine.cxx 
b/editeng/source/editeng/EditLine.cxx
new file mode 100644
index 000000000000..7724f8f12a79
--- /dev/null
+++ b/editeng/source/editeng/EditLine.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 <EditLine.hxx>
+#include <editdoc.hxx>
+
+EditLine* EditLine::Clone() const
+{
+    EditLine* pL = new EditLine;
+    pL->aPositions = aPositions;
+    pL->nStartPosX      = nStartPosX;
+    pL->nStart          = nStart;
+    pL->nEnd            = nEnd;
+    pL->nStartPortion   = nStartPortion;
+    pL->nEndPortion     = nEndPortion;
+    pL->nHeight         = nHeight;
+    pL->nTxtWidth       = nTxtWidth;
+    pL->nTxtHeight      = nTxtHeight;
+    pL->nMaxAscent      = nMaxAscent;
+
+    return pL;
+}
+
+Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
+{
+    Size aSz;
+    Size aTmpSz;
+
+    DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before 
CreatePortions !" );
+
+    for ( sal_Int32 n = nStartPortion; n <= nEndPortion; n++ )
+    {
+        TextPortion& rPortion = rParaPortion.GetTextPortions()[n];
+        switch ( rPortion.GetKind() )
+        {
+            case PortionKind::TEXT:
+            case PortionKind::FIELD:
+            case PortionKind::HYPHENATOR:
+            {
+                aTmpSz = rPortion.GetSize();
+                aSz.AdjustWidth(aTmpSz.Width() );
+                if ( aSz.Height() < aTmpSz.Height() )
+                    aSz.setHeight( aTmpSz.Height() );
+            }
+            break;
+            case PortionKind::TAB:
+            {
+                aSz.AdjustWidth(rPortion.GetSize().Width() );
+            }
+            break;
+            case PortionKind::LINEBREAK: break;
+        }
+    }
+
+    SetHeight( static_cast<sal_uInt16>(aSz.Height()) );
+    return aSz;
+}
+
+void EditLine::SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH )
+{
+    nHeight = nH;
+    nTxtHeight = ( nTxtH ? nTxtH : nH );
+}
+
+void EditLine::SetStartPosX( sal_Int32 start )
+{
+    if (start > 0)
+        nStartPosX = start;
+    else
+        nStartPosX = 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 313648d24277..e37bc47a7fa3 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -890,72 +890,6 @@ void ConvertAndPutItems( SfxItemSet& rDest, const 
SfxItemSet& rSource, const Map
     }
 }
 
-EditLine* EditLine::Clone() const
-{
-    EditLine* pL = new EditLine;
-    pL->aPositions = aPositions;
-    pL->nStartPosX      = nStartPosX;
-    pL->nStart          = nStart;
-    pL->nEnd            = nEnd;
-    pL->nStartPortion   = nStartPortion;
-    pL->nEndPortion     = nEndPortion;
-    pL->nHeight         = nHeight;
-    pL->nTxtWidth       = nTxtWidth;
-    pL->nTxtHeight      = nTxtHeight;
-    pL->nMaxAscent      = nMaxAscent;
-
-    return pL;
-}
-
-void EditLine::SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH )
-{
-    nHeight = nH;
-    nTxtHeight = ( nTxtH ? nTxtH : nH );
-}
-
-void EditLine::SetStartPosX( sal_Int32 start )
-{
-    if (start > 0)
-        nStartPosX = start;
-    else
-        nStartPosX = 0;
-}
-
-Size EditLine::CalcTextSize( ParaPortion& rParaPortion )
-{
-    Size aSz;
-    Size aTmpSz;
-
-    DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before 
CreatePortions !" );
-
-    for ( sal_Int32 n = nStartPortion; n <= nEndPortion; n++ )
-    {
-        TextPortion& rPortion = rParaPortion.GetTextPortions()[n];
-        switch ( rPortion.GetKind() )
-        {
-            case PortionKind::TEXT:
-            case PortionKind::FIELD:
-            case PortionKind::HYPHENATOR:
-            {
-                aTmpSz = rPortion.GetSize();
-                aSz.AdjustWidth(aTmpSz.Width() );
-                if ( aSz.Height() < aTmpSz.Height() )
-                    aSz.setHeight( aTmpSz.Height() );
-            }
-            break;
-            case PortionKind::TAB:
-            {
-                aSz.AdjustWidth(rPortion.GetSize().Width() );
-            }
-            break;
-            case PortionKind::LINEBREAK: break;
-        }
-    }
-
-    SetHeight( static_cast<sal_uInt16>(aSz.Height()) );
-    return aSz;
-}
-
 EditLineList::EditLineList()
 {
 }
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 045161b84bd1..9b416bc3e0ce 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3387,6 +3387,7 @@ editeng/source/accessibility/AccessibleSelectionBase.cxx
 editeng/source/accessibility/AccessibleStaticTextBase.cxx
 editeng/source/accessibility/AccessibleStringWrap.cxx
 editeng/source/editeng/ContentNode.cxx
+editeng/source/editeng/EditLine.cxx
 editeng/source/editeng/editattr.cxx
 editeng/source/editeng/editdbg.cxx
 editeng/source/editeng/editdoc.cxx

Reply via email to