[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

2023-11-11 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 6898f3ad90f2128de78726e689318bc3565b644a
Author: Michael Stahl 
AuthorDate: Wed Nov 1 20:31:44 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Nov 11 18:06:58 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 
(cherry picked from commit a71da3b7a80ca32b595a8ca0ea3da650b0af376c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158799
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 542138157d2f..fdfbeffe8a02 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -177,6 +177,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 ed9f9b31d674..43c20729363e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1651,6 +1651,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::EndCurrentSpan()
 {
 mpPDFExtOutDevData->GetSwPDFState()->m_oCurrentSpan.reset();
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 06c9c56b5d07..bfd15d5dfd90 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -162,6 +162,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
 roTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, 
*GetInfo().GetOut());
 }
 
+SwTaggedPDFHelper::EndCurrentLink(*GetInfo().GetOut());
+
 // Optimization!
 SwTwips nMaxRight = std::min( rPaint.Right(), Right() );
 const SwTwips nTmpLeft = GetInfo().X();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source vcl/qa

2023-10-25 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 bc3d8776a49c898710fd689f2d8ba7abf0db9954
Author: Michael Stahl 
AuthorDate: Tue Oct 24 13:51:39 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 11:28:35 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 
(cherry picked from commit 4c5283a3a11008a06a995c49ed34dc1f6066)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158286
Reviewed-by: Miklos Vajna 

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 9f99c58b4a35..1abd288b787d 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)

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source vcl/qa

2023-09-26 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 e8dda2f4c8f03c9fa0f9558b5d6ec4df81524682
Author: Michael Stahl 
AuthorDate: Wed Aug 30 16:24:50 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 13:36:33 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 
(cherry picked from commit ee3c3fcf5c48964f7bc1d64484409f072c614866)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156962
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 6a505ff7..8ae8d812b71a 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:
@@ -156,6 +157,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 0b4fe669b7d8..ad025d96a7d0 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)
 {
@@ -1530,6 +1545,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();
@@ -1539,6 +1563,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()
+&& 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

2023-08-24 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 f53f7228fc77ac5d2579c9039220d53b4d8443a2
Author: Balazs Varga 
AuthorDate: Mon Aug 21 19:42:38 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Aug 24 11:04:47 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 
(cherry picked from commit 069569e4a095f2fe42e94c2dad15356e2038727a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155925
Reviewed-by: Michael Stahl 

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 a6a7dc603a27..240bdb05b4fd 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 f988cfa95912..07f767e30785 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 c7da361e284f..983681051a2b 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())
 {
@@ -292,7 +295,7 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssu

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

2023-08-03 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 b7e07ea397cfac2a2260f01e64495e4e6d4c1bc6
Author: Michael Stahl 
AuthorDate: Wed Aug 2 13:26:39 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 3 13:59:25 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 
(cherry picked from commit 2d96d69322ac18f53668b75397c8587f94cd043b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155238
Reviewed-by: Miklos Vajna 

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 & 
rConte

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source vcl/qa

2023-08-02 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 56229692918505efcc5d466901e7f1123de45a66
Author: Michael Stahl 
AuthorDate: Mon Jul 10 17:39:03 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Aug 2 13:01:44 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 
(cherry picked from commit f2d5653a6792a19e9a45d34ac9dce22e717b8cbf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154263
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index eee6496bd17d..a6fad2594ae8 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 0a43dbb587ab..117ac8eb5e61 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 
@@ -3509,8 +3510,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, &aFrameInfo, 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, &linkInfo, 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 483597ca52b5..a864b389ceb9 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -391,7 +391,7 @@ bool SwTaggedPDFHelper::CheckReopenTag()
 {
 pKeyFrame = &rFrame;
 }
-else if ( rFrame.IsFlyFrame() )
+else if (rFrame.IsFlyFrame() && !mpFrameInfo->m_isLink)
 {
 const SwFormatAnchor& rAnchor =
 static_cast(&rFrame)->GetFormat()->GetAnchor();
@@ -531,6 +531,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(),
+[&aCenter](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 )
 {
@@ -805,6 +822,12 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 }
 }
 }
+
+if (mpFrameInfo->m_isLink)
+{
+SwRect const aRect(mpFrameInfo->mrFrame.getFrameArea());
+LinkLinkLink(*mpPDFExtOutDevData, aRect);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

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

New commits:
commit f4b6daca3d7efe80d5ddc6050a132ee0023bae94
Author: Balazs Varga 
AuthorDate: Thu Jul 6 17:42:38 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Jul 21 01:36:38 2023 +0200

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

outline level.

cherry-picked from commit: 5c43adc8e6f9948038be6c1fb20f4ac5718a74ea
(tdf#156139 - A11Y - Improve issue text when document starts with wrong)

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

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 165c3b410b95..b235ce19eb2d 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1193,11 +1193,19 @@ 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));
-
 lclAddIssue(m_rIssueCollection, resultString);
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

2023-07-07 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 1e8ec03543a8404543b9226896d36ab6dc72fa8f
Author: Mike Kaganski 
AuthorDate: Wed Jul 5 18:08:54 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jul 7 14:36:47 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 
(cherry picked from commit 7e997097eb0e36bbb6f1eb8519acfc4e8eb6337a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154174

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, &nPos))
+SwOutlineNodes::size_type nPos = 0;
+bool bFoundOutline = rNds.GetOutLineNds().Seek_Entry(pTextNd, &nPos);
+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 5446c708a5e9..7637852ed7d0 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', ' ');
-sP

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 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 9b267374c2a59bd53316a92139becb92ec5bac4e
Author: Mike Kaganski 
AuthorDate: Thu Jul 6 14:04:12 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 6 18:28:26 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 
(cherry picked from commit ab8a1e31019056709fbdbbd93a305c7e02af5a5b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154119
Tested-by: Jenkins

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(&rSet));
 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,
   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source

2023-06-13 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 b22b71879b7570cc1b9b550b9a95af2ff91e2777
Author: Balazs Varga 
AuthorDate: Wed Jun 7 12:21:24 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 13 23:19:08 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 
(cherry picked from commit c5cde93cd4327f55fdd23e6230c2cb101192374d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152973
Reviewed-by: Balazs Varga 
Reviewed-by: Xisco Fauli 

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 &rBuf,
 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:
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/inc sw/source sw/uiconfig

2023-06-08 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 7e6dc9d073c40e58ac7bdb6431f6f5f37b498e2b
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jun 5 14:20:37 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 8 12:30:57 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 
(cherry picked from commit ee8405d7567c35ae240e014fe1da289b4bb1abe2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152664

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_aStyle