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

2023-12-04 Thread Julien Nabet (via logerrit)
 sw/source/ui/frmdlg/column.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9e82062325cc00d2c2974d02d6759015bffdde03
Author: Julien Nabet 
AuthorDate: Thu Nov 30 17:46:08 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 4 13:20:28 2023 +0100

tdf#158450: fix crash when picking custom colour for column separator line

bt:
0x7ffeed9c4a2b in SwColumnPage::SwColumnPage(weld::Container*, 
weld::DialogController*, SfxItemSet const&)::$_0::operator()() const 
(this=0x574a8e38) at 
/home/julien/lo/libreoffice/sw/source/ui/frmdlg/column.cxx:396
396 [this]{ return GetDialogController()->getDialog(); 
}))
0  0x7ffeed9c4a2b in SwColumnPage::SwColumnPage(weld::Container*, 
weld::DialogController*, SfxItemSet const&)::$_0::operator()() const 
(this=0x574a8e38) at 
/home/julien/lo/libreoffice/sw/source/ui/frmdlg/column.cxx:396
1  0x7ffeed9c4a05 in std::__invoke_impl(std::__invoke_other, 
SwColumnPage::SwColumnPage(weld::Container*, weld::DialogController*, 
SfxItemSet const&)::$_0&) (__f=...) at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
2  0x7ffeed9c4985 in std::__invoke_r(SwColumnPage::SwColumnPage(weld::Container*, 
weld::DialogController*, SfxItemSet const&)::$_0&) (__fn=...) at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:114
3  0x7ffeed9c489d in std::_Function_handler::_M_invoke(std::_Any_data const&) (__functor=...) at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290
4  0x71cb89e5 in std::function::operator()() 
const (this=0x574a8e38) at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:591
5  0x71c94604 in ColorWindow::OpenPickerClickHdl(weld::Button&) 
(this=0x574a8db0) at 
/home/julien/lo/libreoffice/svx/source/tbxctrls/tbcontrl.cxx:2283
6  0x71c9356d in ColorWindow::LinkStubOpenPickerClickHdl(void*, 
weld::Button&) (instance=0x574a8db0, data=...) at 
/home/julien/lo/libreoffice/svx/source/tbxctrls/tbcontrl.cxx:2279

See complete bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=191146

Regression from:
862fd2fa19b64972247bde9b171ec828a30e1676
defer getting toplevel for color picker until we need it

Change-Id: I2932281cb3b1cb510013a19f6bcf3d9f9c6cdb7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160164
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 4f8bb267489b14aa1dab360786d8f99c763f03b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160224
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 028b9f1b209a..8caa69fade8c 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -393,7 +393,7 @@ SwColumnPage::SwColumnPage(weld::Container* pPage, 
weld::DialogController* pCont
 , m_xTextDirectionFT(m_xBuilder->weld_label("textdirectionft"))
 , m_xTextDirectionLB(new 
svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirectionlb")))
 , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"),
-[this]{ return GetDialogController()->getDialog(); }))
+[this]{ return GetFrameWeld(); }))
 , m_xLineTypeDLB(new 
SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
 , m_xEd1(new 
SwPercentField(m_xBuilder->weld_metric_spin_button("width1mf", FieldUnit::CM)))
 , m_xEd2(new 
SwPercentField(m_xBuilder->weld_metric_spin_button("width2mf", FieldUnit::CM)))


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

2023-11-29 Thread Xisco Fauli (via logerrit)
 sw/source/core/text/porexp.cxx |   41 -
 sw/source/core/text/portxt.cxx |   10 ++
 2 files changed, 6 insertions(+), 45 deletions(-)

New commits:
commit 88004761916bffd780bd5a1d6e0f744c23d5be4f
Author: Xisco Fauli 
AuthorDate: Wed Nov 29 13:30:40 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Nov 29 17:45:44 2023 +0100

tdf#157768: revert missing parts in 7.6 branch

This code was added with 28675af84ae8e2342bd78be3696dc09de6ce5cc5
"tdf#41652: Variable width NBSP" but not reverted in
a344f4ef39e59b8be5007531b6dd776d156c297e
"Revert variable width NBSP for 7.6"

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

diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 41b10a3c72f2..08a4258f1b23 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -207,47 +207,14 @@ bool SwBlankPortion::Format( SwTextFormatInfo  )
 
 void SwBlankPortion::Paint( const SwTextPaintInfo  ) const
 {
-// Draw field shade (can be disabled individually)
-if (!m_bMulti) // No gray background for multiportion brackets
-rInf.DrawViewOpt(*this, PortionType::Blank);
-
-if (m_cChar == CHAR_HARDBLANK)
-{
-if (rInf.GetOpt().IsBlank())
-{
-// Draw degree sign
-OUString aMarker = u"°";
-
-SwPosSize aMarkerSize(rInf.GetTextSize(aMarker));
-Point aPos(rInf.GetPos());
-
-std::shared_ptr pPortionRect = std::make_shared();
-rInf.CalcRect(*this, pPortionRect.get());
-aPos.AdjustX((pPortionRect->Width() / 2) - (aMarkerSize.Width() / 
2));
-
-SwTextPaintInfo aInf(rInf, );
-aInf.SetPos(aPos);
-SwTextPortion aMarkerPor;
-aMarkerPor.Width(aMarkerSize.Width());
-aMarkerPor.Height(aMarkerSize.Height());
-aMarkerPor.SetAscent(GetAscent());
-
-Color colorBackup = aInf.GetFont()->GetColor();
-aInf.GetFont()->SetColor(NON_PRINTING_CHARACTER_COLOR);
-aInf.DrawText(aMarkerPor, TextFrameIndex(aMarker.getLength()), 
true);
-aInf.GetFont()->SetColor(colorBackup);
-}
-}
-else
-{
-SwExpandPortion::Paint(rInf);
-}
+if( !m_bMulti ) // No gray background for multiportion brackets
+rInf.DrawViewOpt( *this, PortionType::Blank );
+SwExpandPortion::Paint( rInf );
 }
 
-bool SwBlankPortion::GetExpText( const SwTextSizeInfo& /*rInf*/, OUString 
 ) const
+bool SwBlankPortion::GetExpText( const SwTextSizeInfo&, OUString  ) const
 {
 rText = OUString(m_cChar);
-
 return true;
 }
 
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 99595c1a71f7..e11d11d044b5 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -589,10 +589,7 @@ TextFrameIndex SwTextPortion::GetSpaceCnt(const 
SwTextSizeInfo ,
 
 if ( InExpGrp() || PortionType::InputField == GetWhichPor() )
 {
-if (OUString ExpOut;
-(!IsBlankPortion()
- || (GetExpText(rInf, ExpOut) && OUStringChar(CH_BLANK) == ExpOut))
-&& !InNumberGrp() && !IsCombinedPortion())
+if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
 {
 // OnWin() likes to return a blank instead of an empty string from
 // time to time. We cannot use that here at all, however.
@@ -629,10 +626,7 @@ tools::Long SwTextPortion::CalcSpacing( tools::Long 
nSpaceAdd, const SwTextSizeI
 
 if ( InExpGrp() || PortionType::InputField == GetWhichPor() )
 {
-if (OUString ExpOut;
-(!IsBlankPortion()
- || (GetExpText(rInf, ExpOut) && OUStringChar(CH_BLANK) == ExpOut))
-&& !InNumberGrp() && !IsCombinedPortion())
+if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
 {
 // OnWin() likes to return a blank instead of an empty string from
 // time to time. We cannot use that here at all, however.


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

2023-11-29 Thread Mike Kaganski (via logerrit)
 sw/source/core/inc/unoflatpara.hxx |1 +
 sw/source/core/unocore/unoflatpara.cxx |3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9810b3c06c709ffef15932fe24106b503ea4ff46
Author: Mike Kaganski 
AuthorDate: Tue Nov 28 13:59:22 2023 +0300
Commit: Michael Stahl 
CommitDate: Wed Nov 29 11:20:19 2023 +0100

tdf#153693: improve SwXFlatParagraph::isModified check

The response from LanguageTool server may take some seconds, during which
the user may type more characters of an unfinished word. A result of the
check started using an incomplete text should be discarded in this case.

The code in GrammarCheckingIterator::ProcessResult that applies the check
results first calls isModified to decide if it should apply the result,
or to discard it. Before the change, SwXFlatParagraph::isModified only
checked that its underlying node is still referenced; but it could only
get nullified in SwXTextMarkup::Impl::Notify (only when the node dies),
or in SwXTextMarkup::ClearTextNode, called in SwXFlatParagraph::changeText
and SwXFlatParagraph::changeAttributes. Any external changes of the node
didn't mark SwXFlatParagraph "modified".

This change stores the initial text of the paragraph, from the moment of
creation of SwXFlatParagraph; and then compares it to the current text of
the node in isModified.

Change-Id: Ia9a2e74b256152fe311db874c66f7e5347183f12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160021
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 708e52a551daa27932dfae072a16e3512c72cf92)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160032
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/inc/unoflatpara.hxx 
b/sw/source/core/inc/unoflatpara.hxx
index 77e07af399b9..9fd768d277a9 100644
--- a/sw/source/core/inc/unoflatpara.hxx
+++ b/sw/source/core/inc/unoflatpara.hxx
@@ -98,6 +98,7 @@ private:
 SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete;
 
 OUString maExpandText;
+OUString maOrigText;
 };
 
 class SwXFlatParagraphIterator final :
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index c5c2ef94e441..8a55a993753d 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -68,6 +68,7 @@ CreateFlatParagraphIterator(SwDoc & rDoc, sal_Int32 const 
nTextMarkupType,
 SwXFlatParagraph::SwXFlatParagraph( SwTextNode& rTextNode, OUString 
aExpandText, const ModelToViewHelper& rMap )
 : SwXFlatParagraph_Base(& rTextNode, rMap)
 , maExpandText(std::move(aExpandText))
+, maOrigText(rTextNode.GetText())
 {
 }
 
@@ -233,7 +234,7 @@ sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 
nType )
 sal_Bool SAL_CALL SwXFlatParagraph::isModified()
 {
 SolarMutexGuard aGuard;
-return nullptr == GetTextNode();
+return !GetTextNode() || GetTextNode()->GetText() != maOrigText;
 }
 
 // text::XFlatParagraph:


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

2023-11-24 Thread Noel Grandin (via logerrit)
 sw/source/core/access/accfrmobj.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 3e7c55e34ab55e13d6eda54f947eb2e4bb2c22b8
Author: Noel Grandin 
AuthorDate: Thu Nov 23 17:47:24 2023 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 24 09:44:47 2023 +0100

tdf#158338 Opening file with image when JAWS is running causes endless loop

Revert "tdf#112865 assigning to mpDrawObj here is unnecessary"

This reverts commit 1c1647e6ee252fe68d7406d01043e88f1721590f.

Change-Id: I056123a90850989436dadf2d4504230550b9ae2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159768
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 1e51005a2413457a9030c565d627e39670785b56)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159892
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/accfrmobj.cxx 
b/sw/source/core/access/accfrmobj.cxx
index d8e78836b2a1..f78dc2d155db 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -106,7 +106,9 @@ void SwAccessibleChild::Init( const SdrObject* pDrawObj )
 void SwAccessibleChild::Init( const SwFrame* pFrame )
 {
 mpFrame = pFrame;
-mpDrawObj = nullptr;
+mpDrawObj = mpFrame && mpFrame->IsFlyFrame()
+? static_cast < const SwFlyFrame * >( mpFrame 
)->GetVirtDrawObj()
+: nullptr;
 mpWindow = nullptr;
 }
 


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

2023-11-12 Thread Julien Nabet (via logerrit)
 sw/source/ui/misc/translatelangselect.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 45f5fe188769bdc220752841e6588f9c020672f8
Author: Julien Nabet 
AuthorDate: Sat Nov 11 16:00:58 2023 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 13 01:18:05 2023 +0100

tdf#158171: fix crash when double-clicking DeepL translation dialog OK 
button

Change-Id: I4954357c59c7134d882fb19e9949ecbd5d60345a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159322
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 87b0196d595d1b78ba38bccc49e2a57d6047bc37)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159243
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/misc/translatelangselect.cxx 
b/sw/source/ui/misc/translatelangselect.cxx
index 8036cd11dec3..4de844e04343 100644
--- a/sw/source/ui/misc/translatelangselect.cxx
+++ b/sw/source/ui/misc/translatelangselect.cxx
@@ -127,6 +127,8 @@ IMPL_LINK_NOARG(SwTranslateLangSelectDlg, 
LangSelectCancelHdl, weld::Button&, vo
 
 IMPL_LINK_NOARG(SwTranslateLangSelectDlg, LangSelectTranslateHdl, 
weld::Button&, void)
 {
+if (m_bTranslationStarted)
+return;
 if (SwTranslateLangSelectDlg::selectedLangIdx == -1)
 {
 m_xDialog->response(RET_CANCEL);


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

2023-11-11 Thread Vasily Melenchuk (via logerrit)
 sw/source/filter/ww8/rtfattributeoutput.cxx |   37 +---
 1 file changed, 2 insertions(+), 35 deletions(-)

New commits:
commit 906377ef12bcf75da871b0c3dab1decaf5b20b32
Author: Vasily Melenchuk 
AuthorDate: Thu Oct 26 17:09:44 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Sat Nov 11 21:44:11 2023 +0100

tdf#104288: rtf export: drop \nonshppict on export

- these days hard to find a reader not able to read shapes

- RTF file will became compact without pictures duplication

- WordPad nowadays is able to display shape pict, no reason
for fallback

- Fixing possible rtf file bloat on exporting some WMFs

Change-Id: Icc8b60da6541acef939f42021d8d5e81bbcd1ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158507
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159313
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5c20be552480..c8ac5b4cadf4 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -4459,21 +4459,8 @@ void RtfAttributeOutput::FlyFrameGraphic(const 
SwFlyFrameFormat* pFlyFrameFormat
 }
 }
 
-/*
-   If the graphic is not of type WMF then we will have to store two
-   graphics, one in the native format wrapped in shppict, and the other in
-   the wmf format wrapped in nonshppict, so as to keep wordpad happy. If 
it's
-   a wmf already then we don't need any such wrapping
-   */
-bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, 
OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
 const SwAttrSet* pAttrSet = pGrfNode->GetpSwAttrSet();
-if (!pFrame || pFrame->IsInline())
-{
-if (!bIsWMF)
-m_rExport.Strm().WriteOString(
-"{" OOO_STRING_SVTOOLS_RTF_IGNORE 
OOO_STRING_SVTOOLS_RTF_SHPPICT);
-}
-else
+if (pFrame && !pFrame->IsInline())
 {
 m_rExport.Strm().WriteOString(
 "{" OOO_STRING_SVTOOLS_RTF_SHP
@@ -4566,27 +4553,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const 
SwFlyFrameFormat* pFlyFrameFormat
m_rExport, _rExport.Strm(), bWritePicProp, pAttrSet);
 }
 
-if (!pFrame || pFrame->IsInline())
-{
-if (!bIsWMF)
-{
-m_rExport.Strm().WriteOString("}"
-  "{" 
OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
-
-aStream.Seek(0);
-if (GraphicConverter::Export(aStream, rGraphic, 
ConvertDataFormat::WMF) != ERRCODE_NONE)
-SAL_WARN("sw.rtf", "failed to export the graphic");
-pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
-nSize = aStream.TellEnd();
-pGraphicAry = static_cast(aStream.GetData());
-
-ExportPICT(pFlyFrameFormat, aSize, aRendered, aMapped, rCr, 
pBLIPType, pGraphicAry,
-   nSize, m_rExport, _rExport.Strm());
-
-m_rExport.Strm().WriteChar('}');
-}
-}
-else
+if (pFrame && !pFrame->IsInline())
 m_rExport.Strm().WriteOString(""); // Close SV, SP, SHPINST and 
SHP.
 
 m_rExport.Strm().WriteOString(SAL_NEWLINE_STRING);


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

2023-11-11 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/viscrs.cxx  |4 
 sw/source/core/inc/rootfrm.hxx  |4 
 sw/source/core/layout/trvlfrm.cxx   |   49 +++
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   18 +
 vcl/qa/cppunit/pdfexport/data/LinkWithFly.fodt  |  137 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  349 +++-
 6 files changed, 549 insertions(+), 12 deletions(-)

New commits:
commit 1e6e6c6919cfd65bb8192fe893b45ee4d4bfa9be
Author: Michael Stahl 
AuthorDate: Fri Oct 27 19:45:09 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Sat Nov 11 18:07:15 2023 +0100

tdf#157816 sw: PDF export: filter out links on empty space, INetAttrs

Several problems here:
* As with fields, there may be selection rectangles with no text
* SwRootFrame::CalcFrameRects() adds flys that are anchored in the
  selection to the selection
* A fly text portion causes Link annotations to split, but not Link SE
* If a fly only partially overlaps a line vertically, then
  CalcFrameRects() produces a full-width half-height rectangle and
  another 2 half-width half-height rectangles on both sides.
  This is useless, the rectangles must be full line height.
  Add some code in CalcFrameRects() to use the fly portions in the
  SwParaPortion instead of the fly frame areas.

Change-Id: I93f0c12a5e5a3d5f51fcc4b33052a112e9174863
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158576
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit 5726be1314517d47dd733aabe64a3d85cce094c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158813
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index da9c043c6581..f681f3a32815 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -954,7 +954,9 @@ void SwShellCursor::FillRects()
 (GetMark()->GetNode() == GetPoint()->GetNode() ||
 (GetMark()->GetNode().IsContentNode() &&
  GetMark()->GetNode().GetContentNode()->getLayoutFrame( 
GetShell()->GetLayout() ) )   ))
-GetShell()->GetLayout()->CalcFrameRects( *this );
+{
+GetShell()->GetLayout()->CalcFrameRects(*this, *this);
+}
 }
 
 void SwShellCursor::Show(SfxViewShell const * pViewShell)
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 29f813360d82..90d18fcf0ee4 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_ROOTFRM_HXX
 
 #include "layfrm.hxx"
+#include 
 #include 
 #include 
 #include 
@@ -343,7 +344,8 @@ public:
 */
 bool IsBetweenPages(const Point& rPt) const;
 
-void CalcFrameRects( SwShellCursor& );
+enum class RectsMode { Default, NoAnchoredFlys };
+void CalcFrameRects(SwShellCursor const&, SwRects &, RectsMode eMode = 
RectsMode::Default);
 
 /**
  * Calculates the cells included from the current selection
diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index dfcfad57cef5..b7ae8fed0810 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -47,6 +47,8 @@
 #include 
 #include 
 #include 
+#include "../text/inftxt.hxx"
+#include "../text/itrpaint.hxx"
 #include 
 #include 
 
@@ -2016,7 +2018,7 @@ static void Add( SwRegionRects& rRegion, const SwRect& 
rRect )
  *  inverted rectangles are available.
  *  In the end the Flys are cut out of the section.
  */
-void SwRootFrame::CalcFrameRects(SwShellCursor )
+void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & 
rRects, RectsMode const eMode)
 {
 auto [pStartPos, pEndPos] = rCursor.StartEnd(); // SwPosition*
 
@@ -2572,7 +2574,46 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 const SwPageFrame *pPage  = pStartFrame->FindPageFrame();
 const SwPageFrame *pEndPage   = pEndFrame->FindPageFrame();
 
-while ( pPage )
+// for link rectangles: just remove all the fly portions - this prevents
+// splitting of portions vertically (causes spurious extra PDF annotations)
+if (eMode == RectsMode::NoAnchoredFlys)
+{
+assert(pStartFrame == pEndFrame); // link or field all in 1 frame
+assert(pStartFrame->IsTextFrame());
+SwTextGridItem const*const 
pGrid(GetGridItem(pStartFrame->FindPageFrame()));
+SwTextPaintInfo info(static_cast(pStartFrame), 
pStartFrame->FindPageFrame()->getFrameArea());
+SwTextPainter painter(static_cast(pStartFrame), );
+// because nothing outside the start/end has been added, it doesn't
+// matter to match exactly the start/end, subtracting outside is no-op
+
painter.CharToLine(static_cast(pStartFrame)->MapModelToViewPos(*pStartPos));
+do
+{
+

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

2023-11-09 Thread Caolán McNamara (via logerrit)
 sw/source/filter/html/htmlplug.cxx |2 +-
 sw/source/filter/xml/xmltexti.cxx  |2 +-
 tools/source/fsys/urlobj.cxx   |3 ++-
 xmloff/source/draw/ximpshap.cxx|2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 2e1bcbb550d54278b366ec619cc5280d44d6aba4
Author: Caolán McNamara 
AuthorDate: Sat Nov 4 19:57:51 2023 +
Commit: Eike Rathke 
CommitDate: Thu Nov 9 13:50:23 2023 +0100

warn about exotic protocols as well

Change-Id: I50dcf4f36cd20d75f5ad3876353143268740a50f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151834
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 1305f70cff8a81a58a5a6d9c96c5bb032005389e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159034
Reviewed-by: Eike Rathke 

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index e078b00e2d3b..880d16cf0219 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1117,7 +1117,7 @@ void SwHTMLParser::InsertFloatingFrame()
 
 OUString sHRef = aFrameDesc.GetURL().GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
 
-if (INetURLObject(sHRef).GetProtocol() == INetProtocol::Macro)
+if (INetURLObject(sHRef).IsExoticProtocol())
 NotifyMacroEventRead();
 
 xSet->setPropertyValue("FrameURL", uno::Any( sHRef ) );
diff --git a/sw/source/filter/xml/xmltexti.cxx 
b/sw/source/filter/xml/xmltexti.cxx
index 3035e22bce76..3c8fe79deb63 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -813,7 +813,7 @@ uno::Reference< XPropertySet > 
SwXMLTextImportHelper::createAndInsertFloatingFra
 OUString sHRef = URIHelper::SmartRel2Abs(
 INetURLObject( GetXMLImport().GetBaseURL() ), 
rHRef );
 
-if (INetURLObject(sHRef).GetProtocol() == INetProtocol::Macro)
+if (INetURLObject(sHRef).IsExoticProtocol())
 GetXMLImport().NotifyMacroEventRead();
 
 xSet->setPropertyValue("FrameURL",
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index cb749863e9fb..35b5e9244191 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -4885,7 +4885,8 @@ bool INetURLObject::IsExoticProtocol() const
 return m_eScheme == INetProtocol::Slot ||
m_eScheme == INetProtocol::Macro ||
m_eScheme == INetProtocol::Uno ||
-   isSchemeEqualTo(u"vnd.sun.star.script");
+   isSchemeEqualTo(u"vnd.sun.star.script") ||
+   isSchemeEqualTo(u"service");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index c32dd7cc847c..c653ef021a83 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3185,7 +3185,7 @@ void SdXMLFloatingFrameShapeContext::startFastElement 
(sal_Int32 /*nElement*/,
 
 if( !maHref.isEmpty() )
 {
-if (INetURLObject(maHref).GetProtocol() == INetProtocol::Macro)
+if (INetURLObject(maHref).IsExoticProtocol())
 GetImport().NotifyMacroEventRead();
 
 xProps->setPropertyValue("FrameURL", Any(maHref) );


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

2023-11-06 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   38 ++
 vcl/qa/cppunit/pdfexport/data/tdf157816.fodt|  175 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  389 
 3 files changed, 598 insertions(+), 4 deletions(-)

New commits:
commit d5ac2dcc4abf48224a84ea069316c93f40e0b403
Author: Michael Stahl 
AuthorDate: Fri Oct 27 18:00:14 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 14:35:31 2023 +0100

tdf#157816 sw: PDF export: filter out links on empty space, fields

If there is a fly overlapping a paragraph, it may happen (depending on
wrap settings and position) that there's an empty space on one side of
the fly; the cursor selection region has the flys removed, and this
region is used here for the PDF export.

So there is a rectangle on the text on one side of the fly, turned into
the desired Link annotation, and another rectangle on the other side of
the fly, turned into another undesired Link annotation that isn't
connected to any SE because without text there is no SE.

This is a tricky problem, and the only idea to fix it is to try to see
if there is text in the rectangle by first GetModelPositionForViewPoint()
resulting in a SwPosition and a SwSpecialPos with an index inside the
field; then see if GetCharRect() for this position returns a cursor
rectangle that intersects the original selection rectangle.

Change-Id: I6918eac16690e7194208a828108bfa968d28d12a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158571
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit 6593d680e21c24501a58bac216de4a7c71541959)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158811
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 201ff3c604a1..ed9f9b31d674 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -344,6 +344,35 @@ bool lcl_TryMoveToNonHiddenField(SwEditShell& rShell, 
const SwTextNode& rNd, con
 return true;
 };
 
+// tdf#157816: try to check if the rectangle contains actual text
+::std::vector GetCursorRectsContainingText(SwCursorShell const& rShell)
+{
+::std::vector ret;
+for (SwRect const& rRect : *rShell.GetCursor_())
+{
+Point center(rRect.Center());
+SwSpecialPos special;
+SwCursorMoveState cms(CursorMoveState::NONE);
+cms.m_pSpecialPos = 
+cms.m_bFieldInfo = true;
+SwPosition pos(rShell.GetDoc()->GetNodes());
+auto const [pStart, pEnd] = rShell.GetCursor_()->StartEnd();
+if (rShell.GetLayout()->GetModelPositionForViewPoint(, center, 
)
+&& *pStart <= pos && pos <= *pEnd)
+{
+SwRect charRect;
+if (rShell.GetCurrFrame(false)->GetCharRect(charRect, pos, , 
false)
+&& rRect.Overlaps(charRect))
+{
+ret.push_back(rRect);
+}
+}
+// reset stupid static var that may have gotten set now
+SwTextCursor::SetRightMargin(false); // WTF is this crap
+}
+return ret;
+}
+
 } // end namespace
 
 SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo,
@@ -2294,8 +2323,7 @@ void 
SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
 mrSh.SwCursorShell::Right( 1, SwCursorSkipMode::Chars );
 
 // Link Rectangles
-SwRects aTmp;
-aTmp.insert( aTmp.begin(), 
mrSh.SwCursorShell::GetCursor_()->begin(), 
mrSh.SwCursorShell::GetCursor_()->end() );
+SwRects const aTmp(GetCursorRectsContainingText(mrSh));
 OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles 
are missing" );
 
 mrSh.SwCursorShell::ClearMark();
@@ -2717,7 +2745,8 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
 mrSh.SwCursorShell::Right(1, SwCursorSkipMode::Chars);
 
 // Create the links.
-for (const auto& rLinkRect : *mrSh.SwCursorShell::GetCursor_())
+SwRects const rects(GetCursorRectsContainingText(mrSh));
+for (const auto& rLinkRect : rects)
 {
 for (const auto& rLinkPageNum : CalcOutputPageNums(rLinkRect))
 {
@@ -2767,7 +2796,8 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
 mrSh.SwCursorShell::Right(1, SwCursorSkipMode::Chars);
 
 // Create the links.
-for (const auto& rLinkRect : *mrSh.SwCursorShell::GetCursor_())
+SwRects const rects(GetCursorRectsContainingText(mrSh));
+for (const auto& rLinkRect : rects)
 {
 for (const auto& rLinkPageNum : CalcOutputPageNums(rLinkRect))
 {
diff --git 

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

2023-11-06 Thread Michael Stahl (via logerrit)
 sw/source/core/text/porlin.cxx |4 ++--
 sw/source/core/text/porlin.hxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 061e4a8c580f6b616182c12a3599870104634a52
Author: Michael Stahl 
AuthorDate: Wed Nov 1 13:09:13 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 10:21:01 2023 +0100

sw: SwLinePortion::Move() should be const

Change-Id: I79938773034fbe708ba867960c9effecb2e24a59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158766
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit a1b0fc647d14dc36e9fe238d5bfc81ebcfa1d5dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158812
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 4421f107f27f..fdd0ffba53b9 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -269,7 +269,7 @@ bool SwLinePortion::Format( SwTextFormatInfo  )
 void SwLinePortion::FormatEOL( SwTextFormatInfo & )
 { }
 
-void SwLinePortion::Move( SwTextPaintInfo  )
+void SwLinePortion::Move(SwTextPaintInfo & rInf) const
 {
 bool bB2T = rInf.GetDirection() == DIR_BOTTOM2TOP;
 const bool bFrameDir = rInf.GetTextFrame()->IsRightToLeft();
@@ -300,7 +300,7 @@ void SwLinePortion::Move( SwTextPaintInfo  )
 else
 rInf.X( rInf.X() + PrtWidth() );
 }
-if( IsMultiPortion() && static_cast(this)->HasTabulator() 
)
+if (IsMultiPortion() && static_cast(this)->HasTabulator())
 rInf.IncSpaceIdx();
 
 rInf.SetIdx( rInf.GetIdx() + GetLen() );
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 5ce25a3dd76b..8a43d1cde6e9 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -160,7 +160,7 @@ public:
 virtual bool Format( SwTextFormatInfo  );
 // Is called for the line's last portion
 virtual void FormatEOL( SwTextFormatInfo  );
-void Move( SwTextPaintInfo  );
+void Move(SwTextPaintInfo & rInf) const;
 
 // For SwTextSlot
 virtual bool GetExpText( const SwTextSizeInfo , OUString  ) 
const;


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

2023-11-06 Thread Michael Stahl (via logerrit)
 sw/source/core/text/itrcrsr.cxx |   54 +++-
 1 file changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 4db49918efa3ae13a74d8a1450f10fb25393ce86
Author: Michael Stahl 
AuthorDate: Fri Oct 27 16:18:44 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 10:20:46 2023 +0100

tdf#157816 sw: fix getting position in field portion follow

SwSpecialPos can be used to get index inside a field, but
SwTextCursor::GetModelPositionForViewPoint() has several problems:
* the field portion follow has length 0 so an early return is taken
* the nCharOfst is set to the index in the portion, but it needs to
  also count preceding portions of the same field in the line,
  and nLineOfst needs to be set as well, because the SwPosition
  corresponds to the start of the field
* m_bFieldInfo must be set to guarantee SwPosition before the field
  in the nLenght==0 branch, but then there are 2 branches that first
  set nLength=0 and then decrement it, resulting in a SwPosition 1
  char before the field.

Change-Id: Ib7d30981e41b40f4c068fa6d84211c000ecde753
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158570
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 468e5b8e0a7fefe1ca53faeb15f5f6527c37a268)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158810
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 80900061b66f..431aeea2734d 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1527,7 +1527,11 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 --nCurrStart;
 }
 }
-return nCurrStart;
+if (!pPor->InFieldGrp() || !static_cast(pPor)->IsFollow()
+|| !pCMS || !pCMS->m_pSpecialPos)
+{
+return nCurrStart;
+}
 }
 if (TextFrameIndex(1) == nLength || pPor->InFieldGrp())
 {
@@ -1757,18 +1761,56 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InFieldGrp() && pCMS && pCMS->m_pSpecialPos )
 {
 pCMS->m_pSpecialPos->nCharOfst = sal_Int32(nLength);
+// follow portions: need to add the length of all previous
+// portions for the same field
+if (static_cast(pPor)->IsFollow())
+{
+int nLines(0);
+std::vector portions;
+for (SwLineLayout const* pLine = 
GetInfo().GetParaPortion();
+true; pLine = pLine->GetNext())
+{
+for (SwLinePortion const* pLP = pLine; pLP && pLP 
!= pPor; pLP = pLP->GetNextPortion())
+{
+if (pLP->InFieldGrp())
+{
+SwFieldPortion const* 
pField(static_cast(pLP));
+if (!pField->IsFollow())
+{
+nLines = 0;
+portions.clear();
+}
+if (pLine == m_pCurr)
+{
+portions.emplace_back(pField);
+}
+}
+}
+if (pLine == m_pCurr)
+{
+break;
+}
+++nLines;
+}
+for (SwFieldPortion const* pField : portions)
+{
+pCMS->m_pSpecialPos->nCharOfst += 
pField->GetExp().getLength();
+}
+pCMS->m_pSpecialPos->nLineOfst = nLines;
+}
 nLength = TextFrameIndex(0);
 }
+else if (bFieldInfo && nLength == pPor->GetLen() &&
+ (! pPor->GetNextPortion() ||
+  ! pPor->GetNextPortion()->IsPostItsPortion()))
+{
+--nLength;
+}
 
 // set cursor bidi level
 if ( pCMS )
 pCMS->m_nCursorBidiLevel =
 aDrawInf.GetCursorBidiLevel();
-
-if( bFieldInfo && nLength == pPor->GetLen() &&
-( ! pPor->GetNextPortion() ||
-  ! pPor->GetNextPortion()->IsPostItsPortion() ) )
---nLength;
 }
 if( nOldProp )
 

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

2023-11-02 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx|3 
 sw/source/core/text/frmpaint.cxx   |4 
 sw/source/core/text/itrpaint.cxx   |   30 ++-
 vcl/qa/cppunit/pdfexport/data/LO_Lbl_Lbody_bug_report.fodt |  125 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   78 
 5 files changed, 229 insertions(+), 11 deletions(-)

New commits:
commit 8c0519dd7f0eb5c94ab90e8e342cd86e58b48834
Author: Michael Stahl 
AuthorDate: Wed Oct 18 19:15:22 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Nov 2 11:12:05 2023 +0100

tdf#157703 sw: PDF/UA export: fix headings with labels

The problem is that the new Lbl/LBody elements are produced even for
outline nodes, but those aren't represented as lists at all, but as
headings H1..H10.

Plausible representation of the heading label could be in a Lbl element
inside H1, or simply as plain text; i can't find any recommendation
either way.

Let's try Lbl inside H1, neither veraPDF nor PAC3 complain about it.

(regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158127
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7cb283cf0e92cba4bd53b1cd69816ac7037937e4)

tdf#157703 sw: PDF/UA export: export heading labels as text

Been advised that a Lbl element is not much use in practice.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158421
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 5dfae9e00f245da78613224ed8e0dbd8b6633192)

Change-Id: I691957d0c4a80d1339cb2b87c72c9aa652abfb9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158423
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 1abd288b787d..201ff3c604a1 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1318,7 +1318,8 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 const SwTextNode *const 
pTextNd(rTextFrame.GetTextNodeForParaProps());
 
 // lazy open LBody after Lbl
-if 
(rTextFrame.GetPara()->HasNumberingPortion(SwParaPortion::OnlyNumbering))
+if (!pTextNd->IsOutline()
+&& 
rTextFrame.GetPara()->HasNumberingPortion(SwParaPortion::OnlyNumbering))
 {
 sal_Int32 const nId = BeginTagImpl(nullptr, 
vcl::PDFWriter::LIBody, aListBodyString);
 SwNodeNum const*const 
pNodeNum(pTextNd->GetNum(rTextFrame.getRootFrame()));
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index e7e779eb0ea4..906b18616ddd 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -692,7 +692,9 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
 // Paragraph tag - if there is a list label, opening should be delayed.
 ::std::optional oTaggedParagraph;
 
-if (isPDFTaggingEnabled && 
!GetPara()->HasNumberingPortion(SwParaPortion::FootnoteToo))
+if (isPDFTaggingEnabled
+&& (GetTextNodeForParaProps()->IsOutline()
+|| !GetPara()->HasNumberingPortion(SwParaPortion::FootnoteToo)))
 {   // no Lbl needed => open paragraph tag now
 Frame_Info aFrameInfo(*this, false);
 oTaggedParagraph.emplace(nullptr, , nullptr, 
rRenderContext);
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 620838d10171..06c9c56b5d07 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -153,7 +153,8 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 bool bSkippedNumPortions(false);
 SwLinePortion *pPor = bEndPor ? m_pCurr->GetFirstPortion() : 
CalcPaintOfst(rPaint, bSkippedNumPortions);
 
-if (bSkippedNumPortions) // ugly but hard to check earlier in PaintSwFrame:
+if (bSkippedNumPortions // ugly but hard to check earlier in PaintSwFrame:
+&& !GetInfo().GetTextFrame()->GetTextNodeForParaProps()->IsOutline())
 {   // there is a num portion but it is outside of the frame area and not 
painted
 assert(!roTaggedLabel);
 assert(!roTaggedParagraph);
@@ -411,6 +412,7 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 if ((pPor->InNumberGrp() // also footnote label
 // weird special case, bullet with soft hyphen
  || (pPor->InHyphGrp() && pNext && pNext->InNumberGrp()))
+&& 
!GetInfo().GetTextFrame()->GetTextNodeForParaProps()->IsOutline()
 && !roTaggedLabel) // note: CalcPaintOfst may skip some portions
 {
 assert(isPDFTaggingEnabled);
@@ -434,11 

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

2023-10-31 Thread Miklos Vajna (via logerrit)
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |7 
+++
 1 file changed, 7 insertions(+)

New commits:
commit dc01c266f09e0f77442c8e2d5df7741b6a1f6af5
Author: Miklos Vajna 
AuthorDate: Fri Oct 27 08:11:05 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 31 09:49:56 2023 +0100

tdf#99822 sw floattable: allow nomimal overlap of objects from different 
cells

The bugdoc had a table with a single row and 2 columns, both cells had
too wide content. The first column had a too wide chart and the second
column had a too wide (multi-page) floating table.

What happened is that SwTabFrame::Split() wanted to recalc the split
row, and there the overlap detection code pushed down the 2nd shape to
the next page, but that next page only contained the 2nd shape, so the
shifted down shape wanted to go up to its original position and this way
the "format all content lowers" iteration in
SwContentFrame::CalcLowers() never returned.

Fix the problem by limiting the overlap detection to the same uppers,
i.e. in case two floating tables are anchored in the same cell (the
anchors have the same upper) to avoid the overlap, but in case the
anchors have different uppers, then don't worry about this. This seems
to match what Word does.

Regression from commit 5127b1961b762643d47a26704556fd9b8664c6fc (sw
floattable, nesting: add DOCX import, 2023-09-13), the original problem
was already solved by 63007619da7e6c4a6d0c466a8fe54324252be14b
(tdf#144798 DOCX import: handle ZOrder of chart objects, 2021-10-18), it
seems.

Change-Id: I21b9f0ae53bbc69d54a9a9f6870580e3a748ba7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158520
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 435f1aadf7dd8087a8997924bedfccff0f496ba2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158543
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 69951ba08a2c..31802ee4c184 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -1204,6 +1204,7 @@ void SwToContentAnchoredObjectPosition::CalcOverlap(const 
SwTextFrame* pAnchorFr
 
 // Get the list of objects.
 auto pSortedObjs = pAnchorFrameForVertPos->GetDrawObjs();
+const SwLayoutFrame* pAnchorUpper = pAnchorFrameForVertPos->GetUpper();
 
 bool bSplitFly = false;
 SwFlyFrame* pFlyFrame = GetAnchoredObj().DynCastFlyFrame();
@@ -1267,6 +1268,12 @@ void 
SwToContentAnchoredObjectPosition::CalcOverlap(const SwTextFrame* pAnchorFr
 // An inner fly overlapping with its outer fly is fine.
 continue;
 }
+
+if (pAnchoredObjFlyAnchor && pAnchoredObjFlyAnchor->GetUpper() != 
pAnchorUpper)
+{
+// A fly overlapping with a fly from an other upper is fine.
+continue;
+}
 }
 
 css::text::WrapTextMode eWrap = 
pAnchoredObj->GetFrameFormat().GetSurround().GetSurround();


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

2023-10-26 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/tabfrm.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit aa70e0d23abc99191829b4f1bc421e04a78e0a21
Author: Miklos Vajna 
AuthorDate: Wed Oct 25 09:45:05 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 26 13:59:38 2023 +0200

Related: tdf#157590 sw floattable: avoid a bit of not needed work

See

,
we only need to work out if this row has spans in case the row would
split, can skip this otherwise.

Change-Id: Ic61dade7f42e7e43322e902a1f91d6a62bdc0ed8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158414
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit d6527f127622f23ac529ce667fac5ff69ea33ea4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158439
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 079377aedb3c..bbea3ddbb6f0 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2645,10 +2645,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 auto pUpperFly = static_cast(GetUpper());
 bFlySplit = pUpperFly->IsFlySplitAllowed();
 
-if (bFlySplit)
+if (bFlySplit && bTryToSplit)
 {
-// See if this is a nested split fly where the inner 
table also has
-// rowspans.
+// This is a split fly that wants to split the row 
itself. See if it's also
+// nested. If so, we'll want to know if the row split 
has rowspans.
 SwTextFrame* pAnchorCharFrame = 
pUpperFly->FindAnchorCharFrame();
 if (pAnchorCharFrame && pAnchorCharFrame->IsInFly())
 {


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

2023-10-25 Thread Mike Kaganski (via logerrit)
 sw/source/filter/html/css1atr.cxx|   17 ++--
 sw/source/filter/html/htmlatr.cxx|   25 ++--
 sw/source/filter/html/htmldrawreader.cxx |   15 ++-
 sw/source/filter/html/htmldrawwriter.cxx |6 --
 sw/source/filter/html/htmlflywriter.cxx  |   64 +++
 sw/source/filter/html/htmlform.cxx   |   44 -
 sw/source/filter/html/htmlforw.cxx   |   14 --
 sw/source/filter/html/htmlgrin.cxx   |   15 +++
 sw/source/filter/html/htmlnumreader.cxx  |4 -
 sw/source/filter/html/htmlplug.cxx   |   19 ++---
 sw/source/filter/html/htmlsect.cxx   |   12 +
 sw/source/filter/html/htmltab.cxx|   14 +-
 sw/source/filter/html/htmltabw.cxx   |   60 ++---
 sw/source/filter/html/svxcss1.cxx|   11 -
 sw/source/filter/html/swhtml.cxx |   24 +--
 sw/source/filter/html/wrthtml.cxx|6 --
 sw/source/filter/html/wrthtml.hxx|5 +-
 17 files changed, 90 insertions(+), 265 deletions(-)

New commits:
commit e36ccfcdf0488ea2219af7e721af4963244f3d8f
Author: Mike Kaganski 
AuthorDate: Sat Aug 5 06:59:26 2023 +0300
Commit: Xisco Fauli 
CommitDate: Wed Oct 25 15:25:03 2023 +0200

Define px as 1/96 in in HTML filter

Ref: https://www.w3.org/TR/css3-values/#absolute-lengths

Change-Id: Idf1def9497b35f67ef1554220d1abbe640840f22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155366
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158419

diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 3af5f38498e4..a922be479841 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -466,10 +466,9 @@ void SwHTMLWriter::OutCSS1_UnitProperty( std::string_view 
pProp, tools::Long nVa
 OutCSS1_PropertyAscii(pProp, sOut);
 }
 
-void SwHTMLWriter::OutCSS1_PixelProperty( std::string_view pProp, tools::Long 
nVal,
-  bool bVert )
+void SwHTMLWriter::OutCSS1_PixelProperty( std::string_view pProp, tools::Long 
nTwips )
 {
-OString sOut(OString::number(ToPixel(nVal,bVert)) + sCSS1_UNIT_px);
+OString sOut(OString::number(ToPixel(nTwips)) + sCSS1_UNIT_px);
 OutCSS1_PropertyAscii(pProp, sOut);
 }
 
@@ -1965,16 +1964,14 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const 
SwFrameFormat& rFrameFormat
 if( nFrameOpts & HtmlFrmOpts::SWidth )
 {
 if( nFrameOpts & HtmlFrmOpts::SPixSize )
-OutCSS1_PixelProperty( sCSS1_P_width, aTwipSz.Width(),
-   false );
+OutCSS1_PixelProperty( sCSS1_P_width, aTwipSz.Width() 
);
 else
 OutCSS1_UnitProperty( sCSS1_P_width, aTwipSz.Width() );
 }
 if( nFrameOpts & HtmlFrmOpts::SHeight )
 {
 if( nFrameOpts & HtmlFrmOpts::SPixSize )
-OutCSS1_PixelProperty( sCSS1_P_height, 
aTwipSz.Height(),
-   true );
+OutCSS1_PixelProperty( sCSS1_P_height, 
aTwipSz.Height() );
 else
 OutCSS1_UnitProperty( sCSS1_P_height, aTwipSz.Height() 
);
 }
@@ -2780,7 +2777,7 @@ static SwHTMLWriter& OutCSS1_SwFormatFrameSize( 
SwHTMLWriter& rWrt, const SfxPoo
 else if( nMode & Css1FrameSize::Pixel )
 {
 rWrt.OutCSS1_PixelProperty( sCSS1_P_width,
-rFSItem.GetSize().Width(), false );
+rFSItem.GetSize().Width() );
 }
 else
 {
@@ -3235,9 +3232,7 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rWrt,
 sal_Int32 nWidth = pLine->GetWidth();
 
 OStringBuffer sOut;
-if( Application::GetDefaultDevice() &&
-nWidth <= Application::GetDefaultDevice()->PixelToLogic(
-Size( 1, 1 ), MapMode( MapUnit::MapTwip) ).Width() )
+if( nWidth <= o3tl::convert(1, o3tl::Length::px, o3tl::Length::twip) )
 {
 // If the width is smaller than one pixel, then export as 1px
 // so that Netscape and IE show the line.
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index 62460cc2be90..13db3a1ceac6 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2074,7 +2074,7 @@ SwHTMLWriter& OutHTML_SwTextNode( SwHTMLWriter& rWrt, 
const SwContentNode& rNode
 nPageWidth = 
pBox->GetFrameFormat()->GetFrameSize().GetWidth();
 }
 
-OString sWidth = 
OString::number(SwHTMLWriter::ToPixel(nPageWidth - nLeft - nRight, false));
+  

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

2023-10-25 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   13 
 vcl/qa/cppunit/pdfexport/data/SimpleTOC.fodt|  323 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  128 +
 3 files changed, 463 insertions(+), 1 deletion(-)

New commits:
commit eeba703a36aa1e1adcd8dc8b6f87e267ee38aae7
Author: Michael Stahl 
AuthorDate: Fri Oct 20 20:03:11 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 11:17:08 2023 +0200

tdf#157817 sw: PDF/UA export: fix ToX header sections

The problem was that a P or equivalent element is not allowed as child
of a TOC; previously the P was outside/before the TOC because the ToX
header was completely ignored but now it starts a SE for the ToC content
section before being ignored.

Tagged PDF Best Practice Guide suggests putting the header inside a
Caption element.

Another problem is that if the ToX header is on one page but the first
entry in the ToX content section is on the next page, BeginTag() created
a new SE for the ToX content section.

(regression from commit 033e37b49b5712df19dbfd2c307a102bce620de1)

Change-Id: I3c1f8fdda81c1f10198f5eaefc10bcd14f277a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158298
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit a5851d0a6fdc3e08e93daf8cf0ae7f6fc2d73ef6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158285
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 9ebc233dc687..9f99c58b4a35 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -524,6 +524,7 @@ void SwTaggedPDFHelper::BeginTag( 
vcl::PDFWriter::StructElement eType, const OUS
 
 if ( ( rFrame.IsPageFrame() && !static_cast(rFrame).GetPrev() ) ||
  ( rFrame.IsFlowFrame() && 
!SwFlowFrame::CastFlowFrame()->IsFollow() && 
SwFlowFrame::CastFlowFrame()->HasFollow() ) ||
+ rFrame.IsSctFrame() || // all of them, so that opening parent 
sections works
  ( rFrame.IsTextFrame() && rFrame.GetDrawObjs() ) ||
  (rFrame.IsFootnoteFrame() && static_cast(rFrame).GetFollow()) ||
  ( rFrame.IsRowFrame() && rFrame.IsInSplitTableRow() ) ||
@@ -665,6 +666,12 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 bRowSpan = true;
 break;
 
+case vcl::PDFWriter::Caption:
+if (pFrame->IsSctFrame())
+{
+break;
+}
+[[fallthrough]];
 case vcl::PDFWriter::H1 :
 case vcl::PDFWriter::H2 :
 case vcl::PDFWriter::H3 :
@@ -673,7 +680,6 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 case vcl::PDFWriter::H6 :
 case vcl::PDFWriter::Paragraph :
 case vcl::PDFWriter::Heading :
-case vcl::PDFWriter::Caption :
 case vcl::PDFWriter::BlockQuote :
 
 bPlacement =
@@ -1271,6 +1277,11 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 OpenTagImpl(pSection);
 break;
 }
+else if (SectionType::ToxHeader == pSection->GetType())
+{
+nPDFType = vcl::PDFWriter::Caption;
+aPDFType = aCaptionString;
+}
 else if (SectionType::ToxContent == pSection->GetType())
 {
 const SwTOXBase* pTOXBase = pSection->GetTOXBase();
diff --git a/vcl/qa/cppunit/pdfexport/data/SimpleTOC.fodt 
b/vcl/qa/cppunit/pdfexport/data/SimpleTOC.fodt
new file mode 100644
index ..6e7e88ffe9bc
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/SimpleTOC.fodt
@@ -0,0 +1,323 @@
+
+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; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 

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

2023-10-24 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/paintfrm.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 7ac1eada88ff81830bb0d36cda4a902084b5f8d9
Author: Michael Stahl 
AuthorDate: Fri Oct 20 17:33:42 2023 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Oct 24 23:56:06 2023 +0200

tdf#157145 sw: PDF/UA export: tag borders as Artifacts

(probably regression from commit 804d0a896731629397c5328c13c04a45bc55f459
 moving the ProcessPrimitives to SwRootFrame::PaintSwFrame())

Change-Id: I4015ffe6566c94e9f3b3694d39e0c24797cb9039
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158266
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit e9ca8fb1af1e3d41160c13e8002f05a610a0bd0b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158281
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index bd07aa9e1675..8242a99634f2 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3514,7 +3514,10 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
 // fdo#42750: delay painting these until after subsidiary lines
 // fdo#45562: delay painting these until after hell layer
 // fdo#47717: but do it before heaven layer
-ProcessPrimitives(gProp.pBLines->GetBorderLines_Clear());
+{
+SwTaggedPDFHelper tag(nullptr, nullptr, nullptr, 
rRenderContext);
+ProcessPrimitives(gProp.pBLines->GetBorderLines_Clear());
+}
 
 if ( pSh->Imp()->HasDrawView() )
 {


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

2023-10-19 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/frmtool.cxx |   35 -
 sw/source/core/text/itrform2.cxx  |   45 ++
 2 files changed, 32 insertions(+), 48 deletions(-)

New commits:
commit b967e0978276b58cbdc8db7fb215aa0fa07241c3
Author: Miklos Vajna 
AuthorDate: Wed Oct 18 08:52:44 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 19 16:42:26 2023 +0200

tdf#157573 sw floattable: fix incorrect lack of left margin after table

Regression from d477fa8ac1b0d3ee81427217bbb5950278ab16db (sw floattable:
unconditionally map  to SwFormatFlySplit, 2023-03-17), the
paragraph after the anchor of the floating table in the document lost
its left paragraph margin at a layout level.

Turns out the problem was there earlier, but it was hidden for this
specific document, because we used to map DOCX floating tables to Writer
inline tables in some cases before. The real problem was introduced
earlier, in my 50a1df360c907d8419ce49f098b6bc87a37a9956 (n#775899 sw:
add FloattableNomargins compat flag, 2012-08-23), even a TODO was added
to point out this will be problematic. The old bugdoc wants to get rid
of margins, because the floating table is already shifting text towards
the right, the new bugdoc wants to keep the original margin as the
paragraph after the anchor is not wrapping.

Fix the problem by reverting the older fix and re-fix the old document
differently. Don't do changes to the paragraph margin: that's not a good
idea. If there is enough anchor text, it'll lead to a visibly bad
paragraph margin anyway. Instead of reducing the paragraph margin,
reduce the width of the fly portion in the paragraphs that intersect
with the floating table. That's reasonly straightforward to do, because
SwTextFormatter::CalcFlyWidth() already has a case when we know we're
intersecting with a floating table and we also know that the floating
table is aligned to the left. In this case we can simply reduce the fly
portion width with the paragraph margin. This keeps the old bugdoc fixed
and fixes the new bugdoc.

It also means that DocumentSettingId::FLOATTABLE_NOMARGINS is now
effectively unused, but that's not yet removed in this change.

Change-Id: Ibaccc4807fd8c11bd45955b76e96cd4a5e55976f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158103
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158176

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 7f27932434c6..853f363f38e8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2367,25 +2367,6 @@ tools::Long SwBorderAttrs::CalcRight( const SwFrame* 
pCaller ) const
 return nRight;
 }
 
-/// Tries to detect if this paragraph has a floating table attached.
-static bool lcl_hasTabFrame(const SwTextFrame* pTextFrame)
-{
-if (pTextFrame->GetDrawObjs())
-{
-const SwSortedObjs* pSortedObjs = pTextFrame->GetDrawObjs();
-if (pSortedObjs->size() > 0)
-{
-SwAnchoredObject* pObject = (*pSortedObjs)[0];
-if (auto pFly = pObject->DynCastFlyFrame())
-{
-if (pFly->Lower() && pFly->Lower()->IsTabFrame())
-return true;
-}
-}
-}
-return false;
-}
-
 tools::Long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
 {
 tools::Long nLeft=0;
@@ -2405,23 +2386,9 @@ tools::Long SwBorderAttrs::CalcLeft( const SwFrame 
*pCaller ) const
 nLeft += m_pRightMargin->GetRight();
 else
 {
-bool bIgnoreMargin = false;
 if (pCaller->IsTextFrame())
 {
-const SwTextFrame* pTextFrame = static_cast(pCaller);
-if 
(pTextFrame->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::FLOATTABLE_NOMARGINS))
-{
-// If this is explicitly requested, ignore the margins next to 
the floating table.
-if (lcl_hasTabFrame(pTextFrame))
-bIgnoreMargin = true;
-// TODO here we only handle the first two paragraphs, would be 
nice to generalize this.
-else if (pTextFrame->FindPrev() && 
pTextFrame->FindPrev()->IsTextFrame() && lcl_hasTabFrame(static_cast(pTextFrame->FindPrev(
-bIgnoreMargin = true;
-}
-if (!bIgnoreMargin)
-{
-nLeft += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent);
-}
+nLeft += m_pTextLeftMargin->GetLeft(*m_pFirstLineIndent);
 }
 else
 nLeft += m_xLR->GetLeft();
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index c44b831d2a63..51c2d7a9423f 100644
--- a/sw/source/core/text/itrform2.cxx
+++ 

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

2023-10-18 Thread Michael Weghorn (via logerrit)
 sw/source/uibase/uiview/view2.cxx |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 16940dc248068133363153a1c2d41cd2d0102460
Author: Michael Weghorn 
AuthorDate: Wed Oct 18 10:59:33 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Oct 18 22:26:15 2023 +0200

tdf#156033 sw: Don't capture mouse when executing file dlg

When the mouse is captured in
`SwView::InsertGraphicDlg`, temporarily
release it while executing the file dialog,
so the user can use the mouse to interact with
the file dialog.

At least with qt5/qt6/kf5, this would otherwise
not work in the file dialog shown after clicking
on a previously inserted Picture Content Control,
because `QWidget::grabMouse()`'s "other widgets
get no mouse events at all" [1] apparently applies
for the file dialog and other running applications
as well.

[1] https://doc.qt.io/qt-6/qwidget.html#grabMouse

Change-Id: I80a81c57c80debc716a1b111a9c07eef0c005c65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158109
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 680ae3e989c3b665b29f536c2e30dd86bbc3edac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158045
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index f7cfb6563803..585f38b7cae1 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -441,11 +441,22 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
 
 const SfxStringItem* pName = 
rReq.GetArg(SID_INSERT_GRAPHIC);
 bool bShowError = !pName;
-if( pName
+
+bool bHaveName = pName != nullptr;
 #if HAVE_FEATURE_DESKTOP
-|| (!Application::IsHeadlessModeEnabled() && ERRCODE_NONE == 
pFileDlg->Execute())
+if (!bHaveName && !Application::IsHeadlessModeEnabled())
+{
+// execute file dialog, without capturing mouse (tdf#156033)
+vcl::Window* pWin = GetWindow();
+const bool bMouseCaptured = pWin && pWin->IsMouseCaptured();
+if (bMouseCaptured)
+pWin->ReleaseMouse();
+bHaveName =  ERRCODE_NONE == pFileDlg->Execute();
+if (bMouseCaptured)
+pWin->CaptureMouse();
+}
 #endif
-)
+if (bHaveName)
 {
 
 OUString aFileName, aFilterName;


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

2023-10-18 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |   16 
 sw/source/core/crsr/swcrsr.cxx |   14 +++---
 2 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 92d75686181349f4b79aef413a070ab8335f97b9
Author: Michael Stahl 
AuthorDate: Wed Oct 18 15:17:29 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Oct 18 22:22:06 2023 +0200

sw: fix stack overflow on kde45196-1.html

Previously, the shell cursor was put onto a SwGrfNode in the top left
corner, which is invalid, but didn't crash immediately.

With commit b20ca8d951e8205c8b963c6b7407f984053b4094 the cursor is
instead put onto the first SwTextNode in the body, which happens to be
in a table, and the entire table is hidden; this causes an infinite
recursion in SwCursorShell::UpdateCursorPos() because
GetModelPositionForViewPoint() no longer moves it to SwGrfNode.

So try to move the cursor out of a hidden node, which requires an
additional change in SwCursor::IsSelOvr() to allow moving from a node
without a frame to another node without a frame.

Change-Id: Ia33c7b558755f7e8b65ea3ff2c46aea20be577dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158119
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit fa4fe53aa775cdc50eec715f4bd88469fe5e0d32)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158048
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 84f0ba59072a..04b263cda754 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1803,6 +1803,22 @@ void SwCursorShell::UpdateCursorPos()
 GetLayout()->GetModelPositionForViewPoint( pShellCursor->GetPoint(), 
pShellCursor->GetPtPos(),
   );
 pShellCursor->DeleteMark();
+// kde45196-1.html: try to get to a non-hidden paragraph, there must
+// be one in the document body
+while (isInHiddenTextFrame(pShellCursor))
+{
+if (!pShellCursor->MovePara(GoNextPara, fnParaStart))
+{
+break;
+}
+}
+while (isInHiddenTextFrame(pShellCursor))
+{
+if (!pShellCursor->MovePara(GoPrevPara, fnParaStart))
+{
+break;
+}
+}
 }
 auto* pDoc = GetDoc();
 if (pDoc)
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 4349fac21b2f..8d0246bed14f 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -331,6 +331,7 @@ bool SwCursor::IsSelOvr(SwCursorSelOverFlags const eFlags)
 if( pNd->IsContentNode() && !dynamic_cast(this) )
 {
 const SwContentFrame* pFrame = static_cast(pNd)->getLayoutFrame( 
rDoc.getIDocumentLayoutAccess().GetCurrentLayout() );
+// ^ null
 if ( (SwCursorSelOverFlags::ChangePos & eFlags)   //allowed to change 
position if it's a bad one
 && pFrame && pFrame->isFrameAreaDefinitionValid()
 && !pFrame->getFrameArea().Height() //a bad zero height 
position
@@ -400,9 +401,16 @@ bool SwCursor::IsSelOvr(SwCursorSelOverFlags const eFlags)
 
 if( !pFrame )
 {
-DeleteMark();
-RestoreSavePos();
-return true; // we need a frame
+assert(!m_vSavePos.empty());
+SwContentNode const*const 
pSaveNode(rNds[m_vSavePos.back().nNode]->GetContentNode());
+// if the old position already didn't have a frame, allow moving
+// anyway, hope the caller can handle that
+if (pSaveNode && 
pSaveNode->getLayoutFrame(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()))
+{
+DeleteMark();
+RestoreSavePos();
+return true; // we need a frame
+}
 }
 }
 


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

2023-10-18 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |   43 -
 1 file changed, 15 insertions(+), 28 deletions(-)

New commits:
commit 5728686b2f133e7a0e23544ecaebc34bfdde434b
Author: Jim Raykowski 
AuthorDate: Sun Oct 8 23:13:51 2023 -0800
Commit: Michael Stahl 
CommitDate: Wed Oct 18 10:57:35 2023 +0200

SwNavigator: Fix Indexes tracking

Restores Indexes tracking when the document cursor is in TOX
content which was lost in commit
ca34204a39716ec9aa621e60ea50fb3c058c55f6.

Change-Id: Ib0fed4b7a20b5d08b5c52eef28d13cf0044d87d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157693
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit 79df80b642179fdd621538e8a7894a2f055ba16a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158031
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 5114761fe939..cd6528752fef 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3932,36 +3932,23 @@ void SwContentTree::UpdateTracking()
 return;
 }
 // hyperlinks
-if (SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
-
m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), 
aContentAtPos) &&
-!(m_bIsRoot && m_nRootType != ContentTypeId::URLFIELD))
+// not in ToxContent tdf#148312
+if (const SwSection* pSection = m_pActiveShell->GetCurrSection(); 
!pSection
+|| (pSection && pSection->GetType() != SectionType::ToxContent))
 {
-// There is no need to search for hyperlinks in ToxContent 
tdf#148312
-if (const SwTextINetFormat* pTextINetFormat =
-static_txtattr_cast(aContentAtPos.pFndTextAttr))
-{
-if (const SwTextNode* pTextNode = 
pTextINetFormat->GetpTextNode())
-{
-if (const SwSectionNode* pSectNd = 
pTextNode->FindSectionNode())
-{
-SectionType eType = pSectNd->GetSection().GetType();
-if (SectionType::ToxContent == eType)
-{
-m_xTreeView->set_cursor(-1);
-Select();
-return;
-}
-}
-}
+if (SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
+
m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), 
aContentAtPos)
+&& (!m_bIsRoot || m_nRootType == ContentTypeId::URLFIELD))
+{
+// Because hyperlink item names do not need to be unique, 
finding the corresponding
+// item in the tree by name may result in incorrect selection. 
Find the item in the
+// tree by comparing the SwTextINetFormat pointer at the 
document cursor position to
+// that stored in the item SwURLFieldContent.
+if (mTrackContentType[ContentTypeId::URLFIELD])
+lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
ContentTypeId::URLFIELD,
+  
aContentAtPos.pFndTextAttr);
+return;
 }
-// Because hyperlink item names do not need to be unique, finding 
the corresponding item
-// in the tree by name may result in incorrect selection. Find the 
item in the tree by
-// comparing the SwTextINetFormat pointer at the document cursor 
position to that stored
-// in the item SwURLFieldContent.
-if (mTrackContentType[ContentTypeId::URLFIELD])
-lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
ContentTypeId::URLFIELD,
-  aContentAtPos.pFndTextAttr);
-return;
 }
 // fields, comments
 if (SwField* pField = m_pActiveShell->GetCurField(); pField &&


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

2023-10-11 Thread László Németh (via logerrit)
 sw/source/core/txtnode/txtedt.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f3c084853331a9552821c369349398f964c73ab6
Author: László Németh 
AuthorDate: Tue Oct 10 15:49:38 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 11 10:52:21 2023 +0200

tdf#157442 sw: fix spell checking of words next to digits

If the preceding or subsequent word was a number or a word with
numbers, misspelled words were accepted as correct.

Note: it occurred with disabled "Check words with numbers"
(default setting in Options – Language Settings – Writing Aids).

Regression from commit 5619fc438273cd15e78539e78b8af751bca24b1a
"tdf#154499 sw spell checking: add 2-word phrase checking".

Change-Id: I4478c89d04ebf971925d4bdd56aaebc7ce8fb77e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157799
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 4df899de2ac51e684e83ab95dd25fc752ce2e92e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157775
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 1e9082201f7a..71ee1fd93a24 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1077,9 +1078,11 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs)
 const OUString& rActualWord = aScanner.GetPrevWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && pArgs->xSpeller->isValid( 
rActualWord + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+pArgs->xSpeller->isValid( rActualWord + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   ( !sPrevWord.isEmpty() && pArgs->xSpeller->isValid( 
sPrevWord + " " + rActualWord,
+   ( !sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+pArgs->xSpeller->isValid( sPrevWord + " " + 
rActualWord,
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 // make sure the selection build later from the 
data
@@ -1395,9 +1398,11 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, 
sal_Int32 nActPos)
 bNextWord = aScanner.NextWord();
 bCalledNextWord = true;
 // check space separated word pairs in the dictionary, 
e.g. "vice versa"
-if ( !((bNextWord && xSpell->isValid( 
aScanner.GetPrevWord() + " " + aScanner.GetWord(),
+if ( !((bNextWord && 
!linguistic::HasDigits(aScanner.GetWord()) &&
+xSpell->isValid( aScanner.GetPrevWord() + " " + 
aScanner.GetWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() )) ||
-   (!sPrevWord.isEmpty() && xSpell->isValid( sPrevWord 
+ " " + aScanner.GetPrevWord(),
+   (!sPrevWord.isEmpty() && 
!linguistic::HasDigits(sPrevWord) &&
+xSpell->isValid( sPrevWord + " " + 
aScanner.GetPrevWord(),
 static_cast(eActLang), Sequence< 
PropertyValue >() ))) )
 {
 sal_Int32 nSmartTagStt = nBegin;


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

2023-10-09 Thread László Németh (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   34 
 1 file changed, 34 insertions(+)

New commits:
commit 985015195007ee236e62254bc5685816f7e4ec5a
Author: László Németh 
AuthorDate: Wed Sep 27 00:41:22 2023 +0200
Commit: László Németh 
CommitDate: Mon Oct 9 15:52:26 2023 +0200

tdf#141198 sw: fix cycle case with change tracking

Fix cycle case with change tracking by rejecting
changes of the word, and setting the cursor inside
the original word.

Previously the cycle case resulted only in a tracked
deletion and tracked insertion, putting the text
cursor at after the word, so it was not possible to
cycle on the different cases e.g. by pressing Shift-F3
multiple times (and moving the text cursor inside
the tracked insertion didn't help, because resulted
in broken text at asking for the next cycle).

A regression from commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: I819cf0ec722d54852bfc31f7765e0f06e2a07fd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157303
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit dc748d7dbd114fbf663752258dbaf003af2926c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157321
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f7d24dd55ea0..47e5b818b2fb 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -2999,6 +3001,38 @@ void DocumentContentOperationsManager::TransliterateText(
 }
 } else {
 /* Cursor is not inside of a word. Nothing should happen. */
+/* Except in the case of change tracking, when the cursor is at 
the end of the change */
+/* Recognize and reject the previous deleted and inserted words to 
allow to cycle */
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( 
rIDRA.GetRedlineFlags() ) &&
+pStt->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pStt->GetContentNode(), 
pStt->GetContentIndex() - 1);
+SwRedlineTable::size_type n = 0;
+
+const SwRangeRedline* pFnd =
+rIDRA.GetRedlineTable().FindAtPosition( 
aPos, n );
+if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 )
+{
+const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1];
+if ( RedlineType::Delete == pFnd2->GetType() &&
+  
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() &&
+  *pFnd2->End() == *pFnd->Start() &&
+  pFnd->GetAuthor() == pFnd2->GetAuthor() )
+{
+SwPosition aPos2(*pFnd2->End());
+rIDRA.RejectRedline(*pFnd, true);
+rIDRA.RejectRedline(*pFnd2, true);
+// positionate the text cursor inside the changed word 
to allow to cycle
+if ( SwWrtShell *pWrtShell = dynamic_cast(
+
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) )
+{
+pWrtShell->GetCursor()->GetPoint()->
+Assign(*aPos2.GetContentNode(), 
aPos2.GetContentIndex() - 1);
+}
+}
+}
+}
 return;
 }
 }


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

2023-10-05 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/ftnfrm.hxx   |1 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   23 +++
 2 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 9942f9f76ffda559eccc3e4c8e196d5fe36f2051
Author: Michael Stahl 
AuthorDate: Mon Oct 2 19:46:36 2023 +0200
Commit: Caolán McNamara 
CommitDate: Thu Oct 5 21:18:32 2023 +0200

sw: PDF/UA export: merge footnote frame follows

Change-Id: Icb1c585c4d321e38a6ac3d841846d505c4816db2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157504
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 5cdb4e495e23be77466d8f8bbe6ae643b60d3aa6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157535
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx
index a514e4ba10d3..89d9f34f863a 100644
--- a/sw/source/core/inc/ftnfrm.hxx
+++ b/sw/source/core/inc/ftnfrm.hxx
@@ -84,7 +84,6 @@ class SwFootnoteFrame final : public SwLayoutFrame
 {
 // Pointer to FootnoteFrame in which the footnote will be continued:
 //  - 0 no following existent
-//  - this  for the last one
 //  - otherwise the following FootnoteFrame
 SwFootnoteFrame *mpFollow;
 SwFootnoteFrame *mpMaster;  // FootnoteFrame from which I am the 
following
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 3cd5176cb786..3103b3fe9ef8 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "porfld.hxx"
@@ -266,25 +267,29 @@ bool lcl_IsInNonStructEnv( const SwFrame& rFrame )
 }
 
 // Generate key from frame for reopening tags:
-void* lcl_GetKeyFromFrame( const SwFrame& rFrame )
+void const* lcl_GetKeyFromFrame( const SwFrame& rFrame )
 {
-void* pKey = nullptr;
+void const* pKey = nullptr;
 
 if ( rFrame.IsPageFrame() )
-pKey = const_cast(static_cast(&(static_cast(rFrame).GetFormat()->getIDocumentSettingAccess(;
+pKey = static_cast(&(static_cast(rFrame).GetFormat()->getIDocumentSettingAccess()));
 else if ( rFrame.IsTextFrame() )
-pKey = const_cast(static_cast(static_cast(rFrame).GetTextNodeFirst()));
+pKey = static_cast(static_cast(rFrame).GetTextNodeFirst());
 else if ( rFrame.IsSctFrame() )
-pKey = const_cast(static_cast(static_cast(rFrame).GetSection()));
+pKey = static_cast(static_cast(rFrame).GetSection());
 else if ( rFrame.IsTabFrame() )
-pKey = const_cast(static_cast(static_cast(rFrame).GetTable()));
+pKey = static_cast(static_cast(rFrame).GetTable());
 else if ( rFrame.IsRowFrame() )
-pKey = const_cast(static_cast(static_cast(rFrame).GetTabLine()));
+pKey = static_cast(static_cast(rFrame).GetTabLine());
 else if ( rFrame.IsCellFrame() )
 {
 const SwTabFrame* pTabFrame = rFrame.FindTabFrame();
 const SwTable* pTable = pTabFrame->GetTable();
-pKey = const_cast(static_cast(& static_cast(rFrame).GetTabBox()->FindStartOfRowSpan( *pTable )));
+pKey = static_cast(& static_cast(rFrame).GetTabBox()->FindStartOfRowSpan(*pTable));
+}
+else if (rFrame.IsFootnoteFrame())
+{
+pKey = static_cast(static_cast(rFrame).GetAttr());
 }
 
 return pKey;
@@ -420,6 +425,7 @@ bool SwTaggedPDFHelper::CheckReopenTag()
 // - rFrame is a cell frame in a follow flow row (reopen TableData tag)
 if ( ( rFrame.IsPageFrame() && static_cast(rFrame).GetPrev() ) ||
  ( rFrame.IsFlowFrame() && 
SwFlowFrame::CastFlowFrame()->IsFollow() ) ||
+ (rFrame.IsFootnoteFrame() && static_cast(rFrame).GetMaster()) ||
  ( rFrame.IsRowFrame() && rFrame.IsInFollowFlowRow() ) ||
  ( rFrame.IsCellFrame() && 
const_cast(rFrame).GetPrevCellLeaf() ) )
 {
@@ -511,6 +517,7 @@ void SwTaggedPDFHelper::BeginTag( 
vcl::PDFWriter::StructElement eType, const OUS
 if ( ( rFrame.IsPageFrame() && !static_cast(rFrame).GetPrev() ) ||
  ( rFrame.IsFlowFrame() && 
!SwFlowFrame::CastFlowFrame()->IsFollow() && 
SwFlowFrame::CastFlowFrame()->HasFollow() ) ||
  ( rFrame.IsTextFrame() && rFrame.GetDrawObjs() ) ||
+ (rFrame.IsFootnoteFrame() && static_cast(rFrame).GetFollow()) ||
  ( rFrame.IsRowFrame() && rFrame.IsInSplitTableRow() ) ||
  ( rFrame.IsCellFrame() && 
const_cast(rFrame).GetNextCellLeaf() ) )
 {


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

2023-09-28 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/fly.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 60e2fdf1d7e8346e5a3835369c47e582c737ce20
Author: Miklos Vajna 
AuthorDate: Thu Sep 28 09:03:27 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 28 12:14:57 2023 +0200

sw floattable: maintain the invariant that fly height is at least MINFLY

Fixes these warnings on loading 
sw/qa/core/layout/data/floattable-in-inlinetable.docx:

warn:legacy.osl:6908:6908:sw/source/core/layout/flylay.cxx:703: 
 - fly frame has negative height now.
warn:legacy.osl:6908:6908:sw/source/core/layout/flylay.cxx:295: 
SwFlyFreeFrame::Format(), flipping Fly.

Change-Id: I20d01e3289ea597a5b5f4ee43a5e1b892a618648
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157347
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 25b8fdd3b939a221ba00ca37fbf89adaf893aab7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157316
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 039aeb549f77..7fc0a566b9d5 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1443,7 +1443,7 @@ void SwFlyFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBorderA
 SwTwips nDeadline = GetFlyAnchorBottom(this, *pAnchor);
 SwTwips nTop = aRectFnSet.GetTop(getFrameArea());
 SwTwips nBottom = aRectFnSet.GetTop(getFrameArea()) + 
nRemaining;
-if (nBottom > nDeadline)
+if (nBottom > nDeadline && nDeadline > nTop)
 {
 nRemaining = nDeadline - nTop;
 }


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

2023-09-26 Thread Michael Stahl (via logerrit)
 sw/source/core/docnode/nodes.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 18ccdfc248fdc9d7f17f84c1067fee27a62b0772
Author: Michael Stahl 
AuthorDate: Tue Sep 19 11:00:15 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 17:39:24 2023 +0200

tdf#157131 sw: only check for table in same top-level section

The problem is that SwNodes::FindPrvNxtFrameNode() is called with the
first node in the body and moves backwards to a node that is in a table
in a text frame.

(regression from commit faf2d9e2cb13c3750ac359338f8f31fc1afce368)

Change-Id: I9bd353f07ea6361b332134186a6a4462119b597c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157045
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 655874489a13af50b763b75c188b2a8db52c7fc0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157053
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 9f9c516e8f3b..c6ecb9ccf974 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2250,7 +2250,7 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
 {
 pFrameNd = GoPrevSection( , true, false );
 // did we move *into* a table?
-if (pFrameNd)
+if (pFrameNd && ::CheckNodesRange(aIdx.GetNode(), rFrameNd, true))
 {
 for (SwTableNode * pTable = pFrameNd->FindTableNode();
 pTable && pTable->EndOfSectionIndex() < 
rFrameNd.GetIndex();
@@ -2328,7 +2328,7 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
 {
 pFrameNd = GoNextSection( , true, false );
 // did we move *into* a table?
-if (pFrameNd)
+if (pFrameNd && ::CheckNodesRange(aIdx.GetNode(), rFrameNd, true))
 {
 for (SwTableNode * pTable = pFrameNd->FindTableNode();
 pTable && pEnd->GetIndex() < pTable->GetIndex();


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

2023-09-26 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/layact.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 7272d2c152424255437f8fbda5ed31737404d52c
Author: Michael Stahl 
AuthorDate: Wed Aug 23 15:52:51 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 13:38:39 2023 +0200

tdf#128437 tdf#128966 sw: layout: partially revert fix of tdf#124675

The tdf#128437 bugdoc works since LO 4.1 commit
84203fab20b7eb98f0d3667e6626f5c2139e5a7f "Resolves: #i120016# refine
condition for allowing split of a table row".

The non-obvious way in which commit cc5916cd314a27b0cc99560ab887480026630a95
changes the layout is the FlowFrameJoinLockGuard on the table frame.

While layouting page1, with LockJoin, formatting the content in the rows
of the table leaves the table follow valid.

Whereas without LockJoin, formatting the content in the rows grows the
table frame and this invalidates the position of the follow table frame.

 0  SwFrameAreaDefinition::setFrameAreaPositionValid(bool) (this=0x7c85390, 
bNew=false) at sw/source/core/layout/wsfrm.cxx:90
 1  SwFrame::ImplInvalidatePos() (this=0x7c85390) at 
sw/source/core/layout/wsfrm.cxx:2001
 2  SwFrame::InvalidatePos() (this=0x7c85390) at 
sw/source/core/inc/frame.hxx:1053
 3  SwFrame::ImplInvalidateNextPos(bool) (this=0x6edefb0, 
bNoFootnote=false) at sw/source/core/layout/findfrm.cxx:1368
 4  SwFrame::InvalidateNextPos(bool) (this=0x6edefb0, bNoFootnote=false) at 
sw/source/core/inc/frame.hxx:1083
 5  SwTabFrame::GrowFrame(long, bool, bool) (this=0x6edefb0, nDist=10, 
bTst=false, bInfo=false)
sw/source/core/layout/tabfrm.cxx:3428
 6  SwFrame::Grow(long, bool, bool) (this=0x6edefb0, nDist=10, bTst=false, 
bInfo=false) at sw/source/core/layout/wsfrm.cxx:1547
 7  SwTabFrame::Format(OutputDevice*, SwBorderAttrs const*) 
(this=0x6edefb0, pAttrs=0x6f74d00) at sw/source/core/layout/tabfrm.cxx:3357
 8  SwTabFrame::MakeAll(OutputDevice*) (this=0x6edefb0) at 
sw/source/core/layout/tabfrm.cxx:2157
 9  SwFrame::PrepareMake(OutputDevice*) (this=0x6edefb0) at 
sw/source/core/layout/calcmove.cxx:375
 10 SwFrame::Calc(OutputDevice*) const (this=0x6edefb0) at 
sw/source/core/layout/trvlfrm.cxx:1803
 11 SwFrame::PrepareMake(OutputDevice*) (this=0x6f118a0) at 
sw/source/core/layout/calcmove.cxx:253
 12 SwFrame::Calc(OutputDevice*) const (this=0x6f118a0) at 
sw/source/core/layout/trvlfrm.cxx:1803
 13 SwFrame::PrepareMake(OutputDevice*) (this=0x6f11a30) at 
sw/source/core/layout/calcmove.cxx:253
 14 SwFrame::Calc(OutputDevice*) const (this=0x6f11a30) at 
sw/source/core/layout/trvlfrm.cxx:1803
 15 SwFrame::OptPrepareMake() (this=0x6f14da0) at 
sw/source/core/layout/calcmove.cxx:386
 16 SwFrame::OptCalc() const (this=0x6f14da0) at 
sw/source/core/inc/frame.hxx:1090
 17 SwLayAction::FormatLayout(OutputDevice*, SwLayoutFrame*, bool) 
(this=0x7ffdabdf0c90, pLay=0x6f11a30, bAddRect=false)
sw/source/core/layout/layact.cxx:1461
 18 SwLayAction::FormatLayout(OutputDevice*, SwLayoutFrame*, bool) 
(this=0x7ffdabdf0c90, pLay=0x6f118a0, bAddRect=false)
sw/source/core/layout/layact.cxx:1455
 19 SwLayAction::FormatLayoutTab(SwTabFrame*, bool) (this=0x7ffdabdf0c90, 
pTab=0x6edefb0, bAddRect=false)
at sw/source/core/layout/layact.cxx:1679

Thus invalidated, the follow frame's first row will move back and split.

Unable to reproduce tdf#124675 with the FlowFrameLockGuard reverted -
let's assume that some change elsewhere prevents this kind of crash now.

The only problem with this is that some test fails (and i forgot which
one), that's why the 3 previous commits are needed.

What's amusing is that the layout with this fix is the same as the one
in Word 2013, whereas the layout without this fix is the same as the one
from exporting the bugdoc from Word 2013 in DOCX without compatibility
mode, so this will be a "regression" for DOCX layout but it was all an
accident anyway...

This also fixes the last case of tdf#128966 so every row is vertically
centered now; some previous commit improved it already.

Change-Id: I46d77930666a1762ae16af09525f0b23660beba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155989
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit bfa81a200ab59971b69823f9a29d8ce222d655e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156966
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index ae8295b43903..84481981fd6e 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1640,11 +1640,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, 
bool bAddRect )
 // format lowers, only if table frame is valid
 if ( 

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

2023-09-26 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/tabfrm.hxx|2 -
 sw/source/core/layout/layact.cxx |5 ---
 sw/source/core/layout/tabfrm.cxx |   55 +++
 3 files changed, 52 insertions(+), 10 deletions(-)

New commits:
commit 5b3fcbf23773ea8d039185dec2b9704981833473
Author: Michael Stahl 
AuthorDate: Wed Aug 23 15:50:59 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 13:37:59 2023 +0200

tdf#156724 sw: layout: fix tables not splitting due to footnotes differently

Revert commit 610c6f02b11b4b4c555a78b0feb2a1eb35159e39 and
and 61a78a523a6131ff98b5d846368e5626fe58d99c instead do the
opposite: never calc content frames in FormatLayout().

There were a few cases where documents looked worse with the fix, such
as the somewhat pathological tdf120139-1.odt and tdf124474-1.odt, but
typically these went from a bad layout to a worse layout, e.g.
--convert-to pdf tdf120139-1.odt went from 11 minutes to 33 minutes
(dbgutil) with twice as many more half-empty pages.

Worse is that the previous fix appears to prevent tdf#128437 from
working.

It should also be less risky to never calc content frames in
FormatLayout(), because with IsPaintLocked() check that used to be done
led to doing it only for pages which were visible when loading the
document, so any regressions with this new approach would appear on few
pages at the start of the document, instead of many pages at the end.

Note that without the previous commit, this would cause
* CppunitTest_sw_core_layout CPPUNIT_TEST_NAME="testTablePrintAreaLeft"
  to fail
* tdf#137523 SwLayoutWriter3 testTdf137523 to fail,
  *only* on the last text frame

This also appears to fix tdf#125749.

Change-Id: I3d72f8e9d2b89aa3738e554308fd9dce12e92238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155988
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit c303981cfd95ce1c3881366023d5495ae2edce97)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156965
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index a249f6c1f845..4eba886c2385 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -108,7 +108,7 @@ class SW_DLLPUBLIC SwTabFrame final: public SwLayoutFrame, 
public SwFlowFrame
  * created and constructed and inserted directly after this.
  * Join() gets the Follow's content and destroys it.
  */
-bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
+bool Split(const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep, 
bool & rIsFootnoteGrowth);
 void Join();
 
 void UpdateAttr_(
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 52774e52f0fa..ae8295b43903 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1433,10 +1433,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
 PopFormatLayout();
 }
 }
-else if (!pLay->IsColBodyFrame())
-{   // tdf#156724 unconditionally for frames in tables, so their 
footnotes exist before trying to split
-pLow->OptCalc();
-}
+// else: don't calc content frames any more
 
 if ( IsAgain() )
 return false;
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 1c3a878b85d2..049893e2850d 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -646,7 +646,8 @@ inline void TableSplitRecalcLock( SwFlowFrame *pTab ) { 
pTab->LockJoin(); }
 inline void TableSplitRecalcUnlock( SwFlowFrame *pTab ) { pTab->UnlockJoin(); }
 
 static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& 
rFollowLine,
-  SwTwips nRemainingSpaceForLastRow, SwTwips 
nAlreadyFree )
+  SwTwips nRemainingSpaceForLastRow, SwTwips 
nAlreadyFree,
+  bool & rIsFootnoteGrowth)
 {
 bool bRet = true;
 
@@ -655,6 +656,34 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, 
SwRowFrame& rFollowLine,
 SwRectFnSet aRectFnSet(rTab.GetUpper());
 SwTwips nCurLastLineHeight = 
aRectFnSet.GetHeight(rLastLine.getFrameArea());
 
+SwTwips nFootnoteHeight(0);
+if (SwFootnoteBossFrame const*const pBoss = rTab.FindFootnoteBossFrame())
+{
+if (SwFootnoteContFrame const*const pCont = pBoss->FindFootnoteCont())
+{
+for (SwFootnoteFrame const* pFootnote = 
static_cast(pCont->Lower());
+ pFootnote != nullptr;
+ pFootnote = static_cast(pFootnote->GetNext()))
+{
+SwContentFrame const*const pAnchor = pFootnote->GetRef();
+SwTabFrame const* pTab = 

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

2023-09-26 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/tabfrm.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit decade708924e8dbc416893734d2273fcc657dcf
Author: Michael Stahl 
AuthorDate: Wed Aug 23 15:51:32 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 13:37:32 2023 +0200

tdf#154775 sw: layout: avoid breaking this with following commits

The problem with commit 1b5bc2ae2f19a190bf588a5a26c4d125c3960991 is that
the fix only works in case the fly is invalid at the time when
SwTabFrame::CalcFlyOffsets() is called; if it is valid (which will be
the case with following commits, for non-obvious reasons) then the fix
does nothing, causing testTablePrintAreaLeft to fail.

In Word 2013, this fly causes the table to shift down, despite its
HoriOrient being LEFT; so adapt SwTabFrame::CalcFlyOffsets() to also
shift down in this case.

Likely it would be best not to check HoriOrient at all for ShiftDown
case, but needs checking first what Word does in other cases.

Change-Id: I465a55bbf1a783abce8b8d6d65099bd9df5695f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155987
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7b1c03ed87f7a21606e09863b23074e6b96e26d1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156964
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c386bf2ab9de..1c3a878b85d2 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2973,9 +2973,12 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
 //   text frame has already changed its page.
 const SwTextFrame* pAnchorCharFrame = pFly->FindAnchorCharFrame();
 const SwFormatHoriOrient& rHori= pFly->GetFormat()->GetHoriOrient();
+// TODO: why not just ignore HoriOrient?
+bool isHoriOrientShiftDown =
+   rHori.GetHoriOrient() == text::HoriOrientation::NONE
+|| rHori.GetHoriOrient() == text::HoriOrientation::LEFT;
 // Only consider invalid Writer fly frames if they'll be shifted down.
-bool bIgnoreFlyValidity
-= bAddVerticalFlyOffsets && rHori.GetHoriOrient() == 
text::HoriOrientation::NONE;
+bool bIgnoreFlyValidity = bAddVerticalFlyOffsets && 
isHoriOrientShiftDown;
 bool bConsiderFly =
 // #i46807# - do not consider invalid
 // Writer fly frames.
@@ -3031,8 +3034,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
 bool bShiftDown = css::text::WrapTextMode_NONE == nSurround;
 if (!bShiftDown && bAddVerticalFlyOffsets)
 {
-if (nSurround == text::WrapTextMode_PARALLEL
-&& rHori.GetHoriOrient() == text::HoriOrientation::NONE)
+if (nSurround == text::WrapTextMode_PARALLEL && 
isHoriOrientShiftDown)
 {
 // We know that wrapping was requested and the table frame 
overlaps with
 // the fly frame. Check if the print area overlaps with the 
fly frame as
@@ -3094,7 +3096,8 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
 
 if ((css::text::WrapTextMode_RIGHT == nSurround
  || css::text::WrapTextMode_PARALLEL == nSurround)
-&& text::HoriOrientation::LEFT == rHori.GetHoriOrient())
+&& text::HoriOrientation::LEFT == rHori.GetHoriOrient()
+&& !bShiftDown)
 {
 const tools::Long nWidth
 = aRectFnSet.XDiff(aRectFnSet.GetRight(aFlyRect),


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

2023-09-21 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f43dfd0c7fa44eefac75ba7050debb238697d98e
Author: Michael Stahl 
AuthorDate: Tue Sep 19 21:18:52 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Sep 21 08:16:50 2023 +0200

tdf#157129 sw: fix wrong cursor position after paste

This asserts in SwUndoInserts::UndoImpl():
index.cxx:234: virtual SwContentIndexReg::~SwContentIndexReg(): Assertion 
`!m_pFirst && !m_pLast && "There are still indices registered"' failed.

Because there is a bookmark still registered, because the content was
inserted wrongly into a fly frame that contains a SwGrfNode, because
earlier the cursor was in a hidden text node and
SwCursorShell::UpdateCursorPos() moved it into an as-char anchored image.

UpdateCursorPos() should put the cursor only onto a text node.

(somehow regression from commit bb733957dd39e6f0b9d80bb59eb0177188794797)

Change-Id: If00d1e09a612849a44bb3e2d3bd7bac6fa9ac05f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157071
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit b20ca8d951e8205c8b963c6b7407f984053b4094)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157110
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4d69e2a6d705..84f0ba59072a 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1785,8 +1785,8 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
 
 /** Set the cursor back into content.
 
-This should only be called if the cursor was move somewhere else (e.g. when
-deleting a border). The new position is calculated from its current 
position
+This should only be called if the cursor was moved (e.g. when deleting a
+text frame). The new position is calculated from its current position
 in the layout.
 */
 void SwCursorShell::UpdateCursorPos()
@@ -1798,7 +1798,7 @@ void SwCursorShell::UpdateCursorPos()
 
 if (isInHiddenTextFrame(pShellCursor) && !ExtendedSelectedAll())
 {
-SwCursorMoveState aTmpState( CursorMoveState::NONE );
+SwCursorMoveState aTmpState(CursorMoveState::SetOnlyText);
 aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
 GetLayout()->GetModelPositionForViewPoint( pShellCursor->GetPoint(), 
pShellCursor->GetPtPos(),
   );


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

2023-09-19 Thread Samuel Mehrbrodt (via logerrit)
 sw/source/core/access/AccessibilityIssue.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 9cecc2927bdffcb6235a9d0baf649e14c6c7beb2
Author: Samuel Mehrbrodt 
AuthorDate: Thu Sep 7 11:35:52 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 19 12:08:54 2023 +0200

tdf#157085 Make doc title dialog modal

Change-Id: I7a7574c3ffaa45aeb9bb97d9a1963c52d5619d99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156658
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 48129cabb9a5636207d3b8f4f9fa4e4abac61b8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156732
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index 080ce2ec7a9e..a915289f26ea 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -236,8 +236,11 @@ void AccessibilityIssue::quickFixIssue() const
 case IssueObject::DOCUMENT_TITLE:
 {
 OUString aDesc = SwResId(STR_ENTER_DOCUMENT_TITLE);
-SvxNameDialog aNameDialog(m_pParent, "", aDesc);
-if (aNameDialog.run() == RET_OK)
+SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
+SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
+ScopedVclPtr aNameDialog(
+
pFact->CreateSvxNameDialog(pWrtShell->GetView().GetFrameWeld(), "", aDesc));
+if (aNameDialog->Execute() == RET_OK)
 {
 SwDocShell* pShell = m_pDoc->GetDocShell();
 if (!pShell)
@@ -247,7 +250,9 @@ void AccessibilityIssue::quickFixIssue() const
 pShell->GetModel(), uno::UNO_QUERY_THROW);
 const uno::Reference 
xDocumentProperties(
 xDPS->getDocumentProperties());
-xDocumentProperties->setTitle(aNameDialog.GetName());
+OUString sName;
+aNameDialog->GetName(sName);
+xDocumentProperties->setTitle(sName);
 
 
m_pDoc->getOnlineAccessibilityCheck()->resetAndQueueDocumentLevel();
 }


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

2023-09-19 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/flycnt.cxx  |7 +-
 writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx |   27 
++
 writerfilter/qa/cppunittests/dmapper/data/floattable-nested.docx  |binary
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx  |8 --
 4 files changed, 33 insertions(+), 9 deletions(-)

New commits:
commit d647a4f0bf873dfec685fd9f1e2d29896ca801a4
Author: Miklos Vajna 
AuthorDate: Wed Sep 13 08:14:19 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 19 11:49:02 2023 +0200

sw floattable, nesting: add DOCX import

There were two problems here:

1) writerfilter/ didn't even try allowing split floating tables for the
   inner case, because layout didn't support that previously.

2) CppunitTest_writerfilter_dmapper's test3NestedFloatingTables crashed
   because we expected that in case a fly+table is not toplevel, then
   the parent is also a fly+table frame, but in this case the parent was
   just a table frame.

   Fix this by checking for a table parent instead of a fly parent when
   deciding if we handle the split as a nested case or a toplevel one.

Change-Id: I4c58636ef80371b8ec51a96fe436fa6379c795d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156865
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 5127b1961b762643d47a26704556fd9b8664c6fc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156957
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index efdc91365c26..109c26a7258e 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1611,10 +1611,11 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType 
eMakePage )
 }
 }
 
-if (bLeftFly && pFlyAnchor && pFlyAnchor->IsInFly()
-&& FindFlyFrame() == pLayLeaf->FindFlyFrame())
+if (bLeftFly && pFlyAnchor && pFlyAnchor->IsInTab()
+&& FindTabFrame() == pLayLeaf->FindTabFrame())
 {
-// This is an inner fly, then the follow anchor will be just 
next to us.
+// This is an inner fly (parent is an inline or a floating 
table), then the follow
+// anchor will be just next to us.
 SwLayoutFrame* pFlyAnchorUpper = pFlyAnchor->GetUpper();
 pOldLayLeaf = pLayLeaf;
 pLayLeaf = pFlyAnchorUpper;
diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
index 8c11e3db22c7..fa1567c5a577 100644
--- a/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
@@ -133,6 +133,33 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDOCXFloatingTableHiddenAnchor)
 // hidden.
 CPPUNIT_ASSERT(!bCharHidden);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableNested)
+{
+// Given a document with nested, multi-page floating tables:
+// When loading that document:
+loadFromURL(u"floattable-nested.docx");
+
+// Then make sure that both floating tables are allowed to split:
+uno::Reference xFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFrames(xFramesSupplier->getTextFrames(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(static_cast(2), xFrames->getCount());
+// Outer frame:
+uno::Reference xFrame1;
+xFrames->getByIndex(0) >>= xFrame1;
+bool bIsSplitAllowed = false;
+xFrame1->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+CPPUNIT_ASSERT(bIsSplitAllowed);
+// Inner frame:
+uno::Reference xFrame2;
+xFrames->getByIndex(1) >>= xFrame2;
+bIsSplitAllowed = false;
+xFrame2->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+// Without the accompanying fix in place, this test would have failed, the 
inner frame could not
+// split.
+CPPUNIT_ASSERT(bIsSplitAllowed);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/qa/cppunittests/dmapper/data/floattable-nested.docx 
b/writerfilter/qa/cppunittests/dmapper/data/floattable-nested.docx
new file mode 100644
index ..655e6c0e0bad
Binary files /dev/null and 
b/writerfilter/qa/cppunittests/dmapper/data/floattable-nested.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 20523e9d301a..124516e4a324 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1591,12 +1591,8 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 comphelper::makePropertyValue("IsFollowingTextFlow", 
true));
 }
 

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

2023-09-19 Thread Michael Stahl (via logerrit)
 sw/source/core/docnode/nodes.cxx|3 +++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |7 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit f7ff8ab382ed515cb549f514c138399b96c7fe48
Author: Michael Stahl 
AuthorDate: Fri Sep 15 17:52:29 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 19 11:04:10 2023 +0200

sw: fix crash when moving nodes into undo array

In SwUndoSaveContent::MoveToUndoNds() a node is split and in
sw::OnlineAccessibilityCheck::runAccessibilityCheck() we get:

sw/inc/ndindex.hxx:99: bool SwNodeIndex::operator<(const SwNode&) const: 
Assertion `() == ()' failed.

Try to make sure that OnlineAccessibilityCheck doesn't touch nodes in
the undo array.

Change-Id: Iaeb0d36c341c05948cdfcce08009b0430a78f214
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156970
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d19fb1dd668473f2d4f8dbde8bac1fcb34042a6a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156968
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e5d20e4691ff..9f9c516e8f3b 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -346,6 +346,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, 
SwNodeOffset nSz,
 if( pCNd->IsNoTextNode() && bRestPersData )
 
static_cast(pCNd)->RestorePersistentData();
 }
+
+// reset Accessibility issue state
+pCNd->resetAndQueueAccessibilityCheck();
 }
 }
 }
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 983681051a2b..00ccea620948 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -307,8 +307,11 @@ void OnlineAccessibilityCheck::resetAndQueue(SwNode* 
pNode, bool bIssueObjectNam
 
 pNode->getAccessibilityCheckStatus().reset();
 m_aNodes.erase(pNode);
-runAccessibilityCheck(pNode);
-updateNodeStatus(pNode, bIssueObjectNameChanged);
+if (>GetNodes() == _rDocument.GetNodes()) // don't add undo array
+{
+runAccessibilityCheck(pNode);
+updateNodeStatus(pNode, bIssueObjectNameChanged);
+}
 updateStatusbar();
 }
 


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

2023-09-18 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/layact.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 8b6485703af3af575fb0cd5fa38267c86545185e
Author: Michael Stahl 
AuthorDate: Fri Sep 15 16:57:58 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 18 08:58:33 2023 +0200

tdf#157096 sw: layout: fix UAF crash from stale mpFlyDestory entry

It doesn't make sense that mpFlyDestory entries survive exit from
SwLayAction.

Call DeleteEmptyFlys() whenever DeleteEmptySct() is called.

(reportedly crashes since commit c303981cfd95ce1c3881366023d5495ae2edce97
 although i'd rather blame commit f6fbd9d5ff5b049112e6ca7a8943c156b3e4f411)

Change-Id: Ie03e91a7d089c8aae8a1db65df835841f985771f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156949
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 5a33420923c76d3e282f6d4ce0f3a63616ca3cff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156953
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 49d7573dd547..c157476cd3b1 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -371,6 +371,7 @@ void SwLayAction::Action(OutputDevice* pRenderContext)
 m_pRoot->ResetTurboFlag();
 m_bActionInProgress = false;
 m_pRoot->DeleteEmptySct();
+m_pRoot->DeleteEmptyFlys();
 return;
 }
 else if ( m_pRoot->GetTurbo() )
@@ -397,6 +398,7 @@ void SwLayAction::Action(OutputDevice* pRenderContext)
 SetAgain(true);
 }
 m_pRoot->DeleteEmptySct();
+m_pRoot->DeleteEmptyFlys();
 
 m_pWait.reset();
 


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

2023-09-17 Thread Julien Nabet (via logerrit)
 sw/source/uibase/utlui/content.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d29a70a875c5c423eec3f6549ae399ee46049eb2
Author: Julien Nabet 
AuthorDate: Sat Sep 16 22:20:04 2023 +0200
Commit: László Németh 
CommitDate: Sun Sep 17 20:10:14 2023 +0200

tdf#157277: fix Writer crash when hiding Sidebar + using bookmark in 
Navigator

Relevant part of bt (from exception thrown):
1  0x7f00b5398a34 in SfxUnoDecks::getByName(rtl::OUString const&) 
(this=0x559ce97aff60, aName="NavigatorDeck") at 
/home/julien/lo/libreoffice/sfx2/source/sidebar/UnoDecks.cxx:45
2  0x7f00b5398edf in non-virtual thunk to 
SfxUnoDecks::getByName(rtl::OUString const&) () at 
/home/julien/lo/libreoffice/instdir/program/libsfxlo.so
3  0x7f008bc016a5 in SwContentTree::GotoContent(SwContent const*) 
(this=0x559ce849e850, pCnt=0x559ce4b8cc10) at 
/home/julien/lo/libreoffice/sw/source/uibase/utlui/content.cxx:5463

See full bts (initial + from exception thrown) here:
https://bugs.documentfoundation.org/attachment.cgi?id=189632

Test if xDecks has "NavigatorDeck" before trying to retrieve it since it 
seems it's not the case when sidebar disabled.

Change-Id: Ia0aa64ebf26ad06fd4fe4b14f949453ae7948456
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156978
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit 18380cbe922730265cac17d2b710911a2db8f631)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156954
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index c2af6a16304d..5114761fe939 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -5410,6 +5410,9 @@ void SwContentTree::GotoContent(const SwContent* pCnt)
 if ( !xDecks.is() )
 break;
 
+if (!xDecks->hasByName("NavigatorDeck"))
+break;
+
 Reference xDeck ( xDecks->getByName("NavigatorDeck"), 
uno::UNO_QUERY);
 if ( !xDeck.is() )
 break;


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

2023-09-15 Thread Caolán McNamara (via logerrit)
 sw/source/core/frmedt/feshview.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0d9c73734dcd5c1bdff41281afcb415db0f95377
Author: Caolán McNamara 
AuthorDate: Thu Sep 14 20:18:55 2023 +0100
Commit: Xisco Fauli 
CommitDate: Fri Sep 15 09:32:54 2023 +0200

crashreporting: apparent null deref at 
SwFEShell::IsShapeDefaultHoriTextDirR2L

https: 
//crashreport.libreoffice.org/stats/crash_details/73028951-19a0-409b-89d2-a080495df925
Change-Id: I440465a3c7d5b98ecdd1c5f1973a2b8f64d6772e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156888
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 1c19ffb4eca4..eefb9d6d0643 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -3359,8 +3359,11 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const
 if ( dynamic_cast( pSdrObj) ==  nullptr )
 {
 // determine page frame of the frame the shape is anchored.
-const SwFrame* pAnchorFrame =
-
static_cast(GetUserCall(pSdrObj))->GetAnchorFrame( pSdrObj );
+const SwContact* pContact = GetUserCall(pSdrObj);
+OSL_ENSURE( pContact, 
" - missing contact!" );
+if (!pContact)
+return false;
+const SwFrame* pAnchorFrame = static_cast(pContact)->GetAnchorFrame( pSdrObj );
 OSL_ENSURE( pAnchorFrame, "inconsistent model - no anchor at 
shape!");
 if ( pAnchorFrame )
 {


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

2023-09-14 Thread Caolán McNamara (via logerrit)
 sw/source/ui/index/cnttab.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit fe871fa933c1da3f6bcdb9039dd8cf7b570ad94f
Author: Caolán McNamara 
AuthorDate: Wed Sep 13 14:18:23 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 14 18:43:58 2023 +0200

tdf#157223 get sequence name before toggling checkboxes

The expectation is that setting state/values on widgets from code
doesn't trigger any callbacks, which are assumed to be from user
interaction only.

But explictly toggling on a radio implicitly toggles off the other
radio, and while there is no callback from the explicit toggle on,
there is from the implicit toggle off.

Just move the explicit toggles to the end, after where the
values are read which the callback affects.

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

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index fc6f096372f2..f68aa514d272 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1057,8 +1057,6 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
 }
 else if (TOX_ILLUSTRATIONS == aCurType.eType || TOX_TABLES == 
aCurType.eType)
 {
-m_xFromObjectNamesRB->set_active(rDesc.IsCreateFromObjectNames());
-m_xFromCaptionsRB->set_active(!rDesc.IsCreateFromObjectNames());
 OUString sName(rDesc.GetSequenceName());
 int nIndex = m_xCaptionSequenceLB->find_text(sName);
 if (nIndex != -1)
@@ -1066,6 +1064,8 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
 
m_xDisplayTypeLB->set_active(static_cast(rDesc.GetCaptionDisplay()));
 if (m_xDisplayTypeLB->get_active() == -1)
 m_xDisplayTypeLB->set_active(0);
+m_xFromObjectNamesRB->set_active(rDesc.IsCreateFromObjectNames());
+m_xFromCaptionsRB->set_active(!rDesc.IsCreateFromObjectNames());
 RadioButtonHdl(*m_xFromCaptionsRB);
 }
 else if(TOX_OBJECTS == aCurType.eType)


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

2023-09-14 Thread Miklos Vajna (via logerrit)
 sw/source/core/txtnode/swfont.cxx |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 2330252b1b27795a57b5eea738621fda9fe1b549
Author: Miklos Vajna 
AuthorDate: Wed Sep 13 10:39:21 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 14 18:42:28 2023 +0200

crashtesting: fix PDF export of forum-mso-de-118466.docx

This went wrong in commit 19a559b0ec9b806519c405651d6d2b2e14712b4a (sw:
SwSubFont::GetTextSize_() assert on presumably dead code, 2019-10-14):

- as the bugdoc shows, it's not dead code after all, so downgrade the
  assert to a warning

- SwDrawTextInfo::SetText/Idx/Len asserts that the index and length are
  valid for the text, so set / restore these together

Change-Id: I967605324bde757ca11e6684ba6f40c578a211fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156891
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 297e0b6bdd6fb682974f9e3201c7842dd76e31c8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156885
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/txtnode/swfont.cxx 
b/sw/source/core/txtnode/swfont.cxx
index c0149d9a6573..c6d9c3ace26e 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1061,30 +1061,26 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
 if (TextFrameIndex(1) == rInf.GetLen()
 && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
 {
-assert(!"this is presumably dead code");
+SAL_WARN("sw", "this is meant to be dead code");
 TextFrameIndex const nOldIdx(rInf.GetIdx());
 TextFrameIndex const nOldLen(rInf.GetLen());
+OUString aOldText(rInf.GetText());
 const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
-rInf.SetText( aNewText );
-rInf.SetIdx( TextFrameIndex(0) );
-rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
+rInf.SetTextIdxLen(aNewText, TextFrameIndex(0), 
TextFrameIndex(aNewText.getLength()));
 aTextSize = pLastFont->GetTextSize( rInf );
-rInf.SetIdx( nOldIdx );
-rInf.SetLen( nOldLen );
+rInf.SetTextIdxLen(aOldText, nOldIdx, nOldLen);
 }
 else if (TextFrameIndex(1) == rInf.GetLen()
 && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
 {
-assert(!"this is presumably dead code");
+SAL_WARN("sw", "this is meant to be dead code");
 TextFrameIndex const nOldIdx(rInf.GetIdx());
 TextFrameIndex const nOldLen(rInf.GetLen());
+OUString aOldText(rInf.GetText());
 const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
-rInf.SetText( aNewText );
-rInf.SetIdx( TextFrameIndex(0) );
-rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
+rInf.SetTextIdxLen(aNewText, TextFrameIndex(0), 
TextFrameIndex(aNewText.getLength()));
 aTextSize = pLastFont->GetTextSize( rInf );
-rInf.SetIdx( nOldIdx );
-rInf.SetLen( nOldLen );
+rInf.SetTextIdxLen(aOldText, nOldIdx, nOldLen);
 }
 
 return aTextSize;


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

2023-09-14 Thread Noel Grandin (via logerrit)
 sw/source/core/layout/frmtool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ffb5ebb06b5afff8d47943312ecd8a048dbcaf5e
Author: Noel Grandin 
AuthorDate: Thu Sep 14 14:19:27 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 14 18:06:16 2023 +0200

fix use of reference

where we may end up with a reference to a different element of the queue
than we want.

regression from
commit 31e66bd07c1082bb375be8aaf7835f019351d9bb
Author: Michael Stahl 
Date:   Mon Aug 6 19:03:22 2018 +0200
sw: fix ignored frames in AppendAllObjs()

Change-Id: I94801df84b4b130315f67292851fbd129b2fe7d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156919
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit e2a0530a26b5c5b5f48d3e3c695b839d0e5c0164)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156887

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 8beb02663d92..f3de2a7e201e 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1404,7 +1404,7 @@ void AppendAllObjs(const 
sw::FrameFormats* pTable, const Sw
 const SwFrameFormat* pFirstRequeued(nullptr);
 while(!vFormatsToConnect.empty())
 {
-auto& pFormat = vFormatsToConnect.front();
+SwFrameFormat* pFormat = vFormatsToConnect.front();
 bool isConnected(false);
 pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, 
pRoot));
 if(!isConnected)


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

2023-09-12 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/tabfrm.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 9e453a7af284cf17cb0debd2ab027f626e6e4a62
Author: Michael Stahl 
AuthorDate: Fri Aug 25 18:31:42 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 12 16:24:57 2023 +0200

(related? tdf#155177) sw: layout: fix another RemoveFollowFlowLine SNAFU

This happens with the following commit, on testForcepoint76, for no
obvious reason.

A follow table frame is in SwTabFrame::MakeAll(), then its follow flow
line becomes empty and it does SetRemoveFollowFlowLinePending() on the
master, then it formats its follow flow line (but at that time there's
again a text frame in it), then that content moves backward, formats its
uppers until it gets to the master table frame, which wants to join the
row frame that's being formatted on the stack.

Obviously a SwFrameDeleteGuard in lcl_RecalcRow() can't hurt, but it
needs an additional change later to prevent it from moving rows of the
follow back.

Change-Id: Idca90b7eb67994385ccd306562ea26ff39e884f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156117
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 8c24bc5baa1f501943bf955e07787d80cb7a5763)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156146
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index f7e889094adc..3cfa29f92aab 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1712,6 +1712,8 @@ static void lcl_RecalcRow(SwRowFrame & rRow, tools::Long 
const nBottom)
 
 if( bCheck )
 {
+SwFrameDeleteGuard g();
+
 // #115759# - force another format of the
 // lowers, if at least one of it was invalid.
 bCheck = SwContentFrame::CalcLowers(rRow, *rRow.GetUpper(), 
nBottom, true);
@@ -2303,7 +2305,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 if ( !bSplit && GetFollow() )
 {
 bool bDummy;
-if ( GetFollow()->ShouldBwdMoved( GetUpper(), bDummy ) )
+if (!(HasFollowFlowLine()
+&& 
GetFollow()->GetFirstNonHeadlineRow()->IsDeleteForbidden())
+&& GetFollow()->ShouldBwdMoved(GetUpper(), bDummy))
 {
 SwFrame *pTmp = GetUpper();
 SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*pTmp);


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

2023-09-04 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit ed191e04cb846074c4e65025405bba889751edef
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit: Xisco Fauli 
CommitDate: Mon Sep 4 12:51:08 2023 +0200

Fix unchecked dynamic cast

Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 20a6c2df3ea899cce15775d954ffa50bb9dc81cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156447
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bd4cdbe28f0f..d7ab78d6e392 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -983,23 +983,27 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 if(pViewShell->GetWindow())
 {
-auto pSwView = dynamic_cast( pViewShell );
-if(pSwView !=  nullptr ||
-   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+auto pSwView = dynamic_cast(pViewShell);
+if (pSwView)
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(svtools::ColorConfig::GetCurrentSchemeName());
 SwViewColors aViewColors(*m_pColorConfig);
 aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-pViewShell->GetWindow()->Invalidate();
+
 if (bOnlyInvalidateCurrentView)
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 }
 }
+if(pSwView !=  nullptr ||
+   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+{
+pViewShell->GetWindow()->Invalidate();
+}
 }
 if (bOnlyInvalidateCurrentView)
 break;


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

2023-09-04 Thread Caolán McNamara (via logerrit)
 sw/source/core/layout/paintfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 8c886e86bc4b7534a0376204fdc646ce8103eedf
Author: Caolán McNamara 
AuthorDate: Fri Aug 25 09:54:28 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Sep 4 10:41:11 2023 +0200

crash case seen on clicking on drawing text box inside a footer

Change-Id: Id7645ad651d237c94fecb2fc2b6c57a88f3caa55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156091
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit bbbd7e346c5b929ca3b867b6dd80c71b8dd788d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156383
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 361e750570e9..8f6347a2268e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7257,7 +7257,8 @@ void SwPageFrame::PaintSubsidiaryLines( const SwPageFrame 
*,
 pLay = pLay->GetNext();
 }
 
-assert(pPageBody && "presumably this is impossible");
+if (!pPageBody)
+return;
 
 SwRect aArea( pPageBody->getFrameArea() );
 if ( pFootnoteCont )


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

2023-08-30 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |7 +--
 sw/source/core/access/AccessibilityIssue.cxx |   25 +++--
 2 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit 50f6e719764d6746220dedc78a8dd4654a791b1d
Author: Balazs Varga 
AuthorDate: Mon Aug 14 14:37:04 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Wed Aug 30 14:58:59 2023 +0200

tdf#156654 - A11Y - fix no fixable button for warning about

"Document default language is not set."

Open dialog "Tools/Options/Language Settings - Language" for
fixing the issue for the actual document.

Follow-up of ca9cb1df613789d99154d50e77847c3e32330642
(tdf#156591 - A11Y - add fix button for "Style has no language set.")

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 2cc3d247..bf0d4aeb8616 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1317,8 +1317,11 @@ public:
 LanguageType eLanguage = rLang.GetLanguage();
 if (eLanguage == LANGUAGE_NONE)
 {
-lclAddIssue(m_rIssueCollection, 
SwResId(STR_DOCUMENT_DEFAULT_LANGUAGE),
-sfx::AccessibilityIssueID::DOCUMENT_LANGUAGE);
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_DOCUMENT_DEFAULT_LANGUAGE),
+  
sfx::AccessibilityIssueID::DOCUMENT_LANGUAGE);
+pIssue->setIssueObject(IssueObject::LANGUAGE_NOT_SET);
+pIssue->setObjectID(OUString());
+pIssue->setDoc(*pDoc);
 }
 else
 {
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index 5c1744ad..1cb1a9a87213 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -262,12 +262,25 @@ void AccessibilityIssue::quickFixIssue() const
 uno::Reference 
xModel(m_pDoc->GetDocShell()->GetModel(),
  uno::UNO_QUERY_THROW);
 
-uno::Sequence aArgs{
-comphelper::makePropertyValue("Param", m_sObjectID),
-comphelper::makePropertyValue("Family", 
sal_Int16(SfxStyleFamily::Para))
-};
-comphelper::dispatchCommand(".uno:EditStyleFont",
-
xModel->getCurrentController()->getFrame(), aArgs);
+if (m_sObjectID.isEmpty())
+{
+// open the dialog "Tools/Options/Language Settings - Language"
+uno::Sequence aArgs{ 
comphelper::makePropertyValue(
+"Language", OUString("*")) };
+
+comphelper::dispatchCommand(".uno:LanguageStatus",
+
xModel->getCurrentController()->getFrame(), aArgs);
+}
+else
+{
+uno::Sequence aArgs{
+comphelper::makePropertyValue("Param", m_sObjectID),
+comphelper::makePropertyValue("Family", 
sal_Int16(SfxStyleFamily::Para))
+};
+
+comphelper::dispatchCommand(".uno:EditStyleFont",
+
xModel->getCurrentController()->getFrame(), aArgs);
+}
 }
 break;
 default:


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

2023-08-21 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/layact.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e40263b12055cbb95bb64ec6e81d3912152df900
Author: Michael Stahl 
AuthorDate: Mon Aug 14 17:27:52 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 21 12:26:40 2023 +0200

tdf#156724 tdf#156722 sw: layout: remove IsPaintLocked() check

Get rid of the problematic IsPaintLocked() and only check for a column
parent; effectively this prevents formatting frames in columns even when
loaded from the UI, so the layout will hopefully be the same regardless
of how it is invoked.

Change-Id: Ib4cc2efdb68ef4db73dcad01c7e1bd4be35de071
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155673
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 61a78a523a6131ff98b5d846368e5626fe58d99c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155694
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index af93ab796ff6..c20fa4e3a1ea 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1431,7 +1431,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
 PopFormatLayout();
 }
 }
-else if (m_pImp->GetShell()->IsPaintLocked() || 
!pLay->IsColBodyFrame())
+else if (!pLay->IsColBodyFrame())
 {   // tdf#156724 unconditionally for frames in tables, so their 
footnotes exist before trying to split
 pLow->OptCalc();
 }


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

2023-08-17 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityIssue.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 12fa73e75f183b44fb79128d420f4b0f9fb8b594
Author: Balazs Varga 
AuthorDate: Mon Aug 14 19:05:35 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 17 11:44:11 2023 +0200

tdf#156741 - A11Y - fix drawing shape is not highlighted by clicking

"Avoid floating text" warning.

If GotoFly not select the textframe object try GotoDrawingObject.

Change-Id: Ica7829dd0cc21f3f1fb344dfb21afdfb43783cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155676
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 54c158ff35ab5a0b5fa538562755638e052d51f2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155699
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index e0b66391c022..577b3ed0929e 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -70,6 +70,10 @@ void AccessibilityIssue::gotoIssue() const
 pWrtShell->HideCursor();
 pWrtShell->EnterSelFrameMode();
 }
+
+if (!bSelected && m_eIssueObject == IssueObject::TEXTFRAME)
+pWrtShell->GotoDrawingObject(m_sObjectID);
+
 if (comphelper::LibreOfficeKit::isActive())
 pWrtShell->ShowCursor();
 }


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

2023-08-16 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit cfc49650d37e2a0eb28111097d7fc8453d9cafee
Author: László Németh 
AuthorDate: Mon Aug 14 16:40:34 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 16 19:41:57 2023 +0200

tdf#156782 sw tracked table column: fix missing right table border

Last visible column of a table followed with hidden deleted columns
hid also the right border of the table, if the inner vertical column
borders drawn only by left-only borders (like in the default table
style).

See also commit f9898fa64bd2a575be94c309b43373de53c5331b
"tdf#150308 sw: fix missing top table border after hidden table rows"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: I5e98c6751d889f8d5a3f7f2b0b31e44149742e25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155669
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f7189c63b297b8756f02be65a7050609599651af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155704
Tested-by: Jenkins

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 117ac8eb5e61..c9fcc98436b6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2828,6 +2828,29 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 && rBoxItem.GetBottom());
 }
 
+/**
+ * Special case:
+ * last visible cell of a table row followed with a hidden deleted cell,
+ * and the right border of the visible cell was painted by its left border
+ */
+static bool lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+SwFrame const& rFrame, SvxBoxItem const& rBoxItem)
+{
+SwRowFrame const*const pThisRowFrame =
+dynamic_cast(rFrame.GetUpper());
+const SwCellFrame* pThisCell = static_cast();
+
+return pThisRowFrame
+// last visible cell
+&& !rFrame.GetNext()
+// it has only left border
+&& !rBoxItem.GetRight()
+&& rBoxItem.GetLeft()
+// last visible table cell isn't equal to the last cell:
+// there are invisible deleted cells in Hide Changes mode
+&& pThisRowFrame->GetTabLine()->GetTabBoxes().back() != 
pThisCell->GetTabBox();
+}
+
 void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& 
rBoxItem, const SwRect& rPaintArea)
 {
 // build 4 line entries for the 4 borders:
@@ -2837,6 +2860,9 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 
 bool const 
bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 mrTabFrame, rFrame, rBoxItem));
+bool const bLeftAsRight(lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow(
+rFrame, rBoxItem));
+
 bool const bVert = mrTabFrame.IsVertical();
 bool const bR2L  = mrTabFrame.IsRightToLeft();
 
@@ -2898,7 +2924,7 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 }
 
 SwLineEntry aRight (nRight,  nTop,  nBottom, bRightIsOuter,
-bVert ? (bBottomAsTop ? aB : aT) : (bR2L ? aL : aR));
+bVert ? (bBottomAsTop ? aB : aT) : ((bR2L || bLeftAsRight) ? aL : 
aR));
 if (bWordTableCell && rBoxItem.GetRight())
 {
 aRight.LimitVerticalEndPos(rFrame, SwLineEntry::VerticalType::RIGHT);


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

2023-08-15 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit efec67f1953640c5536b9635f65695552c001693
Author: Balazs Varga 
AuthorDate: Fri Aug 11 11:23:35 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Tue Aug 15 08:21:30 2023 +0200

tdf#156622 - A11Y - fix not clickable warning about blinking text

Make clickable and highlight the problematic text.

Change-Id: Ie53c74b0364d08e4299e4c27ff2744a8c547844e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155586
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 13d51d47e8c7c8cca6d1271dfad42e0af982945f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155609
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index f18cb81a8d8e..ee2ba0aa8bef 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1040,7 +1040,8 @@ public:
 class BlinkingTextCheck : public NodeCheck
 {
 private:
-void checkTextRange(uno::Reference const& xTextRange)
+void checkTextRange(uno::Reference const& xTextRange, 
SwTextNode* pTextNode,
+sal_Int32 nStart)
 {
 uno::Reference xProperties(xTextRange, 
uno::UNO_QUERY);
 if (xProperties.is() && 
xProperties->getPropertySetInfo()->hasPropertyByName("CharFlash"))
@@ -1050,7 +1051,12 @@ private:
 
 if (bBlinking)
 {
-lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_BLINKING));
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_BLINKING));
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+pIssue->setDoc(pTextNode->GetDoc());
+pIssue->setStart(nStart);
+pIssue->setEnd(nStart + xTextRange->getString().getLength());
 }
 }
 }
@@ -1074,11 +1080,15 @@ public:
 
 uno::Reference 
xRunEnumAccess(xParagraph, uno::UNO_QUERY);
 uno::Reference xRunEnum = 
xRunEnumAccess->createEnumeration();
+sal_Int32 nStart = 0;
 while (xRunEnum->hasMoreElements())
 {
 uno::Reference xRun(xRunEnum->nextElement(), 
uno::UNO_QUERY);
 if (xRun.is())
-checkTextRange(xRun);
+{
+checkTextRange(xRun, pTextNode, nStart);
+nStart += xRun->getString().getLength();
+}
 }
 }
 };


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

2023-08-15 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 95db490b23ce10cc220bc7e09a3e6d213bd7a7fd
Author: Balazs Varga 
AuthorDate: Fri Aug 11 11:48:22 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Tue Aug 15 08:20:32 2023 +0200

tdf#156620 - A11Y - fix not clickable warning about tables have headings

Make warning messages clickable and go to the problematic paragraph.

Change-Id: I5ca0b33b6f50b5d08993ebd0fc2749804e80de48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155587
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 8d2ab36f41f8f11e9f5986bba6ebb5b95d7e1eef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155690
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 462205fc65d6..f18cb81a8d8e 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1219,7 +1219,10 @@ public:
 if (parentTable)
 {
 m_bPrevPassed = false;
-lclAddIssue(m_rIssueCollection, SwResId(STR_HEADING_IN_TABLE));
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_HEADING_IN_TABLE));
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setDoc(pCurrent->GetDoc());
+pIssue->setNode(pCurrent);
 }
 }
 }


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

2023-08-14 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/calcmove.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 91f46dcc99f9191a00bc41a90088ffa9eb124bd8
Author: Michael Stahl 
AuthorDate: Tue Aug 8 19:39:04 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 11:27:47 2023 +0200

tdf#151866 sw: layout: prevent deleting newly created SwSectionFrame

A section frame is created so that content can move back from another
page into it.

Apparently only the pPrv frame is on the same page, and formatting it in
SwFrame::MakePos() moves it backward, then CheckPageDescs() sees a page
with only empty section frames on it and deletes the whole page.

(regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb)

Change-Id: I4f8e4debd4bcf993c9355dcfc3ced779fe6732ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155467
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 2f9e67d1e70bdc45dfc59554547bc3730481a757)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155474
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 73a4ced54c99..820d7834027b 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -542,6 +542,9 @@ void SwFrame::MakePos()
  !pPrv->GetAttrSet()->GetKeep().GetValue()
)
 {
+// tdf#151866 pPrv may MoveBwd and if this is a newly created
+// section frame then CheckPageDescs() may delete the whole page!
+SwFrameDeleteGuard g(this); // Prevent it.
 pPrv->Calc(getRootFrame()->GetCurrShell() ? 
getRootFrame()->GetCurrShell()->GetOut() : nullptr);   // This may cause Prev 
to vanish!
 }
 else if ( pPrv->getFrameArea().Top() == 0 )


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

2023-08-14 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/layact.cxx |   23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit ac5d5b4d7901b347b9b610b536317b30ec785f68
Author: Michael Stahl 
AuthorDate: Tue Aug 8 17:22:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 11:25:21 2023 +0200

tdf#147666 sw: layout: no IsShortCut() if fly was moved to page

The problem was that the fly's anchor frame was moved to page 2, and
then IsShortCut() returns true for the anchor frame, which means only
the anchor frame itself is formatted, but not its fly.

Thus the fly remains invalid and positioned on page 1 when its rectangle
is passed to SwViewShell::VisPortChgd(), and only later it is properly
positioned.

(regression from commit eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)

Change-Id: I9e0554bd0d9751b47a11a3917575d382139ee93a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155461
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9c291ea8c63284fe5c344553fcb338e66c17c797)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155470
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 21496e2237e1..ecce180eb336 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1166,21 +1166,28 @@ bool SwLayAction::IsShortCut( SwPageFrame * )
 }
 // no shortcut, if at previous page
 // an anchored object is registered, whose anchor is 
.
-else if ( prPage->GetPrev() )
+else
 {
-SwSortedObjs* pObjs =
-
static_cast(prPage->GetPrev())->GetSortedObjs();
-if ( pObjs )
+auto const CheckFlys = [,pContent](SwPageFrame & 
rPage)
 {
-for (SwAnchoredObject* pObj : *pObjs)
+SwSortedObjs *const pObjs(rPage.GetSortedObjs());
+if (pObjs)
 {
-if ( pObj->GetAnchorFrameContainingAnchPos() == 
pContent )
+for (SwAnchoredObject *const pObj : *pObjs)
 {
-bRet = false;
-break;
+if (pObj->GetAnchorFrameContainingAnchPos() == 
pContent)
+{
+bRet = false;
+break;
+}
 }
 }
+};
+if (prPage->GetPrev())
+{
+
CheckFlys(*static_cast(prPage->GetPrev()));
 }
+CheckFlys(*prPage); // tdf#147666 also check this page
 }
 }
 }


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

2023-08-14 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/tabfrm.hxx|1 +
 sw/source/core/layout/fly.cxx|7 ++-
 sw/source/core/layout/tabfrm.cxx |   24 ++--
 3 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 1808306db7bec6cd668b5840eb8a0121ee89991f
Author: Michael Stahl 
AuthorDate: Tue Aug 8 12:21:20 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 11:21:58 2023 +0200

tdf#156551 tdf#150606 sw: layout: only invalidate SwTabFrame if it...

... wants to move back.

In this document, the table 1709 splits across 3 columns of the section
1702 with 1 row each, and when its follows are invalidated in
CalcContent(), the later SwTabFrame::MakeAll() of the 1st follow joins
the 2nd follow and invalidates the size of the section frame, causing a
loop.

So only invalidate if that actually looks necessary.

(regression from commit 59987d3c77ec7dbf59fbea9f47cc226f4e8903f9)

Change-Id: I360c8f697a7666a19a08d8ebcabbcfa3a7cdf844
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155452
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit a9b19f78f3cdcbf5c949a85b45877e903114cc54)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155408
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 7e7a590c7907..a249f6c1f845 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -61,6 +61,7 @@ class SW_DLLPUBLIC SwTabFrame final: public SwLayoutFrame, 
public SwFlowFrame
 bool m_bCalcLowers  :1; /// For stability of the content in MakeAll
 bool m_bLowersFormatted :1; /// Communication between MakeAll and Layact
 bool m_bLockBackMove:1; /// The Master took care of the BackMove test
+bool m_bWantBackMove:1; /// Table wants to move back but was locked
 bool m_bResizeHTMLTable :1; /// Call the Resize of the HTMLTableLayout in 
the MakeAll
 /// This is an optimization, so that we don't 
have to call
 /// it in ContentFrame::Grow; there it might 
be called for
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 4022e1995fe8..c2d27eaf2f0e 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1843,7 +1843,12 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 {
 assert(static_cast(pFrame)->IsFollow());
 static_cast(pFrame)->m_bLockBackMove = false;
-pFrame->InvalidatePos();
+// tdf#150606 encourage it to move back in FormatLayout()
+if (static_cast(pFrame)->m_bWantBackMove)
+{
+static_cast(pFrame)->m_bWantBackMove = 
false;
+pFrame->InvalidatePos();
+}
 }
 }
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a4dddec2ec83..02e3dbdc187d 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -79,6 +79,7 @@ SwTabFrame::SwTabFrame( SwTable , SwFrame* pSib )
 , m_bCalcLowers(false)
 , m_bLowersFormatted(false)
 , m_bLockBackMove(false)
+, m_bWantBackMove(false)
 , m_bResizeHTMLTable(false)
 , m_bONECalcLowers(false)
 , m_bHasFollowFlowLine(false)
@@ -124,6 +125,7 @@ SwTabFrame::SwTabFrame( SwTabFrame  )
 , m_bCalcLowers(false)
 , m_bLowersFormatted(false)
 , m_bLockBackMove(false)
+, m_bWantBackMove(false)
 , m_bResizeHTMLTable(false)
 , m_bONECalcLowers(false)
 , m_bHasFollowFlowLine(false)
@@ -3820,9 +3822,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame 
*pNewUpper, bool  )
 }
 else if (!m_bLockBackMove)
 bMoveAnyway = true;
+else
+{
+m_bWantBackMove = true;
+}
 }
 else if (!m_bLockBackMove)
 bMoveAnyway = true;
+else
+{
+m_bWantBackMove = true;
+}
 
 if ( bMoveAnyway )
 {
@@ -3835,7 +3845,7 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame 
*pNewUpper, bool  )
 // This frame fits into pNewUpper in case it has no space, but this
 // frame is empty.
 bFits = nSpace >= 0;
-if (!m_bLockBackMove && bFits)
+if (bFits)
 {
 // #i26945# - check, if follow flow line
 // contains frame, which are moved forward due to its object
@@ -3854,7 +3864,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame 
*pNewUpper, bool  )
 // 'return nHeight <= nSpace' to 'return nTmpHeight < nSpace'.
 // This obviously results in problems with table frames in
 // sections. Remember: Every twip is sacred.
-return nTmpHeight <= nSpace;
+   

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

2023-08-14 Thread Michael Stahl (via logerrit)
 sw/source/core/undo/untbl.cxx |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 28a3435cda15509dd9832f48607aac908bde3954
Author: Michael Stahl 
AuthorDate: Fri Aug 4 13:06:51 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 11:20:47 2023 +0200

tdf#147938 sw: Undo of table to text uses ContentIdxStore wrong

ContentIdxStore must be created for every SplitContentNode() with its
content index and used there; SwNodes::UndoTableToText() creates it once
per text node which is rather unhelpful and in this case results in a
redline with incorrect range, starting in one table cell and ending in
another.

This problem exists since initial CVS import.

Change-Id: I8a20b13b42384658bf869c5202ccbad2213c12f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155344
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 3d8697dab9a4a29666440a30c5c7a6d9d9f76d76)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155304
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 8c351559db69..d6e58e633844 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -561,7 +561,6 @@ SwTableNode* SwNodes::UndoTableToText( SwNodeOffset nSttNd, 
SwNodeOffset nEndNd,
 SwTableLine* pLine = new SwTableLine( pLineFormat, rSavedData.size(), 
nullptr );
 pTableNd->GetTable().GetTabLines().insert( 
pTableNd->GetTable().GetTabLines().begin(), pLine );
 
-const std::shared_ptr 
pContentStore(sw::mark::ContentIdxStore::Create());
 for( size_t n = rSavedData.size(); n; )
 {
 const SwTableToTextSave *const pSave = rSavedData[ --n ].get();
@@ -576,6 +575,9 @@ SwTableNode* SwNodes::UndoTableToText( SwNodeOffset nSttNd, 
SwNodeOffset nEndNd,
 OSL_ENSURE( pTextNd, "Where is my TextNode?" );
 SwContentIndex aCntPos( pTextNd, pSave->m_nContent - 1 );
 
+const std::shared_ptr 
pContentStore(sw::mark::ContentIdxStore::Create());
+pContentStore->Save(GetDoc(), aSttIdx.GetIndex(), 
aCntPos.GetIndex());
+
 pTextNd->EraseText( aCntPos, 1 );
 
 std::function 
restoreFunc(
@@ -589,14 +591,6 @@ SwTableNode* SwNodes::UndoTableToText( SwNodeOffset 
nSttNd, SwNodeOffset nEndNd,
 pTextNd->SplitContentNode(
 SwPosition(aSttIdx, aCntPos), );
 }
-else
-{
-pContentStore->Clear();
-if( pTextNd )
-{
-pContentStore->Save(GetDoc(), aSttIdx.GetIndex(), 
SAL_MAX_INT32);
-}
-}
 
 if( pTextNd )
 {


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

2023-08-11 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 2b2285f70bcc85ae26ad12b75859dae8800c6662
Author: Balazs Varga 
AuthorDate: Wed Aug 9 14:43:55 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 11 16:02:06 2023 +0200

tdf#156614 - A11Y - fix not clickable warning about fake forms

Make the warning message clickable and select the text.

Change-Id: I5b503ba278980c128bbef83631dabc897bb33b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155519
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 61730db0931ac117971646df8f9f359df99a1cc6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155480
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index a7907c8992cd..462205fc65d6 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1129,10 +1129,10 @@ public:
 if (!pCurrent->IsTextNode())
 return;
 
-const auto& text = pCurrent->GetTextNode()->GetText();
+SwTextNode* pTextNode = pCurrent->GetTextNode();
+const auto& text = pTextNode->GetText();
 
 // Series of tests to detect if there are fake forms in the text.
-
 bool bCheck = text.indexOf("___") == -1; // Repeated underscores.
 
 if (bCheck)
@@ -1149,7 +1149,15 @@ public:
 
 // Checking if all the tests are passed successfully. If not, adding a 
warning.
 if (!bCheck)
-lclAddIssue(m_rIssueCollection, 
SwResId(STR_NON_INTERACTIVE_FORMS));
+{
+sal_Int32 nStart = 0;
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_NON_INTERACTIVE_FORMS));
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+pIssue->setDoc(pTextNode->GetDoc());
+pIssue->setStart(nStart);
+pIssue->setEnd(nStart + text.getLength());
+}
 }
 };
 


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

2023-08-11 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/wrtsh/wrtsh1.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 50c3d02656ffb10fc103ad2bb52f0fcc1de93daf
Author: Xisco Fauli 
AuthorDate: Thu Aug 10 17:59:01 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 11 13:30:34 2023 +0200

tdf#156270: use double for width/height

Otherwise 0.313159 is rounded to 0

Regression from
commit 99f43923b66a98b75c78a50577f19293aa480998
Author: Xisco Fauli 
Date:   Tue Apr 18 14:37:32 2023 +0200

sw: fix divide by 0

Change-Id: Ib8bf0a770834e0ff73d215c27788df7a3b98404d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155561
Reviewed-by: Caolán McNamara 
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 
(cherry picked from commit 6ab45e1e2b256880d2f05b6669eb196e83682a14)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155488
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 7a39048fec5f..af96916885d5 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -915,8 +915,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& 
xObj,
 }
 else
 {
-tools::Long nWidth(pCli->GetScaleWidth());
-tools::Long nHeight(pCli->GetScaleHeight());
+double nWidth(pCli->GetScaleWidth());
+double nHeight(pCli->GetScaleHeight());
 if (nWidth && nHeight)
 {
 aArea.Width ( aArea.Width()  / nWidth );


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

2023-08-10 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   10 ++
 sw/source/core/docnode/nodes.cxx |3 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 6980f69c559861aba7279d5b90ae09f0347fa4d4
Author: Balazs Varga 
AuthorDate: Fri Aug 4 20:54:29 2023 +0200
Commit: Balazs Varga 
CommitDate: Thu Aug 10 10:57:01 2023 +0200

tdf#156553 tdf#156554 A11Y: fix issue update after image deletion

Reset accessibility check issues when deleting graphic/ole nodes.

Change-Id: I5f0698f6cf9e97045be22482de64518ab22d5946
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155355
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 0d2fc6c053cad80c685755d030c6b57202f78d50)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155482
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index a24bdb82ad79..a7907c8992cd 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -100,9 +100,12 @@ class NoTextNodeAltTextCheck : public NodeCheck
 if (!pNoTextNode->GetTitle().isEmpty() || 
!pNoTextNode->GetDescription().isEmpty())
 return;
 
-OUString sName = pNoTextNode->GetFlyFormat()->GetName();
+const SwFrameFormat* pFrameFormat = pNoTextNode->GetFlyFormat();
+if (!pFrameFormat)
+return;
 
-OUString sIssueText = SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", 
sName);
+OUString sIssueText
+= SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", 
pFrameFormat->GetName());
 
 if (pNoTextNode->IsOLENode())
 {
@@ -110,11 +113,10 @@ class NoTextNodeAltTextCheck : public NodeCheck
   sfx::AccessibilityIssueID::NO_ALT_OLE);
 pIssue->setDoc(pNoTextNode->GetDoc());
 pIssue->setIssueObject(IssueObject::OLE);
-pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName());
+pIssue->setObjectID(pFrameFormat->GetName());
 }
 else if (pNoTextNode->IsGrfNode())
 {
-const SwFrameFormat* pFrameFormat = pNoTextNode->GetFlyFormat();
 const SfxBoolItem* pIsDecorItem = 
pFrameFormat->GetItemIfSet(RES_DECORATIVE);
 if (!(pIsDecorItem && pIsDecorItem->GetValue()))
 {
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index c045aa57023d..e5d20e4691ff 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -812,6 +812,9 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes 
& rNodes,
 pCurrentNode->m_pStartOfSection = aSttNdStack[ nLevel ];
 nInsPos++;
 --aRg.aEnd;
+
+// reset Accessibility issue state
+pCurrentNode->resetAndQueueAccessibilityCheck();
 }
 break;
 


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

2023-08-10 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 15f0871015b3d80cdf952f06891364f37adec90c
Author: Balazs Varga 
AuthorDate: Wed Aug 9 21:03:11 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 10 10:34:19 2023 +0200

tdf#156615 - A11Y - fix not clickable warning about empty table cells

Make "Empty table cells for formatting" warning clickable and go to the
table.

Change-Id: I65a258cd559b423692307af9778754076894
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155532
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 1770cab0674295a44ddd5002c189530021e0836d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155481

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 191d5d1c5c9a..a24bdb82ad79 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -251,8 +251,15 @@ private:
 }
 // If more than half of the boxes are empty we can assume that it 
is used for formatting
 if (nEmptyBoxes > nBoxCount / 2)
-lclAddIssue(m_rIssueCollection, SwResId(STR_TABLE_FORMATTING),
-sfx::AccessibilityIssueID::TABLE_FORMATTING);
+{
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_TABLE_FORMATTING),
+  
sfx::AccessibilityIssueID::TABLE_FORMATTING);
+
+pIssue->setDoc(pTableNode->GetDoc());
+pIssue->setIssueObject(IssueObject::TABLE);
+if (const SwTableFormat* pFormat = rTable.GetFrameFormat())
+pIssue->setObjectID(pFormat->GetName());
+}
 }
 }
 


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

2023-08-07 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit fb5e1b23d5e06aee3cc05b05f468efe781948db3
Author: Balazs Varga 
AuthorDate: Wed Aug 2 14:10:28 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Aug 7 12:21:57 2023 +0200

tdf#156570 - A11Y - Fix heading accessibility warning not clickable

Make "Wrong heading..." warning message clickable.

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 80fc5624d7ed..191d5d1c5c9a 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1245,7 +1245,10 @@ public:
 }
 resultString
 = resultString.replaceAll("%LEVEL_CURRENT%", 
OUString::number(currentLevel));
-lclAddIssue(m_rIssueCollection, resultString);
+auto pIssue = lclAddIssue(m_rIssueCollection, resultString);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setDoc(pCurrent->GetDoc());
+pIssue->setNode(pCurrent);
 }
 
 // Updating previous level.


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

2023-08-07 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 585b2cec2f6441a698588e5a27d02c14378daf49
Author: Balazs Varga 
AuthorDate: Wed Aug 2 13:05:37 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Aug 7 12:21:12 2023 +0200

tdf#156568 - A11Y - Make clickable the "Hyperlink text is the same as..."

warning message.

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 2d44e8689b58..80fc5624d7ed 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -332,18 +332,24 @@ private:
 {
 OUString sText = xTextRange->getString();
 INetURLObject aHyperlink(sHyperlink);
+std::shared_ptr pIssue;
+
 if (aHyperlink.GetProtocol() != INetProtocol::NotValid
 && INetURLObject(sText) == aHyperlink)
 {
 OUString sIssueText
 = 
SwResId(STR_HYPERLINK_TEXT_IS_LINK).replaceFirst("%LINK%", sHyperlink);
-lclAddIssue(m_rIssueCollection, sIssueText,
-sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT);
+pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
+ 
sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT);
 }
 else if (sText.getLength() <= 5)
 {
-auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_HYPERLINK_TEXT_IS_SHORT),
-  
sfx::AccessibilityIssueID::HYPERLINK_SHORT);
+pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_HYPERLINK_TEXT_IS_SHORT),
+ 
sfx::AccessibilityIssueID::HYPERLINK_SHORT);
+}
+
+if (pIssue)
+{
 pIssue->setIssueObject(IssueObject::TEXT);
 pIssue->setNode(pTextNode);
 SwDoc& rDocument = pTextNode->GetDoc();


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

2023-08-07 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 1deec5e76bcd653ae48267f12c700753c5e0b6b5
Author: Balazs Varga 
AuthorDate: Tue Aug 1 20:32:09 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Aug 7 11:47:47 2023 +0200

tdf#156550 - a11y - fix sidebar complains about TOC hyperlinks

Just comparing strings of url text and url link target.

Change-Id: Iaf6196512214195a947429cd2d5e00cf9be46b89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155202
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 041e8806f2640e69634aee6a0a681e2f07b387eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155243
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 4419e8d33b9d..2d44e8689b58 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -331,7 +331,9 @@ private:
 if (!sHyperlink.isEmpty())
 {
 OUString sText = xTextRange->getString();
-if (INetURLObject(sText) == INetURLObject(sHyperlink))
+INetURLObject aHyperlink(sHyperlink);
+if (aHyperlink.GetProtocol() != INetProtocol::NotValid
+&& INetURLObject(sText) == aHyperlink)
 {
 OUString sIssueText
 = 
SwResId(STR_HYPERLINK_TEXT_IS_LINK).replaceFirst("%LINK%", sHyperlink);


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

2023-08-03 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/findfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4a69c103cd0a8f41c3c679bf9440c87974de933b
Author: Michael Stahl 
AuthorDate: Wed Aug 2 18:20:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 3 14:02:33 2023 +0200

tdf#145743 sw: don't delete empty page with ColLocked section

In MakeFrames(), the new frames are inserted into a section frame,
before an existing frame; the existing frame is MoveFwd() to the next
page, so the call to CheckPageDescs() finds the page frame empty and
deletes it, along with the section frame.

Check the mbColLocked flag set by MakeFrames() to prevent it.

(regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb)

Change-Id: I4e02a85314adaf07794fd6b5447bd78d39597b8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155266
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit bd996a23bc4780579fc17e23d8f9f16e2af60289)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155245
Reviewed-by: Caolán McNamara 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 3e2c26a8bbf9..ae2c7473baf3 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -180,7 +180,7 @@ bool SwLayoutFrame::ContainsDeleteForbiddenLayFrame() const
 continue;
 }
 SwLayoutFrame const*const pLay(static_cast(pFrame));
-if (pLay->ContainsDeleteForbiddenLayFrame())
+if (pLay->ContainsDeleteForbiddenLayFrame() || pLay->IsColLocked())
 {
 return true;
 }


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

2023-08-03 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/vprint.hxx   |7 +++
 sw/source/core/text/EnhancedPDFExportHelper.cxx |6 --
 sw/source/core/view/viewpg.cxx  |2 +-
 sw/source/core/view/vprint.cxx  |   18 +-
 4 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 570ca3164c57aa29d1548b179e0a9905f8b8a9b3
Author: Michael Stahl 
AuthorDate: Mon Jul 10 17:09:14 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 3 14:01:32 2023 +0200

tdf#148729 sw: PDF export: fix link targets when "comments in margin"

... is enabled but there are no comments; the conditions in
SwViewShell::PrintOrPDFExport() and
SwEnhancedPDFExportHelper::SwRectToPDFRect() were out of sync.

(regression from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403)

Change-Id: I617185e6f30843a79190a54b73a5f4497388
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154279
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit f7974dc8d6d0cca08da52c4fbdb312ed6b7d71da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154257
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/view/vprint.hxx b/sw/source/core/inc/vprint.hxx
similarity index 90%
rename from sw/source/core/view/vprint.hxx
rename to sw/source/core/inc/vprint.hxx
index 60f2750caeb9..9d2c7fe3722f 100644
--- a/sw/source/core/view/vprint.hxx
+++ b/sw/source/core/inc/vprint.hxx
@@ -22,6 +22,13 @@
 
 class SwRootFrame;
 class SwPageFrame;
+class SwPrintData;
+
 SwPageFrame const* sw_getPage(SwRootFrame const& rLayout, sal_Int32 const 
nPage);
 
+namespace sw
+{
+bool IsShrinkPageForPostIts(SwViewShell const& rShell, SwPrintData const&);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index f883b49490a0..9124522379c8 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1735,9 +1736,10 @@ SwEnhancedPDFExportHelper::~SwEnhancedPDFExportHelper()
 tools::Rectangle SwEnhancedPDFExportHelper::SwRectToPDFRect(const SwPageFrame* 
pCurrPage,
 const tools::Rectangle& rRectangle) const
 {
-SwPostItMode nPostItMode = mrPrintData.GetPrintPostIts();
-if (nPostItMode != SwPostItMode::InMargins)
+if (!::sw::IsShrinkPageForPostIts(mrSh, mrPrintData)) // tdf#148729
+{
 return rRectangle;
+}
 //the page has been scaled by 75% and vertically centered, so adjust these
 //rectangles equivalently
 tools::Rectangle aRect(rRectangle);
diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx
index 4d2385483c92..02ebd1a69e12 100644
--- a/sw/source/core/view/viewpg.cxx
+++ b/sw/source/core/view/viewpg.cxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 
-#include "vprint.hxx"
+#include 
 
 using namespace ::com::sun::star;
 
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 3cd0c524007e..bc5dd5bd6c86 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -47,7 +47,7 @@
 #include 
 #include 
 #include 
-#include "vprint.hxx"
+#include 
 
 using namespace ::com::sun::star;
 
@@ -429,6 +429,17 @@ sw_getPage(SwRootFrame const& rLayout, sal_Int32 const 
nPage)
 return nullptr;
 }
 
+namespace sw
+{
+// tdf#91680 Reserve space in margin for comments only if there are 
comments
+bool IsShrinkPageForPostIts(SwViewShell const& rShell, SwPrintData const& 
rPrintData)
+{
+SwPostItMode const nPostItMode(rPrintData.GetPrintPostIts());
+return nPostItMode == SwPostItMode::InMargins
+&& sw_GetPostIts(rShell.GetDoc()->getIDocumentFieldsAccess(), 
nullptr);
+}
+}
+
 bool SwViewShell::PrintOrPDFExport(
 OutputDevice *pOutDev,
 SwPrintData const& rPrintData,
@@ -446,11 +457,8 @@ bool SwViewShell::PrintOrPDFExport(
 // output device is now provided by a call from outside the Writer)
 pOutDev->Push();
 
-SwPostItMode nPostItMode = rPrintData.GetPrintPostIts();
 
-// tdf#91680 Reserve space in margin for comments only if there are 
comments
-const bool bHasPostItsToPrintInMargins = ( nPostItMode == 
SwPostItMode::InMargins ) &&
-sw_GetPostIts( 
GetDoc()->getIDocumentFieldsAccess(), nullptr );
+const bool bHasPostItsToPrintInMargins(::sw::IsShrinkPageForPostIts(*this, 
rPrintData));
 ::std::optional oOrigHeight;
 
 // Print/PDF export for (multi-)selection has already generated a


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

2023-08-03 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 74eafad84463d097adc8fe680f57b2c9039e0a56
Author: Michael Stahl 
AuthorDate: Wed Aug 2 15:01:20 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 3 14:00:35 2023 +0200

tdf#156306 sw: PDF export: duplicate structure element from ...

... lazy open LIBody - with mpFrameInfo, not mpNumInfo - causes this
assert and later an infinite loop as the SE is its own parent:

sw/source/core/text/EnhancedPDFExportHelper.cxx:468: void 
SwTaggedPDFHelper::BeginTag(vcl::PDFWriter::StructElement, const 
rtl::OUString&): Assertion `rFrameTagSet.find(pKey) == rFrameTagSet.end()' 
failed.

(regression from commit d467f1aa3d028f399826c97e2eecedcd79efcf65)

Change-Id: I90f057c45a22e5ef44ae5ae9d1cb1d6b8870379f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155253
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 16aa870598d00eb3e6ac15435fef080d3b87cbc1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155237
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index a864b389ceb9..f883b49490a0 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -449,7 +449,7 @@ void SwTaggedPDFHelper::BeginTag( 
vcl::PDFWriter::StructElement eType, const OUS
 {
 void const* pKey(nullptr);
 
-if ( mpFrameInfo )
+if (mpFrameInfo && eType != vcl::PDFWriter::LIBody)
 {
 const SwFrame& rFrame = mpFrameInfo->mrFrame;
 


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

2023-08-03 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/wsfrm.cxx |   26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

New commits:
commit c2a86b88e71c0b4291cd813d9a53fa89a29ea8b9
Author: Michael Stahl 
AuthorDate: Tue Aug 1 19:45:58 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 3 13:58:11 2023 +0200

tdf#152307 sw: layout: invalidate more frames when footer grows

While on page 12:
SwTabFrame::MakeAll() is called on 523 while it's on page 12; there is
one invalid pos text frame 492 with a fly somewhere before it;
PrepareMake() of 523 formats prevs 492 then 493 which MoveFwd() taking
523 with it.

While on page 13:
TabFrame 523 is valid, and the footer 6651 never formatted (0 height).
Formatting the footer in SwHeadFootFrame::FormatSize() invalidates the
body 1031, immediately calls Calc() from SwFrame::MakePos(), where
~SwLayNotify() -> SwLayoutFrame::ChgLowersProp() invalidates
SectionFrame 1034.

Then SectionFrame 1034 is formatted, which via
SwSectionFrame::CheckClipping() -> SwLayoutFrame::ChgLowersProp()
invalidates only the last lower frame, because it checks the position of
the frame and this frame still has a position on a previous page (it
moved from page 12) and isn't even invalid yet.

So in case there are invalid frames, the positions of the frames
following these cannot be trusted to be used to optimize invalidations
in SwLayoutFrame::ChgLowersProp().

(aside: it seems odd to format the body text before the footer text, but
 in this case doing it differently wouldn't have helped because the
 problem was already caused on a previous page)

(regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb)

Change-Id: I23b35c09af3a373d0913d931a2ba59d45fadf2c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155196
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 06bbcee6e367d1bc319c1f9cb0e749168e4d890c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155230
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 2834b09f70a6..9d696a2650f7 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -3141,26 +3141,48 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize 
)
 }
 else
 {
+SwFrame const* pFirstInvalid(nullptr);
+for (SwFrame const* pLow = Lower();
+ pLow && pLow != pLowerFrame; pLow = pLow->GetNext())
+{
+if (!pLow->isFrameAreaDefinitionValid())
+{
+pFirstInvalid = pLow;
+break;
+}
+}
 // variable size of body|section frame has shrunk. Thus,
 // invalidate all lowers not matching the new body|section size
 // and the dedicated new last lower.
 if( aRectFnSet.IsVert() )
 {
 SwTwips nBot = getFrameArea().Left() + 
getFramePrintArea().Left();
-while ( pLowerFrame && pLowerFrame->GetPrev() && 
pLowerFrame->getFrameArea().Left() < nBot )
+while (pLowerFrame && pLowerFrame->GetPrev()
+&& (pFirstInvalid != nullptr // tdf#152307 trust 
nothing after invalid frame
+|| pLowerFrame->getFrameArea().Left() < nBot))
 {
 pLowerFrame->InvalidateAll_();
 pLowerFrame->InvalidatePage( pPage );
+if (pLowerFrame == pFirstInvalid)
+{
+pFirstInvalid = nullptr; // continue checking nBot
+}
 pLowerFrame = pLowerFrame->GetPrev();
 }
 }
 else
 {
 SwTwips nBot = getFrameArea().Top() + 
getFramePrintArea().Bottom();
-while ( pLowerFrame && pLowerFrame->GetPrev() && 
pLowerFrame->getFrameArea().Top() > nBot )
+while (pLowerFrame && pLowerFrame->GetPrev()
+&& (pFirstInvalid != nullptr // tdf#152307 trust 
nothing after invalid frame
+|| nBot < pLowerFrame->getFrameArea().Top()))
 {
 pLowerFrame->InvalidateAll_();
 pLowerFrame->InvalidatePage( pPage );
+if (pLowerFrame == pFirstInvalid)
+{
+pFirstInvalid = nullptr; // continue checking nBot
+}
 pLowerFrame = pLowerFrame->GetPrev();
 }
 }


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

2023-08-02 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   46 +--
 1 file changed, 37 insertions(+), 9 deletions(-)

New commits:
commit 7109110a6494e9af2fa8aa9291d5f10f23f3f26b
Author: Balazs Varga 
AuthorDate: Mon Jul 31 15:11:44 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Aug 2 13:02:24 2023 +0200

tdf#156545 - a11y - fix warns about background character style formattings

Do not add warn to a11y sidebar if we use charstyle for character background
format.

Change-Id: Ide558b590cae2bc20c71c5c44909cd2cdeb89985
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155095
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 47ca3f1f762352b488d58b3bf23d5776576f1cca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155189
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 50dfa55d8f3c..4419e8d33b9d 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -480,15 +480,43 @@ private:
 aBackgroundColor = nParaBackColor;
 else
 {
-auto pIssue
-= lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING),
-  sfx::AccessibilityIssueID::TEXT_FORMATTING);
-pIssue->setIssueObject(IssueObject::TEXT);
-pIssue->setNode(pTextNode);
-SwDoc& rDocument = pTextNode->GetDoc();
-pIssue->setDoc(rDocument);
-pIssue->setStart(nTextStart);
-pIssue->setEnd(nTextStart + xTextRange->getString().getLength());
+OUString sCharStyleName;
+Color nCharStyleBackColor(COL_AUTO);
+if (xProperties->getPropertyValue("CharStyleName") >>= 
sCharStyleName)
+{
+try
+{
+uno::Reference 
xStyleFamiliesSupplier(
+pTextNode->GetDoc().GetDocShell()->GetModel(), 
uno::UNO_QUERY);
+uno::Reference xCont
+= xStyleFamiliesSupplier->getStyleFamilies();
+uno::Reference xStyleFamily(
+xCont->getByName("CharacterStyles"), uno::UNO_QUERY);
+uno::Reference xInfo(
+xStyleFamily->getByName(sCharStyleName), 
uno::UNO_QUERY);
+xInfo->getPropertyValue("CharBackColor") >>= 
nCharStyleBackColor;
+}
+catch (const uno::Exception&)
+{
+}
+}
+else
+{
+SAL_WARN("sw.a11y", "CharStyleName void");
+}
+
+if (aBackgroundColor != nCharStyleBackColor)
+{
+auto pIssue
+= lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING),
+  sfx::AccessibilityIssueID::TEXT_FORMATTING);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+SwDoc& rDocument = pTextNode->GetDoc();
+pIssue->setDoc(rDocument);
+pIssue->setStart(nTextStart);
+pIssue->setEnd(nTextStart + 
xTextRange->getString().getLength());
+}
 }
 
 Color aForegroundColor(ColorTransparency, nCharColor);


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

2023-07-31 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |   13 +
 sw/source/core/docnode/ndtbl.cxx  |   11 ++-
 2 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 0eea257cfc084903e4b20e923b06ac2bdd17a4e8
Author: Michael Stahl 
AuthorDate: Wed Jul 19 15:58:36 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jul 31 22:16:48 2023 +0200

tdf#153115 sw: SwDoc::TextToTable(), first remove all redlines

The problem is that there are redlines that overlap the created table
cell nodes.

For the writerfilter-import-API TextToTable() that was solved by
splitting the redlines, but that would take a lot of effort here as it's
not known ahead of time where the cells start and end, so just get rid
of the redlines.

Another issue is that the temporary SwPaM in
DocumentRedlineManager::AcceptRedline() caused ~SwIndexReg() assert.

(reportedly regression from commit 471212d464f54054f7419ef1890267d0def852d9)

Change-Id: I6b211b6c8e5c7e4bdab1dac858707d7d7fd85029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154655
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit cd20d9512aa4f9fbe39fce48b3c49cdb13cca6e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154620
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index d9148ce723f3..efed70b44a1a 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2947,17 +2947,22 @@ bool DocumentRedlineManager::AcceptRedline( const 
SwPaM& rPam, bool bCallDelete
 // The Selection is only in the ContentSection. If there are Redlines
 // to Non-ContentNodes before or after that, then the Selections
 // expand to them.
-SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
-lcl_AdjustRedlineRange( aPam );
+std::shared_ptr const 
pPam(m_rDoc.CreateUnoCursor(*rPam.GetPoint(), false));
+if (rPam.HasMark())
+{
+pPam->SetMark();
+*pPam->GetMark() = *rPam.GetMark();
+}
+lcl_AdjustRedlineRange(*pPam);
 
 if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
 {
 m_rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::ACCEPT_REDLINE, 
nullptr );
-m_rDoc.GetIDocumentUndoRedo().AppendUndo( 
std::make_unique( aPam ));
+
m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pPam));
 }
 
 int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, maRedlineTable,
- bCallDelete, aPam );
+ bCallDelete, *pPam );
 if( nRet > 0 )
 {
 CompressRedlines();
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index e7080207760d..0b625fb3651c 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -635,6 +635,16 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions& rInsTableOpts,
 return nullptr;
 }
 
+if (GetIDocumentUndoRedo().DoesUndo())
+{
+GetIDocumentUndoRedo().StartUndo(SwUndoId::TEXTTOTABLE, nullptr);
+}
+
+// tdf#153115 first, remove all redlines; splitting them at cell boundaries
+// would be tricky to implement, and it's unclear what the value of
+// existing redlines is once it's been converted to a table
+getIDocumentRedlineAccess().AcceptRedline(rRange, true);
+
 // Save first node in the selection if it is a context node
 SwContentNode * pSttContentNd = pStt->GetNode().GetContentNode();
 
@@ -645,7 +655,6 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions& rInsTableOpts,
 SwUndoTextToTable* pUndo = nullptr;
 if( GetIDocumentUndoRedo().DoesUndo() )
 {
-GetIDocumentUndoRedo().StartUndo( SwUndoId::TEXTTOTABLE, nullptr );
 pUndo = new SwUndoTextToTable( aOriginal, rInsTableOpts, cCh,
 o3tl::narrowing(eAdjust), pTAFormat );
 GetIDocumentUndoRedo().AppendUndo( std::unique_ptr(pUndo) );


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

2023-07-31 Thread Michael Stahl (via logerrit)
 sw/source/core/unocore/unoobj2.cxx |   42 +++--
 1 file changed, 31 insertions(+), 11 deletions(-)

New commits:
commit 8d2c3ba78550631ae991bdd517b3acc9749e41b7
Author: Michael Stahl 
AuthorDate: Fri Jul 28 17:33:20 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jul 31 22:14:19 2023 +0200

tdf#149555 sw: convert RANGE_IS_SECTION SwXTextRange if possible

The writerfilter import got an exception in
SectionPropertyMap::CloseSectionGroup() because XTextRangeToSwPaM()
can't handle RANGE_IS_SECTION SwXTextRange.

(regression from commit 7ab349296dac79dad3fec09f60348efcbb9ea17e)

Change-Id: I38b37fdec64f4699c0fa1a090c72a8676ff386a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155026
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 0f39ecfed57f3f32d4f5cadf50b7dd9de77f8d7e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154968
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index 1b02cb5a0b27..01682ef48587 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1049,20 +1049,40 @@ void SAL_CALL SwXTextRange::setString(const OUString& 
rString)
 
 bool SwXTextRange::GetPositions(SwPaM& rToFill, ::sw::TextRangeMode const 
eMode) const
 {
-if (RANGE_IS_SECTION == m_pImpl->m_eRangePosition
-&& eMode == ::sw::TextRangeMode::AllowNonTextNode)
+if (RANGE_IS_SECTION == m_pImpl->m_eRangePosition)
 {
 if (auto const pSectFormat = static_cast(m_pImpl->m_pTableOrSectionFormat))
 {
-SwNodeIndex const*const 
pSectionNode(pSectFormat->GetContent().GetContentIdx());
-assert(pSectionNode);
-assert(pSectionNode->GetNodes().IsDocNodes());
-rToFill.GetPoint()->Assign( pSectionNode->GetNode(), 
SwNodeOffset(1) );
-rToFill.SetMark();
-rToFill.GetMark()->Assign( 
*pSectionNode->GetNode().EndOfSectionNode(), SwNodeOffset(-1) );
-if (const SwContentNode* pCNd = 
rToFill.GetMark()->GetContentNode())
-rToFill.GetMark()->AssignEndIndex(*pCNd);
-return true;
+if (eMode == ::sw::TextRangeMode::AllowNonTextNode)
+{
+SwNodeIndex const*const 
pSectionNode(pSectFormat->GetContent().GetContentIdx());
+assert(pSectionNode);
+assert(pSectionNode->GetNodes().IsDocNodes());
+rToFill.GetPoint()->Assign( pSectionNode->GetNode(), 
SwNodeOffset(1) );
+rToFill.SetMark();
+rToFill.GetMark()->Assign( 
*pSectionNode->GetNode().EndOfSectionNode(), SwNodeOffset(-1) );
+if (const SwContentNode* pCNd = 
rToFill.GetMark()->GetContentNode())
+rToFill.GetMark()->AssignEndIndex(*pCNd);
+return true;
+}
+else
+{
+SwPaM aPaM(*pSectFormat->GetContent().GetContentIdx());
+aPaM.Move(fnMoveForward, GoInContent);
+assert(aPaM.GetPoint()->GetNode() < 
*pSectFormat->GetContent().GetContentIdx()->GetNode().EndOfSectionNode());
+aPaM.SetMark();
+*aPaM.GetPoint() = 
SwPosition(*pSectFormat->GetContent().GetContentIdx()->GetNode().EndOfSectionNode());
+aPaM.Move(fnMoveBackward, GoInContent);
+assert(*pSectFormat->GetContent().GetContentIdx() < 
aPaM.GetPoint()->GetNode());
+// tdf#149555 if there is no table involved, only nested
+// sections, then PaM is valid
+if (aPaM.GetPoint()->GetNode().FindTableNode()
+== aPaM.GetMark()->GetNode().FindTableNode())
+{
+rToFill = aPaM;
+return true;
+}
+}
 }
 }
 ::sw::mark::IMark const * const pBkmk = m_pImpl->GetBookmark();


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

2023-07-27 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/frmtool.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 55a8eec99f6c709705a50518980c2bcb02cfcfc5
Author: Michael Stahl 
AuthorDate: Tue Jul 18 16:58:34 2023 +0200
Commit: Caolán McNamara 
CommitDate: Thu Jul 27 15:24:55 2023 +0200

tdf#146258 sw: invalidate section frame for new text frame at start

SwFlowFrame::CalcUpperSpace() uses the first text frame inside to
compute the upper margin of section frames.

Before commit 69d2d24b3579ad21fb1ba2746f81a02f8bbfb984 this was
working because a temporary SwTextFrame for the new SwTextNode was
created and then deleted again, but while it was alive the SvULSpace
item was copied and then it invalidated the section frame:

1  SwFrame::InvalidatePrt_()
2  SwContentFrame::Modify()
at libreoffice-6-1/sw/source/core/layout/wsfrm.cxx:2336
3  SwTextFrame::SwClientNotify()
...
7  SwTextNode::Modify()
8  SwContentNode::SetAttr()
9  SwTextNode::SetAttr()
10 SwAttrSet::CopyToModify()
11 SwTextNode::CopyText()
12 SwTextNode::CopyText()
13 SwTextNode::MakeCopy()
14 SwNodes::CopyNodes()
15 sw::DocumentContentOperationsManager::CopyWithFlyInFly()
16 SwIntrnlSectRefLink::DataChanged()

Now however nothing invalidates the section frame, so do it in
InsertCnt_(), hopefully it works for columned sections too.

(regression from commit 166b5010b402a41b192b1659093a25acf9065fd9)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154594
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee)
[commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee used wrong issue id]

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

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 6b1647b5..8beb02663d92 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1605,6 +1605,16 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
 pPageMaker->CheckInsert( nIndex );
 
 pFrame->InsertBehind( pLay, pPrv );
+if (!pPrv)
+{
+if (SwSectionFrame *const pSection = pLay->FindSctFrame())
+{
+if (pSection && pSection->ContainsAny() == pFrame)
+{   // tdf#146258 section PrtArea depends on paragraph 
upper margin
+pSection->InvalidatePrt();
+}
+}
+}
 // #i27138#
 // notify accessibility paragraphs objects about changed
 // CONTENT_FLOWS_FROM/_TO relation.


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

2023-07-27 Thread Michael Stahl (via logerrit)
 sw/source/core/text/widorp.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 7d044e0293357153294d1ca86897ef4088608a82
Author: Michael Stahl 
AuthorDate: Mon Jul 17 21:37:07 2023 +0200
Commit: Caolán McNamara 
CommitDate: Thu Jul 27 15:24:13 2023 +0200

tdf#153319 sw: don't move footnotes to follow if portions in master

SwTextFrameBreak::IsInside() may be called in different situations,
during formatting it should be possible to move the footnotes, but when
called from SwTextFrame::CalcPreps() this is problematic as it does not
format the lines, it iterates over existing lines.

The problem is that the footnote frame is moved to the follow's page,
but the footnote portion remains on the master, and then the follow is
joined while the footnote frame's mpReference still points to it.

(regression from commit 391613785ae6fbb735cf7a86ea2f6a93161a8769)

Change-Id: I4290dcd242a7f5292ad4f50c1407c9cd88e80a6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154557
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7e9b2b71db72b8c4c9c6ca83d08d3b6b05775ac8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154544
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index 8a66e40f8234..720a88a1102a 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -182,6 +182,8 @@ bool SwTextFrameBreak::IsInside( SwTextMargin const  
) const
 }
 }
 if (!bFit && rLine.MaybeHasHints() && m_pFrame->GetFollow()
+// tdf#153319 RemoveFootnote only works if this frame doesn't
+&& !rLine.GetNext() // contain the footnote portion
 // if using same footnote container as the follow, pointless to 
try?
 && m_pFrame->FindFootnoteBossFrame() != 
m_pFrame->GetFollow()->FindFootnoteBossFrame())
 {


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

2023-07-26 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/uiview/viewtab.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 900fb3b9aa1808796ee24ba9795096dec3e85a98
Author: Mike Kaganski 
AuthorDate: Thu Jul 13 17:58:07 2023 +0300
Commit: Caolán McNamara 
CommitDate: Wed Jul 26 14:48:30 2023 +0200

tdf#154035: use correct Which range including the new WIDs

After commit db115bec9254417ef7a3faf687478fe5424ab378 (tdf#78510 sw,cui:
split SvxLRSpaceItem for SwTextNode, SwTextFormatColl, 2023-02-24),
aCoreSet is now querying RES_MARGIN_FIRSTLINE, RES_MARGIN_TEXTLEFT,
RES_MARGIN_RIGHT instead of RES_LR_SPACE. Without the fix, it would
return wrong state, and disable the respective item in the cases of
SID_ATTR_TABSTOP_VERTICAL / RES_PARATR_TABSTOP, which disabled the
ruler.

Change-Id: I8ca4ce586b414cefe2be79ec0226ac7808a231d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154395
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit bfa25258d21430560584e3265cdd4629ee47a1b8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154421
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index d99e27f7fb58..26bfba7b8b18 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1401,8 +1401,9 @@ void SwView::StateTabWin(SfxItemSet& rSet)
 SwapPageMargin( rDesc, aPageLRSpace );
 
 SfxItemSetFixed  aCoreSet( GetPool() );
-// get also the list level indent values merged as LR-SPACE item, if 
needed.
+RES_MARGIN_FIRSTLINE, RES_MARGIN_RIGHT,
+RES_UL_SPACE, RES_UL_SPACE>  aCoreSet( GetPool() );
+// get also the list level indent values, if needed.
 rSh.GetCurAttr( aCoreSet, true );
 const SelectionType nSelType = rSh.GetSelectionType();
 


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

2023-07-26 Thread Khaled Hosny (via logerrit)
 sw/source/core/edit/edfcol.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1889b5f6d69224185b74f435e52f540ab2a7512a
Author: Khaled Hosny 
AuthorDate: Tue Jul 25 17:18:48 2023 +0300
Commit: Michael Stahl 
CommitDate: Wed Jul 26 09:59:50 2023 +0200

tdf#156368: Fix setting watermark font for CJK/CTL text

We were setting only Western font when getting the shape, so if there is
no Western characters in the text the default font would be used. There
is no separate setting for CJK/CTL fonts, so we sets the same font for
all the three.

Change-Id: If2ba2a206f95e0efe9139b9d092b1d6dbf05967c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154894
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit 04cf5feb81c179ef58707ff0e71068208a47a2b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154919
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 1be771b89174..18e0055c9324 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1578,6 +1578,8 @@ static void lcl_placeWatermarkInHeader(const 
SfxWatermarkItem& rWatermark,
 xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, 
uno::Any(text::RelOrientation::PAGE_PRINT_AREA));
 xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, 
uno::Any(text::RelOrientation::PAGE_PRINT_AREA));
 xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::Any(sFont));
+xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME_ASIAN, 
uno::Any(sFont));
+xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME_COMPLEX, 
uno::Any(sFont));
 xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, 
uno::Any(WATERMARK_AUTO_SIZE));
 xPropertySet->setPropertyValue("Transformation", uno::Any(aMatrix));
 


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

2023-07-26 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   17 ++---
 sw/source/core/access/AccessibilityIssue.cxx |2 +-
 sw/source/core/inc/AccessibilityIssue.hxx|2 +-
 3 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit da13bde10eb80c5a0bfb4390d49ea7d0ea5eb05e
Author: Balazs Varga 
AuthorDate: Tue Jul 25 09:21:42 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Jul 26 09:57:15 2023 +0200

tdf#156170 - A11Y - Fix "Avoid endnotes." issue is not hyperlinked

to jump to corresponding anchory.

Change-Id: Id01f66b8d75d85b4618ca30873bf3dc4951b74d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154882
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit fa61fb2b49327de8583505bdadf58067773409bd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154866
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 59aa2fab1380..50dfa55d8f3c 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1311,17 +1311,12 @@ public:
 for (SwTextFootnote* pTextFootnote : pDoc->GetFootnoteIdxs())
 {
 SwFormatFootnote const& rFootnote = pTextFootnote->GetFootnote();
-if (rFootnote.IsEndNote())
-{
-lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_ENDNOTES));
-}
-else
-{
-auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_FOOTNOTES));
-pIssue->setDoc(*pDoc);
-pIssue->setIssueObject(IssueObject::FOOTNOTE);
-pIssue->setTextFootnote(pTextFootnote);
-}
+auto pIssue = lclAddIssue(m_rIssueCollection, rFootnote.IsEndNote()
+  ? 
SwResId(STR_AVOID_ENDNOTES)
+  : 
SwResId(STR_AVOID_FOOTNOTES));
+pIssue->setDoc(*pDoc);
+pIssue->setIssueObject(IssueObject::FOOTENDNOTE);
+pIssue->setTextFootnote(pTextFootnote);
 }
 }
 };
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index a9ddc2b75b62..adc52b0dfea2 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -120,7 +120,7 @@ void AccessibilityIssue::gotoIssue() const
 pWrtShell->ShowCursor();
 }
 break;
-case IssueObject::FOOTNOTE:
+case IssueObject::FOOTENDNOTE:
 {
 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
 if (m_pTextFootnote)
diff --git a/sw/source/core/inc/AccessibilityIssue.hxx 
b/sw/source/core/inc/AccessibilityIssue.hxx
index 608a41ee2e1f..b7f42165853c 100644
--- a/sw/source/core/inc/AccessibilityIssue.hxx
+++ b/sw/source/core/inc/AccessibilityIssue.hxx
@@ -27,7 +27,7 @@ enum class IssueObject
 TABLE,
 TEXT,
 DOCUMENT_TITLE,
-FOOTNOTE,
+FOOTENDNOTE,
 TEXTFRAME,
 };
 


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

2023-07-25 Thread Michael Stahl (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 84079e1b0319519736c9bc6dfe02474509d51add
Author: Michael Stahl 
AuthorDate: Fri Jul 14 14:44:59 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Jul 25 10:15:57 2023 +0200

tdf#156267 sw: remove DdeBookmarks in SwDoc::DelTable()

On Copy, a SwTransferDdeLink is created, which also creates a
DDE_BOOKMARK (it's the only thing that does that) without Undo.

On Delete, the DelTable() creates SwUndoDelete which creates a
SwHistoryBookmark; then the DeleteAndJoin() deletes the DdeBookmark.

On Undo, the SwHistoryBookmark doesn't find its bookmark, and crashes.

Because the DdeBookmark is artificial and deliberately created without
Undo, DelTable() should prevent the SwHistoryBookmark by deleting it
first.

(regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154440
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 4270552395600487f9d680cfdc9cd0ad6f457497)

cid#1538889 Pointer to local outside scope
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154767
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit b6f3b76fb611a5f2c7f32296bc86316b6abb32cb)

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

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 07216640f354..e7080207760d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1917,6 +1917,12 @@ void SwDoc::DeleteCol( const SwCursor& rCursor )
 
 void SwDoc::DelTable(SwTableNode *const pTableNd)
 {
+{
+// tdf#156267 remove DdeBookmarks before deleting nodes
+SwPaM aTmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
+SwDataChanged aTmp(aTmpPaM);
+}
+
 bool bNewTextNd = false;
 // Is it alone in a FlyFrame?
 SwNodeIndex aIdx( *pTableNd, -1 );


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

2023-07-24 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 68708b763391c3f9a80dc1fd26aec828211c7c79
Author: Balazs Varga 
AuthorDate: Thu Jul 20 13:23:54 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 24 15:33:12 2023 +0200

tdf#156140 - A11y fix warnings when using default heading/title styles

No warnings when we use default paragraph styles.

Change-Id: Idbbd542a33c23ff38f691098bf0ceba610efad84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154673
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit aba88061e5091e932418b5b03c7d189a28a8256d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154702
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index b235ce19eb2d..59aa2fab1380 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -666,17 +666,20 @@ public:
 auto nParagraphLength = pTextNode->GetText().getLength();
 if (nParagraphLength == 0)
 return;
-if (aSwAttrSet.HasItem(RES_CHRATR_WEIGHT) || 
aSwAttrSet.HasItem(RES_CHRATR_CJK_WEIGHT)
-|| aSwAttrSet.HasItem(RES_CHRATR_CTL_WEIGHT)
-|| aSwAttrSet.HasItem(RES_CHRATR_POSTURE)
-|| aSwAttrSet.HasItem(RES_CHRATR_CJK_POSTURE)
-|| aSwAttrSet.HasItem(RES_CHRATR_CTL_POSTURE)
-|| aSwAttrSet.HasItem(RES_CHRATR_SHADOWED) || 
aSwAttrSet.HasItem(RES_CHRATR_COLOR)
-|| aSwAttrSet.HasItem(RES_CHRATR_EMPHASIS_MARK)
-|| aSwAttrSet.HasItem(RES_CHRATR_UNDERLINE)
-|| aSwAttrSet.HasItem(RES_CHRATR_OVERLINE)
-|| aSwAttrSet.HasItem(RES_CHRATR_CROSSEDOUT)
-|| aSwAttrSet.HasItem(RES_CHRATR_RELIEF) || 
aSwAttrSet.HasItem(RES_CHRATR_CONTOUR))
+if (aSwAttrSet.GetItem(RES_CHRATR_WEIGHT, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CJK_WEIGHT, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CTL_WEIGHT, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_POSTURE, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CJK_POSTURE, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CTL_POSTURE, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_SHADOWED, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_COLOR, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_EMPHASIS_MARK, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_UNDERLINE, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_OVERLINE, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CROSSEDOUT, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_RELIEF, false)
+|| aSwAttrSet.GetItem(RES_CHRATR_CONTOUR, false))
 {
 auto pIssue
 = lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING),


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

2023-07-19 Thread László Németh (via logerrit)
 sw/source/core/layout/paintfrm.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0eb44f8c6ad764d8c2d044603f8f2aa84e3c7892
Author: László Németh 
AuthorDate: Tue Jul 18 16:41:52 2023 +0200
Commit: László Németh 
CommitDate: Thu Jul 20 00:31:37 2023 +0200

tdf#150308 sw: fix missing top table border after hidden table rows

First visible line of a table with preceding hidden deleted rows
hid also the top border of the table, if the inner horizontal row
borders drawn only by bottom-only borders (like in the default table
style).

Note: re-use an existing workaround to show the missing line,
see commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628
"fdo#39415: sw: fix collapsing border painting more:"

Note: layout testing doesn't work, because of the missing calculation
with the width of the enabled border of the row frame. Also there is
a problem with metafile testing (empty meta file?).

Change-Id: Ia8476a2ec592be1dc36e0ea71c10a71c257c29e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154595
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 379acb934164e673b708d0f3ec6b3ec046c8d73f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154612
Tested-by: László Németh 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 47e56b390712..0a43dbb587ab 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2804,6 +2804,8 @@ void SwTabFramePainter::FindStylesForLine( Point& 
rStartPoint,
 /**
  * Special case: #i9860#
  * first line in follow table without repeated headlines
+ * Special case: tdf#150308
+ * first visible line of a table with preceding hidden deleted rows
  */
 static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 SwTabFrame const& rTabFrame, SwFrame const& rFrame, SvxBoxItem const& 
rBoxItem)
@@ -2812,7 +2814,11 @@ static bool 
lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
 dynamic_cast(rFrame.GetUpper());
 return (pThisRowFrame
 && (pThisRowFrame->GetUpper() == )
-&& rTabFrame.IsFollow()
+&& ( rTabFrame.IsFollow()
+// tdf#150308 first table row isn't equal to the table row of the 
first
+// row frame of the first table frame: there are invisible deleted 
rows
+// in Hide Changes mode before the first visible table row
+|| rTabFrame.GetTable()->GetTabLines().front() != 
pThisRowFrame->GetTabLine() )
 && !rTabFrame.GetTable()->GetRowsToRepeat()
 &&  (  !pThisRowFrame->GetPrev()
 || static_cast(pThisRowFrame->GetPrev())


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

2023-07-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/crsr/crstrvl.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 27c57627fcd28a8f533b535b37ec6376f1505e6f
Author: Bjoern Michaelsen 
AuthorDate: Fri Jul 14 01:03:56 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 18:35:46 2023 +0200

tdf#153866: Fix TOX crash

Im not sure why it should be valid that the ContentFrame should ever be
nullptr here, but a simple check prevents the immediate crash.

Change-Id: I19a2d04e41271ae6a5b6a3a79c31c3efd5db7875
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154404
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d86a6d2b47c6a22d185dc631388ca3f2c0386a35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154416

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index d5e430bb8711..3face1677c13 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -368,6 +368,8 @@ void SwCursorShell::GotoTOXMarkBase()
 // Take the 1. and get the index type. Ask it for the actual index.
 const SwTOXType* pType = aMarks[0]->GetTOXType();
 auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout());
+if(!pContentFrame)
+return;
 SwCallLink aLk(*this); // watch Cursor-Moves
 SwCursorSaveState aSaveState(*m_pCurrentCursor);
 assert(pContentFrame->IsTextFrame());


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

2023-07-10 Thread Michael Weghorn (via logerrit)
 sw/source/core/access/textmarkuphelper.cxx |   33 ++---
 1 file changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 7cffdc43f100fa7fad2797c13e10d7a23fdad53b
Author: Michael Weghorn 
AuthorDate: Thu Jul 6 13:37:30 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue Jul 11 07:02:21 2023 +0200

tdf#155705 sw a11y: Only handle paragraph's own spell check data

When a paragraph is split across multiple pages, there
are multiple accessible paragraphs on the
accessibility layer, but there's still just a single text
node in the underlying Writer core model.

The `sw::WrongListIteratorCounter` used in
`SwTextMarkupHelper` is for the whole text node, i.e.
iterates over the spell check data from other pages
(i.e. other accessible paragraphs) as well in that case.
This caused invalid indices to be used when calculating the
index within the current accessible paragraph again when
iterating over all elements, causing a crash.

Fix this by filtering out the elements that are outside
of the accessible paragraph when handling markup information.

Change-Id: If76cc60cc9ff5614d0bcbaff196ac34ec908936e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154109
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 7f7ccf955fa1138b712233628de4a73b3f845c7e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154206
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/textmarkuphelper.cxx 
b/sw/source/core/access/textmarkuphelper.cxx
index 34be72fff584..ae221f499831 100644
--- a/sw/source/core/access/textmarkuphelper.cxx
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -113,8 +113,15 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const 
sal_Int32 nTextMarkupTyp
 sal_Int32 nTextMarkupCount( 0 );
 
 std::unique_ptr pIter = 
getIterator(nTextMarkupType);
-if (pIter)
-nTextMarkupCount = pIter->GetElementCount();
+// iterator may handle all items in the underlying text node in the model, 
which may be more
+// than what is in the portion data (e.g. if a paragraph is split across 
multiple pages),
+// only take into account those that are in the portion data
+for (sal_uInt16 i = 0; i < pIter->GetElementCount(); i++)
+{
+std::optional> oIndices = 
pIter->GetElementAt(i);
+if (oIndices && mrPortionData.IsValidCorePosition(oIndices->first) && 
mrPortionData.IsValidCorePosition(oIndices->second))
+nTextMarkupCount++;
+}
 
 return nTextMarkupCount;
 }
@@ -136,7 +143,27 @@ css::accessibility::TextSegment
 std::unique_ptr pIter = 
getIterator(nTextMarkupType);
 if (pIter)
 {
-auto const oElement(pIter->GetElementAt(nTextMarkupIndex));
+std::optional> oElement;
+const sal_uInt16 nIterElementCount = pIter->GetElementCount();
+sal_Int32 nIndexInPortion = 0;
+sal_uInt16 nIterIndex = 0;
+while (!oElement && nIterIndex < nIterElementCount)
+{
+// iterator may handle all items in the underlying text node in 
the model, which may be more
+// than what is in the portion data (e.g. if a paragraph is split 
across multiple pages),
+// only take into account those that are in the portion data
+std::optional> oIndices 
= pIter->GetElementAt(nIterIndex);
+if (oIndices && mrPortionData.IsValidCorePosition(oIndices->first) 
&& mrPortionData.IsValidCorePosition(oIndices->second))
+{
+if (nIndexInPortion == nTextMarkupIndex)
+oElement = oIndices;
+
+nIndexInPortion++;
+}
+
+nIterIndex++;
+}
+
 if (oElement)
 {
 const OUString& rText = mrPortionData.GetAccessibleString();


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

2023-07-10 Thread Michael Weghorn (via logerrit)
 sw/source/core/access/textmarkuphelper.cxx |   55 ++---
 sw/source/core/access/textmarkuphelper.hxx |6 +++
 2 files changed, 25 insertions(+), 36 deletions(-)

New commits:
commit dccd32607d2d10a24e0214c01c74ed6dcf8746fb
Author: Michael Weghorn 
AuthorDate: Thu Jul 6 10:27:37 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 10 11:46:57 2023 +0200

tdf#155705 sw a11y: Unify iterator use in SwTextMarkupHelper

Introduce a new helper method `SwTextMarkupHelper::getIterator`
to get a `sw::WrongListIteratorCounter` and use that to deduplicate
and unify handling in three methods.

Change-Id: I81790c547f70f0649ce800bc481db70982dfa742
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154108
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 472950414a0fb07d5260b7b6b2d3a5d2dc18a68d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154180
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/textmarkuphelper.cxx 
b/sw/source/core/access/textmarkuphelper.cxx
index 5329241c6f1b..34be72fff584 100644
--- a/sw/source/core/access/textmarkuphelper.cxx
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -86,13 +86,13 @@ SwTextMarkupHelper::SwTextMarkupHelper( const 
SwAccessiblePortionData& rPortionD
 {
 }
 
-sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 
nTextMarkupType )
-{
-sal_Int32 nTextMarkupCount( 0 );
 
+std::unique_ptr 
SwTextMarkupHelper::getIterator(sal_Int32 nTextMarkupType)
+{
+std::unique_ptr pIter;
 if (mpTextMarkupList)
 {
-nTextMarkupCount = mpTextMarkupList->Count();
+pIter.reset(new sw::WrongListIteratorCounter(*mpTextMarkupList));
 }
 else
 {
@@ -100,11 +100,22 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const 
sal_Int32 nTextMarkupTyp
 SwWrongList const* (SwTextNode::*const pGetWrongList)() const = 
getTextMarkupFunc(nTextMarkupType);
 if (pGetWrongList)
 {
-sw::WrongListIteratorCounter iter(*m_pTextFrame, pGetWrongList);
-nTextMarkupCount = iter.GetElementCount();
+pIter.reset(new sw::WrongListIteratorCounter(*m_pTextFrame, 
pGetWrongList));
 }
 }
 
+return pIter;
+}
+
+
+sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 
nTextMarkupType )
+{
+sal_Int32 nTextMarkupCount( 0 );
+
+std::unique_ptr pIter = 
getIterator(nTextMarkupType);
+if (pIter)
+nTextMarkupCount = pIter->GetElementCount();
+
 return nTextMarkupCount;
 }
 
@@ -122,21 +133,7 @@ css::accessibility::TextSegment
 aTextMarkupSegment.SegmentStart = -1;
 aTextMarkupSegment.SegmentEnd = -1;
 
-std::unique_ptr pIter;
-if (mpTextMarkupList)
-{
-pIter.reset(new sw::WrongListIteratorCounter(*mpTextMarkupList));
-}
-else
-{
-assert(m_pTextFrame);
-SwWrongList const* (SwTextNode::*const pGetWrongList)() const = 
getTextMarkupFunc(nTextMarkupType);
-if (pGetWrongList)
-{
-pIter.reset(new sw::WrongListIteratorCounter(*m_pTextFrame, 
pGetWrongList));
-}
-}
-
+std::unique_ptr pIter = 
getIterator(nTextMarkupType);
 if (pIter)
 {
 auto const oElement(pIter->GetElementAt(nTextMarkupIndex));
@@ -175,21 +172,7 @@ css::uno::Sequence< css::accessibility::TextSegment >
 return uno::Sequence< css::accessibility::TextSegment >();
 }
 
-std::unique_ptr pIter;
-if (mpTextMarkupList)
-{
-pIter.reset(new sw::WrongListIteratorCounter(*mpTextMarkupList));
-}
-else
-{
-assert(m_pTextFrame);
-SwWrongList const* (SwTextNode::*const pGetWrongList)() const = 
getTextMarkupFunc(nTextMarkupType);
-if (pGetWrongList)
-{
-pIter.reset(new sw::WrongListIteratorCounter(*m_pTextFrame, 
pGetWrongList));
-}
-}
-
+std::unique_ptr pIter = 
getIterator(nTextMarkupType);
 std::vector< css::accessibility::TextSegment > aTmpTextMarkups;
 if (pIter)
 {
diff --git a/sw/source/core/access/textmarkuphelper.hxx 
b/sw/source/core/access/textmarkuphelper.hxx
index 6db3f9bc0e34..daccc0eef4ad 100644
--- a/sw/source/core/access/textmarkuphelper.hxx
+++ b/sw/source/core/access/textmarkuphelper.hxx
@@ -30,6 +30,10 @@ class SwAccessiblePortionData;
 class SwTextFrame;
 class SwWrongList; // #i108125#
 
+namespace sw {
+class WrongListIteratorCounter;
+}
+
 class SwTextMarkupHelper
 {
 public:
@@ -60,6 +64,8 @@ class SwTextMarkupHelper
 SwTextMarkupHelper( const SwTextMarkupHelper& ) = delete;
 SwTextMarkupHelper& operator=( const SwTextMarkupHelper& ) = delete;
 
+std::unique_ptr getIterator(sal_Int32 
nTextMarkupType);
+
 const SwAccessiblePortionData& mrPortionData;
 
 SwTextFrame const* m_pTextFrame;


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

2023-07-10 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   17 +++--
 sw/source/core/access/AccessibilityIssue.cxx |1 +
 sw/source/core/inc/AccessibilityIssue.hxx|1 +
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 5a0898d68abac5883e9f431823f5c5fc4c823d23
Author: Balazs Varga 
AuthorDate: Thu Jul 6 13:44:10 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jul 10 09:33:48 2023 +0200

tdf#156135 - Add "Go to" action for "Avoid floating text" issue type

Change-Id: Ie98f291141f38ac5544c9e51a209fb9bf1f26d1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154107
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit b15697c8d5f395bb368e7d96998f2c0b0662b0de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154187

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 8daf85b5276f..165c3b410b95 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1125,7 +1125,13 @@ public:
 const SwNode* startFly = pCurrent->FindFlyStartNode();
 if (startFly
 && startFly->GetFlyFormat()->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
-lclAddIssue(m_rIssueCollection, SwResId(STR_FLOATING_TEXT));
+{
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_FLOATING_TEXT));
+pIssue->setIssueObject(IssueObject::TEXTFRAME);
+pIssue->setObjectID(startFly->GetFlyFormat()->GetName());
+pIssue->setDoc(pCurrent->GetDoc());
+pIssue->setNode(pCurrent);
+}
 }
 };
 
@@ -1372,7 +1378,14 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, 
SdrObject* pObject)
 // (Floating objects with text create problems with reading order)
 if (pObject->HasText()
 && FindFrameFormat(pObject)->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
-lclAddIssue(m_aIssueCollection, SwResId(STR_FLOATING_TEXT));
+{
+auto pIssue = lclAddIssue(m_aIssueCollection, 
SwResId(STR_FLOATING_TEXT));
+pIssue->setIssueObject(IssueObject::TEXTFRAME);
+pIssue->setObjectID(pObject->GetName());
+pIssue->setDoc(*m_pDoc);
+if (pCurrent)
+pIssue->setNode(pCurrent);
+}
 
 const SdrObjKind nObjId = pObject->GetObjIdentifier();
 const SdrInventor nInv = pObject->GetObjInventor();
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index ebda9a25083b..a9ddc2b75b62 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -60,6 +60,7 @@ void AccessibilityIssue::gotoIssue() const
 {
 case IssueObject::GRAPHIC:
 case IssueObject::OLE:
+case IssueObject::TEXTFRAME:
 {
 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
 bool bSelected = pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, 
true);
diff --git a/sw/source/core/inc/AccessibilityIssue.hxx 
b/sw/source/core/inc/AccessibilityIssue.hxx
index 5a6d3e772333..608a41ee2e1f 100644
--- a/sw/source/core/inc/AccessibilityIssue.hxx
+++ b/sw/source/core/inc/AccessibilityIssue.hxx
@@ -28,6 +28,7 @@ enum class IssueObject
 TEXT,
 DOCUMENT_TITLE,
 FOOTNOTE,
+TEXTFRAME,
 };
 
 class SW_DLLPUBLIC AccessibilityIssue final : public sfx::AccessibilityIssue


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

2023-07-07 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5ba701935923f27b4155d61ce17fbe1af176613e
Author: Balazs Varga 
AuthorDate: Wed Jul 5 21:38:08 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 7 11:22:26 2023 +0200

tdf#156136 - Add "Go to" action for "Text contrast too low" issue type

Change-Id: Icce3b56877679ca40a52a2c5f4b8f70f14268fac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154078
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 0cc7998194e7467182175643469fb0365b728752)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154117
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 26f6b91328bd..8daf85b5276f 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -424,6 +424,9 @@ private:
 uno::Reference const& xParagraph, 
SwTextNode* pTextNode,
 sal_Int32 nTextStart)
 {
+if (xTextRange->getString().isEmpty())
+return;
+
 Color nParaBackColor(COL_AUTO);
 uno::Reference xParagraphProperties(xParagraph, 
uno::UNO_QUERY);
 if (!(xParagraphProperties->getPropertyValue("ParaBackColor") >>= 
nParaBackColor))
@@ -475,7 +478,7 @@ private:
 // If not character background color, try paragraph background color
 if (aBackgroundColor == COL_AUTO)
 aBackgroundColor = nParaBackColor;
-else if (!xTextRange->getString().isEmpty())
+else
 {
 auto pIssue
 = lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING),
@@ -503,7 +506,12 @@ private:
 double fContrastRatio = calculateContrastRatio(aForegroundColor, 
aBackgroundColor);
 if (fContrastRatio < 4.5)
 {
-lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_CONTRAST));
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_CONTRAST));
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+pIssue->setDoc(pTextNode->GetDoc());
+pIssue->setStart(nTextStart);
+pIssue->setEnd(nTextStart + xTextRange->getString().getLength());
 }
 }
 


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

2023-07-06 Thread Xisco Fauli (via logerrit)
 sw/source/core/txtnode/ndtxt.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 98a5dd8ce4ea0fed7fec046d7003bdb0af51e379
Author: Xisco Fauli 
AuthorDate: Tue Jul 4 17:56:05 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 6 15:29:05 2023 +0200

sw: fix crash in SwTextNode::Update

FindPageFrame might return nullptr
Introduced with c684301352bcca709bc8d1c99e0f08e7096e9716
"(related: tdf#149595) sw: also re-sort SwSortedObjs on SwPageFrame"
See 
https://crashreport.libreoffice.org/stats/signature/SwTextNode::Update(SwContentIndex%20const%20&,long,SwContentIndexReg::UpdateMode)

Change-Id: I2e8df1428400f6752eafaaa6102a1fc3de3f0daa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153977
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit a62af0444515ab28bc0ffdc8ff7f320ca962bbc0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154111
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index f46fbdc69c77..8eea1b74f11e 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1603,7 +1603,9 @@ void SwTextNode::Update(
 pSortedObjs->UpdateAll();
 }
 // also sort the objs on the page frame
-pSortedObjs = pFrame->FindPageFrame()->GetSortedObjs();
+if (SwPageFrame *pPage = pFrame->FindPageFrame())
+pSortedObjs = pPage->GetSortedObjs();
+
 if (pSortedObjs) // doesn't exist yet if called for inserting as-char 
fly
 {
 pSortedObjs->UpdateAll();


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

2023-07-06 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit ef9be5b1947d4900a83ac1bb87bd21a7133cae2f
Author: Balazs Varga 
AuthorDate: Wed Jul 5 20:29:50 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jul 6 11:16:17 2023 +0200

tdf#156134 - Add "Go to" action for "Simulated numbering" issue type

Change-Id: I92f7ae620eb0fd540c8919a4bbb9cae1d375a391
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154071
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit a6e12924d299f83efd4ac11c36784775fe9e1d77)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154049

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 450f657e13e6..26f6b91328bd 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -306,8 +306,11 @@ public:
 OUString sNumbering = rPair.first + " " + rPair.second + "...";
 OUString sIssueText
 = SwResId(STR_FAKE_NUMBERING).replaceAll("%NUMBERING%", 
sNumbering);
-lclAddIssue(m_rIssueCollection, sIssueText,
-sfx::AccessibilityIssueID::MANUAL_NUMBERING);
+auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
+  
sfx::AccessibilityIssueID::MANUAL_NUMBERING);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setDoc(pCurrent->GetDoc());
+pIssue->setNode(pCurrent);
 }
 }
 }


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

2023-07-05 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/config/usrpref.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 04e969822ef93e9afbcb4953182f439b9c16c6fd
Author: Mike Kaganski 
AuthorDate: Wed Jul 5 15:30:30 2023 +0300
Commit: Caolán McNamara 
CommitDate: Wed Jul 5 22:56:54 2023 +0200

tdf#155462: Re-enable ShowScrollBarTips expert config

... accidentally broken by commit 4ed26badfd6fd9190cb6e54078b41eb38cb37dca.

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

diff --git a/sw/source/uibase/config/usrpref.cxx 
b/sw/source/uibase/config/usrpref.cxx
index 181b863e130c..c04d775c3ac3 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -392,7 +392,7 @@ void SwLayoutViewConfig::Load()
 case 16: m_rParent.SetViewLayoutBookMode(bSet); break;// 
"ViewLayout/BookMode",
 case 17: m_rParent.SetDefaultPageMode(bSet,true); break;// 
"Other/IsSquaredPageMode",
 case 18: m_rParent.SetApplyCharUnit(bSet, true); break;// 
"Other/ApplyUserChar"
-case 29: m_rParent.SetShowScrollBarTips(bSet); break;// 
"Window/ShowScrollBarTips",
+case 19: m_rParent.SetShowScrollBarTips(bSet); break;// 
"Window/ShowScrollBarTips",
 }
 }
 }


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

2023-07-05 Thread Xisco Fauli (via logerrit)
 sw/source/core/unocore/unoobj2.cxx |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 042964e60a49d6959a6eb93fb9397e8b5ff9da56
Author: Xisco Fauli 
AuthorDate: Tue Jul 4 15:53:39 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 5 09:04:11 2023 +0200

sw: fix crash in CreateParentXText

See 
https://crashreport.libreoffice.org/stats/signature/SfxObjectShell::GetBaseModel()

Change-Id: Idcfc8219b5765bca9c45819bde5f276ce68c45de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153971
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit a0669a1a4963b2611fb372c8394ea4530d2c9e96)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154002

diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index 210e62655a15..1b02cb5a0b27 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1307,12 +1307,14 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
 break;
 default:
 {
-// then it is the body text
-const uno::Reference xModel =
-rDoc.GetDocShell()->GetBaseModel();
-const uno::Reference< text::XTextDocument > xDoc(
-xModel, uno::UNO_QUERY);
-xParentText = xDoc->getText();
+if (SwDocShell *const pDocSh = rDoc.GetDocShell())
+{
+// then it is the body text
+const uno::Reference xModel = 
pDocSh->GetBaseModel();
+const uno::Reference< text::XTextDocument > xDoc(
+xModel, uno::UNO_QUERY);
+xParentText = xDoc->getText();
+}
 }
 }
 OSL_ENSURE(xParentText.is(), "no parent text?");


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

2023-07-04 Thread Michael Stahl (via logerrit)
 sw/source/core/unocore/unostyle.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 0efacb9f484962d4b3be207ed3ebb8935779444c
Author: Michael Stahl 
AuthorDate: Tue Jul 4 14:54:47 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 4 20:01:00 2023 +0200

tdf#156155 sw: export draw:fill to top-level ODF graphic styles

The default for XATTR_FILLSTYLE for Writer flys differs from the default
in the item pool, which is intended for svx shapes/SdrObjects.

This is implemented with an intermediate mpDfltFrameFormat but it needs
some special handling so the attribute ends up in the styles.xml.

Change-Id: I8f369809a9f3b7e85a8bc7ad5d309dbc3cd6ccfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153970
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9410a22cdbe7c977206456218c75683a305ef79e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153993

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 0f0faa227351..bb78c16244bc 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2536,6 +2536,21 @@ uno::Sequence 
SwXStyle::getPropertyStates(const uno::Seque
 }
 }
 break;
+case XATTR_FILLSTYLE:
+{
+if (m_rEntry.family() == SfxStyleFamily::Frame
+&& xStyle->GetFrameFormat()->DerivedFrom() == 
GetDoc()->GetDfltFrameFormat())
+{   // tdf#156155 mpDfltFrameFormat is the parent, but because
+// it IsDefault() it is not enumerated/exported as a style
+// to ODF, so export its one important value here.
+pStates[i] = beans::PropertyState_DIRECT_VALUE;
+}
+else
+{
+pStates[i] = pPropSet->getPropertyState(*pEntry, 
*pSourceSet);
+}
+}
+break;
 case RES_BACKGROUND:
 {
 // for FlyFrames we need to mark the used properties from type 
RES_BACKGROUND


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

2023-07-03 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityIssue.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit aa553e6906d2f5ac99d30395e0d02ca7d861a0b7
Author: Balazs Varga 
AuthorDate: Thu Jun 29 12:47:25 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jul 3 12:40:12 2023 +0200

tdf#156096 - A11Y - Fix moving the cursor from selected frame object

after we 'GOTO' an a11y frame issue.

Change-Id: Ia828b2ac72edfc2045090d22ccdf3f95d1877170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153742
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit a6fc2f6c9a3dcfab2fce365c3e424c1b68f6fadd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153847

diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index feac634f32a6..ebda9a25083b 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -62,7 +62,12 @@ void AccessibilityIssue::gotoIssue() const
 case IssueObject::OLE:
 {
 SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
-pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, true);
+bool bSelected = pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, 
true);
+if (bSelected && pWrtShell->IsFrameSelected())
+{
+pWrtShell->HideCursor();
+pWrtShell->EnterSelFrameMode();
+}
 if (comphelper::LibreOfficeKit::isActive())
 pWrtShell->ShowCursor();
 }


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

2023-07-03 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |7 +--
 sw/source/core/access/AccessibilityIssue.cxx |   10 ++
 sw/source/core/inc/AccessibilityIssue.hxx|5 +
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit a8d357a31055dad9db0311b891687bec1b47f8c9
Author: Balazs Varga 
AuthorDate: Fri Jun 30 12:51:45 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jul 3 09:50:09 2023 +0200

tdf#156094 - Add "Go to" button to "Avoid footnotes" issues

And the button points to the footnote anchor point in the text content.

Change-Id: I3193714a69a432094cd194a60223b255a6c8f24d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153805
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 81804d81804dc5d646236605d824b28383a947b1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153848

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 45dd076e99ce..450f657e13e6 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1280,7 +1280,7 @@ public:
 
 void check(SwDoc* pDoc) override
 {
-for (SwTextFootnote const* pTextFootnote : pDoc->GetFootnoteIdxs())
+for (SwTextFootnote* pTextFootnote : pDoc->GetFootnoteIdxs())
 {
 SwFormatFootnote const& rFootnote = pTextFootnote->GetFootnote();
 if (rFootnote.IsEndNote())
@@ -1289,7 +1289,10 @@ public:
 }
 else
 {
-lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_FOOTNOTES));
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_FOOTNOTES));
+pIssue->setDoc(*pDoc);
+pIssue->setIssueObject(IssueObject::FOOTNOTE);
+pIssue->setTextFootnote(pTextFootnote);
 }
 }
 }
diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index c7332f919cf5..feac634f32a6 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -31,6 +31,7 @@ 
AccessibilityIssue::AccessibilityIssue(sfx::AccessibilityIssueID eIssueID)
 , m_eIssueObject(IssueObject::UNKNOWN)
 , m_pDoc(nullptr)
 , m_pNode(nullptr)
+, m_pTextFootnote(nullptr)
 , m_nStart(0)
 , m_nEnd(0)
 {
@@ -113,6 +114,15 @@ void AccessibilityIssue::gotoIssue() const
 pWrtShell->ShowCursor();
 }
 break;
+case IssueObject::FOOTNOTE:
+{
+SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell();
+if (m_pTextFootnote)
+pWrtShell->GotoFootnoteAnchor(*m_pTextFootnote);
+if (comphelper::LibreOfficeKit::isActive())
+pWrtShell->ShowCursor();
+}
+break;
 default:
 break;
 }
diff --git a/sw/source/core/inc/AccessibilityIssue.hxx 
b/sw/source/core/inc/AccessibilityIssue.hxx
index f38457acf0b6..5a6d3e772333 100644
--- a/sw/source/core/inc/AccessibilityIssue.hxx
+++ b/sw/source/core/inc/AccessibilityIssue.hxx
@@ -13,6 +13,7 @@
 
 #include 
 #include 
+#include 
 
 namespace sw
 {
@@ -26,6 +27,7 @@ enum class IssueObject
 TABLE,
 TEXT,
 DOCUMENT_TITLE,
+FOOTNOTE,
 };
 
 class SW_DLLPUBLIC AccessibilityIssue final : public sfx::AccessibilityIssue
@@ -36,6 +38,7 @@ private:
 OUString m_sObjectID;
 std::vector m_aIssueAdditionalInfo;
 SwNode* m_pNode;
+SwTextFootnote* m_pTextFootnote;
 
 sal_Int32 m_nStart;
 sal_Int32 m_nEnd;
@@ -47,6 +50,7 @@ public:
 void setDoc(SwDoc& rDoc);
 void setObjectID(OUString const& rID);
 void setNode(SwNode* pNode) { m_pNode = pNode; }
+void setTextFootnote(SwTextFootnote* pTextFootnote) { m_pTextFootnote = 
pTextFootnote; }
 
 void setStart(sal_Int32 nStart) { m_nStart = nStart; }
 
@@ -68,6 +72,7 @@ public:
 sal_Int32 getStart() { return m_nStart; }
 sal_Int32 getEnd() { return m_nEnd; }
 SwNode* getNode() { return m_pNode; }
+SwTextFootnote* getTextFootnote() { return m_pTextFootnote; }
 };
 
 } // end sw namespace


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

2023-06-29 Thread Balazs Varga (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |   39 +-
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |1 
 2 files changed, 32 insertions(+), 8 deletions(-)

New commits:
commit a2389bcd630b8c011e3dc236a33c7d2de43fd2be
Author: Balazs Varga 
AuthorDate: Wed Jun 28 19:44:54 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 29 14:18:28 2023 +0200

tdf#156032 - A11Y: fix remove of empty issue sections

Remove issue categories if there is no more issue in it.

Change-Id: Ic5dddf3db59c574d1e8712d79bdf203a6b637eb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153724
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins
(cherry picked from commit 3b250bcd95f6be183b2694c57512eba9b1a0ca67)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153708

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 123ce7e1fa57..162724a1035c 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -159,31 +159,54 @@ void A11yCheckIssuesPanel::ImplDestroy()
 
 A11yCheckIssuesPanel::~A11yCheckIssuesPanel() { 
suppress_fun_call_w_exception(ImplDestroy()); }
 
-void A11yCheckIssuesPanel::populateIssues()
+void A11yCheckIssuesPanel::removeOldWidgets()
 {
-if (!mpDoc)
-return;
-sw::AccessibilityCheck aCheck(mpDoc);
-aCheck.check();
-m_aIssueCollection = aCheck.getIssueCollection();
-
-// Remove old issue widgets
 for (auto const& xEntry : m_aDocumentEntries)
 m_xBoxDocument->move(xEntry->get_widget(), nullptr);
+m_xExpanderDocument->set_visible(false);
+
 for (auto const& xEntry : m_aStylesEntries)
 m_xBoxStyles->move(xEntry->get_widget(), nullptr);
+m_xExpanderStyles->set_visible(false);
+
 for (auto const& xEntry : m_aNoAltEntries)
 m_xBoxNoAlt->move(xEntry->get_widget(), nullptr);
+m_xExpanderNoAlt->set_visible(false);
+
 for (auto const& xEntry : m_aTableEntries)
 m_xBoxTable->move(xEntry->get_widget(), nullptr);
+m_xExpanderTable->set_visible(false);
+
 for (auto const& xEntry : m_aFormattingEntries)
 m_xBoxFormatting->move(xEntry->get_widget(), nullptr);
+m_xExpanderFormatting->set_visible(false);
+
 for (auto const& xEntry : m_aHyperlinkEntries)
 m_xBoxHyperlink->move(xEntry->get_widget(), nullptr);
+m_xExpanderHyperlink->set_visible(false);
+
 for (auto const& xEntry : m_aFakesEntries)
 m_xBoxFakes->move(xEntry->get_widget(), nullptr);
+m_xExpanderFakes->set_visible(false);
+
 for (auto const& xEntry : m_aNumberingEntries)
 m_xBoxNumbering->move(xEntry->get_widget(), nullptr);
+m_xExpanderNumbering->set_visible(false);
+
+for (auto const& xEntry : m_aOtherEntries)
+m_xBoxOther->move(xEntry->get_widget(), nullptr);
+m_xExpanderOther->set_visible(false);
+}
+
+void A11yCheckIssuesPanel::populateIssues()
+{
+if (!mpDoc)
+return;
+sw::AccessibilityCheck aCheck(mpDoc);
+aCheck.check();
+m_aIssueCollection = aCheck.getIssueCollection();
+
+removeOldWidgets();
 
 sal_Int32 iDocument = 0;
 sal_Int32 iStyles = 0;
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
index d48f4cae2906..54e5ad560bdf 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
@@ -89,6 +89,7 @@ private:
 std::unique_ptr m_xBoxOther;
 sfx::AccessibilityIssueCollection m_aIssueCollection;
 std::function m_getIssueCollection;
+void removeOldWidgets();
 void populateIssues();
 
 SfxBindings* mpBindings;


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

2023-06-29 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityIssue.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 97ff86d26d4eb47f43e174c94f06dee37bc8a4b7
Author: Balazs Varga 
AuthorDate: Tue Jun 27 13:35:14 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 29 12:56:35 2023 +0200

tdf#156023 - A11Y: Add visual hints when fixing an accessibility check issue

Go to the issue object and select it, before fixing the issue.

Change-Id: I0217922c91045c288df7e48965be259e4d4f7ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153642
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 4a08c79919efffd40c765c41bc06322a2ea83c59)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153701

diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index d0366b1ef3e2..c7332f919cf5 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -131,6 +131,9 @@ void AccessibilityIssue::quickFixIssue() const
 if (!m_pDoc)
 return;
 
+if (m_eIssueObject != IssueObject::UNKNOWN)
+gotoIssue();
+
 switch (m_eIssueObject)
 {
 case IssueObject::GRAPHIC:


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

2023-06-29 Thread Balazs Varga (via logerrit)
 sw/source/uibase/uiview/view2.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 4d4238c92b1155fa425d48637fa290a1d2eb
Author: Balazs Varga 
AuthorDate: Wed Jun 28 18:27:48 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 29 11:54:01 2023 +0200

tdf#156031 - UX/A11Y: Clicking on a11y check status bar icon opening a11y

check sidebar deck.

Clicing on the a11y check status bar icon, the a11y check sidebar
deck will be opened.

Change-Id: Iee2e0e9345ed47dd971a9a61e55471d082d5461d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153723
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit cec1aa29b5a2e11d162bda8f3a4faea4f75e4a23)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153702

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index ed0982f037dc..f7cfb6563803 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2188,6 +2188,14 @@ void SwView::ExecuteStatusLine(SfxRequest )
 }
 break;
 
+case FN_STAT_ACCESSIBILITY_CHECK:
+{
+const SfxStringItem sDeckName(SID_SIDEBAR_DECK, "A11yCheckDeck");
+GetViewFrame().GetDispatcher()->ExecuteList(SID_SIDEBAR_DECK, 
SfxCallMode::RECORD,
+{  });
+}
+break;
+
 case FN_STAT_BOOKMARK:
 if ( pArgs )
 {


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

2023-06-29 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 18d650a29e93fdb868b1bd6d8cd768c42659fd61
Author: Balazs Varga 
AuthorDate: Wed Jun 7 15:41:23 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 29 11:48:47 2023 +0200

tdf#154981 - A11Y sidebar: fix warning missing signature line desc

Add graphic shape objects to "Go to" and "Fix" functions.

Change-Id: I258d3664613cbd53b7b26aaa8d88715660d921dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152707
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit b3594e01ec6d0156277f354efe5cacc04b33c4b6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153704

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index b9eeaafc6171..45dd076e99ce 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1365,7 +1365,7 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, 
SdrObject* pObject)
 
 if (nObjId == SdrObjKind::CustomShape || nObjId == SdrObjKind::Text
 || nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group
-|| nInv == SdrInventor::FmForm)
+|| nObjId == SdrObjKind::Graphic || nInv == SdrInventor::FmForm)
 {
 OUString sAlternative = pObject->GetTitle();
 if (sAlternative.isEmpty())


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

2023-06-27 Thread Justin Luth (via logerrit)
 sw/source/ui/vba/vbadocument.cxx |   19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit efdf2505df7fe766465e4cd5b8bc429ca8d51f71
Author: Justin Luth 
AuthorDate: Mon Jun 26 20:14:17 2023 -0400
Commit: Justin Luth 
CommitDate: Tue Jun 27 23:43:52 2023 +0200

tdf#151548 ContentControls vba: allow search by float #2

I don't know how to figure out where the basic parsing
is mishandling the double-specifier of "#",
so just hack in a re-attempt to find a control with the
name of an unfound index.

This should be fine. If it really was specifying an index,
then it won't get to this code.

If the number is larger than the index and a control exists
with that id, then it almost certainly was intended as a name.
If by some chance it wasn't, then instead of the code failing,
it will actually go ahead with the operation.

Since in practical terms this won't happen,
just go ahead and fix the likely case of a
positive-number-as-a-name control not being found.

Change-Id: I2a34184d86b99a50fdc6b806264f1d5e7794ad48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153630
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 609a1567d0e60ca11800df56059b97b6a61ad117)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153605

diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 4f20311879ad..c8985464501d 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -225,7 +225,24 @@ uno::Any SwVbaDocument::ContentControls(const uno::Any& 
index)
 uno::Reference xContentControls(
 new SwVbaContentControls(this, mxContext, mxTextDocument, "", ""));
 if (index.hasValue())
-return xContentControls->Item(index, uno::Any());
+{
+try
+{
+return xContentControls->Item(index, uno::Any());
+}
+catch (lang::IndexOutOfBoundsException&)
+{
+// Hack: Instead of an index, it might be a float that was 
mistakenly treated as a long,
+// which can happen with any valid positive integer when specified 
as a double like
+// ActiveDocument.ContentControls(1841581653#).
+if (index.getValueTypeClass() == css::uno::TypeClass_LONG)
+{
+sal_Int32 nLong(0);
+index >>= nLong;
+return 
xContentControls->Item(uno::Any(static_cast(nLong)), uno::Any());
+}
+}
+}
 
 return uno::Any(xContentControls);
 }


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

2023-06-15 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx|   22 
 sw/source/core/inc/AccessibilityCheck.hxx   |2 -
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |2 -
 3 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 4c71b0ac5fcb3ebe1e88721c49be8a6e0b9dcdf9
Author: Balazs Varga 
AuthorDate: Tue Jun 13 11:25:36 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 15 09:26:30 2023 +0200

tdf#155728 - A11y sidebar: fix Update issue list after fixing an issue

in case of SdrObjects.

Change-Id: I45608d423c0da0f1a983dcfad43562c3d7c9ee67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152953
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 4bfdc5b1aeee65bfbc985452a90cc43868682f0a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153077

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 05d2634db863..802ad2c8dea3 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1337,7 +1337,7 @@ public:
 } // end anonymous namespace
 
 // Check Shapes, TextBox
-void AccessibilityCheck::checkObject(SdrObject* pObject)
+void AccessibilityCheck::checkObject(SwNode* pCurrent, SdrObject* pObject)
 {
 if (!pObject)
 return;
@@ -1381,6 +1381,8 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 
 pIssue->setObjectID(pObject->GetName());
 pIssue->setDoc(*m_pDoc);
+if (pCurrent)
+pIssue->setNode(pCurrent);
 }
 }
 }
@@ -1469,19 +1471,13 @@ void AccessibilityCheck::check()
 if (pNodeCheck)
 pNodeCheck->check(pNode);
 }
-}
-}
 
-IDocumentDrawModelAccess& rDrawModelAccess = 
m_pDoc->getIDocumentDrawModelAccess();
-auto* pModel = rDrawModelAccess.GetDrawModel();
-for (sal_uInt16 nPage = 0; nPage < pModel->GetPageCount(); ++nPage)
-{
-SdrPage* pPage = pModel->GetPage(nPage);
-for (size_t nObject = 0; nObject < pPage->GetObjCount(); ++nObject)
-{
-SdrObject* pObject = pPage->GetObj(nObject);
-if (pObject)
-checkObject(pObject);
+for (SwFrameFormat* const& pFrameFormat : pNode->GetAnchoredFlys())
+{
+SdrObject* pObject = pFrameFormat->FindSdrObject();
+if (pObject)
+checkObject(pNode, pObject);
+}
 }
 }
 }
diff --git a/sw/source/core/inc/AccessibilityCheck.hxx 
b/sw/source/core/inc/AccessibilityCheck.hxx
index c7613e8829a4..caaff1944842 100644
--- a/sw/source/core/inc/AccessibilityCheck.hxx
+++ b/sw/source/core/inc/AccessibilityCheck.hxx
@@ -49,7 +49,7 @@ public:
 }
 
 void check() override;
-void checkObject(SdrObject* pObject);
+void checkObject(SwNode* pNode, SdrObject* pObject);
 void checkNode(SwNode* pNode);
 void checkDocumentProperties();
 };
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 20d0ac39c10e..629497c50bac 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -134,7 +134,7 @@ void 
OnlineAccessibilityCheck::runAccessibilityCheck(SwNode* pNode)
 {
 SdrObject* pObject = pFrameFormat->FindSdrObject();
 if (pObject)
-m_aAccessibilityCheck.checkObject(pObject);
+m_aAccessibilityCheck.checkObject(pNode, pObject);
 }
 
 auto aCollection = m_aAccessibilityCheck.getIssueCollection();


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

2023-06-12 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit af32f4f88be29b4b16e0c5b03cb2ea1075aa8e9b
Author: Balazs Varga 
AuthorDate: Thu Jun 8 11:33:13 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 12 14:00:09 2023 +0200

tdf#154943 - Accessibility checker: fix no warn of decorative-flagged image

If an image marked as Decorative it will be irrelevant for a11y,
and no warning will be on the accessibility sidebar.

Change-Id: If4d25fd8043549832a70b2c2be5aa754c76d9c33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152737
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit fe7d95eb051312e3174b71be84c122c1837c1f0f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152877
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 250f1b45f901..302d26c9c06f 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -114,12 +114,17 @@ class NoTextNodeAltTextCheck : public NodeCheck
 }
 else if (pNoTextNode->IsGrfNode())
 {
-auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
-  
sfx::AccessibilityIssueID::NO_ALT_GRAPHIC);
-pIssue->setDoc(pNoTextNode->GetDoc());
-pIssue->setIssueObject(IssueObject::GRAPHIC);
-pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName());
-pIssue->setNode(pNoTextNode);
+const SwFrameFormat* pFrameFormat = pNoTextNode->GetFlyFormat();
+const SfxBoolItem* pIsDecorItem = 
pFrameFormat->GetItemIfSet(RES_DECORATIVE);
+if (!(pIsDecorItem && pIsDecorItem->GetValue()))
+{
+auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
+  
sfx::AccessibilityIssueID::NO_ALT_GRAPHIC);
+pIssue->setDoc(pNoTextNode->GetDoc());
+pIssue->setIssueObject(IssueObject::GRAPHIC);
+pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName());
+pIssue->setNode(pNoTextNode);
+}
 }
 }
 


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

2023-06-12 Thread Tomaž Vajngerl (via logerrit)
 sw/source/filter/ww8/docxexport.cxx |   37 ++--
 1 file changed, 11 insertions(+), 26 deletions(-)

New commits:
commit 3c7643570913c149d68f0850612edcb538c6d346
Author: Tomaž Vajngerl 
AuthorDate: Thu Jun 8 12:37:21 2023 +0900
Commit: Xisco Fauli 
CommitDate: Mon Jun 12 11:16:39 2023 +0200

sw: use ThemeExport instead of grab bag

Change-Id: I68d300d58aaa1e5da374a8ddea4ff37e9a1e1819
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152723
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit fcccb8f8d67dd7deec772746661d2d6dff2c14a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152768
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index af9979a1d660..f7258952a541 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -48,11 +48,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -62,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "wrtww8.hxx"
@@ -74,6 +78,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1466,35 +1471,15 @@ void DocxExport::WriteSettings()
 
 void DocxExport::WriteTheme()
 {
-uno::Reference< beans::XPropertySet > xPropSet( 
m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW );
-
-uno::Reference< beans::XPropertySetInfo > xPropSetInfo = 
xPropSet->getPropertySetInfo();
-OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
-if ( !xPropSetInfo->hasPropertyByName( aName ) )
+SdrPage* pPage = 
m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
+if (!pTheme)
 return;
 
-uno::Reference themeDom;
-uno::Sequence< beans::PropertyValue > propList;
-xPropSet->getPropertyValue( aName ) >>= propList;
-auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
-[](const beans::PropertyValue& rProp) { return rProp.Name == 
"OOXTheme"; });
-if (pProp != std::cend(propList))
-pProp->Value >>= themeDom;
-
-// no theme dom to write
-if ( !themeDom.is() )
-return;
-
-m_rFilter.addRelation( m_pDocumentFS->getOutputStream(),
-oox::getRelationship(Relationship::THEME),
-u"theme/theme1.xml" );
+m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), 
oox::getRelationship(Relationship::THEME), u"theme/theme1.xml" );
 
-uno::Reference< xml::sax::XSAXSerializable > serializer( themeDom, 
uno::UNO_QUERY );
-uno::Reference< xml::sax::XWriter > writer = xml::sax::Writer::create( 
comphelper::getProcessComponentContext() );
-writer->setOutputStream( GetFilter().openFragmentStream( 
"word/theme/theme1.xml",
-"application/vnd.openxmlformats-officedocument.theme+xml" ) );
-serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( 
writer, uno::UNO_QUERY_THROW ),
-uno::Sequence< beans::StringPair >() );
+oox::ThemeExport aThemeExport(_rFilter, oox::drawingml::DOCUMENT_DOCX);
+aThemeExport.write(u"word/theme/theme1.xml", *pTheme);
 }
 
 // See OOXMLDocumentImpl::resolveGlossaryStream


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

2023-06-11 Thread Colomban Wendling (via logerrit)
 sw/source/core/access/accpara.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5899f2d6794a02112f8b4e2983fb1d41527bf2d4
Author: Colomban Wendling 
AuthorDate: Thu Jun 8 17:43:49 2023 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jun 11 21:39:04 2023 +0200

sw: Fix crash accessing default accessible attributes

Fix crash accessing the name of the MMToPixelRatio item in the sequence
returned by SwAccessibleParagraph::getDefaultAttributes(), because a
temporary local was used as the property name, but got destroyed when
the method returns.

This was introduced in 46ce0d28b4c765076c7871358375c4e85e44534b,
probably by inadvertently removing the `static` qualifier.

Change-Id: I1d5004b0b0fdf9651781b9c71b67afeba61c284c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152748
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 
(cherry picked from commit 235b0a4d30598631218dcc289a9efa85cd52ed3a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152766
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index bf88bda18bc4..c0599dbe3695 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1598,7 +1598,7 @@ uno::Sequence< PropertyValue > 
SwAccessibleParagraph::getDefaultAttributes(
 _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
 
 // #i92233#
-constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
+static constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
  (comphelper::findValue(aRequestedAttributes, 
sMMToPixelRatio) != -1) );
 


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

2023-06-08 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit f0619fddd49b56652f2fed9a2b56d21a2769e3b0
Author: Balazs Varga 
AuthorDate: Thu Jun 8 12:34:37 2023 +0200
Commit: Balazs Varga 
CommitDate: Thu Jun 8 22:17:19 2023 +0200

tdf#154951 - Accessibility checker fix missing alt text of grouped shapes

Add grouped shapes objects to "Go to" and "Fix" functions.

Change-Id: I4ebdbcadc775e700fe1da3a858e60658a88553db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152709
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 0b98ddee3612568ac640ad05b2d3d59f00d9ca2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152761

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 58e3fe50f4a9..250f1b45f901 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1354,9 +1354,10 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 && FindFrameFormat(pObject)->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
 lclAddIssue(m_aIssueCollection, SwResId(STR_FLOATING_TEXT));
 
-if (pObject->GetObjIdentifier() == SdrObjKind::CustomShape
-|| pObject->GetObjIdentifier() == SdrObjKind::Text
-|| pObject->GetObjIdentifier() == SdrObjKind::Media)
+const SdrObjKind nObjId = pObject->GetObjIdentifier();
+
+if (nObjId == SdrObjKind::CustomShape || nObjId == SdrObjKind::Text
+|| nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group)
 {
 OUString sAlternative = pObject->GetTitle();
 if (sAlternative.isEmpty())


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

2023-06-08 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7055f90dce3effc3c9fa0f7e8da6171dc07bf894
Author: Balazs Varga 
AuthorDate: Wed Jun 7 10:16:28 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 8 12:31:29 2023 +0200

tdf#154932 - A11Y sidebar: fix warning about missing media object 
description

Add media graphic object to "Go to" and "Fix" functions.

Change-Id: I796ce53605e5d8d10558494a87b987443ad918ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152695
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 07af470f6186d8304f1b966b7068d3690eb3e259)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152665

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 1766052b5d44..58e3fe50f4a9 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1355,7 +1355,8 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 lclAddIssue(m_aIssueCollection, SwResId(STR_FLOATING_TEXT));
 
 if (pObject->GetObjIdentifier() == SdrObjKind::CustomShape
-|| pObject->GetObjIdentifier() == SdrObjKind::Text)
+|| pObject->GetObjIdentifier() == SdrObjKind::Text
+|| pObject->GetObjIdentifier() == SdrObjKind::Media)
 {
 OUString sAlternative = pObject->GetTitle();
 if (sAlternative.isEmpty())