[Libreoffice-commits] core.git: sw/inc

2023-12-04 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtrfmrk.hxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 9c02160fc55bccc43d92c68ec5166a79d50e1528
Author: Miklos Vajna 
AuthorDate: Mon Dec 4 20:05:57 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 5 08:31:19 2023 +0100

sw: document SwFormatRefMark

Explain where this can appear, who owns it and where it can be found on
the UI.

Change-Id: I4096bc51ef03e50c65261e7356a4e593d1ba4c48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160323
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx
index 8f708cf583ea..b41449fa97af 100644
--- a/sw/inc/fmtrfmrk.hxx
+++ b/sw/inc/fmtrfmrk.hxx
@@ -30,8 +30,13 @@
 class SwTextRefMark;
 class SwXReferenceMark;
 
-// ATT_REFMARK
-
+/// SfxPoolItem subclass that represents a reference mark (a position in the 
document with a name,
+/// which has a start and may or may not have an end).
+///
+/// This can be used as a character format in the hints array of a text node, 
it's owned by an
+/// SwTextRefMark.
+///
+/// It's Insert -> Cross-reference -> Cross-references -> set reference on the 
UI.
 class SAL_DLLPUBLIC_RTTI SwFormatRefMark final
 : public SfxPoolItem
 , public sw::BroadcastingModify


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-11-30 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/pagedesc.hxx   |2 -
 sw/qa/core/header_footer/HeaderFooterTest.cxx |   40 ++
 sw/source/core/doc/docfmt.cxx |   33 -
 sw/source/core/layout/pagedesc.cxx|2 -
 4 files changed, 73 insertions(+), 4 deletions(-)

New commits:
commit 963de9feb37105560fde14b44d992e47f341bb5b
Author: Tomaž Vajngerl 
AuthorDate: Thu Nov 30 16:42:26 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 1 05:07:42 2023 +0100

sw: fix issue with copying stashed frame format

When the PageDesc is copied from one document to another, we
don't make sure the stashed FrameFormat(s) are also properly
copied to the new document (which can happen at copy/paste). This
can cause a crash if the stashed FrameFormats are accessed or
destructed after the original document is destroyed.

This fixes the issue so that when we detect the PageDesc belong
to different documents, the stashed FrameFormats are copied just
like the non-stashed FrameFormats (used for headers and footers).

Change-Id: I948068dba4d39bb47c3725dfa8491c53c5833c7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160065
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 382bbb5f00cd..11bb347aa1fb 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -223,7 +223,7 @@ public:
 const SwFrameFormat* GetStashedFrameFormat(bool bHeader, bool bLeft, bool 
bFirst) const;
 
 /// Checks if the pagedescriptor has a stashed format according to the 
parameters or not.
-bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst);
+bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) const;
 
 /// Gives the feature of removing the stashed format by hand if it is 
necessary.
 void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst);
diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index 8b78363a0c1b..b411632884e1 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -48,6 +48,46 @@ public:
 }
 };
 
+CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testStashedHeaderFooter)
+{
+createSwDoc();
+SwDoc* pSourceDocument = getSwDoc();
+uno::Reference xSourceDocument = mxComponent;
+mxComponent.clear();
+
+createSwDoc();
+SwDoc* pTargetDocument = getSwDoc();
+uno::Reference xTargetDocument = mxComponent;
+mxComponent.clear();
+
+// Source
+SwPageDesc* pSourcePageDesc = pSourceDocument->MakePageDesc("SourceStyle");
+pSourcePageDesc->ChgFirstShare(false);
+CPPUNIT_ASSERT(!pSourcePageDesc->IsFirstShared());
+pSourcePageDesc->StashFrameFormat(pSourcePageDesc->GetFirstMaster(), true, 
false, true);
+pSourceDocument->ChgPageDesc("SourceStyle", *pSourcePageDesc);
+CPPUNIT_ASSERT(pSourcePageDesc->HasStashedFormat(true, false, true));
+
+// Target
+SwPageDesc* pTargetPageDesc = pTargetDocument->MakePageDesc("TargetStyle");
+
+// Copy source to target
+pTargetDocument->CopyPageDesc(*pSourcePageDesc, *pTargetPageDesc);
+
+// Check the stashed frame format is copied
+CPPUNIT_ASSERT(pTargetPageDesc->HasStashedFormat(true, false, true));
+
+// Check document instance
+auto pSourceStashedFormat = pSourcePageDesc->GetStashedFrameFormat(true, 
false, true);
+CPPUNIT_ASSERT_EQUAL(true, pSourceStashedFormat->GetDoc() == 
pSourceDocument);
+
+auto pTargetStashedFormat = pTargetPageDesc->GetStashedFrameFormat(true, 
false, true);
+CPPUNIT_ASSERT_EQUAL(true, pTargetStashedFormat->GetDoc() == 
pTargetDocument);
+
+xSourceDocument->dispose();
+xTargetDocument->dispose();
+}
+
 CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testNonFirstHeaderIsDisabled)
 {
 // related to tdf#127778
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d5854b3633e6..57c42c529eb1 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1540,14 +1540,43 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, 
SwPageDesc& rDstDesc,
 
 // Copy the stashed formats as well between the page descriptors...
 for (bool bFirst : { true, false })
+{
 for (bool bLeft : { true, false })
+{
 for (bool bHeader : { true, false })
 {
 if (!bLeft && !bFirst)
 continue;
-if (auto pStashedFormat = 
rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst))
-rDstDesc.StashFrameFormat(*pStashedFormat, bHeader, bLeft, 
bFirst);
+
+// Copy format only if it exists
+if (auto pStashedFormatSrc = 
rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst))
+{
+if (pStashedFormatSrc->GetDoc() != this)
+{
+ 

[Libreoffice-commits] core.git: sw/inc

2023-11-27 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtruby.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 5beec1db91b590ebb8e043dfabeaba553c586fad
Author: Miklos Vajna 
AuthorDate: Mon Nov 27 20:27:25 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 28 08:25:51 2023 +0100

sw: document SwFormatRuby

Who owns it, where is the UI, which contain can have this.

Change-Id: I78bf968f2f887131fe49e5ca56b9a86a2539adc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160004
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx
index 08f150f09954..e0e756b1db7a 100644
--- a/sw/inc/fmtruby.hxx
+++ b/sw/inc/fmtruby.hxx
@@ -25,6 +25,8 @@
 
 class SwTextRuby;
 
+/// SfxPoolItem subclass that is owned by an SwTextRuby and contains info 
entered in Format -> Asian
+/// Phonetic Guide. This is a character property, i.e. appears in the SwpHints 
of an SwTextNode.
 class SW_DLLPUBLIC SwFormatRuby final : public SfxPoolItem
 {
 friend class SwTextRuby;


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-25 Thread Noel Grandin (via logerrit)
 sw/inc/IDocumentFieldsAccess.hxx |5 
 sw/inc/calc.hxx  |   61 ---
 sw/source/core/bastyp/calc.cxx   |  226 +++
 sw/source/core/doc/DocumentFieldsManager.cxx |   73 ++--
 sw/source/core/doc/docfld.cxx|   48 +
 sw/source/core/edit/editsh.cxx   |2 
 sw/source/core/fields/expfld.cxx |2 
 sw/source/core/inc/DocumentFieldsManager.hxx |2 
 sw/source/core/inc/docfld.hxx|   29 +--
 9 files changed, 114 insertions(+), 334 deletions(-)

New commits:
commit 947b23c20780ede6b4d588fb9b944f572e9f8bc8
Author: Noel Grandin 
AuthorDate: Sat Nov 25 00:53:37 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 25 11:25:25 2023 +0100

Convert SwHashTable to std::unordered_map

Change-Id: I88b082dc61c05761fd162ea4cf1d30940c2dfccd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159941
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index 4664ae3bc846..4ffe7779833f 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -25,6 +25,7 @@
 #include 
 #include "swtypes.hxx"
 #include "nodeoffset.hxx"
+#include 
 
 class SwFieldTypes;
 class SwFieldType;
@@ -40,8 +41,6 @@ class SetGetExpField;
 class SwNode;
 class SwTable;
 enum class SwFieldIds : sal_uInt16;
-template  class SwHashTable;
-struct HashStr;
 class SwRootFrame;
 class IDocumentRedlineAccess;
 
@@ -128,7 +127,7 @@ namespace com::sun::star::uno { class Any; }
 
 virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& 
rToThisField, SwRootFrame const* pLayout) = 0;
 
-virtual void FieldsToExpand(SwHashTable & rTable, const 
SetGetExpField& rToThisField, SwRootFrame const& rLayout) = 0;
+virtual void FieldsToExpand(std::unordered_map & 
rTable, const SetGetExpField& rToThisField, SwRootFrame const& rLayout) = 0;
 
 virtual bool IsNewFieldLst() const = 0;
 
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 87583f752ff4..0e066bae145f 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,8 +38,6 @@ class SwFieldType;
 class SwDoc;
 class SwUserFieldType;
 
-#define TBLSZ 47// should be a prime, because of hash table
-
 const sal_Unicode cListDelim= '|';
 
 enum SwCalcOper
@@ -131,62 +130,12 @@ public:
 void SetDBvalue(bool bSet) {m_bDBvalue = bSet;}
 };
 
-// Calculate HashTables for VarTable and Operations
-struct SwHash
-{
-SwHash( OUString aStr );
-virtual ~SwHash();
-OUString aStr;
-std::unique_ptr pNext;
-};
-
-struct SwCalcExp final : public SwHash
+struct SwCalcExp
 {
 SwSbxValue  nValue;
 const SwFieldType* pFieldType;
 
-SwCalcExp( const OUString& rStr, SwSbxValue aVal,
-const SwFieldType* pFieldType );
-};
-
-/// T should be a subclass of SwHash
-template
-class SwHashTable
-{
-std::vector> m_aData;
-public:
-SwHashTable(size_t nSize) : m_aData(nSize)
-{
-assert(nSize < SAL_MAX_UINT32);
-}
-std::unique_ptr & operator[](size_t idx) { return m_aData[idx]; }
-std::unique_ptr const & operator[](size_t idx) const { return 
m_aData[idx]; }
-void resize(size_t nSize) { m_aData.resize(nSize); }
-
-T* Find( std::u16string_view aStr, sal_uInt32* pPos = nullptr ) const
-{
-size_t nTableSize = m_aData.size();
-assert(nTableSize < SAL_MAX_UINT32);
-sal_uInt32 ii = 0;
-for( size_t n = 0; n < aStr.size(); ++n )
-{
-ii = ii << 1 ^ aStr[n];
-}
-ii %= nTableSize;
-
-if( pPos )
-*pPos = ii;
-
-for( T* pEntry = m_aData[ii].get(); pEntry; pEntry = 
static_cast(pEntry->pNext.get()) )
-{
-if( aStr == pEntry->aStr )
-{
-return pEntry;
-}
-}
-return nullptr;
-}
-
+SwCalcExp( SwSbxValue aVal, const SwFieldType* pFieldType );
 };
 
 
@@ -198,7 +147,7 @@ extern "C" typedef double (*pfCalc)(double);
 
 class SwCalc
 {
-SwHashTable m_aVarTable;
+std::unordered_map m_aVarTable;
 OUStringBuffer m_aVarName;
 OUStringm_sCurrSym;
 OUStringm_sCommand;
@@ -245,7 +194,7 @@ public:
 SwCalcExp*  VarLook( const OUString , bool bIns = false );
 voidVarChange( const OUString& rStr, const SwSbxValue& rValue );
 voidVarChange( const OUString& rStr, double );
-SwHashTable & GetVarTable() { return m_aVarTable; }
+std::unordered_map & GetVarTable() { return 
m_aVarTable; }
 
 boolPush(const SwUserFieldType* pUserFieldType);
 voidPop();
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 62d300f60ba7..0c9643317a4e 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-11-23 Thread Xisco Fauli (via logerrit)
 sw/inc/cellatr.hxx   |1 +
 sw/qa/extras/uiwriter/data/tdf157132.odt |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx  |   17 -
 sw/source/core/attr/cellatr.cxx  |   12 
 sw/source/core/table/swtable.cxx |2 +-
 5 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 32ce5fe4ed19a79b6f15a5d4d1892e6cc8d778d9
Author: Xisco Fauli 
AuthorDate: Thu Nov 23 17:06:51 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Nov 23 18:21:20 2023 +0100

tdf#158336: Only Change current table

For that, use the same logic as TryBoxNmToPtr

Regression from 0c008ab081aa5bbf53f8562e95e547deae5afc2e
"tdf#157132: restore behaviour for TBL_RELBOXNAME"

Change-Id: I8f93ad3a9686001fd6bd7226400925e43b81ec23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159865
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index 2c00b5321190..54ddf2caa5ba 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -75,6 +75,7 @@ public:
 { return const_cast(this)->GetTableBox(); }
 
 void TryBoxNmToPtr();
+void TryRelBoxNm();
 void ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& rUpdate, 
SwHistory* pHistory);
 void ChangeState()
 {
diff --git a/sw/qa/extras/uiwriter/data/tdf157132.odt 
b/sw/qa/extras/uiwriter/data/tdf157132.odt
index ddb9522bf835..3cfbec4d756b 100644
Binary files a/sw/qa/extras/uiwriter/data/tdf157132.odt and 
b/sw/qa/extras/uiwriter/data/tdf157132.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 41be9a196dfb..0fbb8e9fae81 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -1517,7 +1517,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157132)
 uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
 uno::UNO_QUERY);
 
-CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
 
 uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
 
@@ -1533,6 +1533,21 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157132)
 CPPUNIT_ASSERT_EQUAL(OUString("6"), xCellA4->getString());
 uno::Reference xCellA5(xTextTable->getCellByName("A5"), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("7"), xCellA5->getString());
+
+xTextTable.set(xTables->getByIndex(1), uno::UNO_QUERY);
+
+xCellA2.set(xTextTable->getCellByName("A2"), uno::UNO_QUERY);
+
+// tdf#158336: Without the fix in place, this test would have failed with
+// - Expected: 2
+// - Actual  : ** Expression is faulty **
+CPPUNIT_ASSERT_EQUAL(OUString("2"), xCellA2->getString());
+xCellA3.set(xTextTable->getCellByName("A3"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xCellA3->getString());
+xCellA4.set(xTextTable->getCellByName("A4"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("6"), xCellA4->getString());
+xCellA5.set(xTextTable->getCellByName("A5"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("7"), xCellA5->getString());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147938)
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 9023cca2f793..19e7b2f39d53 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -104,6 +104,18 @@ void SwTableBoxFormula::TryBoxNmToPtr()
 BoxNmToPtr(>GetTable());
 }
 }
+
+void SwTableBoxFormula::TryRelBoxNm()
+{
+const SwNode* pNd = GetNodeOfFormula();
+if (!pNd || >GetNodes() != >GetDoc().GetNodes())
+return;
+if(const SwTableNode* pTableNd = pNd->FindTableNode())
+{
+ToRelBoxNm(>GetTable());
+}
+}
+
 void SwTableBoxFormula::ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& 
rUpdate, SwHistory* pHistory)
 {
 if(!pHistory)
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 8b8f449c7df9..cfa9f52a206c 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1728,7 +1728,7 @@ void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags)
 if(eFlags == TBL_BOXPTR)
 pBoxFormula->TryBoxNmToPtr();
 else if(eFlags == TBL_RELBOXNAME)
-pBoxFormula->ToRelBoxNm(this);
+pBoxFormula->TryRelBoxNm();
 else
 pBoxFormula->ChangeState();
 }


[Libreoffice-commits] core.git: sw/inc sw/Library_sw.mk sw/qa sw/source

2023-11-23 Thread Miklos Vajna (via logerrit)
 sw/Library_sw.mk |1 
 sw/inc/format.hxx|1 
 sw/inc/formatwraptextatflystart.hxx  |   50 +++
 sw/inc/hintids.hxx   |   31 +++---
 sw/inc/swatrset.hxx  |2 
 sw/qa/core/attr/attr.cxx |   21 +
 sw/source/core/attr/formatwraptextatflystart.cxx |   46 +
 sw/source/core/bastyp/init.cxx   |5 +-
 8 files changed, 140 insertions(+), 17 deletions(-)

New commits:
commit b1b0cc1b0bb473155b5b089199ca99bb1dc40e42
Author: Miklos Vajna 
AuthorDate: Thu Nov 23 08:38:19 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 23 09:54:27 2023 +0100

sw floattable: add per-frame wrap-on-all-pages mode

Currently the wrap-on-all pages mode is off by default and a
document-level setting can enable it for all split flys.

Allowing this at a per-frame level (and not only per-doc level) is
suggested in . Given
that this floating table proposal is coming from us, it makes sense to
also support this additional attribute from the proposal, even if it's
not supported by Word.

Fix this by adding a new SwFormatWrapTextAtFlyStart property on fly
frames: this is meant to be enabled when wrap-on-all-pages is wanted for
this fly, but it's disabled at a per-doc level.

Unlike SwFormatFlySplit, this is meant to be easy at a layout level,
since SwFlyAtContentFrame::IsWrapOnAllPages() is already a per-frame
function, it is just backed with a per-doc setting.

Change-Id: I8f562102c2bc366a36c08895b681c4a2ab256bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159847
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index f49117e58f86..bd5d831f7f2f 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -140,6 +140,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/attr/fmtwrapinfluenceonobjpos \
 sw/source/core/attr/format \
 sw/source/core/attr/formatflysplit \
+sw/source/core/attr/formatwraptextatflystart \
 sw/source/core/attr/hints \
 sw/source/core/attr/swatrset \
 sw/source/core/bastyp/SwSmartTagMgr \
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index f420afcf512e..8ded8c6f61f3 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -240,6 +240,7 @@ public:
 inline const SwFormatLayoutSplit ( bool = true ) const;
 inline const SwFormatRowSplit  ( bool = true ) const;
 inline const SwFormatFlySplit  ( bool = true ) const;
+inline const SwFormatWrapTextAtFlyStart ( bool = 
true ) const;
 inline const SwFormatChain   ( bool = true ) const;
 inline const SwFormatFootnoteAtTextEnd ( bool = 
true ) const;
 inline const SwFormatEndAtTextEnd ( bool = true ) 
const;
diff --git a/sw/inc/formatwraptextatflystart.hxx 
b/sw/inc/formatwraptextatflystart.hxx
new file mode 100644
index ..02305247df7c
--- /dev/null
+++ b/sw/inc/formatwraptextatflystart.hxx
@@ -0,0 +1,50 @@
+/* -*- 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 
+
+#include "swdllapi.h"
+#include "hintids.hxx"
+#include "format.hxx"
+
+/// Determines if text wraps around a split fly on all pages (i.e. wrap text 
at fly start) or only
+/// on the last page.
+class SW_DLLPUBLIC SwFormatWrapTextAtFlyStart final : public SfxBoolItem
+{
+public:
+SwFormatWrapTextAtFlyStart(bool bAtStart = false);
+
+SwFormatWrapTextAtFlyStart* Clone(SfxItemPool* pPool = nullptr) const 
override;
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline const SwFormatWrapTextAtFlyStart& SwAttrSet::GetWrapTextAtFlyStart(bool 
bInP) const
+{
+return Get(RES_WRAP_TEXT_AT_FLY_START, bInP);
+}
+
+inline const SwFormatWrapTextAtFlyStart& SwFormat::GetWrapTextAtFlyStart(bool 
bInP) const
+{
+return m_aSet.GetWrapTextAtFlyStart(bInP);
+}
+
+/* 

[Libreoffice-commits] core.git: sw/inc

2023-11-20 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtfsize.hxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit cbd16c4dc4cfb9155fd7f3899866e4f8156140a0
Author: Miklos Vajna 
AuthorDate: Mon Nov 20 20:08:17 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 21 08:25:13 2023 +0100

sw: document SwFormatFrameSize

Where this can appear, size type, percent relations.

Change-Id: I7afddd033e8a8842c99dcb3d9604a2cb75ad6d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159743
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx
index 9f8676c87dda..66aea1e78e50 100644
--- a/sw/inc/fmtfsize.hxx
+++ b/sw/inc/fmtfsize.hxx
@@ -40,6 +40,15 @@ enum class SwFrameSize
 (can be exceeded but not be less). */
 };
 
+/**
+ * Describes the size of a Writer frame, for example a table, table row, table 
cell, TextFrame,
+ * page, etc.
+ *
+ * The height and width can be either relative or absolute, see SwFrameSize.
+ *
+ * If the size is relative, then the "relation" decides what 100% means, e.g. 
it may be relative to
+ * the page size of the parent frame size.
+ */
 class SW_DLLPUBLIC SwFormatFrameSize final : public SvxSizeItem
 {
 SwFrameSize m_eFrameHeightType;


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-20 Thread Matt K (via logerrit)
 sw/inc/comcore.hxx  |4 +++-
 sw/inc/utlui.hrc|4 +++-
 sw/source/core/edit/autofmt.cxx |   40 
 3 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit 2fa88bfbfa4c9befe1be8a1953c018437a621254
Author: Matt K 
AuthorDate: Fri Jul 7 17:18:28 2023 -0500
Commit: Mike Kaganski 
CommitDate: Tue Nov 21 06:52:29 2023 +0100

tdf#117651 Add AutoCorrect support for italic and strikethrough

The AutoCorrect "Apply" command calls SwAutoFormat::AutoCorrect
in sw/source/core/edit/autofmt.cxx, as mentioned in the bug
comments.  This change just adds new cases for "/" (italic)
and "-" (strikethrough), so that when "Tools" -> "AutoCorrect"
->  "Apply" is invoked it changes any text between 2 "/"s or
2 "-"s (assuming your AutoCorrect options enable the setting
for this).  The new code is just mostly copied from the case
statement above it (for bold and underline), and the only
additional changes that were needed were to add the comment
strings for the 2 new cases.

Change-Id: I02238690a40fd0113e3e9acbecf93ef5c34e0785
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154207
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/comcore.hxx b/sw/inc/comcore.hxx
index 96a53fc84b2d..9da3d19e2aa0 100644
--- a/sw/inc/comcore.hxx
+++ b/sw/inc/comcore.hxx
@@ -45,8 +45,10 @@
 #define STR_AUTOFMTREDL_NON_BREAK_SPACE 21
 #define STR_AUTOFMTREDL_TRANSLITERATE_RTL   22
 #define STR_AUTOFMTREDL_DETECT_DOI  23
+#define STR_AUTOFMTREDL_ITALIC  24
+#define STR_AUTOFMTREDL_STRIKETHROUGH   25
 // !!  always set the correct end 
-#define STR_AUTOFMTREDL_END 24
+#define STR_AUTOFMTREDL_END 26
 
 #endif
 
diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc
index db13af5b517c..417123331e46 100644
--- a/sw/inc/utlui.hrc
+++ b/sw/inc/utlui.hrc
@@ -50,7 +50,9 @@ const TranslateId RID_SHELLRES_AUTOFMTSTRS[] =
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Add non breaking space"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Transliterates RTL Hungarian text to Old 
Hungarian script"),
-NC_("RID_SHELLRES_AUTOFMTSTRS", "DOI citation recognition")
+NC_("RID_SHELLRES_AUTOFMTSTRS", "DOI citation recognition"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic /italic/"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic -strikethrough-"),
 };
 
 #endif
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 555eec327a5d..65324e0eb296 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -282,6 +282,8 @@ void SwAutoFormat::SetRedlineText_( sal_uInt16 nActionId )
 case STR_AUTOFMTREDL_ORDINAL:
 case STR_AUTOFMTREDL_NON_BREAK_SPACE:
 case STR_AUTOFMTREDL_TRANSLITERATE_RTL:
+case STR_AUTOFMTREDL_ITALIC:
+case STR_AUTOFMTREDL_STRIKETHROUGH:
 nSeqNo = ++m_nRedlAutoFormatSeqId;
 break;
 }
@@ -2109,6 +2111,44 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos)
 SetRedlineText( STR_AUTOFMTREDL_NON_BREAK_SPACE );
 if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, 
sal_Int32(nPos), eLang, bNbspRunNext))
 --nPos;
+break;
+}
+[[fallthrough]];
+case '-':
+if (m_aFlags.bChgWeightUnderl)
+{
+// consider Symbolfonts!
+if (!aFInfo.GetFrame())
+aFInfo.SetFrame(GetFrame(*m_pCurTextNd));
+if (!aFInfo.IsBullet(nPos))
+{
+SetRedlineText('/' == cChar ? STR_AUTOFMTREDL_ITALIC : 
STR_AUTOFMTREDL_STRIKETHROUGH);
+
+sal_Unicode cBlank = nSttPos ? 
(*pText)[sal_Int32(nSttPos) - 1] : 0;
+*m_aDelPam.GetPoint() = 
m_pCurTextFrame->MapViewToModelPos(nPos);
+
+if (pATst->FnChgWeightUnderl(aACorrDoc, *pText, 
sal_Int32(nPos)))
+{
+if (m_aFlags.bWithRedlining)
+{
+m_aNdIdx = m_aDelPam.GetPoint()->GetNode();
+m_pCurTextNd = 
m_aNdIdx.GetNode().GetTextNode();
+m_pCurTextFrame = GetFrame(*m_pCurTextNd);
+pText = _pCurTextFrame->GetText();
+m_aDelPam.SetMark();
+m_aDelPam.DeleteMark();
+aFInfo.SetFrame(nullptr);
+}
+//#125102# in case of the mode 
RedlineFlags::ShowDelete the ** are still contained in pText
+

[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig

2023-11-20 Thread Balazs Varga (via logerrit)
 sw/inc/SwCapConfigProp.hxx   |   38 ++
 sw/source/ui/config/optload.cxx  |  503 ++-
 sw/source/uibase/inc/optload.hxx |   11 
 sw/uiconfig/swriter/ui/optcaptionpage.ui |  206 ++--
 4 files changed, 725 insertions(+), 33 deletions(-)

New commits:
commit 3e81415f7f71b7fe99342c82b3c54011fbcb2dbb
Author: Balazs Varga 
AuthorDate: Fri Nov 17 19:03:51 2023 +0100
Commit: Balazs Varga 
CommitDate: Mon Nov 20 12:55:55 2023 +0100

tdf#158136 - UI: Part 31 - Unify lockdown behavior of Options dialog

for Writer - AutoCaption Page.

Change-Id: Ia3c37510477542556c3302d2013fe10a4ae00545
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159594
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sw/inc/SwCapConfigProp.hxx b/sw/inc/SwCapConfigProp.hxx
new file mode 100644
index ..20257f3d9716
--- /dev/null
+++ b/sw/inc/SwCapConfigProp.hxx
@@ -0,0 +1,38 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX
+#define INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX
+
+enum CapConfigProp
+{
+PROP_CAP_OBJECT_ENABLE = 0, //0
+PROP_CAP_OBJECT_CATEGORY, //1
+PROP_CAP_OBJECT_NUMBERING, //2
+PROP_CAP_OBJECT_NUMBERINGSEPARATOR, //3
+PROP_CAP_OBJECT_CAPTIONTEXT, //4
+PROP_CAP_OBJECT_DELIMITER, //5
+PROP_CAP_OBJECT_LEVEL, //6
+PROP_CAP_OBJECT_POSITION, //7
+PROP_CAP_OBJECT_CHARACTERSTYLE, //8
+PROP_CAP_OBJECT_APPLYATTRIBUTES, //9
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 675a2d48e8d6..3adf4dce4e34 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -55,6 +55,436 @@
 
 using namespace ::com::sun::star;
 
+static bool lcl_isPropertyReadOnly(const SwCapObjType eType, const 
CapConfigProp ePropType, const SvGlobalName& rOleId)
+{
+bool bReadOnly = false;
+
+switch (ePropType)
+{
+case PROP_CAP_OBJECT_ENABLE:
+{
+switch (eType)
+{
+case TABLE_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Table::Enable::isReadOnly();
+break;
+case FRAME_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Frame::Enable::isReadOnly();
+break;
+case GRAPHIC_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Graphic::Enable::isReadOnly();
+break;
+case OLE_CAP:
+{
+if (rOleId == SvGlobalName(SO3_SC_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Calc::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SIMPRESS_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Impress::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SCH_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Chart::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SM_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Formula::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SDRAW_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Draw::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_OUT_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::OLEMisc::Enable::isReadOnly();
+} else {
+// Should not reach it.
+}
+}
+break;
+default:
+break;
+

[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-20 Thread Julien Nabet (via logerrit)
 sw/inc/doc.hxx|5 +
 sw/source/core/attr/calbck.cxx|7 +++
 sw/source/core/edit/edfcol.cxx|6 ++
 sw/source/core/inc/layfrm.hxx |5 +
 sw/source/core/txtnode/attrcontentcontrol.cxx |4 +---
 sw/source/core/txtnode/fmtatr2.cxx|5 +
 sw/source/core/unocore/unochart.cxx   |4 ++--
 sw/source/core/unocore/unoobj2.cxx|3 +--
 sw/source/core/view/viewsh.cxx|2 +-
 sw/source/filter/html/htmltab.cxx |2 +-
 sw/source/filter/ww8/writerwordglue.cxx   |3 +--
 sw/source/ui/dbui/mmaddressblockpage.cxx  |2 +-
 sw/source/ui/misc/bookmark.cxx|4 +---
 sw/source/uibase/docvw/PostItMgr.cxx  |2 +-
 sw/source/uibase/uiview/uivwimp.cxx   |4 ++--
 sw/source/uibase/uno/unodispatch.cxx  |7 +++
 sw/source/uibase/utlui/content.cxx|3 +--
 17 files changed, 24 insertions(+), 44 deletions(-)

New commits:
commit 950bee9154c9854364c72a3b48ddbc137803
Author: Julien Nabet 
AuthorDate: Sun Nov 19 21:29:12 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 20 12:06:28 2023 +0100

c++20: use std::erase(_if) instead of std::remove(_if)+erase (sw)

Change-Id: I67c231441b56f05da001beab5b893bc6a6a6a392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159704
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5d1814210801..ea95cef85636 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1675,10 +1675,7 @@ public:
 {
 auto & rTable = const_cast(this)->mvUnoCursorTable;
 // In most cases we'll remove most of the elements.
-rTable.erase( std::remove_if(rTable.begin(),
- rTable.end(),
- [] (std::weak_ptr const & x) 
{ return x.expired(); }),
-  rTable.end());
+std::erase_if(rTable, [] (std::weak_ptr const & x) { 
return x.expired(); });
 }
 
 /**
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 81a249203dc8..871dff43477b 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -284,13 +284,12 @@ bool sw::WriterMultiListener::IsListeningTo(const 
SwModify* const pBroadcaster)
 
 void sw::WriterMultiListener::EndListening(SwModify* pBroadcaster)
 {
-m_vDepends.erase(
-std::remove_if( m_vDepends.begin(), m_vDepends.end(),
+std::erase_if(
+m_vDepends,
 [](const ListenerEntry& aListener)
 {
 return aListener.GetRegisteredIn() == nullptr || 
aListener.GetRegisteredIn() == pBroadcaster;
-}),
-m_vDepends.end());
+});
 }
 
 void sw::WriterMultiListener::EndListeningAll()
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 2ce0caa01f91..f02273e07318 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1190,11 +1190,9 @@ static void lcl_ApplyParagraphClassification(SwDoc* pDoc,
 // need to insert in reverse order.
 std::reverse(aResults.begin(), aResults.end());
 // Ignore "PARAGRAPH" types
-aResults.erase(std::remove_if(aResults.begin(),
-  aResults.end(),
+std::erase_if(aResults,
   [](const svx::ClassificationResult& 
rResult)-> bool
-{ return rResult.meType == 
svx::ClassificationType::PARAGRAPH; }),
-  aResults.end());
+{ return rResult.meType == 
svx::ClassificationType::PARAGRAPH; });
 
 sfx::ClassificationKeyCreator 
aKeyCreator(SfxClassificationHelper::getPolicyType());
 std::vector aFieldNames;
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index 52e22829d4ad..981fbb34f649 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -178,10 +178,7 @@ public:
 
 void ClearVertPosOrientFrameFor(SwAnchoredObject *pObj)
 {
-m_VertPosOrientFramesFor.erase(
-std::remove(m_VertPosOrientFramesFor.begin(),
-m_VertPosOrientFramesFor.end(), pObj),
-m_VertPosOrientFramesFor.end());
+std::erase(m_VertPosOrientFramesFor, pObj);
 }
 void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
 };
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 1782f23fb526..c894615fa41d 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -830,9 +830,7 @@ void SwContentControlManager::Insert(SwTextContentControl* 
pTextContentControl)
 
 void SwContentControlManager::Erase(SwTextContentControl* 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-17 Thread Caolán McNamara (via logerrit)
 sw/inc/swurl.hxx |5 
 sw/source/uibase/shells/drwtxtex.cxx |2 -
 sw/source/uibase/wrtsh/wrtsh2.cxx|   39 +--
 3 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit 521ca9cf6acbae96cf95d9740859c9682212013d
Author: Caolán McNamara 
AuthorDate: Fri Nov 17 08:57:09 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 17 11:33:08 2023 +0100

we can have just one LoadURL for writer

Change-Id: Ia0162ee1c275292fcf200bad4662e4c2c6b7b972
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159557
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx
index ec88a639a4e9..87375f30c8b7 100644
--- a/sw/inc/swurl.hxx
+++ b/sw/inc/swurl.hxx
@@ -23,7 +23,6 @@
 #include 
 
 class SwViewShell;
-class SwView;
 
 enum class LoadUrlFlags {
 NONE= 0x00,
@@ -36,10 +35,6 @@ namespace o3tl {
 void LoadURL( SwViewShell& rSh, const OUString& rName,
   LoadUrlFlags nFilter, const OUString& rTargetFrameName );
 
-void LoadURL( SwView& rView, const OUString& rName,
-  LoadUrlFlags nFilter, const OUString& rTargetFrameName );
-
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index aac07e855f05..3d7eecab6f07 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -499,7 +499,7 @@ void SwDrawTextShell::Execute( SfxRequest  )
 const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : 
nullptr;
 if (const SvxURLField* pURLField = dynamic_cast(pField))
 {
-::LoadURL(GetView(), pURLField->GetURL(), LoadUrlFlags::NONE,
+::LoadURL(GetShell(), pURLField->GetURL(), LoadUrlFlags::NONE,
   pURLField->GetTargetFrame());
 }
 }
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index d2451442c600..e3af36a1c54b 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -553,26 +553,8 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, 
LoadUrlFlags nFilter )
 return bRet;
 }
 
-void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
-  const OUString& rTargetFrameName )
-{
-OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
-if( rURL.isEmpty() )
-return ;
-
-// The shell could be 0 also!
-if ( dynamic_cast( ) ==  nullptr )
-return;
-
-//A CursorShell is always a WrtShell
-SwWrtShell  = static_cast(rVSh);
-
-::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
-
-}
-
-void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter,
-  const OUString& rTargetFrameName)
+static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter,
+const OUString& rTargetFrameName)
 {
 SwDocShell* pDShell = rView.GetDocShell();
 OSL_ENSURE( pDShell, "No DocShell?!");
@@ -629,6 +611,23 @@ void LoadURL(SwView& rView, const OUString& rURL, 
LoadUrlFlags nFilter,
 {  } );
 }
 
+void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
+  const OUString& rTargetFrameName )
+{
+OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
+if( rURL.isEmpty() )
+return ;
+
+// The shell could be 0 also!
+if ( dynamic_cast( ) ==  nullptr )
+return;
+
+//A CursorShell is always a WrtShell
+SwWrtShell  = static_cast(rVSh);
+
+::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
+}
+
 void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
 const sal_uInt16 nAction )
 {


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-13 Thread Andreas Heinisch (via logerrit)
 sw/inc/viewopt.hxx  |9 +
 sw/source/ui/index/cnttab.cxx   |   16 +++-
 sw/source/uibase/config/viewopt.cxx |4 
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 8bf614179f5664d7cdd49db41ef462073cc8608d
Author: Andreas Heinisch 
AuthorDate: Thu Nov 9 16:00:10 2023 +0100
Commit: Andreas Heinisch 
CommitDate: Mon Nov 13 18:16:38 2023 +0100

tdf#135266 - Remember last used entry level depending on the index type

Change-Id: I4fe9342c28fc9135b73286e67464b16a1d910a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159217
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 3c847acfd6fe..72659849a627 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -274,6 +274,9 @@ class SW_DLLPUBLIC SwViewOption
 boolm_bShowPlaceHolderFields : 1; // Only used in printing!
 mutable boolm_bIdle;
 sal_Int32   m_nDefaultAnchor; // GetDefaultAnchorType() to convert 
int to RndStdIds
+// tdf#135266 - tox dialog: remember last used entry level depending on 
the index type
+sal_uInt8 m_nTocEntryLvl;
+sal_uInt8 m_nIdxEntryLvl;
 
 // Scale
 sal_uInt16  m_nZoom;  // In percent.
@@ -845,6 +848,12 @@ public:
 
 RndStdIds GetDefaultAnchorType() const;
 
+// tdf#135266 - tox dialog: remember last used entry level depending on 
the index type
+sal_uInt8 GetTocEntryLvl() const { return m_nTocEntryLvl; }
+void SetTocEntryLvl(sal_uInt8 n) { m_nTocEntryLvl = n; }
+sal_uInt8 GetIdxEntryLvl() const { return m_nIdxEntryLvl; }
+void SetIdxEntryLvl(sal_uInt8 n) { m_nIdxEntryLvl = n; }
+
 // Useful for when getting the current view SwViewOption is not possible 
otherwise
 static const SwViewOption& GetCurrentViewOptions();
 };
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 829beb6e9499..a5d3bf92ddef 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2065,6 +2065,17 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* 
pPage, weld::DialogControl
 SwTOXEntryTabPage::~SwTOXEntryTabPage()
 {
 m_xTokenWIN.reset();
+
+// tdf#135266 - remember last used entry level depending on the index type
+if (const auto aSelectedIndex = m_xLevelLB->get_selected_index(); 
aSelectedIndex != -1)
+{
+auto& rSh = 
static_cast(GetDialogController())->GetWrtShell();
+SwViewOption* pVOpt = const_cast(rSh.GetViewOptions());
+if (m_aLastTOXType == TOX_INDEX)
+pVOpt->SetIdxEntryLvl(aSelectedIndex);
+else
+pVOpt->SetTocEntryLvl(aSelectedIndex);
+}
 }
 
 IMPL_LINK_NOARG(SwTOXEntryTabPage, ModifyClickHdl, weld::Toggleable&, void)
@@ -2240,7 +2251,10 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& 
/*rSet*/)
 else
 m_xLevelFT->set_label(m_sLevelStr);
 
-m_xLevelLB->select(bToxIsIndex ? 1 : 0);
+// tdf#135266 - remember last used entry level depending on the index 
type
+m_xLevelLB->select(bToxIsIndex ? 
pTOXDlg->GetWrtShell().GetViewOptions()->GetIdxEntryLvl()
+   : 
pTOXDlg->GetWrtShell().GetViewOptions()->GetTocEntryLvl());
+
 
 //show or hide controls
 ShowHideControls(aCurType.eType);
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 1e78b1fdac02..36fdf1fd4484 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -292,6 +292,10 @@ SwViewOption::SwViewOption() :
 
 m_nDefaultAnchor = 1; //FLY_TO_CHAR
 
+// tdf#135266 - tox dialog: remember last used entry level depending on 
the index type
+m_nTocEntryLvl = 0;
+m_nIdxEntryLvl = 1;
+
 #ifdef DBG_UTIL
 // correspond to the statements in ui/config/cfgvw.src
 m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 =


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-08 Thread Noel Grandin (via logerrit)
 sw/inc/docsh.hxx  |3 ++-
 sw/source/uibase/app/docshini.cxx |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit dae818cf81763dedad573c86b352f1cfedcfeb64
Author: Noel Grandin 
AuthorDate: Wed Nov 8 09:27:02 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 06:25:25 2023 +0100

loplugin:fieldcast in SwDocShell

Change-Id: I81739c24ae1174ff9f889490b8152dda7b61f328
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159171
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 301ba4748fd1..3cbc43c98803 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -52,6 +52,7 @@ class IDocumentChartDataProviderAccess;
 class SwDocShell;
 class SwDrawModel;
 class SwViewShell;
+class SwDocStyleSheetPool;
 namespace svt
 {
 class EmbeddedObjectRef;
@@ -69,7 +70,7 @@ class SW_DLLPUBLIC SwDocShell
 , public SfxListener
 {
 rtl::Reference< SwDoc > m_xDoc;  ///< Document.
-rtl::Reference< SfxStyleSheetBasePool > m_xBasePool; ///< Passing through 
for formats.
+rtl::Reference< SwDocStyleSheetPool > m_xBasePool; ///< Passing through 
for formats.
 std::unique_ptr m_pFontList;  ///< Current Fontlist.
 boolm_IsInUpdateFontList; ///< prevent nested calls of 
UpdateFontList
 
diff --git a/sw/source/uibase/app/docshini.cxx 
b/sw/source/uibase/app/docshini.cxx
index 2dbe6095a554..6d3cf42a7858 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -436,7 +436,7 @@ void SwDocShell::RemoveLink()
 {
 if (m_xBasePool.is())
 {
-static_cast(m_xBasePool.get())->dispose();
+m_xBasePool->dispose();
 m_xBasePool.clear();
 }
 m_xDoc->SetOle2Link(Link());


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-08 Thread Noel Grandin (via logerrit)
 sw/inc/viscrs.hxx  |4 ++--
 sw/source/core/crsr/viscrs.cxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ce98f8d033ab9dfd505448860981472153970e96
Author: Noel Grandin 
AuthorDate: Tue Nov 7 16:18:05 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 06:21:25 2023 +0100

loplugin:fieldcast in SwSelPaintRects

Change-Id: I62471db74c30baf8bd42a3679624c767c68c66f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159137
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index 24b632cca22c..2aba4bbd7110 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -28,7 +28,7 @@
 
 #include 
 
-namespace sdr::overlay { class OverlayObject; }
+namespace sdr::overlay { class OverlaySelection; }
 
 class SwCursorShell;
 class SfxViewShell;
@@ -87,7 +87,7 @@ class SwSelPaintRects : public SwRects
 const SwCursorShell* m_pCursorShell;
 
 #if HAVE_FEATURE_DESKTOP || defined(ANDROID)
-std::unique_ptr m_pCursorOverlay;
+std::unique_ptr m_pCursorOverlay;
 #endif
 
 bool m_bShowTextInputFieldOverlay;
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index f681f3a32815..0385ce85f71c 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -448,7 +448,7 @@ void SwSelPaintRects::Show(std::vector* 
pSelectionRectangles)
 {
 if(!aNewRanges.empty())
 {
-
static_cast(m_pCursorOverlay.get())->setRanges(std::move(aNewRanges));
+m_pCursorOverlay->setRanges(std::move(aNewRanges));
 }
 else
 {


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-03 Thread EMartinGube (via logerrit)
 sw/inc/dbmgr.hxx|4 ++--
 sw/source/uibase/dbui/dbmgr.cxx |   11 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit d7a5e7643f3540b1490c1e2f1a91ff86c721d7b6
Author: EMartinGube 
AuthorDate: Mon Aug 14 21:31:24 2023 +0200
Commit: Hossein 
CommitDate: Sat Nov 4 02:34:56 2023 +0100

tdf#114441 Convert use of sal_uLong to better integer types

Return type of GetColumnFormat() is changed to sal_uInt32. All the
values from the function calls inside GetCloumnFormat() which were
involved in the return value seem to be positive right now.

Change-Id: Id19b2982d8372e10fee5fc0fd4233576076ec3df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155680
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index b0d4b756917d..4c6a0c1e7499 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -325,13 +325,13 @@ public:
 css::uno::Reference< css::sdbc::XConnection> const 
& xConnection,
 const OUString& rTableName);
 
-static sal_uLong GetColumnFormat( css::uno::Reference< 
css::sdbc::XDataSource> const & xSource,
+static sal_uInt32 GetColumnFormat( css::uno::Reference< 
css::sdbc::XDataSource> const & xSource,
 css::uno::Reference< css::sdbc::XConnection> const 
& xConnection,
 css::uno::Reference< css::beans::XPropertySet> 
const & xColumn,
 SvNumberFormatter* pNFormatr,
 LanguageType nLanguage );
 
-sal_uLong GetColumnFormat( const OUString& rDBName,
+sal_uInt32 GetColumnFormat( const OUString& rDBName,
 const OUString& rTableName,
 const OUString& rColNm,
 SvNumberFormatter* pNFormatr,
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 0cc225e0c3de..bb4cdc12cdbe 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -591,7 +591,7 @@ void SwDBManager::ImportFromConnection(  SwWrtShell* pSh )
 std::optional oWait;
 
 {
-sal_uLong i = 0;
+sal_uInt32 i = 0;
 do {
 
 ImportDBEntry(pSh);
@@ -1670,13 +1670,13 @@ void SwDBManager::MergeCancel()
 
 // determine the column's Numberformat and transfer to the forwarded Formatter,
 // if applicable.
-sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
+sal_uInt32 SwDBManager::GetColumnFormat( const OUString& rDBName,
 const OUString& rTableName,
 const OUString& rColNm,
 SvNumberFormatter* pNFormatr,
 LanguageType nLanguage )
 {
-sal_uLong nRet = 0;
+sal_uInt32 nRet = 0;
 if(pNFormatr)
 {
 uno::Reference< sdbc::XDataSource> xSource;
@@ -1750,7 +1750,7 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& 
rDBName,
 return nRet;
 }
 
-sal_uLong SwDBManager::GetColumnFormat( uno::Reference< sdbc::XDataSource> 
const & xSource_in,
+sal_uInt32 SwDBManager::GetColumnFormat( uno::Reference< sdbc::XDataSource> 
const & xSource_in,
 uno::Reference< sdbc::XConnection> const & xConnection,
 uno::Reference< beans::XPropertySet> const & xColumn,
 SvNumberFormatter* pNFormatr,
@@ -1759,7 +1759,7 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< 
sdbc::XDataSource> const
 auto xSource = xSource_in;
 
 // set the NumberFormat in the doc if applicable
-sal_uLong nRet = 0;
+sal_uInt32 nRet = 0;
 
 if(!xSource.is())
 {
@@ -1813,6 +1813,7 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< 
sdbc::XDataSource> const
 nFormat = xDocNumberFormats->queryKey( sFormat, aLoc, 
false );
 if(NUMBERFORMAT_ENTRY_NOT_FOUND == 
sal::static_int_cast< sal_uInt32, sal_Int32>(nFormat))
 nFormat = xDocNumberFormats->addNew( sFormat, aLoc 
);
+
 nRet = nFormat;
 bUseDefault = false;
 }


[Libreoffice-commits] core.git: sw/inc sw/source

2023-11-02 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx  |1 +
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   14 ++
 sw/source/core/text/itrpaint.cxx|2 ++
 3 files changed, 17 insertions(+)

New commits:
commit a71da3b7a80ca32b595a8ca0ea3da650b0af376c
Author: Michael Stahl 
AuthorDate: Wed Nov 1 20:31:44 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 2 11:53:42 2023 +0100

tdf#156565 sw: PDF/UA export: split Link SE at line break

There must be one Link SE per Link Annotation, so ensure that a new one
is created for a new line.

(regression from commit 4c5283a3a11008a06a995c49ed34dc1f6066)

Change-Id: I2585d9e22a435d7716f48fec89a78149c129f71d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158775
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index be3c45383061..6b2e2655ea43 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -183,6 +183,7 @@ class SwTaggedPDFHelper
 ~SwTaggedPDFHelper();
 
 static bool IsExportTaggedPDF( const OutputDevice& rOut );
+static void EndCurrentLink(OutputDevice const&);
 };
 
 /*
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index e224d33901a4..48c938264994 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1698,6 +1698,20 @@ void SwTaggedPDFHelper::EndStructureElements()
 CheckRestoreTag();
 }
 
+void SwTaggedPDFHelper::EndCurrentLink(OutputDevice const& rOut)
+{
+vcl::PDFExtOutDevData *const pPDFExtOutDevData(
+dynamic_cast(rOut.GetExtOutDevData()));
+if (pPDFExtOutDevData && 
pPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink)
+{
+pPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink.reset();
+pPDFExtOutDevData->EndStructureElement();
+#if OSL_DEBUG_LEVEL > 1
+aStructStack.pop_back();
+#endif
+}
+}
+
 void SwTaggedPDFHelper::EndCurrentAll()
 {
 if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 4f0d412f2597..5b6bb1288d57 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -162,6 +162,8 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 roTaggedParagraph.emplace(nullptr, , nullptr, 
*GetInfo().GetOut());
 }
 
+SwTaggedPDFHelper::EndCurrentLink(*GetInfo().GetOut());
+
 // Optimization!
 SwTwips nMaxRight = std::min( rPaint.Right(), Right() );
 const SwTwips nTmpLeft = GetInfo().X();


[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/inc/numrule.hxx   |4 -
 sw/inc/reffld.hxx|5 -
 sw/source/core/doc/number.cxx|  121 ++-
 sw/source/core/fields/reffld.cxx |   44 +++---
 sw/source/core/txtnode/ndtxt.cxx |1 
 sw/source/ui/fldui/fldref.cxx|   48 +--
 sw/source/ui/fldui/fldref.hxx|1 
 7 files changed, 152 insertions(+), 72 deletions(-)

New commits:
commit 2ddd1378fc232fbc1d5162f2c44ecf71c6725732
Author: Skyler Grey 
AuthorDate: Tue Oct 24 16:22:30 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:10:27 2023 +0100

Improve HIDE_NON_NUMERICAL compatibility with Word

The previous implementation of REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL had
some major incompatibilites with Word. In particular, it stripped
letters even if they were included in the "numbering" system.

This commit fixes a lot of the flaws in the previous implementation, so
it's now a lot closer to Word.

Change-Id: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158451
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index f642e21e746c..b21cc5259656 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -169,11 +169,13 @@ public:
 OUString MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
   const bool bInclStrings = true,
   const unsigned int _nRestrictToThisLevel = MAXLEVEL,
+  const bool bHideNonNumerical = false,
   Extremities* pExtremities = nullptr,
   LanguageType nLang = LANGUAGE_SYSTEM) const;
 OUString MakeRefNumString( const SwNodeNum& rNodeNum,
  const bool bInclSuperiorNumLabels,
- const int nRestrictInclToThisLevel ) const;
+ const int nRestrictInclToThisLevel,
+ const bool bHideNonNumerical ) const;
 OUString MakeParagraphStyleListString() const;
 
 /** @return list of associated text nodes */
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 3c1e3c63b5e6..b65e8c209633 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -117,11 +117,6 @@ private:
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
-
-/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
-/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
-/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
-void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
 sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 3ab36c63c160..d2cb98924e0f 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -648,9 +648,51 @@ OUString SwNumRule::MakeNumString( const SwNodeNum& rNum, 
bool bInclStrings ) co
 return OUString();
 }
 
+namespace {
+/// Strip out text that is not a delimiter. Used in STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y"
+/// Only used on the prefix/infix/suffix, so the numbers are not modified
+void StripNonDelimiter(OUString& rText)
+{
+std::vector charactersToKeep;
+
+for (int i = 0; i < rText.getLength(); i++) {
+auto character = rText[i];
+
+ // tdf#86790# for Word compatibility: I haven't found any better way 
to determine whether a
+ // character is a delimiter than testing in Word and listing them 
out. Furthermore, I haven't
+ // found a list so I can't be certain this is the complete set- if 
there's a compatibility issue
+ // with this in the future, here's the first place to look...
+if (
+character == '.'
+|| character == ','
+|| character == ':'
+|| character == ';'
+|| character == '-'
+|| character == '('
+|| character == ')'
+|| character == '['
+|| character == ']'
+|| character == '{'
+|| character == '}'
+|| character == '/'
+|| character == '\\'
+|| character == '|'
+)
+charactersToKeep.push_back(character);
+}
+
+if (charactersToKeep.size())
+rText = OUString(charactersToKeep.data(), charactersToKeep.size());
+else
+rText = OUString();
+}
+}
+
 OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & 
rNumVector,
   

[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/inc/reffld.hxx|1 
 sw/source/core/doc/DocumentFieldsManager.cxx |5 
 sw/source/core/fields/reffld.cxx |   29 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 15972993ff6e106a02954125269612179e1f33aa
Author: Skyler Grey 
AuthorDate: Mon Oct 23 16:17:17 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:08:56 2023 +0100

Fix incorrect marginal STYLEREF content in docx

STYLEREF fields were previously not importing with the correct content
when loading a docx document. This is because they were not updating
when the document had finished loading- only partway through, and where
a STYLEREF field is in relation to everything else in the document can
change its content.

This commit fixes that issue by adding STYLEREF fields to be refreshed
whenever other fields that can change based on pages (e.g. page number)
fields are updated. I suspect this could lead to double updates in some
cases where both reference and page fields are being updated. I consider
this a relatively minor issue in comparison to incorrect field content
when specific documents are loaded, but a followup could be made
improving this.

This commit also fixes a minor typo in reffld.cxx where m_sText is
always the filtered text when updating fields, even if we are updating
m_sTextRLHidden instead.

Change-Id: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158450
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 293b913c406b..3c1e3c63b5e6 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -100,6 +100,7 @@ public:
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
 void UpdateGetReferences();
+void UpdateStyleReferences();
 };
 
 class SW_DLLPUBLIC SwGetRefField final : public SwField
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index c8703e7f06ef..a7be3bb96394 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1292,6 +1292,11 @@ void DocumentFieldsManager::UpdatePageFields(const 
SwTwips nDocPos)
 case SwFieldIds::DocStat:
 pFieldType->CallSwClientNotify(sw::LegacyModifyHint(nullptr, 
nullptr));
 break;
+case SwFieldIds::GetRef:
+
static_cast(pFieldType)->UpdateStyleReferences();
+// Style references can vary across different pages (e.g. in 
header/footer)
+// so they must be updated when page fields are
+break;
 default: break;
 }
 }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 638baf0a5474..ee7791a68753 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -706,7 +706,7 @@ void SwGetRefField::UpdateField(const SwTextField* 
pFieldTextAttr, SwFrame* pFra
 rText = pTextNd->GetExpandText(pLayout, nStart, nEnd - 
nStart, false, false,
false, ExpandMode(0));
 }
-FilterText(m_sText, GetLanguage(), m_sSetReferenceLanguage);
+FilterText(rText, GetLanguage(), m_sSetReferenceLanguage);
 }
 }
 break;
@@ -1167,6 +1167,33 @@ void SwGetRefFieldType::UpdateGetReferences()
 CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
 }
 
+void SwGetRefFieldType::UpdateStyleReferences()
+{
+std::vector vFields;
+GatherFields(vFields, false);
+bool bModified = false;
+for(auto pFormatField: vFields)
+{
+// update only the GetRef fields which are also STYLEREF fields
+SwGetRefField* pGRef = 
static_cast(pFormatField->GetField());
+
+if (pGRef->GetSubType() != REF_STYLE) continue;
+
+const SwTextField* pTField;
+if(!pGRef->GetLanguage() &&
+nullptr != (pTField = pFormatField->GetTextField()) &&
+pTField->GetpTextNode())
+{
+
pGRef->SetLanguage(pTField->GetpTextNode()->GetLang(pTField->GetStart()));
+}
+
+pGRef->UpdateField(pFormatField->GetTextField(), nullptr);
+bModified = true;
+}
+if (bModified)
+CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr));
+}
+
 void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if (rHint.GetId() != SfxHintId::SwLegacyModify)


[Libreoffice-commits] core.git: sw/inc

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/inc/redline.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 702c4775fc4e011220bf2356d4ee2ca561ff5487
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:51:08 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:41:59 2023 +0100

Fix typo

Change-Id: I0ea74d87f66554cedf1b1bff86e58bb3e78a3010
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158634
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index a82c785ee58f..c54b7d5d8380 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -95,7 +95,7 @@ class SW_DLLPUBLIC SwRedlineData
 RedlineType m_eType;
 sal_uInt16 m_nSeqNo;
 bool m_bAutoFormat;
-sal_uInt32 m_nMovedID;  // 0 == not moved, 1 == moved, but dont have its 
pair, 2+ == unique ID
+sal_uInt32 m_nMovedID;  // 0 == not moved, 1 == moved, but don't have its 
pair, 2+ == unique ID
 
 public:
 SwRedlineData( RedlineType eT, std::size_t nAut, sal_uInt32 nMoveID = 0 );


[Libreoffice-commits] core.git: sw/inc

2023-10-29 Thread Rico Tzschichholz (via logerrit)
 sw/inc/frameformats.hxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 31fb3045dabdb27d913712f3abcade315e3ea9bd
Author: Rico Tzschichholz 
AuthorDate: Fri Sep 8 17:02:02 2023 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Oct 30 02:39:52 2023 +0100

sw: Drop superfluous template class definitions to avoid linker failure on 
arm

workdir/CxxObject/sw/source/core/access/accdoc.o:(.data.rel.ro+0x41c): 
multiple
definition of `typeinfo for sw::FrameFormats';
workdir/CxxObject/sw/source/core/access/acccontext.o:(.data.rel.ro+0x1d8): 
first
defined here

Change-Id: I1ba9db69a73bd205a9a90cc11259abcadf62a082
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156737
Tested-by: Jenkins
Tested-by: René Engelhard 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx
index 4edb1f98b134..ca0d5025fbe2 100644
--- a/sw/inc/frameformats.hxx
+++ b/sw/inc/frameformats.hxx
@@ -237,7 +237,4 @@ typedef FrameFormats<::SwTableFormat*> TableFrameFormats;
 typedef FrameFormats SpzFrameFormats;
 }
 
-template class SW_DLLPUBLIC sw::FrameFormats;
-template class SW_DLLPUBLIC sw::FrameFormats;
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-29 Thread Attila Szűcs (via logerrit)
 sw/inc/IDocumentRedlineAccess.hxx |3 +-
 sw/source/core/doc/DocumentRedlineManager.cxx |   33 +-
 sw/source/core/doc/docnum.cxx |2 -
 sw/source/core/inc/DocumentRedlineManager.hxx |5 +++
 4 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit b40e469887d973e1eea242749a90c3c2370da3a5
Author: Attila Szűcs 
AuthorDate: Thu Oct 26 01:51:40 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 01:55:54 2023 +0100

tdf#157663 SW: fix redline continueing a move

Subsequent moves generated new MoveID's, like if they were separete moves.
That cause moves to forgot their other parts.

Now, if we move a redline that was moved by us it will re-use its moveID
as if it was just the continue of the previous movement.
It does not work if we move more then 1 of our own movement redlines

Note: There are complex cases what it cannot handle.. in those case it
just use the new ID, so the newly moved part, will forgot its relation
with the old move oroginal parts.
Complex case is like.. if we move 2 of our own move redlines,
that means there will be 2 MoveId we would want to continue, but only 1
insert redline to write that MoveID.
But as long as we moved only 1 of our redlines it will work, even if
there are more text redlines, even move redlines of other author.
Other move redlines will be separate move anyway.

Note2: In complex cases, we may could connect movements.
Or we could split the new inserted move part.
but those are design questions, they may be not good idea..
and the split one is probably more work to implement.

Change-Id: Icb2adf43272181c6a63a4a84750352f4b163383a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158473
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158615
Tested-by: Jenkins

diff --git a/sw/inc/IDocumentRedlineAccess.hxx 
b/sw/inc/IDocumentRedlineAccess.hxx
index 6e28f1340deb..9d97eb43ff7e 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -147,7 +147,8 @@ public:
 MERGED if pNewRedl was deleted but has been merged with existing 
one
 IGNORED if pNewRedl was deleted and ignored/invalid
 */
-virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, 
/*[in]*/bool bCallDelete) = 0;
+virtual AppendResult AppendRedline(/*[in]*/ SwRangeRedline* pNewRedl, 
/*[in]*/ bool bCallDelete,
+   /*[in]*/ sal_uInt32 nMoveIDToDelete = 
0) = 0;
 
 virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0;
 virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0;
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 468449ecfbe9..8d52c814e81a 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1309,7 +1309,8 @@ Behaviour of Delete-Redline:
   the Delete
 */
 IDocumentRedlineAccess::AppendResult
-DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const 
bCallDelete)
+DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const 
bCallDelete,
+  sal_uInt32 nMoveIDToDelete)
 {
 CHECK_REDLINE( *this )
 
@@ -1330,6 +1331,9 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 return AppendResult::IGNORED;
 }
 
+// Collect MoveID's of the redlines we delete.
+// If there is only 1, then we should use its ID. (continuing the move)
+std::set deletedMoveIDs;
 
 bool bMerged = false;
 
@@ -1807,6 +1811,16 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 // and anonymized insertion, i.e. with the same dummy 
timestamp
 !pRedl->GetRedlineData(0).IsAnonymized() )
 {
+// Collect MoveID's of the redlines we delete.
+if (nMoveIDToDelete > 1 && maRedlineTable[n]->GetMoved() > 0
+&& (eCmpPos == SwComparePosition::Equal
+|| eCmpPos == SwComparePosition::Inside
+|| eCmpPos == SwComparePosition::Outside
+|| eCmpPos == SwComparePosition::OverlapBefore
+|| eCmpPos == SwComparePosition::OverlapBehind))
+{
+deletedMoveIDs.insert(maRedlineTable[n]->GetMoved());
+}
 
 // Set to NONE, so that the Delete::Redo merges the 
Redline data correctly!
 // The ShowMode needs to be retained!
@@ -2421,6 +2435,23 @@ 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-29 Thread Attila Szűcs (via logerrit)
 sw/inc/IDocumentRedlineAccess.hxx   |9 ++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++
 sw/source/core/doc/DocumentRedlineManager.cxx   |   53 +++-
 sw/source/core/inc/DocumentRedlineManager.hxx   |   10 +++
 4 files changed, 78 insertions(+), 3 deletions(-)

New commits:
commit 5e726afaf08c8cc59124d9551bb083220a38821e
Author: Attila Szűcs 
AuthorDate: Wed Oct 25 12:46:10 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 00:39:30 2023 +0100

SW: fixed redline SwPosition update problem

When nodes are removed, SwPosition nNode is updated,
but its nContent is not.
If nNode change from a non-ContentNodo to a ContentNode, then it is
a problem, as nContent 's m_pContentNode remains nullptr, so the
Position seems to be inconsistent.

Now when redline remove nodes, it check what redlines may effected it,
and update them after the node deletion happened.

Probably this bug should be handled deeper, as this problem probably
effect every SwPosition.. not sure if it can be a problem elsewhere.

A special case when it happens, if there is a Table between 2 text.
And there are 2 redlines..
1: any redline positioned 'text start'-'table start'
2: delete redline: 'table begin'-'table end'
now if we accept the 2. redline .. that remove the table
the 1. redline position will change to: 'text start'-'next text start'
but its end's nContent.m_pContentNode remain nullptr
so lcl_CheckPosition(...) will assert

Change-Id: I2981fd0218a375994d3f55cb5d3463b17ca35849
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158456
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158614
Tested-by: Jenkins

diff --git a/sw/inc/IDocumentRedlineAccess.hxx 
b/sw/inc/IDocumentRedlineAccess.hxx
index c2b71aa1005a..6e28f1340deb 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -168,6 +168,11 @@ public:
 /*[in]*/const SwNode& rNode,
 /*[in]*/RedlineType nType) const = 0;
 
+virtual SwRedlineTable::size_type GetRedlineEndPos(
+/*[in]*/ SwRedlineTable::size_type nStartPos,
+/*[in]*/ const SwNode& rNode,
+/*[in]*/ RedlineType nType) const = 0;
+
 virtual bool HasRedline(
 /*[in]*/const SwPaM& rPam,
 /*[in]*/RedlineType nType,
@@ -226,6 +231,10 @@ public:
 virtual void SetRedlinePassword(
 /*[in]*/const css::uno::Sequence & rNewPassword) = 0;
 
+virtual void UpdateRedlineContentNode(/*[in]*/ SwRedlineTable::size_type 
nStartPos,
+  /*[in]*/ SwRedlineTable::size_type 
nEndPos) const = 0;
+
+
 protected:
  virtual ~IDocumentRedlineAccess() {};
 };
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 60f9d1b96890..3f4c99a8f487 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2142,8 +2142,17 @@ void DocumentContentOperationsManager::DeleteDummyChar(
 
 void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam )
 {
+// Seek all redlines that are in that PaM to be deleted..
+SwRedlineTable::size_type nRedlStart = 
m_rDoc.getIDocumentRedlineAccess().GetRedlinePos(
+rPam.Start()->GetNode(), RedlineType::Any);
+SwRedlineTable::size_type nRedlEnd = 
m_rDoc.getIDocumentRedlineAccess().GetRedlineEndPos(
+nRedlStart, rPam.End()->GetNode(), RedlineType::Any);
+
 lcl_DoWithBreaks(*this, rPam, SwDeleteFlags::Default, 
::DeleteRangeImpl);
 
+// update all redlines was in the Pam that is
+m_rDoc.getIDocumentRedlineAccess().UpdateRedlineContentNode(nRedlStart, 
nRedlEnd);
+
 if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline()
 && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty())
 {
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index b09ad5bedcaa..468449ecfbe9 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -54,9 +54,8 @@ using namespace com::sun::star;
 // 2. check that position is valid and doesn't point after text
 void lcl_CheckPosition( const SwPosition* pPos )
 {
-// Commented out because of a random problem, that happened even 
before my patch
-//assert(dynamic_cast(>GetNode())
-//== pPos->GetContentNode());
+assert(dynamic_cast(>GetNode())
+== pPos->GetContentNode());
 
 SwTextNode* pTextNode = pPos->GetNode().GetTextNode();
 if( pTextNode == nullptr )
@@ -2801,6 +2800,54 @@ SwRedlineTable::size_type 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source sw/uiconfig

2023-10-27 Thread Skyler Grey (via logerrit)
 sw/inc/crsrsh.hxx   |2 
 sw/inc/reffld.hxx   |   27 ++
 sw/qa/extras/uiwriter/uiwriter7.cxx |   15 -
 sw/source/core/crsr/crstrvl.cxx |4 
 sw/source/core/fields/reffld.cxx|   99 +++---
 sw/source/core/text/EnhancedPDFExportHelper.cxx |2 
 sw/source/core/unocore/unofield.cxx |1 
 sw/source/filter/ww8/ww8par5.cxx|8 
 sw/source/ui/fldui/fldref.cxx   |   37 ++-
 sw/source/ui/fldui/fldref.hxx   |4 
 sw/source/uibase/fldui/fldmgr.cxx   |   21 +-
 sw/source/uibase/inc/wrtsh.hxx  |2 
 sw/source/uibase/shells/textsh1.cxx |3 
 sw/source/uibase/wrtsh/move.cxx |4 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |3 
 sw/uiconfig/swriter/ui/fldrefpage.ui|  231 ++--
 16 files changed, 303 insertions(+), 160 deletions(-)

New commits:
commit 4bb1a7836abb49a9b0513958239f3998305201fd
Author: Skyler Grey 
AuthorDate: Fri Oct 20 09:02:57 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 08:07:21 2023 +0200

Add flags to STYLEREF

This commit is part of an implementation for the following STYLEREF flags
- Search from bottom to top, which sets the STYLEREF field to search
  downwards first, or from the bottom of the page in marginals
- Hide non numerical, which hides all characters that are not either
  numbers or punctuation commonly used as delimiters. For example, if
  your STYLEREF said "Chapter 2.1", this setting would make it say "2.1"

This commit implements:
- The document model
- The layout
- The UI

Change-Id: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158349
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 233edb71c240..fd28607c5e32 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -702,7 +702,7 @@ public:
 bool SelectNxtPrvHyperlink( bool bNext );
 
 bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
-sal_uInt16 nSeqNo );
+sal_uInt16 nSeqNo, sal_uInt16 nFlags );
 
 // get the nth character from the start or end of the  current selection
 sal_Unicode GetChar( bool bEnd = true, tools::Long nOffset = 0 );
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index bf9d563ab2ac..293b913c406b 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -34,6 +34,20 @@ class SwFrame;
 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
 const SwTextNode& rBehindNd, sal_Int32 nSttPos );
 
+#define REFFLDFLAG  0x4000
+#define REFFLDFLAG_BOOKMARK 0x4800
+#define REFFLDFLAG_FOOTNOTE 0x5000
+#define REFFLDFLAG_ENDNOTE  0x6000
+// #i83479#
+#define REFFLDFLAG_HEADING  0x7100
+#define REFFLDFLAG_NUMITEM  0x7200
+
+#define REFFLDFLAG_STYLE0xc000
+/* we skip past 0x8000, 0x9000, 0xa000 and 0xb000 as when we bitwise 'and'
+   with REFFLDFLAG they are false */
+#define REFFLDFLAG_STYLE_FROM_BOTTOM   0xc100
+#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL0xc200
+
 enum REFERENCESUBTYPE
 {
 REF_SETREFATTR = 0,
@@ -81,7 +95,7 @@ public:
 void MergeWithOtherDoc( SwDoc& rDestDoc );
 
 static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo,
+sal_uInt16 nSubType, sal_uInt16 
nSeqNo, sal_uInt16 nFlags,
 sal_Int32* pStt, sal_Int32* pEnd = 
nullptr,
 SwRootFrame const* pLayout = nullptr,
 SwTextNode* pSelf = nullptr, SwFrame* 
pFrame = nullptr);
@@ -98,13 +112,18 @@ private:
 sal_uInt16 m_nSubType;
 /// reference to either a SwTextFootnote::m_nSeqNo or a 
SwSetExpField::mnSeqNo
 sal_uInt16 m_nSeqNo;
+sal_uInt16 m_nFlags;
 
 virtual OUStringExpandImpl(SwRootFrame const* pLayout) const override;
 virtual std::unique_ptr Copy() const override;
 
+/// Strip out text that is not either a number or a delimiter. Used in 
STYLEREF for when you
+/// have chapters labelled "Chapter X.Y" and want to just keep the "X.Y". 
Distinct from
+/// GetExpandedTextOfReferencedTextNode so you can run it after any other 
processing
+void StylerefStripNonnumerical(OUString& rText) const;
 public:
 SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString 
aReferenceLanguage,
-sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat 
);
+sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, 
sal_uLong nFormat );
 
 virtual ~SwGetRefField() override;
 
@@ -140,6 +159,10 @@ public:

[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-25 Thread Mike Kaganski (via logerrit)
 sw/inc/fldbas.hxx|5 +
 sw/source/core/fields/fldbas.cxx |   10 --
 2 files changed, 1 insertion(+), 14 deletions(-)

New commits:
commit 6448c83a8740711172b3c59175a2abd15c00114b
Author: Mike Kaganski 
AuthorDate: Wed Oct 25 09:59:51 2023 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 25 11:42:13 2023 +0200

DBG_UTIL implementation differs only by never-wrong assert

Change-Id: Ifb879d6536c80f00da61707fb0aa0700dcd19bcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158288
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 4aa874c3021d..7518c47582f3 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -349,13 +349,10 @@ public:
 
 /// ResId
 SwFieldIds  Which() const
-#ifdef DBG_UTIL
-;   // implemented in fldbas.cxx
-#else
 {
+assert(m_pType);
 return m_pType->Which();
 }
-#endif
 
 // TYP_ID
 SwFieldTypesEnumGetTypeId() const;
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index c528f2a0d65a..b3fab811f1c2 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -257,16 +257,6 @@ SwField::~SwField()
 {
 }
 
-// instead of indirectly via the type
-
-#ifdef DBG_UTIL
-SwFieldIds SwField::Which() const
-{
-assert(m_pType);
-return m_pType->Which();
-}
-#endif
-
 SwFieldTypesEnum SwField::GetTypeId() const
 {
 


[Libreoffice-commits] core.git: sw/inc sw/source vcl/qa

2023-10-24 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx  |3 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   49 ++-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  102 ++--
 3 files changed, 141 insertions(+), 13 deletions(-)

New commits:
commit 4c5283a3a11008a06a995c49ed34dc1f6066
Author: Michael Stahl 
AuthorDate: Tue Oct 24 13:51:39 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 24 16:44:45 2023 +0200

tdf#156565 sw: PDF/UA export: only one Link ILSE per link

The problem is that for a hyperlink, multiple Link SEs are created, but
only one Link annotation; the Link SEs all point to the annotation but
the annotation can only point to one Link SE.

So try to create only one Link SE for a hyperlink, similar to commit
ee3c3fcf5c48964f7bc1d64484409f072c614866.  This could be
further subdivided by Spans when formatting properties change but it
looks complicated and rarely needed.

Change-Id: I7d158b599ec744b03e78eeca88d717183f2ba1dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158387
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 1ab0f8868af4..542138157d2f 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -39,6 +39,7 @@ class SwPrintData;
 class SwTextPainter;
 class SwEditShell;
 class StringRangeEnumerator;
+class SwTextAttr;
 class SwTextNode;
 class SwTable;
 class SwNumberTreeNode;
@@ -161,7 +162,7 @@ class SwTaggedPDFHelper
 
 void EndCurrentSpan();
 void CreateCurrentSpan(SwTextPaintInfo const& rInf, OUString const& 
rStyleName);
-bool CheckContinueSpan(SwTextPaintInfo const& rInf, std::u16string_view 
rStyleName);
+bool CheckContinueSpan(SwTextPaintInfo const& rInf, std::u16string_view 
rStyleName, SwTextAttr const* pInetFormatAttr);
 
 bool CheckReopenTag();
 void CheckRestoreTag() const;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index ff47a693769f..999e599b4478 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -156,6 +156,7 @@ struct SwEnhancedPDFState
 };
 
 ::std::optional m_oCurrentSpan;
+::std::optional m_oCurrentLink;
 
 SwEnhancedPDFState(LanguageType const eLanguageDefault)
 : m_eLanguageDefault(eLanguageDefault)
@@ -1597,13 +1598,18 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
 void SwTaggedPDFHelper::EndStructureElements()
 {
-if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
+if (mpFrameInfo != nullptr)
 {
-if (mpFrameInfo != nullptr)
+if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
 {   // close span at end of paragraph
 mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan.reset();
 ++m_nEndStructureElement;
 }
+if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink)
+{   // close link at end of paragraph
+mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink.reset();
+++m_nEndStructureElement;
+}
 }
 
 while ( m_nEndStructureElement > 0 )
@@ -1640,8 +1646,32 @@ void SwTaggedPDFHelper::CreateCurrentSpan(
 }
 
 bool SwTaggedPDFHelper::CheckContinueSpan(
-SwTextPaintInfo const& rInf, std::u16string_view const rStyleName)
+SwTextPaintInfo const& rInf, std::u16string_view const rStyleName,
+SwTextAttr const*const pInetFormatAttr)
 {
+// for now, don't create span inside of link - this should be very rare
+// situation and it looks complicated to implement.
+assert(!mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan
+|| !mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink);
+if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink)
+{
+if (pInetFormatAttr && pInetFormatAttr == 
*mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink)
+{
+return true;
+}
+else
+{
+mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentLink.reset();
+EndTag();
+return false;
+}
+}
+if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan && pInetFormatAttr)
+{
+EndCurrentSpan();
+return false;
+}
+
 if (!mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
 return false;
 
@@ -1691,7 +1721,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
 }
 
 // note: ILSE may be nested, so only end the span if needed to start new 
one
-bool const isContinueSpan(CheckContinueSpan(rInf, sStyleName));
+bool const isContinueSpan(CheckContinueSpan(rInf, sStyleName, 
pInetFormatAttr));
 
 sal_uInt16 nPDFType = USHRT_MAX;
 OUString aPDFType;
@@ -1714,8 +1744,15 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
 // 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-10-23 Thread Heiko Tietze (via logerrit)
 sw/inc/flddat.hxx |2 +-
 sw/qa/uibase/shells/shells.cxx|6 --
 sw/source/ui/fldui/flddok.cxx |4 ++--
 sw/source/uibase/fldui/fldmgr.cxx |6 +++---
 4 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit fa569930a0968cdeba4441e19a68e7d78aa25cb4
Author: Heiko Tietze 
AuthorDate: Tue Oct 17 11:15:58 2023 +0200
Commit: Heiko Tietze 
CommitDate: Mon Oct 23 15:42:38 2023 +0200

Revert "Resolves tdf#139141 - Make variable date/time field the default"

This reverts commit e37f06f534ac864f9fe8cd20b07a85c36e697d41.
and ui test from Ia1a2387e137f8a672a24056b13234d4275a77ca4

Reason for revert: tdf#157337; macros rely on fix field values

Change-Id: I7a638330aac9b71432556454c0104479fcd05b4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158041
Tested-by: Heiko Tietze 
Reviewed-by: Heiko Tietze 

diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx
index 6c452072e926..39c00f68a235 100644
--- a/sw/inc/flddat.hxx
+++ b/sw/inc/flddat.hxx
@@ -30,8 +30,8 @@ namespace tools { class Time; }
 
 enum SwDateSubFormat
 {
-DATE_VAR,
 DATE_FIX,
+DATE_VAR
 };
 
 class SAL_DLLPUBLIC_RTTI SwDateTimeFieldType final : public SwValueFieldType
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index f8d7f99de023..88f90e909698 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -1049,7 +1049,9 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testInsertTextFormFieldEndnote)
 // Then this was empty: the fieldmark was inserted before the note anchor, 
not in the note body.
 CPPUNIT_ASSERT_EQUAL(OUString("result"), aActual);
 }
-
+/* 
+// Disabled because tdf#139141 was reverted and the default time field inserts 
a fix value again
+// Should be reactivated once a new UNO command is added for variable time 
fields
 CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField)
 {
 // Given an empty doc:
@@ -1077,7 +1079,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testUpdateSelectedField)
 // Check that the selected field has changed:
 CPPUNIT_ASSERT(aTimeFieldAfter != aTimeFieldBefore);
 }
-
+*/
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index f669fa7b92b2..a195ed026ec0 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -241,9 +241,9 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, 
void)
 case SwFieldTypesEnum::Date:
 case SwFieldTypesEnum::Time:
 m_xSelectionLB->append(sId, aLst[i]);
-if 
(static_cast(GetCurField())->IsFixed() && i)
+if 
(static_cast(GetCurField())->IsFixed() && !i)
 m_xSelectionLB->select_id(sId);
-if 
(!static_cast(GetCurField())->IsFixed() && !i)
+if 
(!static_cast(GetCurField())->IsFixed() && i)
 m_xSelectionLB->select_id(sId);
 break;
 case SwFieldTypesEnum::ExtendedUser:
diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index c61c9c26cba5..3b69fb63739d 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -161,14 +161,14 @@ const TranslateId FMT_AUTHOR_ARY[] =
 
 const TranslateId FLD_DATE_ARY[] =
 {
+FLD_DATE_FIX,
 FLD_DATE_STD,
-FLD_DATE_FIX
 };
 
 const TranslateId FLD_TIME_ARY[] =
 {
-FLD_TIME_STD,
-FLD_TIME_FIX
+FLD_TIME_FIX,
+FLD_TIME_STD
 };
 
 const TranslateId FMT_NUM_ARY[] =


[Libreoffice-commits] core.git: sw/inc sw/source writerfilter/source

2023-10-20 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 -
 sw/source/core/doc/DocumentSettingManager.cxx |   11 ---
 sw/source/core/inc/DocumentSettingManager.hxx |1 -
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   13 -
 writerfilter/source/filter/WriterFilter.cxx   |1 -
 5 files changed, 27 deletions(-)

New commits:
commit 5e7f7917fd589f661982d481a45bf84337e4c03c
Author: Miklos Vajna 
AuthorDate: Fri Oct 20 12:12:44 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 20 14:15:20 2023 +0200

sw floattable: remove now unused FloattableNomargins compat flag

This was noop since commit 626fe9ab5ebebc4ef36e35f4aa597c03a3564d22
(tdf#157573 sw floattable: fix incorrect lack of left margin after
table, 2023-10-18).

Change-Id: I89a197313ac4ffbcff9bbff534e5411085282ac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158237
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index b8077ea9ad56..b8088440163d 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -106,7 +106,6 @@ enum class DocumentSettingId
 KERN_ASIAN_PUNCTUATION,
 MATH_BASELINE_ALIGNMENT,
 STYLES_NODEFAULT,
-FLOATTABLE_NOMARGINS,
 EMBED_FONTS,
 EMBED_USED_FONTS,
 EMBED_LATIN_SCRIPT_FONTS,
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 86aa3ede7e81..ebe116c68276 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -62,7 +62,6 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbUseHiResolutionVirtualDevice(true),
 mbMathBaselineAlignment(false), // default for *old* documents is 'off'
 mbStylesNoDefault(false),
-mbFloattableNomargins(false),
 mEmbedFonts(false),
 mEmbedUsedFonts(false),
 mEmbedLatinScriptFonts(true),
@@ -230,7 +229,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return 
mbDoNotResetParaAttrsForNumFont;
 case DocumentSettingId::MATH_BASELINE_ALIGNMENT: return 
mbMathBaselineAlignment;
 case DocumentSettingId::STYLES_NODEFAULT: return mbStylesNoDefault;
-case DocumentSettingId::FLOATTABLE_NOMARGINS: return 
mbFloattableNomargins;
 case DocumentSettingId::EMBED_FONTS: return mEmbedFonts;
 case DocumentSettingId::EMBED_USED_FONTS: return mEmbedUsedFonts;
 case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS: return 
mEmbedLatinScriptFonts;
@@ -509,9 +507,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 case DocumentSettingId::STYLES_NODEFAULT:
 mbStylesNoDefault  = value;
 break;
-case DocumentSettingId::FLOATTABLE_NOMARGINS:
-mbFloattableNomargins = value;
-break;
 case DocumentSettingId::EMBED_FONTS:
 mEmbedFonts = value;
 break;
@@ -700,7 +695,6 @@ void 
sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
 mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
 mbMathBaselineAlignment = rSource.mbMathBaselineAlignment;
 mbStylesNoDefault = rSource.mbStylesNoDefault;
-mbFloattableNomargins = rSource.mbFloattableNomargins;
 mbOldNumbering = rSource.mbOldNumbering;
 mbIgnoreFirstLineIndentInNumbering = 
rSource.mbIgnoreFirstLineIndentInNumbering;
 mbDoNotJustifyLinesWithManualBreak = 
rSource.mbDoNotJustifyLinesWithManualBreak;
@@ -875,11 +869,6 @@ void 
sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
 
BAD_CAST(OString::boolean(mbStylesNoDefault).getStr()));
 (void)xmlTextWriterEndElement(pWriter);
 
-(void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("mbFloattableNomargins"));
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
-
BAD_CAST(OString::boolean(mbFloattableNomargins).getStr()));
-(void)xmlTextWriterEndElement(pWriter);
-
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbOldNumbering"));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
 
BAD_CAST(OString::boolean(mbOldNumbering).getStr()));
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 
b/sw/source/core/inc/DocumentSettingManager.hxx
index 34b26c476e28..284dccf9cf37 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -122,7 +122,6 @@ class DocumentSettingManager final :
 // attribute 
'WrapInfluenceOnObjPos'.
 bool mbMathBaselineAlignment: 1;// TL  2010-10-29 #i972#
 bool mbStylesNoDefault  : 1;
-bool 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

2023-10-17 Thread László Németh (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |2 ++
 sw/qa/core/text/frmform.cxx   |5 +
 sw/qa/extras/ooxmlexport/data/tdf130088.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   11 +++
 sw/source/core/doc/DocumentSettingManager.cxx |   11 +++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/text/guess.cxx |8 
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 9 files changed, 61 insertions(+)

New commits:
commit 7d08767b890e723cd502b1c61d250924f695eb98
Author: László Németh 
AuthorDate: Mon Oct 16 19:39:30 2023 +0200
Commit: László Németh 
CommitDate: Tue Oct 17 10:37:23 2023 +0200

tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.

Writer typeset DOCX files with more lines/pages, because of
new default paragraph justification algorithm of MSO 2013 and
newer, which resulted in losing text layout interoperability
for new DOCX documents.

Add new compatibility option "JustifyLinesWithShrinking" to
store also the new type of justification in OpenDocument files.

First analysis of the unknown justification algorithm shows
up to 2% shrinking of plain justified line. Apply this value
to break the lines in the same (or very similar) positions
during importing a DOCX file with compatibilityMode >= 15
(created in MSO 2013 or newer), to avoid typesetting more lines
and pages.

Note: shrinking will be added by the next commits, fixing
the temporary exceeding lines.

Change-Id: I9a00db888e9af3f6723e4c502158e8e56a00ef02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158063
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 8e5e3a587997..b8077ea9ad56 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -94,6 +94,8 @@ enum class DocumentSettingId
 HYPHENATE_URLS, ///< tdf#152952
 DO_NOT_BREAK_WRAPPED_TABLES,
 ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
+// tdf#119908 new paragraph justification
+JUSTIFY_LINES_WITH_SHRINKING,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index ee791f325729..b321fca51cee 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -63,6 +63,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableNegativeVertOffset)
 CPPUNIT_ASSERT_LESS(pPara2->getFrameArea().Top(), rFlyRect.Bottom());
 }
 
+// FIXME: because breaking the lines at the right place, this test
+// became obsolete: proposed fix is to modify compatibilityMode to "14"
+// in the DOCX test file to use the old justification algorithm
+#if 0
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 {
 // Given a document with a 6-page floating table and some anchor text:
@@ -81,6 +85,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 // anchors of non-last split fly frames should contain no text.
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pAnchor->GetOffset().get());
 }
+#endif
 
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidLastManipOfst)
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf130088.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130088.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index dd0c1a75e48f..704166e695a5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1397,6 +1397,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146346, "tdf146346.docx")
 }
 #endif
 
+DECLARE_OOXMLEXPORT_TEST(testTdf130088, "tdf130088.docx")
+{
+// This was 2 (justification without shrinking resulted more lines)
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// check compatibility option in ODT export/import, too
+saveAndReload("writer8");
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, 
"cont-sect-break-header-footer.docx")
 {
 // Load a document with a continuous section break on page 2.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 53bd26fa9d08..86aa3ede7e81 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -255,6 +255,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case 

[Libreoffice-commits] core.git: sw/inc

2023-10-15 Thread khushishikhu (via logerrit)
 sw/inc/calbck.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit db0681effb0f04dc0f7ad39fa9410dfb7c647d95
Author: khushishikhu 
AuthorDate: Sat Oct 14 13:03:34 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Sun Oct 15 12:08:09 2023 +0200

tdf#143148 use pragma once and removed include guards

Change-Id: I02ebab47905eaaab0d7f34fa0416b5bbbe8e1b09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157973
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 2f0d2d17bcbc..0538ea99265c 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SW_INC_CALBCK_HXX
-#define INCLUDED_SW_INC_CALBCK_HXX
+#pragma once
 
 #include 
 
@@ -428,6 +427,4 @@ SwClient::SwClient( SwModify* pToRegisterIn )
 pToRegisterIn->Add(this);
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-14 Thread EMartinGube (via logerrit)
 sw/inc/editsh.hxx   |4 +++
 sw/source/core/edit/eddel.cxx   |   46 
 sw/source/core/edit/edlingu.cxx |   15 ---
 sw/source/uibase/shells/textsh1.cxx |   23 ++
 4 files changed, 54 insertions(+), 34 deletions(-)

New commits:
commit 6da9d629f7f17ec569e7fb6d0f1931dd410b1d28
Author: EMartinGube 
AuthorDate: Thu Jul 20 23:33:37 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sun Oct 15 07:42:07 2023 +0200

tdf#156250: sw: Keep comments when spell correction replaces a word

New method SwEditShell:ReplaceKeepComments for comment preserving
spell correction.

Change-Id: Ifdb9d5664ab8d457a16ad8f7ec62dd968c89d580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154761
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 8fc1afb9483a..a3b181440237 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -172,6 +172,10 @@ public:
--> "xx\t..zzz..&" */
 bool Replace( const OUString& rNewStr, bool bRegExpRplc );
 
+/** Replace a selected range in a TextNode by given string.
+ Possible comments will be kept (moved to the end of the selection). */
+bool ReplaceKeepComments( const OUString& rNewStr);
+
 /** Delete content of all ranges.
  If whole nodes are selected, these nodes get deleted. */
 bool Delete(bool isArtificialSelection = false);
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 10d086bbac63..989cddfd3a28 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -359,6 +359,52 @@ bool SwEditShell::Replace( const OUString& rNewStr, bool 
bRegExpRplc )
 return bRet;
 }
 
+/** Replace a selected area in a text node with a given string.
+ *
+ * Method to replace a text selection with a new string while
+ * keeping possible comments (they will be moved to the end
+ * of the selection).
+ *
+ * @param rNewStr the new string which the selected area is to be replaced 
with
+ * @returntrue, if something has been replaced, false otherwise.
+ */
+bool SwEditShell::ReplaceKeepComments( const OUString& rNewStr)
+{
+bool bRet   = false;
+SwPaM *pCursor  = GetCursor();
+
+if(pCursor != nullptr)
+{
+// go sure that the text selection pointed to by pCursor is valid
+if(pCursor->HasMark())
+{
+// preserve comments inside of the number by deleting number 
portions starting from the back
+OUString aSelectedText = pCursor->GetText();
+sal_Int32 nCommentPos(aSelectedText.lastIndexOf(CH_TXTATR_INWORD));
+// go sure that we have a valid selection and a comment has been 
found
+while((nCommentPos > -1) && (aSelectedText.getLength() > 0) && 
(pCursor->HasMark()))
+{
+// select the part of the text after the last found comment
+// selection start:
+pCursor->GetPoint()->AdjustContent(nCommentPos + 1);
+// selection end ist left where it is -> will be adjusted 
later on
+// delete the part of the word after the last found comment
+Replace(OUString(), false);
+// put the selection start back to the beginning of the word
+pCursor->GetPoint()->AdjustContent(-(nCommentPos + 1));
+// adjust the selection end, so that the last comment is no 
longer selected:
+pCursor->GetMark()->AdjustContent(-1);
+// search for the next possible comment
+aSelectedText = pCursor->GetText();
+nCommentPos = aSelectedText.lastIndexOf(CH_TXTATR_INWORD);
+}
+bRet = Replace(rNewStr, false);
+}
+}
+
+return bRet;
+}
+
 /// special method for JOE's wizards
 bool SwEditShell::DelFullPara()
 {
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index ab89fc5b7241..63ea37ba8233 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1167,20 +1167,7 @@ void SwEditShell::ApplyChangedSentence(const 
svx::SpellPortions& rNewPortions, b
 
 // if there is a comment inside the original word, don't 
delete it:
 // but keep it at the end of the replacement
-// TODO: keep all the comments with a recursive function
-sal_Int32 
nCommentPos(pCursor->GetText().indexOf(OUStringChar(CH_TXTATR_INWORD)));
-if ( nCommentPos > -1 )
-{
-// delete the original word after the comment
-pCursor->GetPoint()->AdjustContent(nCommentPos + 1);
-
-
mxDoc->getIDocumentContentOperations().ReplaceRange(*pCursor, OUString(), 
false);
-// and select only the remaining part before the comment
-

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-10-14 Thread Attila Szűcs (via logerrit)
 sw/inc/IDocumentRedlineAccess.hxx  |   16 
 sw/inc/redline.hxx |2 
 sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt |binary
 sw/qa/extras/uiwriter/uiwriter5.cxx|   62 ++
 sw/source/core/doc/DocumentRedlineManager.cxx  |  274 
+-
 sw/source/core/doc/docredln.cxx|   35 +
 sw/source/core/edit/edredln.cxx|4 
 sw/source/core/inc/DocumentRedlineManager.hxx  |   19 
 sw/source/core/inc/UndoCore.hxx|4 
 sw/source/core/inc/UndoRedline.hxx |   10 
 sw/source/core/undo/undobj.cxx |4 
 sw/source/core/undo/unredln.cxx|   25 
 12 files changed, 419 insertions(+), 36 deletions(-)

New commits:
commit 52fa7aed48632166e064e6a227e034f0981c4205
Author: Attila Szűcs 
AuthorDate: Mon Aug 28 07:40:20 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sat Oct 14 11:55:27 2023 +0200

tdf#157662 SW: redline: accept/reject done for all parts

Tracked changes divided into smaller parts when they are
overlapping. But if the Author, and Change time, and some more
is equal, then they can be combined into 1 change later..

Modified AcceptRedline / RejectRedline, to seek for all these parts
that are neightbour to each other, and can be combined, and
reject/accept them all at once. Even those that are deepen in the tree.
i.e.: insert that have a delete redline too.

when rejecting an insert redline, that have a delete redline too,
the delete redline is accepted instead. (have the same result.)

when accepting an insert redline, that have a delete redline too,
The delete redline remains, while the insert is deleted. (=accepted)

made some limitations to lessen the probability of regression:
No anonym, No table, No seqNo, and dont use it in RejectAll/AcceptAll

Added unittest to check that accept/reject handle more redlines
at once, but not too many..

Change-Id: Ibd0a39f7847b22b279a797babb30ba162e70a513
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157950
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/IDocumentRedlineAccess.hxx 
b/sw/inc/IDocumentRedlineAccess.hxx
index 73f87fa8c799..c2b71aa1005a 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -183,15 +183,23 @@ public:
 
 virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
 
-virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, 
/*[in]*/bool bCallDelete) = 0;
+virtual bool AcceptRedline(/*[in]*/ SwRedlineTable::size_type nPos, 
/*[in]*/ bool bCallDelete,
+   /*[in]*/ bool bRange = false)
+= 0;
 
-virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool 
bCallDelete) = 0;
+virtual bool AcceptRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool 
bCallDelete,
+   /*[in]*/ sal_Int8 nDepth = 0)
+= 0;
 
 virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) 
= 0;
 
-virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, 
/*[in]*/bool bCallDelete) = 0;
+virtual bool RejectRedline(/*[in]*/ SwRedlineTable::size_type nPos,
+   /*[in]*/ bool bCallDelete, /*[in]*/ bool bRange 
= false)
+= 0;
 
-virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool 
bCallDelete) = 0;
+virtual bool RejectRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool 
bCallDelete,
+   /*[in]*/ sal_Int8 nDepth = 0)
+= 0;
 
 virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 
0;
 
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 7ef6b9cad20f..d8eba6480618 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -144,6 +144,7 @@ public:
 void SetMoved() { m_bMoved = true; }
 bool IsMoved() const { return m_bMoved; }
 bool CanCombine( const SwRedlineData& rCmp ) const;
+bool CanCombineForAcceptReject( const SwRedlineData& rCmp ) const;
 
 // ExtraData gets copied, the pointer is therefore not taken over by
 // the RedlineObject
@@ -261,6 +262,7 @@ public:
 
 void PushData( const SwRangeRedline& rRedl, bool bOwnAsNext = true );
 bool PopData();
+bool PopAllDataAfter(int depth);
 
 /**
Returns textual description of a redline data element of
diff --git a/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt 
b/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt
new file mode 100644
index ..d97521559a84
Binary files /dev/null and 

[Libreoffice-commits] core.git: sw/inc

2023-10-13 Thread Federico Gallo Herosa (via logerrit)
 sw/inc/legacyitem.hxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 287339e08d01a11e2d70e12f728ee2bf3e89eee3
Author: Federico Gallo Herosa 
AuthorDate: Fri Oct 13 00:39:36 2023 -0300
Commit: Ilmari Lauhakangas 
CommitDate: Fri Oct 13 10:59:38 2023 +0200

tdf#143148: Use pragma once instead of include guards

Replace include guards in favor of #pragma once. First task for beginners

Change-Id: I0ead6e955c953ec0e9113174797ffb8b9938999f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157901
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/inc/legacyitem.hxx b/sw/inc/legacyitem.hxx
index 9ce879d0118a..5d284c8afecf 100644
--- a/sw/inc/legacyitem.hxx
+++ b/sw/inc/legacyitem.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_SW_LEGACYITEM_HXX
-#define INCLUDED_SW_LEGACYITEM_HXX
+
+#pragma once
 
 #include 
 
@@ -39,6 +39,4 @@ namespace legacy
 }
 }
 
-#endif // INCLUDED_SW_LEGACYITEM_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-10-05 Thread Justin Luth (via logerrit)
 sw/inc/viewopt.hxx |5 
 sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   18 +
 sw/source/uibase/config/viewopt.cxx|6 +
 4 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 27d0c8cbba2a9c2b6aa43e97d56f62d15b3b5bca
Author: Justin Luth 
AuthorDate: Wed Oct 4 10:04:42 2023 -0400
Commit: Miklos Vajna 
CommitDate: Thu Oct 5 19:21:03 2023 +0200

LOKit: always display hidden chars when showing formatting marks

This is related to the request in tdf#107658 to do the same for core.
However, this is something fairly easily doable with an extension
in core, so I'm not in favour of forcing one user's opinion over top
of status quo.

Doing this only for Online.

make CppunitTest_sw_tiledrendering \
CPPUNIT_TEST_NAME=testShowHiddenCharsWhenShowFormatting

Change-Id: I34bbe50dd4bbff92577b18f8a05d2f8dd67ea771
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157562
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index b82b970cb540..b5bf16b5ca22 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -484,10 +484,7 @@ public:
 void SetTreatSubOutlineLevelsAsContent(bool b)
 { m_nCoreOptions.bTreatSubOutlineLevelsAsContent = b; }
 
-bool IsShowHiddenChar(bool bHard = false) const
-{ return !m_bReadonly && m_nCoreOptions.bCharHidden &&
-(m_nCoreOptions.bViewMetachars || bHard); }
-
+bool IsShowHiddenChar(bool bHard = false) const;
 void SetShowHiddenChar( bool b )
 { m_nCoreOptions.bCharHidden = b; }
 
diff --git a/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx 
b/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx
new file mode 100644
index ..0802f6e7d314
Binary files /dev/null and 
b/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 2e43441958f8..b3b6c948d884 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -2971,6 +2971,24 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testPilcrowRedlining)
 comphelper::dispatchCommand(".uno:ControlCodes", {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testShowHiddenCharsWhenShowFormatting)
+{
+// In LOKit, ignore the config setting for
+// Tools - Options - Writer - Formatting Aids - Display Formatting - 
Hidden characters
+// and always show hidden content when showing pilcrow formatting
+
+createSwDoc("hiddenLoremIpsum.docx");
+
+// Since LOKit is active in TiledRendering, turning on "Show formatting" 
will show hidden text.
+comphelper::dispatchCommand(".uno:ControlCodes", {}); // show format marks
+Scheduler::ProcessEventsToIdle();
+
+// Without this patch, no body text would be visible - so only 1 page 
instead of 3.
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+comphelper::dispatchCommand(".uno:ControlCodes", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDoubleUnderlineAndStrikeOut)
 {
 // Load a document where the tracked text moving is visible with
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 93ee5f710653..1e78b1fdac02 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -184,6 +184,12 @@ bool SwViewOption::IsTreatSubOutlineLevelsAsContent() const
 return m_nCoreOptions.bTreatSubOutlineLevelsAsContent;
 }
 
+bool SwViewOption::IsShowHiddenChar(bool bHard) const
+{
+bool bCharHidden = comphelper::LibreOfficeKit::isActive() ? true : 
m_nCoreOptions.bCharHidden;
+return !m_bReadonly && bCharHidden && (m_nCoreOptions.bViewMetachars || 
bHard);
+}
+
 void SwViewOption::DrawRect( OutputDevice *pOut,
  const SwRect , ::Color nCol )
 {


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source uitest/uitest

2023-10-05 Thread Gökay Şatır (via logerrit)
 sw/inc/AnnotationWin.hxx  |2 --
 sw/qa/uitest/navigator/tdf137274.py   |7 ++-
 sw/source/uibase/docvw/AnnotationWin.cxx  |   14 --
 sw/source/uibase/docvw/AnnotationWin2.cxx |2 ++
 sw/source/uibase/docvw/PostItMgr.cxx  |6 --
 uitest/uitest/test.py |3 +++
 6 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit c0187d9f5e6ab5129b6fc4682555f2f8775d6f67
Author: Gökay Şatır 
AuthorDate: Thu Sep 7 16:09:00 2023 +0300
Commit: Miklos Vajna 
CommitDate: Thu Oct 5 16:46:15 2023 +0200

SW comments: Provide parent / child relations without position.

Signed-off-by: Gökay Şatır 
Change-Id: I7acba74ef0717bc07a675be17fc1909680138f00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157019
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 62b20cb352cc..07f3ed8e83f9 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -81,8 +81,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 
 sal_uInt32 MoveCaret();
 
-/// Calculate parent postit id of current annotation window
-sal_uInt32 CalcParent();
 void   InitAnswer(OutlinerParaObject const & rText);
 
 bool IsReadOnlyOrProtected() const;
diff --git a/sw/qa/uitest/navigator/tdf137274.py 
b/sw/qa/uitest/navigator/tdf137274.py
index 5192045b8264..5273ddcb2f91 100644
--- a/sw/qa/uitest/navigator/tdf137274.py
+++ b/sw/qa/uitest/navigator/tdf137274.py
@@ -9,6 +9,7 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict
+import time
 
 class tdf137274(UITestCase):
 
@@ -59,7 +60,11 @@ class tdf137274(UITestCase):
 self.ui_test.wait_until_child_is_available('Comment2')
 
 # xComments needs reassigned after content tree change
-xComments = self.get_item(xContentTree, 'Comments')
+while True:
+xComments = self.get_item(xContentTree, 'Comments')
+if '1' in xComments.getChildren():
+break
+time.sleep(self.ui_test.get_default_sleep())
 self.assertEqual('Comments', get_state_as_dict(xComments)['Text'])
 
 xComments.executeAction("EXPAND", tuple())
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index e57f90532294..5ed6780b455a 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -374,20 +374,6 @@ sal_uInt32 SwAnnotationWin::MoveCaret()
: 1 + CountFollowing();
 }
 
-// returns a non-zero postit parent id, if exists, otherwise 0 for root 
comments
-sal_uInt32 SwAnnotationWin::CalcParent()
-{
-SwTextField* pTextField = mpFormatField->GetTextField();
-if (SwPosition aPosition(pTextField->GetTextNode(), 
pTextField->GetStart());
-aPosition.GetContentIndex() > 0)
-if (const SwTextAttr* pTextAttr = 
pTextField->GetTextNode().GetTextAttrForCharAt(
-aPosition.GetContentIndex() - 1, RES_TXTATR_ANNOTATION))
-if (const SwField* pField = pTextAttr->GetFormatField().GetField())
-if (pField->Which() == SwFieldIds::Postit)
-return static_cast(pField)->GetPostItId();
-return 0;
-}
-
 // counts how many SwPostItField we have right after the current one
 sal_uInt32 SwAnnotationWin::CountFollowing()
 {
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 5e8f7a86886e..6a97433272b6 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1065,6 +1065,8 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 // Get newly created SwPostItField and set its paraIdParent
 auto pPostItField = mrMgr.GetLatestPostItField();
 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
+
pPostItField->SetParentPostItId(GetTopReplyNote()->GetPostItField()->GetPostItId());
+
pPostItField->SetParentName(GetTopReplyNote()->GetPostItField()->GetName());
 }
 break;
 }
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 64579d75124b..64f5ff4f47d5 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -734,7 +734,7 @@ void SwPostItMgr::LayoutPostIts()
 pItem->mpPostIt = pPostIt;
 if (mpAnswer)
 {
-if (static_cast(pPostIt->CalcParent())) 
//do we really have another note in front of this one
+if 
(pPostIt->GetPostItField()->GetParentPostItId() != 0) //do 

[Libreoffice-commits] core.git: sw/inc

2023-10-03 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtsrnd.hxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 1ab4e9eb63bfd07a30c0febe8df4bc34d90d33be
Author: Miklos Vajna 
AuthorDate: Mon Oct 2 20:01:18 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 3 08:17:25 2023 +0200

sw: improve documentation for SwFormatSurround

Mention which item set is expected to contain this and where is the UI.

Change-Id: I63ee57218eb7c4bc9be4430eb90d98bd43739b83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157502
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx
index 77d2a3c9d16d..bb22af094214 100644
--- a/sw/inc/fmtsrnd.hxx
+++ b/sw/inc/fmtsrnd.hxx
@@ -27,7 +27,9 @@
 
 class IntlWrapper;
 
-// SwFormatSurround: How document content under the frame shall behave.
+/// Defines the way you want text to wrap around an object. This pool item can 
appear in a frame
+/// styles and in the item set of an sw::SpzFrameFormat. It's Format -> Image 
-> Properties -> Wrap
+/// on the UI.
 class SW_DLLPUBLIC SwFormatSurround final : public 
SfxEnumItem
 {
 boolm_bAnchorOnly :1;


[Libreoffice-commits] core.git: sw/inc sw/source

2023-10-02 Thread Jim Raykowski (via logerrit)
 sw/inc/view.hxx  |   16 
 sw/source/core/access/AccessibilityIssue.cxx |   86 ++
 sw/source/uibase/uiview/view.cxx |  104 ++-
 3 files changed, 205 insertions(+), 1 deletion(-)

New commits:
commit c603d37223d4f7c3594515fb2bbac22015bc146b
Author: Jim Raykowski 
AuthorDate: Fri Sep 22 16:35:05 2023 -0800
Commit: Jim Raykowski 
CommitDate: Tue Oct 3 06:50:02 2023 +0200

tdf#157370 Bring A11y issue to attention in the document view

when issue is clicked on in the A11y sidebar

Change-Id: I9122e608e88568fa2d91b6cf4616b0f61db8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157200
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index dee2363dedd9..c6add7e23364 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -32,6 +32,8 @@
 #include "swtypes.hxx"
 #include "shellid.hxx"
 
+#include 
+
 class SwTextFormatColl;
 class SwPageDesc;
 class SwFrameFormat;
@@ -68,6 +70,7 @@ enum class SotExchangeDest;
 class SwCursorShell;
 enum class SvxSearchCmd;
 enum class SelectionType : sal_Int32;
+class SwNode;
 
 namespace com::sun::star::view { class XSelectionSupplier; }
 namespace sfx2 { class FileDialogHelper; }
@@ -716,6 +719,19 @@ public:
 virtual std::optional getLOKPayload(int nType, int nViewId) const 
override;
 
 bool IsHighlightCharDF() { return m_bIsHighlightCharDF; }
+
+private:
+AutoTimer m_aBringToAttentionBlinkTimer;
+size_t m_nBringToAttentionBlinkTimeOutsRemaining;
+
+std::unique_ptr 
m_xBringToAttentionOverlayObject;
+
+DECL_LINK(BringToAttentionBlinkTimerHdl, Timer*, void);
+
+public:
+void BringToAttention(std::vector&& aRanges = {});
+void BringToAttention(const tools::Rectangle& rRect);
+void BringToAttention(const SwNode* pNode);
 };
 
 inline tools::Long SwView::GetXScroll() const
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index 6ec39238cda9..8056408a5b02 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -28,6 +28,11 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+
 namespace sw
 {
 AccessibilityIssue::AccessibilityIssue(sfx::AccessibilityIssueID eIssueID)
@@ -75,6 +80,21 @@ void AccessibilityIssue::gotoIssue() const
 {
 SwWrtShell* pWrtShell = 
TempIssueObject.m_pDoc->GetDocShell()->GetWrtShell();
 bool bSelected = pWrtShell->GotoFly(TempIssueObject.m_sObjectID, 
FLYCNTTYPE_ALL, true);
+
+// bring issue to attention
+if (bSelected)
+{
+if (const SwFlyFrameFormat* pFlyFormat
+= m_pDoc->FindFlyByName(TempIssueObject.m_sObjectID, 
SwNodeType::NONE))
+{
+if (SwFlyFrame* pFlyFrame
+= SwIterator(*pFlyFormat).First())
+{
+
pWrtShell->GetView().BringToAttention(pFlyFrame->getFrameArea().SVRect());
+}
+}
+}
+
 if (bSelected && pWrtShell->IsFrameSelected())
 {
 pWrtShell->HideCursor();
@@ -82,8 +102,19 @@ void AccessibilityIssue::gotoIssue() const
 }
 
 if (!bSelected && TempIssueObject.m_eIssueObject == 
IssueObject::TEXTFRAME)
+{
 pWrtShell->GotoDrawingObject(TempIssueObject.m_sObjectID);
 
+// bring issue to attention
+if (SdrPage* pPage
+= 
pWrtShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0))
+{
+if (SdrObject* pObj = 
pPage->GetObjByName(TempIssueObject.m_sObjectID))
+{
+
pWrtShell->GetView().BringToAttention(pObj->GetLogicRect());
+}
+}
+}
 if (comphelper::LibreOfficeKit::isActive())
 pWrtShell->ShowCursor();
 }
@@ -94,6 +125,17 @@ void AccessibilityIssue::gotoIssue() const
 if (pWrtShell->IsFrameSelected())
 pWrtShell->LeaveSelFrameMode();
 pWrtShell->GotoDrawingObject(TempIssueObject.m_sObjectID);
+
+// bring issue to attention
+if (SdrPage* pPage
+= 
pWrtShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0))
+{
+if (SdrObject* pObj = 
pPage->GetObjByName(TempIssueObject.m_sObjectID))
+{
+
pWrtShell->GetView().BringToAttention(pObj->GetLogicRect());
+}
+}
+
 if (comphelper::LibreOfficeKit::isActive())
 pWrtShell->ShowCursor();
 }
@@ -107,6 +149,17 @@ void AccessibilityIssue::gotoIssue() const
 if (!bIsDesignMode)
 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-09-28 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   79 +++
 sw/source/core/doc/tblrwcl.cxx   |9 ++-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |8 +--
 sw/source/uibase/dochdl/swdtflvr.cxx |   16 ---
 8 files changed, 98 insertions(+), 29 deletions(-)

New commits:
commit 65efbf64cfa30ba96bc9f0ba539eb1414b861c49
Author: László Németh 
AuthorDate: Thu Sep 28 17:32:24 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 28 22:50:35 2023 +0200

tdf#157492 sw: fix tracked drag & drop of table row

Selecting table rows by the left row border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 3e6125c72f8c07c14df42d45571cab44f24e9f70
"tdf#155846 sw tracked table column: fix drag & drop".

This reverts also commit 5a1c19624eda0c8b847af0dcee70b82502578ceb
"tdf#146965 sw track changes: fix tracked table row moving".

Change-Id: I7287e46188eee123b5fd36a5ec7ac5311699840b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157382
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ba05ef371056..5fd6b58064c3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1208,7 +1208,7 @@ public:
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 
 // Delete Columns/Rows in table.
 enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 
2 };
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index a7d1bd87d4d4..3d0a5732d188 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -167,7 +167,7 @@ private:
 bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
-bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
+bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind, 
bool bInsertDummy );
 bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
@@ -254,7 +254,7 @@ public:
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy = true );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
 bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* 
pMerged,
 SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 5ef637c356e6..a02ebf08c6a0 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -926,6 +926,85 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf147181_TrackedMovingOfMultipleTable
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable2b->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157492_TrackedMovingRow)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 3; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xCellA1(xTable1->getCellByName("A1"), 
uno::UNO_QUERY);
+xCellA1->setString("A1");
+uno::Reference xCellB1(xTable1->getCellByName("B1"), 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-09-28 Thread László Németh (via logerrit)
 sw/inc/doc.hxx   |2 
 sw/inc/swtable.hxx   |4 -
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   82 +++
 sw/source/core/doc/tblrwcl.cxx   |5 +-
 sw/source/core/docnode/ndtbl.cxx |4 -
 sw/source/core/frmedt/fetab.cxx  |5 +-
 sw/source/core/table/swnewtable.cxx  |   12 +++--
 sw/source/uibase/dochdl/swdtflvr.cxx |6 +-
 8 files changed, 105 insertions(+), 15 deletions(-)

New commits:
commit 3e6125c72f8c07c14df42d45571cab44f24e9f70
Author: László Németh 
AuthorDate: Wed Sep 27 22:10:15 2023 +0200
Commit: László Németh 
CommitDate: Thu Sep 28 17:34:34 2023 +0200

tdf#155846 sw tracked table column: fix drag & drop

Selecting table columns by the top border, and
moving them via drag & drop resulted only tracked
deletion, but not tracked insertion.

See also commit 912336f3c85d9a631fa0ac0f270bab04b204f619
"tdf#154599 sw: fix crash at drag & drop table columns".

Change-Id: Ib392f0700ec8c17a342df435c8bb1883967b0711
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157370
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a84df42b8c87..ba05ef371056 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1204,7 +1204,7 @@ public:
 void InsertCol( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertCol( const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt = 1, bool bBehind = true );
+sal_uInt16 nCnt = 1, bool bBehind = true, bool 
bInsertDummy = true );
 void InsertRow( const SwCursor& rCursor,
 sal_uInt16 nCnt = 1, bool bBehind = true );
 bool InsertRow( const SwSelBoxes& rBoxes,
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index e8b4ad35602f..a7d1bd87d4d4 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -168,7 +168,7 @@ private:
 std::optional CollectBoxSelection( const SwPaM& rPam ) 
const;
 void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
 bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind 
);
-bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool 
);
+bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, 
bool, bool bInsertDummy );
 void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* 
);
 void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
 void NewSetTabCols( Parm , const SwTabCols , const SwTabCols ,
@@ -252,7 +252,7 @@ public:
 void PrepareDeleteCol( tools::Long nMin, tools::Long nMax );
 
 bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
-sal_uInt16 nCnt, bool bBehind );
+sal_uInt16 nCnt, bool bBehind, bool bInsertDummy );
 bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
 sal_uInt16 nCnt, bool bBehind );
 void PrepareDelBoxes( const SwSelBoxes& rBoxes );
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index f1f349779dac..5ef637c356e6 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -975,6 +975,88 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testTdf154599_MovingColumn)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155846_MovingColumn)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Create a table
+SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+(void)>InsertTable(TableOpt, 4, 3);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable1->getColumns()->getCount());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// fill table with data
+for (int i = 0; i < 4; ++i)
+{
+pWrtShell->Insert("x");
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+}
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xCellA1(xTable1->getCellByName("A1"), 
uno::UNO_QUERY);
+xCellA1->setString("A1");
+uno::Reference xCellA2(xTable1->getCellByName("A2"), 
uno::UNO_QUERY);
+xCellA2->setString("A2");
+uno::Reference xCellA3(xTable1->getCellByName("A3"), 
uno::UNO_QUERY);
+xCellA3->setString("A3");
+uno::Reference xCellA4(xTable1->getCellByName("A4"), 
uno::UNO_QUERY);
+xCellA4->setString("A4");
+
+

[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-27 Thread Noel Grandin (via logerrit)
 sw/inc/swatrset.hxx|1 
 sw/source/core/attr/swatrset.cxx   |8 ++
 sw/source/core/doc/doclay.cxx  |  114 +
 sw/source/core/model/ThemeColorChanger.cxx |   40 +-
 sw/source/ui/dialog/uiregionsw.cxx |   18 ++--
 5 files changed, 93 insertions(+), 88 deletions(-)

New commits:
commit 8eb53f735eba218b6911e7aa5a805972dfb54809
Author: Noel Grandin 
AuthorDate: Wed Sep 27 16:47:13 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 27 19:13:04 2023 +0200

reduce allocation when cloning SwAttrSet

Change-Id: Ic37355cd2a6091576426c48ff694023e24ae6342
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157334
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 64841ade79c9..667121f35327 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -183,6 +183,7 @@ public:
 SwAttrSet( const SwAttrSet& );
 
 virtual std::unique_ptr Clone(bool bItems = true, SfxItemPool 
*pToPool = nullptr) const override;
+SwAttrSet CloneAsValue(bool bItems = true) const;
 
 bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
 bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 7821f9db366d..6d778c1cb6b2 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -222,6 +222,14 @@ std::unique_ptr SwAttrSet::Clone( bool bItems, 
SfxItemPool *pToPool
 : new SwAttrSet( *GetPool(), GetRanges() ));
 }
 
+SwAttrSet SwAttrSet::CloneAsValue( bool bItems ) const
+{
+if (bItems)
+return *this;
+else
+return SwAttrSet( *GetPool(), GetRanges() );
+}
+
 bool SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
SwAttrSet* pOld, SwAttrSet* pNew )
 {
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index b6398ee8ce7f..c9881b848d29 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -741,19 +741,19 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const 
pTextFormatCollTable,
 
 /* #i6447#: Only the selected items are copied from the old
format. */
-std::unique_ptr pNewSet = 
pNewFormat->GetAttrSet().Clone();
+SwAttrSet aNewSet = pNewFormat->GetAttrSet().CloneAsValue();
 
 // Copy only the set attributes.
 // The others should apply from the Templates.
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_PRINT );
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_OPAQUE );
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_PROTECT );
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_SURROUND 
);
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), 
RES_VERT_ORIENT );
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), 
RES_HORI_ORIENT );
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_LR_SPACE 
);
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), RES_UL_SPACE 
);
-lcl_CpyAttr( *pNewSet, pOldFormat->GetAttrSet(), 
RES_BACKGROUND );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_PRINT );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_OPAQUE );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_PROTECT );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_SURROUND );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), 
RES_VERT_ORIENT );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), 
RES_HORI_ORIENT );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_LR_SPACE );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_UL_SPACE );
+lcl_CpyAttr( aNewSet, pOldFormat->GetAttrSet(), RES_BACKGROUND 
);
 if( bCpyBrd )
 {
 // If there's no BoxItem at graphic, but the new Format 
has one, then set the
@@ -761,40 +761,40 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const 
pTextFormatCollTable,
 const SfxPoolItem *pItem;
 if( SfxItemState::SET == pOldFormat->GetAttrSet().
 GetItemState( RES_BOX, true,  ))
-pNewSet->Put( *pItem );
+aNewSet.Put( *pItem );
 else if( SfxItemState::SET == pNewFormat->GetAttrSet().
 GetItemState( RES_BOX ))
-pNewSet->Put( *GetDfltAttr( RES_BOX ) );
+aNewSet.Put( *GetDfltAttr( RES_BOX ) );
 
 if( SfxItemState::SET == pOldFormat->GetAttrSet().
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-27 Thread Noel Grandin (via logerrit)
 sw/inc/istyleaccess.hxx   |5 +++
 sw/inc/node.hxx   |4 +-
 sw/source/core/doc/swstylemanager.cxx |   15 ++
 sw/source/core/docnode/node.cxx   |   50 +-
 4 files changed, 47 insertions(+), 27 deletions(-)

New commits:
commit c2ab40af9efd19d386a486a934986731b7a80d6d
Author: Noel Grandin 
AuthorDate: Wed Sep 27 13:14:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 27 14:20:24 2023 +0200

pass SwAttrSet around explicitly

instead of using SfxItemSet and static_cast'ing it everywhere

Change-Id: I12d1a6bd2dec7035fa16206ea01346a3a73c1457
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157309
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/istyleaccess.hxx b/sw/inc/istyleaccess.hxx
index b547d55bac56..755f10bf15d8 100644
--- a/sw/inc/istyleaccess.hxx
+++ b/sw/inc/istyleaccess.hxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+class SwAttrSet;
+
 // Management of (automatic) styles
 class IStyleAccess
 {
@@ -40,6 +42,9 @@ public:
 virtual std::shared_ptr getAutomaticStyle( const SfxItemSet& 
rSet,

SwAutoStyleFamily eFamily,
const OUString* 
pParentName = nullptr ) = 0;
+virtual std::shared_ptr getAutomaticStyle( const SwAttrSet& 
rSet,
+   
SwAutoStyleFamily eFamily,
+   const OUString* 
pParentName = nullptr ) = 0;
 virtual void getAllStyles( std::vector> 
,

SwAutoStyleFamily eFamily ) = 0;
 /** It's slow to iterate through a stylepool looking for a special name, 
but if
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 79d1a3792935..de7e24a0b152 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -410,7 +410,7 @@ protected:
 
 /**  Attribute-set for all auto attributes of a ContentNode.
   (e.g. TextNode or NoTextNode). */
-std::shared_ptr mpAttrSet;
+std::shared_ptr mpAttrSet;
 
 /// Make respective nodes create the specific AttrSets.
 virtual void NewAttrSet( SwAttrPool& ) = 0;
@@ -490,7 +490,7 @@ public:
 /** Does node has already its own auto-attributes?
  Access to SwAttrSet. */
 inline const SwAttrSet () const;
-const SwAttrSet *GetpSwAttrSet() const { return static_cast(mpAttrSet.get()); }
+const SwAttrSet *GetpSwAttrSet() const { return mpAttrSet.get(); }
 bool  HasSwAttrSet() const { return mpAttrSet != nullptr; }
 
 virtual SwFormatColl* ChgFormatColl( SwFormatColl* );
diff --git a/sw/source/core/doc/swstylemanager.cxx 
b/sw/source/core/doc/swstylemanager.cxx
index 7f73555fc8ff..6372ab10c89d 100644
--- a/sw/source/core/doc/swstylemanager.cxx
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -72,6 +72,9 @@ public:
 virtual std::shared_ptr getAutomaticStyle( const SfxItemSet& 
rSet,

IStyleAccess::SwAutoStyleFamily eFamily,
const OUString* 
pParentName = nullptr ) override;
+virtual std::shared_ptr getAutomaticStyle( const SwAttrSet& 
rSet,
+   
IStyleAccess::SwAutoStyleFamily eFamily,
+   const OUString* 
pParentName = nullptr ) override;
 virtual std::shared_ptr getByName( const OUString& rName,

IStyleAccess::SwAutoStyleFamily eFamily ) override;
 virtual void getAllStyles( std::vector> 
,
@@ -104,6 +107,18 @@ std::shared_ptr 
SwStyleManager::getAutomaticStyle( const SfxItemSet&
 return rAutoPool.insertItemSet( rSet, pParentName );
 }
 
+std::shared_ptr SwStyleManager::getAutomaticStyle( const SwAttrSet& 
rSet,
+   
IStyleAccess::SwAutoStyleFamily eFamily,
+   const 
OUString* pParentName )
+{
+StylePool& rAutoPool
+= eFamily == IStyleAccess::AUTO_STYLE_CHAR ? m_aAutoCharPool : 
m_aAutoParaPool;
+std::shared_ptr pItemSet = rAutoPool.insertItemSet( rSet, 
pParentName );
+std::shared_ptr pAttrSet = 
std::dynamic_pointer_cast(pItemSet);
+assert(bool(pItemSet) == bool(pAttrSet) && "types do not match");
+return pAttrSet;
+}
+
 std::shared_ptr SwStyleManager::cacheAutomaticStyle( const 
SfxItemSet& rSet,

IStyleAccess::SwAutoStyleFamily eFamily )
 {
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index c9abe227643a..6cfab7801f43 100644
--- a/sw/source/core/docnode/node.cxx
+++ 

[Libreoffice-commits] core.git: sw/inc

2023-09-19 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtclds.hxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit f2f32aaa839b25a2413928b7b92fff3d71034508
Author: Miklos Vajna 
AuthorDate: Mon Sep 18 20:22:59 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 19 08:34:49 2023 +0200

sw: document SwFormatCol

It's not too obvious that you can have columns directly inside the body
text as well, not only inside a UI-level section.

Change-Id: I8194aa472fd1d515552dddbe6d14a3d38fa5c1ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157030
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx
index d560561d2c15..d2b34192b48d 100644
--- a/sw/inc/fmtclds.hxx
+++ b/sw/inc/fmtclds.hxx
@@ -64,6 +64,10 @@ enum SwColLineAdj
 COLADJ_BOTTOM
 };
 
+/// This pool item subclass can appear in the item set of an SwPageDesc, and 
contains settings
+/// visible on the UI via Format -> Page Style -> Columns tab.
+/// It can also appear in the item set of an SwSectionFormat, and then 
contains settings visible on
+/// the UI via Format -> Sections -> Options -> Columns tab.
 class SW_DLLPUBLIC SwFormatCol final : public SfxPoolItem
 {
 SvxBorderLineStyle m_eLineStyle; ///< style of the separator line


[Libreoffice-commits] core.git: sw/inc

2023-09-12 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtfld.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 8232cae49bc20ddff3047c363233e85c407055aa
Author: Miklos Vajna 
AuthorDate: Mon Sep 11 20:09:30 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 12 08:26:30 2023 +0200

sw: document SwFormatField

Note that SwField is abstract, so in practice this always wraps a
subclass, e.g. SwPageNumberField has an actual ExpandImpl() definition.

Change-Id: I579cc9f2f9d1f64885512bceabc2fc684b8c3701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156828
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index ba23014a1f82..0c8d5fda7110 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -95,7 +95,8 @@ namespace sw {
 }
 
 
-// ATT_FLD
+/// SfxPoolItem subclass that is a wrapper around an SwField, i.e. one 
inserted field into paragraph
+/// text. Typically owned by an SwTextField.
 class SW_DLLPUBLIC SwFormatField final
 : public SfxPoolItem
 , public sw::BroadcastingModify


[Libreoffice-commits] core.git: sw/inc

2023-09-09 Thread Noel Grandin (via logerrit)
 sw/inc/unosett.hxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 43ad56252d788dd1e7f4a14d07662e5b1854adee
Author: Noel Grandin 
AuthorDate: Fri Sep 8 15:01:24 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 9 11:54:05 2023 +0200

SwXFootnoteProperties does not need to implement XAggreggation

Checked on jenkins using 'make check' and

+void SAL_CALL setDelegator(css::uno::Reference const 
&) final { assert(false); }

WIP SwXFootnoteProperties

Change-Id: Id1e1a0195e770bcbcebd9b55355de230c8641547
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156725
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index 590046b97412..7cc4794e8dff 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -29,8 +29,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include "unobaseclass.hxx"
 
 class SwDoc;
@@ -41,7 +40,7 @@ class SwNumFormat;
 class SfxItemPropertySet;
 namespace com::sun::star::beans { struct PropertyValue; }
 
-class SwXFootnoteProperties final : public cppu::WeakAggImplHelper2
+class SwXFootnoteProperties final : public cppu::WeakImplHelper
 <
 css::beans::XPropertySet,
 css::lang::XServiceInfo
@@ -71,7 +70,7 @@ public:
 voidInvalidate() {m_pDoc = nullptr;}
 };
 
-class SwXEndnoteProperties final : public cppu::WeakAggImplHelper2
+class SwXEndnoteProperties final : public cppu::WeakImplHelper
 <
 css::beans::XPropertySet,
 css::lang::XServiceInfo
@@ -101,7 +100,7 @@ public:
 voidInvalidate() {m_pDoc = nullptr;}
 };
 
-class SwXLineNumberingProperties final : public cppu::WeakAggImplHelper2
+class SwXLineNumberingProperties final : public cppu::WeakImplHelper
 <
 css::beans::XPropertySet,
 css::lang::XServiceInfo
@@ -131,7 +130,7 @@ public:
 voidInvalidate() {m_pDoc = nullptr;}
 };
 
-class SwXNumberingRules : public cppu::WeakAggImplHelper4
+class SwXNumberingRules : public cppu::WeakImplHelper
 <
 css::container::XIndexReplace,
 css::beans::XPropertySet,


[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-08 Thread Miklos Vajna (via logerrit)
 sw/inc/redline.hxx  |2 +
 sw/source/core/doc/docredln.cxx |   54 +---
 2 files changed, 37 insertions(+), 19 deletions(-)

New commits:
commit edd121dd668e141cd61f0992340fa07eb6df8e76
Author: Miklos Vajna 
AuthorDate: Thu Sep 7 20:09:15 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 8 08:15:13 2023 +0200

sw doc model xml dump: show all redline data of a range redline

E.g. Alice does an insert, then Bob does a delete in the middle, then
the deletion redline will have 2 redline data, the first will be the
delete, the second will be the original insert, show this in the xml
dump.

Change-Id: Ide9777cdbc8a5460fe28c646104901c968a33382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156680
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 1fccb405e192..7ef6b9cad20f 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -157,6 +157,8 @@ public:
 void SetSeqNo( sal_uInt16 nNo ) { m_nSeqNo = nNo; }
 
 OUString GetDescr() const;
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 class SW_DLLPUBLIC SwRangeRedline final : public SwPaM
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 54d853065629..752de518accb 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1141,6 +1141,37 @@ OUString SwRedlineData::GetDescr() const
 return SwResId(STR_REDLINE_ARY[static_cast(GetType())]);
 }
 
+void SwRedlineData::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwRedlineData"));
+
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), 
BAD_CAST(OString::number(GetSeqNo()).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), 
BAD_CAST(SW_MOD()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), 
BAD_CAST(DateTimeToOString(GetTimeStamp()).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("descr"), 
BAD_CAST(GetDescr().toUtf8().getStr()));
+
+OString sRedlineType;
+switch (GetType())
+{
+case RedlineType::Insert:
+sRedlineType = "REDLINE_INSERT";
+break;
+case RedlineType::Delete:
+sRedlineType = "REDLINE_DELETE";
+break;
+case RedlineType::Format:
+sRedlineType = "REDLINE_FORMAT";
+break;
+default:
+sRedlineType = "UNKNOWN";
+break;
+}
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(sRedlineType.getStr()));
+
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 sal_uInt32 SwRangeRedline::s_nLastId = 1;
 
 SwRangeRedline::SwRangeRedline(RedlineType eTyp, const SwPaM& rPam )
@@ -2073,28 +2104,13 @@ void SwRangeRedline::dumpAsXml(xmlTextWriterPtr 
pWriter) const
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwRangeRedline"));
 
 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), 
BAD_CAST(OString::number(GetSeqNo()).getStr()));
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), 
BAD_CAST(SW_MOD()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr()));
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), 
BAD_CAST(DateTimeToOString(GetTimeStamp()).getStr()));
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("descr"), 
BAD_CAST(const_cast(this)->GetDescr().toUtf8().getStr()));
 
-OString sRedlineType;
-switch (GetType())
+const SwRedlineData* pRedlineData = m_pRedlineData;
+while (pRedlineData)
 {
-case RedlineType::Insert:
-sRedlineType = "REDLINE_INSERT";
-break;
-case RedlineType::Delete:
-sRedlineType = "REDLINE_DELETE";
-break;
-case RedlineType::Format:
-sRedlineType = "REDLINE_FORMAT";
-break;
-default:
-sRedlineType = "UNKNOWN";
-break;
+pRedlineData->dumpAsXml(pWriter);
+pRedlineData = pRedlineData->Next();
 }
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(sRedlineType.getStr()));
 
 SwPaM::dumpAsXml(pWriter);
 


[Libreoffice-commits] core.git: sw/inc

2023-09-05 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtautofmt.hxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 6ee0f9f02f7255339e18ab9e6189b2200bb71e6e
Author: Miklos Vajna 
AuthorDate: Mon Sep 4 21:00:34 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 5 08:28:01 2023 +0200

sw: document SwFormatAutoFormat

It can be a bit confusing that char formats go via an autostyle, while
para formats go into the attribute set of the text node directly.

Change-Id: Ie1138e91268974b1290c5754af5901cc360d4f8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156550
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx
index f4ac2fae7035..1523389083bd 100644
--- a/sw/inc/fmtautofmt.hxx
+++ b/sw/inc/fmtautofmt.hxx
@@ -23,6 +23,10 @@
 #include 
 #include 
 
+/// Has a shared reference to an "auto-style", i.e. a not named collection of 
character formats. It
+/// is owned by an SwTextAttrEnd, which is then stored in the SwpHints of an 
SwTextNode.
+///
+/// This is the primary way how direct character formats are stored inside a 
paragraph.
 class SW_DLLPUBLIC SwFormatAutoFormat final : public SfxPoolItem
 {
 std::shared_ptr mpHandle;


[Libreoffice-commits] core.git: sw/inc sw/source vcl/qa

2023-09-01 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx  |5 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |  129 ++--
 vcl/qa/cppunit/pdfexport/data/spanlist.fodt |  207 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  385 
 4 files changed, 704 insertions(+), 22 deletions(-)

New commits:
commit ee3c3fcf5c48964f7bc1d64484409f072c614866
Author: Michael Stahl 
AuthorDate: Wed Aug 30 16:24:50 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Sep 1 22:07:13 2023 +0200

tdf#157028 sw: PDF/UA export: reduce the number of Span ILSEs

Currently every text portion produces its own Span ILSE, which means
there's at least one per line.

But that seems a bit excessive, let's try to merge the portions and
create new Spans only when needed, i.e. when the formatting properties
that are exported change.

ILSEs may even be nested, e.g. a Span may contain Link or Span.

This will only merge within one SwTextFrame; merging across split
SwTextFrames looks too difficult to implement.

Change-Id: Id9b02332c580266f78da048be80ecceff1b28eca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156299
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index b6a051647f1a..1ab0f8868af4 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -42,6 +42,7 @@ class StringRangeEnumerator;
 class SwTextNode;
 class SwTable;
 class SwNumberTreeNode;
+class SwTextPaintInfo;
 
 /*
  * Mapping of OOo elements to tagged pdf elements:
@@ -158,6 +159,10 @@ class SwTaggedPDFHelper
 void BeginInlineStructureElements();
 void EndStructureElements();
 
+void EndCurrentSpan();
+void CreateCurrentSpan(SwTextPaintInfo const& rInf, OUString const& 
rStyleName);
+bool CheckContinueSpan(SwTextPaintInfo const& rInf, std::u16string_view 
rStyleName);
+
 bool CheckReopenTag();
 void CheckRestoreTag() const;
 
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index e69639dad1e4..3cd5176cb786 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -91,6 +91,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -141,6 +142,20 @@ struct SwEnhancedPDFState
 
 LanguageType m_eLanguageDefault;
 
+struct Span
+{
+FontLineStyle eUnderline;
+FontLineStyle eOverline;
+FontStrikeout eStrikeout;
+FontEmphasisMark eFontEmphasis;
+short nEscapement;
+SwFontScript nScript;
+LanguageType nLang;
+OUString StyleName;
+};
+
+::std::optional m_oCurrentSpan;
+
 SwEnhancedPDFState(LanguageType const eLanguageDefault)
 : m_eLanguageDefault(eLanguageDefault)
 {
@@ -1556,6 +1571,15 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
 void SwTaggedPDFHelper::EndStructureElements()
 {
+if (mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
+{
+if (mpFrameInfo != nullptr)
+{   // close span at end of paragraph
+mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan.reset();
+++m_nEndStructureElement;
+}
+}
+
 while ( m_nEndStructureElement > 0 )
 {
 EndTag();
@@ -1565,6 +1589,53 @@ void SwTaggedPDFHelper::EndStructureElements()
 CheckRestoreTag();
 }
 
+void SwTaggedPDFHelper::EndCurrentSpan()
+{
+mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan.reset();
+EndTag(); // close span
+}
+
+void SwTaggedPDFHelper::CreateCurrentSpan(
+SwTextPaintInfo const& rInf, OUString const& rStyleName)
+{
+assert(!mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan);
+mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan.emplace(
+SwEnhancedPDFState::Span{
+rInf.GetFont()->GetUnderline(),
+rInf.GetFont()->GetOverline(),
+rInf.GetFont()->GetStrikeout(),
+rInf.GetFont()->GetEmphasisMark(),
+rInf.GetFont()->GetEscapement(),
+rInf.GetFont()->GetActual(),
+rInf.GetFont()->GetLanguage(),
+rStyleName});
+// leave it open to let next portion decide to merge or close
+--m_nEndStructureElement;
+}
+
+bool SwTaggedPDFHelper::CheckContinueSpan(
+SwTextPaintInfo const& rInf, std::u16string_view const rStyleName)
+{
+if (!mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan)
+return false;
+
+SwEnhancedPDFState::Span const& 
rCurrent(*mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan);
+
+bool const ret(rCurrent.eUnderline == rInf.GetFont()->GetUnderline()
+&& rCurrent.eOverline == rInf.GetFont()->GetOverline()
+&& rCurrent.eStrikeout == rInf.GetFont()->GetStrikeout()
+&& rCurrent.eFontEmphasis == 

[Libreoffice-commits] core.git: sw/inc sw/source vcl/qa

2023-09-01 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx   |1 
 sw/source/core/text/EnhancedPDFExportHelper.cxx  |   44 ++-
 vcl/qa/cppunit/pdfexport/data/nestedsection.fodt |  132 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |  137 +++
 4 files changed, 306 insertions(+), 8 deletions(-)

New commits:
commit d5f68529a79c615f989fcfeef248d887a6e10f5a
Author: Michael Stahl 
AuthorDate: Thu Aug 31 19:50:55 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Sep 1 19:16:15 2023 +0200

sw: PDF/UA export: produce nested Sect SEs for nested sections

Change-Id: I5b142acf00629ffd00562e2c8791587b7a7761df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156357
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index c75e7cfe70ce..b6a051647f1a 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -145,6 +145,7 @@ class SwTaggedPDFHelper
 const Frame_Info* mpFrameInfo;
 const Por_Info* mpPorInfo;
 
+void OpenTagImpl(void const* pKey);
 sal_Int32 BeginTagImpl(void const* pKey,vcl::PDFWriter::StructElement 
aTagRole, const OUString& rTagName);
 void BeginTag( vcl::PDFWriter::StructElement aTagRole, const OUString& 
rTagName );
 void EndTag();
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index d3529e54b7f9..e69639dad1e4 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -437,13 +437,7 @@ bool SwTaggedPDFHelper::CheckReopenTag()
 
 if (pReopenKey)
 {
-sal_Int32 const id = 
mpPDFExtOutDevData->EnsureStructureElement(pReopenKey);
-mpPDFExtOutDevData->BeginStructureElement(id);
-++m_nEndStructureElement;
-
-#if OSL_DEBUG_LEVEL > 1
-aStructStack.push_back( 99 );
-#endif
+OpenTagImpl(pReopenKey);
 
 bRet = true;
 }
@@ -464,6 +458,17 @@ void SwTaggedPDFHelper::CheckRestoreTag() const
 }
 }
 
+void SwTaggedPDFHelper::OpenTagImpl(void const*const pKey)
+{
+sal_Int32 const id = mpPDFExtOutDevData->EnsureStructureElement(pKey);
+mpPDFExtOutDevData->BeginStructureElement(id);
+++m_nEndStructureElement;
+
+#if OSL_DEBUG_LEVEL > 1
+aStructStack.push_back( 99 );
+#endif
+}
+
 sal_Int32 SwTaggedPDFHelper::BeginTagImpl(void const*const pKey,
 vcl::PDFWriter::StructElement const eType, const OUString& rString)
 {
@@ -1213,7 +1218,30 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 {
 const SwSection* pSection =
 static_cast(pFrame)->GetSection();
-if ( SectionType::ToxContent == pSection->GetType() )
+
+// open all parent sections, so that the SEs of sections
+// are nested in the same way as their SwSectionNodes
+std::vector parents;
+for (SwSection const* pParent = pSection->GetParent();
+ pParent != nullptr; pParent = pParent->GetParent())
+{
+parents.push_back(pParent);
+}
+for (auto it = parents.rbegin(); it != parents.rend(); ++it)
+{
+// key is the SwSection - see lcl_GetKeyFromFrame()
+OpenTagImpl(*it);
+}
+
+FrameTagSet& 
rFrameTagSet(mpPDFExtOutDevData->GetSwPDFState()->m_FrameTagSet);
+if (rFrameTagSet.find(pSection) != rFrameTagSet.end())
+{
+// special case: section may have *multiple* master frames,
+// when it is interrupted by nested section - reopen!
+OpenTagImpl(pSection);
+break;
+}
+else if (SectionType::ToxContent == pSection->GetType())
 {
 const SwTOXBase* pTOXBase = pSection->GetTOXBase();
 if ( pTOXBase )
diff --git a/vcl/qa/cppunit/pdfexport/data/nestedsection.fodt 
b/vcl/qa/cppunit/pdfexport/data/nestedsection.fodt
new file mode 100644
index ..ab743058f5e7
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/nestedsection.fodt
@@ -0,0 +1,132 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-01 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx  |1 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   52 +++-
 2 files changed, 26 insertions(+), 27 deletions(-)

New commits:
commit 7aca867aa1e1e675c0a9d27d76bd069bc6d5f512
Author: Michael Stahl 
AuthorDate: Thu Aug 31 19:01:47 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Sep 1 10:23:46 2023 +0200

tdf#156306 sw: PDF export: refactor, split out BeginTagImpl()

Change-Id: Ifcb8db6d9a5caaf50c0ca2794266fb501b59dee0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156356
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 6a505ff7..c75e7cfe70ce 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -145,6 +145,7 @@ class SwTaggedPDFHelper
 const Frame_Info* mpFrameInfo;
 const Por_Info* mpPorInfo;
 
+sal_Int32 BeginTagImpl(void const* pKey,vcl::PDFWriter::StructElement 
aTagRole, const OUString& rTagName);
 void BeginTag( vcl::PDFWriter::StructElement aTagRole, const OUString& 
rTagName );
 void EndTag();
 
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 0b4fe669b7d8..d3529e54b7f9 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -464,11 +464,27 @@ void SwTaggedPDFHelper::CheckRestoreTag() const
 }
 }
 
+sal_Int32 SwTaggedPDFHelper::BeginTagImpl(void const*const pKey,
+vcl::PDFWriter::StructElement const eType, const OUString& rString)
+{
+// write new tag
+const sal_Int32 nId = mpPDFExtOutDevData->EnsureStructureElement(pKey);
+mpPDFExtOutDevData->InitStructureElement(nId, eType, rString);
+mpPDFExtOutDevData->BeginStructureElement(nId);
+++m_nEndStructureElement;
+
+#if OSL_DEBUG_LEVEL > 1
+aStructStack.push_back( o3tl::narrowing(eType) );
+#endif
+
+return nId;
+}
+
 void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const 
OUString& rString )
 {
 void const* pKey(nullptr);
 
-if (mpFrameInfo && eType != vcl::PDFWriter::LIBody && eType != 
vcl::PDFWriter::TOCI)
+if (mpFrameInfo)
 {
 const SwFrame& rFrame = mpFrameInfo->mrFrame;
 
@@ -489,15 +505,7 @@ void SwTaggedPDFHelper::BeginTag( 
vcl::PDFWriter::StructElement eType, const OUS
 }
 }
 
-// write new tag
-const sal_Int32 nId = mpPDFExtOutDevData->EnsureStructureElement(pKey);
-mpPDFExtOutDevData->InitStructureElement(nId, eType, rString);
-mpPDFExtOutDevData->BeginStructureElement(nId);
-++m_nEndStructureElement;
-
-#if OSL_DEBUG_LEVEL > 1
-aStructStack.push_back( o3tl::narrowing(eType) );
-#endif
+sal_Int32 const nId = BeginTagImpl(pKey, eType, rString);
 
 // Store the id of the current structure element if
 // - it is a list structure element
@@ -524,19 +532,6 @@ void SwTaggedPDFHelper::BeginTag( 
vcl::PDFWriter::StructElement eType, const OUS
 rNumListBodyIdMap[ pNodeNum ] = nId;
 }
 }
-else if ( mpFrameInfo )
-{
-const SwFrame& rFrame = mpFrameInfo->mrFrame;
-
-if (vcl::PDFWriter::LIBody == eType && rFrame.IsTextFrame())
-{
-SwTextFrame const& rTextFrame(static_cast(rFrame));
-SwTextNode const*const 
pTextNd(rTextFrame.GetTextNodeForParaProps());
-SwNodeNum const*const 
pNodeNum(pTextNd->GetNum(rTextFrame.getRootFrame()));
-NumListBodyIdMap& 
rNumListBodyIdMap(mpPDFExtOutDevData->GetSwPDFState()->m_NumListBodyIdMap);
-rNumListBodyIdMap[ pNodeNum ] = nId;
-}
-}
 
 SetAttributes( eType );
 }
@@ -1250,14 +1245,17 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 case SwFrameType::Txt :
 {
 SwTextFrame const& rTextFrame(*static_cast(pFrame));
+const SwTextNode *const 
pTextNd(rTextFrame.GetTextNodeForParaProps());
+
 // lazy open LBody after Lbl
 if 
(rTextFrame.GetPara()->HasNumberingPortion(SwParaPortion::OnlyNumbering))
 {
-BeginTag(vcl::PDFWriter::LIBody, aListBodyString);
+sal_Int32 const nId = BeginTagImpl(nullptr, 
vcl::PDFWriter::LIBody, aListBodyString);
+SwNodeNum const*const 
pNodeNum(pTextNd->GetNum(rTextFrame.getRootFrame()));
+NumListBodyIdMap& 
rNumListBodyIdMap(mpPDFExtOutDevData->GetSwPDFState()->m_NumListBodyIdMap);
+rNumListBodyIdMap[ pNodeNum ] = nId;
 }
 
-const SwTextNode *const 
pTextNd(rTextFrame.GetTextNodeForParaProps());
-
 const SwFormat* pTextFormat = pTextNd->GetFormatColl();
 const SwFormat* pParentTextFormat = pTextFormat ? 
pTextFormat->DerivedFrom() : nullptr;
 
@@ -1371,7 +1369,7 @@ void 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-01 Thread Noel Grandin (via logerrit)
 sw/inc/accmap.hxx|2 -
 sw/source/core/access/accmap.cxx |   77 +--
 2 files changed, 35 insertions(+), 44 deletions(-)

New commits:
commit a3bd81335c4128cb2f62487868a94882a97eaf66
Author: Noel Grandin 
AuthorDate: Wed Aug 30 16:09:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 1 09:10:35 2023 +0200

use concrete type for SwAccessibleShapeMap_Impl

avoid some unnecessary casting

Change-Id: I422428fa3c31141d73171a22c6c58242a1c1be2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156319
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 42a73cbf4fe9..6e5c189a97b4 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -176,7 +176,7 @@ public:
 }
 static bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh);
 void AddShapeContext(const SdrObject *pObj,
- css::uno::Reference < 
css::accessibility::XAccessible > const & xAccShape);
+ rtl::Reference < ::accessibility::AccessibleShape 
> const & xAccShape);
 
 void AddGroupContext(const SdrObject *pParentObj,
 css::uno::Reference < css::accessibility::XAccessible > 
const & xAccParent);
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index b8b87289286a..3babe9e879d0 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -258,7 +258,7 @@ class SwAccessibleShapeMap_Impl
 public:
 
 typedef const SdrObject *   
key_type;
-typedef uno::WeakReference 
mapped_type;
+typedef unotools::WeakReference<::accessibility::AccessibleShape>   
mapped_type;
 typedef std::pair   
value_type;
 typedef std::map::iterator iterator;
 typedef std::map::const_iterator const_iterator;
@@ -326,23 +326,19 @@ std::unique_ptr
 for( const auto& rEntry : maMap )
 {
 const SdrObject *pObj = rEntry.first;
-uno::Reference < XAccessible > xAcc( rEntry.second );
+rtl::Reference < ::accessibility::AccessibleShape > xAcc( 
rEntry.second );
 if( nSelShapes && pFESh && pFESh->IsObjSelected( *pObj ) )
 {
 // selected objects are inserted from the back
 --pSelShape;
 pSelShape->first = pObj;
-pSelShape->second =
-static_cast < ::accessibility::AccessibleShape* >(
-xAcc.get() );
+pSelShape->second = xAcc.get();
 --nSelShapes;
 }
 else
 {
 pShape->first = pObj;
-pShape->second =
-static_cast < ::accessibility::AccessibleShape* >(
-xAcc.get() );
+pShape->second = xAcc.get();
 ++pShape;
 }
 }
@@ -1165,9 +1161,9 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
 {
 while( aIter != aEndIter )
 {
-uno::Reference < XAccessible > xAcc( (*aIter).second );
+rtl::Reference<::accessibility::AccessibleShape> xAcc( 
(*aIter).second );
 if( xAcc.is() )
-static_cast < ::accessibility::AccessibleShape* 
>(xAcc.get())->SetState( AccessibleStateType::SELECTED );
+xAcc->SetState( AccessibleStateType::SELECTED );
 
 ++aIter;
 }
@@ -1187,9 +1183,9 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
 
 if(rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
 {
-uno::Reference < XAccessible > xAcc( (*aIter).second );
+rtl::Reference < ::accessibility::AccessibleShape > xAcc( 
(*aIter).second );
 if(xAcc.is())
-static_cast < ::accessibility::AccessibleShape* 
>(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
+xAcc->ResetState( AccessibleStateType::SELECTED );
 
 ++aIter;
 continue;
@@ -1239,44 +1235,44 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
 if( ( ((nHere == nStartIndex) && 
(nIndex >= pStart->GetContentIndex())) || (nHere > nStartIndex) )
 &&( ((nHere == nEndIndex) && 
(nIndex < pEnd->GetContentIndex())) || (nHere < nEndIndex) ) )
 {
-uno::Reference < XAccessible > 
xAcc( (*aIter).second );
+rtl::Reference < 
::accessibility::AccessibleShape > xAcc( (*aIter).second );
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-09-01 Thread Noel Grandin (via logerrit)
 sw/inc/accmap.hxx|4 
 sw/source/core/access/accmap.cxx |  196 ++-
 2 files changed, 76 insertions(+), 124 deletions(-)

New commits:
commit 14dc749f575a8faea301472ed22f9c6b24044e8d
Author: Noel Grandin 
AuthorDate: Wed Aug 30 16:02:29 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 1 08:49:17 2023 +0200

use concrete type for SwAccessibleMap::mxCursorContext

avoid some unnecessary casting

Change-Id: I354ac67aa7a0c7f8ebe676315c66c97af31dc4e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156318
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 33f3a2d93f94..42a73cbf4fe9 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -108,7 +108,7 @@ class SwAccessibleMap final : public 
::accessibility::IAccessibleViewForwarder,
 /// preview-to-display coordinates
 std::unique_ptr mpPreview;
 
-css::uno::WeakReference < css::accessibility::XAccessible > 
mxCursorContext;
+unotools::WeakReference< SwAccessibleContext > mxCursorContext;
 
 bool mbShapeSelected;
 
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 02038f14fc25..b8b87289286a 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -86,8 +86,8 @@ using namespace ::sw::access;
 class SwAccessibleContextMap_Impl
 {
 public:
-typedef const SwFrame *   
key_type;
-typedef uno::WeakReference < XAccessible >  
mapped_type;
+typedef const SwFrame * 
key_type;
+typedef unotools::WeakReference < SwAccessibleContext >  
mapped_type;
 typedef std::pair   
value_type;
 typedef std::unordered_map::iterator iterator;
 typedef std::unordered_map::const_iterator 
const_iterator;
@@ -647,8 +647,8 @@ struct SwAccessibleParaSelection
 
 struct SwXAccWeakRefComp
 {
-bool operator()( const uno::WeakReference& _rXAccWeakRef1,
- const uno::WeakReference& _rXAccWeakRef2 
) const
+bool operator()( const unotools::WeakReference& 
_rXAccWeakRef1,
+ const unotools::WeakReference& 
_rXAccWeakRef2 ) const
 {
 return _rXAccWeakRef1.get() < _rXAccWeakRef2.get();
 }
@@ -659,7 +659,7 @@ struct SwXAccWeakRefComp
 class SwAccessibleSelectedParas_Impl
 {
 public:
-typedef uno::WeakReference < XAccessible >  
key_type;
+typedef unotools::WeakReference < SwAccessibleContext > 
key_type;
 typedef SwAccessibleParaSelection   
mapped_type;
 typedef std::pair   
value_type;
 typedef SwXAccWeakRefComp   
key_compare;
@@ -859,7 +859,7 @@ void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
 _iorLogicPgSwRect.AddBottom( - nTmpDiff );
 }
 
-static bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
+static bool AreInSameTable( const rtl::Reference< SwAccessibleContext >& rAcc,
   const SwFrame *pFrame )
 {
 bool bRet = false;
@@ -870,11 +870,9 @@ static bool AreInSameTable( const uno::Reference< 
XAccessible >& rAcc,
 // by comparing the last table frame in the
 // follow chain, because that's cheaper than
 // searching the first one.
-SwAccessibleContext *pAccImpl =
-static_cast< SwAccessibleContext *>( rAcc.get() );
-if( pAccImpl->GetFrame()->IsCellFrame() )
+if( rAcc->GetFrame()->IsCellFrame() )
 {
-const SwTabFrame *pTabFrame1 = 
pAccImpl->GetFrame()->FindTabFrame();
+const SwTabFrame *pTabFrame1 = rAcc->GetFrame()->FindTabFrame();
 if (pTabFrame1)
 {
 while (pTabFrame1->GetFollow())
@@ -904,14 +902,10 @@ void SwAccessibleMap::FireEvent( const 
SwAccessibleEvent_Impl& rEvent )
 mpFrameMap->find( rEvent.mpParentFrame );
 if( aIter != mpFrameMap->end() )
 {
-uno::Reference < XAccessible > xAcc( (*aIter).second );
-if (xAcc.is())
+rtl::Reference < SwAccessibleContext > xContext( 
(*aIter).second.get() );
+if (xContext.is() && xContext->getAccessibleRole() == 
AccessibleRole::PARAGRAPH)
 {
-uno::Reference < XAccessibleContext >  
xContext(xAcc,uno::UNO_QUERY);
-if (xContext.is() && xContext->getAccessibleRole() == 
AccessibleRole::PARAGRAPH)
-{
-xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() 
);
-}
+xAccImpl = xContext.get();
 }
 }
 }
@@ -1324,7 +1318,7 @@ void 

[Libreoffice-commits] core.git: sw/inc

2023-08-31 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtfollowtextflow.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d082621130b01ebc6c7794dc54ff7ace76468599
Author: Miklos Vajna 
AuthorDate: Wed Aug 30 20:27:37 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 31 08:16:02 2023 +0200

sw: document SwFormatFollowTextFlow

Change-Id: I720f01bea49415c0b150fcea222074fb1cbe61cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156307
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx
index 60e02a4163f1..625f4658207b 100644
--- a/sw/inc/fmtfollowtextflow.hxx
+++ b/sw/inc/fmtfollowtextflow.hxx
@@ -26,6 +26,9 @@
 
 class IntlWrapper;
 
+/// This can appear in the item set of a fly frame. It's called "keep inside 
text boundaries" on the
+/// UI. It's off by default and it keeps the fly frame within the boundaries 
of the upper (e.g.
+/// table cell).
 class SW_DLLPUBLIC SwFormatFollowTextFlow final : public SfxBoolItem
 {
 public:


[Libreoffice-commits] core.git: sw/inc sw/source

2023-08-23 Thread Balazs Varga (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |4 ++--
 sw/inc/node.hxx |2 +-
 sw/source/core/docnode/node.cxx |4 ++--
 sw/source/core/layout/atrfrm.cxx|   10 ++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |9 ++---
 sw/source/uibase/shells/drwbassh.cxx|8 
 6 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 069569e4a095f2fe42e94c2dad15356e2038727a
Author: Balazs Varga 
AuthorDate: Mon Aug 21 19:42:38 2023 +0200
Commit: Balazs Varga 
CommitDate: Wed Aug 23 12:40:11 2023 +0200

tdf#156116 - A11Y - fix object name does not update in accessibility sidebar

when we modify the name on the Navigator sidebar.
Update the related accessibility issue after we modify the name on the 
sidebar.

Change-Id: I8f4b8780ff1ffe7cfb86ff837c9579d6b785b832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155904
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 1055c7e67d53..1e320554f8fc 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -57,7 +57,7 @@ private:
 
 void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
-void updateNodeStatus(SwNode* pContentNode);
+void updateNodeStatus(SwNode* pContentNode, bool bIssueObjectNameChanged = 
false);
 void initialCheck();
 void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos);
 void clearAccessibilityIssuesFromAllNodes();
@@ -66,7 +66,7 @@ private:
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
 void update(SwPosition const& rNewPos);
-void resetAndQueue(SwNode* pNode);
+void resetAndQueue(SwNode* pNode, bool bIssueObjectNameChanged = false);
 void resetAndQueueDocumentLevel();
 void updateCheckerActivity();
 sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 84e466dfefa0..79d1a3792935 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -336,7 +336,7 @@ public:
 return m_aAccessibilityCheckStatus;
 }
 
-void resetAndQueueAccessibilityCheck();
+void resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged = false);
 
 private:
 SwNode( const SwNode & rNodes ) = delete;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 64a9e86137c5..4304b875c4d7 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -2179,9 +2179,9 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const 
pFlyFormat)
 m_aAnchoredFlys.erase(it);
 }
 
-void SwNode::resetAndQueueAccessibilityCheck()
+void SwNode::resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged)
 {
-GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this);
+GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this, 
bIssueObjectNameChanged);
 }
 
 
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 5a48a3965545..a272292be46b 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2614,6 +2614,16 @@ void SwFrameFormat::SetFormatName( const OUString& 
rNewName, bool bBroadcast )
 if (bBroadcast) {
 GetNotifier().Broadcast(aHint);
 }
+
+// update accessibility sidebar object name if we modify the object 
name on the navigator bar
+if (!aHint.m_sOld.isEmpty() && aHint.m_sOld != aHint.m_sNew)
+{
+if (SwFlyFrame* pSFly = SwIterator(*this).First())
+{
+if (SwNode* pSwNode = 
static_cast(pSFly->Lower())->GetNode())
+pSwNode->resetAndQueueAccessibilityCheck(true);
+}
+}
 }
 else
 SwFormat::SetFormatName( rNewName, bBroadcast );
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 025dba8c5f25..27d4d5d56f12 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -79,13 +79,16 @@ OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& 
rDocument)
 {
 }
 
-void OnlineAccessibilityCheck::updateNodeStatus(SwNode* pNode)
+void OnlineAccessibilityCheck::updateNodeStatus(SwNode* pNode, bool 
bIssueObjectNameChanged)
 {
 if (!pNode->IsContentNode() && !pNode->IsTableNode())
 return;
 
 m_nAccessibilityIssues = 0;
 
+if (bIssueObjectNameChanged)
+return;
+
 auto it = m_aNodes.find(pNode);
 if (it == m_aNodes.end())
 {
@@ -291,7 +294,7 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()
 updateStatusbar();
 }
 
-void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode)
+void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode, 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-08-22 Thread Miklos Vajna (via logerrit)
 sw/inc/cshtyp.hxx |4 ++--
 sw/qa/core/txtnode/txtnode.cxx|   35 +++
 sw/source/core/txtnode/thints.cxx |   14 --
 3 files changed, 49 insertions(+), 4 deletions(-)

New commits:
commit 56da1d30afe48cc4acd79567052a575e81f8c7a0
Author: Miklos Vajna 
AuthorDate: Tue Aug 22 12:28:59 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 22 15:19:34 2023 +0200

tdf#77760 sw floattable: add support for footnotes, doc model

The bugdoc had a floating table, but we didn't convert the inline table
to floating because it had a footnote, and having footnotes in fly
frames is not supported in Writer.

One benefit of not having footnotes in fly frames is that once these are
saved to Word shapes, those can't have footnotes, either -- there is
value in limiting the UI to the constructs that can be also saved in
Word formats.

Fix the problem by allowing this for split flys, but not for
flys/headers/footers in general.

This is just the doc model, later steps (layout, etc) still need doing
in follow-up commits.

Change-Id: Ic3ba95877d7fad3f5f30743b89e2cf90e0d0af52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155944
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx
index 1ecde9f6d1d7..ec99572f6827 100644
--- a/sw/inc/cshtyp.hxx
+++ b/sw/inc/cshtyp.hxx
@@ -50,9 +50,9 @@ extern SW_DLLPUBLIC SwMoveFnCollection const & fnParaEnd;
 // Direction-parameter for MoveSection.
 typedef bool (*SwWhichSection)( SwPaM&, SwMoveFnCollection const & );
 extern SwMoveFnCollection const & fnSectionStart;
-extern SwMoveFnCollection const & fnSectionEnd;
+extern SW_DLLPUBLIC SwMoveFnCollection const & fnSectionEnd;
 
-bool GoCurrSection( SwPaM&, SwMoveFnCollection const &);
+SW_DLLPUBLIC bool GoCurrSection( SwPaM&, SwMoveFnCollection const &);
 
 // Direction-parameter for MoveTable
 typedef bool (*SwWhichTable)( SwPaM&, SwMoveFnCollection const &, bool 
bInReadOnly );
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 4a4bf9901a2f..ad6a85aabb58 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -33,6 +33,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 /// Covers sw/source/core/txtnode/ fixes.
 class SwCoreTxtnodeTest : public SwModelTestBase
@@ -426,6 +429,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testContentControlCopy)
 CPPUNIT_ASSERT_EQUAL(SwContentControlType::CHECKBOX, 
rFormat2.GetContentControl()->GetType());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlySplitFootnote)
+{
+// Given a document with a split fly (to host a table):
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+RndStdIds eAnchor = RndStdIds::FLY_AT_PARA;
+pWrtShell->StartAllAction();
+aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
+pWrtShell->EndAllAction();
+pWrtShell->StartAllAction();
+sw::FrameFormats& rFlys = *pDoc->GetSpzFrameFormats();
+sw::SpzFrameFormat* pFly = rFlys[0];
+SwAttrSet aSet(pFly->GetAttrSet());
+aSet.Put(SwFormatFlySplit(true));
+pDoc->SetAttr(aSet, *pFly);
+pWrtShell->EndAllAction();
+pWrtShell->UnSelectFrame();
+pWrtShell->LeaveSelFrameMode();
+pWrtShell->GetView().AttrChangedNotify(nullptr);
+pWrtShell->MoveSection(GoCurrSection, fnSectionEnd);
+
+// When inserting a footnote:
+pWrtShell->InsertFootnote(OUString());
+
+// Then make sure the footnote gets inserted to the doc model.
+// Without the accompanying fix in place, this test would have failed, 
insert code refused to
+// have footnotes in all fly frames.
+CPPUNIT_ASSERT(!pDoc->GetFootnoteIdxs().empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 75e80abb242a..2c0a1250f0b7 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1440,7 +1441,16 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 SwNodes  = rDoc.GetNodes();
 
 // check that footnote is inserted into body or redline section
-if( StartOfSectionIndex() < 
rNodes.GetEndOfAutotext().GetIndex() )
+bool bSplitFly = false;
+if (StartOfSectionIndex() < 
rNodes.GetEndOfAutotext().GetIndex()
+&& StartOfSectionIndex() >= 
rNodes.GetEndOfInserts().GetIndex())
+{
+// This is a frame, header or footer. Check if it's a 
split frame.
+

[Libreoffice-commits] core.git: sw/inc

2023-08-22 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtlsplt.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit a490cbfd9a5c9e69979b412d78dbe08bc307541f
Author: Miklos Vajna 
AuthorDate: Mon Aug 21 19:47:12 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 22 08:04:31 2023 +0200

sw: document SwFormatLayoutSplit

Here layout means a table, given that rows have a dedicated
SwFormatRowSplit.

Change-Id: I02255e2b787923ad56a9bfc8b7e7e8b02d8551cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155903
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx
index 75feda2a04aa..8038f597d9a9 100644
--- a/sw/inc/fmtlsplt.hxx
+++ b/sw/inc/fmtlsplt.hxx
@@ -26,6 +26,8 @@
 
 class IntlWrapper;
 
+/// This appears in a table's item set, and controls if the table is allowed 
to split across pages
+/// and columns.
 class SW_DLLPUBLIC SwFormatLayoutSplit final : public SfxBoolItem
 {
 public:


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-08-15 Thread Balazs Varga (via logerrit)
 sw/inc/frmfmt.hxx  |2 
 sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |3 
 sw/source/core/access/AccessibilityIssue.cxx   |   66 ++---
 sw/source/core/layout/atrfrm.cxx   |   12 ++
 5 files changed, 66 insertions(+), 17 deletions(-)

New commits:
commit e027ef6c0534b7ce50dc5f8b74e27ce85b9eb97b
Author: Balazs Varga 
AuthorDate: Mon Aug 14 09:44:35 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Tue Aug 15 08:56:40 2023 +0200

tdf#156670 - A11Y - Open the Format->Description dialog with the fix button

The Fix button will open the Format->Description dialog in case of shapes,
textBox, graphic, OLE objects.

(Remove Description text from (AccessibilityTests1.odt) the shape for proper
testing of no_alt_text.)

Change-Id: I6678fa44a0a47bab60558f770cc709012f02d83b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155653
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index cb9846f969c4..6a0c6e8c2276 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -256,6 +256,8 @@ public:
 
 OUString GetObjDescription() const;
 void SetObjDescription( const OUString& rDescription, bool bBroadcast = 
false );
+
+bool IsDecorative() const;
 void SetObjDecorative(bool isDecorative);
 
 /** SwFlyFrameFormat::IsBackgroundTransparent
diff --git a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
index 6b55335e773d..405fd6647a08 100644
Binary files a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt and 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index eace70ef7cfc..c73de2bccfc6 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1517,8 +1517,7 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, 
SdrObject* pObject)
 || nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group
 || nObjId == SdrObjKind::Graphic || nInv == SdrInventor::FmForm)
 {
-OUString sAlternative = pObject->GetTitle();
-if (sAlternative.isEmpty())
+if (pObject->GetTitle().isEmpty() && 
pObject->GetDescription().isEmpty())
 {
 OUString sName = pObject->GetName();
 OUString sIssueText = 
SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", sName);
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index 2ec8b5f02e20..9da1952f95bc 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace sw
 {
@@ -160,29 +161,64 @@ void AccessibilityIssue::quickFixIssue() const
 case IssueObject::GRAPHIC:
 case IssueObject::OLE:
 {
-OUString aDesc = SwResId(STR_ENTER_ALT);
-SvxNameDialog aNameDialog(m_pParent, "", aDesc);
-if (aNameDialog.run() == RET_OK)
+SwFlyFrameFormat* pFlyFormat
+= 
const_cast(m_pDoc->FindFlyByName(m_sObjectID));
+if (pFlyFormat)
 {
-SwFlyFrameFormat* pFlyFormat
-= 
const_cast(m_pDoc->FindFlyByName(m_sObjectID));
-if (pFlyFormat)
-m_pDoc->SetFlyFrameTitle(*pFlyFormat, 
aNameDialog.GetName());
+OUString aDescription(pFlyFormat->GetObjDescription());
+OUString aTitle(pFlyFormat->GetObjTitle());
+bool isDecorative(pFlyFormat->IsDecorative());
+
+SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
+SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
+ScopedVclPtr pDlg(
+
pFact->CreateSvxObjectTitleDescDialog(pWrtShell->GetView().GetFrameWeld(),
+  aTitle, 
aDescription, isDecorative));
+
+if (pDlg->Execute() == RET_OK)
+{
+pDlg->GetTitle(aTitle);
+pDlg->GetDescription(aDescription);
+pDlg->IsDecorative(isDecorative);
+
+m_pDoc->SetFlyFrameTitle(*pFlyFormat, aTitle);
+m_pDoc->SetFlyFrameDescription(*pFlyFormat, aDescription);
+m_pDoc->SetFlyFrameDecorative(*pFlyFormat, isDecorative);
+
+pWrtShell->SetModified();
+}
 }
 }
 break;
 case IssueObject::SHAPE:
 case IssueObject::FORM:
 {
-OUString aDesc = 

[Libreoffice-commits] core.git: sw/inc

2023-08-14 Thread Gabor Kelemen (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7e3f1e61e20dee523c7db48164c3fadbc953ed85
Author: Gabor Kelemen 
AuthorDate: Fri Aug 11 17:55:06 2023 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Aug 14 10:26:16 2023 +0200

Improve accessibility warning text

Instead of referring to developer-only terminology
tell users what to do

For example, Word uses the warning "Objects not inline" in this
case and actually explains below what needs to be done

Change-Id: I7650807b7520d2f10d75e1417cdf42978a31a417
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155629
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 814dc22dde2c..66370cd9e4b0 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -31,7 +31,7 @@
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Outline levels of headings not in sequential order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "Use 
interactive input fields.")
-#define STR_FLOATING_TEXT   NC_("STR_FLOATING_TEXT", "Avoid 
floating text.")
+#define STR_FLOATING_TEXT   NC_("STR_FLOATING_TEXT", "Anchor 
Frames/Text boxes “As Character“.")
 #define STR_HEADING_IN_TABLENC_("STR_HEADING_IN_TABLE", "Tables 
must not contain headings.")
 #define STR_HEADING_ORDER   NC_("STR_HEADING_ORDER", "A heading 
with outline level %LEVEL_CURRENT% must not follow a heading with outline level 
%LEVEL_PREV%.")
 #define STR_HEADING_START   NC_("STR_HEADING_START", "Outline 
levels should start with level 1, instead of level %LEVEL_CURRENT%.")


[Libreoffice-commits] core.git: sw/inc sw/sdi sw/source

2023-08-10 Thread Balazs Varga (via logerrit)
 sw/inc/cmdid.h   |1 +
 sw/sdi/_basesh.sdi   |6 ++
 sw/sdi/swriter.sdi   |   18 ++
 sw/source/core/access/AccessibilityCheck.cxx |8 ++--
 sw/source/core/access/AccessibilityIssue.cxx |   20 +---
 sw/source/core/inc/AccessibilityIssue.hxx|1 +
 sw/source/uibase/shells/basesh.cxx   |4 
 7 files changed, 53 insertions(+), 5 deletions(-)

New commits:
commit d190758ecee87c2d5d3944e40c4cca6850ce7fd2
Author: Balazs Varga 
AuthorDate: Tue Aug 8 18:07:11 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 10 11:09:00 2023 +0200

tdf#156594 - A11Y - add fix button for "Avoid background images."

- add fix button for "Avoid background images."
- add .uno:PageAreaDialog command to navigate page style-->Area tab

Change-Id: Ibad4e8896d05e72713189a0042c3f156a0733171
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155464
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 78fce16a7bd5..08f239b3d8d0 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -356,6 +356,7 @@ class SwUINumRuleItem;
 #define FN_FORMAT_FRAME_DLG TypedWhichId(FN_FORMAT + 
56)  /* frame */
 #define FN_FORMAT_GRAFIC_DLG(FN_FORMAT + 58)  /* graphic */
 #define FN_FORMAT_TABLE_DLG TypedWhichId(FN_FORMAT + 
60)  /* table */
+#define FN_FORMAT_PAGE_AREA_DLG (FN_FORMAT + 62)  /* area/background */
 
 #define FN_UPDATE_STYLE_BY_EXAMPLE(FN_FORMAT + 63)  /* update 
style */
 #define FN_FORMAT_FOOTNOTE_DLG(FN_FORMAT + 68)  /* footnote 
dialog */
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index b338abfe9b7e..6967020afbcc 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -289,6 +289,12 @@ interface BaseTextSelection
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
 
+FN_FORMAT_PAGE_AREA_DLG
+[
+ExecMethod = ExecDlg ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
+
 FN_CONVERT_TABLE_TO_TEXT
 [
 ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 1ae79b5b2b8b..92fc37a342a3 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -4897,6 +4897,24 @@ SfxVoidItem PageSettingDialog FN_FORMAT_PAGE_SETTING_DLG
 GroupId = SfxGroupId::Format;
 ]
 
+SfxVoidItem PageAreaDialog FN_FORMAT_PAGE_AREA_DLG
+()
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Asynchron;
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Format;
+]
+
 SfxVoidItem TitlePageDialog FN_FORMAT_TITLEPAGE_DLG
 ()
 [
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 86684ab4d879..19683f9cf761 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1453,8 +1453,12 @@ public:
 drawing::FillStyle aFillStyle = 
aFillStyleContainer.get();
 if (aFillStyle == drawing::FillStyle_BITMAP)
 {
-lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_BACKGROUND_IMAGES),
-
sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND);
+auto pIssue
+= lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_BACKGROUND_IMAGES),
+  
sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND);
+
+pIssue->setDoc(*pDoc);
+pIssue->setIssueObject(IssueObject::DOCUMENT_BACKGROUND);
 }
 }
 }
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index adc52b0dfea2..2ec8b5f02e20 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -10,6 +10,9 @@
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -46,7 +49,8 @@ void AccessibilityIssue::setObjectID(OUString const& rID) { 
m_sObjectID = rID; }
 bool AccessibilityIssue::canGotoIssue() const
 {
 if (m_pDoc && m_eIssueObject != IssueObject::UNKNOWN
-&& m_eIssueObject != IssueObject::DOCUMENT_TITLE)
+&& m_eIssueObject != IssueObject::DOCUMENT_TITLE
+&& m_eIssueObject != IssueObject::DOCUMENT_BACKGROUND)
 return true;
 return false;
 }
@@ -139,7 +143,8 @@ bool AccessibilityIssue::canQuickFixIssue() const
 {
 return m_eIssueObject == IssueObject::GRAPHIC || m_eIssueObject == 
IssueObject::OLE
|| m_eIssueObject == IssueObject::SHAPE || m_eIssueObject == 
IssueObject::FORM
-   || m_eIssueObject == IssueObject::DOCUMENT_TITLE;
+   || 

[Libreoffice-commits] core.git: sw/inc

2023-08-10 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 750f60174ea0dacf1cf007cd67eb70acd83fe649
Author: Samuel Mehrbrodt 
AuthorDate: Thu Aug 10 08:08:40 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 10 10:48:51 2023 +0200

Related tdf#156614 Improve wording of non-interactive forms text

Change-Id: I063cb144a7d94e15e9405135ad321d9f2e74d414
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155534
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 1412f66372ec..814dc22dde2c 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -30,7 +30,7 @@
 #define STR_AVOID_TABS_FORMATTING   NC_("STR_AVOID_TABS_FORMATTING", 
"Avoid using tabs for formatting.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Outline levels of headings not in sequential order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
-#define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
+#define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "Use 
interactive input fields.")
 #define STR_FLOATING_TEXT   NC_("STR_FLOATING_TEXT", "Avoid 
floating text.")
 #define STR_HEADING_IN_TABLENC_("STR_HEADING_IN_TABLE", "Tables 
must not contain headings.")
 #define STR_HEADING_ORDER   NC_("STR_HEADING_ORDER", "A heading 
with outline level %LEVEL_CURRENT% must not follow a heading with outline level 
%LEVEL_PREV%.")


[Libreoffice-commits] core.git: sw/inc

2023-08-08 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtftntx.hxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 196c689b9403b0f5874395fb53aedb83794893f7
Author: Miklos Vajna 
AuthorDate: Mon Aug 7 20:12:13 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 8 10:35:33 2023 +0200

sw: document SwFormatFootnote/EndAtTextEnd

In this case footnote really means footnote, as there is a separate
class for endnotes.

Change-Id: Ic701e33b45d22ac42a9518a7d44b2e8a43fac4a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155431
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx
index d930e31b6665..a5de432ccad7 100644
--- a/sw/inc/fmtftntx.hxx
+++ b/sw/inc/fmtftntx.hxx
@@ -86,6 +86,8 @@ public:
 void SetSuffix(const OUString& rSet)   { m_sSuffix = rSet; }
 };
 
+/// SwFormatFootnoteEndAtTextEnd subclass, specific to footnotes, placed in 
the item set of an
+/// SwSectionFormat.
 class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd final : public 
SwFormatFootnoteEndAtTextEnd
 {
 public:
@@ -96,6 +98,8 @@ public:
 virtual SwFormatFootnoteAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) 
const override;
 };
 
+/// SwFormatFootnoteEndAtTextEnd subclass, specific to endnotes, placed in the 
item set of an
+/// SwSectionFormat.
 class SW_DLLPUBLIC SwFormatEndAtTextEnd final : public 
SwFormatFootnoteEndAtTextEnd
 {
 public:


[Libreoffice-commits] core.git: sw/inc sw/source

2023-08-03 Thread Rafael Lima (via logerrit)
 sw/inc/helpids.h   |6 
 sw/source/uibase/utlui/content.cxx |   49 ++---
 2 files changed, 46 insertions(+), 9 deletions(-)

New commits:
commit 490cf5393d30dd2e9ab201286ef863b3c266a8b4
Author: Rafael Lima 
AuthorDate: Tue Aug 1 02:42:15 2023 +0200
Commit: Rafael Lima 
CommitDate: Thu Aug 3 18:15:52 2023 +0200

tdf#154210 Add help IDs for the Navigator context menu

This patch adds the missing HIDs for all entries in submenus of the context 
menu in the Navigator. The entries in the main level already work.

For this patch to work, the related patch in the "help" repo needs to be 
accepted to create the target HIDs.

Change-Id: Ic5917ce16a1430c6f7031ea6b9eb71a09f52624a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155049
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Reviewed-by: Rafael Lima 

diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h
index 6bf90929ab00..cc3b2d791613 100644
--- a/sw/inc/helpids.h
+++ b/sw/inc/helpids.h
@@ -116,6 +116,12 @@ inline constexpr OUStringLiteral HID_TBX_FORMULA_CALC = 
u"SW_HID_TBX_FORMULA_CAL
 inline constexpr OUStringLiteral HID_TBX_FORMULA_CANCEL = 
u"SW_HID_TBX_FORMULA_CANCEL";
 inline constexpr OUStringLiteral HID_TBX_FORMULA_APPLY = 
u"SW_HID_TBX_FORMULA_APPLY";
 
+// Navigator context menu
+inline constexpr OUStringLiteral HID_NAV_OUTLINE_TRACKING = 
u"SW_HID_NAV_OUTLINE_TRACKING";
+inline constexpr OUStringLiteral HID_NAV_OUTLINE_LEVEL = 
u"SW_HID_NAV_OUTLINE_LEVEL";
+inline constexpr OUStringLiteral HID_NAV_DRAG_MODE = u"SW_HID_NAV_DRAG_MODE";
+inline constexpr OUStringLiteral HID_NAV_DISPLAY = u"SW_HID_NAV_DISPLAY";
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index a57df3fd0630..5238dde260b6 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1575,19 +1575,42 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
 
xSubPopOutlineContent->append(OUString::number(SHOW_OUTLINE_CONTENT_VISIBILITY),
   
SwResId(STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL));
 
+
xSubPopOutlineContent->set_item_help_id(OUString::number(TOGGLE_OUTLINE_CONTENT_VISIBILITY),
+HID_NAVIGATOR_TREELIST);
+
xSubPopOutlineContent->set_item_help_id(OUString::number(HIDE_OUTLINE_CONTENT_VISIBILITY),
+HID_NAVIGATOR_TREELIST);
+
xSubPopOutlineContent->set_item_help_id(OUString::number(SHOW_OUTLINE_CONTENT_VISIBILITY),
+HID_NAVIGATOR_TREELIST);
+
+// Add entries to the Outline Tracking submenu
+OUString sId;
 for(int i = 1; i <= 3; ++i)
-xSubPopOutlineTracking->append_radio(OUString::number(i + 10), 
m_aContextStrings[IDX_STR_OUTLINE_TRACKING + i]);
+{
+sId = OUString::number(i + 10);
+xSubPopOutlineTracking->append_radio(sId, 
m_aContextStrings[IDX_STR_OUTLINE_TRACKING + i]);
+xSubPopOutlineTracking->set_item_help_id(sId, 
HID_NAV_OUTLINE_TRACKING);
+}
 xSubPopOutlineTracking->set_active(OUString::number(10 + 
m_nOutlineTracking), true);
 
+// Add entries to the Outline Level submenu
 for (int i = 1; i <= MAXLEVEL; ++i)
-xSubPop1->append_radio(OUString::number(i + 100), OUString::number(i));
+{
+sId = OUString::number(i + 100);
+xSubPop1->append_radio(sId, OUString::number(i));
+xSubPop1->set_item_help_id(sId, HID_NAV_OUTLINE_LEVEL);
+}
 xSubPop1->set_active(OUString::number(100 + m_nOutlineLevel), true);
 
+// Add entries to the Drag Mode submenu
 for (int i=0; i < 3; ++i)
-xSubPop2->append_radio(OUString::number(i + 201), 
m_aContextStrings[IDX_STR_HYPERLINK + i]);
+{
+sId = OUString::number(i + 201);
+xSubPop2->append_radio(sId, m_aContextStrings[IDX_STR_HYPERLINK + i]);
+xSubPop2->set_item_help_id(sId, HID_NAV_DRAG_MODE);
+}
 xSubPop2->set_active(OUString::number(201 + 
static_cast(GetParentWindow()->GetRegionDropMode())), true);
 
-// Insert the list of the open files
+// Insert the list of the open files in the Display submenu
 {
 sal_uInt16 nId = 301;
 SwView *pView = SwModule::GetFirstView();
@@ -1596,20 +1619,28 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
 OUString sInsert = pView->GetDocShell()->GetTitle() + " (" +
 m_aContextStrings[pView == GetActiveView() ? IDX_STR_ACTIVE :
  IDX_STR_INACTIVE] 
+ ")";
-xSubPop3->append_radio(OUString::number(nId), sInsert);
+sId = OUString::number(nId);
+xSubPop3->append_radio(sId, sInsert);
+xSubPop3->set_item_help_id(sId, HID_NAV_DISPLAY);
 if (State::CONSTANT == 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-08-02 Thread Michael Stahl (via logerrit)
 sw/inc/undobj.hxx  |   11 +--
 sw/source/core/undo/undobj.cxx |   21 +
 sw/source/core/undo/unins.cxx  |4 ++--
 sw/source/core/undo/untblk.cxx |6 +++---
 4 files changed, 19 insertions(+), 23 deletions(-)

New commits:
commit 2d96d69322ac18f53668b75397c8587f94cd043b
Author: Michael Stahl 
AuthorDate: Wed Aug 2 13:26:39 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Aug 2 20:40:37 2023 +0200

tdf#156546 sw: fix infinite loop in SwUndoInsert::RedoImpl()

The problem is that SwUndoSaveContent::MovePtBackward() sets the point
of a shell cursor to the document body's start node, which is not a
valid position for a shell cursor; FindParentText() then loops forever.

The purpose of this appears to be to move the point temporarily
somewhere where subsequent inserting operations won't move it further,
so that it can be restored to the start of the inserted stuff.

Refactor a bit to use a temporary SwNodeIndex instead, which should work
as nothing should delete the node it's pointing to.

(regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda)

Change-Id: I471bcced1741c77c07239ed124d4fd39ff7a7515
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155227
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index f95a3aa78bfc..9feaec0521b7 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -179,12 +179,11 @@ protected:
   const SwNodeOffset* pEndNdIdx = nullptr,
   bool bForceCreateFrames = false);
 
-// These two methods move the SPoint back/forth from PaM. With it
-// a range can be spanned for Undo/Redo. (In this case the SPoint
-// is before the manipulated range!!)
-// The flag indicates if there is content before the SPoint.
-static bool MovePtBackward( SwPaM& rPam );
-static void MovePtForward( SwPaM& rPam, bool bMvBkwrd );
+// These two methods save and restore the Point of PaM.
+// If the point cannot be moved, a "backup" is created on the previous 
node.
+// Either way, it will not be moved by inserting at its original position.
+static ::std::optional MovePtBackward(SwPaM& rPam);
+static void MovePtForward(SwPaM& rPam, ::std::optional && 
oMvBkwrd);
 
 // Before moving stuff into UndoNodes-Array care has to be taken that
 // the content-bearing attributes are removed from the nodes-array.
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index c0a8427b0361..dce7f3eb2724 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -860,29 +860,26 @@ void SwUndoSaveContent::MoveFromUndoNds( SwDoc& rDoc, 
SwNodeOffset nNodeIdx,
 }
 }
 
-// These two methods move the Point of Pam backwards/forwards. With that, one
-// can span an area for a Undo/Redo. (The Point is then positioned in front of
-// the area to manipulate!)
-// The flag indicates if there is still content in front of Point.
-bool SwUndoSaveContent::MovePtBackward( SwPaM& rPam )
+// These two methods save and restore the Point of PaM.
+// If the point cannot be moved, a "backup" is created on the previous node.
+// Either way, returned, inserting at its original position will not move it.
+::std::optional SwUndoSaveContent::MovePtBackward(SwPaM & rPam)
 {
 rPam.SetMark();
 if( rPam.Move( fnMoveBackward ))
-return true;
+return {};
 
-// If there is no content onwards, set Point simply to the previous 
position
-// (Node and Content, so that Content will be detached!)
-rPam.GetPoint()->Adjust(SwNodeOffset(-1));
-return false;
+return { SwNodeIndex(rPam.GetPoint()->GetNode(), -1) };
 }
 
-void SwUndoSaveContent::MovePtForward( SwPaM& rPam, bool bMvBkwrd )
+void SwUndoSaveContent::MovePtForward(SwPaM& rPam, 
::std::optional && oMvBkwrd)
 {
 // Was there content before this position?
-if( bMvBkwrd )
+if (!oMvBkwrd)
 rPam.Move( fnMoveForward );
 else
 {
+*rPam.GetPoint() = SwPosition(*oMvBkwrd);
 rPam.GetPoint()->Adjust(SwNodeOffset(1));
 SwContentNode* pCNd = rPam.GetPointContentNode();
 if( !pCNd )
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 38ac9d49c65b..0ac95d0c192f 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -321,7 +321,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & 
rContext)
 
 if( m_nLen )
 {
-const bool bMvBkwrd = MovePtBackward( *pPam );
+::std::optional oMvBkwrd = MovePtBackward(*pPam);
 
 if (maText)
 {
@@ -348,7 +348,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & 
rContext)
 m_nNode = pPam->GetMark()->GetNodeIndex();
 m_nContent = pPam->GetMark()->GetContentIndex();
 
-MovePtForward( *pPam, 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-08-01 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtinfmt.hxx |4 ++--
 sw/inc/fmturl.hxx   |3 ++-
 sw/inc/txtinet.hxx  |2 +-
 sw/source/core/txtnode/txatbase.cxx |3 +++
 4 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit b54776293ad21363e8a1251bf71ff1ae74f61365
Author: Miklos Vajna 
AuthorDate: Mon Jul 31 21:23:26 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 1 08:19:21 2023 +0200

sw: document SwFormatINetFormat

Especially how it relates to SwFormatURL, which is for images, not for
Writer text.

Change-Id: Idc00f3b9803d2fb603647b692de2c1a6ce068361
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155115
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx
index 32e05f6bd3a9..a76db5521c52 100644
--- a/sw/inc/fmtinfmt.hxx
+++ b/sw/inc/fmtinfmt.hxx
@@ -30,8 +30,8 @@ class SwTextINetFormat;
 class IntlWrapper;
 enum class SvMacroItemId : sal_uInt16;
 
-// ATT_INETFMT
-
+/// SfxPoolItem subclass that contains data about an inserted hyperlink / URL 
in Writer text. Its
+/// location is tracked by the wrapping SwTextINetFormat.
 class SW_DLLPUBLIC SwFormatINetFormat final
 : public SfxPoolItem
 , public sw::BroadcasterMixin
diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx
index dcfcb9f9e830..c3bca0789aa4 100644
--- a/sw/inc/fmturl.hxx
+++ b/sw/inc/fmturl.hxx
@@ -28,7 +28,8 @@
 class ImageMap;
 class IntlWrapper;
 
-/// SfxPoolItem subclass that wraps a URL.
+/// SfxPoolItem subclass that wraps a URL. This can appear in the item set of 
e.g. a
+/// sw::SpzFrameFormat (Writer image).
 class SW_DLLPUBLIC SwFormatURL final : public SfxPoolItem
 {
 OUString  m_sTargetFrameName; ///< Target frame for URL.
diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx
index 1f3b4ab36ed2..6459b84a3e59 100644
--- a/sw/inc/txtinet.hxx
+++ b/sw/inc/txtinet.hxx
@@ -25,7 +25,7 @@
 class SwTextNode;
 class SwCharFormat;
 
-/// SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
+/// SwTextAttr subclass that tracks the location of the wrapped 
SwFormatINetFormat.
 class SW_DLLPUBLIC SwTextINetFormat final: public SwTextAttrNesting, public 
SwClient
 {
 private:
diff --git a/sw/source/core/txtnode/txatbase.cxx 
b/sw/source/core/txtnode/txatbase.cxx
index 9fdd1212543f..df347860db11 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -173,6 +173,9 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
 case RES_TXTATR_REFMARK:
 GetRefMark().dumpAsXml(pWriter);
 break;
+case RES_TXTATR_INETFMT:
+GetINetFormat().dumpAsXml(pWriter);
+break;
 default:
 SAL_WARN("sw.core", "Unhandled TXTATR");
 break;


[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-27 Thread Caolán McNamara (via logerrit)
 sw/inc/viewsh.hxx  |2 
 sw/source/core/inc/hffrm.hxx   |6 +
 sw/source/core/inc/pagefrm.hxx |3 
 sw/source/core/layout/paintfrm.cxx |  156 +++--
 sw/source/core/view/viewsh.cxx |   18 +++-
 5 files changed, 144 insertions(+), 41 deletions(-)

New commits:
commit ba0c39064fd97816774f4c06ca84c92c4a137450
Author: Caolán McNamara 
AuthorDate: Wed Jul 26 16:31:04 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jul 27 09:37:08 2023 +0200

Invalidate less on entering/leaving header/footer

Instead of invalidating the entire window, just invalidate the
parts that need to change.

Invalidate a sequence of Rectangles rather than bundle them
into a vcl::Region. Currently Window::Invalidate(const vcl::Region&...
does a LogicInvalidate(rRegion.GetBoundRect()) so get a mega rectangle
that covers everthing which is the opposite of what I want to get here.
It might be worth using GetRegionRectangles there.

Change-Id: Idc3f5f7d19dd57da725072ec4161d932c0c26902
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154973
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 8976452a0dc4..66eec0f5060e 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -188,6 +188,8 @@ class SW_DLLPUBLIC SwViewShell : public 
sw::Ring
 
 SAL_DLLPRIVATE void InvalidateAll(std::vector& rReasons);
 
+SAL_DLLPRIVATE void InvalidatePageAndHFSubsidiaryLines();
+
 protected:
 static ShellResource*  spShellRes;  ///< Resources for the Shell.
 static vcl::DeleteOnDeinit< std::shared_ptr > spCareDialog;  
  ///< Avoid this window.
diff --git a/sw/source/core/inc/hffrm.hxx b/sw/source/core/inc/hffrm.hxx
index 32af4dab9e30..4fed2517db1e 100644
--- a/sw/source/core/inc/hffrm.hxx
+++ b/sw/source/core/inc/hffrm.hxx
@@ -22,8 +22,13 @@
 
 #include "layfrm.hxx"
 
+class SwViewShell;
+
 class SwHeadFootFrame : public SwLayoutFrame
 {
+private:
+std::vector GetSubsidiaryLinesPolygons(const 
SwViewShell& rViewShell) const;
+
 protected:
 void FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs);
 void FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs);
@@ -37,6 +42,7 @@ public:
 virtual SwTwips ShrinkFrame( SwTwips,
bool bTst = false, bool bInfo = false ) 
override;
 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) 
const override;
+void AddSubsidiaryLinesBounds(const SwViewShell& rViewShell, 
RectangleVector& rRects) const;
 };
 
 /// Header in the document layout, inside a page.
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index d85ddaecd116..53bf27a24bbc 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -123,6 +123,8 @@ class SW_DLLPUBLIC SwPageFrame final: public 
SwFootnoteBossFrame
 /// Calculate the content height of a page (without columns).
 size_t GetContentHeight(const tools::Long nTop, const tools::Long nBottom) 
const;
 
+std::vector GetSubsidiaryLinesPolygons(const 
SwViewShell& rViewShell) const;
+
 public:
 SwPageFrame( SwFrameFormat*, SwFrame*, SwPageDesc* );
 
@@ -189,6 +191,7 @@ public:
 
 void PaintDecorators( ) const;
 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) 
const override;
+void AddSubsidiaryLinesBounds(const SwViewShell& rShell, RectangleVector& 
rRects) const;
 virtual void PaintBreak() const override;
 
 /// Paint line number etc.
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 117ac8eb5e61..7c757e4d19ca 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -6969,12 +6970,10 @@ static void lcl_RefreshLine( const SwLayoutFrame *pLay,
 }
 }
 
-static drawinglayer::primitive2d::Primitive2DContainer 
lcl_CreatePageAreaDelimiterPrimitives(
-const SwRect& rRect )
+static std::vector 
lcl_CreatePageAreaDelimiterPolygons(const SwRect& rRect)
 {
-drawinglayer::primitive2d::Primitive2DContainer aSeq( 4 );
+std::vector aPolygons;
 
-basegfx::BColor aLineColor = 
SwViewOption::GetCurrentViewOptions().GetDocBoundariesColor().getBColor();
 double nLineLength = 200.0; // in Twips
 
 Point aPoints[] = { rRect.TopLeft(), rRect.TopRight(), 
rRect.BottomRight(), rRect.BottomLeft() };
@@ -6994,30 +6993,39 @@ static drawinglayer::primitive2d::Primitive2DContainer 
lcl_CreatePageAreaDelimit
 aPolygon.append( aBPoint );
 aPolygon.append( aBPoint + aVertVector * nLineLength );
 
-aSeq[i] = new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
-std::move(aPolygon), aLineColor );
+aPolygons.emplace_back(aPolygon);
 }
 
-return aSeq;
+return aPolygons;
 }
 
-static 

[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig

2023-07-26 Thread Heiko Tietze (via logerrit)
 sw/inc/docstat.hxx   |1 
 sw/source/core/doc/docstat.cxx   |2 
 sw/source/ui/dialog/wordcountdialog.cxx  |5 
 sw/source/uibase/inc/wordcountdialog.hxx |1 
 sw/source/uibase/uiview/view2.cxx|5 
 sw/uiconfig/swriter/ui/wordcount.ui  |  192 +--
 6 files changed, 122 insertions(+), 84 deletions(-)

New commits:
commit 90e3af16c12f94f487ff7516048a239db1d2ff7d
Author: Heiko Tietze 
AuthorDate: Tue Jul 18 15:02:58 2023 +0200
Commit: Heiko Tietze 
CommitDate: Wed Jul 26 10:37:35 2023 +0200

Resolves tdf#95329 - Number of comments in word count dialog

Change-Id: I29ca811065cce83f9c8630f79a2b78c2c3fe0da1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154581
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx
index fd53d80bfcbf..84476db5c065 100644
--- a/sw/inc/docstat.hxx
+++ b/sw/inc/docstat.hxx
@@ -36,6 +36,7 @@ struct SW_DLLPUBLIC SwDocStat
 sal_uLong   nAsianWord;
 sal_uLong   nChar;
 sal_uLong   nCharExcludingSpaces;
+sal_uLong   nComments;
 boolbModified;
 
 SwDocStat();
diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx
index c34e8d094ba2..959c61833dd6 100644
--- a/sw/source/core/doc/docstat.cxx
+++ b/sw/source/core/doc/docstat.cxx
@@ -30,6 +30,7 @@ SwDocStat::SwDocStat() :
 nAsianWord(0),
 nChar(0),
 nCharExcludingSpaces(0),
+nComments(0),
 bModified(true)
 {}
 
@@ -45,6 +46,7 @@ void SwDocStat::Reset()
 nAsianWord = 0;
 nChar   = 0;
 nCharExcludingSpaces = 0;
+nComments = 0;
 bModified = true;
 }
 
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx 
b/sw/source/ui/dialog/wordcountdialog.cxx
index a96e1c50b3be..b0b92a6ae1a7 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && 
SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
 
@@ -64,6 +65,7 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& 
rCurrent, const SwDocStat&
 setValue(*m_xDocCharacterFT, rDoc.nChar, rLocaleData);
 setValue(*m_xDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, 
rLocaleData);
 setValue(*m_xDocCjkcharsFT, rDoc.nAsianWord, rLocaleData);
+setValue(*m_xDocComments, rCurrent.nComments, rLocaleData);
 
 if (m_xStandardizedPagesLabelFT->get_visible())
 {
@@ -120,6 +122,7 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* 
_pBindings,
 , m_xCjkcharsLabelFT2(m_xBuilder->weld_label("cjkcharsft2"))
 , m_xStandardizedPagesLabelFT(m_xBuilder->weld_label("standardizedpages"))
 , 
m_xStandardizedPagesLabelFT2(m_xBuilder->weld_label("standardizedpages2"))
+, m_xDocComments(m_xBuilder->weld_label("docComments"))
 {
 showCJK(SvtCJKOptions::IsAnyEnabled());
 
showStandardizedPages(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get());
@@ -143,6 +146,8 @@ void SwWordCountFloatDlg::UpdateCounts()
 aDocStat = rSh.GetUpdatedDocStat();
 rSh.EndAction();
 }
+SwPostItMgr* pPostItMgr = rSh.GetPostItMgr();
+aCurrCnt.nComments = pPostItMgr->end() - pPostItMgr->begin();
 SetValues(aCurrCnt, aDocStat);
 }
 }
diff --git a/sw/source/uibase/inc/wordcountdialog.hxx 
b/sw/source/uibase/inc/wordcountdialog.hxx
index c5b23f0c5307..ffa0b6478dcc 100644
--- a/sw/source/uibase/inc/wordcountdialog.hxx
+++ b/sw/source/uibase/inc/wordcountdialog.hxx
@@ -43,6 +43,7 @@ class SwWordCountFloatDlg final : public 
SfxModelessDialogController
 std::unique_ptr m_xCjkcharsLabelFT2;
 std::unique_ptr m_xStandardizedPagesLabelFT;
 std::unique_ptr m_xStandardizedPagesLabelFT2;
+std::unique_ptr m_xDocComments;
 
 public:
 SwWordCountFloatDlg(SfxBindings* pBindings,
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 2903bbf19c03..0fb4f0e22a2b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1875,9 +1875,12 @@ void SwView::StateStatusLine(SfxItemSet )
 OUString aWordCount(SwResId(pResId));
 aWordCount = aWordCount.replaceAll("$1", aWordArg);
 aWordCount = aWordCount.replaceAll("$2", aCharArg);
-
 rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );
 
+SwPostItMgr* pPostItMgr = rShell.GetPostItMgr();
+if (pPostItMgr)
+selectionStats.nComments = pPostItMgr->end() - 
pPostItMgr->begin();
+
 SwWordCountWrapper *pWrdCnt = 
static_cast(GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
 if (pWrdCnt)
 pWrdCnt->SetCounts(selectionStats, documentStats);
diff --git 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-21 Thread Balazs Varga (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/source/core/access/AccessibilityCheck.cxx |   45 +++
 2 files changed, 46 insertions(+)

New commits:
commit 3f6ad9d3cdd6fe97989d85b7ec31fe9b8ae340cd
Author: Balazs Varga 
AuthorDate: Fri Jul 21 12:31:20 2023 +0200
Commit: Balazs Varga 
CommitDate: Fri Jul 21 17:57:36 2023 +0200

tdf#155000 - A11Y - Add warning message if content control in header/footer

Add warning message if content controls are in the header or footer.

Change-Id: Ie2a0a8aa1bfaf629f8e17828f2f99e590ea4e3af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154715
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Reviewed-by: Balazs Varga 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 0186c062273b..1412f66372ec 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -37,6 +37,7 @@
 #define STR_HEADING_START   NC_("STR_HEADING_START", "Outline 
levels should start with level 1, instead of level %LEVEL_CURRENT%.")
 #define STR_FONTWORKS   NC_("STR_FONTWORKS", "Avoid Fontwork 
objects in your documents. Make sure you use it for samples or other 
meaningless text.")
 #define STR_TABLE_FORMATTINGNC_("STR_TABLE_FORMATTING", "Avoid 
using empty table cells for formatting.")
+#define STR_CONTENT_CONTROL_IN_HEADER_OR_FOOTER 
NC_("STR_CONTENT_CONTROL_IN_HEADER", "Avoid content controls in header or 
footer.")
 
 #define STR_DOCUMENT_DEFAULT_LANGUAGE   NC_("STR_DOCUMENT_DEFAULT_LANGUAGE", 
"Document default language is not set.")
 #define STR_STYLE_NO_LANGUAGE   NC_("STR_STYLE_NO_LANGUAGE", "Style 
“%STYLE_NAME%” has no language set.")
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 4cde7b8a..9a990b0fa981 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1224,6 +1224,50 @@ private:
 int m_prevLevel = 0;
 };
 
+/// Checking content controls in header or footer
+class ContentControlCheck : public NodeCheck
+{
+private:
+// Boolean indicating if content controls in header or footer warning is 
already triggered.
+bool m_bPrevPassed;
+
+public:
+ContentControlCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
+: NodeCheck(rIssueCollection)
+, m_bPrevPassed(true)
+{
+}
+
+void check(SwNode* pCurrent) override
+{
+if (!m_bPrevPassed)
+return;
+
+const SwTextNode* pTextNode = pCurrent->GetTextNode();
+if (pTextNode)
+{
+if (pCurrent->FindHeaderStartNode() || 
pCurrent->FindFooterStartNode())
+{
+const SwpHints* pHts = pTextNode->GetpSwpHints();
+if (pHts)
+{
+for (size_t i = 0; i < pHts->Count(); ++i)
+{
+const SwTextAttr* pHt = pHts->Get(i);
+if (pHt->Which() == RES_TXTATR_CONTENTCONTROL)
+{
+m_bPrevPassed = false;
+lclAddIssue(m_rIssueCollection,
+
SwResId(STR_CONTENT_CONTROL_IN_HEADER_OR_FOOTER));
+break;
+}
+}
+}
+}
+}
+}
+};
+
 class DocumentCheck : public BaseCheck
 {
 public:
@@ -1458,6 +1502,7 @@ void AccessibilityCheck::init()
 m_aNodeChecks.emplace_back(new SpaceSpacingCheck(m_aIssueCollection));
 m_aNodeChecks.emplace_back(new FakeFootnoteCheck(m_aIssueCollection));
 m_aNodeChecks.emplace_back(new FakeCaptionCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
ContentControlCheck(m_aIssueCollection));
 }
 }
 


[Libreoffice-commits] core.git: sw/inc

2023-07-20 Thread Jim Raykowski (via logerrit)
 sw/inc/strings.hrc |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit de586d8bb1ee72f25729b86cac61e7ddf5839f08
Author: Jim Raykowski 
AuthorDate: Sun Jul 16 23:04:00 2023 -0800
Commit: Jim Raykowski 
CommitDate: Thu Jul 20 19:13:52 2023 +0200

tdf#141102 related: Improve names of menu items used to fold and

unfold outline content including sub level outline content

Change-Id: I686b3acdec910a7b6ae11b498eea3e4c01b6ada8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154558
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 16df1a234e3c..185bc5d89661 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -693,8 +693,8 @@
 #define STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY 
NC_("STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY", "Click to toggle outline 
folding")
 #define STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT 
NC_("STR_CLICK_OUTLINE_CONTENT_TOGGLE_VISIBILITY_EXT", "right-click to include 
sub levels")
 #define STR_OUTLINE_CONTENT_VISIBILITY_TOGGLE   
NC_("STR_OUTLINE_CONTENT_VISIBILITY_TOGGLE", "Toggle")
-#define STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL 
NC_("STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL", "Unfold All")
-#define STR_OUTLINE_CONTENT_VISIBILITY_HIDE_ALL 
NC_("STR_OUTLINE_CONTENT_VISIBILITY_HIDE_ALL", "Fold All")
+#define STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL 
NC_("STR_OUTLINE_CONTENT_VISIBILITY_SHOW_ALL", "Unfold Including Sub Levels")
+#define STR_OUTLINE_CONTENT_VISIBILITY_HIDE_ALL 
NC_("STR_OUTLINE_CONTENT_VISIBILITY_HIDE_ALL", "Fold Including Sub Levels")
 #define STR_OUTLINE_LEVELS_SHOWN_TITLE  
NC_("STR_OUTLINE_LEVELS_SHOWN_TITLE", "Show Up to Outline Level")
 #define STR_OUTLINE_LEVELS_SHOWN_SPIN_LABEL 
NC_("STR_OUTLINE_LEVELS_SHOWN_SPIN_LABEL", "Level (1–10):")
 #define STR_OUTLINE_LEVELS_SHOWN_HELP_LABEL 
NC_("STR_OUTLINE_LEVELS_SHOWN_HELP_LABEL", "Enter maximum outline level allowed 
for a displayed heading.")


[Libreoffice-commits] core.git: sw/inc

2023-07-20 Thread sahil (via logerrit)
 sw/inc/mdiexp.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit e9dcbb2a5965e062c84b2e39e83fdf3f3227
Author: sahil 
AuthorDate: Thu Jul 20 02:48:59 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Thu Jul 20 12:47:59 2023 +0200

tdf#143148 Use pragma once in sw

Change-Id: Ibb1fc8d8419dd4e1c805134fab3ee91476e5c5ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154662
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
index 80c7397b470c..afe308e1ad89 100644
--- a/sw/inc/mdiexp.hxx
+++ b/sw/inc/mdiexp.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_SW_INC_MDIEXP_HXX
-#define INCLUDED_SW_INC_MDIEXP_HXX
+#pragma once
 
 #include 
 #include "tblenum.hxx"
@@ -53,6 +52,4 @@ TableChgMode GetTableChgDefaultMode();
 
 bool JumpToSwMark( SwViewShell const * pVwSh, std::u16string_view rMark );
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-19 Thread Balazs Varga (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 +
 sw/source/core/access/AccessibilityCheck.cxx |   19 ---
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 5c43adc8e6f9948038be6c1fb20f4ac5718a74ea
Author: Balazs Varga 
AuthorDate: Thu Jul 6 17:42:38 2023 +0200
Commit: Balazs Varga 
CommitDate: Wed Jul 19 09:45:55 2023 +0200

tdf#156139 - A11Y - Improve issue text when document starts with wrong

outline level.

Change-Id: I68bff66171af61089f0f8b06a0842f1f3dfdd7bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154139
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 0efaee64ca4b..0186c062273b 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -34,6 +34,7 @@
 #define STR_FLOATING_TEXT   NC_("STR_FLOATING_TEXT", "Avoid 
floating text.")
 #define STR_HEADING_IN_TABLENC_("STR_HEADING_IN_TABLE", "Tables 
must not contain headings.")
 #define STR_HEADING_ORDER   NC_("STR_HEADING_ORDER", "A heading 
with outline level %LEVEL_CURRENT% must not follow a heading with outline level 
%LEVEL_PREV%.")
+#define STR_HEADING_START   NC_("STR_HEADING_START", "Outline 
levels should start with level 1, instead of level %LEVEL_CURRENT%.")
 #define STR_FONTWORKS   NC_("STR_FONTWORKS", "Avoid Fontwork 
objects in your documents. Make sure you use it for samples or other 
meaningless text.")
 #define STR_TABLE_FORMATTINGNC_("STR_TABLE_FORMATTING", "Avoid 
using empty table cells for formatting.")
 
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 5dc306192ce0..7b63729550a1 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1196,15 +1196,20 @@ public:
 if (currentLevel - m_prevLevel > 1)
 {
 // Preparing and posting a warning.
-OUString resultString = SwResId(STR_HEADING_ORDER);
+OUString resultString;
+if (!m_prevLevel)
+{
+resultString = SwResId(STR_HEADING_START);
+}
+else
+{
+resultString = SwResId(STR_HEADING_ORDER);
+resultString
+= resultString.replaceAll("%LEVEL_PREV%", 
OUString::number(m_prevLevel));
+}
 resultString
 = resultString.replaceAll("%LEVEL_CURRENT%", 
OUString::number(currentLevel));
-resultString = resultString.replaceAll("%LEVEL_PREV%", 
OUString::number(m_prevLevel));
-
-auto pIssue = lclAddIssue(m_rIssueCollection, resultString);
-pIssue->setIssueObject(IssueObject::TEXT);
-pIssue->setDoc(pCurrent->GetDoc());
-pIssue->setNode(pCurrent);
+lclAddIssue(m_rIssueCollection, resultString);
 }
 
 // Updating previous level.


[Libreoffice-commits] core.git: sw/inc

2023-07-18 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtftn.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit de9aeed35461b0884c55318519333070b7726c2b
Author: Miklos Vajna 
AuthorDate: Mon Jul 17 20:10:04 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jul 18 08:05:06 2023 +0200

sw: document SwFormatFootnote

Explain this is just the anchor side, the content side is described by
the SwTextFootnote around us.

Change-Id: Id27ce3cabf30b31c494a9dbfbc94130c35bb61cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154556
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index a34b2b83b482..009b75c3f98f 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -39,6 +39,8 @@ class SwXFootnote;
 
 // ATT_FTN
 
+/// SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text 
node. The start node
+/// for the footnote content is defined by m_pTextAttr.
 class SW_DLLPUBLIC SwFormatFootnote final
 : public SfxPoolItem
 , public sw::BroadcastingModify


[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-14 Thread Mike Kaganski (via logerrit)
 sw/inc/anchoreddrawobject.hxx |2 +-
 sw/source/core/draw/dcontact.cxx  |4 +---
 sw/source/core/inc/flyfrm.hxx |2 +-
 sw/source/core/layout/flylay.cxx  |   24 ++--
 sw/source/core/layout/frmtool.cxx |5 +
 sw/source/core/layout/tabfrm.cxx  |   11 ++-
 6 files changed, 8 insertions(+), 40 deletions(-)

New commits:
commit a051601a4cef506bc257c647cbce6288ba8068d4
Author: Mike Kaganski 
AuthorDate: Fri Jul 14 21:10:24 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jul 14 23:22:09 2023 +0200

Use SwAnchoredObject::RegisterAtPage

Change-Id: Icdc8266656bea5b44ce744457ad6a1d0ba87c473
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154447
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx
index eb457701a98d..609582d4d326 100644
--- a/sw/inc/anchoreddrawobject.hxx
+++ b/sw/inc/anchoreddrawobject.hxx
@@ -94,7 +94,6 @@ class SwAnchoredDrawObject final : public SwAnchoredObject
 page frame
 */
 virtual void RegisterAtCorrectPage() override;
-virtual void RegisterAtPage(SwPageFrame &) override;
 
 virtual bool SetObjTop_( const SwTwips _nTop) override;
 virtual bool SetObjLeft_( const SwTwips _nLeft) override;
@@ -109,6 +108,7 @@ class SwAnchoredDrawObject final : public SwAnchoredObject
 // declaration of pure virtual methods of base class 
 virtual void MakeObjPos() override;
 virtual void InvalidateObjPos() override;
+virtual void RegisterAtPage(SwPageFrame&) override;
 bool IsValidPos() const
 {
 return mbValidPos;
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index e5b0c3d50314..2de9544640f3 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2074,9 +2074,7 @@ void SwDrawContact::ChkPage()
 else
 {
 // --> #i28701# - use methods  and 
-if ( GetPageFrame() )
-GetPageFrame()->RemoveDrawObjFromPage( maAnchoredDrawObj );
-pPg->AppendDrawObjToPage( maAnchoredDrawObj );
+maAnchoredDrawObj.RegisterAtPage(*pPg);
 maAnchoredDrawObj.SetPageFrame( pPg );
 }
 }
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index d3815a82835a..bbcf2845e5d7 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -156,7 +156,6 @@ protected:
 page frame
 */
 virtual void RegisterAtCorrectPage() override;
-virtual void RegisterAtPage(SwPageFrame &) override;
 
 virtual bool SetObjTop_( const SwTwips _nTop ) override;
 virtual bool SetObjLeft_( const SwTwips _nLeft ) override;
@@ -267,6 +266,7 @@ public:
 // #i26791# - pure virtual methods of base class 
 virtual void MakeObjPos() override;
 virtual void InvalidateObjPos() override;
+virtual void RegisterAtPage(SwPageFrame&) override;
 
 virtual SwFrameFormat& GetFrameFormat() override;
 virtual const SwFrameFormat& GetFrameFormat() const override;
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 40b8547811fd..8c40a22fe0cd 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -900,11 +900,7 @@ void SwPageFrame::AppendFlyToPage( SwFlyFrame *pNew )
 // #i87493#
 if ( pTmpObj->GetPageFrame() != this )
 {
-if ( pTmpObj->GetPageFrame() != nullptr )
-{
-pTmpObj->GetPageFrame()->RemoveDrawObjFromPage( *pTmpObj );
-}
-AppendDrawObjToPage( *pTmpObj );
+pTmpObj->RegisterAtPage(*this);
 }
 }
 }
@@ -1057,23 +1053,7 @@ void SwPageFrame::MoveFly( SwFlyFrame *pToMove, 
SwPageFrame *pDest )
 SwSortedObjs  = *pToMove->GetDrawObjs();
 for (SwAnchoredObject* pObj : rObjs)
 {
-if ( auto pFly = pObj->DynCastFlyFrame() )
-{
-if ( pFly->IsFlyFreeFrame() )
-{
-// #i28701# - use new method 
-SwPageFrame* pPageFrame = pFly->GetPageFrame();
-if ( pPageFrame )
-pPageFrame->MoveFly( pFly, pDest );
-else
-pDest->AppendFlyToPage( pFly );
-}
-}
-else if ( dynamic_cast( pObj) !=  nullptr 
)
-{
-RemoveDrawObjFromPage( *pObj );
-pDest->AppendDrawObjToPage( *pObj );
-}
+pObj->RegisterAtPage(*pDest);
 }
 }
 
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 6b1647b5..9c8d6cbe85bf 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3209,10 +3209,7 @@ static void lcl_Regist( SwPageFrame *pPage, const 
SwFrame *pAnch )
 // #i87493#
 if ( pPage != 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-12 Thread Mike Kaganski (via logerrit)
 sw/inc/doc.hxx |2 +-
 sw/inc/fmtmeta.hxx |2 +-
 sw/source/core/docnode/ndtbl.cxx   |   15 ---
 sw/source/core/txtnode/fmtatr2.cxx |2 +-
 4 files changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 375d423573cf237fb082ed2b4908d8067036d8b2
Author: Mike Kaganski 
AuthorDate: Wed Jul 12 12:50:44 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jul 12 14:20:39 2023 +0200

Simplify a bit

Change-Id: I452619c5a1d0b414f09c1e3178fac9905b6d0374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154349
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 9fce6c92e4c9..a84df42b8c87 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1276,7 +1276,7 @@ public:
 SwTableLineFormat* MakeTableLineFormat();
 
 // helper function: cleanup before checking number value
-bool IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, 
double& fOutNumber);
+bool IsNumberFormat( const OUString& aString, sal_uInt32& F_Index, double& 
fOutNumber);
 // Check if box has numerical value. Change format of box if required.
 void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
 void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx
index 93b5f9f49cb5..b7f9758484c4 100644
--- a/sw/inc/fmtmeta.hxx
+++ b/sw/inc/fmtmeta.hxx
@@ -182,7 +182,7 @@ private:
 sal_uInt32 m_nNumberFormat;
 bool   m_bIsFixedLanguage;
 
-sal_uInt32 GetNumberFormat(std::u16string_view aContent) const;
+sal_uInt32 GetNumberFormat(const OUString& aContent) const;
 void SetNumberFormat(sal_uInt32 nNumberFormat);
 bool IsFixedLanguage() const{ return m_bIsFixedLanguage; }
 void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; }
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 07216640f354..08775066cb91 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4007,21 +4007,14 @@ void SwDoc::SetColRowWidthHeight( SwTableBox& 
rCurrentBox, TableChgWidthHeightTy
 }
 }
 
-bool SwDoc::IsNumberFormat( std::u16string_view aString, sal_uInt32& F_Index, 
double& fOutNumber )
+bool SwDoc::IsNumberFormat( const OUString& aString, sal_uInt32& F_Index, 
double& fOutNumber )
 {
-if( aString.size() > 308 ) // optimization matches svl:IsNumberFormat 
arbitrary value
+if( aString.getLength() > 308 ) // optimization matches svl:IsNumberFormat 
arbitrary value
 return false;
 
 // remove any comment anchor marks
-OUStringBuffer sStringBuffer(aString);
-sal_Int32 nCommentPosition = sStringBuffer.indexOf( CH_TXTATR_INWORD );
-while( nCommentPosition != -1 )
-{
-sStringBuffer.remove( nCommentPosition, 1 );
-nCommentPosition = sStringBuffer.indexOf( CH_TXTATR_INWORD, 
nCommentPosition );
-}
-
-return GetNumberFormatter()->IsNumberFormat( 
sStringBuffer.makeStringAndClear(), F_Index, fOutNumber );
+return GetNumberFormatter()->IsNumberFormat(
+aString.replaceAll(OUStringChar(CH_TXTATR_INWORD), u""), F_Index, 
fOutNumber);
 }
 
 void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate )
diff --git a/sw/source/core/txtnode/fmtatr2.cxx 
b/sw/source/core/txtnode/fmtatr2.cxx
index c776116a4ecc..2e5a562e0690 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -767,7 +767,7 @@ void MetaField::GetPrefixAndSuffix(
 }
 }
 
-sal_uInt32 MetaField::GetNumberFormat(std::u16string_view aContent) const
+sal_uInt32 MetaField::GetNumberFormat(const OUString& aContent) const
 {
 //TODO: this probably lacks treatment for some special cases
 sal_uInt32 nNumberFormat( m_nNumberFormat );


[Libreoffice-commits] core.git: sw/inc sw/source vcl/qa

2023-07-11 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx |5 
 sw/source/core/layout/paintfrm.cxx |   14 
 sw/source/core/text/EnhancedPDFExportHelper.cxx|   45 ++-
 sw/source/core/text/frmpaint.cxx   |2 
 sw/source/core/text/itrpaint.cxx   |6 
 vcl/qa/cppunit/pdfexport/data/image-hyperlink-alttext.fodt |  195 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |  130 
 7 files changed, 381 insertions(+), 16 deletions(-)

New commits:
commit f2d5653a6792a19e9a45d34ac9dce22e717b8cbf
Author: Michael Stahl 
AuthorDate: Mon Jul 10 17:39:03 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 11 11:10:14 2023 +0200

tdf#154939 sw: PDF/UA export: produce Link StructElem inside Figure

... for a fly frame with a hyperlink set.

  Specification: ISO 14289-1:2014, Clause: 7.18.5, Test number: 1
  Links shall be tagged according to ISO 32000-1:2008, 14.8.4.4.2, Link 
Element.
  A Link annotation is nested within null tag instead of Link

Change-Id: I7a2bef8d6100adffb1f40085bba8f18fc68bd8d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154280
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index e928e417a0f0..a52a03f786ae 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -103,7 +103,10 @@ struct Num_Info
 struct Frame_Info
 {
 const SwFrame& mrFrame;
-Frame_Info( const SwFrame& rFrame ) : mrFrame( rFrame ) {};
+bool const m_isLink;
+
+Frame_Info(const SwFrame& rFrame, bool const isLink)
+: mrFrame(rFrame), m_isLink(isLink) {}
 };
 
 struct Por_Info
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 47e56b390712..69f78db19c59 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3503,8 +3504,19 @@ SwShortCut::SwShortCut( const SwFrame& rFrame, const 
SwRect& rRect )
 void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, SwPrintData const*const) const
 {
 // #i16816# tagged pdf support
-Frame_Info aFrameInfo( *this );
+Frame_Info aFrameInfo(*this, false);
 SwTaggedPDFHelper aTaggedPDFHelper( nullptr, , nullptr, 
rRenderContext );
+::std::optional oTaggedLink;
+if (IsFlyFrame())
+{
+// tdf#154939 Link nested inside Figure
+auto const pItem(GetFormat()->GetAttrSet().GetItemIfSet(RES_URL));
+if (pItem && !pItem->GetURL().isEmpty())
+{
+Frame_Info linkInfo(*this, true);
+oTaggedLink.emplace(nullptr, , nullptr, rRenderContext);
+}
+}
 
 const SwFrame *pFrame = Lower();
 if ( !pFrame )
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 25be18e0d521..7b5732e925da 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -408,7 +408,7 @@ bool SwTaggedPDFHelper::CheckReopenTag()
 {
 pKeyFrame = 
 }
-else if ( rFrame.IsFlyFrame() )
+else if (rFrame.IsFlyFrame() && !mpFrameInfo->m_isLink)
 {
 const SwFormatAnchor& rAnchor =
 static_cast()->GetFormat()->GetAnchor();
@@ -532,6 +532,23 @@ void SwTaggedPDFHelper::EndTag()
 #endif
 }
 
+namespace {
+
+// link the link annotation to the link structured element
+void LinkLinkLink(vcl::PDFExtOutDevData & rPDFExtOutDevData, SwRect const& 
rRect)
+{
+const LinkIdMap& rLinkIdMap = 
SwEnhancedPDFExportHelper::GetLinkIdMap();
+const Point aCenter = rRect.Center();
+auto aIter = std::find_if(rLinkIdMap.begin(), rLinkIdMap.end(),
+[](const IdMapEntry& rEntry) { return 
rEntry.first.Contains(aCenter); });
+if (aIter != rLinkIdMap.end())
+{
+sal_Int32 nLinkId = (*aIter).second;
+
rPDFExtOutDevData.SetStructureAttributeNumerical(vcl::PDFWriter::LinkAnnotation,
 nLinkId);
+}
+}
+}
+
 // Sets the attributes according to the structure type.
 void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
 {
@@ -806,6 +823,12 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 }
 }
 }
+
+if (mpFrameInfo->m_isLink)
+{
+SwRect const aRect(mpFrameInfo->mrFrame.getFrameArea());
+LinkLinkLink(*mpPDFExtOutDevData, aRect);
+}
 }
 
 /*
@@ -906,17 +929,9 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 
 if ( bLinkAttribute )
 {
-const LinkIdMap& rLinkIdMap = 

[Libreoffice-commits] core.git: sw/inc

2023-07-11 Thread Mike Kaganski (via logerrit)
 sw/inc/comcore.hxx |1 +
 sw/inc/utlui.hrc   |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 9ae63fc4a4ca683a58744f501e1606229069
Author: Mike Kaganski 
AuthorDate: Tue Jul 11 05:55:10 2023 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jul 11 08:41:19 2023 +0200

Document connections between sw/inc/comcore.hxx and sw/inc/utlui.hrc

Change-Id: Ibb646964ff031a34e13a814b79b0e73cb885fe37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154261
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/comcore.hxx b/sw/inc/comcore.hxx
index 3e43536742d2..96a53fc84b2d 100644
--- a/sw/inc/comcore.hxx
+++ b/sw/inc/comcore.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_INC_COMCORE_HXX
 
 // defines for the Autoformat Redline Comments
+// see sw/inc/utlui.hrc
 #define STR_AUTOFMTREDL_DEL_EMPTY_PARA  0
 #define STR_AUTOFMTREDL_USE_REPLACE 1
 #define STR_AUTOFMTREDL_CPTL_STT_WORD   2
diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc
index 5aa0b0e06e75..df315d709bb4 100644
--- a/sw/inc/utlui.hrc
+++ b/sw/inc/utlui.hrc
@@ -24,6 +24,7 @@
 
 #define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String))
 
+// see sw/inc/comcore.hxx
 const TranslateId RID_SHELLRES_AUTOFMTSTRS[] =
 {
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Remove empty paragraphs"),


[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-06 Thread Mike Kaganski (via logerrit)
 sw/inc/autostyle_helper.hxx   |2 +-
 sw/source/core/doc/swstylemanager.cxx |5 +
 sw/source/core/unocore/unoobj.cxx |2 +-
 sw/source/core/unocore/unostyle.cxx   |2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 732d0e89363abb009ff13a23957ab7257a378a11
Author: Mike Kaganski 
AuthorDate: Thu Jul 6 14:04:12 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 6 14:41:31 2023 +0200

Related: tdf#141969 Make sure to use SwAttrSet for paragraph autostyles

See 
https://gerrit.libreoffice.org/c/core/+/153947/8#message-45a748bf68235bf143bec07cda2d704abb2b140f

> This started to cause e.g.  CppunitTest_sw_rtfexport3  to fail with
>   /sw/inc/node.hxx:493:53: runtime error: downcast of address 
0x606000617540 which does not point to an object of type 'const SwAttrSet'
>   0x606000617540: note: object is of type 'SfxItemSet'
>00 00 00 00  30 15 0f a9 a6 7f 00 00  50 6a 4a 01 40 60 00 00  c8 98 
0f 00 30 61 00 00  80 30 6c 00
> ^~~
> vptr for 'SfxItemSet'
>   #0 0x7fa671d1b765 in SwContentNode::GetpSwAttrSet() const 
/sw/inc/node.hxx:493:53
>   #1 0x7fa671d7159e in SwContentNode::GetSwAttrSet() const 
/sw/inc/node.hxx:729:25
>   #2 0x7fa673be6c4a in 
SwDoc::TextToTable(std::__debug::vector >, std::allocator > > > const&) 
/sw/source/core/docnode/ndtbl.cxx:1236:51
>   #3 0x7fa6775f46a5 in 
SwXText::convertToTable(com::sun::star::uno::Sequence
 > > > const&, 
com::sun::star::uno::Sequence
 > > const&, 
com::sun::star::uno::Sequence
 > const&, com::sun::star::uno::Sequence 
const&) /sw/source/core/unocore/unotext.cxx:2279:51
>   #4 0x7fa6775fba56 in non-virtual thunk to 
SwXText::convertToTable(com::sun::star::uno::Sequence
 > > > const&, 
com::sun::star::uno::Sequence
 > > const&, 
com::sun::star::uno::Sequence
 > const&, com::sun::star::uno::Sequence 
const&) /sw/source/core/unocore/unotext.cxx
>   #5 0x7fa61c596a81 in 
writerfilter::dmapper::DomainMapperTableHandler::endTable(unsigned int, bool) 
/writerfilter/source/dmapper/DomainMapperTableHandler.cxx:1481:35
>   #6 0x7fa61cf2fdee in 
writerfilter::dmapper::TableManager::resolveCurrentTable() 
/writerfilter/source/dmapper/TableManager.cxx:409:33
>   #7 0x7fa61cf30bb1 in 
writerfilter::dmapper::TableManager::endLevel() 
/writerfilter/source/dmapper/TableManager.cxx:427:9
>   #8 0x7fa61c642f37 in 
writerfilter::dmapper::DomainMapperTableManager::endLevel() 
/writerfilter/source/dmapper/DomainMapperTableManager.cxx:496:19
>   #9 0x7fa61cf2cae1 in 
writerfilter::dmapper::TableManager::endParagraphGroup() 
/writerfilter/source/dmapper/TableManager.cxx:338:9
> ()

Regression after commit b036e563e699595fa7625888f11ab0c76f1abd66
(tdf#141969: use paragraph autostyle to mimic Word's table style,
2023-07-04).

Change-Id: Idc905cdea35bd0c5f3cfbd562d63894f44e64446
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154106
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/autostyle_helper.hxx b/sw/inc/autostyle_helper.hxx
index 9336085db02e..956bf01a8a62 100644
--- a/sw/inc/autostyle_helper.hxx
+++ b/sw/inc/autostyle_helper.hxx
@@ -26,6 +26,6 @@ class SwDoc;
 std::shared_ptr
 PropValuesToAutoStyleItemSet(SwDoc& rDoc, IStyleAccess::SwAutoStyleFamily 
eFamily,
  const 
css::uno::Sequence& Values,
- SfxItemSet& rSet);
+ SwAttrSet& rSet);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sw/source/core/doc/swstylemanager.cxx 
b/sw/source/core/doc/swstylemanager.cxx
index 38f79d679af3..7f73555fc8ff 100644
--- a/sw/source/core/doc/swstylemanager.cxx
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -20,6 +20,7 @@
 #include "swstylemanager.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -97,6 +98,7 @@ std::shared_ptr 
SwStyleManager::getAutomaticStyle( const SfxItemSet&

IStyleAccess::SwAutoStyleFamily eFamily,
const 
OUString* pParentName )
 {
+assert(eFamily != IStyleAccess::AUTO_STYLE_PARA || dynamic_cast());
 StylePool& rAutoPool
 = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? m_aAutoCharPool : 
m_aAutoParaPool;
 return rAutoPool.insertItemSet( rSet, pParentName );
@@ -105,6 +107,7 @@ std::shared_ptr 
SwStyleManager::getAutomaticStyle( const SfxItemSet&
 std::shared_ptr SwStyleManager::cacheAutomaticStyle( const 
SfxItemSet& rSet,

IStyleAccess::SwAutoStyleFamily eFamily )
 {
+assert(eFamily != IStyleAccess::AUTO_STYLE_PARA || dynamic_cast());
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-07-05 Thread Mike Kaganski (via logerrit)
 sw/inc/crsrsh.hxx|   11 ++-
 sw/source/core/crsr/crstrvl.cxx  |   13 +++--
 sw/source/uibase/uiview/viewport.cxx |8 +++-
 3 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit 7e997097eb0e36bbb6f1eb8519acfc4e8eb6337a
Author: Mike Kaganski 
AuthorDate: Wed Jul 5 18:08:54 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 6 06:05:34 2023 +0200

tdf#155462: fix the scrollbar tooltip text

Over the time when it was completely unused, it regressed in a couple
of aspects:

1. It got assembled in incorrect order: instead of appending chapter,
   it got prepended in commit 832e5aadbff006ec24959162c29756fe2b1982be
   (Related: fdo#38838 remove UniString::SearchAndReplaceAll, 2013-10-08);
2. It started to show chapters, only when the respective heading are
   at the very top of screen, and show only page elsewhere, likely in
   commit 835cd06a047717dfe5e0f117959f3c042e13b21b (tdf#38093 Writer
   outline folding - outline visibility and on canvas ui, 2020-07-30),
   where a call to SwNode::FindOutlineNodeOfLevel was replaced with
   SwOutlineNodes::Seek_Entry in SwCursorShell::GetContentAtPos.

Change-Id: I3f427f7ecb3b6c58a441220c555b22e765a533c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154077
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index cfba5cb852c1..233edb71c240 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -88,15 +88,16 @@ enum class IsAttrAtPos
 SmartTag = 0x0800,
 FormControl  = 0x1000,
 TableRedline = 0x2000,
-TableColRedline  = 0x4000
+TableColRedline  = 0x4000,
 #ifdef DBG_UTIL
-,CurrAttrs   = 0x8000///< only for debugging
-,TableBoxValue   = 0x1   ///< only for debugging
+CurrAttrs   = 0x8000,///< only for debugging
+TableBoxValue   = 0x1,   ///< only for debugging
 #endif
-, ContentControl = 0x2
+ContentControl = 0x2,
+AllowContaining = 0x4, // With Outline, finds an outline node for 
non-outline position
 };
 namespace o3tl {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 struct SwContentAtPos
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index a1656233cfc9..d5e430bb8711 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1466,8 +1466,17 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 && !rNds.GetOutLineNds().empty() )
 {
 // only for nodes in outline nodes
-SwOutlineNodes::size_type nPos;
-if(rNds.GetOutLineNds().Seek_Entry(pTextNd, ))
+SwOutlineNodes::size_type nPos = 0;
+bool bFoundOutline = rNds.GetOutLineNds().Seek_Entry(pTextNd, );
+if (!bFoundOutline && nPos && (IsAttrAtPos::AllowContaining & 
rContentAtPos.eContentAtPos))
+{
+// nPos points to the first found outline node not before pTextNd, 
or to end();
+// when bFoundOutline is false, and nPos is not 0, it means that 
there were
+// outline nodes before pTextNd, and nPos-1 points to the last of 
those.
+pTextNd = rNds.GetOutLineNds()[nPos - 1]->GetTextNode();
+bFoundOutline = true;
+}
+if (bFoundOutline)
 {
 rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
 rContentAtPos.sStr = sw::GetExpandTextMerged(GetLayout(), 
*pTextNd, true, false, ExpandMode::ExpandFootnote);
diff --git a/sw/source/uibase/uiview/viewport.cxx 
b/sw/source/uibase/uiview/viewport.cxx
index 415771aae940..306f8844dda8 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -714,16 +714,14 @@ IMPL_LINK(SwView, VertScrollHdl, weld::Scrollbar&, 
rScrollbar, void)
 aRect.SetBottom( aRect.Top() );
 
 OUString sPageStr( GetPageStr( nPhNum, nVirtNum, 
sDisplay ));
-SwContentAtPos aCnt( IsAttrAtPos::Outline );
+SwContentAtPos aCnt(IsAttrAtPos::Outline | 
IsAttrAtPos::AllowContaining);
 bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, 
aCnt);
 if (bSuccess && !aCnt.sStr.isEmpty())
 {
-sPageStr += "  - ";
 sal_Int32 nChunkLen = 
std::min(aCnt.sStr.getLength(), 80);
 std::u16string_view sChunk = aCnt.sStr.subView(0, 
nChunkLen);
-sPageStr = sChunk + sPageStr;
-sPageStr = sPageStr.replace('\t', ' ');
-sPageStr = sPageStr.replace(0x0a, ' ');
+sPageStr = sPageStr + "  - " + sChunk;
+sPageStr = 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

2023-07-04 Thread Mike Kaganski (via logerrit)
 sw/inc/autostyle_helper.hxx   |   31 
+++
 sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |   17 +
 sw/source/core/unocore/unoobj.cxx |   52 
+
 sw/source/core/unocore/unostyle.cxx   |   67 
--
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx  |   99 
++
 6 files changed, 213 insertions(+), 53 deletions(-)

New commits:
commit b036e563e699595fa7625888f11ab0c76f1abd66
Author: Mike Kaganski 
AuthorDate: Tue Jul 4 08:14:02 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 4 20:10:33 2023 +0200

tdf#141969: use paragraph autostyle to mimic Word's table style

Word's table styles may define paragraph and character properties. They are
handled in DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle.

When setting such a character property using setPropertyValue, it may apply
to the text runs inside the paragraph, overriding values from character
style and direct formatting, which must be kept.

To fix that, this change creates a *paragraph* autostyle first, containing
the properties; and then applies only this autostyle to the paragraph; the
autostyle can't apply to runs, so the properties apply at paragraph level.

Sadly, it is impossible to create a useful autostyle in writerfilter using
UNO, because of the same problem that caused tdf#155945. UNO properties
may define only parts of complex SfxPoolItem; setting them without having
already applied values of such SfxPoolItem's would create wrong values for
properties that weren't set by the UNO properties, but happen to share the
same SfxPoolItem. To workaround that in writerfilter, a map of UNO names
to sets of UNO names defining the complex property would be required, and
then maintained.

Instead, introduce a hidded 'ParaAutoStyleDef' property of SwXTextCursor,
taking the same PropertyValue sequence as in XAutoStyleFamily::insertStyle.
Implement it similarly to SwUnoCursorHelper::SetPropertyValues: first,
build a WhichRangesContainer for specific WIDs needed for the properties;
then obtain the actual values for these WIDs from the paragraph; and then
set properties from the PropertyValue sequence.

To create the autostyle properly, the code from 
SwXAutoStyleFamily::insertStyle
is reused.

There are more "proper" ways to fix this in part or as a whole, e.g.:

* Split all complex SfxPoolItem's to simple ones, as done for one of them
  in commit db115bec9254417ef7a3faf687478fe5424ab378 (tdf#78510 sw,cui:
  split SvxLRSpaceItem for SwTextNode, SwTextFormatColl, 2023-02-24);

* Rewrite writerfilter in sw;

* Implement the missing proper table styles with paragraph and character
  properties, having the same precedence.

But I don't feel crazy enough for any of these :D

Change-Id: I07142cb23e8ec51f0e8ac8609f367ba247d94438
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/autostyle_helper.hxx b/sw/inc/autostyle_helper.hxx
new file mode 100644
index ..9336085db02e
--- /dev/null
+++ b/sw/inc/autostyle_helper.hxx
@@ -0,0 +1,31 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "istyleaccess.hxx"
+#include "swatrset.hxx"
+
+class SwDoc;
+
+std::shared_ptr
+PropValuesToAutoStyleItemSet(SwDoc& rDoc, IStyleAccess::SwAutoStyleFamily 
eFamily,
+ const 
css::uno::Sequence& Values,
+ SfxItemSet& rSet);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git 
a/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx
new file mode 100644
index ..6cbb8fb72e9d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 20b190d59af6..a0a4d8051686 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1177,6 +1177,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078)
 CPPUNIT_ASSERT(numberPixelsFound);
 }
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-30 Thread Noel Grandin (via logerrit)
 sw/inc/viewsh.hxx|3 ---
 sw/source/core/view/vnew.cxx |4 ++--
 sw/source/uibase/uiview/viewport.cxx |2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 396f7dfc17ceb24de8cfa0a9480943f7b397f8f4
Author: Noel Grandin 
AuthorDate: Fri Jun 30 15:33:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 30 20:29:05 2023 +0200

mbFrameView is dead since

commit 407731c9f403c35357a0d1428c9b99835f79a5f7
Author: Noel Grandin 
Date:   Tue Jul 21 10:44:17 2015 +0200
loplugin:unusedmethods sw

removed the SetFrameView() method, which in turn
was dead since

commit 1c6da69ba2bc437d826573c7909a220290a67311
Author: Frank Schoenheit [fs] 
Date:   Mon Nov 30 12:56:05 2009 +0100
[CWS autorecovery] removed some dead/unused stuff

Change-Id: I6e74dd7609ecd6ce459b6397a852caa6bde7fac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153812
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 583b795a1b22..1fb861748f20 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -153,7 +153,6 @@ class SW_DLLPUBLIC SwViewShell : public 
sw::Ring
 // in this case MakeVisible is ineffectual.
 bool  mbInEndAction :1;  // Avoid problems, cf. viewsh.cxx.
 bool  mbPreview :1;  // If true it is a Preview-SwViewShell.
-bool  mbFrameView   :1;  // If true it is a  (HTML-)Frame.
 bool  mbEnableSmooth:1;  // Disable SmoothScroll, e.g. for drag
 // of scrollbars.
 bool  mbShowHeaderSeparator:1; ///< Flag to say that we are showing 
the header control
@@ -515,8 +514,6 @@ public:
 
 bool IsPreview() const { return mbPreview; }
 
-bool IsFrameView()  const { return mbFrameView; }
-
 // Invalidates pages and contents.
 // When bSizeChanged==true, adds/removes
 // headers and footers as necessary.
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 0d097f0a9475..613a15df633b 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -168,7 +168,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window 
*pWindow,
 //  during construction of  instance
 mbInConstructor = true;
 
-mbPaintInProgress = mbViewLocked = mbInEndAction = mbFrameView = false;
+mbPaintInProgress = mbViewLocked = mbInEndAction = false;
 mbPaintWorks = mbEnableSmooth = true;
 mbPreview = 0 !=( VSHELLFLAG_ISPREVIEW & nFlags );
 
@@ -237,7 +237,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window 
*pWindow,
 mbInConstructor = true;
 
 mbPaintWorks = mbEnableSmooth = true;
-mbPaintInProgress = mbViewLocked = mbInEndAction = mbFrameView = false;
+mbPaintInProgress = mbViewLocked = mbInEndAction = false;
 mbPreview = 0 !=( VSHELLFLAG_ISPREVIEW & nFlags );
 
 if( nFlags & VSHELLFLAG_SHARELAYOUT )
diff --git a/sw/source/uibase/uiview/viewport.cxx 
b/sw/source/uibase/uiview/viewport.cxx
index 5446c708a5e9..415771aae940 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -294,7 +294,7 @@ void SwView::SetVisArea( const Point , bool 
bUpdateScrollbar )
 // Let's see how far we get with half BrushSize.
 Point aPt = GetEditWin().LogicToPixel( rPt );
 #if HAVE_FEATURE_DESKTOP
-const tools::Long nTmp = GetWrtShell().IsFrameView() ? 4 : 8;
+const tools::Long nTmp = 8;
 aPt.AdjustX( -(aPt.X() % nTmp) );
 aPt.AdjustY( -(aPt.Y() % nTmp) );
 #endif


[Libreoffice-commits] core.git: sw/inc

2023-06-29 Thread Mike Kaganski (via logerrit)
 sw/inc/node.hxx |   78 ++--
 1 file changed, 20 insertions(+), 58 deletions(-)

New commits:
commit 429d26a7386413ebccdedf72f9ac0115b1b6db1b
Author: Mike Kaganski 
AuthorDate: Thu Jun 29 12:03:33 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jun 29 12:21:28 2023 +0200

Simplify a bit

Change-Id: Ia1c142d9841075f307fba69f7697992a5c5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153735
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index a6a7dc603a27..84e466dfefa0 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -184,15 +184,15 @@ public:
 inline   SwSectionNode *GetSectionNode();
 inline const SwSectionNode *GetSectionNode() const;
 
-inline bool IsStartNode() const;
-inline bool IsContentNode() const;
-inline bool IsEndNode() const;
-inline bool IsTextNode() const;
-inline bool IsTableNode() const;
-inline bool IsSectionNode() const;
-inline bool IsOLENode() const;
-inline bool IsNoTextNode() const;
-inline bool IsGrfNode() const;
+bool IsStartNode() const { return bool(SwNodeType::Start & m_nNodeType); }
+bool IsContentNode() const { return bool(SwNodeType::ContentMask & 
m_nNodeType); }
+bool IsEndNode() const { return SwNodeType::End == m_nNodeType; }
+bool IsTextNode() const { return SwNodeType::Text == m_nNodeType; }
+bool IsTableNode() const { return SwNodeType::Table == m_nNodeType; }
+bool IsSectionNode() const { return SwNodeType::Section == m_nNodeType; }
+bool IsOLENode() const { return SwNodeType::Ole == m_nNodeType; }
+bool IsNoTextNode() const { return bool(SwNodeType::NoTextMask & 
m_nNodeType); }
+bool IsGrfNode() const { return SwNodeType::Grf == m_nNodeType; }
 
 /**
Checks if this node is in redlines.
@@ -633,80 +633,43 @@ private:
 
 inline   SwEndNode   *SwNode::GetEndNode()
 {
- return SwNodeType::End == m_nNodeType ? static_cast(this) : 
nullptr;
+ return IsEndNode() ? static_cast(this) : nullptr;
 }
 inline const SwEndNode   *SwNode::GetEndNode() const
 {
- return SwNodeType::End == m_nNodeType ? static_cast(this) : nullptr;
+ return IsEndNode() ? static_cast(this) : nullptr;
 }
 inline   SwStartNode *SwNode::GetStartNode()
 {
- return SwNodeType::Start & m_nNodeType ? static_cast(this) 
: nullptr;
+ return IsStartNode() ? static_cast(this) : nullptr;
 }
 inline const SwStartNode *SwNode::GetStartNode() const
 {
- return SwNodeType::Start & m_nNodeType ? static_cast(this) : nullptr;
+ return IsStartNode() ? static_cast(this) : nullptr;
 }
 inline   SwTableNode *SwNode::GetTableNode()
 {
- return SwNodeType::Table == m_nNodeType ? static_cast(this) 
: nullptr;
+ return IsTableNode() ? static_cast(this) : nullptr;
 }
 inline const SwTableNode *SwNode::GetTableNode() const
 {
- return SwNodeType::Table == m_nNodeType ? static_cast(this) : nullptr;
+ return IsTableNode() ? static_cast(this) : nullptr;
 }
 inline   SwSectionNode *SwNode::GetSectionNode()
 {
- return SwNodeType::Section == m_nNodeType ? 
static_cast(this) : nullptr;
+ return IsSectionNode() ? static_cast(this) : nullptr;
 }
 inline const SwSectionNode *SwNode::GetSectionNode() const
 {
- return SwNodeType::Section == m_nNodeType ? static_cast(this) : nullptr;
+ return IsSectionNode() ? static_cast(this) : 
nullptr;
 }
 inline   SwContentNode *SwNode::GetContentNode()
 {
- return SwNodeType::ContentMask & m_nNodeType ? 
static_cast(this) : nullptr;
+ return IsContentNode() ? static_cast(this) : nullptr;
 }
 inline const SwContentNode *SwNode::GetContentNode() const
 {
- return SwNodeType::ContentMask & m_nNodeType ? static_cast(this) : nullptr;
-}
-
-inline bool SwNode::IsStartNode() const
-{
-return bool(SwNodeType::Start & m_nNodeType);
-}
-inline bool SwNode::IsContentNode() const
-{
-return bool(SwNodeType::ContentMask & m_nNodeType);
-}
-inline bool SwNode::IsEndNode() const
-{
-return SwNodeType::End == m_nNodeType;
-}
-inline bool SwNode::IsTextNode() const
-{
-return SwNodeType::Text == m_nNodeType;
-}
-inline bool SwNode::IsTableNode() const
-{
-return SwNodeType::Table == m_nNodeType;
-}
-inline bool SwNode::IsSectionNode() const
-{
-return SwNodeType::Section == m_nNodeType;
-}
-inline bool SwNode::IsNoTextNode() const
-{
-return bool(SwNodeType::NoTextMask & m_nNodeType);
-}
-inline bool SwNode::IsOLENode() const
-{
-return SwNodeType::Ole == m_nNodeType;
-}
-inline bool SwNode::IsGrfNode() const
-{
-return SwNodeType::Grf == m_nNodeType;
+ return IsContentNode() ? static_cast(this) : 
nullptr;
 }
 
 inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) 
const
@@ -727,8 +690,7 @@ inline SwNodeOffset SwNode::StartOfSectionIndex() const
 }
 inline SwNodeOffset SwNode::EndOfSectionIndex() const
 {
-const 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source xmloff/source

2023-06-24 Thread Mike Kaganski (via logerrit)
 sw/inc/unoprnms.hxx  |2 
 sw/qa/core/layout/data/floattable-2cols.docx |binary
 sw/qa/core/layout/data/floattable-compat14-body.docx |binary
 sw/qa/core/layout/data/floattable-compat14-nosplit.docx  |binary
 sw/qa/core/layout/data/floattable-compat14.docx  |binary
 sw/qa/core/layout/data/floattable-footer-2rows.docx  |binary
 sw/qa/core/layout/data/floattable-footer.docx|binary
 sw/qa/core/layout/data/floattable-widow.docx |binary
 sw/qa/extras/layout/data/tdf116256.docx  |binary
 sw/qa/extras/layout/data/tdf136613.docx  |binary
 sw/qa/extras/layout/layout2.cxx  |   13 
 sw/qa/extras/ooxmlexport/data/lastEmptyLineWithDirectFormatting.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx   |   11 
 sw/qa/extras/rtfexport/rtfexport6.cxx|4 
 sw/qa/extras/rtfimport/rtfimport.cxx |7 
 sw/source/core/doc/DocumentContentOperationsManager.cxx  |7 
 sw/source/core/doc/docfmt.cxx|6 
 sw/source/core/unocore/unoobj.cxx|9 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|  169 
++
 xmloff/source/text/txtparai.cxx  |   30 -
 20 files changed, 155 insertions(+), 103 deletions(-)

New commits:
commit fc1b9ab2913bc8c2d8414b6d8de3ceed3910c5d8
Author: Mike Kaganski 
AuthorDate: Fri Jun 23 09:31:01 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Jun 24 10:18:47 2023 +0200

tdf#133560: re-anchor objects, to use paragraph's dispose for bEndOfDocument

1. During import, XParagraphAppend::finishParagraph(Insert) are called,
   which are implemented using SwXText::Impl::finishOrAppendParagraph,
   and the latter calls

m_pDoc->getIDocumentContentOperations().AppendTextNode( 
*aPam.GetPoint() );
// remove attributes from the previous paragraph
m_pDoc->ResetAttrs(aPam);

   so that there is always another (empty) paragraph after the finalized
   one;

2. During import, lcl_AddRange is called to create anchored text content;
   the start and end of it may reference the very end of the document
   (using xTextAppend->getEnd()) - i.e., that last (maybe empty, maybe
   extra) paragraph.

3. In many places, and in particular, in DomainMapper_Impl destructor,
   DomainMapper_Impl::RemoveLastParagraph is called; and the latter uses
   one of the two techniques to remove that last paragraph:

3.1. It either obtains the paragraph's lang::XComponent interface, and
 calls its dispose (SwXParagraph::dispose), which eventually calls
 DocumentContentOperationsManager::DelFullPara;

3.2. Or it uses cursor to select 1 ch back, and replace the resulting
 selection with nothing.

3.1 has an advantage of keeping the formatting of the remaining (second-
to-last) paragraph, but DocumentContentOperationsManager::DelFullPara,
among other things, removes all anchored objects, thus this mode is not
used for the end-of-document case (e.g., see commit message of commit
e521930ea1c855c236efb67793e540d07c201d35 "fdo#58327: writerfilter:
RemoveLastParagraph is tricky:", 2013-01-10);

3.2 keeps the anchored objects, but needs workarounds to keep bookmarks,
and destroys the remaining paragraph character formatting.

Let me try to use #3.1 also in the end-of-document case, by introducing
code to move anchored objects to previous paragraph before calling
XComponent::dispose. Indeed, it may happen that more processing could be
needed, if more properties would happen to be bound to the very last
extra paragraph.

This change adds a call to DocumentRedlineManager::CompressRedlines in
DocumentContentOperationsManager::DelFullPara, because previously, this
was called during #3.2 inside setString. testTdf150086 failed without
this change.

testTdf131386 and testTdf152872 were changed to the now-correct import of
last paragraph properties (previously both of them relied on the hidden
property not present there, while it is there in Word).

In DomainMapper_Impl::RemoveLastParagraph, the check of the content of
selection made by moving backward one character was generalized to be run
before both cases, because RTF sometimes has only one paragraph after a
table (see e.g. testTdf148515), which now could be removed in the absence
of the check.

testTdf104390 was changed to not check the number of runs, because now
the paragraph keeps the trailing "paragraph mark 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-23 Thread Balazs Varga (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc|1 
 sw/inc/OnlineAccessibilityCheck.hxx |6 
 sw/source/core/access/AccessibilityCheck.cxx|6 ++--
 sw/source/core/access/AccessibilityIssue.cxx|   28 ++--
 sw/source/core/inc/AccessibilityIssue.hxx   |1 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   15 ++
 sw/source/uibase/uiview/view2.cxx   |3 +-
 7 files changed, 55 insertions(+), 5 deletions(-)

New commits:
commit bbb104ea2b8f3e48273f316cfad406e904a2f331
Author: Balazs Varga 
AuthorDate: Tue Jun 20 15:38:40 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Fri Jun 23 10:17:29 2023 +0200

tdf#155503 - A11Y sidebar: Add quick fix action to set document title

Add fix button to set the document title.
Fix updates issue of document level changes.

Change-Id: Ibab5cab3b595de4df68c3022a5864b2d2d4bed2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153352
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 12e2e1fa2b8d..0efaee64ca4b 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -40,6 +40,7 @@
 #define STR_DOCUMENT_DEFAULT_LANGUAGE   NC_("STR_DOCUMENT_DEFAULT_LANGUAGE", 
"Document default language is not set.")
 #define STR_STYLE_NO_LANGUAGE   NC_("STR_STYLE_NO_LANGUAGE", "Style 
“%STYLE_NAME%” has no language set.")
 #define STR_DOCUMENT_TITLE  NC_("STR_DOCUMENT_TITLE", "Document 
title is not set.")
+#define STR_ENTER_DOCUMENT_TITLENC_("STR_ENTER_DOCUMENT_TITLE", "Enter 
document title:")
 
 #define STR_ENTER_ALT   NC_("STR_ENTER_ALT", "Enter 
alternative text:")
 
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index fc158e28db7e..1055c7e67d53 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -67,8 +67,14 @@ public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
 void update(SwPosition const& rNewPos);
 void resetAndQueue(SwNode* pNode);
+void resetAndQueueDocumentLevel();
 void updateCheckerActivity();
 sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
+sal_Int32 getNumberOfDocumentLevelAccessibilityIssues()
+{
+return m_pDocumentAccessibilityIssues ? 
m_pDocumentAccessibilityIssues->getIssues().size()
+  : sal_Int32(0);
+}
 };
 
 } // end sw
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 802ad2c8dea3..ec2a101795e5 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1263,8 +1263,10 @@ public:
 OUString sTitle = xDocumentProperties->getTitle();
 if (o3tl::trim(sTitle).empty())
 {
-lclAddIssue(m_rIssueCollection, SwResId(STR_DOCUMENT_TITLE),
-sfx::AccessibilityIssueID::DOCUMENT_TITLE);
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_DOCUMENT_TITLE),
+  
sfx::AccessibilityIssueID::DOCUMENT_TITLE);
+pIssue->setDoc(*pDoc);
+pIssue->setIssueObject(IssueObject::DOCUMENT_TITLE);
 }
 }
 };
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index d1ebb53bdeeb..d0366b1ef3e2 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -8,6 +8,8 @@
  *
  */
 
+#include 
+
 #include 
 #include 
 #include 
@@ -42,7 +44,8 @@ void AccessibilityIssue::setObjectID(OUString const& rID) { 
m_sObjectID = rID; }
 
 bool AccessibilityIssue::canGotoIssue() const
 {
-if (m_pDoc && m_eIssueObject != IssueObject::UNKNOWN)
+if (m_pDoc && m_eIssueObject != IssueObject::UNKNOWN
+&& m_eIssueObject != IssueObject::DOCUMENT_TITLE)
 return true;
 return false;
 }
@@ -119,7 +122,8 @@ void AccessibilityIssue::gotoIssue() const
 bool AccessibilityIssue::canQuickFixIssue() const
 {
 return m_eIssueObject == IssueObject::GRAPHIC || m_eIssueObject == 
IssueObject::OLE
-   || m_eIssueObject == IssueObject::SHAPE || m_eIssueObject == 
IssueObject::FORM;
+   || m_eIssueObject == IssueObject::SHAPE || m_eIssueObject == 
IssueObject::FORM
+   || m_eIssueObject == IssueObject::DOCUMENT_TITLE;
 }
 
 void AccessibilityIssue::quickFixIssue() const
@@ -158,6 +162,26 @@ void AccessibilityIssue::quickFixIssue() const
 }
 }
 break;
+case IssueObject::DOCUMENT_TITLE:
+{
+OUString aDesc = SwResId(STR_ENTER_DOCUMENT_TITLE);
+SvxNameDialog aNameDialog(m_pParent, "", aDesc);
+if (aNameDialog.run() == 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-23 Thread Maxim Monastirsky (via logerrit)
 sw/inc/doc.hxx   |2 -
 sw/source/core/doc/docfmt.cxx|8 --
 sw/source/core/inc/UndoAttribute.hxx |8 +++---
 sw/source/core/undo/unattr.cxx   |   42 +++
 sw/source/uibase/app/docstyle.cxx|   15 ++--
 5 files changed, 46 insertions(+), 29 deletions(-)

New commits:
commit 6cc71f3eef4e5108e44ab6c1943def1d3a0f707a
Author: Maxim Monastirsky 
AuthorDate: Wed Jun 21 07:30:53 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Jun 23 08:31:13 2023 +0200

tdf#103064 Fix reset to parent style handling

If the style ends up empty, it still needs modification
broadcasting if it used to be non-empty. So let's just
trust the pool notification for when to notify clients.
And given that broadcasting happens now always after
EnsureStyleHierarchy, I assume that the explicit
broadcasting in SetParent is no longer needed.

Also added broadcasting to the undo of a reset. And the
undo actions were combined, so we don't get separate
notifications for each reset attribute.

Change-Id: Ia2895fe346ef337cc0b4fe5dc4275f5b2dc60cd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153478
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c729e0b2a983..c709db694d07 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -729,7 +729,7 @@ public:
 void SetAttr( const SfxItemSet&, SwFormat& );
 
 // method to reset a certain attribute at the given format
-void ResetAttrAtFormat( const sal_uInt16 nWhichId,
+void ResetAttrAtFormat( const std::vector& rIds,
 SwFormat& rChangedFormat );
 
 /** Set attribute as new default attribute in current document.
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 8ed9c4c9d249..3a503407c90f 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -498,14 +498,16 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& 
rFormat )
 getIDocumentState().SetModified();
 }
 
-void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
+void SwDoc::ResetAttrAtFormat( const std::vector& rIds,
SwFormat& rChangedFormat )
 {
 std::unique_ptr pUndo;
 if (GetIDocumentUndoRedo().DoesUndo())
-pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId ));
+pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, rIds ));
 
-const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId );
+bool bAttrReset = false;
+for (const auto& nWhichId : rIds)
+bAttrReset = rChangedFormat.ResetFormatAttr(nWhichId) || bAttrReset;
 
 if ( bAttrReset )
 {
diff --git a/sw/source/core/inc/UndoAttribute.hxx 
b/sw/source/core/inc/UndoAttribute.hxx
index 7fbbb5b522cd..f6905cafc6cf 100644
--- a/sw/source/core/inc/UndoAttribute.hxx
+++ b/sw/source/core/inc/UndoAttribute.hxx
@@ -132,7 +132,7 @@ class SwUndoFormatResetAttr final : public SwUndo
 {
 public:
 SwUndoFormatResetAttr( SwFormat& rChangedFormat,
-const sal_uInt16 nWhichId );
+   const std::vector& rIds );
 virtual ~SwUndoFormatResetAttr() override;
 
 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
@@ -141,10 +141,10 @@ class SwUndoFormatResetAttr final : public SwUndo
 private:
 // format at which a certain attribute is reset.
 SwFormat * const m_pChangedFormat;
-// which ID of the reset attribute
-const sal_uInt16 m_nWhichId;
 // old attribute which has been reset - needed for undo.
-std::unique_ptr m_pOldItem;
+SfxItemSet m_aSet;
+
+void BroadcastStyleChange();
 };
 
 class SwUndoDontExpandFormat final : public SwUndo
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index acc1503ee35c..66ccb4073bc3 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -233,7 +233,7 @@ void SwUndoFormatAttr::UndoImpl(::sw::UndoRedoContext & 
rContext)
 else if (RES_CHRFMT == m_nFormatWhich)
 nFamily = SfxStyleFamily::Char;
 
-if (pFormat && nFamily != SfxStyleFamily::None)
+if (m_oOldSet && m_oOldSet->Count() > 0 && nFamily != SfxStyleFamily::None)
 rContext.GetDoc().BroadcastStyleOperation(pFormat->GetName(), nFamily, 
SfxHintId::StyleSheetModified);
 }
 
@@ -549,14 +549,16 @@ bool 
SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext)
 }
 
 SwUndoFormatResetAttr::SwUndoFormatResetAttr( SwFormat& rChangedFormat,
-const sal_uInt16 nWhichId )
+  const std::vector& 
rIds )
 : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() )
 , m_pChangedFormat(  )
-, m_nWhichId( nWhichId )
+, m_aSet(*rChangedFormat.GetAttrSet().GetPool())
 {
-

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-23 Thread Maxim Monastirsky (via logerrit)
 sw/inc/docstyle.hxx   |2 +-
 sw/source/uibase/app/docstyle.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9cfed79cc1eb6182a807dafec796c0423d6003d6
Author: Maxim Monastirsky 
AuthorDate: Wed Jun 21 10:10:03 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Jun 23 08:30:51 2023 +0200

This can be const

Change-Id: Ie69b8a926c20d1923c4e1ad580838f1b57bbd3f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153480
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 82b33adf4efd..7d0a07de2dc8 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -181,7 +181,7 @@ class SwStyleSheetIterator final : public 
SfxStyleSheetIterator, public SfxListe
 sal_uInt32  m_nLastPos;
 boolm_bFirstCalled;
 
-bool IsUsedInComments(const OUString& rName);
+bool IsUsedInComments(const OUString& rName) const;
 voidAppendStyleList(const std::vector& rLst,
 boolbUsed,
 boolbTestHidden,
diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index d43d5f652ff1..8f8e9eb94c19 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -3409,7 +3409,7 @@ void SwStyleSheetIterator::AppendStyleList(const 
std::vector& rList,
 }
 }
 
-bool SwStyleSheetIterator::IsUsedInComments(const OUString& rName)
+bool SwStyleSheetIterator::IsUsedInComments(const OUString& rName) const
 {
 auto pPool = static_cast(pBasePool)->GetEEStyleSheetPool();
 SfxStyleSheetIterator aIter(pPool, GetSearchFamily(), 
SfxStyleSearchBits::Used);


[Libreoffice-commits] core.git: sw/inc

2023-06-20 Thread Adolfo Jayme Barrientos (via logerrit)
 sw/inc/strings.hrc |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a9e819430702e89454ef7af0c1019ba8e2617903
Author: Adolfo Jayme Barrientos 
AuthorDate: Sat Jun 17 19:18:17 2023 -0600
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Jun 20 17:03:02 2023 +0200

Remove German capitalization from some translatable strings

Change-Id: I74f886c651ea7973cc60e3771f2de6eaa449fe4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153231
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 97d216e7ba83..99cbc47b55b3 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1470,9 +1470,9 @@
 // in order to change %PRODUCTNAME at runtime is expensive, so limit doing 
that as much as possible.
 #define STR_A11Y_DESC_AUTO  
NC_("insertcaption|extended_tip|auto", "Opens the Caption dialog. It has the 
same information as the dialog you get by menu %PRODUCTNAME Writer - 
AutoCaption in the Options dialog box.")
 
-#define STR_A11Y_DESIGN_MODE_TITLE  
NC_("STR_A11Y_DESIGN_MODE_TITLE", "The Forms are not editable")
-#define STR_A11Y_DESIGN_MODE_PRIMARY
NC_("STR_A11Y_DESIGN_MODE_PRIMARY", "Would you like to switch to Design mode?")
-#define STR_A11Y_DESIGN_MODE_SECONDARY  
NC_("STR_A11Y_DESIGN_MODE_SECONDARY", "You need to switch to design mode to 
edit Forms.")
+#define STR_A11Y_DESIGN_MODE_TITLE  
NC_("STR_A11Y_DESIGN_MODE_TITLE", "The forms are not editable")
+#define STR_A11Y_DESIGN_MODE_PRIMARY
NC_("STR_A11Y_DESIGN_MODE_PRIMARY", "Would you like to switch to design mode?")
+#define STR_A11Y_DESIGN_MODE_SECONDARY  
NC_("STR_A11Y_DESIGN_MODE_SECONDARY", "You need to switch to design mode to 
edit forms.")
 
 #define STR_MARK_COPY NC_("STR_MARK_COPY", "%1 Copy ")
 


[Libreoffice-commits] core.git: sw/inc

2023-06-20 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtline.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit abca28b4db956848271b53b4bc59f79b5f2f2529
Author: Miklos Vajna 
AuthorDate: Mon Jun 19 20:28:46 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 20 08:31:01 2023 +0200

sw: document SwFormatLineNumber

The primary use-case here is to have this in certain paragraph styles,
so that they can request "don't count these lines", like Caption or
Header.

Change-Id: I2af591d2713cc23f4b634b69797f0dd61a37a2de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153298
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtline.hxx b/sw/inc/fmtline.hxx
index 7eaf2e29221b..87b22fe9d140 100644
--- a/sw/inc/fmtline.hxx
+++ b/sw/inc/fmtline.hxx
@@ -27,6 +27,8 @@
 
 class IntlWrapper;
 
+/// Contains the line numbering properties of this paragraph. Format -> 
Paragraph -> Outline & List
+/// tab, Line Numbering section is the UI for this.
 class SW_DLLPUBLIC SwFormatLineNumber final : public SfxPoolItem
 {
 sal_uLong m_nStartValue   :24; ///< Starting value for the paragraph. 0 == 
no starting value.


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-06-15 Thread Maxim Monastirsky (via logerrit)
 sw/inc/poolfmt.hxx  |2 ++
 sw/inc/strings.hrc  |1 +
 sw/qa/python/check_styles.py|2 +-
 sw/source/core/doc/DocumentStylePoolManager.cxx |   10 +-
 sw/source/core/doc/SwStyleNameMapper.cxx|3 ++-
 sw/source/core/doc/poolfmt.cxx  |1 +
 6 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 6e2c8f3f56ab52dfaa9bdce37423bac44cc64061
Author: Maxim Monastirsky 
AuthorDate: Thu Jun 15 11:23:02 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jun 15 19:34:13 2023 +0200

tdf#103064 sw: add a comment style

Change-Id: I96acdf3200836efe1d66e19dd85000fca9e7a6fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153109
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
index 358747e37808..4f017de21d3a 100644
--- a/sw/inc/poolfmt.hxx
+++ b/sw/inc/poolfmt.hxx
@@ -356,6 +356,8 @@ RES_POOLCOLL_SEND_ADDRESS,  
///< Sender.
 RES_POOLCOLL_ENDNOTE,   ///< Endnotes.
 
 RES_POOLCOLL_LABEL_DRAWING, ///< Label drawing 
objects.
+RES_POOLCOLL_COMMENT,   ///< Comment
+
 RES_POOLCOLL_EXTRA_END,
 
 /// Group indices.
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 38ae2f61bff9..97d216e7ba83 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -152,6 +152,7 @@
 #define STR_POOLCOLL_LABEL_FRAME
NC_("STR_POOLCOLL_LABEL_FRAME", "Text")
 #define STR_POOLCOLL_LABEL_DRAWING  
NC_("STR_POOLCOLL_LABEL_DRAWING", "Drawing")
 #define STR_POOLCOLL_LABEL_FIGURE   
NC_("STR_POOLCOLL_LABEL_FIGURE", "Figure")
+#define STR_POOLCOLL_COMMENTNC_("STR_POOLCOLL_COMMENT", 
"Comment")
 #define STR_POOLCOLL_ENVELOPE_ADDRESS   
NC_("STR_POOLCOLL_ENVELOPE_ADDRESS", "Addressee")
 #define STR_POOLCOLL_SEND_ADDRESS   
NC_("STR_POOLCOLL_SEND_ADDRESS", "Sender")
 #define STR_POOLCOLL_TOX_IDXH   NC_("STR_POOLCOLL_TOX_IDXH", 
"Index Heading")
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index 113fd801593c..aca3d8f0486e 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -131,7 +131,7 @@ class CheckStyle(unittest.TestCase):
 def test_ParagraphFamily(self):
 xDoc = CheckStyle._uno.openEmptyWriterDoc()
 xParaStyles = xDoc.StyleFamilies["ParagraphStyles"]
-vEmptyDocStyles = ['Standard', 'Heading', 'Text body', 'List', 
'Caption', 'Index', 'First line indent', 'Hanging indent', 'Text body indent', 
'Salutation', 'Signature', 'List Indent', 'Marginalia', 'Heading 1', 'Heading 
2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6', 'Heading 7', 'Heading 
8', 'Heading 9', 'Heading 10', 'Title', 'Subtitle', 'Appendix', 'Numbering 1 
Start', 'Numbering 1', 'Numbering 1 End', 'Numbering 1 Cont.', 'Numbering 2 
Start', 'Numbering 2', 'Numbering 2 End', 'Numbering 2 Cont.', 'Numbering 3 
Start', 'Numbering 3', 'Numbering 3 End', 'Numbering 3 Cont.', 'Numbering 4 
Start', 'Numbering 4', 'Numbering 4 End', 'Numbering 4 Cont.', 'Numbering 5 
Start', 'Numbering 5', 'Numbering 5 End', 'Numbering 5 Cont.', 'List 1 Start', 
'List 1', 'List 1 End', 'List 1 Cont.', 'List 2 Start', 'List 2', 'List 2 End', 
'List 2 Cont.', 'List 3 Start', 'List 3', 'List 3 End', 'List 3 Cont.', 'List 4 
Start', 'List 4', 'List 4 End', 'List 4 Cont.', 'List 5 Start', 'List 5
 ', 'List 5 End', 'List 5 Cont.', 'Index Heading', 'Index 1', 'Index 2', 'Index 
3', 'Index Separator', 'Contents Heading', 'Contents 1', 'Contents 2', 
'Contents 3', 'Contents 4', 'Contents 5', 'User Index Heading', 'User Index 1', 
'User Index 2', 'User Index 3', 'User Index 4', 'User Index 5', 'Contents 6', 
'Contents 7', 'Contents 8', 'Contents 9', 'Contents 10', 'Figure Index 
Heading', 'Figure Index 1', 'Object index heading', 'Object index 1', 'Table 
index heading', 'Table index 1', 'Bibliography Heading', 'Bibliography 1', 
'User Index 6', 'User Index 7', 'User Index 8', 'User Index 9', 'User Index 
10', 'Header and Footer','Header', 'Header left', 'Header right', 'Footer', 
'Footer left', 'Footer right', 'Table Contents', 'Table Heading', 
'Illustration', 'Table', 'Text','Figure', 'Frame contents', 'Footnote', 
'Addressee', 'Sender', 'Endnote', 'Drawing', 'Quotations', 'Preformatted Text', 
'Horizontal Line', 'List Contents', 'List Heading']
+vEmptyDocStyles = ['Standard', 'Heading', 'Text body', 'List', 
'Caption', 'Comment', 'Index', 'First line indent', 'Hanging indent', 'Text 
body indent', 'Salutation', 'Signature', 'List Indent', 'Marginalia', 'Heading 
1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6', 'Heading 
7', 'Heading 8', 'Heading 9', 'Heading 10', 'Title', 'Subtitle', 'Appendix', 
'Numbering 1 Start', 'Numbering 1', 'Numbering 1 End', 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-13 Thread Noel Grandin (via logerrit)
 sw/inc/AnnotationWin.hxx  |3 +++
 sw/source/uibase/docvw/AnnotationWin2.cxx |   23 +--
 2 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 8d18b5af883bb6b56e758801ee730a08bb88a8f5
Author: Noel Grandin 
AuthorDate: Tue Jun 13 10:11:08 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Jun 13 17:11:45 2023 +0200

speed up rendering annotatins, cache meta height

shaves 2% off scrolling profile on a large word doc

Change-Id: I283e3f99c1c385f3d20ea573d15ca59b4629c14d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152978
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 8499c392516a..c3d556085a03 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -29,6 +29,7 @@
 #include "postithelper.hxx"
 #include "swrect.hxx"
 #include "SidebarWindowsTypes.hxx"
+#include 
 
 class EditView;
 class PopupMenu;
@@ -212,6 +213,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 
 virtual voidLoseFocus() override;
 virtual voidGetFocus() override;
+virtual voidDataChanged( const DataChangedEvent& rDCEvt ) override;
 
 voidSetSizePixel( const Size& rNewSize ) override;
 SfxItemSet  DefaultItem();
@@ -280,6 +282,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 SwPostItField*   mpField;
 
 rtl::Reference 
mxSidebarWinAccessible;
+mutable std::optional moMetaHeight;
 };
 
 } // end of namespace sw::annotation
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 06efbfdb581f..2c4bc7ce3d5e 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1262,14 +1262,25 @@ int SwAnnotationWin::GetPrefScrollbarWidth() const
 
 sal_Int32 SwAnnotationWin::GetMetaHeight() const
 {
-const int fields = GetNumFields();
+if (!moMetaHeight)
+{
+const int fields = GetNumFields();
 
-sal_Int32 nRequiredHeight = 0;
-weld::Label* aLabels[3] = { mxMetadataAuthor.get(), mxMetadataDate.get(), 
mxMetadataResolved.get() };
-for (int i = 0; i < fields; ++i)
-nRequiredHeight += aLabels[i]->get_preferred_size().Height();
+sal_Int32 nRequiredHeight = 0;
+weld::Label* aLabels[3] = { mxMetadataAuthor.get(), 
mxMetadataDate.get(), mxMetadataResolved.get() };
+for (int i = 0; i < fields; ++i)
+nRequiredHeight += aLabels[i]->get_preferred_size().Height();
+moMetaHeight = nRequiredHeight;
+}
+return *moMetaHeight;
+}
 
-return nRequiredHeight;
+void SwAnnotationWin::DataChanged(const DataChangedEvent& rDCEvt)
+{
+if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && 
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+{
+moMetaHeight.reset();
+}
 }
 
 sal_Int32 SwAnnotationWin::GetNumFields() const


[Libreoffice-commits] core.git: sw/inc

2023-06-13 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtrowsplt.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d16606650621a1f9390091be5633772111b88584
Author: Miklos Vajna 
AuthorDate: Mon Jun 12 19:55:09 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 13 08:24:12 2023 +0200

sw: document SwFormatRowSplit

It's the row equivalent of a table's SwFormatLayoutSplit.

Change-Id: Ibf33df306d4d51ff8f8999b25b03693e1ebc5a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152930
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx
index c9aad4a80078..faf168ba2b5e 100644
--- a/sw/inc/fmtrowsplt.hxx
+++ b/sw/inc/fmtrowsplt.hxx
@@ -26,6 +26,8 @@
 
 class IntlWrapper;
 
+/// Controls if a table row is allowed to split or not. This is used in the 
item set of an
+/// SwTableLine's format.
 class SW_DLLPUBLIC SwFormatRowSplit final : public SfxBoolItem
 {
 public:


[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-12 Thread Balazs Varga (via logerrit)
 sw/inc/editsh.hxx|7 +++
 sw/inc/strings.hrc   |4 
 sw/source/core/access/AccessibilityCheck.cxx |   11 +--
 sw/source/core/access/AccessibilityIssue.cxx |   17 -
 sw/source/core/inc/AccessibilityIssue.hxx|1 +
 sw/source/uibase/inc/wrtsh.hxx   |1 +
 sw/source/uibase/wrtsh/wrtsh1.cxx|   11 +++
 7 files changed, 49 insertions(+), 3 deletions(-)

New commits:
commit c5cde93cd4327f55fdd23e6230c2cb101192374d
Author: Balazs Varga 
AuthorDate: Wed Jun 7 12:21:24 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jun 12 20:38:36 2023 +0200

tdf#155041 - A11Y sidebar: fix warning about missing form control 
description

Add form control objects to "Go to" and "Fix" functions.
In case of "Go to" a warning dialoge shows up if it is not in Design mode
and ask to switch on Design mode or not.

Change-Id: I79b6d67568e2ddfd121081d4c47ce7588f5d51b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152698
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 41650792e10b..766e504b4072 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -637,6 +637,13 @@ public:
 return true;
 }
 
+/// Switch to Design mode for Forms
+virtual bool WarnSwitchToDesignModeDialog() const
+{
+// override in SwWrtShell
+return false;
+}
+
 /** Query text within selection. */
 void GetSelectedText( OUString ,
 ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank 
);
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index c18aff49639a..38ae2f61bff9 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1469,6 +1469,10 @@
 // in order to change %PRODUCTNAME at runtime is expensive, so limit doing 
that as much as possible.
 #define STR_A11Y_DESC_AUTO  
NC_("insertcaption|extended_tip|auto", "Opens the Caption dialog. It has the 
same information as the dialog you get by menu %PRODUCTNAME Writer - 
AutoCaption in the Options dialog box.")
 
+#define STR_A11Y_DESIGN_MODE_TITLE  
NC_("STR_A11Y_DESIGN_MODE_TITLE", "The Forms are not editable")
+#define STR_A11Y_DESIGN_MODE_PRIMARY
NC_("STR_A11Y_DESIGN_MODE_PRIMARY", "Would you like to switch to Design mode?")
+#define STR_A11Y_DESIGN_MODE_SECONDARY  
NC_("STR_A11Y_DESIGN_MODE_SECONDARY", "You need to switch to design mode to 
edit Forms.")
+
 #define STR_MARK_COPY NC_("STR_MARK_COPY", "%1 Copy ")
 
 #define STR_INFORODLG_FOLDED_PRIMARY
NC_("STR_INFORODLG_FOLDED_PRIMARY", "You are trying to delete folded (hidden) 
content.")
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 302d26c9c06f..05d2634db863 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1360,9 +1360,11 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 lclAddIssue(m_aIssueCollection, SwResId(STR_FLOATING_TEXT));
 
 const SdrObjKind nObjId = pObject->GetObjIdentifier();
+const SdrInventor nInv = pObject->GetObjInventor();
 
 if (nObjId == SdrObjKind::CustomShape || nObjId == SdrObjKind::Text
-|| nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group)
+|| nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group
+|| nInv == SdrInventor::FmForm)
 {
 OUString sAlternative = pObject->GetTitle();
 if (sAlternative.isEmpty())
@@ -1371,7 +1373,12 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 OUString sIssueText = 
SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", sName);
 auto pIssue = lclAddIssue(m_aIssueCollection, sIssueText,
   sfx::AccessibilityIssueID::NO_ALT_SHAPE);
-pIssue->setIssueObject(IssueObject::SHAPE);
+// Set FORM Issue for Form objects because of the design mode
+if (nInv == SdrInventor::FmForm)
+pIssue->setIssueObject(IssueObject::FORM);
+else
+pIssue->setIssueObject(IssueObject::SHAPE);
+
 pIssue->setObjectID(pObject->GetName());
 pIssue->setDoc(*m_pDoc);
 }
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index 7f09b9d7cf05..d1ebb53bdeeb 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -71,6 +71,20 @@ void AccessibilityIssue::gotoIssue() const
 pWrtShell->ShowCursor();
 }
 break;
+case IssueObject::FORM:
+{
+SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
+bool bIsDesignMode = 
pWrtShell->GetView().GetFormShell()->IsDesignMode();
+if 

[Libreoffice-commits] core.git: sw/inc

2023-06-11 Thread Maxim Monastirsky (via logerrit)
 sw/inc/utlui.hrc |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7fa6198f29ac18ef2d58129918cb76c5da263d4f
Author: Maxim Monastirsky 
AuthorDate: Sun Jun 11 02:50:49 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Sun Jun 11 23:47:01 2023 +0200

tdf#154933 Update style names in autocorrect strings

Change-Id: I8a5157e10179c1813c1fd1a8f94c13c977131cf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152855
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc
index d5998e143514..5aa0b0e06e75 100644
--- a/sw/inc/utlui.hrc
+++ b/sw/inc/utlui.hrc
@@ -40,10 +40,10 @@ const TranslateId RID_SHELLRES_AUTOFMTSTRS[] =
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace dashes"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace 1st... with 1^st..."),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine single line paragraphs"),
-NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body\" Style"),
-NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"),
-NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging indent\" Style"),
-NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text\" Style"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging Indent\" Style"),
+NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Body Text, Indented\" Style"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Heading $(ARG1)\" Style"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Bullet\" or \"Numbering\" Style"),
 NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"),


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

2023-06-08 Thread Justin Luth (via logerrit)
 dev/null  |binary
 sw/inc/IDocumentSettingAccess.hxx |3 ---
 sw/qa/extras/layout/layout2.cxx   |8 
 sw/source/core/doc/DocumentSettingManager.cxx |6 --
 sw/source/core/inc/DocumentSettingManager.hxx |1 -
 sw/source/core/text/portxt.cxx|5 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 
 writerfilter/source/filter/WriterFilter.cxx   |1 -
 8 files changed, 1 insertion(+), 39 deletions(-)

New commits:
commit 278b6d21d36a0ff401fdd9ed6f964cd0dca862bf
Author: Justin Luth 
AuthorDate: Thu Jun 8 20:24:28 2023 -0400
Commit: Justin Luth 
CommitDate: Fri Jun 9 06:07:18 2023 +0200

tdf#152046 Revert "tdf#100680 sw DOCX compatibility: fix wrap of as_char 
flys"

This reverts 7.4 commit 41b012767feb8552b60a68c7be18d80c403304bf,

The premiss of the commit is that as-char flies needed to be handled 
differently,
and yet at the spot where it was implemented, we have no idea whether we
are even dealing with an as-char fly!!!

As this bug report report shows, it affects paragraphy that don't
have any fly whatsoever, let alone an as-char fly.

Change-Id: I2fedb2d610093933081e861a16a25de2f2716258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152778
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index f8d9bfa2ab59..f14ffb543b30 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -120,9 +120,6 @@ enum class DocumentSettingId
 // footnoteContainer default position is the page end instead of the 
column end
 // only if "evenly distributed" is set, and "collected at the end" is not 
set
 FOOTNOTE_IN_COLUMN_TO_PAGEEND,
-// AsChar anchored flys wrapped differently in ooxml than normally so in 
case of
-// docx enable this flag. For details see ticket tdf#100680.
-WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
 // Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
 NO_NUMBERING_SHOW_FOLLOWBY,
 // drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
diff --git a/sw/qa/extras/layout/data/tdf100680.docx 
b/sw/qa/extras/layout/data/tdf100680.docx
deleted file mode 100644
index c949540be388..
Binary files a/sw/qa/extras/layout/data/tdf100680.docx and /dev/null differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b4b004951bf0..9daa260c21c4 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -137,14 +137,6 @@ void SwLayoutWriter2::CheckRedlineCharAttributesHidden()
 "portion", "foobaz");
 }
 
-CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf100680_as_char_wrap)
-{
-createSwDoc("tdf100680.docx");
-auto pDump = parseLayoutDump();
-assertXPath(pDump, "/root/page/header/txt/SwParaPortion/SwLineLayout[3]");
-// If the third line missing that assert will fire, as was before the fix.
-}
-
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897)
 {
 createSwDoc("tdf148897.odt");
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 7eb4f9de5f20..5610f2a1f801 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -106,7 +106,6 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbFootnoteInColumnToPageEnd(false),
 mnImagePreferredDPI(0),
 mbAutoFirstLineIndentDisregardLineSpace(true),
-mbWrapAsCharFlysLikeInOOXML(false),
 mbNoNumberingShowFollowBy(false),
 mbDropCapPunctuation(true),
 mbUseVariableWidthNBSP(false)
@@ -254,7 +253,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs;
 case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
 return mbDoNotBreakWrappedTables;
-case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
 case DocumentSettingId::DROP_CAP_PUNCTUATION: return 
mbDropCapPunctuation;
 case DocumentSettingId::USE_VARIABLE_WIDTH_NBSP: return 
mbUseVariableWidthNBSP;
@@ -444,10 +442,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbDoNotBreakWrappedTables = value;
 break;
 
-case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML:
-mbWrapAsCharFlysLikeInOOXML = value;
-break;
-
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY:
 mbNoNumberingShowFollowBy = value;
 break;
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 

[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig

2023-06-07 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc  |2 
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |  164 +-
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |   29 ++
 sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui|  251 +-
 4 files changed, 432 insertions(+), 14 deletions(-)

New commits:
commit ee8405d7567c35ae240e014fe1da289b4bb1abe2
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jun 5 14:20:37 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 8 07:56:16 2023 +0200

tdf#155505 Group issues by type in a11y sidebar panel

Change-Id: I87349e9d3f5680751a91264e055e4579c97fa93e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152617
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index cb461b1013f8..12e2e1fa2b8d 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -13,7 +13,7 @@
 
 #define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String))
 
-#define STR_NO_ALT  NC_("STR_NO_ALT", "No alt or 
description text for graphic “%OBJECT_NAME%”.")
+#define STR_NO_ALT  NC_("STR_NO_ALT", "%OBJECT_NAME%")
 #define STR_TABLE_MERGE_SPLIT   NC_("STR_TABLE_MERGE_SPLIT", "Table 
“%OBJECT_NAME%” contains merges or splits.")
 #define STR_FAKE_NUMBERING  NC_("STR_FAKE_NUMBERING", "Simulated 
numbering “%NUMBERING%”.")
 #define STR_HYPERLINK_TEXT_IS_LINK  NC_("STR_HYPERLINK_TEXT_IS_LINK", 
"Hyperlink text is the same as the link address “%LINK%”.")
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index c0c8595408c6..1728ed58e266 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -69,7 +69,24 @@ std::unique_ptr 
A11yCheckIssuesPanel::Create(weld::Widget* pParent,
 
 A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* 
pBindings)
 : PanelLayout(pParent, "A11yCheckIssuesPanel", 
"modules/swriter/ui/a11ycheckissuespanel.ui")
-, m_xAccessibilityCheckBox(m_xBuilder->weld_box("accessibilityCheckBox"))
+, m_xExpanderDocument(m_xBuilder->weld_expander("expand_document"))
+, m_xExpanderStyles(m_xBuilder->weld_expander("expand_styles"))
+, m_xExpanderNoAlt(m_xBuilder->weld_expander("expand_no_alt"))
+, m_xExpanderTable(m_xBuilder->weld_expander("expand_table"))
+, m_xExpanderFormatting(m_xBuilder->weld_expander("expand_formatting"))
+, m_xExpanderHyperlink(m_xBuilder->weld_expander("expand_hyperlink"))
+, m_xExpanderFakes(m_xBuilder->weld_expander("expand_fakes"))
+, m_xExpanderNumbering(m_xBuilder->weld_expander("expand_numbering"))
+, m_xExpanderOther(m_xBuilder->weld_expander("expand_other"))
+, m_xBoxDocument(m_xBuilder->weld_box("box_document"))
+, m_xBoxStyles(m_xBuilder->weld_box("box_styles"))
+, m_xBoxNoAlt(m_xBuilder->weld_box("box_no_alt"))
+, m_xBoxTable(m_xBuilder->weld_box("box_table"))
+, m_xBoxFormatting(m_xBuilder->weld_box("box_formatting"))
+, m_xBoxHyperlink(m_xBuilder->weld_box("box_hyperlink"))
+, m_xBoxFakes(m_xBuilder->weld_box("box_fakes"))
+, m_xBoxNumbering(m_xBuilder->weld_box("box_numbering"))
+, m_xBoxOther(m_xBuilder->weld_box("box_other"))
 , mpBindings(pBindings)
 , mpDoc(nullptr)
 , maA11yCheckController(FN_STAT_ACCESSIBILITY_CHECK, *pBindings, *this)
@@ -108,7 +125,24 @@ void A11yCheckIssuesPanel::ImplDestroy()
 batch->commit();
 mpBindings->Invalidate(SID_ACCESSIBILITY_CHECK_ONLINE);
 }
-m_xAccessibilityCheckBox.reset();
+m_xExpanderDocument.reset();
+m_xExpanderStyles.reset();
+m_xExpanderNoAlt.reset();
+m_xExpanderTable.reset();
+m_xExpanderFormatting.reset();
+m_xExpanderHyperlink.reset();
+m_xExpanderFakes.reset();
+m_xExpanderNumbering.reset();
+m_xExpanderOther.reset();
+m_xBoxDocument.reset();
+m_xBoxStyles.reset();
+m_xBoxNoAlt.reset();
+m_xBoxTable.reset();
+m_xBoxFormatting.reset();
+m_xBoxHyperlink.reset();
+m_xBoxFakes.reset();
+m_xBoxNumbering.reset();
+m_xBoxOther.reset();
 }
 
 A11yCheckIssuesPanel::~A11yCheckIssuesPanel() { 
suppress_fun_call_w_exception(ImplDestroy()); }
@@ -122,23 +156,133 @@ void A11yCheckIssuesPanel::populateIssues()
 m_aIssueCollection = aCheck.getIssueCollection();
 
 // Remove old issue widgets
-for (auto const& xEntry : m_aAccessibilityCheckEntries)
-m_xAccessibilityCheckBox->move(xEntry->get_widget(), nullptr);
+for (auto const& xEntry : m_aDocumentEntries)
+m_xBoxDocument->move(xEntry->get_widget(), nullptr);
+for (auto const& xEntry : m_aStylesEntries)
+m_xBoxStyles->move(xEntry->get_widget(), nullptr);
+for (auto const& xEntry : m_aNoAltEntries)
+

[Libreoffice-commits] core.git: sw/inc sw/source

2023-06-06 Thread Michael Stahl (via logerrit)
 sw/inc/crsrsh.hxx|2 
 sw/inc/doc.hxx   |1 
 sw/source/core/crsr/crsrsh.cxx   |   38 -
 sw/source/core/docnode/ndtbl.cxx |  262 ---
 sw/source/core/edit/eddel.cxx|   15 +-
 sw/source/core/edit/edglss.cxx   |8 -
 6 files changed, 181 insertions(+), 145 deletions(-)

New commits:
commit f66d5331c1f55dfc88b1439f1b8e10ebe41d3f98
Author: Michael Stahl 
AuthorDate: Mon Jun 5 20:24:45 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jun 6 12:02:41 2023 +0200

tdf#155685 sw: fix crash on undo of ExtendedSelectAll with table at end

While the selection with table at the end works for Copy, unfortunately
it doesn't work for Delete, because SwUndoDelete can't handle it,
and an empty SwTableNode+SwEndNode pair remains.

This needs some extra code, extract a SwDoc::DelTable() out of
SwDoc::DeleteRowCol() and call it from SwEditShell::DeleteSel() to
create separate SwUndoDelete objects per table, which appears to work.

(regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda)

Change-Id: I1534b100d31bc279bce298d3c2bd235cffc1f9d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152628
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 6efdceee2838..cfba5cb852c1 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -332,7 +332,7 @@ public:
 // only for usage in special cases allowed!
 void ExtendedSelectAll(bool bFootnotes = true);
 /// If ExtendedSelectAll() was called and selection didn't change since 
then.
-SwNode const* ExtendedSelectedAll() const;
+::std::optional<::std::pair>> 
ExtendedSelectedAll() const;
 enum class StartsWith { None, Table, HiddenPara };
 /// If document body starts with a table or starts/ends with hidden 
paragraph.
 StartsWith StartsWith_();
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c3ac513c4b52..c729e0b2a983 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1210,6 +1210,7 @@ public:
 
 // Delete Columns/Rows in table.
 enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 
2 };
+void DelTable(SwTableNode * pTable);
 bool DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode eMode = 
RowColMode::DeleteRow);
 void DeleteRow( const SwCursor& rCursor );
 void DeleteCol( const SwCursor& rCursor );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c34827f092d8..325ff54d52cd 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -819,11 +819,12 @@ static typename SwCursorShell::StartsWith 
EndsWith(SwStartNode const& rStart)
 
 // return the node that is the start of the extended selection (to include 
table
 // or section start nodes; looks like extending for end nodes is not required)
-SwNode const* SwCursorShell::ExtendedSelectedAll() const
+::std::optional<::std::pair>>
+SwCursorShell::ExtendedSelectedAll() const
 {
 if (m_pTableCursor)
 {
-return nullptr;
+return {};
 }
 
 SwNodes& rNodes = GetDoc()->GetNodes();
@@ -834,27 +835,48 @@ SwNode const* SwCursorShell::ExtendedSelectedAll() const
 SwContentNode* pStart = rNodes.GoNext();
 if (!pStart)
 {
-return nullptr;
+return {};
 }
 
 nNode = *pStartNode->EndOfSectionNode();
 SwContentNode* pEnd = SwNodes::GoPrevious();
 if (!pEnd)
 {
-return nullptr;
+return {};
 }
 
 SwPosition aStart(*pStart, 0);
 SwPosition aEnd(*pEnd, pEnd->Len());
 if (!(aStart == *pShellCursor->Start() && aEnd == *pShellCursor->End()))
 {
-return nullptr;
+return {};
 }
 
+auto const ends(::EndsWith(*pStartNode));
 if (::StartsWith(*pStartNode) == StartsWith::None
-&& ::EndsWith(*pStartNode) == StartsWith::None)
+&& ends == StartsWith::None)
 {
-return nullptr; // "ordinary" selection will work
+return {}; // "ordinary" selection will work
+}
+
+::std::vector tablesAtEnd;
+if (ends == StartsWith::Table)
+{
+SwNode * pLastNode(rNodes[pStartNode->EndOfSectionIndex() - 1]);
+while (pLastNode->IsEndNode())
+{
+SwNode *const pNode(pLastNode->StartOfSectionNode());
+if (pNode->IsTableNode())
+{
+tablesAtEnd.push_back(pNode->GetTableNode());
+pLastNode = rNodes[pNode->GetIndex() - 1];
+}
+else if (pNode->IsSectionNode())
+{
+pLastNode = rNodes[pLastNode->GetIndex() - 1];
+}
+}
+assert(!tablesAtEnd.empty());
 }
 
 // tdf#133990 ensure directly containing section is included in 
SwUndoDelete
@@ -867,7 +889,7 @@ SwNode const* SwCursorShell::ExtendedSelectedAll() const
 
 // pStartNode is the node that fully contains the selection - the 

[Libreoffice-commits] core.git: sw/inc

2023-06-01 Thread Caolán McNamara (via logerrit)
 sw/inc/ndindex.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 020d72fb85dac7a52eacb29731b8f2d536a2892d
Author: Caolán McNamara 
AuthorDate: Thu Jun 1 09:22:08 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 1 14:47:03 2023 +0200

WaE: SwNodeIndex GCC12 spurious -Werror=dangling-pointer=

I see this with gcc 13 too

Change-Id: I63aed9a3bdc5bec7f96474145fd2ba30156741cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152478
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index d700ac11c2f0..775546597500 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -36,12 +36,12 @@ class SAL_WARN_UNUSED SW_DLLPUBLIC SwNodeIndex final : 
public sw::Ring

[Libreoffice-commits] core.git: sw/inc sw/source

2023-05-19 Thread László Németh (via logerrit)
 sw/inc/crsrsh.hxx  |   11 ++-
 sw/inc/strings.hrc |2 ++
 sw/source/core/crsr/crstrvl.cxx|   36 +++-
 sw/source/uibase/docvw/edtwin2.cxx |   22 --
 4 files changed, 51 insertions(+), 20 deletions(-)

New commits:
commit 5facae7614a1a82ed51241f50cec8e82bfb2cbda
Author: László Németh 
AuthorDate: Fri May 19 10:29:29 2023 +0200
Commit: László Németh 
CommitDate: Fri May 19 16:10:05 2023 +0200

tdf#155343 sw tracked table column: add tooltip

Tooltip of a deleted table column shows "Column Deleted",
an inserted table column (will) show "Column Inserted".

Follow-up to commit ffd8d20d368a885d6d786749278fa438573227a7
"tdf#150673 sw xmloff: import/export tracked table column" and
commit 84fbb3398f7486f00e7b7dea415e1ea2510a9535
"tdf#146144 sw: add tooltip to table rows with change tracking".

Change-Id: I79fd2397410328b320bd2536285cc5cc835da9fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151998
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 57bb90a11a5d..6efdceee2838 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -87,15 +87,16 @@ enum class IsAttrAtPos
 ContentCheck = 0x0400,
 SmartTag = 0x0800,
 FormControl  = 0x1000,
-TableRedline = 0x2000
+TableRedline = 0x2000,
+TableColRedline  = 0x4000
 #ifdef DBG_UTIL
-,CurrAttrs   = 0x4000///< only for debugging
-,TableBoxValue   = 0x8000///< only for debugging
+,CurrAttrs   = 0x8000///< only for debugging
+,TableBoxValue   = 0x1   ///< only for debugging
 #endif
-, ContentControl = 0x1
+, ContentControl = 0x2
 };
 namespace o3tl {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 struct SwContentAtPos
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index b7c8137c8275..c18aff49639a 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1268,6 +1268,8 @@
 #define STR_REDLINE_PARAGRAPH_FORMAT
NC_("STR_REDLINE_PARAGRAPH_FORMAT", "Paragraph formatting changed")
 #define STR_REDLINE_TABLE_ROW_INSERT
NC_("STR_REDLINE_TABLE_ROW_INSERT", "Row Inserted")
 #define STR_REDLINE_TABLE_ROW_DELETE
NC_("STR_REDLINE_TABLE_ROW_DELETE", "Row Deleted")
+#define STR_REDLINE_TABLE_COLUMN_INSERT 
NC_("STR_REDLINE_TABLE_COLUMN_INSERT", "Column Inserted")
+#define STR_REDLINE_TABLE_COLUMN_DELETE 
NC_("STR_REDLINE_TABLE_COLUMN_DELETE", "Column Deleted")
 #define STR_REDLINE_TABLE_CELL_INSERT   
NC_("STR_REDLINE_TABLE_CELL_INSERT", "Cell Inserted")
 #define STR_REDLINE_TABLE_CELL_DELETE   
NC_("STR_REDLINE_TABLE_CELL_DELETE", "Cell Deleted")
 #define STR_REDLINE_INSERT_MOVED
NC_("STR_REDLINE_INSERT_MOVED", "Moved (insertion)")
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 3ea5db46ccc9..a1656233cfc9 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1879,7 +1879,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 }
 }
 
-if( !bRet && ( IsAttrAtPos::TableRedline & rContentAtPos.eContentAtPos 
) )
+if( !bRet && ( ( IsAttrAtPos::TableRedline & 
rContentAtPos.eContentAtPos ) ||
+ ( IsAttrAtPos::TableColRedline & 
rContentAtPos.eContentAtPos ) ) )
 {
 const SwTableNode* pTableNd;
 const SwTableBox* pBox;
@@ -1889,17 +1890,34 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 nullptr != ( pBox = pTableNd->GetTable().GetTableBox(
 pSttNd->GetIndex() )) &&
 nullptr != ( pTableLine = pBox->GetUpper() ) &&
-RedlineType::None != pTableLine->GetRedlineType() )
+( RedlineType::None != pBox->GetRedlineType() ||
+RedlineType::None != pTableLine->GetRedlineType() ) )
 {
-SwRedlineTable::size_type nPos = 0;
-nPos = pTableLine->UpdateTextChangesOnly(nPos);
-if ( nPos != SwRedlineTable::npos )
+const SwRedlineTable& aRedlineTable = 
GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+if ( RedlineType::None != pTableLine->GetRedlineType() )
 {
-rContentAtPos.aFnd.pRedl = 
GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[nPos];
-rContentAtPos.eContentAtPos = IsAttrAtPos::TableRedline;
-bRet = true;
+SwRedlineTable::size_type nPos = 0;
+nPos = pTableLine->UpdateTextChangesOnly(nPos);
+if ( nPos != SwRedlineTable::npos )
+{
+rContentAtPos.aFnd.pRedl 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-05-19 Thread Matti Tyrväinen (via logerrit)
 sw/inc/txtrfmrk.hxx|3 +
 sw/qa/core/txtnode/txtnode.cxx |   41 ++
 sw/source/core/txtnode/atrref.cxx  |   52 +++
 sw/source/uibase/shells/basesh.cxx |   81 -
 4 files changed, 98 insertions(+), 79 deletions(-)

New commits:
commit 384a80fc56e75e3d1ee18ffc303db85490716829
Author: Matti Tyrväinen 
AuthorDate: Mon Feb 13 21:04:56 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 19 12:28:35 2023 +0200

tdf#81720 Don't expand Reference Marks

Make Reference Marks behave like nesting attributes such as
Hyperlinks. This is described as the ideal behavior in


Change-Id: I34ddfb3a6aa0147ba4bc281ebbb6342089b7bd08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146941
Reviewed-by: Matti 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx
index f73f8cf71019..c01387998392 100644
--- a/sw/inc/txtrfmrk.hxx
+++ b/sw/inc/txtrfmrk.hxx
@@ -21,6 +21,8 @@
 
 #include "txatbase.hxx"
 
+class SwDoc;
+class SwWrtShell;
 class SwTextNode;
 
 // Attribute for content-/position references in text.
@@ -37,6 +39,7 @@ public:
 
 virtual const sal_Int32* GetEnd() const override;   // SwTextAttr
 virtual void SetEnd(sal_Int32) override;   // SwTextAttr
+void UpdateFieldContent(SwDoc* pDoc, SwWrtShell& rWrtSh, OUString 
aContent);
 
 // get and set TextNode pointer
 inline const SwTextNode& GetTextNode() const;
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index f99cc3dd54dd..640df69ed211 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /// Covers sw/source/core/txtnode/ fixes.
 class SwCoreTxtnodeTest : public SwModelTestBase
@@ -219,6 +221,45 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testSplitNodeSuperscriptCopy)
 CPPUNIT_ASSERT(!aSet.HasItem(RES_CHRATR_ESCAPEMENT));
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDontExpandRefmark)
+{
+// Given a document with a refmark:
+createSwDoc();
+
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("TypeName", 
uno::Any(OUString("SetRef"))),
+comphelper::makePropertyValue(
+"Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} 
RNDpyJknp173F"))),
+comphelper::makePropertyValue("Content", uno::Any(OUString("foo"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertField", aArgs);
+
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint();
+SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
+std::vector aAttrs
+= pTextNode->GetTextAttrsAt(rCursor.GetContentIndex(), 
RES_TXTATR_REFMARK);
+
+auto& rRefmark = const_cast(aAttrs[0]->GetRefMark());
+auto pTextRefMark = const_cast(rRefmark.GetTextRefMark());
+
+// When typing after the refmark...
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, 
/*bBasicCall=*/false);
+pWrtShell->Insert(" bar");
+
+// and skipping back to insert a comma after the refmark
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, 
/*bBasicCall=*/false);
+pWrtShell->Insert(",");
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 3
+// - Actual  : 4
+// i.e. the reference mark expanded
+CPPUNIT_ASSERT_EQUAL(3, static_cast(*pTextRefMark->End()));
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testInsertDropDownContentControlTwice)
 {
 // Given an already selected dropdown content control:
diff --git a/sw/source/core/txtnode/atrref.cxx 
b/sw/source/core/txtnode/atrref.cxx
index b93b62e7433a..ffb4509aee70 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -32,6 +32,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 SwFormatRefMark::~SwFormatRefMark( )
 {
@@ -118,6 +121,8 @@ SwTextRefMark::SwTextRefMark( SwFormatRefMark& rAttr,
 }
 SetDontMoveAttr( true );
 SetOverlapAllowedAttr( true );
+SetDontExpand( true );  // like hyperlinks, reference markers shouldn't 
expand
+SetLockExpandFlag( true ); // protect the flag
 }
 
 SwTextRefMark::~SwTextRefMark()
@@ -153,6 +158,53 @@ void SwTextRefMark::SetEnd(sal_Int32 n)
 m_pHints->EndPosChanged();
 }
 
+void SwTextRefMark::UpdateFieldContent(SwDoc* pDoc, SwWrtShell& rWrtSh, 
OUString aContent)
+{
+if (!this->End())
+{
+return;
+}
+
+// Insert markers to remember where the paste positions are.
+const SwTextNode& rTextNode = this->GetTextNode();
+SwPaM 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-05-19 Thread Caolán McNamara (via logerrit)
 sw/inc/viewsh.hxx |5 ---
 sw/source/core/doc/htmltbl.cxx|4 +-
 sw/source/core/inc/rootfrm.hxx|2 -
 sw/source/core/layout/pagechg.cxx |5 ---
 sw/source/core/view/viewsh.cxx|   61 --
 sw/source/core/view/vnew.cxx  |6 +--
 sw/source/filter/html/swhtml.cxx  |3 -
 7 files changed, 7 insertions(+), 79 deletions(-)

New commits:
commit 669b95e6c99f9fc0ade7c23322b7142ef497133b
Author: Caolán McNamara 
AuthorDate: Tue May 16 20:58:05 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 19 09:59:18 2023 +0200

Related: tdf#155349 drop SetEndActionByVirDev from the html import

EndActionByVirDev only arises in the non-mainstream use html web document 
case and precedes the introduction of DoubleBuffer. It would be helpful to have 
one less corner case to consider.

Change-Id: Ibb9064cf5b37b1806f90c24ad9fbf84a8e37c0c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151854
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 3c8bc31b88c0..656e47347c02 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -137,8 +137,6 @@ class SW_DLLPUBLIC SwViewShell : public 
sw::Ring
 bool  mbFrameView   :1;  // If true it is a  (HTML-)Frame.
 bool  mbEnableSmooth:1;  // Disable SmoothScroll, e.g. for drag
 // of scrollbars.
-bool  mbEndActionByVirDev:1; // Paints from EndAction always via virtual 
device
-// (e.g. when browsing).
 bool  mbShowHeaderSeparator:1; ///< Flag to say that we are showing 
the header control
 bool  mbShowFooterSeparator:1; ///< Flag to say that we are showing 
the footer control
 bool  mbHeaderFooterEdit:1;  ///< Flag to say that we are editing 
header or footer (according to the bShow(Header|Footer)Separator above)
@@ -204,9 +202,6 @@ public:
 bool ActionPend() const { return mnStartAction != 0; }
 bool IsInEndAction() const { return mbInEndAction; }
 
-void SetEndActionByVirDev( bool b ) { mbEndActionByVirDev = b; }
-bool IsEndActionByVirDev() const{ return mbEndActionByVirDev; }
-
 // The ActionCount for all Shells is temporarily set to zero and then
 // restored at the RootFrame via UNO.
 voidSetRestoreActions(sal_uInt16 nSet);
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index ffa1a63267e2..4711a123ad0f 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1684,8 +1684,8 @@ void SwHTMLTableLayout::Resize_( sal_uInt16 nAbsAvail, 
bool bRecalc )
 // Else we can set the widths, in which we have to run Pass 2 in each case.
 SetWidths( true, nAbsAvail );
 
-if ( pRoot && pRoot->IsCallbackActionEnabled() )
-pRoot->EndAllAction( true );//True per VirDev (browsing is calmer)
+if (pRoot && pRoot->IsCallbackActionEnabled())
+pRoot->EndAllAction();
 }
 
 IMPL_LINK_NOARG( SwHTMLTableLayout, DelayedResize_Impl, Timer*, void )
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 0caf4012862d..80e104c9c63b 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -223,7 +223,7 @@ public:
  * automatically in the EndAllAction.
  */
 void StartAllAction();
-void EndAllAction( bool bVirDev = false );
+void EndAllAction();
 
 /**
  * Certain UNO Actions (e.g. table cursor) require that all Actions are 
reset temporarily
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index c38201a5ed9d..6f11380fc030 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1929,15 +1929,13 @@ void SwRootFrame::StartAllAction()
 }
 }
 
-void SwRootFrame::EndAllAction( bool bVirDev )
+void SwRootFrame::EndAllAction()
 {
 if ( !GetCurrShell() )
 return;
 
 for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
 {
-const bool bOldEndActionByVirDev = rSh.IsEndActionByVirDev();
-rSh.SetEndActionByVirDev( bVirDev );
 if ( auto pCursorShell = dynamic_cast( ) )
 {
 pCursorShell->EndAction();
@@ -1947,7 +1945,6 @@ void SwRootFrame::EndAllAction( bool bVirDev )
 }
 else
 rSh.EndAction();
-rSh.SetEndActionByVirDev( bOldEndActionByVirDev );
 }
 }
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a6197e994c51..16717f4e540d 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -337,71 +337,12 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
 oRegion->LimitToOrigin();
 oRegion->Compress( SwRegionRects::CompressFuzzy );
 
-ScopedVclPtr pVout;
 while ( !oRegion->empty() )
 {
 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-05-18 Thread Miklos Vajna (via logerrit)
 sw/inc/strings.hrc  |1 +
 sw/inc/swundo.hxx   |1 +
 sw/source/core/undo/undobj.cxx  |3 +++
 sw/source/uibase/shells/textsh1.cxx |4 ++--
 4 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit f5b3f8d6d9d7c060e35b6da295c043576cd36a57
Author: Miklos Vajna 
AuthorDate: Wed May 17 20:14:57 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 18 08:22:10 2023 +0200

sw: fix undo comment of FN_DELETE_SECTIONS

It's sections, not section. One has to dispatch .uno:DeleteSections to
see this in action, which does something if the document already has
existing sections.

I think this was the last place where the relatively new biblio-related
UNO commands had a wrong undo comment.

Change-Id: I55074174a498f26ea7bda721988940a86ad2e458
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151930
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index e9f4927c6200..b7c8137c8275 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -445,6 +445,7 @@
 #define STR_UPDATE_FIELDS   NC_("STR_UPDATE_FIELDS", 
"Update fields")
 #define STR_DELETE_FIELDS   NC_("STR_DELETE_FIELDS", 
"Delete fields")
 #define STR_UPDATE_SECTIONS NC_("STR_UPDATE_SECTIONS", 
"Update sections")
+#define STR_DELETE_SECTIONS NC_("STR_DELETE_SECTIONS", 
"Delete sections")
 #define STR_SORT_TBLNC_("STR_SORT_TBL", "Sort 
table")
 #define STR_SORT_TXTNC_("STR_SORT_TXT", "Sort 
text")
 #define STR_INSTABLE_UNDO   NC_("STR_INSTABLE_UNDO", 
"Insert table: $1$2$3")
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index b8bf714aa580..a0a7d918d017 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -178,6 +178,7 @@ enum class SwUndoId
 DELETE_FIELDS, // 146
 UPDATE_SECTIONS,   // 147
 CHANGE_THEME = 148,
+DELETE_SECTIONS = 149,
 };
 
 OUString GetUndoComment(SwUndoId eId);
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index e5d8469feb3c..712b8252e79d 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -679,6 +679,9 @@ OUString GetUndoComment(SwUndoId eId)
 case SwUndoId::CHANGE_THEME:
 pId = STR_UNDO_CHANGE_THEME_COLORS;
 break;
+case SwUndoId::DELETE_SECTIONS:
+pId = STR_DELETE_SECTIONS;
+break;
 }
 
 assert(pId);
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index a03c8b7249ef..774f6299559a 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -480,13 +480,13 @@ void DeleteSections(SfxRequest& rReq, SwWrtShell& rWrtSh)
 aSectionNamePrefix = pSectionNamePrefix->GetValue();
 }
 
-rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELSECTION, 
nullptr);
+
rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELETE_SECTIONS, 
nullptr);
 rWrtSh.StartAction();
 comphelper::ScopeGuard g(
 []
 {
 rWrtSh.EndAction();
-
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
+
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELETE_SECTIONS, 
nullptr);
 });
 
 SwDoc* pDoc = rWrtSh.GetDoc();


[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-05-17 Thread László Németh (via logerrit)
 sw/inc/swtable.hxx  |4 +--
 sw/qa/extras/layout/layout.cxx  |   44 
 sw/qa/extras/uiwriter/uiwriter5.cxx |4 +--
 sw/source/core/layout/tabfrm.cxx|7 +
 sw/source/core/layout/wsfrm.cxx |4 +--
 sw/source/core/table/swtable.cxx|   25 ++--
 sw/source/uibase/app/docsh2.cxx |2 -
 7 files changed, 81 insertions(+), 9 deletions(-)

New commits:
commit aff269c18b9029fec992135a406dc5031927c401
Author: László Németh 
AuthorDate: Mon May 15 19:11:11 2023 +0200
Commit: László Németh 
CommitDate: Wed May 17 19:45:01 2023 +0200

tdf#155345 sw tracked table column: hide them in Hide Changes mode

And if all columns are deleted, hide the table in Hide Changes mode.

Follow-up to commit ffd8d20d368a885d6d786749278fa438573227a7
"tdf#150673 sw xmloff: import/export tracked table column" and
commit f481c2c8e74bded11fac754e493560391229dbcd
"tdf#144057 sw track changes: hide deleted table rows".

Change-Id: Ic8f0254d607d629ed6386df94b16a939cde17506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151805
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 77ec4163eb31..e8b4ad35602f 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -354,8 +354,8 @@ public:
 
 // is it a table deleted completely with change tracking
 bool IsDeleted() const;
-// is it a table with deleted row(s)
-bool HasDeletedRow() const;
+// is it a table with a deleted row or cell
+bool HasDeletedRowOrCell() const;
 // it doesn't contain box content (except single empty nested tables of 
the boxes
 // which could remain after deletion of text content of the selected table)
 bool IsEmpty() const;
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index ab10a2af2bf0..07f041faaf96 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3302,6 +3302,50 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab", 0);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
+{
+createSwDoc("tdf144057.fodt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc());
+SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
+CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+
+// reject all deletions
+dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// delete table column with track changes
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+discardDumpedLayout();
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// show tracked column deletions
+assertXPath(pXmlDoc, "/root/page", 4);
+
+// hide tracked table column deletions
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+
+// This was 4 (unhidden tracked table column deletions)
+assertXPath(pXmlDoc, "/root/page", 2);
+
+// show tracked table column deletions again
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
+pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page", 4);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137)
 {
 createSwDoc("tdf109137.docx");
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 0bb6db185e37..00cc35e13998 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -1907,7 +1907,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976)
 SwTabFrame* pTabFrame = static_cast(pTable);
 
 // This was false (not deleted row)
-CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRow());
+CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRowOrCell());
 
 // accept all tracked changes
 dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
@@ -1960,7 +1960,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657)
 SwTabFrame* pTabFrame = static_cast(pTable);
 
 // This was false (not deleted row)
-CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRow());
+CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRowOrCell());
 
 // accept all tracked changes
 dispatchCommand(mxComponent, 

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-05-17 Thread László Németh (via logerrit)
 sw/inc/swtable.hxx   |2 
 sw/qa/extras/uiwriter/uiwriter5.cxx  |   49 
 sw/source/core/table/swtable.cxx |   31 ++
 sw/source/core/unocore/unocrsrhelper.cxx |   28 +
 sw/source/filter/ww8/docxtableexport.cxx |   92 +--
 5 files changed, 161 insertions(+), 41 deletions(-)

New commits:
commit 85a47bbb8340e65a19dc1ceaac768902a771ee77
Author: László Németh 
AuthorDate: Fri May 12 17:03:57 2023 +0200
Commit: László Németh 
CommitDate: Wed May 17 13:04:43 2023 +0200

tdf#155328 sw tracked table column: add DOCX export/import

Follow-up to commit ffd8d20d368a885d6d786749278fa438573227a7
"tdf#150673 sw xmloff: import/export tracked table column" and
commit 896c2199d9f0a28bd405dd2d1068f5e2973cdf06
"tdf#79069 DOCX: support tracked table (row) deletion".

Change-Id: Ifbe7b8b83e7071367104a09b4b559513227db786
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151709
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 0e01f1caecb5..77ec4163eb31 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -552,6 +552,8 @@ public:
 sal_uInt16 nMaxStep ) const
 { return const_cast(this)->FindEndOfRowSpan( rTable, 
nMaxStep ); }
 void RegisterToFormat( SwFormat& rFormat ) ;
+// get redline for the table cell, if it exists
+SwRedlineTable::size_type GetRedline() const;
 // get redline type
 RedlineType GetRedlineType() const;
 };
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 4dd0a42d83c0..0bb6db185e37 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2641,6 +2641,55 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf150673_RedlineTableColumnDeletionWi
 assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testRedlineTableColumnDeletionWithDOCXExport)
+{
+// load a 1-row table, and delete the first column with enabled change 
tracking:
+createSwDoc("tdf118311.fodt");
+SwDoc* pDoc = getSwDoc();
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// check table
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+// delete first table column with enabled change tracking
+// (HasTextChangesOnly property of the cell will be false)
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+// Deleted text content with change tracking,
+// but not table deletion
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+// Save it to a DOCX and load it back.
+// Exporting change tracking of the cell wasn't supported.
+// Also Manage Changes for the import.
+reload("Office Open XML Text", "tdf79069_tracked_table_deletion.docx");
+pDoc = getSwDoc();
+
+// accept the deletion of the content of the first cell
+SwEditShell* const pEditShell(pDoc->GetEditShell());
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pEditShell->GetRedlineCount());
+pEditShell->AcceptRedline(0);
+
+// table column was deleted
+// (working export/import of HasTextChangesOnly of table cells)
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "//page[1]//body/tab");
+assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128335)
 {
 // Load the bugdoc, which has 3 textboxes.
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 83cb70fc0a65..8b2d395c05eb 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2960,6 +2960,37 @@ void SwTableBox::ActualiseValueBox()
 }
 }
 
+SwRedlineTable::size_type SwTableBox::GetRedline() const
+{
+const SwStartNode *pSttNd = GetSttNd();
+
+if ( !pSttNd || GetRedlineType() == RedlineType::None )
+return SwRedlineTable::npos;
+
+SwPosition aCellStart( *GetSttNd(), SwNodeOffset(0) );
+SwPosition aCellEnd( *GetSttNd()->EndOfSectionNode(), SwNodeOffset(-1) );
+SwNodeIndex pEndNodeIndex(aCellEnd.GetNode());
+const SwRedlineTable& aRedlineTable = 

[Libreoffice-commits] core.git: sw/inc

2023-05-16 Thread Miklos Vajna (via logerrit)
 sw/inc/fmturl.hxx  |3 +--
 sw/inc/txtinet.hxx |1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a396d0e373f3e62931f2660a1b149e88d2eaefec
Author: Miklos Vajna 
AuthorDate: Mon May 15 20:13:53 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 16 08:40:49 2023 +0200

sw: document SwFormatURL and SwTextINetFormat

SwFormatURL is special, it has its won SwTextAttr subclass, instead of
going via the usual SwFormatAutoFormat.

Change-Id: Ibe06abcb486b6bf6037006e727be4ce750d489a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151806
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx
index c5418cd3c4b2..dcfcb9f9e830 100644
--- a/sw/inc/fmturl.hxx
+++ b/sw/inc/fmturl.hxx
@@ -28,8 +28,7 @@
 class ImageMap;
 class IntlWrapper;
 
-// URL, ServerMap and ClientMap
-
+/// SfxPoolItem subclass that wraps a URL.
 class SW_DLLPUBLIC SwFormatURL final : public SfxPoolItem
 {
 OUString  m_sTargetFrameName; ///< Target frame for URL.
diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx
index 50e3d4518dfa..1f3b4ab36ed2 100644
--- a/sw/inc/txtinet.hxx
+++ b/sw/inc/txtinet.hxx
@@ -25,6 +25,7 @@
 class SwTextNode;
 class SwCharFormat;
 
+/// SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
 class SW_DLLPUBLIC SwTextINetFormat final: public SwTextAttrNesting, public 
SwClient
 {
 private:


  1   2   3   4   5   6   7   8   9   10   >