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

2023-12-06 Thread Michael Weghorn (via logerrit)
 sw/source/core/access/accpara.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 185cd83bf58d8c834a9690cdd6a25736787abbf7
Author: Michael Weghorn 
AuthorDate: Tue Dec 5 14:44:45 2023 +0100
Commit: Michael Weghorn 
CommitDate: Thu Dec 7 07:10:35 2023 +0100

sw a11y: Only report "level", no more "heading-level" obj attr

Stop reporting the custom "heading-level" object attribute in
addition to the "level" attribute.
As described in the Core Accessibility API Mappings spec, the
latter is specified in ARIA and maps to an attribute of
the same name for all of AT-SPI2, IAccessible2 and UIA [1].

Get rid of the non-documented "heading-level" as part of the
goal to align more closely to platform APIs/specifications.

NVDA's LibreOffice-specific app module currently relies on the
custom "heading-level" object attribute [2], but I've reported
an issue and submitted a pull request for this: [3] [4]

While neither the "level" nor the "heading-level" attribute are
currently mentioned in the the IAccessible2 object attribute
specification [5], the IAccessible2 doc for
`IAccessible2::groupPosition` [6] explicitly mentions
the "level" attribute for headings:

> This method is meant to describe the nature of an object's containment
> structure. It's exposed by trees, tree grids, nested lists, nested
> menus, but not headings, which uses the level object attribute.

[1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading
[2] 
https://github.com/nvaccess/nvda/blob/9cf925195e0fc5ffc67dcfcc9e4d4a7d46ffb430/source/appModules/soffice.py#L225
[3] https://github.com/nvaccess/nvda/issues/15881
[4] https://github.com/nvaccess/nvda/pull/15882
[5] 
https://wiki.linuxfoundation.org/accessibility/iaccessible2/objectattributes
[6] 
https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/interface_i_accessible2.html#a94d4d84e000ef2fa3f2abf1148779941

Change-Id: I8e8994cc7565f9b0f40ca8bedff951512f56b59b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160347
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 6f487ab46c53..f0bd0f0653d1 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3519,9 +3519,10 @@ uno::Any SAL_CALL 
SwAccessibleParagraph::getExtendedAttributes()
 OUString strHeading;
 if (m_nHeadingLevel >= 0)
 {
-strHeading = "heading-level:" + OUString::number(m_nHeadingLevel);
-// tdf#84102: expose the same attribute with the name "level"
-strHeading += ";level:" + OUString::number(m_nHeadingLevel) + ";";
+// report heading level using the "level" object attribute as 
specified in ARIA,
+// maps to attributes of the same name for AT-SPI, IAccessible2, UIA
+// https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading
+strHeading = "level:" + OUString::number(m_nHeadingLevel) + ";";
 }
 
 return uno::Any(strHeading);


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

2023-12-06 Thread Michael Weghorn (via logerrit)
 sw/source/core/access/accpara.cxx |   22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 90d49b980d7fed1d55ab83f3ed88d27ab2cfbb12
Author: Michael Weghorn 
AuthorDate: Tue Dec 5 12:55:37 2023 +0100
Commit: Michael Weghorn 
CommitDate: Thu Dec 7 07:09:49 2023 +0100

sw a11y: Only report heading level attr for heading

Only report the "heading-level" and "level" object
attributes for a Writer paragraph when this paragraph
has a heading level that can be reported as the value
of the object attribute.
No longer report the attribute without any value set otherwise,
since the attribute doesn't provide any value then,
but is rather confusing/misleading.

Change-Id: I282345b00a32a74de229058ff368f3b169bf1c03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160346
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 62db53567a3e..6f487ab46c53 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3516,19 +3516,15 @@ uno::Any SAL_CALL 
SwAccessibleParagraph::getExtendedAttributes()
 {
 SolarMutexGuard g;
 
-uno::Any Ret;
-OUString strHeading("heading-level:");
-if( m_nHeadingLevel >= 0 )
-strHeading += OUString::number(m_nHeadingLevel);
-// tdf#84102: expose the same attribute with the name "level"
-strHeading += ";level:";
-if( m_nHeadingLevel >= 0 )
-strHeading += OUString::number(m_nHeadingLevel);
-strHeading += ";";
-
-Ret <<= strHeading;
-
-return Ret;
+OUString strHeading;
+if (m_nHeadingLevel >= 0)
+{
+strHeading = "heading-level:" + OUString::number(m_nHeadingLevel);
+// tdf#84102: expose the same attribute with the name "level"
+strHeading += ";level:" + OUString::number(m_nHeadingLevel) + ";";
+}
+
+return uno::Any(strHeading);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-12-06 Thread Oliver Specht (via logerrit)
 sw/source/core/text/txtfld.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5de53775531a358c6775d265a3a19699c96a8139
Author: Oliver Specht 
AuthorDate: Wed Nov 22 12:05:14 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Dec 6 15:24:57 2023 +0100

tdf#154369 don't apply default items to numbering symbols

default attributes from the CharFmt should no be applied to the
numbering symbol

Change-Id: Ifa2d2ace575b888a43fa948f3b71605cfe20f129
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159817
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 2cffd26eeef7..84f32e30971f 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -351,7 +351,8 @@ static void 
checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
 {
 if (!SwTextNode::IsIgnoredCharFormatForNumbering(nWhich, 
/*bIsCharStyle=*/true)
 && !pCleanedSet->HasItem(nWhich)
-&& !(pFormat && pFormat->HasItem(nWhich)) )
+&& !(pFormat && pFormat->HasItem(nWhich))
+&& rStyleAttrs.GetItemState(nWhich) > SfxItemState::DEFAULT)
 {
 // Copy from parent sets only allowed items which will not 
overwrite
 // values explicitly defined in current set (pCleanedSet) or 
in pFormat


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

2023-12-05 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/inc/conttree.hxx  |4 +
 sw/source/uibase/utlui/content.cxx |   91 -
 2 files changed, 93 insertions(+), 2 deletions(-)

New commits:
commit 8286c9ebe47aaf24b055f51136a8cb06f1e6429c
Author: Jim Raykowski 
AuthorDate: Mon Nov 27 22:51:28 2023 -0900
Commit: Jim Raykowski 
CommitDate: Tue Dec 5 21:52:22 2023 +0100

tdf#157729 SwNavigator: enhancement to group comments by threads

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

diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index 9e1653fd08e3..b693a7da97a4 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -106,8 +106,10 @@ class SwContentTree final : public SfxListener
 SwWrtShell* m_pActiveShell;   // the active or a const. open view
 SwNavigationConfig* m_pConfig;
 
+// these maps store the expand state of nodes with children
 std::map< void*, bool > mOutLineNodeMap;
-std::map m_aRegionNodeExpandMap; // stores expand state 
of nodes with children
+std::map m_aRegionNodeExpandMap;
+std::map m_aPostItNodeExpandMap;
 
 sal_Int32   m_nActiveBlock;  // used to restore content types 
expand state
 sal_Int32   m_nHiddenBlock;
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 4ca633697cdd..29ab1b964c26 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -119,6 +119,8 @@
 
 #include 
 
+#include 
+
 #define CTYPE_CNT   0
 #define CTYPE_CTT   1
 
@@ -2312,6 +2314,45 @@ bool SwContentTree::RequestingChildren(const 
weld::TreeIter& rParent)
 }
 }
 }
+else if (pCntType->GetType() == ContentTypeId::POSTIT)
+{
+std::vector> aParentCandidates;
+for(size_t i = 0; i < nCount; ++i)
+{
+const SwPostItContent* pCnt =
+static_cast(pCntType->GetMember(i));
+
+OUString sEntry = pCnt->GetName();
+OUString sId(weld::toId(pCnt));
+
+const SwPostItField* pPostItField =
+static_cast(pCnt->GetPostIt()->GetField());
+auto lambda = [, this](const 
std::unique_ptr& xEntry)
+{
+SwPostItContent* pParentCandidateCnt =
+
weld::fromId(m_xTreeView->get_id(*xEntry));
+return pPostItField->GetParentPostItId() ==
+static_cast(pParentCandidateCnt->GetPostIt()
+  
->GetField())->GetPostItId();
+};
+
+// if a parent candidate is not found use the passed root node
+auto aFind = std::find_if(aParentCandidates.rbegin(), 
aParentCandidates.rend(), lambda);
+if (aFind != aParentCandidates.rend())
+insert(aFind->get(), sEntry, sId, false, xChild.get());
+else
+insert(, sEntry, sId, false, xChild.get());
+
+m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible());
+
+// clear parent candidates when encountering a postit that 
doesn't have a parent
+// following postits can't have a parent that is in these 
candidates
+if (pPostItField->GetParentPostItId() == 0)
+aParentCandidates.clear();
+
+
aParentCandidates.emplace_back(m_xTreeView->make_iterator(xChild.get()));
+}
+}
 else
 InsertContent(rParent);
 
@@ -2485,6 +2526,47 @@ void SwContentTree::Expand(const weld::TreeIter& rParent,
 m_aRegionNodeExpandMap[key] = true;
 }
 }
+else if (m_nRootType == ContentTypeId::POSTIT || (m_nRootType == 
ContentTypeId::UNKNOWN &&
+  eParentContentTypeId == 
ContentTypeId::POSTIT))
+{
+if (bParentIsContentType)
+{
+std::map aCurrentPostItNodeExpandMap;
+if (RequestingChildren(rParent))
+{
+std::unique_ptr 
xChild(m_xTreeView->make_iterator());
+while (m_xTreeView->iter_next(*xChild) && 
lcl_IsContent(*xChild, *m_xTreeView))
+{
+if (m_xTreeView->iter_has_child(*xChild))
+{
+
assert(dynamic_cast(weld::fromId(m_xTreeView->get_id(*xChild;
+const void* key =
+static_cast(weld::fromId(
+ 
m_xTreeView->get_id(*xChild))->GetPostIt());
+bool bExpandNode =
+

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

2023-12-04 Thread Justin Luth (via logerrit)
 sw/source/uibase/shells/txtnum.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 1a74a87b442857567d20da5dc97bbbc278745afd
Author: Justin Luth 
AuthorDate: Thu Nov 23 20:50:09 2023 -0500
Commit: Justin Luth 
CommitDate: Mon Dec 4 22:40:54 2023 +0100

related tdf#56258 sw sidebar SetOutline: do something without dropdown

The sidebar gained SetOutline in 7.6
with commit 3fd0b4053763aa91b0004c523e96e7d390c7b58e.

In the TOOLBAR, there is special code that tells the main button
to show the locale list outline choices - just like the dropdown does.
However, none of that code comes into play in the sidebar,
so add a special case to handle that situation.

It is easy to launch the dialog, focused on the outlinenum page.
Better yet would be to figure out how to launch the popup window
that the dropdown opens - so they do the same thing...

Change-Id: I3d6eeafaa8bdb45cfacc42e221820d664419e0e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159934
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Justin Luth 
Reviewed-by: Szymon Kłos 
(cherry picked from commit f384dc0476e4730d3ccb7a7f56eae8452bce133a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160180
Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/txtnum.cxx 
b/sw/source/uibase/shells/txtnum.cxx
index c577cdafdfcc..e769b7f46347 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -310,6 +310,14 @@ void SwTextShell::ExecSetNumber(SfxRequest const )
 GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
 }
 }
+else if (nSlot == FN_SVX_SET_OUTLINE)
+{
+// no outline provided: launch dialog to request a specific 
outline
+SfxBindings& rBindings = 
GetView().GetViewFrame().GetBindings();
+const SfxStringItem aPage(FN_PARAM_1, "outlinenum");
+const SfxPoolItem* aItems[] = { , nullptr };
+rBindings.Execute(SID_OUTLINE_BULLET, aItems);
+}
 }
 break;
 


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

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

New commits:
commit 4f8bb267489b14aa1dab360786d8f99c763f03b4
Author: Julien Nabet 
AuthorDate: Thu Nov 30 17:46:08 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 18:09:35 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 

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 028b9f1b209a..380bbb768f16 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(); }))
+[pController]{ return pController->getDialog(); }))
 , 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: sw/source

2023-11-30 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/ftnfrm.hxx|1 +
 sw/source/core/layout/ftnfrm.cxx |   11 +++
 sw/source/core/text/xmldump.cxx  |9 -
 3 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit a83088b05f177fb938c2e4ffb06cd19362a5a1ca
Author: Miklos Vajna 
AuthorDate: Thu Nov 30 20:03:16 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 1 08:41:00 2023 +0100

sw: extract SwFootnoteFrame::dumpAsXmlAttributes() from SwFrame

Allows getting rid of a static cast.

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

diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx
index 89d9f34f863a..558c4941bf06 100644
--- a/sw/source/core/inc/ftnfrm.hxx
+++ b/sw/source/core/inc/ftnfrm.hxx
@@ -163,6 +163,7 @@ public:
 SwContentFrame* FindLastContent();
 
 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
+void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
 };
 
 #endif
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 4baed772787b..70453c572774 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -3007,4 +3007,15 @@ void SwFootnoteFrame::dumpAsXml(xmlTextWriterPtr writer) 
const
 (void)xmlTextWriterEndElement(writer);
 }
 
+void SwFootnoteFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+SwLayoutFrame::dumpAsXmlAttributes(writer);
+
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("ref"), "%" 
SAL_PRIuUINT32, GetRef()->GetFrameId() );
+if (GetMaster())
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("master"), 
"%" SAL_PRIuUINT32, GetMaster()->GetFrameId() );
+if (GetFollow())
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("follow"), 
"%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 245a1aa96945..a14c5a485109 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -198,15 +198,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer 
) const
 (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "upper" ), 
"%" SAL_PRIuUINT32, GetUpper()->GetFrameId() );
 if ( GetLower( ) )
 (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "lower" ), 
"%" SAL_PRIuUINT32, GetLower()->GetFrameId() );
-if (IsFootnoteFrame())
-{
-SwFootnoteFrame const*const pFF(static_cast(this));
-(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("ref"), "%" 
SAL_PRIuUINT32, pFF->GetRef()->GetFrameId() );
-if (pFF->GetMaster())
-(void)xmlTextWriterWriteFormatAttribute( writer, 
BAD_CAST("master"), "%" SAL_PRIuUINT32, pFF->GetMaster()->GetFrameId() );
-if (pFF->GetFollow())
-(void)xmlTextWriterWriteFormatAttribute( writer, 
BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFF->GetFollow()->GetFrameId() );
-}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-29 Thread Noel Grandin (via logerrit)
 sw/source/core/text/itrcrsr.cxx  |4 ++--
 sw/source/core/text/porlin.cxx   |4 ++--
 sw/source/core/text/porlin.hxx   |2 +-
 sw/source/core/text/pormulti.cxx |6 +++---
 sw/source/core/text/pormulti.hxx |6 +++---
 sw/source/core/text/portxt.cxx   |2 +-
 sw/source/core/text/portxt.hxx   |2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 1932a549b239be7a7555453516190d3e2846593b
Author: Noel Grandin 
AuthorDate: Wed Nov 29 08:22:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 30 07:01:43 2023 +0100

use more SwTwips in CalcSpacing

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

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 1770361c19de..4ae582d7df59 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1371,7 +1371,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_Int16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + pPor->CalcSpacing( nSpaceAdd, GetInfo() );
 }
 if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
 ( pPor->IsMultiPortion() && 
static_cast(pPor)->HasTabulator() )
@@ -1415,7 +1415,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_Int16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + pPor->CalcSpacing( nSpaceAdd, GetInfo() );
 }
 
 if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 6d0992f1abf6..31010a1e776e 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -89,7 +89,7 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
 sal_uInt16 nLastWidth = pLast->Width();
 
 if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
-nLastWidth = nLastWidth + 
o3tl::narrowing(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ));
+nLastWidth = nLastWidth + pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf 
);
 
 sal_uInt16 nPos;
 SwTextPaintInfo aInf( rInf );
@@ -306,7 +306,7 @@ void SwLinePortion::Move(SwTextPaintInfo & rInf) const
 rInf.SetIdx( rInf.GetIdx() + GetLen() );
 }
 
-tools::Long SwLinePortion::CalcSpacing( tools::Long , const SwTextSizeInfo & ) 
const
+SwTwips SwLinePortion::CalcSpacing( tools::Long , const SwTextSizeInfo & ) 
const
 {
 return 0;
 }
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 8a43d1cde6e9..50ee3ed159c1 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -169,7 +169,7 @@ public:
 virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo  ) const;
 
 // for text- and multi-portions
-virtual tools::Long CalcSpacing( tools::Long nSpaceAdd, const 
SwTextSizeInfo  ) const;
+virtual SwTwips CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeInfo 
 ) const;
 
 // Accessibility: pass information about this portion to the PortionHandler
 virtual void HandlePortion( SwPortionHandler& rPH ) const;
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 4e7268698efc..7771ab9b5e8f 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -120,7 +120,7 @@ void SwMultiPortion::CalcSize( SwTextFormatter& rLine, 
SwTextFormatInfo  )
 SetAscent( nTmp );
 }
 
-tools::Long SwMultiPortion::CalcSpacing( tools::Long , const SwTextSizeInfo & 
) const
+SwTwips SwMultiPortion::CalcSpacing( tools::Long , const SwTextSizeInfo & ) 
const
 {
 return 0;
 }
@@ -219,7 +219,7 @@ SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, 
sal_uInt8 nLv)
 SetDirection( DIR_LEFT2RIGHT );
 }
 
-tools::Long SwBidiPortion::CalcSpacing( tools::Long nSpaceAdd, const 
SwTextSizeInfo& rInf ) const
+SwTwips SwBidiPortion::CalcSpacing( tools::Long nSpaceAdd, const 
SwTextSizeInfo& rInf ) const
 {
 return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt(rInf)) * nSpaceAdd / 
SPACING_PRECISION_FACTOR;
 }
@@ -505,7 +505,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo 
 )
 rInf.SetIdx( nStart );
 }
 
-tools::Long SwDoubleLinePortion::CalcSpacing( tools::Long nSpaceAdd, const 
SwTextSizeInfo & ) const
+SwTwips SwDoubleLinePortion::CalcSpacing( tools::Long nSpaceAdd, const 
SwTextSizeInfo & ) const
 {
 return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt()) * nSpaceAdd / 
SPACING_PRECISION_FACTOR;
 }
diff --git 

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

2023-11-28 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/inc/conttree.hxx  |4 
 sw/source/uibase/utlui/content.cxx |  183 +++--
 2 files changed, 97 insertions(+), 90 deletions(-)

New commits:
commit 7a555725dad87b977154961beeb5c0da2a856709
Author: Jim Raykowski 
AuthorDate: Thu Nov 23 16:54:51 2023 -0900
Commit: Jim Raykowski 
CommitDate: Wed Nov 29 07:59:38 2023 +0100

SwNavigator: Rework the SwContentTree Expand function

in effort to improve readability and operation.

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

diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index a8094c40303a..9e1653fd08e3 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -109,10 +109,10 @@ class SwContentTree final : public SfxListener
 std::map< void*, bool > mOutLineNodeMap;
 std::map m_aRegionNodeExpandMap; // stores expand state 
of nodes with children
 
-sal_Int32   m_nActiveBlock; // used to restore content 
types/categories expand state
+sal_Int32   m_nActiveBlock;  // used to restore content types 
expand state
 sal_Int32   m_nHiddenBlock;
 size_t  m_nEntryCount;
-ContentTypeId   m_nRootType;
+ContentTypeId   m_nRootType;// content type that is currently 
displayed in the tree
 ContentTypeId   m_nLastSelType;
 sal_uInt8   m_nOutlineLevel;
 
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 352a6daa9bba..4ca633697cdd 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2364,122 +2364,129 @@ SdrObject* 
SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
 return pRetObj;
 }
 
-void SwContentTree::Expand(const weld::TreeIter& rParent, 
std::vector>* pNodesToExpand)
+void SwContentTree::Expand(const weld::TreeIter& rParent,
+   std::vector>* 
pNodesToExpand)
 {
-if (!(m_xTreeView->iter_has_child(rParent) || 
m_xTreeView->get_children_on_demand(rParent)))
+if (!m_xTreeView->iter_has_child(rParent) && 
!m_xTreeView->get_children_on_demand(rParent))
 return;
 
-if (m_nRootType == ContentTypeId::UNKNOWN || m_nRootType == 
ContentTypeId::OUTLINE ||
-m_nRootType == ContentTypeId::REGION)
+// pNodesToExpand is used by the Display function to restore the trees 
expand structure for
+// hierarchical content types, e.g., OUTLINE and REGION.
+if (pNodesToExpand)
+pNodesToExpand->emplace_back(m_xTreeView->make_iterator());
+
+// rParentId is a string representation of a pointer to SwContentType or 
SwContent
+const OUString& rParentId = m_xTreeView->get_id(rParent);
+// bParentIsContentType tells if the passed rParent tree entry is a 
content type or content
+const bool bParentIsContentType = lcl_IsContentType(rParent, *m_xTreeView);
+// eParentContentTypeId is the content type of the passed rParent tree 
entry
+const ContentTypeId eParentContentTypeId =
+bParentIsContentType ? 
weld::fromId(rParentId)->GetType() :
+   
weld::fromId(rParentId)->GetParent()->GetType();
+
+if (m_nRootType == ContentTypeId::UNKNOWN && bParentIsContentType)
 {
-if (lcl_IsContentType(rParent, *m_xTreeView))
+// m_nActiveBlock and m_nHiddenBlock are used to persist the content 
type expand state for
+// the all content view mode
+const sal_Int32 nOr = 1 << static_cast(eParentContentTypeId); 
//linear -> Bitposition
+if (State::HIDDEN != m_eState)
 {
-ContentTypeId eContentTypeId =
-
weld::fromId(m_xTreeView->get_id(rParent))->GetType();
-const sal_Int32 nOr = 1 << static_cast(eContentTypeId); 
//linear -> Bitposition
-if (State::HIDDEN != m_eState)
-{
-m_nActiveBlock |= nOr;
-m_pConfig->SetActiveBlock(m_nActiveBlock);
-}
-else
-m_nHiddenBlock |= nOr;
-if (eContentTypeId == ContentTypeId::OUTLINE)
-{
-std::map< void*, bool > aCurrOutLineNodeMap;
+m_nActiveBlock |= nOr;
+m_pConfig->SetActiveBlock(m_nActiveBlock);
+}
+else
+m_nHiddenBlock |= nOr;
+}
+
+if (m_nRootType == ContentTypeId::OUTLINE || (m_nRootType == 
ContentTypeId::UNKNOWN &&
+  eParentContentTypeId == 
ContentTypeId::OUTLINE))
+{
+if (bParentIsContentType)
+{
+std::map< void*, bool > aCurrOutLineNodeMap;
 
-SwWrtShell* pShell = GetWrtShell();
-bool bParentHasChild = RequestingChildren(rParent);
-if (pNodesToExpand)
-   

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

2023-11-28 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8f2c10f051c4d3e587b859210e9430ada7876a7a
Author: Jim Raykowski 
AuthorDate: Tue Nov 28 10:49:31 2023 -0900
Commit: Jim Raykowski 
CommitDate: Wed Nov 29 07:03:54 2023 +0100

SwNavigator: Allow Sections, Indexes, and Headings tracking

when in a table and Table tracking is off

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index ff354273ff82..352a6daa9bba 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4226,8 +4226,8 @@ void SwContentTree::UpdateTracking()
 OUString aName = m_pActiveShell->GetTableFormat()->GetName();
 lcl_SelectByContentTypeAndName(this, *m_xTreeView, 
SwResId(STR_CONTENT_TYPE_TABLE),
aName);
+return;
 }
-return;
 }
 // indexes
 if (const SwTOXBase* pTOX = m_pActiveShell->GetCurTOX(); pTOX &&


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

2023-11-28 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/inc/content.hxx   |2 +
 sw/source/uibase/utlui/content.cxx |   44 ++---
 sw/uiconfig/swriter/ui/navigatorcontextmenu.ui |   16 +
 3 files changed, 58 insertions(+), 4 deletions(-)

New commits:
commit 01a02ee7f1dbe7501a89b41e62599fba6a8b33f3
Author: Jim Raykowski 
AuthorDate: Sat Nov 18 18:56:56 2023 -0900
Commit: Jim Raykowski 
CommitDate: Wed Nov 29 04:24:57 2023 +0100

tdf#157681 SwNavigator: Add Protect and Hide menu items to Sections

context menu

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

diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx
index 77cb156b744c..c6698f4b0322 100644
--- a/sw/source/uibase/inc/content.hxx
+++ b/sw/source/uibase/inc/content.hxx
@@ -72,6 +72,8 @@ class SwRegionContent final : public SwContent
 m_nRegionLevel(nLevel), 
m_pSectionFormat(pSectionFormat){}
 sal_uInt8   GetRegionLevel() const {return m_nRegionLevel;}
 const SwSectionFormat* GetSectionFormat() const {return m_pSectionFormat;}
+
+bool IsProtect() const override;
 };
 
 class SwURLFieldContent final : public SwContent
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 07fd64dc3bf9..ff354273ff82 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -260,6 +260,11 @@ bool SwURLFieldContent::IsProtect() const
 return m_pINetAttr->IsProtect();
 }
 
+bool SwRegionContent::IsProtect() const
+{
+return m_pSectionFormat->GetSection()->IsProtect();
+}
+
 SwGraphicContent::~SwGraphicContent()
 {
 }
@@ -810,7 +815,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 m_bAlphabeticSort ? 0 : 
getYPos(pNodeIndex->GetNode()),
 pFormat));
 
-if(!pFormat->IsVisible())
+if (!pFormat->IsVisible() || pSection->IsHidden())
 pCnt->SetInvisible();
 m_pMember->insert(std::move(pCnt));
 }
@@ -1718,6 +1723,9 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 
 bool bRemoveSortEntry = true;
 
+bool bRemoveProtectSection = true;
+bool bRemoveHideSection = true;
+
 if (xEntry)
 {
 const SwContentType* pType;
@@ -1811,7 +1819,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 && 
m_pActiveShell->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS);
 const bool bEditable = pType->IsEditable() &&
 ((bVisible && !bProtected) || ContentTypeId::REGION == 
nContentType);
-const bool bDeletable = pType->IsDeletable() && bVisible && 
!bProtected && !bProtectBM;
+const bool bDeletable = pType->IsDeletable()
+&& ((bVisible && !bProtected && !bProtectBM) || 
ContentTypeId::REGION == nContentType);
 const bool bRenamable = bEditable && !bReadonly &&
 (ContentTypeId::TABLE == nContentType ||
  ContentTypeId::FRAME == nContentType ||
@@ -1913,8 +1922,17 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
 }
 else if(ContentTypeId::REGION == nContentType)
 {
-bRemoveSelectEntry = false;
 bRemoveEditEntry = false;
+bRemoveProtectSection = false;
+bRemoveHideSection = false;
+SwContent* pCnt = 
weld::fromId(m_xTreeView->get_id(*xEntry));
+
assert(dynamic_cast(static_cast(pCnt)));
+const SwSectionFormat* pSectionFormat
+= 
static_cast(pCnt)->GetSectionFormat();
+bool bHidden = pSectionFormat->GetSection()->IsHidden();
+bRemoveSelectEntry = bHidden || !bVisible;
+xPop->set_active("protectsection", bProtected);
+xPop->set_active("hidesection", bHidden);
 }
 else if (bEditable)
 bRemoveEditEntry = false;
@@ -2106,6 +2124,10 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
 xPop->remove("endnotetracking");
 if (bRemoveSortEntry)
 xPop->remove("sort");
+if (bRemoveProtectSection)
+xPop->remove("protectsection");
+if (bRemoveHideSection)
+xPop->remove("hidesection");
 
 bool bSetSensitiveCollapseAllCategories = false;
 if (!m_bIsRoot && xEntry)
@@ -4811,7 +4833,21 @@ void SwContentTree::ExecuteContextMenuAction(const 
OUString& rSelectedPopupEntry
 if 

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

2023-11-28 Thread Gökay Şatır (via logerrit)
 sw/source/core/edit/edlingu.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7697ef9d8fbbed7afba10c00ff9f5362d0540cdd
Author: Gökay Şatır 
AuthorDate: Thu Nov 2 13:37:46 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Nov 28 14:28:42 2023 +0100

Proof reading suggestions:

* When user right clicks an underlined part of the sentence, we are 
checking if there is a suggestion list.
* Then we show the suggestions.

Sometimes spell checker algorithms send 2 lists for the same part of the 
sentence.
And we saw that one of these lists can be empty (no suggestions).
But since we check if there is a list, the empty list is shown to the user.

I updated the checks here and added a new condition:
Now we take the list if the list is not empty.
This way, we can find the not-empty list which may come after an empty list 
(for the same part of the sentence).

Signed-off-by: Gökay Şatır 
Change-Id: Ib3b498b98a8d44f8a7ead99593a71adcefa87a82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158832
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 4c6c60d44b0056cbe08b6e75baacbc0df0cd1742)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159908
Tested-by: Jenkins

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index e1f6d631139d..5731d2b2be49 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1031,7 +1031,8 @@ bool SwEditShell::GetGrammarCorrection(
 auto pError = std::find_if(std::cbegin(rResult.aErrors), 
std::cend(rResult.aErrors),
 [rErrorPosInText, nLen](const 
linguistic2::SingleProofreadingError ) {
 return rError.nErrorStart <= rErrorPosInText
-&& rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength; });
+&& rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength
+&& rError.aSuggestions.size() > 0; });
 if (pError != std::cend(rResult.aErrors))
 {
 rSuggestions = pError->aSuggestions;


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

2023-11-28 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 708e52a551daa27932dfae072a16e3512c72cf92
Author: Mike Kaganski 
AuthorDate: Tue Nov 28 13:59:22 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Nov 28 14:28: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 

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 ac3ebb4c6698..0f158e49fc82 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: sw/source

2023-11-27 Thread Julien Nabet (via logerrit)
 sw/source/core/access/AccessibilityIssue.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit c56d0355b742aa0afb17c0370997610d24d9554f
Author: Julien Nabet 
AuthorDate: Mon Nov 27 12:27:55 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Nov 27 14:41:53 2023 +0100

Remove unused #include 

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

diff --git a/sw/source/core/access/AccessibilityIssue.cxx 
b/sw/source/core/access/AccessibilityIssue.cxx
index fe7d409091ca..346d8bb293c6 100644
--- a/sw/source/core/access/AccessibilityIssue.cxx
+++ b/sw/source/core/access/AccessibilityIssue.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 


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

2023-11-23 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/sectfrm.hxx|1 +
 sw/source/core/layout/sectfrm.cxx |   10 +-
 sw/source/core/text/xmldump.cxx   |6 --
 3 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 40309da824a6d370aaeae4169c44f237387ec427
Author: Miklos Vajna 
AuthorDate: Thu Nov 23 20:03:48 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 24 08:27:23 2023 +0100

sw: extract SwSectionFrame::dumpAsXmlAttributes() from SwFrame

Allows getting rid of a static cast.

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

diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 82a41d4e3167..c07d78b12ba9 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -156,6 +156,7 @@ public:
 bool IsBalancedSection() const;
 
 virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
+void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
 
 bool IsFootnoteAtEnd() const { return m_bFootnoteAtEnd; }
 bool IsEndnAtEnd() const { return m_bEndnAtEnd;   }
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index fdbcb5a57092..a1fd849ec495 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2962,7 +2962,7 @@ bool SwSectionFrame::IsBalancedSection() const
 void SwSectionFrame::dumpAsXml(xmlTextWriterPtr writer) const
 {
 (void)xmlTextWriterStartElement(writer, BAD_CAST("section"));
-SwFrame::dumpAsXmlAttributes( writer );
+dumpAsXmlAttributes( writer );
 if ( HasFollow() )
 (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), 
"%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
 
@@ -2977,4 +2977,12 @@ void SwSectionFrame::dumpAsXml(xmlTextWriterPtr writer) 
const
 (void)xmlTextWriterEndElement(writer);
 }
 
+void SwSectionFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+SwLayoutFrame::dumpAsXmlAttributes(writer);
+
+SwSectionNode const*const pNode(GetSection() ? 
GetSection()->GetFormat()->GetSectionNode() : nullptr);
+(void)xmlTextWriterWriteFormatAttribute(writer, 
BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? 
sal_Int32(pNode->GetIndex()) : -1);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index b5cde782775f..245a1aa96945 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -207,12 +207,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer 
) const
 if (pFF->GetFollow())
 (void)xmlTextWriterWriteFormatAttribute( writer, 
BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFF->GetFollow()->GetFrameId() );
 }
-if (IsSctFrame())
-{
-SwSectionFrame const*const pFrame(static_cast(this));
-SwSectionNode const*const pNode(pFrame->GetSection() ? 
pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr);
-(void)xmlTextWriterWriteFormatAttribute(writer, 
BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? 
sal_Int32(pNode->GetIndex()) : -1);
-}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

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

New commits:
commit 1e51005a2413457a9030c565d627e39670785b56
Author: Noel Grandin 
AuthorDate: Thu Nov 23 17:47:24 2023 +0100
Commit: Noel Grandin 
CommitDate: Fri Nov 24 07:46:07 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 

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: sw/source

2023-11-22 Thread Szymon Kłos (via logerrit)
 sw/source/uibase/dochdl/swdtflvr.cxx |   15 ++-
 sw/source/uibase/inc/swdtflvr.hxx|2 ++
 sw/source/uibase/inc/uivwimp.hxx |2 ++
 sw/source/uibase/uiview/uivwimp.cxx  |   13 +
 4 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 5dcc658d7fc6bd6f8002666e40e1f1bff3dd4c69
Author: Szymon Kłos 
AuthorDate: Thu Nov 16 17:13:37 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 22 15:41:22 2023 +0100

lok: disconnect clipboard leftovers in Writer to avoid crash

When we closed one view which previously copied some larger selection
in the Writer and other session after that modified content of that 
selection
we got a crash. It was caused by old clipboard data still beeing used.
On copy there is created SwTransferDdeLink which creates "Server" - 
SvLinkSource
which is notified in SwTransferDdeLink::DataChanged when someone is
editing
previously copied selection. Let's disconnect that server on view close
as it is no longer needed.

some characteristic trace pieces for crash:

libsofficeapp.so!LOKClipboard::setContents(LOKClipboard * this, const 
com::sun::star::uno::Reference & 
xTrans, const 
com::sun::star::uno::Reference
 & xClipboardOwner)
...
libswlo.so!SwTransferable::RemoveDDELinkFormat(SwTransferable * this, 
vcl::Window & rWin)
...
libsfxlo.so!sfx2::SvLinkSource::NotifyDataChanged(sfx2::SvLinkSource * this)
...
libswlo.so!SwDataChanged::~SwDataChanged(SwDataChanged * this)

Change-Id: I2ebab3db8bc42e20781874802563352ef263fdaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159755
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index fc5f9f73a0a5..91eb38e0f45c 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -283,11 +283,7 @@ SwTransferable::~SwTransferable()
 SolarMutexGuard aSolarGuard;
 
 // the DDELink still needs the WrtShell!
-if( m_xDdeLink.is() )
-{
-static_cast( m_xDdeLink.get() )->Disconnect( true 
);
-m_xDdeLink.clear();
-}
+DisconnectDDE();
 
 m_pWrtShell = nullptr;
 
@@ -393,6 +389,15 @@ void SwTransferable::RemoveDDELinkFormat(vcl::Window& rWin)
 CopyToClipboard();
 }
 
+void SwTransferable::DisconnectDDE()
+{
+if( m_xDdeLink.is() )
+{
+static_cast( m_xDdeLink.get() )->Disconnect( true 
);
+m_xDdeLink.clear();
+}
+}
+
 namespace
 {
 //Resolves: fdo#40717 surely when we create a clipboard document we should
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index 86531267af9d..e7e1849a0dc9 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -185,6 +185,8 @@ public:
 
 // remove the DDE-Link format promise
 void RemoveDDELinkFormat(vcl::Window& rWin);
+// disconnect to not receive DataChanged listener notifications
+void DisconnectDDE();
 
 // paste - methods and helper methods for the paste
 static bool IsPaste( const SwWrtShell&, const TransferableDataHelper& );
diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index cbdfb18c7fc9..65a0bf4f23e2 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -112,6 +112,8 @@ class SwView_Impl
 boolm_bSelectObject;
 boolm_bEditingPositionSet;
 
+voidDisconnectTransferableDDE();
+
 public:
 /// Redline author that's specific to this view.
 OUString m_sRedlineAuthor;
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index 71f97dbbc9d1..ed0c3c68fcfc 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -65,6 +65,7 @@ SwView_Impl::~SwView_Impl()
 m_xDispatchProviderInterceptor->Invalidate();
 mxXTextView->Invalidate();
 mxXTextView.clear();
+
 if( mxScanEvtLstnr.is() )
mxScanEvtLstnr->ViewDestroyed();
 if( mxClipEvtLstnr.is() )
@@ -72,6 +73,8 @@ SwView_Impl::~SwView_Impl()
 mxClipEvtLstnr->AddRemoveListener( false );
 mxClipEvtLstnr->ViewDestroyed();
 }
+DisconnectTransferableDDE();
+
 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
 m_xConfigItem.reset();
 #endif
@@ -215,6 +218,16 @@ void SwView_Impl::Invalidate()
 }
 }
 
+void SwView_Impl::DisconnectTransferableDDE()
+{
+for (const auto& xTransferable: mxTransferables)
+{
+rtl::Reference pTransferable = xTransferable.get();
+if(pTransferable)
+pTransferable->DisconnectDDE();
+}
+}
+
 void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
 {
 //prevent removing of the non-referenced SwTransferable


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

2023-11-21 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx |   93 +---
 1 file changed, 60 insertions(+), 33 deletions(-)

New commits:
commit e797f291530fb7f4f6d86646b2fb805a1a78aa3f
Author: Balazs Varga 
AuthorDate: Tue Nov 21 19:53:29 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 21 21:04:20 2023 +0100

tdf#158145 - UI: Part 37 - Unify lockdown behavior of Options dialog

for Writer/Web - Table Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 063d353da0ee..a2af6912b75a 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1468,6 +1468,11 @@ bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* )
 
 void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
 {
+if (const SfxUInt16Item* pItem = rSet->GetItemIfSet(SID_HTML_MODE, false))
+{
+m_bHTMLMode = 0 != (pItem->GetValue() & HTMLMODE_ON);
+}
+
 const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
 if ( rSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT )
 {
@@ -1479,21 +1484,29 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* 
rSet)
 ::SetFieldUnit( *m_xColInsertMF, eFieldUnit );
 }
 
+bool bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Table::Shift::Row::isReadOnly() :
+officecfg::Office::WriterWeb::Table::Shift::Row::isReadOnly();
 m_xRowMoveMF->set_value(m_xRowMoveMF->normalize(pModOpt->GetTableHMove()), 
FieldUnit::TWIP);
-
m_xRowMoveMF->set_sensitive(!officecfg::Office::Writer::Table::Shift::Row::isReadOnly());
-
m_xRowMoveImg->set_visible(officecfg::Office::Writer::Table::Shift::Row::isReadOnly());
+m_xRowMoveMF->set_sensitive(!bReadOnly);
+m_xRowMoveImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Table::Shift::Column::isReadOnly() :
+officecfg::Office::WriterWeb::Table::Shift::Column::isReadOnly();
 m_xColMoveMF->set_value(m_xColMoveMF->normalize(pModOpt->GetTableVMove()), 
FieldUnit::TWIP);
-
m_xColMoveMF->set_sensitive(!officecfg::Office::Writer::Table::Shift::Column::isReadOnly());
-
m_xColMoveImg->set_visible(officecfg::Office::Writer::Table::Shift::Column::isReadOnly());
+m_xColMoveMF->set_sensitive(!bReadOnly);
+m_xColMoveImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Table::Insert::Row::isReadOnly() :
+officecfg::Office::WriterWeb::Table::Insert::Row::isReadOnly();
 
m_xRowInsertMF->set_value(m_xRowInsertMF->normalize(pModOpt->GetTableHInsert()),
 FieldUnit::TWIP);
-
m_xRowInsertMF->set_sensitive(!officecfg::Office::Writer::Table::Insert::Row::isReadOnly());
-
m_xRowInsertImg->set_visible(officecfg::Office::Writer::Table::Insert::Row::isReadOnly());
+m_xRowInsertMF->set_sensitive(!bReadOnly);
+m_xRowInsertImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Table::Insert::Column::isReadOnly() :
+officecfg::Office::WriterWeb::Table::Insert::Column::isReadOnly();
 
m_xColInsertMF->set_value(m_xColInsertMF->normalize(pModOpt->GetTableVInsert()),
 FieldUnit::TWIP);
-
m_xColInsertMF->set_sensitive(!officecfg::Office::Writer::Table::Insert::Column::isReadOnly());
-
m_xColInsertImg->set_visible(officecfg::Office::Writer::Table::Insert::Column::isReadOnly());
+m_xColInsertMF->set_sensitive(!bReadOnly);
+m_xColInsertImg->set_visible(bReadOnly);
 
 switch(pModOpt->GetTableMode())
 {
@@ -1501,10 +1514,6 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* 
rSet)
 case TableChgMode::FixedWidthChangeProp:  
m_xFixPropRB->set_active(true); break;
 case TableChgMode::VarWidthChangeAbs: m_xVarRB->set_active(true); 
break;
 }
-if(const SfxUInt16Item* pItem = rSet->GetItemIfSet(SID_HTML_MODE, false))
-{
-m_bHTMLMode = 0 != (pItem->GetValue() & HTMLMODE_ON);
-}
 
 // hide certain controls for html
 if (m_bHTMLMode)
@@ -1513,7 +1522,9 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
 m_xDontSplitCB->hide();
 }
 
-if (officecfg::Office::Writer::Table::Change::Effect::isReadOnly())
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Table::Change::Effect::isReadOnly() :
+officecfg::Office::WriterWeb::Table::Change::Effect::isReadOnly();
+if (bReadOnly)
 {
 m_xFixRB->set_sensitive(false);
 m_xFixPropRB->set_sensitive(false);
@@ -1524,33 +1535,45 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* 
rSet)
 SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(m_bHTMLMode);
 const SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode;
 
+bReadOnly = !m_bHTMLMode ? 

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

2023-11-21 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx  |   97 ---
 sw/source/uibase/inc/optpage.hxx |1 
 2 files changed, 63 insertions(+), 35 deletions(-)

New commits:
commit 1f94a89429c665104bdf21b5ac48171850fa5afb
Author: Balazs Varga 
AuthorDate: Tue Nov 21 16:31:00 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 21 21:04:01 2023 +0100

tdf#158144 - UI: Part 36 - Unify lockdown behavior of Options dialog

for Writer/Web - Print Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 7062a68716c8..063d353da0ee 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -415,6 +415,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(weld::Container* 
pPage, weld::DialogCon
 , m_sNone(SwResId(SW_STR_NONE))
 , m_bAttrModified(false)
 , m_bPreview(false)
+, m_bHTMLMode(false)
 , m_xGrfCB(m_xBuilder->weld_check_button("graphics"))
 , m_xGrfImg(m_xBuilder->weld_widget("lockgraphics"))
 , m_xCtrlFieldCB(m_xBuilder->weld_check_button("formcontrols"))
@@ -473,6 +474,7 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(weld::Container* 
pPage, weld::DialogCon
 const SfxUInt16Item* pItem = rCoreSet.GetItemIfSet(SID_HTML_MODE, false );
 if(pItem && pItem->GetValue() & HTMLMODE_ON)
 {
+m_bHTMLMode = true;
 m_xLeftPageCB->hide();
 m_xRightPageCB->hide();
 m_xPrintHiddenTextCB->hide();
@@ -577,56 +579,76 @@ boolSwAddPrinterTabPage::FillItemSet( SfxItemSet* 
rCoreSet )
 voidSwAddPrinterTabPage::Reset( const SfxItemSet*  )
 {
 const   SfxItemSet& rSet = GetItemSet();
+bool bReadOnly = false;
 
 if( const SwAddPrinterItem* pAddPrinterAttr = rSet.GetItemIfSet( 
FN_PARAM_ADDPRINTER , false ) )
 {
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Print::Content::Graphic::isReadOnly() :
+
officecfg::Office::WriterWeb::Print::Content::Graphic::isReadOnly();
 m_xGrfCB->set_active(pAddPrinterAttr->m_bPrintGraphic || 
pAddPrinterAttr->m_bPrintDraw);
-
m_xGrfCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Graphic::isReadOnly());
-
m_xGrfImg->set_visible(officecfg::Office::Writer::Print::Content::Graphic::isReadOnly());
+m_xGrfCB->set_sensitive(!bReadOnly);
+m_xGrfImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Print::Content::Control::isReadOnly() :
+
officecfg::Office::WriterWeb::Print::Content::Control::isReadOnly();
 m_xCtrlFieldCB->set_active(   pAddPrinterAttr->m_bPrintControl);
-
m_xCtrlFieldCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Control::isReadOnly());
-
m_xCtrlFieldImg->set_visible(officecfg::Office::Writer::Print::Content::Control::isReadOnly());
+m_xCtrlFieldCB->set_sensitive(!bReadOnly);
+m_xCtrlFieldImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Print::Content::Background::isReadOnly() :
+
officecfg::Office::WriterWeb::Print::Content::Background::isReadOnly();
 m_xBackgroundCB->set_active(
pAddPrinterAttr->m_bPrintPageBackground);
-
m_xBackgroundCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Background::isReadOnly());
-
m_xBackgroundImg->set_visible(officecfg::Office::Writer::Print::Content::Background::isReadOnly());
+m_xBackgroundCB->set_sensitive(!bReadOnly);
+m_xBackgroundImg->set_visible(bReadOnly);
 
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly() :
+
officecfg::Office::WriterWeb::Print::Content::PrintBlack::isReadOnly();
 m_xBlackFontCB->set_active( pAddPrinterAttr->m_bPrintBlackFont);
-
m_xBlackFontCB->set_sensitive(!officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly());
-
m_xBlackFontImg->set_visible(officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly());
+m_xBlackFontCB->set_sensitive(!bReadOnly);
+m_xBlackFontImg->set_visible(bReadOnly);
 
+bReadOnly = 
officecfg::Office::Writer::Print::Content::PrintHiddenText::isReadOnly();
 m_xPrintHiddenTextCB->set_active( pAddPrinterAttr->m_bPrintHiddenText);
-
m_xPrintHiddenTextCB->set_sensitive(!officecfg::Office::Writer::Print::Content::PrintHiddenText::isReadOnly());
-
m_xPrintHiddenTextImg->set_visible(officecfg::Office::Writer::Print::Content::PrintHiddenText::isReadOnly());
+m_xPrintHiddenTextCB->set_sensitive(!bReadOnly);
+m_xPrintHiddenTextImg->set_visible(bReadOnly);
 
+bReadOnly = 
officecfg::Office::Writer::Print::Content::PrintPlaceholders::isReadOnly();
 

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

2023-11-21 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx  |   40 ++-
 sw/source/uibase/inc/optpage.hxx |1 
 2 files changed, 28 insertions(+), 13 deletions(-)

New commits:
commit edf05194527e596e8b32956f7f3f34357f6e4a27
Author: Balazs Varga 
AuthorDate: Tue Nov 21 14:32:21 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 21 21:03:25 2023 +0100

tdf#158141 - UI: Part 34 - Unify lockdown behavior of Options dialog

for Writer/Web - Formatting Aids Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 90ea14acf64f..7062a68716c8 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1560,6 +1560,7 @@ void SwTableOptionsTabPage::PageCreated( const 
SfxAllItemSet& aSet)
 SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet)
 : SfxTabPage(pPage, pController, 
"modules/swriter/ui/optformataidspage.ui", "OptFormatAidsPage", )
 , m_pWrtShell(nullptr)
+, m_bHTMLMode(false)
 , m_xParaCB(m_xBuilder->weld_check_button("paragraph"))
 , m_xParaImg(m_xBuilder->weld_widget("lockparagraph"))
 , m_xSHyphCB(m_xBuilder->weld_check_button("hyphens"))
@@ -1607,6 +1608,8 @@ 
SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w
 if(!pHtmlModeItem || !(pHtmlModeItem->GetValue() & HTMLMODE_ON))
 return;
 
+m_bHTMLMode = true;
+
 m_xTabCB->hide();
 m_xTabLabel->hide();
 m_xCharHiddenCB->hide();
@@ -1721,18 +1724,23 @@ void SwShdwCursorOptionsTabPage::Reset( const 
SfxItemSet* rSet )
 eMode = pItem->GetMode();
 bIsOn = pItem->IsOn();
 }
+
+bool bReadOnly = 
officecfg::Office::Writer::Cursor::DirectCursor::UseDirectCursor::isReadOnly();
 m_xOnOffCB->set_active( bIsOn );
-
m_xOnOffCB->set_sensitive(!officecfg::Office::Writer::Cursor::DirectCursor::UseDirectCursor::isReadOnly());
-
m_xOnOffImg->set_visible(officecfg::Office::Writer::Cursor::DirectCursor::UseDirectCursor::isReadOnly());
+m_xOnOffCB->set_sensitive(!bReadOnly);
+m_xOnOffImg->set_visible(bReadOnly);
 
+bReadOnly = 
officecfg::Office::Writer::Cursor::DirectCursor::Insert::isReadOnly();
 m_xDirectCursorFillMode->set_active( static_cast(eMode) );
-
m_xDirectCursorFillMode->set_sensitive(!officecfg::Office::Writer::Cursor::DirectCursor::Insert::isReadOnly());
-
m_xDirectCursorFillModeImg->set_visible(officecfg::Office::Writer::Cursor::DirectCursor::Insert::isReadOnly());
+m_xDirectCursorFillMode->set_sensitive(!bReadOnly);
+m_xDirectCursorFillModeImg->set_visible(bReadOnly);
 
 if (m_pWrtShell) {
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly()
 :
+
officecfg::Office::WriterWeb::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly();
 m_xMathBaselineAlignmentCB->set_active( 
m_pWrtShell->GetDoc()->getIDocumentSettingAccess().get( 
DocumentSettingId::MATH_BASELINE_ALIGNMENT ) );
-
m_xMathBaselineAlignmentCB->set_sensitive(!officecfg::Office::Writer::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly());
-
m_xMathBaselineAlignmentImg->set_visible(officecfg::Office::Writer::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly());
+m_xMathBaselineAlignmentCB->set_sensitive(!bReadOnly);
+m_xMathBaselineAlignmentImg->set_visible(bReadOnly);
 m_xMathBaselineAlignmentCB->save_state();
 } else {
 m_xMathBaselineAlignmentCB->hide();
@@ -1740,14 +1748,16 @@ void SwShdwCursorOptionsTabPage::Reset( const 
SfxItemSet* rSet )
 
 if( const SfxBoolItem* pItem = rSet->GetItemIfSet( 
FN_PARAM_CRSR_IN_PROTECTED, false ) )
 m_xCursorInProtCB->set_active(pItem->GetValue());
-
m_xCursorInProtCB->set_sensitive(!officecfg::Office::Writer::Cursor::Option::ProtectedArea::isReadOnly());
-
m_xCursorInProtImg->set_visible(officecfg::Office::Writer::Cursor::Option::ProtectedArea::isReadOnly());
+bReadOnly = 
officecfg::Office::Writer::Cursor::Option::ProtectedArea::isReadOnly();
+m_xCursorInProtCB->set_sensitive(!bReadOnly);
+m_xCursorInProtImg->set_visible(bReadOnly);
 m_xCursorInProtCB->save_state();
 
 const SwDocDisplayItem* pDocDisplayAttr = rSet->GetItemIfSet( 
FN_PARAM_DOCDISP, false );
 if(pDocDisplayAttr)
 {
-bool bReadOnly = 
officecfg::Office::Writer::Content::NonprintingCharacter::ParagraphEnd::isReadOnly();
+bReadOnly = !m_bHTMLMode ? 
officecfg::Office::Writer::Content::NonprintingCharacter::ParagraphEnd::isReadOnly()
 :
+
officecfg::Office::WriterWeb::Content::NonprintingCharacter::ParagraphEnd::isReadOnly();
 m_xParaCB->set_active( 

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

2023-11-21 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx   |   36 ++
 sw/source/uibase/inc/optpage.hxx  |1 
 sw/uiconfig/swriter/ui/viewoptionspage.ui |   12 +-
 3 files changed, 39 insertions(+), 10 deletions(-)

New commits:
commit 49c200cf9f3e8f61716a15bf67dee9f54d2931fa
Author: Balazs Varga 
AuthorDate: Tue Nov 21 13:26:01 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 21 21:03:03 2023 +0100

tdf#158140 - UI: Part 33 - Unify lockdown behavior of Options dialog

for Writer/Web - View Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 294e25772da0..90ea14acf64f 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -108,6 +109,7 @@ SwContentOptPage::SwContentOptPage(weld::Container* pPage, 
weld::DialogControlle
 , m_xSettingsLabel(m_xBuilder->weld_label("settingslabel"))
 , m_xMetricLabel(m_xBuilder->weld_label("measureunitlabel"))
 , m_xMetricLB(m_xBuilder->weld_combo_box("measureunit"))
+, m_xMetricImg(m_xBuilder->weld_widget("lockmeasureunit"))
 , m_xShowInlineTooltips(m_xBuilder->weld_check_button("changestooltip"))
 , m_xShowInlineTooltipsImg(m_xBuilder->weld_widget("lockchangestooltip"))
 , 
m_xShowOutlineContentVisibilityButton(m_xBuilder->weld_check_button("outlinecontentvisibilitybutton"))
@@ -203,35 +205,42 @@ static void lcl_SelectMetricLB(weld::ComboBox& rMetric, 
TypedWhichIdis_visible();
 const SwElemItem* pElemAttr = rSet->GetItemIfSet( FN_PARAM_ELEM , false );
 if(pElemAttr)
 {
-bReadOnly = 
officecfg::Office::Writer::Content::Display::Table::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::Table::isReadOnly() :
+
officecfg::Office::WriterWeb::Content::Display::Table::isReadOnly();
 m_xTableCB->set_active(pElemAttr->m_bTable);
 m_xTableCB->set_sensitive(!bReadOnly);
 m_xTableImg->set_visible(bReadOnly);
 
-bReadOnly = 
officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly() :
+
officecfg::Office::WriterWeb::Content::Display::GraphicObject::isReadOnly();
 m_xGrfCB->set_active(pElemAttr->m_bGraphic);
 m_xGrfCB->set_sensitive(!bReadOnly);
 m_xGrfImg->set_visible(bReadOnly);
 
-bReadOnly = 
officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly() :
+
officecfg::Office::WriterWeb::Content::Display::DrawingControl::isReadOnly();
 m_xDrwCB->set_active(pElemAttr->m_bDrawing);
 m_xDrwCB->set_sensitive(!bReadOnly);
 m_xDrwImg->set_visible(bReadOnly);
 
-bReadOnly = 
officecfg::Office::Writer::Content::Display::Note::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::Note::isReadOnly() :
+officecfg::Office::WriterWeb::Content::Display::Note::isReadOnly();
 m_xPostItCB->set_active(pElemAttr->m_bNotes);
 m_xPostItCB->set_sensitive(!bReadOnly);
 m_xPostItCB->set_visible(pElemAttr->m_bNotes);
 
-bReadOnly = 
officecfg::Office::Writer::Layout::Line::Guide::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Line::Guide::isReadOnly() :
+officecfg::Office::WriterWeb::Layout::Line::Guide::isReadOnly();
 m_xCrossCB->set_active(pElemAttr->m_bCrosshair);
 m_xCrossCB->set_sensitive(!bReadOnly);
 m_xCrossImg->set_visible(bReadOnly);
 
-bReadOnly = 
officecfg::Office::Writer::Layout::Window::VerticalRuler::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::VerticalRuler::isReadOnly() :
+
officecfg::Office::WriterWeb::Layout::Window::VerticalRuler::isReadOnly();
 m_xVRulerCBox->set_active(pElemAttr->m_bVertRuler);
 m_xVRulerCBox->set_sensitive(!bReadOnly);
 m_xVRulerImg->set_visible(bReadOnly);
@@ -241,7 +250,8 @@ void SwContentOptPage::Reset(const SfxItemSet* rSet)
 m_xVRulerRightCBox->set_sensitive(!bReadOnly);
 m_xVRulerRightImg->set_visible(bReadOnly);
 
-bReadOnly = 
officecfg::Office::Writer::Layout::Window::SmoothScroll::isReadOnly();
+bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::SmoothScroll::isReadOnly() :
+
officecfg::Office::WriterWeb::Layout::Window::SmoothScroll::isReadOnly();
 

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

2023-11-21 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/mailconfigpage.cxx |   85 -
 sw/source/uibase/inc/mailconfigpage.hxx|7 
 sw/uiconfig/swriter/ui/authenticationsettingsdialog.ui |  159 ++---
 sw/uiconfig/swriter/ui/mailconfigpage.ui   |  124 +++--
 4 files changed, 332 insertions(+), 43 deletions(-)

New commits:
commit ddf9f30869a9808097135f77384e2679c3f73e36
Author: Balazs Varga 
AuthorDate: Mon Nov 20 15:22:11 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 21 12:17:45 2023 +0100

tdf#158137 - UI: Part 32 - Unify lockdown behavior of Options dialog

for Writer - Mail Merge, Email Page.

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

diff --git a/sw/source/ui/config/mailconfigpage.cxx 
b/sw/source/ui/config/mailconfigpage.cxx
index 468d9f761d8a..0bf9633abd1d 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,23 +69,31 @@ class SwAuthenticationSettingsDialog : public 
SfxDialogController
 SwMailMergeConfigItem& m_rConfigItem;
 
 std::unique_ptr m_xAuthenticationCB;
+std::unique_ptr  m_xAuthenticationImg;
 std::unique_ptr m_xSeparateAuthenticationRB;
+std::unique_ptr  m_xSeparateAuthenticationImg;
 std::unique_ptr m_xSMTPAfterPOPRB;
+std::unique_ptr  m_xSMTPAfterPOPImg;
 std::unique_ptr   m_xOutgoingServerFT;
 std::unique_ptr   m_xUserNameFT;
 std::unique_ptr   m_xUserNameED;
+std::unique_ptr  m_xUserNameImg;
 std::unique_ptr   m_xOutPasswordFT;
 std::unique_ptr   m_xOutPasswordED;
 std::unique_ptr   m_xIncomingServerFT;
 std::unique_ptr   m_xServerFT;
 std::unique_ptr   m_xServerED;
+std::unique_ptr  m_xServerImg;
 std::unique_ptr   m_xPortFT;
 std::unique_ptr  m_xPortNF;
+std::unique_ptr  m_xPortImg;
 std::unique_ptr   m_xProtocolFT;
 std::unique_ptr m_xPOP3RB;
+std::unique_ptr  m_xPOP3Img;
 std::unique_ptr m_xIMAPRB;
 std::unique_ptr   m_xInUsernameFT;
 std::unique_ptr   m_xInUsernameED;
+std::unique_ptr  m_xInUsernameImg;
 std::unique_ptr   m_xInPasswordFT;
 std::unique_ptr   m_xInPasswordED;
 std::unique_ptr  m_xOKPB;
@@ -104,13 +113,20 @@ SwMailConfigPage::SwMailConfigPage(weld::Container* 
pPage, weld::DialogControlle
 : SfxTabPage(pPage, pController, "modules/swriter/ui/mailconfigpage.ui", 
"MailConfigPage", )
 , m_pConfigItem(new SwMailMergeConfigItem)
 , m_xDisplayNameED(m_xBuilder->weld_entry("displayname"))
+, m_xDisplayNameImg(m_xBuilder->weld_widget("lockdisplayname"))
 , m_xAddressED(m_xBuilder->weld_entry("address"))
+, m_xAddressImg(m_xBuilder->weld_widget("lockaddress"))
 , m_xReplyToCB(m_xBuilder->weld_check_button("replytocb"))
+, m_xReplyToCBImg(m_xBuilder->weld_widget("lockreplytocb"))
 , m_xReplyToFT(m_xBuilder->weld_label("replyto_label"))
 , m_xReplyToED(m_xBuilder->weld_entry("replyto"))
+, m_xReplyToImg(m_xBuilder->weld_widget("lockreplyto"))
 , m_xServerED(m_xBuilder->weld_entry("server"))
+, m_xServerImg(m_xBuilder->weld_widget("lockserver"))
 , m_xPortNF(m_xBuilder->weld_spin_button("port"))
+, m_xPortImg(m_xBuilder->weld_widget("lockport"))
 , m_xSecureCB(m_xBuilder->weld_check_button("secure"))
+, m_xSecureImg(m_xBuilder->weld_widget("locksecure"))
 , 
m_xServerAuthenticationPB(m_xBuilder->weld_button("serverauthentication"))
 , m_xTestPB(m_xBuilder->weld_button("test"))
 {
@@ -184,16 +200,34 @@ bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ )
 void SwMailConfigPage::Reset( const SfxItemSet* /*rSet*/ )
 {
 m_xDisplayNameED->set_text(m_pConfigItem->GetMailDisplayName());
+
m_xDisplayNameED->set_sensitive(!officecfg::Office::Writer::MailMergeWizard::MailDisplayName::isReadOnly());
+
m_xDisplayNameImg->set_visible(officecfg::Office::Writer::MailMergeWizard::MailDisplayName::isReadOnly());
+
 m_xAddressED->set_text(m_pConfigItem->GetMailAddress());
+
m_xAddressED->set_sensitive(!officecfg::Office::Writer::MailMergeWizard::MailAddress::isReadOnly());
+
m_xAddressImg->set_visible(officecfg::Office::Writer::MailMergeWizard::MailAddress::isReadOnly());
+
+m_xReplyToED->set_text(m_pConfigItem->GetMailReplyTo());
+
m_xReplyToED->set_sensitive(!officecfg::Office::Writer::MailMergeWizard::MailReplyTo::isReadOnly());
+
m_xReplyToImg->set_visible(officecfg::Office::Writer::MailMergeWizard::MailReplyTo::isReadOnly());
 
-m_xReplyToED->set_text(m_pConfigItem->GetMailReplyTo()) ;
 m_xReplyToCB->set_active(m_pConfigItem->IsMailReplyTo());
+

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

2023-11-17 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/wrtsh/wrtsh2.cxx |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit fb789aff45773c2b161376d13dd660b80af0d157
Author: Mike Kaganski 
AuthorDate: Fri Nov 17 12:50:45 2023 +0100
Commit: Mike Kaganski 
CommitDate: Fri Nov 17 14:06:46 2023 +0100

Simplify a bit

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

diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index e3af36a1c54b..029b728bb30a 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -619,13 +619,8 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
 return ;
 
 // The shell could be 0 also!
-if ( dynamic_cast( ) ==  nullptr )
-return;
-
-//A CursorShell is always a WrtShell
-SwWrtShell  = static_cast(rVSh);
-
-::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
+if (auto pSh = dynamic_cast())
+::LoadURL(pSh->GetView(), rURL, nFilter, rTargetFrameName);
 }
 
 void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,


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

2023-11-16 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/txtfrm.hxx   |1 +
 sw/source/core/text/txtfrm.cxx  |   25 -
 sw/source/core/text/xmldump.cxx |   21 -
 3 files changed, 25 insertions(+), 22 deletions(-)

New commits:
commit 3526faf09bd86a4f18fe606a3818e816c41d8c85
Author: Miklos Vajna 
AuthorDate: Thu Nov 16 19:57:10 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 17 08:30:25 2023 +0100

sw: extract SwTextFrame::dumpAsXmlAttributes() from SwFrame

Allows getting rid of a static cast.

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

diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index d73c2efa499f..aa2246727fc2 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -809,6 +809,7 @@ public:
 static SwView* GetView();
 
 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
+void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
 };
 
 //use this to protect a SwTextFrame for a given scope from getting merged with
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 470ce8b528fd..f043530de702 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -793,10 +793,33 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, 
SwFrame* pSib,
 m_pMergedPara = CheckParaRedlineMerge(*this, *pNode, eMode);
 }
 
+void SwTextFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+SwContentFrame::dumpAsXmlAttributes(writer);
+
+const SwTextNode *pTextNode = GetTextNodeFirst();
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" 
), "%" SAL_PRIdINT32, sal_Int32(pTextNode->GetIndex()) );
+
+OString aMode = "Horizontal";
+if (IsVertLRBT())
+{
+aMode = "VertBTLR";
+}
+else if (IsVertLR())
+{
+aMode = "VertLR";
+}
+else if (IsVertical())
+{
+aMode = "Vertical";
+}
+(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), 
BAD_CAST(aMode.getStr()));
+}
+
 void SwTextFrame::dumpAsXml(xmlTextWriterPtr writer) const
 {
 (void)xmlTextWriterStartElement(writer, reinterpret_cast("txt"));
-SwFrame::dumpAsXmlAttributes( writer );
+dumpAsXmlAttributes( writer );
 if ( HasFollow() )
 (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), 
"%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
 
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 445a0e306336..b5cde782775f 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -213,27 +213,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer 
) const
 SwSectionNode const*const pNode(pFrame->GetSection() ? 
pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr);
 (void)xmlTextWriterWriteFormatAttribute(writer, 
BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? 
sal_Int32(pNode->GetIndex()) : -1);
 }
-if ( IsTextFrame(  ) )
-{
-const SwTextFrame *pTextFrame = static_cast(this);
-const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst();
-(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( 
"txtNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(pTextNode->GetIndex()) );
-
-OString aMode = "Horizontal";
-if (IsVertLRBT())
-{
-aMode = "VertBTLR";
-}
-else if (IsVertLR())
-{
-aMode = "VertLR";
-}
-else if (IsVertical())
-{
-aMode = "Vertical";
-}
-(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), 
BAD_CAST(aMode.getStr()));
-}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-16 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/wrtsh/wrtsh2.cxx |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 32535dfa82200b54296838b52285c054fbe5e51d
Author: Caolán McNamara 
AuthorDate: Wed Nov 15 12:55:58 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 16 12:19:24 2023 +0100

reuse AllowedLinkProtocolFromDocument in writer

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

diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 3bf614370b97..91d97c119064 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -564,6 +564,16 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
 if ( dynamic_cast( ) ==  nullptr )
 return;
 
+//A CursorShell is always a WrtShell
+SwWrtShell  = static_cast(rVSh);
+
+SwDocShell* pDShell = rSh.GetView().GetDocShell();
+OSL_ENSURE( pDShell, "No DocShell?!");
+SfxViewFrame& rViewFrame = rSh.GetView().GetViewFrame();
+
+if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, 
rViewFrame.GetFrameWeld()))
+return;
+
 // We are doing tiledRendering, let the client handles the URL loading,
 // unless we are jumping to a TOC mark.
 if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
@@ -572,11 +582,6 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
 return;
 }
 
-//A CursorShell is always a WrtShell
-SwWrtShell  = static_cast(rVSh);
-
-SwDocShell* pDShell = rSh.GetView().GetDocShell();
-OSL_ENSURE( pDShell, "No DocShell?!");
 OUString sTargetFrame(rTargetFrameName);
 if (sTargetFrame.isEmpty() && pDShell)
 {
@@ -591,7 +596,6 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
 OUString sReferer;
 if( pDShell && pDShell->GetMedium() )
 sReferer = pDShell->GetMedium()->GetName();
-SfxViewFrame& rViewFrame = rSh.GetView().GetViewFrame();
 SfxFrameItem aView( SID_DOCFRAME,  );
 SfxStringItem aName( SID_FILE_NAME, rURL );
 SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );


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

2023-11-16 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/fly.cxx |4 ++--
 sw/source/uibase/docvw/UnfloatTableButton.cxx |5 -
 sw/source/uibase/inc/FrameControl.hxx |1 +
 sw/source/uibase/inc/UnfloatTableButton.hxx   |4 ++--
 4 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 2f42d8acd2d06f848c9e680c42a0f7834a9a641f
Author: Miklos Vajna 
AuthorDate: Thu Nov 16 08:29:26 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 16 10:09:06 2023 +0100

sw floattable, delete UI: fix unfloat button for cant-split frames

Open sw/qa/extras/uiwriter/data/unfloatable_floating_table.odt, select
the TextFrame, click on the "unfloat" button that appears, then nothing
happens.

This is a problem since commit 51379fb3d46e5891bdaea0122bd62b0753663da3
(weld writer's FrameControl MenuButtons, 2020-12-03), the old
MouseButtonDown() callback is never invoked.

Fix the problem similar to what SwHeaderFooterWin does, which works:
instead of overriding the dead MouseButtonDown(), explicitly connect the
click handler to the weld::Button widget.

Also adjust SwFlyFrame::ActiveUnfloatButton() to use the welded
callback, this way CppunitTest_sw_uiwriter2's testUnfloating covers the
fix.

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

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 78aa7f604b20..33880623a481 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2105,9 +2105,9 @@ void SwFlyFrame::ActiveUnfloatButton(SwWrtShell* pWrtSh)
 SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
 SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
 SwFrameControlPtr pControl = 
rMngr.GetControl(FrameControlType::FloatingTable, this);
-if (pControl && pControl->GetWindow())
+if (pControl && pControl->GetIFacePtr())
 {
-pControl->GetWindow()->MouseButtonDown(MouseEvent());
+pControl->GetIFacePtr()->GetButton()->clicked();
 }
 }
 
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx 
b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index e1cdf8c7aad9..30d1d97aaacc 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -53,9 +53,12 @@ UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, 
const SwFrame* pFram
 {
 m_xPushButton->set_accessible_name(m_sLabel);
 m_xVirDev = m_xPushButton->create_virtual_device();
+m_xPushButton->connect_clicked(LINK(this, UnfloatTableButton, ClickHdl));
 SetVirDevFont();
 }
 
+weld::Button* UnfloatTableButton::GetButton() { return m_xPushButton.get(); }
+
 UnfloatTableButton::~UnfloatTableButton() { disposeOnce(); }
 
 void UnfloatTableButton::dispose()
@@ -89,7 +92,7 @@ void UnfloatTableButton::SetOffset(Point aTopRightPixel)
 PaintButton();
 }
 
-void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
+IMPL_LINK_NOARG(UnfloatTableButton, ClickHdl, weld::Button&, void)
 {
 assert(GetFrame()->IsFlyFrame());
 // const_cast is needed because of bad design of ISwFrameControl and 
derived classes
diff --git a/sw/source/uibase/inc/FrameControl.hxx 
b/sw/source/uibase/inc/FrameControl.hxx
index 7bdc9ff6bb8b..4043f834f94b 100644
--- a/sw/source/uibase/inc/FrameControl.hxx
+++ b/sw/source/uibase/inc/FrameControl.hxx
@@ -32,6 +32,7 @@ public:
 
 virtual const SwFrame* GetFrame() = 0;
 virtual SwEditWin*   GetEditWin() = 0;
+virtual weld::Button* GetButton() { return nullptr; };
 };
 
 class SwFrameControl final
diff --git a/sw/source/uibase/inc/UnfloatTableButton.hxx 
b/sw/source/uibase/inc/UnfloatTableButton.hxx
index 164b240f28b1..8803b5169173 100644
--- a/sw/source/uibase/inc/UnfloatTableButton.hxx
+++ b/sw/source/uibase/inc/UnfloatTableButton.hxx
@@ -34,14 +34,14 @@ public:
 
 void SetOffset(Point aTopRightPixel);
 
-virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
-
 virtual void ShowAll(bool bShow) override;
 virtual bool Contains(const Point& rDocPt) const override;
 
 virtual void SetReadonly(bool bReadonly) override;
+weld::Button* GetButton() override;
 
 private:
+DECL_LINK(ClickHdl, weld::Button&, void);
 void PaintButton();
 };
 


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

2023-11-15 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/config/viewopt.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 4b9394c6d00bd2d041457c03c93066ed8eb5cb15
Author: Caolán McNamara 
AuthorDate: Wed Nov 15 10:29:54 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 15 13:07:15 2023 +0100

cid#1550112 Uninitialized scalar field

since:

commit 8bf614179f5664d7cdd49db41ef462073cc8608d
Date:   Thu Nov 9 16:00:10 2023 +0100

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

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

diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 36fdf1fd4484..538efd4a86f0 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -337,6 +337,8 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt)
 m_bShowPlaceHolderFields = rVOpt.m_bShowPlaceHolderFields;
 m_bIdle   = rVOpt.m_bIdle;
 m_nDefaultAnchor  = rVOpt.m_nDefaultAnchor;
+m_nTocEntryLvl = rVOpt.m_nTocEntryLvl;
+m_nIdxEntryLvl = rVOpt.m_nIdxEntryLvl;
 m_aColorConfig= rVOpt.m_aColorConfig;
 
 #ifdef DBG_UTIL


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

2023-11-14 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx |   31 ++
 sw/source/uibase/inc/optpage.hxx|5 +
 sw/uiconfig/swriter/ui/optcomparison.ui |   93 +---
 3 files changed, 121 insertions(+), 8 deletions(-)

New commits:
commit bfee998e71e2b7e8bcf4a366a00219a9b0f59035
Author: Balazs Varga 
AuthorDate: Tue Nov 14 14:32:20 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 14 19:47:26 2023 +0100

tdf#158134 - UI: Part 29 - Unify lockdown behavior of Options dialog

for Writer - Comparison Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index add7bed5a079..294e25772da0 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -2457,10 +2457,15 @@ 
SwCompareOptionsTabPage::SwCompareOptionsTabPage(weld::Container* pPage, weld::D
 , m_xAutoRB(m_xBuilder->weld_radio_button("auto"))
 , m_xWordRB(m_xBuilder->weld_radio_button("byword"))
 , m_xCharRB(m_xBuilder->weld_radio_button("bycharacter"))
+, m_xCompareModeImg(m_xBuilder->weld_widget("lockcomparemode"))
 , m_xRsidCB(m_xBuilder->weld_check_button("useRSID"))
+, m_xRsidImg(m_xBuilder->weld_widget("lockuseRSID"))
 , m_xIgnoreCB(m_xBuilder->weld_check_button("ignore"))
+, m_xIgnoreImg(m_xBuilder->weld_widget("lockignore"))
 , m_xLenNF(m_xBuilder->weld_spin_button("ignorelen"))
+, m_xLenImg(m_xBuilder->weld_widget("lockignorelen"))
 , m_xStoreRsidCB(m_xBuilder->weld_check_button("storeRSID"))
+, m_xStoreRsidImg(m_xBuilder->weld_widget("lockstoreRSID"))
 {
 Link aLnk( LINK( this, SwCompareOptionsTabPage, 
ComparisonHdl ) );
 m_xAutoRB->connect_toggled( aLnk );
@@ -2581,22 +2586,48 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
 m_xIgnoreCB->set_sensitive(true);
 m_xLenNF->set_sensitive(true);
 }
+
+if (officecfg::Office::Writer::Comparison::Mode::isReadOnly())
+{
+m_xAutoRB->set_sensitive(false);
+m_xWordRB->set_sensitive(false);
+m_xCharRB->set_sensitive(false);
+m_xCompareModeImg->set_visible(true);
+}
+
 m_xAutoRB->save_state();
 m_xWordRB->save_state();
 m_xCharRB->save_state();
 
 m_xRsidCB->set_active( pOpt->IsUseRsid() );
+if (officecfg::Office::Writer::Comparison::UseRSID::isReadOnly())
+{
+m_xRsidCB->set_sensitive(false);
+m_xRsidImg->set_visible(true);
+}
 m_xRsidCB->save_state();
 
 m_xIgnoreCB->set_active( pOpt->IsIgnorePieces() );
+if (officecfg::Office::Writer::Comparison::IgnorePieces::isReadOnly())
+{
+m_xIgnoreCB->set_sensitive(false);
+m_xIgnoreImg->set_visible(true);
+}
 m_xIgnoreCB->save_state();
 
 m_xLenNF->set_sensitive( m_xIgnoreCB->get_active() && eCmpMode != 
SwCompareMode::Auto );
 
 m_xLenNF->set_value( pOpt->GetPieceLen() );
+if (officecfg::Office::Writer::Comparison::IgnoreLength::isReadOnly())
+{
+m_xLenNF->set_sensitive(false);
+m_xLenImg->set_visible(true);
+}
 m_xLenNF->save_value();
 
 m_xStoreRsidCB->set_active(pOpt->IsStoreRsid());
+
m_xStoreRsidCB->set_sensitive(!officecfg::Office::Writer::Comparison::StoreRSID::isReadOnly());
+
m_xStoreRsidImg->set_visible(officecfg::Office::Writer::Comparison::StoreRSID::isReadOnly());
 m_xStoreRsidCB->save_state();
 }
 
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index 9027c74ab1bf..ba9c585d9d99 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -451,10 +451,15 @@ class SwCompareOptionsTabPage final : public SfxTabPage
 std::unique_ptr m_xAutoRB;
 std::unique_ptr m_xWordRB;
 std::unique_ptr m_xCharRB;
+std::unique_ptr m_xCompareModeImg;
 std::unique_ptr m_xRsidCB;
+std::unique_ptr m_xRsidImg;
 std::unique_ptr m_xIgnoreCB;
+std::unique_ptr m_xIgnoreImg;
 std::unique_ptr m_xLenNF;
+std::unique_ptr m_xLenImg;
 std::unique_ptr m_xStoreRsidCB;
+std::unique_ptr m_xStoreRsidImg;
 
 DECL_LINK(ComparisonHdl, weld::Toggleable&, void);
 DECL_LINK(IgnoreHdl, weld::Toggleable&, void);
diff --git a/sw/uiconfig/swriter/ui/optcomparison.ui 
b/sw/uiconfig/swriter/ui/optcomparison.ui
index 8010cbc0a9a2..afaab6e4bbd1 100644
--- a/sw/uiconfig/swriter/ui/optcomparison.ui
+++ b/sw/uiconfig/swriter/ui/optcomparison.ui
@@ -22,7 +22,7 @@
 0
 none
 
-  
+  
   
 True
 False
@@ -40,7 +40,7 @@
 True
   
   
-0
+1
 0
   
 
@@ -55,7 +55,7 @@
 auto
   
   
-0
+1
 

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

2023-11-13 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx|   65 
 sw/source/uibase/inc/optpage.hxx   |   14 +
 sw/uiconfig/swriter/ui/printoptionspage.ui |  389 +
 3 files changed, 369 insertions(+), 99 deletions(-)

New commits:
commit d93d11529e7922fe391edcc839af8a3b4044b809
Author: Balazs Varga 
AuthorDate: Mon Nov 13 18:01:45 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 14 08:22:10 2023 +0100

tdf#158130 - UI: Part 26 - Unify lockdown behavior of Options dialog

for Writer - Print Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 1abc9d46d334..8506d8773d55 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -399,25 +399,39 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(weld::Container* 
pPage, weld::DialogCon
 , m_bAttrModified(false)
 , m_bPreview(false)
 , m_xGrfCB(m_xBuilder->weld_check_button("graphics"))
+, m_xGrfImg(m_xBuilder->weld_widget("lockgraphics"))
 , m_xCtrlFieldCB(m_xBuilder->weld_check_button("formcontrols"))
+, m_xCtrlFieldImg(m_xBuilder->weld_widget("lockformcontrols"))
 , m_xBackgroundCB(m_xBuilder->weld_check_button("background"))
+, m_xBackgroundImg(m_xBuilder->weld_widget("lockbackground"))
 , m_xBlackFontCB(m_xBuilder->weld_check_button("inblack"))
+, m_xBlackFontImg(m_xBuilder->weld_widget("lockinblack"))
 , m_xPrintHiddenTextCB(m_xBuilder->weld_check_button("hiddentext"))
+, m_xPrintHiddenTextImg(m_xBuilder->weld_widget("lockhiddentext"))
 , 
m_xPrintTextPlaceholderCB(m_xBuilder->weld_check_button("textplaceholder"))
+, 
m_xPrintTextPlaceholderImg(m_xBuilder->weld_widget("locktextplaceholder"))
 , m_xPagesFrame(m_xBuilder->weld_widget("pagesframe"))
 , m_xLeftPageCB(m_xBuilder->weld_check_button("leftpages"))
+, m_xLeftPageImg(m_xBuilder->weld_widget("lockleftpages"))
 , m_xRightPageCB(m_xBuilder->weld_check_button("rightpages"))
+, m_xRightPageImg(m_xBuilder->weld_widget("lockrightpages"))
 , m_xProspectCB(m_xBuilder->weld_check_button("brochure"))
+, m_xProspectImg(m_xBuilder->weld_widget("lockbrochure"))
 , m_xProspectCB_RTL(m_xBuilder->weld_check_button("rtl"))
+, m_xProspectImg_RTL(m_xBuilder->weld_widget("lockrtl"))
 , m_xCommentsFrame(m_xBuilder->weld_widget("commentsframe"))
 , m_xNoRB(m_xBuilder->weld_radio_button("none"))
 , m_xOnlyRB(m_xBuilder->weld_radio_button("only"))
 , m_xEndRB(m_xBuilder->weld_radio_button("end"))
 , m_xEndPageRB(m_xBuilder->weld_radio_button("endpage"))
 , m_xInMarginsRB(m_xBuilder->weld_radio_button("inmargins"))
+, m_xMarginsImg(m_xBuilder->weld_widget("lockcomments"))
 , m_xPrintEmptyPagesCB(m_xBuilder->weld_check_button("blankpages"))
+, m_xPrintEmptyPagesImg(m_xBuilder->weld_widget("lockblankpages"))
 , m_xPaperFromSetupCB(m_xBuilder->weld_check_button("papertray"))
+, m_xPaperFromSetupImg(m_xBuilder->weld_widget("lockpapertray"))
 , m_xFaxLB(m_xBuilder->weld_combo_box("fax"))
+, m_xFaxImg(m_xBuilder->weld_widget("lockfax"))
 {
 Link aLk = LINK( this, SwAddPrinterTabPage, 
AutoClickHdl);
 m_xGrfCB->connect_toggled( aLk );
@@ -550,32 +564,79 @@ voidSwAddPrinterTabPage::Reset( const SfxItemSet*  )
 if( const SwAddPrinterItem* pAddPrinterAttr = rSet.GetItemIfSet( 
FN_PARAM_ADDPRINTER , false ) )
 {
 m_xGrfCB->set_active(pAddPrinterAttr->m_bPrintGraphic || 
pAddPrinterAttr->m_bPrintDraw);
+
m_xGrfCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Graphic::isReadOnly());
+
m_xGrfImg->set_visible(officecfg::Office::Writer::Print::Content::Graphic::isReadOnly());
+
 m_xCtrlFieldCB->set_active(   pAddPrinterAttr->m_bPrintControl);
+
m_xCtrlFieldCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Control::isReadOnly());
+
m_xCtrlFieldImg->set_visible(officecfg::Office::Writer::Print::Content::Control::isReadOnly());
+
 m_xBackgroundCB->set_active(
pAddPrinterAttr->m_bPrintPageBackground);
+
m_xBackgroundCB->set_sensitive(!officecfg::Office::Writer::Print::Content::Background::isReadOnly());
+
m_xBackgroundImg->set_visible(officecfg::Office::Writer::Print::Content::Background::isReadOnly());
+
 m_xBlackFontCB->set_active( pAddPrinterAttr->m_bPrintBlackFont);
+
m_xBlackFontCB->set_sensitive(!officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly());
+
m_xBlackFontImg->set_visible(officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly());
+
 m_xPrintHiddenTextCB->set_active( pAddPrinterAttr->m_bPrintHiddenText);
+

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

2023-11-13 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx  |   49 
 sw/source/uibase/inc/optpage.hxx |   10 +
 sw/uiconfig/swriter/ui/optfonttabpage.ui |  172 +++
 3 files changed, 213 insertions(+), 18 deletions(-)

New commits:
commit 4cf54aa70a73b000c6dbf604a2d69f287644756e
Author: Balazs Varga 
AuthorDate: Mon Nov 13 14:39:42 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 14 08:21:54 2023 +0100

tdf#158010 - UI: Part 25 - Unify lockdown behavior of Options dialog

for Writer - Basic Fonts Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 5628f2b1570a..1abc9d46d334 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -653,15 +653,25 @@ SwStdFontTabPage::SwStdFontTabPage(weld::Container* 
pPage, weld::DialogControlle
 , m_sScriptComplex(SwResId(ST_SCRIPT_CTL))
 , m_xLabelFT(m_xBuilder->weld_label("label1"))
 , m_xStandardBox(m_xBuilder->weld_combo_box("standardbox"))
+, m_xStandardBoxImg(m_xBuilder->weld_widget("lockstandardbox"))
 , m_xStandardHeightLB(new 
FontSizeBox(m_xBuilder->weld_combo_box("standardheight")))
+, m_xStandardHeightImg(m_xBuilder->weld_widget("lockstandardheight"))
 , m_xTitleBox(m_xBuilder->weld_combo_box("titlebox"))
+, m_xTitleBoxImg(m_xBuilder->weld_widget("locktitlebox"))
 , m_xTitleHeightLB(new 
FontSizeBox(m_xBuilder->weld_combo_box("titleheight")))
+, m_xTitleHeightImg(m_xBuilder->weld_widget("locktitleheight"))
 , m_xListBox(m_xBuilder->weld_combo_box("listbox"))
+, m_xListBoxImg(m_xBuilder->weld_widget("locklistbox"))
 , m_xListHeightLB(new 
FontSizeBox(m_xBuilder->weld_combo_box("listheight")))
+, m_xListHeightImg(m_xBuilder->weld_widget("locklistheight"))
 , m_xLabelBox(m_xBuilder->weld_combo_box("labelbox"))
+, m_xLabelBoxImg(m_xBuilder->weld_widget("locklabelbox"))
 , m_xLabelHeightLB(new 
FontSizeBox(m_xBuilder->weld_combo_box("labelheight")))
+, m_xLabelHeightImg(m_xBuilder->weld_widget("locklabelheight"))
 , m_xIdxBox(m_xBuilder->weld_combo_box("idxbox"))
+, m_xIdxBoxImg(m_xBuilder->weld_widget("lockidxbox"))
 , m_xIndexHeightLB(new 
FontSizeBox(m_xBuilder->weld_combo_box("indexheight")))
+, m_xIndexHeightImg(m_xBuilder->weld_widget("lockindexheight"))
 , m_xStandardPB(m_xBuilder->weld_button("standard"))
 {
 m_xStandardBox->make_sorted();
@@ -1036,6 +1046,45 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
 m_xLabelHeightLB->set_value( CalcToPoint( nLabelHeight   , 
MapUnit::MapTwip, 10 ));
 m_xIndexHeightLB->set_value( CalcToPoint( nIndexHeight   , 
MapUnit::MapTwip, 10 ));
 
+
+if (m_nFontGroup == FONT_GROUP_DEFAULT)
+{
+bool bReadonly = 
officecfg::Office::Writer::DefaultFont::Standard::isReadOnly();
+m_xStandardBox->set_sensitive(!bReadonly);
+m_xStandardBoxImg->set_visible(bReadonly);
+bReadonly = 
officecfg::Office::Writer::DefaultFont::StandardHeight::isReadOnly();
+m_xStandardHeightLB->set_sensitive(!bReadonly);
+m_xStandardHeightImg->set_visible(bReadonly);
+
+bReadonly = 
officecfg::Office::Writer::DefaultFont::Heading::isReadOnly();
+m_xTitleBox->set_sensitive(!bReadonly);
+m_xTitleBoxImg->set_visible(bReadonly);
+bReadonly = 
officecfg::Office::Writer::DefaultFont::HeadingHeight::isReadOnly();
+m_xTitleHeightLB->set_sensitive(!bReadonly);
+m_xTitleHeightImg->set_visible(bReadonly);
+
+bReadonly = officecfg::Office::Writer::DefaultFont::List::isReadOnly();
+m_xListBox->set_sensitive(!bReadonly);
+m_xListBoxImg->set_visible(bReadonly);
+bReadonly = 
officecfg::Office::Writer::DefaultFont::ListHeight::isReadOnly();
+m_xListHeightLB->set_sensitive(!bReadonly);
+m_xListHeightImg->set_visible(bReadonly);
+
+bReadonly = 
officecfg::Office::Writer::DefaultFont::Caption::isReadOnly();
+m_xLabelBox->set_sensitive(!bReadonly);
+m_xLabelBoxImg->set_visible(bReadonly);
+bReadonly = 
officecfg::Office::Writer::DefaultFont::CaptionHeight::isReadOnly();
+m_xLabelHeightLB->set_sensitive(!bReadonly);
+m_xLabelHeightImg->set_visible(bReadonly);
+
+bReadonly = 
officecfg::Office::Writer::DefaultFont::Index::isReadOnly();
+m_xIdxBox->set_sensitive(!bReadonly);
+m_xIdxBoxImg->set_visible(bReadonly);
+bReadonly = 
officecfg::Office::Writer::DefaultFont::IndexHeight::isReadOnly();
+m_xIndexHeightLB->set_sensitive(!bReadonly);
+m_xIndexHeightImg->set_visible(bReadonly);
+}
+
 m_xStandardBox->save_value();
 m_xTitleBox->save_value();
 m_xListBox->save_value();
diff --git a/sw/source/uibase/inc/optpage.hxx 

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

2023-11-13 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx |   57 +
 sw/source/uibase/inc/optpage.hxx|   13 +
 sw/uiconfig/swriter/ui/optformataidspage.ui |  267 +---
 3 files changed, 316 insertions(+), 21 deletions(-)

New commits:
commit a598de5b6ed6f161844e01f7be7164a65927caee
Author: Balazs Varga 
AuthorDate: Fri Nov 10 15:57:57 2023 +0100
Commit: Balazs Varga 
CommitDate: Mon Nov 13 09:20:27 2023 +0100

tdf#158009 - UI: Part 24 - Unify lockdown behavior of Options dialog

for Writer - Format Aids Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 6fb499f455ad..5628f2b1570a 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1379,23 +1379,36 @@ 
SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage(weld::Container* pPage, w
 : SfxTabPage(pPage, pController, 
"modules/swriter/ui/optformataidspage.ui", "OptFormatAidsPage", )
 , m_pWrtShell(nullptr)
 , m_xParaCB(m_xBuilder->weld_check_button("paragraph"))
+, m_xParaImg(m_xBuilder->weld_widget("lockparagraph"))
 , m_xSHyphCB(m_xBuilder->weld_check_button("hyphens"))
+, m_xSHyphImg(m_xBuilder->weld_widget("lockhyphens"))
 , m_xSpacesCB(m_xBuilder->weld_check_button("spaces"))
+, m_xSpacesImg(m_xBuilder->weld_widget("lockspaces"))
 , m_xHSpacesCB(m_xBuilder->weld_check_button("nonbreak"))
+, m_xHSpacesImg(m_xBuilder->weld_widget("locknonbreak"))
 , m_xTabCB(m_xBuilder->weld_check_button("tabs"))
+, m_xTabImg(m_xBuilder->weld_widget("locktabs"))
 , m_xTabLabel(m_xBuilder->weld_label("tabs_label"))
 , m_xBreakCB(m_xBuilder->weld_check_button("break"))
+, m_xBreakImg(m_xBuilder->weld_widget("lockbreak"))
 , m_xCharHiddenCB(m_xBuilder->weld_check_button("hiddentext"))
+, m_xCharHiddenImg(m_xBuilder->weld_widget("lockhiddentext"))
 , m_xBookmarkCB(m_xBuilder->weld_check_button("bookmarks"))
+, m_xBookmarkImg(m_xBuilder->weld_widget("lockbookmarks"))
 , m_xBookmarkLabel(m_xBuilder->weld_label("bookmarks_label"))
 , m_xDirectCursorFrame(m_xBuilder->weld_frame("directcrsrframe"))
 , m_xOnOffCB(m_xBuilder->weld_check_button("cursoronoff"))
+, m_xOnOffImg(m_xBuilder->weld_widget("lockcursoronoff"))
 , 
m_xDirectCursorFillMode(m_xBuilder->weld_combo_box("cxDirectCursorFillMode"))
+, m_xDirectCursorFillModeImg(m_xBuilder->weld_widget("lockfillmode"))
 , m_xCursorProtFrame(m_xBuilder->weld_frame("crsrprotframe"))
 , m_xImageFrame(m_xBuilder->weld_frame("frmImage"))
 , m_xCursorInProtCB(m_xBuilder->weld_check_button("cursorinprot"))
+, m_xCursorInProtImg(m_xBuilder->weld_widget("lockcursorinprot"))
 , m_xDefaultAnchorType(m_xBuilder->weld_combo_box("cxDefaultAnchor"))
+, m_xDefaultAnchorTypeImg(m_xBuilder->weld_widget("lockAnchor"))
 , m_xMathBaselineAlignmentCB(m_xBuilder->weld_check_button("mathbaseline"))
+, m_xMathBaselineAlignmentImg(m_xBuilder->weld_widget("lockmathbaseline"))
 {
 SwFillMode eMode = SwFillMode::Tab;
 bool bIsOn = false;
@@ -1527,10 +1540,17 @@ void SwShdwCursorOptionsTabPage::Reset( const 
SfxItemSet* rSet )
 bIsOn = pItem->IsOn();
 }
 m_xOnOffCB->set_active( bIsOn );
+
m_xOnOffCB->set_sensitive(!officecfg::Office::Writer::Cursor::DirectCursor::UseDirectCursor::isReadOnly());
+
m_xOnOffImg->set_visible(officecfg::Office::Writer::Cursor::DirectCursor::UseDirectCursor::isReadOnly());
 
 m_xDirectCursorFillMode->set_active( static_cast(eMode) );
+
m_xDirectCursorFillMode->set_sensitive(!officecfg::Office::Writer::Cursor::DirectCursor::Insert::isReadOnly());
+
m_xDirectCursorFillModeImg->set_visible(officecfg::Office::Writer::Cursor::DirectCursor::Insert::isReadOnly());
+
 if (m_pWrtShell) {
 m_xMathBaselineAlignmentCB->set_active( 
m_pWrtShell->GetDoc()->getIDocumentSettingAccess().get( 
DocumentSettingId::MATH_BASELINE_ALIGNMENT ) );
+
m_xMathBaselineAlignmentCB->set_sensitive(!officecfg::Office::Writer::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly());
+
m_xMathBaselineAlignmentImg->set_visible(officecfg::Office::Writer::Layout::Other::IsAlignMathObjectsToBaseline::isReadOnly());
 m_xMathBaselineAlignmentCB->save_state();
 } else {
 m_xMathBaselineAlignmentCB->hide();
@@ -1538,20 +1558,57 @@ void SwShdwCursorOptionsTabPage::Reset( const 
SfxItemSet* rSet )
 
 if( const SfxBoolItem* pItem = rSet->GetItemIfSet( 
FN_PARAM_CRSR_IN_PROTECTED, false ) )
 m_xCursorInProtCB->set_active(pItem->GetValue());
+
m_xCursorInProtCB->set_sensitive(!officecfg::Office::Writer::Cursor::Option::ProtectedArea::isReadOnly());
+

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

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

New commits:
commit 79f92d09ec52f0777fc03ff1d057a11b45e73f6d
Author: Julien Nabet 
AuthorDate: Sat Nov 11 16:00:58 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Nov 12 21:57:33 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 

diff --git a/sw/source/ui/misc/translatelangselect.cxx 
b/sw/source/ui/misc/translatelangselect.cxx
index 8036cd11dec3..7b3c35528e0a 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);
@@ -157,6 +159,7 @@ IMPL_LINK_NOARG(SwTranslateLangSelectDlg, 
LangSelectTranslateHdl, weld::Button&,
 SwTranslateHelper::TranslateAPIConfig aConfig({ aAPIUrl, aAuthKey, 
aTargetLang });
 SwTranslateHelper::TranslateDocumentCancellable(m_rWrtSh, aConfig, 
m_bCancelTranslation);
 m_xDialog->response(RET_OK);
+m_bTranslationStarted = false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-10 Thread Matt K (via logerrit)
 sw/source/core/txtnode/ndtxt.cxx |   28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

New commits:
commit 0c3b89da7cde9866bf3174a6276736c76efb8356
Author: Matt K 
AuthorDate: Thu Aug 3 00:06:24 2023 -0500
Commit: Mike Kaganski 
CommitDate: Fri Nov 10 19:05:13 2023 +0100

tdf#62603 Fix find/replace to not extend font attributes

This change modifies the logic of the core replace code
to now not replace the 1st character and extend its
attributes, but instead to actually replace characters
to keep respective formatting.  Additional checks
are made for whether the replacement was shorter or
longer than the found text, and to handle trimming
or appending the final portions as needed.

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

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index af9b5f72fc92..541e3fd5049f 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3849,19 +3849,27 @@ void SwTextNode::ReplaceText( const SwContentIndex& 
rStart, const sal_Int32 nDel
 bool bOldExpFlg = IsIgnoreDontExpand();
 SetIgnoreDontExpand( true );
 
-if (nLen && sInserted.getLength())
+const sal_Int32 nInsLen = sInserted.getLength();
+if (nLen && nInsLen)
 {
-// Replace the 1st char, then delete the rest and insert.
-// This way the attributes of the 1st char are expanded!
-m_Text = m_Text.replaceAt(nStartPos, 1, sInserted.subView(0, 1));
+m_Text = m_Text.replaceAt(nStartPos, nLen, sInserted);
 
-++const_cast(rStart);
-m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, u"");
-Update(rStart, nLen - 1, UpdateMode::Negative);
+if (nLen > nInsLen) // short insert
+{
+// delete up to the point that the user specified
+const SwContentIndex aNegIdx(rStart, nInsLen);
+Update(aNegIdx, nLen - nInsLen, UpdateMode::Negative);
+}
+else if (nLen < nInsLen) // long insert
+{
+const SwContentIndex aIdx(rStart, nLen);
+Update(aIdx, nInsLen - nLen, UpdateMode::Replace);
+}
 
-std::u16string_view aTmpText( sInserted.subView(1) );
-m_Text = m_Text.replaceAt(rStart.GetIndex(), 0, aTmpText);
-Update(rStart, aTmpText.size(), UpdateMode::Replace);
+for (sal_Int32 i = 0; i < nInsLen; i++)
+{
+++const_cast(rStart);
+}
 }
 else
 {


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

2023-11-09 Thread Skyler Grey (via logerrit)
 sw/source/filter/ww8/ww8atr.cxx |3 +++
 xmloff/source/text/txtfldi.cxx  |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 7924d8fc274bb611c829443e0eb1a53d883cc9a3
Author: Skyler Grey 
AuthorDate: Thu Nov 9 16:57:50 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 08:12:28 2023 +0100

Fix STYLEREF crashes and forwards-compatibility

This commit fixes a crash in STYLEREF caused by a dereferenced nullptr
when serializing chapter fields for .doc export. Along with the STYLEREF
changes, I also changed the chapter export logic to allow exporting
chapter fields when they were in document text, and to use the style of
the thing they pointed to. Unfortunately, in some cases that would be
null. This commit makes us fall back to previous behavior in those
cases.

This commit also adds import logic for styleref on the TEXT namespace in
addition to LO_EXT. This is important as if/when the STYLEREF field is
no longer LO_EXT we want to be able to open new documents in old
versions of libreoffice. This was erroneously missed when we changed
TEXT references to LO_EXT in our export logic.

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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 79446939957e..4949c7ffe6fd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3456,6 +3456,9 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 // Otherwise, get the style of the text and use it as the 
style name
 const SwTextNode* pOutlineNd = 
pTextNd->FindOutlineNodeOfLevel(aCopy.GetLevel());
 
+if (!pOutlineNd) break;
+// Sometimes we can't find the outline node, in that case 
let's just fallback to exporting the text
+
 sStr = FieldString(ww::eSTYLEREF)
  + 
GetExport().GetStyleRefName(pOutlineNd->GetFormatColl()->GetName());
 }
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index e0f6a01ecca6..1228e232d328 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -408,6 +408,7 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
 case XML_ELEMENT(TEXT, XML_NOTE_REF):
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 pContext = new XMLReferenceFieldImportContext( rImport, rHlp, 
nToken );
 break;
@@ -2512,6 +2513,7 @@ void XMLReferenceFieldImportContext::startFastElement(
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
 nSource = ReferenceFieldSource::SEQUENCE_FIELD;
 break;
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 nSource = ReferenceFieldSource::STYLE;
 break;
@@ -2593,6 +2595,7 @@ void XMLReferenceFieldImportContext::PrepareField(
 {
 case XML_ELEMENT(TEXT, XML_REFERENCE_REF):
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 xPropertySet->setPropertyValue("SourceName", Any(sName));
 xPropertySet->setPropertyValue("ReferenceFieldFlags", Any(nFlags));


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

2023-11-09 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/layfrm.hxx   |1 +
 sw/source/core/layout/wsfrm.cxx |   12 
 sw/source/core/text/xmldump.cxx |7 ---
 3 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 052c917d97aa88f21008cc3d978c6ca2ad83c88e
Author: Miklos Vajna 
AuthorDate: Thu Nov 9 19:59:45 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 08:06:47 2023 +0100

sw layout xml dump: avoid a static_cast in SwFrame::dumpAsXmlAttributes()

Move the code to SwLayoutFrame from SwFrame, then no cast is needed.

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

diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index b0f981477499..52e22829d4ad 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -183,6 +183,7 @@ public:
 m_VertPosOrientFramesFor.end(), pObj),
 m_VertPosOrientFramesFor.end());
 }
+void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
 };
 
 /**
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 7fdd19ace322..1cd01d53c680 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4139,6 +4139,18 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs 
,
 }
 }
 
+void SwLayoutFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+SwFrame::dumpAsXmlAttributes(writer);
+
+const SwFrameFormat* pFormat = GetFormat();
+if (pFormat)
+{
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "format" ), 
"%p", pFormat);
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( 
"formatName" ), "%s", BAD_CAST(pFormat->GetName().toUtf8().getStr()));
+}
+}
+
 static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, SwInvalidateFlags 
nInv )
 {
 SwSectionFrame* pSect = pCnt->FindSctFrame();
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 019866a9acbd..445a0e306336 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -234,13 +234,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer 
) const
 }
 (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), 
BAD_CAST(aMode.getStr()));
 }
-if (IsHeaderFrame() || IsFooterFrame())
-{
-const SwHeadFootFrame *pHeadFootFrame = static_cast(this);
-OUString aFormatName = pHeadFootFrame->GetFormat()->GetName();
-(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtName" 
), "%s", BAD_CAST(OUStringToOString(aFormatName, 
RTL_TEXTENCODING_UTF8).getStr()));
-(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtPtr" ), 
"%p", pHeadFootFrame->GetFormat());
-}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-09 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx   |   84 +
 sw/source/uibase/inc/optpage.hxx  |   16 +
 sw/uiconfig/swriter/ui/viewoptionspage.ui |  254 +++---
 3 files changed, 328 insertions(+), 26 deletions(-)

New commits:
commit 51f4cadfdd50e757e593c3166d4e54c6b2634af9
Author: Balazs Varga 
AuthorDate: Wed Nov 8 12:33:56 2023 +0100
Commit: Balazs Varga 
CommitDate: Thu Nov 9 20:29:02 2023 +0100

tdf#158006 - UI: Part 21 - Unify lockdown behavior of Options dialog

for Writer - View Page.

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

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index b1f24d671a92..6fb499f455ad 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,25 +87,40 @@ void drawRect(vcl::RenderContext& rRenderContext, const 
tools::Rectangle ,
 SwContentOptPage::SwContentOptPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rCoreSet)
 : SfxTabPage(pPage, pController, "modules/swriter/ui/viewoptionspage.ui", 
"ViewOptionsPage", )
 , m_xCrossCB(m_xBuilder->weld_check_button("helplines"))
+, m_xCrossImg(m_xBuilder->weld_widget("lockhelplines"))
 , m_xHMetric(m_xBuilder->weld_combo_box("hrulercombobox"))
+, m_xHMetricImg(m_xBuilder->weld_widget("lockhruler"))
 , m_xVRulerCBox(m_xBuilder->weld_check_button("vruler"))
+, m_xVRulerImg(m_xBuilder->weld_widget("lockvruler"))
 , m_xVRulerRightCBox(m_xBuilder->weld_check_button("vrulerright"))
+, m_xVRulerRightImg(m_xBuilder->weld_widget("lockvrulerright"))
 , m_xVMetric(m_xBuilder->weld_combo_box("vrulercombobox"))
 , m_xSmoothCBox(m_xBuilder->weld_check_button("smoothscroll"))
+, m_xSmoothImg(m_xBuilder->weld_widget("locksmoothscroll"))
 , m_xGrfCB(m_xBuilder->weld_check_button("graphics"))
+, m_xGrfImg(m_xBuilder->weld_widget("lockgraphics"))
 , m_xTableCB(m_xBuilder->weld_check_button("tables"))
+, m_xTableImg(m_xBuilder->weld_widget("locktables"))
 , m_xDrwCB(m_xBuilder->weld_check_button("drawings"))
+, m_xDrwImg(m_xBuilder->weld_widget("lockdrawings"))
 , m_xPostItCB(m_xBuilder->weld_check_button("comments"))
+, m_xPostItImg(m_xBuilder->weld_widget("lockcomments"))
 , m_xSettingsFrame(m_xBuilder->weld_frame("settingsframe"))
 , m_xSettingsLabel(m_xBuilder->weld_label("settingslabel"))
 , m_xMetricLabel(m_xBuilder->weld_label("measureunitlabel"))
 , m_xMetricLB(m_xBuilder->weld_combo_box("measureunit"))
 , m_xShowInlineTooltips(m_xBuilder->weld_check_button("changestooltip"))
+, m_xShowInlineTooltipsImg(m_xBuilder->weld_widget("lockchangestooltip"))
 , 
m_xShowOutlineContentVisibilityButton(m_xBuilder->weld_check_button("outlinecontentvisibilitybutton"))
+, 
m_xShowOutlineContentVImg(m_xBuilder->weld_widget("lockoutlinecontentvisibility"))
 , 
m_xTreatSubOutlineLevelsAsContent(m_xBuilder->weld_check_button("suboutlinelevelsascontent"))
+, 
m_xTreatSubOutlineLevelsImg(m_xBuilder->weld_widget("locksuboutlinelevels"))
 , m_xShowChangesInMargin(m_xBuilder->weld_check_button("changesinmargin"))
+, m_xShowChangesInMarginImg(m_xBuilder->weld_widget("lockchangesinmargin"))
 , m_xFieldHiddenCB(m_xBuilder->weld_check_button("hiddentextfield"))
+, m_xFieldHiddenImg(m_xBuilder->weld_widget("lockhiddentextfield"))
 , m_xFieldHiddenParaCB(m_xBuilder->weld_check_button("hiddenparafield"))
+, m_xFieldHiddenParaImg(m_xBuilder->weld_widget("lockhiddenparafield"))
 {
 m_xShowOutlineContentVisibilityButton->connect_toggled(LINK(this, 
SwContentOptPage, ShowOutlineContentVisibilityButtonHdl));
 
@@ -187,25 +203,88 @@ static void lcl_SelectMetricLB(weld::ComboBox& rMetric, 
TypedWhichIdGetItemIfSet( FN_PARAM_ELEM , false );
 if(pElemAttr)
 {
+bReadOnly = 
officecfg::Office::Writer::Content::Display::Table::isReadOnly();
 m_xTableCB->set_active(pElemAttr->m_bTable);
+m_xTableCB->set_sensitive(!bReadOnly);
+m_xTableImg->set_visible(bReadOnly);
+
+bReadOnly = 
officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly();
 m_xGrfCB->set_active(pElemAttr->m_bGraphic);
+m_xGrfCB->set_sensitive(!bReadOnly);
+m_xGrfImg->set_visible(bReadOnly);
+
+bReadOnly = 
officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly();
 m_xDrwCB->set_active(pElemAttr->m_bDrawing);
+m_xDrwCB->set_sensitive(!bReadOnly);
+m_xDrwImg->set_visible(bReadOnly);
+
+bReadOnly = 
officecfg::Office::Writer::Content::Display::Note::isReadOnly();
 m_xPostItCB->set_active(pElemAttr->m_bNotes);
+m_xPostItCB->set_sensitive(!bReadOnly);

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

2023-11-08 Thread Noel Grandin (via logerrit)
 sw/source/filter/html/htmldrawreader.cxx |8 
 sw/source/filter/html/htmltab.cxx|1 +
 sw/source/filter/html/swhtml.cxx |1 +
 sw/source/filter/html/swhtml.hxx |2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e1d15b223ad741acc90690918ee43096b494b942
Author: Noel Grandin 
AuthorDate: Tue Nov 7 15:48:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 17:26:08 2023 +0100

loplugin:fieldcast in SwHTMLParser

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

diff --git a/sw/source/filter/html/htmldrawreader.cxx 
b/sw/source/filter/html/htmldrawreader.cxx
index 4e5cb320408a..fdbc187348e9 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -345,10 +345,10 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
 // #i52858# - method name changed
 SwDrawModel* pModel = 
m_xDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
 SdrPage* pPg = pModel->GetPage( 0 );
-m_pMarquee = SdrObjFactory::MakeNewObject(
+m_pMarquee = static_cast(SdrObjFactory::MakeNewObject(
 *pModel,
 SdrInventor::Default,
-SdrObjKind::Text);
+SdrObjKind::Text).get());
 
 if( !m_pMarquee )
 return;
@@ -533,13 +533,13 @@ void SwHTMLParser::EndMarquee()
 }
 
 // insert the collected text
-static_cast(m_pMarquee.get())->SetText( m_aContents );
+m_pMarquee->SetText( m_aContents );
 m_pMarquee->SetMergedItemSetAndBroadcast( m_pMarquee->GetMergedItemSet() );
 
 if (m_bFixMarqueeWidth && !bFuzzing)
 {
 // adjust the size to the text
-static_cast(m_pMarquee.get())->FitFrameToTextSize();
+m_pMarquee->FitFrameToTextSize();
 }
 
 m_aContents.clear();
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index e1e50865f624..8b4756986f27 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 17c0da4e25c2..01670a3d2220 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #if OSL_DEBUG_LEVEL > 0
 #include 
 #endif
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 1c88e8add932..33f03ecf3fc3 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -403,7 +403,7 @@ class SwHTMLParser : public SfxHTMLParser, public 
SvtListener
 std::vector m_aTables;
 std::shared_ptr m_xTable; // current "outermost" table
 SwHTMLForm_Impl* m_pFormImpl;   // current form
-rtl::Reference m_pMarquee;// current marquee
+rtl::Reference m_pMarquee;// current marquee
 std::unique_ptr m_xField; // current field
 ImageMap*m_pImageMap;   // current image map
 std::unique_ptr m_pImageMaps;  ///< all Image-Maps that have 
been read


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

2023-11-07 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 1305f70cff8a81a58a5a6d9c96c5bb032005389e
Author: Caolán McNamara 
AuthorDate: Sat Nov 4 19:57:51 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 7 11:22:03 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 

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index bc80a6475af9..31f16f6d28d6 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 fe9d1cb877bc..f653399c81a8 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 c9500d1ae534..18ee57b18ee4 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 3591c8a357c9..d228b729521c 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3189,7 +3189,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: sw/source

2023-11-06 Thread Stephan Bergmann (via logerrit)
 sw/source/core/txtnode/txatritr.cxx |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit c662c66829187e5e1ccf6cba752928b7056a4cab
Author: Stephan Bergmann 
AuthorDate: Mon Nov 6 15:44:46 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Nov 7 07:05:29 2023 +0100

Fix SwLanguageIterator::Next for RES_TXTATR_AUTOFMT

...following advice by mstahl, as discussed in the comments starting at


"tdf#157667 sw track changes: fix cycle case on multiple words", which had
started to cause

> /sw/inc/txatritr.hxx:69:18: runtime error: downcast of address 
0x603001b45d90 which does not point to an object of type 'const SvxLanguageItem'
> 0x603001b45d90: note: object is of type 'SwFormatAutoFormat'
>  00 00 00 00  f0 0f 53 4e 3b 7f 00 00  02 00 00 00 32 00 90 be  20 31 36 
00 80 60 00 00  c0 5d b4 01
>   ^~~
>   vptr for 'SwFormatAutoFormat'
> #0 0x7f3b45ef75d2 in SwLanguageIterator::GetLanguage() const 
/sw/inc/txatritr.hxx:69:18
> #1 0x7f3b45ee2765 in 
SwTextNode::TransliterateText(utl::TransliterationWrapper&, int, int, 
SwUndoTransliterate*, bool) /sw/source/core/txtnode/txtedt.cxx:1980:32
> #2 0x7f3b429f1d40 in 
sw::DocumentContentOperationsManager::TransliterateText(SwPaM const&, 
utl::TransliterationWrapper&) 
/sw/source/core/doc/DocumentContentOperationsManager.cxx:3186:15
> #3 0x7f3b43a52777 in 
SwEditShell::TransliterateText(TransliterationFlags) 
/sw/source/core/edit/editsh.cxx:1076:51
> #4 0x7f3b49118c97 in 
SwTextShell::ExecRotateTransliteration(SfxRequest const&) 
/sw/source/uibase/shells/textsh.cxx:866:20
> #5 0x7f3b49118984 in 
SfxStubSwTextShellExecRotateTransliteration(SfxShell*, SfxRequest&) 
/workdir/SdiTarget/sw/sdi/swslots.hxx:3194:1
> #6 0x7f3b6529ff75 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot 
const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:254:9
> #7 0x7f3b652b5e85 in SfxDispatcher::Execute_(SfxShell&, SfxSlot 
const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9
> #8 0x7f3b65240e3b in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot 
const*, SfxShell*) /sfx2/source/control/bindings.cxx:1061:22
> #9 0x7f3b656c2760 in 
SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, 
com::sun::star::uno::Sequence const&, 
com::sun::star::uno::Reference 
const&) /sfx2/source/control/unoctitm.cxx:688:53
> #10 0x7f3b656c4ec1 in 
SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, 
com::sun::star::uno::Sequence const&, 
com::sun::star::uno::Reference 
const&) /sfx2/source/control/unoctitm.cxx:266:16
> #11 0x7f3b193705a6 in 
framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference
 const&, com::sun::star::util::URL const&, bool, 
com::sun::star::uno::Sequence const&) 
/framework/source/services/dispatchhelper.cxx:163:30
> #12 0x7f3b1936f482 in 
framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference
 const&, rtl::OUString const&, rtl::OUString const&, int, 
com::sun::star::uno::Sequence const&) 
/framework/source/services/dispatchhelper.cxx:120:16
> #13 0x7f3b19370e54 in non-virtual thunk to 
framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference
 const&, rtl::OUString const&, rtl::OUString const&, int, 
com::sun::star::uno::Sequence const&) 
/framework/source/services/dispatchhelper.cxx
> #14 0x7f3b3810b5e9 in 
unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference
 const&, rtl::OUString const&, 
com::sun::star::uno::Sequence const&) 
/unotest/source/cpp/macros_test.cxx:94:33
> #15 0x7f3b7245e5fd in testTdf157667::TestBody() 
/sw/qa/extras/uiwriter/uiwriter6.cxx:793:5

Change-Id: I0e0545a134d86a333b971da83a66f58c5e70f601
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159002
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/source/core/txtnode/txatritr.cxx 
b/sw/source/core/txtnode/txatritr.cxx
index 883c09760c33..91aed778c157 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -126,13 +126,8 @@ bool SwLanguageIterator::Next()
 m_nChgPos = nEndPos;
 m_nAttrPos = nSavePos;
 
-if( RES_TXTATR_CHARFMT == pHt->Which() )
-{
-const sal_uInt16 nWId = GetWhichOfScript( 
RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() );
-m_pCurrentItem = 
>GetCharFormat().GetCharFormat()->GetFormatAttr(nWId);
-}
-else
-m_pCurrentItem = >GetAttr();
+const sal_uInt16 nWId = GetWhichOfScript( 
RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() 

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

2023-11-06 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/shells/textsh.cxx |   71 +++--
 vcl/jsdialog/enabled.cxx   |1 
 2 files changed, 39 insertions(+), 33 deletions(-)

New commits:
commit 35925357f86e01612df28a092d71b6e216195636
Author: Miklos Vajna 
AuthorDate: Mon Nov 6 14:45:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 6 18:29:06 2023 +0100

sw floattable: make Insert Frame dialog async and mark it as a jsdialog

- with this, once a LOK client dispatches .uno:InsertFrame, we don't
  open two dialogs (one tunelled, one jsdialog)

- all the tabpages were already allowed as jsdialogs, the tabpages don't
  open any unwanted file picker (hyperlink browse button, area -> image
  -> import button)

- switching to async means we can't work with the original SfxRequest
  (which is no longer there by the time the callback is invoked), but
  057eca05f23d9d15465e591bd0da671735d62d50 (sc: convert optimal
  width/height and normal width/height dialog to async, 2022-04-12) shows
  we can re-create the SfxRequest after the fact, do the same here

- similar problem with SwFlyFrameAttrMgr, but looks like the
  SwFlyFrameAttrMgr before launching the dialog doesn't share state with
  the SwFlyFrameAttrMgr after the dialog is gone, so work with two
  instances here

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

diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index 76e0bc0a3511..c9e0e8a4d6f9 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -527,51 +527,56 @@ void SwTextShell::ExecInsert(SfxRequest )
 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( 
GetView().GetDocShell()) != nullptr );
 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< 
sal_uInt16 >(eMetric)));
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateFrameTabDialog("FrameDialog",
+VclPtr 
pDlg(pFact->CreateFrameTabDialog("FrameDialog",
   GetView().GetViewFrame(),
   GetView().GetFrameWeld(),
   aSet));
-if(pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet())
-{
-//local variable necessary at least after call of 
.AutoCaption() because this could be deleted at this point
-SwWrtShell& rShell = GetShell();
-rShell.LockPaint(LockPaintReason::InsertFrame);
-rShell.StartAllAction();
-rShell.StartUndo(SwUndoId::INSERT);
+pDlg->StartExecuteAsync([pDlg, nSlot, this](sal_Int32 nResult) {
+if (nResult == RET_OK && pDlg->GetOutputItemSet())
+{
+SwFlyFrameAttrMgr aAttrMgr( true, GetShellPtr(), 
Frmmgr_Type::TEXT, nullptr );
+//local variable necessary at least after call of 
.AutoCaption() because this could be deleted at this point
+SwWrtShell& rShell = GetShell();
+rShell.LockPaint(LockPaintReason::InsertFrame);
+rShell.StartAllAction();
+rShell.StartUndo(SwUndoId::INSERT);
 
-const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-aMgr.SetAttrSet(*pOutSet);
+const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+aAttrMgr.SetAttrSet(*pOutSet);
 
-// At first delete the selection at the ClickToEditField.
-if( rShell.IsInClickToEdit() )
-rShell.DelRight();
+// At first delete the selection at the ClickToEditField.
+if( rShell.IsInClickToEdit() )
+rShell.DelRight();
 
-aMgr.InsertFlyFrame();
+aAttrMgr.InsertFlyFrame();
 
-uno::Reference< frame::XDispatchRecorder > xRecorder =
-GetView().GetViewFrame().GetBindings().GetRecorder();
-if ( xRecorder.is() )
-{
-//FN_INSERT_FRAME
-sal_uInt16 nAnchor = 
static_cast(aMgr.GetAnchor());
-rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor));
-rReq.AppendItem(SfxPointItem(FN_PARAM_1, 
rShell.GetObjAbsPos()));
-rReq.AppendItem(SvxSizeItem(FN_PARAM_2, 
rShell.GetObjSize()));
-rReq.Done();
-}
+uno::Reference< frame::XDispatchRecorder > xRecorder =
+GetView().GetViewFrame().GetBindings().GetRecorder();
+if ( xRecorder.is() 

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

2023-11-05 Thread Bogdan B (via logerrit)
 sw/source/core/access/accdoc.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 1ad81f7e69b545340e340b54f9c9dd387b17cce0
Author: Bogdan B 
AuthorDate: Sun Nov 5 20:59:17 2023 +0100
Commit: Mike Kaganski 
CommitDate: Sun Nov 5 22:24:47 2023 +0100

tdf#158067 Replace OUStringLiteral in accdoc

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

diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index d1bb9d84b150..a1cf511b8bcf 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -52,7 +52,6 @@
 #include 
 #include 
 constexpr OUString sServiceName = 
u"com.sun.star.text.AccessibleTextDocumentView"_ustr;
-constexpr OUStringLiteral sImplementationName = 
u"com.sun.star.comp.Writer.SwAccessibleDocumentView";
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
@@ -421,7 +420,7 @@ IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, 
VclWindowEvent&, rEve
 
 OUString SAL_CALL SwAccessibleDocument::getImplementationName()
 {
-return sImplementationName;
+return u"com.sun.star.comp.Writer.SwAccessibleDocumentView"_ustr;
 }
 
 sal_Bool SAL_CALL SwAccessibleDocument::supportsService(const OUString& 
sTestServiceName)


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

2023-11-03 Thread Michael Weghorn (via logerrit)
 sw/source/core/access/accpara.cxx |   39 --
 1 file changed, 39 deletions(-)

New commits:
commit a2e0b39b62129d9dbae438ec6b12fca210bbcbb5
Author: Michael Weghorn 
AuthorDate: Fri Oct 20 16:04:51 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Nov 3 07:31:37 2023 +0100

sw a11y: No longer report underline for misspelling

No longer report a red wavy underline for misspelled
words in Writer.

The underline isn't really a character/text attribute, since
it's not part of the actual formatting of the text, but is
just shown visually.

Each platform a11y API has a better way to explicitly
report misspelling.

commit ec2e02cfa41510c3d30b118cbf7595c84a046d03
Author: Michael Weghorn 
Date:   Tue Oct 17 14:36:58 2023 +0200

tdf#157696 a11y: Report spelling error via IA2 "invalid:spelling" 
attr

and

commit 2bf88c172c9c9d159344b95fb96073f4891a6c30
Author: Michael Weghorn 
Date:   Wed Oct 18 13:44:42 2023 +0200

tdf#157696 wina11y: Switch from custom to IA2 text attributes

added the implementation for Windows and
the Qt-based VCL plugins on Linux.

On macOS (`NSAccessibilityMarkedMisspelledTextAttribute`/
`NSAccessibilityMisspelledTextAttribute`) and for gtk3/ATK,
the corresponding attributes were already used before.

Therefore, reporting an underline as a workaround is no
longer needed.

Orca on Linux, NVDA on Windows (with [1] in place)
and CrossOver on macOS all make use of the specific
character attribute to announce spelling errors, not
the underline. If any assistive technology should stop
reporting spelling errors due to this change, it should
be fixed to handle the proper text attribute as well.

After switching to text attributes according to the
IAccessible2 specification on Windows (i.e. with,
the above-mentioned commits and the NVDA commit
to switch to IAccessible2 text attributes for LO [1]),
NVDA was starting to announce not only that a word is
misspelled, but an underline in addition, which is
no more the case now that the underlining is no more
reported.

[1] 
https://github.com/nvaccess/nvda/commit/de4e8814f39ab6ae9fbc5330b007494ef6888cd3

Change-Id: Ifa29e0080a4a039c5a119dd0debe5e924fa546ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158847
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 7fb728f68fbc..62db53567a3e 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1905,7 +1905,6 @@ void SwAccessibleParagraph::_correctValues( const 
sal_Int32 nIndex,
 pos = pFrame->MapViewToModel(nCorePos + TextFrameIndex(1)); // try 
this one instead
 assert(pos.first->Len() != pos.second);
 }
-const SwTextNode *const pTextNode(pos.first);
 
 sal_Int32 nValues = rValues.size();
 for (sal_Int32 i = 0;  i < nValues;  ++i)
@@ -1962,47 +1961,9 @@ void SwAccessibleParagraph::_correctValues( const 
sal_Int32 nIndex,
 continue;
 }
 
-// UnderLine
-if (rValue.Name == UNO_NAME_CHAR_UNDERLINE)
-{
-//misspelled word
-SwCursorShell* pCursorShell = GetCursorShell();
-if( pCursorShell != nullptr && pCursorShell->GetViewOptions() && 
pCursorShell->GetViewOptions()->IsOnlineSpell())
-{
-const SwWrongList* pWrongList = pTextNode->GetWrong();
-if( nullptr != pWrongList )
-{
-sal_Int32 nBegin = pos.second;
-sal_Int32 nLen = 1;
-if (pWrongList->InWrongWord(nBegin, nLen) && 
!pTextNode->IsSymbolAt(nBegin))
-{
-rValue.Value <<= sal_uInt16(LINESTYLE_WAVE);
-}
-}
-}
-continue;
-}
-
 // UnderLineColor
 if (rValue.Name == UNO_NAME_CHAR_UNDERLINE_COLOR)
 {
-//misspelled word
-SwCursorShell* pCursorShell = GetCursorShell();
-if( pCursorShell != nullptr && pCursorShell->GetViewOptions() && 
pCursorShell->GetViewOptions()->IsOnlineSpell())
-{
-const SwWrongList* pWrongList = pTextNode->GetWrong();
-if( nullptr != pWrongList )
-{
-sal_Int32 nBegin = pos.second;
-sal_Int32 nLen = 1;
-if (pWrongList->InWrongWord(nBegin, nLen) && 
!pTextNode->IsSymbolAt(nBegin))
-{
-rValue.Value <<= sal_Int32(0x00ff);
-continue;
-}
-}
-}
-
 uno::Any  = rValue.Value;

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

2023-11-02 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |   86 +++--
 1 file changed, 45 insertions(+), 41 deletions(-)

New commits:
commit d2676b3e4b43aa4e17007bacdd0d98573ebd1ad2
Author: Jim Raykowski 
AuthorDate: Sat Oct 28 21:21:38 2023 -0800
Commit: Jim Raykowski 
CommitDate: Fri Nov 3 00:15:23 2023 +0100

SwNavigator: Improve field content sorting

Shave some time off sorting field content entries for documents with
large number of fields by eliminating a second sort and the loop used
to determine if a second sort is done because a field is found in a
frame. Also corrects ordering of fields in nested frames which prior
to this patch are placed at the beginning of the field content
entries.

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 43bb9e78bb5f..3a4322ad1532 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -200,6 +200,23 @@ namespace
 pCNd = aIdx.GetNodes().GoNext();
 return pCNd->IsTextNode() ? static_cast(pCNd)->GetText() 
: OUString();
 }
+
+void getAnchorPos(SwPosition& rPos)
+{
+// get the top most anchor position of the position
+if (SwFrameFormat* pFlyFormat = rPos.GetNode().GetFlyFormat())
+{
+SwNode* pAnchorNode;
+SwFrameFormat* pTmp = pFlyFormat;
+while (pTmp && (pAnchorNode = pTmp->GetAnchor().GetAnchorNode()) &&
+   (pTmp = pAnchorNode->GetFlyFormat()))
+{
+pFlyFormat = pTmp;
+}
+if (const SwPosition* pPos = 
pFlyFormat->GetAnchor().GetContentAnchor())
+rPos = *pPos;
+}
+}
 }
 
 // Content, contains names and reference at the content type.
@@ -628,55 +645,42 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 }
 if (!m_bAlphabeticSort)
 {
-const SwNodeOffset nEndOfExtrasIndex = 
m_pWrtShell->GetNodes().GetEndOfExtras().GetIndex();
-bool bHasEntryInFly = false;
-
+const SwNodeOffset nEndOfExtrasIndex =
+m_pWrtShell->GetNodes().GetEndOfExtras().GetIndex();
 // use stable sort array to list fields in document model order
 std::stable_sort(aArr.begin(), aArr.end(),
- [](const SwTextField* a, const SwTextField* 
b){
+ [, this](
+ const SwTextField* a, const SwTextField* b){
 SwPosition aPos(a->GetTextNode(), a->GetStart());
 SwPosition bPos(b->GetTextNode(), b->GetStart());
-return aPos < bPos;});
-
-// determine if there is a text field in a fly frame
-for (SwTextField* pTextField : aArr)
-{
-if (!bHasEntryInFly)
+// use anchor position for entries that are located in flys
+if (nEndOfExtrasIndex >= aPos.GetNodeIndex())
+getAnchorPos(aPos);
+if (nEndOfExtrasIndex >= bPos.GetNodeIndex())
+getAnchorPos(bPos);
+if (aPos == bPos)
 {
-if (nEndOfExtrasIndex >= 
pTextField->GetTextNode().GetIndex())
+// probably in same or nested fly frame
+// sort using layout position
+SwRect aCharRect, bCharRect;
+std::shared_ptr pPamForTextField;
+if (SwTextFrame* pFrame = static_cast(
+
a->GetTextNode().getLayoutFrame(m_pWrtShell->GetLayout(
 {
-// Not a node of BodyText
-// Are we in a fly?
-if (pTextField->GetTextNode().GetFlyFormat())
-{
-bHasEntryInFly = true;
-break;
-}
+SwTextField::GetPamForTextField(*a, 
pPamForTextField);
+if (pPamForTextField)
+pFrame->GetCharRect(aCharRect, 
*pPamForTextField->GetPoint());
+}
+if (SwTextFrame* pFrame = static_cast(
+
b->GetTextNode().getLayoutFrame(m_pWrtShell->GetLayout(
+{
+SwTextField::GetPamForTextField(*b, 
pPamForTextField);
+if (pPamForTextField)
+

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

2023-11-02 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/ww8scan.hxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 6b708e3c569f87e7a89ec032afacc5a7389f86f0
Author: Caolán McNamara 
AuthorDate: Thu Nov 2 08:52:35 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 2 15:46:47 2023 +0100

Related: ofz#63786 make it clearer what m_aShortSprm is used for

its not used as a SVBT32, only as a little buffer

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

diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index d69a822554f5..320d3e3cb10e 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -437,8 +437,7 @@ private:
 WW8PLCFpcd_Iter* m_pPcdI;
 WW8PLCFx_PCD* m_pPcd;
 std::vector> const & mrGrpprls; // attribute 
of Piece-table
-SVBT32 m_aShortSprm;  // mini storage: can contain ONE sprm with
-// 1 byte param
+sal_uInt8 m_aShortSprm[4]; // mini storage: can contain ONE sprm with 1 
byte param
 
 WW8PLCFx_PCDAttrs(const WW8PLCFx_PCDAttrs&) = delete;
 WW8PLCFx_PCDAttrs& operator=(const WW8PLCFx_PCDAttrs&) = delete;


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

2023-11-02 Thread Michael Stahl (via logerrit)
 sw/source/core/text/pormulti.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 755210c38dcb72a56aa7aacb9b52246a63dae687
Author: Michael Stahl 
AuthorDate: Wed Nov 1 18:55:53 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 2 10:48:01 2023 +0100

sw: PDF/UA export: produce Link SEs for RTL text

This is a SwBidiPortion containing a nested SwLineLayout containing
SwLinePortions for the link or text, and only the SwBidiPortion had a
tag helper, so add one for the inner portion too. (Apparently this
never worked before.)

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

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 07453a4b1fcb..67cd13af4d6d 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1778,7 +1778,12 @@ void SwTextPainter::PaintMultiPortion( const SwRect 
,
 PaintMultiPortion( rPaint, static_cast(*pPor), 
 );
 }
 else
+{
+Por_Info const por(*pPor, *this, 0);
+SwTaggedPDFHelper const tag(nullptr, nullptr, , 
*GetInfo().GetOut());
+
 pPor->Paint( GetInfo() );
+}
 
 bFirst &= !pPor->GetLen();
 if( pNext || !pPor->IsMarginPortion() )


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

2023-11-02 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 a1b0fc647d14dc36e9fe238d5bfc81ebcfa1d5dc
Author: Michael Stahl 
AuthorDate: Wed Nov 1 13:09:13 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 2 10:47:44 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 

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: sw/source vcl/qa

2023-11-02 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  |  348 +++-
 6 files changed, 548 insertions(+), 12 deletions(-)

New commits:
commit 5726be1314517d47dd733aabe64a3d85cce094c5
Author: Michael Stahl 
AuthorDate: Fri Oct 27 19:45:09 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Nov 2 10:47:20 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 

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 fab57c35c24b..d79ffab813aa 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 )
  *  rectangles are available for highlighting.
  *  In the end the Flys are cut out of the region.
  */
-void SwRootFrame::CalcFrameRects(SwShellCursor )
+void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & 
rRects, RectsMode const eMode)
 {
 auto [pStartPos, pEndPos] = rCursor.StartEnd(); // SwPosition*
 
@@ -2570,7 +2572,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
+{
+info.SetPos(painter.GetTopLeft());
+bool const bAdjustBaseLine(
+
painter.GetLineInfo().HasSpecialAlign(pStartFrame->IsVertical())
+|| nullptr != pGrid || 

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

2023-11-02 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 6593d680e21c24501a58bac216de4a7c71541959
Author: Michael Stahl 
AuthorDate: Fri Oct 27 18:00:14 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Nov 2 10:46:30 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 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index decdd4215f0b..946def82f719 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -345,6 +345,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,
@@ -2396,8 +2425,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();
@@ -2819,7 +2847,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))
 {
@@ -2869,7 +2898,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 a/vcl/qa/cppunit/pdfexport/data/tdf157816.fodt 
b/vcl/qa/cppunit/pdfexport/data/tdf157816.fodt
new file mode 100644
index ..5288f3aa75ca
--- /dev/null
+++ 

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

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

New commits:
commit 468e5b8e0a7fefe1ca53faeb15f5f6527c37a268
Author: Michael Stahl 
AuthorDate: Fri Oct 27 16:18:44 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Nov 2 10:39:12 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 

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 3dea5b461c44..7a7024d97a09 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1528,7 +1528,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())
 {
@@ -1758,18 +1762,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 )
 const_cast(GetFnt())->SetProportion( nOldProp );


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

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

New commits:
commit 24ee09ab41924fd339835cbc7a54a5ba27f5c67e
Author: Vasily Melenchuk 
AuthorDate: Thu Oct 26 17:09:44 2023 +0300
Commit: Vasily Melenchuk 
CommitDate: Thu Nov 2 09:38:05 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 

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index afcdbdf0e761..baefd752e1c0 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -4461,21 +4461,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
@@ -4568,27 +4555,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: sw/source

2023-11-02 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/ww8scan.cxx |   17 +++--
 sw/source/filter/ww8/ww8scan.hxx |2 ++
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 5d4dcc5228ce0f1c5eee34101be10ff2fcd5f49c
Author: Noel Grandin 
AuthorDate: Thu Nov 2 06:21:38 2023 +0100
Commit: Noel Grandin 
CommitDate: Thu Nov 2 08:16:27 2023 +0100

Revert "WW8PLCFx_PCDAttrs::m_aShortSprm can be local"

This reverts commit 2779984709d24ad263547407069a5da0fda36ceb.

Reason for revert: we are storing a pointer to this field

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

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6f801b929d57..c7b175f56e61 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1023,13 +1023,12 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p)
 
 if (IsSevenMinus(GetFIBVersion()))
 {
-SVBT32 aShortSprm; // mini storage: can contain ONE sprm with 1 
byte param
-aShortSprm[0] = static_cast( ( nPrm & 0xfe) >> 1 );
-aShortSprm[1] = static_cast(   nPrm >> 8 );
+m_aShortSprm[0] = static_cast( ( nPrm & 0xfe) >> 1 );
+m_aShortSprm[1] = static_cast(   nPrm >> 8 );
 p->nSprmsLen = nPrm ? 2 : 0;// length
 
 // store Position of internal mini storage in Data Pointer
-p->pMemPos = aShortSprm;
+p->pMemPos = m_aShortSprm;
 }
 else
 {
@@ -1120,18 +1119,16 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p)
 
 if( nSprmId )
 {
-SVBT32 aShortSprm; // mini storage: can contain ONE sprm 
with 1 byte param
-
 // move Sprm Id and Sprm Param to internal mini storage:
-aShortSprm[0] = static_cast( nSprmId & 0x00ff)  
 ;
-aShortSprm[1] = static_cast( ( nSprmId & 
0xff00) >> 8 );
-aShortSprm[2] = static_cast( nPrm >> 8 );
+m_aShortSprm[0] = static_cast( nSprmId & 
0x00ff)   ;
+m_aShortSprm[1] = static_cast( ( nSprmId & 
0xff00) >> 8 );
+m_aShortSprm[2] = static_cast( nPrm >> 8 );
 
 // store Sprm Length in member:
 p->nSprmsLen = nPrm ? 3 : 0;
 
 // store Position of internal mini storage in Data Pointer
-p->pMemPos = aShortSprm;
+p->pMemPos = m_aShortSprm;
 }
 }
 }
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index d8fc08334bd6..d69a822554f5 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -437,6 +437,8 @@ private:
 WW8PLCFpcd_Iter* m_pPcdI;
 WW8PLCFx_PCD* m_pPcd;
 std::vector> const & mrGrpprls; // attribute 
of Piece-table
+SVBT32 m_aShortSprm;  // mini storage: can contain ONE sprm with
+// 1 byte param
 
 WW8PLCFx_PCDAttrs(const WW8PLCFx_PCDAttrs&) = delete;
 WW8PLCFx_PCDAttrs& operator=(const WW8PLCFx_PCDAttrs&) = delete;


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

2023-11-01 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/ww8par.hxx  |1 -
 sw/source/filter/ww8/ww8par2.cxx |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 90c84aa5916c496de357dbf3956c51e0eb202dc4
Author: Noel Grandin 
AuthorDate: Tue Oct 31 13:45:06 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 1 14:45:44 2023 +0100

WW8TabBandDesc::bCantSplit90 is unused

found by a new loplugin

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

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 2c0bf9dd8e4f..cfd1cd6f2a85 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1064,7 +1064,6 @@ struct WW8TabBandDesc
 bool bLEmptyCol;// SW: an additional empty column at the left
 bool bREmptyCol;// SW: same at the right
 bool bCantSplit;
-bool bCantSplit90;
 WW8_TCell* pTCs;
 sal_uInt8 nOverrideSpacing[MAX_COL + 1];
 short nOverrideValues[MAX_COL + 1][4];
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 375371192ef6..faa9d9e45d29 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -79,7 +79,7 @@ WW8TabBandDesc::WW8TabBandDesc():
 pNextBand(nullptr), nGapHalf(0), mnDefaultLeft(0), mnDefaultTop(0), 
mnDefaultRight(0),
 mnDefaultBottom(0), mbHasSpacing(false), nLineHeight(0), nRows(0), 
nCenter{}, nWidth{},
 nWwCols(0), nSwCols(0), bLEmptyCol(false), bREmptyCol(false), 
bCantSplit(false),
-bCantSplit90(false), pTCs(nullptr), nOverrideSpacing{}, nOverrideValues{}, 
pSHDs(nullptr),
+pTCs(nullptr), nOverrideSpacing{}, nOverrideValues{}, pSHDs(nullptr),
 pNewSHDs(nullptr), bExist{}, nTransCell{}
 {
 for (sal_uInt16 & rn : maDirections)


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

2023-10-31 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/rtfattributeoutput.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e8228e0994610fed8af090ff30ffc08bfecb7261
Author: Justin Luth 
AuthorDate: Tue Oct 31 16:26:50 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Nov 1 02:28:15 2023 +0100

tdf#108318 rtfexport: no hyperlink target for clipboard

This fixes copying hyperlinks from Writer to the other apps
like Calc or even to editeng components within Writer.

External apps never seem to call for RTF clipboard.
Certainly firefox doesn't - and everything I tested
seems to just request plain text URL strings.

I don't see anywhere in the RTF specification that a
\fldinst can take formatting parameters along with the URL.
That is likely only a DOCX thing.
But since RTF shares import code with DOCX, it gets the parsing
for free, so we explicitly use it to round-trip targets in RTF.
See commit 31de0ac30d6c521ad663db78feb936688be5bccb
Author: Miklos Vajna on Tue Feb 14 09:32:25 2017 +0100
RTF import: handle target of hyperlink

Alternatively I could have had editeng parse the flags
on clipboard RTF import, but handling it at export
seemed cleaner to me.

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

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index c3ec71eaaa30..afcdbdf0e761 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -561,7 +561,9 @@ bool RtfAttributeOutput::StartURL(const OUString& rUrl, 
const OUString& rTarget)
 m_aRun->append(msfilter::rtfutil::OutString(rUrl, 
m_rExport.GetCurrentEncoding()));
 m_aRun->append("\" ");
 
-if (!rTarget.isEmpty())
+// Adding the target is likely a LO embellishment.
+// Don't export it to clipboard, since editeng and other RTF readers 
won't understand it.
+if (!rTarget.isEmpty() && !m_rExport.m_rDoc.IsClipBoard())
 {
 m_aRun->append("t \"");
 m_aRun->append(msfilter::rtfutil::OutString(rTarget, 
m_rExport.GetCurrentEncoding()));


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

2023-10-31 Thread Attila Szűcs (via logerrit)
 sw/source/core/doc/docredln.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit bfeb6375a96d75ed7117f1581b0a0d7cb0d236ca
Author: Attila Szűcs 
AuthorDate: Thu Oct 26 23:11:03 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Oct 31 16:27:25 2023 +0100

tdf#157662 SW: fix connected area calculation

Reset pRedline to its origin value between the 2 loops,
because the 1. loop may change it.

without this fix, if it discover neightbours in the 1. direction,
it will not discover them in the other direction.

Change-Id: Ia1ab357ada17cb7574907a3aa1bf0dd4d7a90255
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158517
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158721
Tested-by: Jenkins

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 0472343d8eb3..8ef699787b3f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -846,6 +846,7 @@ void SwRedlineTable::getConnectedArea(size_type nPosOrigin, 
size_type& rPosStart
 rPosStart--;
 pRedline = pOther;
 }
+pRedline = pOrigin;
 while (rPosEnd + 1 < size() && (pOther = (*this)[rPosEnd + 1])
&& lcl_CanCombineWithRange(pOrigin, pRedline, pOther, false, 
bCheckChilds))
 {


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

2023-10-31 Thread Mike Kaganski (via logerrit)
 sw/source/filter/html/htmlplug.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d4f4a401861e7c908b6ab7f72563d5ab911edcf0
Author: Mike Kaganski 
AuthorDate: Tue Oct 31 09:44:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 31 08:50:18 2023 +0100

This function takes a string view - no need in OUString literal

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

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index 8331751fe431..bc80a6475af9 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1567,7 +1567,7 @@ static bool TrySaveFormulaAsPDF(SwHTMLWriter& rWrt, const 
SwFrameFormat& rFrameF
 return false;
 
 Graphic aGraphic(xTextContent->getReplacementGraphic());
-OUString aFileName = lcl_CalculateFileName(rWrt.GetOrigFileName(), 
aGraphic, u"pdf"_ustr);
+OUString aFileName = lcl_CalculateFileName(rWrt.GetOrigFileName(), 
aGraphic, u"pdf");
 
 utl::MediaDescriptor aDescr;
 aDescr[u"FilterName"_ustr] <<= u"math_pdf_Export"_ustr;


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

2023-10-30 Thread Skyler Grey (via logerrit)
 sw/source/core/fields/reffld.cxx |   21 +
 sw/uiconfig/swriter/ui/fldrefpage.ui |2 +-
 2 files changed, 6 insertions(+), 17 deletions(-)

New commits:
commit 3e6d4a563f390638b285254d2128466b56ce03ba
Author: Skyler Grey 
AuthorDate: Tue Oct 24 10:19:52 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:11:31 2023 +0100

Improve STYLE_FROM_BOTTOM compatability with Word

From my testing in Word, it doesn't honor the "search from bottom" flag
when it is in the body, only in marginals. Additionally, it doesn't
continue searching in the opposite order if the referenced content is
not found on the current page, instead it searches in the same order as
it would normally (i.e. pages above then pages below). This commit
changes the behavior and UI of our from bottom flag to match.

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

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index c92d4b6d37bb..f034b1b52b5b 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1384,8 +1384,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 case REF_STYLE:
 if (!pSelf) break;
 
-bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == 
REFFLDFLAG_STYLE_FROM_BOTTOM;
-
 const SwNodes& nodes = pDoc->GetNodes();
 
 StyleRefElementType elementType = StyleRefElementType::Default;
@@ -1434,6 +1432,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 // For marginals, styleref tries to act on the current 
page first
 // 1. Get the page we're on, search it from top to bottom
 
+bool bFlagFromBottom = (nFlags & 
REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM;
+
 Point aPt;
 std::pair const tmp(aPt, false);
 
@@ -1499,10 +1499,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 
 if (beforeStart)
 {
-if (bFlagFromBottom)
-pSearchThird.push_front(nodes[n]);
-else
-pSearchSecond.push_front(nodes[n]);
+pSearchSecond.push_front(nodes[n]);
 }
 else if (beforeEnd)
 {
@@ -1516,8 +1513,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 beforeEnd = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchSecond.push_back(nodes[n]);
 else
 pSearchThird.push_back(nodes[n]);
 }
@@ -1579,20 +1574,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, 
const OUString& rRefMark,
 {
 if (beforeElement)
 {
-if (bFlagFromBottom)
-pSearchSecond.push_front(nodes[n]);
-else
-pSearchFirst.push_front(nodes[n]);
+pSearchFirst.push_front(nodes[n]);
 
 if (*pReference == *nodes[n])
 {
 beforeElement = false;
 }
 }
-else if (bFlagFromBottom)
-pSearchFirst.push_back(nodes[n]);
-else
-pSearchSecond.push_back(nodes[n]);
+pSearchSecond.push_back(nodes[n]);
 }
 
 // 1. Search up until we hit the top of the document
diff --git a/sw/uiconfig/swriter/ui/fldrefpage.ui 
b/sw/uiconfig/swriter/ui/fldrefpage.ui
index 549a7a6e6f9a..8398e0a2ccf8 100644
--- a/sw/uiconfig/swriter/ui/fldrefpage.ui
+++ b/sw/uiconfig/swriter/ui/fldrefpage.ui
@@ -202,7 +202,7 @@
 top
 
   
-Search from bottom to top
+Search this page from bottom to 
top
 True
 True
 False


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

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/source/core/doc/docredln.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 03417b4ee572f84850ea7406929410510f10d793
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:49:40 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:44:28 2023 +0100

Fix typo

Change-Id: I1906435815ddfe831a3f833f9e47af2636f4367f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158632
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 029752d6500b..0472343d8eb3 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -830,7 +830,7 @@ bool lcl_CanCombineWithRange(SwRangeRedline* pOrigin, 
SwRangeRedline* pActual,
 void SwRedlineTable::getConnectedArea(size_type nPosOrigin, size_type& 
rPosStart,
   size_type& rPosEnd, bool bCheckChilds) 
const
 {
-// Keep the original redline .. else we should memorize witch children was 
checked
+// Keep the original redline .. else we should memorize which children was 
checked
 // at the last combined redline.
 SwRangeRedline* pOrigin = (*this)[nPosOrigin];
 rPosStart = nPosOrigin;


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

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 64e34917e79c4690e923f28a6a316cc41e3bab4d
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:50:02 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:41:36 2023 +0100

Fix typo

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

diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx 
b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 43ac1cc6769a..cb304283f77f 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -411,7 +411,7 @@ void XMLRedlineImportHelper::Add(
 pInfo->sMovedID = rMovedID;
 pInfo->bMergeLastParagraph = bMergeLastPara;
 
-//reserve MoveID so it wont be reused by others
+//reserve MoveID so it won't be reused by others
 if (!rMovedID.isEmpty())
 {
 SwDoc* const pDoc(static_cast(m_rImport).getDoc());


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

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/source/core/doc/docredln.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 06c97416819fb4a681e45bd7660709bc500d5467
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:47:06 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:41:13 2023 +0100

Fix typos

Change-Id: I1549c90313823f9ade2a72d858dd01354e1f4f6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158630
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 26a3c7bc24df..029752d6500b 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -856,7 +856,7 @@ void SwRedlineTable::getConnectedArea(size_type nPosOrigin, 
size_type& rPosStart
 
 OUString SwRedlineTable::getTextOfArea(size_type rPosStart, size_type rPosEnd) 
const
 {
-// Normally a SwPaM::GetText() would be enought with rPosStart-start and 
rPosEnd-end
+// Normally a SwPaM::GetText() would be enough with rPosStart-start and 
rPosEnd-end
 // But at import time some text is not present there yet
 // we have to collect them 1 by 1
 
@@ -901,7 +901,7 @@ OUString SwRedlineTable::getTextOfArea(size_type rPosStart, 
size_type rPosEnd) c
 
 bool SwRedlineTable::isMoved(size_type rPos) const
 {
-// If it is already a part of a movement, then dont check it.
+// If it is already a part of a movement, then don't check it.
 if ((*this)[rPos]->GetMoved() != 0)
 return false;
 // First try with single redline. then try with combined redlines


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

2023-10-29 Thread Noel Grandin (via logerrit)
 sw/source/filter/xml/xmlimp.cxx |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit f02cd897a4605192dd4034e4893ae9aedb9dad4f
Author: Noel Grandin 
AuthorDate: Sat Oct 28 19:55:33 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Oct 29 07:45:45 2023 +0100

use more TempFileFast in TestPDFExportFODT

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

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 55415f12a6f4..81ddfbbb5ffa 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1852,16 +1852,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool 
TestPDFExportFODT(SvStream )
 css::uno::Reference 
xController(xModel->createDefaultViewController(xTargetFrame), UNO_SET_THROW);
 utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel);
 
-utl::TempFileNamed aTempFile;
-aTempFile.EnableKillingFile();
+utl::TempFileFast aTempFile;
 
 uno::Reference xPDFFilter(
 
xMultiServiceFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
 uno::Reference xExporter(xPDFFilter, 
uno::UNO_QUERY);
 xExporter->setSourceDocument(xModel);
 
-SvFileStream aOutputStream(aTempFile.GetURL(), StreamMode::WRITE);
-uno::Reference xOutputStream(new 
utl::OStreamWrapper(aOutputStream));
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(*aTempFile.GetStream(StreamMode::READWRITE)));
 
 // ofz#60533 fuzzer learned to use fo:font-size="842pt" which generate 
timeouts trying
 // to export thousands of pages from minimal input size
@@ -1874,7 +1872,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool 
TestPDFExportFODT(SvStream )
 { "FilterData", uno::Any(aFilterData) }
 }));
 xPDFFilter->filter(aDescriptor);
-aOutputStream.Close();
 }
 
 css::uno::Reference xClose(xModel, 
css::uno::UNO_QUERY);


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

2023-10-28 Thread Caolán McNamara (via logerrit)
 sw/source/filter/xml/xmlimp.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 7269df74824bdea31b9d42d1e2d77b77e702b3ab
Author: Caolán McNamara 
AuthorDate: Sat Oct 28 17:11:00 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 28 19:51:00 2023 +0200

ofz#63646 avoid Timeout when document fails to load

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

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index c84a3a3a3392..55415f12a6f4 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1847,12 +1847,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool 
TestPDFExportFODT(SvStream )
 uno::Reference xFODTFilter(xInterface, 
uno::UNO_QUERY_THROW);
 bool ret = xFODTFilter->filter(aArgs);
 
-css::uno::Reference 
xController(xModel->createDefaultViewController(xTargetFrame), UNO_SET_THROW);
-
-utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel);
-
 if (ret)
 {
+css::uno::Reference 
xController(xModel->createDefaultViewController(xTargetFrame), UNO_SET_THROW);
+utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel);
+
 utl::TempFileNamed aTempFile;
 aTempFile.EnableKillingFile();
 


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

2023-10-28 Thread Andrea Gelmini (via logerrit)
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3a23b1fcdb6ee05880d9a30cea2f35b11b885f4f
Author: Andrea Gelmini 
AuthorDate: Sat Oct 28 14:53:39 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 28 17:11:58 2023 +0200

Fix typo

Change-Id: I662b35eeba752f84a950be8653622c05d8538d7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158589
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 31802ee4c184..8e4af98b7169 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -1271,7 +1271,7 @@ void SwToContentAnchoredObjectPosition::CalcOverlap(const 
SwTextFrame* pAnchorFr
 
 if (pAnchoredObjFlyAnchor && pAnchoredObjFlyAnchor->GetUpper() != 
pAnchorUpper)
 {
-// A fly overlapping with a fly from an other upper is fine.
+// A fly overlapping with a fly from another upper is fine.
 continue;
 }
 }


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

2023-10-28 Thread Mike Kaganski (via logerrit)
 sw/source/filter/html/htmlplug.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit df5bb1387b5c7a30e15aad7811a3c0f0d3fe44c8
Author: Mike Kaganski 
AuthorDate: Fri Oct 27 16:24:03 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 28 08:46:12 2023 +0200

Simplify a bit

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

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index 0216a6929dbf..86d5cc0ffe7b 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1492,15 +1492,13 @@ SwHTMLWriter& OutHTML_FrameFormatOLENodeGrf( 
SwHTMLWriter& rWrt, const SwFrameFo
 {
 // If we skip images, embedded objects would be completely lost.
 // Instead, try to use the HTML export of the embedded object.
-uno::Reference xTextContent = 
SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rWrt.m_pDoc, 
const_cast());
-uno::Reference 
xEmbeddedObjectSupplier(xTextContent, uno::UNO_QUERY);
-uno::Reference 
xStorable(xEmbeddedObjectSupplier->getEmbeddedObject(), uno::UNO_QUERY);
+auto xTextContent = 
SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rWrt.m_pDoc, 
const_cast());
+uno::Reference 
xStorable(xTextContent->getEmbeddedObject(), uno::UNO_QUERY);
 SAL_WARN_IF(!xStorable.is(), "sw.html", 
"OutHTML_FrameFormatOLENodeGrf: no embedded object");
 
 // Figure out what is the filter name of the embedded object.
-uno::Reference xServiceInfo(xStorable, 
uno::UNO_QUERY);
 OUString aFilter;
-if (xServiceInfo.is())
+if (uno::Reference xServiceInfo{ xStorable, 
uno::UNO_QUERY })
 {
 if 
(xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
 aFilter = "HTML (StarCalc)";
@@ -1508,7 +1506,7 @@ SwHTMLWriter& OutHTML_FrameFormatOLENodeGrf( 
SwHTMLWriter& rWrt, const SwFrameFo
 aFilter = "HTML (StarWriter)";
 }
 
-if (xStorable.is() && !aFilter.isEmpty())
+if (!aFilter.isEmpty())
 {
 try
 {


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

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

New commits:
commit 435f1aadf7dd8087a8997924bedfccff0f496ba2
Author: Miklos Vajna 
AuthorDate: Fri Oct 27 08:11:05 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 09:47:42 2023 +0200

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

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: sw/source

2023-10-27 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/wsfrm.cxx |9 +
 sw/source/core/text/xmldump.cxx |9 -
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 39fcc32376bcafde8b1e582cbb5e8f23fed868ce
Author: Miklos Vajna 
AuthorDate: Thu Oct 26 19:53:23 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 08:00:02 2023 +0200

sw layout xml dump: move SwFrame::dumpChildrenAsXml()

Next to the rest of the SwFrame code.

So it's more likely that it gets updated as SwAnchoredObject changes.

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

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 195618aa5b7b..7fdd19ace322 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -313,6 +313,15 @@ void SwFrame::dumpAsXml(xmlTextWriterPtr pWriter) const
 dumpChildrenAsXml(pWriter);
 }
 
+void SwFrame::dumpChildrenAsXml( xmlTextWriterPtr writer ) const
+{
+const SwFrame *pFrame = GetLower(  );
+for ( ; pFrame != nullptr; pFrame = pFrame->GetNext(  ) )
+{
+pFrame->dumpAsXml( writer );
+}
+}
+
 SwFrame::SwFrame( sw::BroadcastingModify *pMod, SwFrame* pSib )
 :   SwClient( pMod ),
 mpRoot( pSib ? pSib->getRootFrame() : nullptr ),
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 8284ac3fdc58..019866a9acbd 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -243,13 +243,4 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer 
) const
 }
 }
 
-void SwFrame::dumpChildrenAsXml( xmlTextWriterPtr writer ) const
-{
-const SwFrame *pFrame = GetLower(  );
-for ( ; pFrame != nullptr; pFrame = pFrame->GetNext(  ) )
-{
-pFrame->dumpAsXml( writer );
-}
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-10-26 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/trvlfrm.cxx |   54 ++
 1 file changed, 26 insertions(+), 28 deletions(-)

New commits:
commit 6787d2ae5eb99ea05dae586bbe50a8aa4dab8a3e
Author: Michael Stahl 
AuthorDate: Wed Oct 25 17:01:16 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Oct 26 11:03:31 2023 +0200

sw: fix comments in SwRootFrame::CalcFrameRects()

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

diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 0b4938f7fe8d..fab57c35c24b 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -175,8 +175,7 @@ bool SwLayoutFrame::GetModelPositionForViewPoint( 
SwPosition *pPos, Point 
 return bRet;
 }
 
-/** Searches the page containing the searched point. */
-
+/** Searches for the page containing the searched point. */
 bool SwPageFrame::GetModelPositionForViewPoint( SwPosition *pPos, Point 
,
  SwCursorMoveState* pCMS, bool bTestBackground ) 
const
 {
@@ -1993,28 +1992,29 @@ static void Add( SwRegionRects& rRegion, const SwRect& 
rRect )
 }
 
 /*
- * The following situations can happen:
- *  1. Start and end lie in one screen-row and in the same node
+ * The following situations can happen (simplified version, before
+ * CJK/CTL features were added):
+ *  1. Start and end in same line of text and in the same frame
  * -> one rectangle out of start and end; and we're okay
- *  2. Start and end lie in one frame (therefore in the same node!)
+ *  2. Start and end in same frame
  * -> expand start to the right, end to the left and if more than two
- *screen-rows are involved - calculate the in-between
- *  3. Start and end lie in different frames
+ *lines of text are involved - calculate the in-between area
+ *  3. Start and end in different frames
  * -> expand start to the right until frame-end, calculate Rect
  *expand end to the left until frame-start, calculate Rect
  *and if more than two frames are involved add the PrtArea of all
  *frames which lie in between
  *
- * Big reorganization because of the FlyFrame - those need to be locked out.
+ * Big reorganization because of FlyFrame - those need to be excluded.
  * Exceptions:  - The Fly in which the selection took place (if it took place
  * in a Fly)
- *  - The Flys which are underrun by the text
+ *  - The Flys which are below the text (in z-order)
  *  - The Flys which are anchored to somewhere inside the 
selection.
  * Functioning: First a SwRegion with a root gets initialized.
- *  Out of the region the inverted sections are cut out. The
+ *  Out of the region the selected areas are cut out. The
  *  section gets compressed and finally inverted and thereby the
- *  inverted rectangles are available.
- *  In the end the Flys are cut out of the section.
+ *  rectangles are available for highlighting.
+ *  In the end the Flys are cut out of the region.
  */
 void SwRootFrame::CalcFrameRects(SwShellCursor )
 {
@@ -2026,7 +2026,6 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 if (pSh)
 bIgnoreVisArea = pSh->GetViewOptions()->IsPDFExport() || 
comphelper::LibreOfficeKit::isActive();
 
-// #i12836# enhanced pdf
 SwRegionRects aRegion( !bIgnoreVisArea ?
pSh->VisArea() :
getFrameArea() );
@@ -2055,7 +2054,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 //tdf#119224 start and end are expected to exist for the scope of this 
function
 SwFrameDeleteGuard aStartFrameGuard(pStartFrame), 
aEndFrameGuard(pEndFrame);
 
-//Do not subtract the FlyFrames in which selected Frames lie.
+// Do not subtract FlyFrames that contain selected Frames.
 SwSortedObjs aSortObjs;
 if ( pStartFrame->IsInFly() )
 {
@@ -2071,7 +2070,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
 }
 
 // if a selection which is not allowed exists, we correct what is not
-// allowed (header/footer/table-headline) for two pages.
+// allowed (header/footer/table-headline start/end on different pages).
 do {// middle check loop
 const SwLayoutFrame* pSttLFrame = pStartFrame->GetUpper();
 const SwFrameType cHdFtTableHd = SwFrameType::Header | 
SwFrameType::Footer | SwFrameType::Tab;
@@ -2377,7 +2376,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor )
   MultiPortionType::ROT_270 == pSt2Pos->nMultiType ||
   MultiPortionType::ROT_90  == pSt2Pos->nMultiType ) &&
 pSt2Pos->aPortion == pEnd2Pos->aPortion;
-//case 1: (Same frame and same row)
+// case 1: (Same frame and same line)
 if( 

[Libreoffice-commits] core.git: 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 d6527f127622f23ac529ce667fac5ff69ea33ea4
Author: Miklos Vajna 
AuthorDate: Wed Oct 25 09:45:05 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 26 08:26:21 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 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 688f1e9770a2..b671e2248550 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: sw/source

2023-10-25 Thread Mike Kaganski (via logerrit)
 sw/source/core/text/porfld.cxx |2 --
 sw/source/core/text/porfld.hxx |1 -
 sw/source/core/text/txtfld.cxx |   10 --
 3 files changed, 13 deletions(-)

New commits:
commit 3a87f9b67f3274fe4a02b003c49f893c87291c3d
Author: Mike Kaganski 
AuthorDate: Wed Oct 25 11:51:13 2023 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 25 14:28:47 2023 +0200

Drop unused SwFieldPortion::m_nAttrFieldType

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

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index e07747ff8a22..66f39644ffed 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -81,7 +81,6 @@ SwFieldPortion::SwFieldPortion(OUString aExpand, 
std::unique_ptr pFont,
 , m_bAnimated( false), m_bNoPaint( false)
 , m_bReplace( false), m_bPlaceHolder( bPlaceHold )
 , m_bNoLength( false )
-, m_nAttrFieldType(0)
 {
 SetWhichPor( PortionType::Field );
 }
@@ -103,7 +102,6 @@ SwFieldPortion::SwFieldPortion( const SwFieldPortion& 
rField )
 , m_bReplace( rField.m_bReplace )
 , m_bPlaceHolder( rField.m_bPlaceHolder )
 , m_bNoLength( rField.m_bNoLength )
-, m_nAttrFieldType( rField.m_nAttrFieldType)
 {
 if ( rField.HasFont() )
 m_pFont.reset( new SwFont( *rField.GetFont() ) );
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 39a08a5db665..e1c18fc9bd18 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -63,7 +63,6 @@ public:
 SwFieldPortion(OUString aExpand, std::unique_ptr pFnt = nullptr, 
bool bPlaceHolder = false, TextFrameIndex nLen = TextFrameIndex(1));
 virtual ~SwFieldPortion() override;
 
-sal_uInt16 m_nAttrFieldType;
 void TakeNextOffset( const SwFieldPortion* pField );
 void CheckScript( const SwTextSizeInfo  );
 bool HasFont() const { return nullptr != m_pFont; }
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index a728c36aec8b..462c9085036b 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -142,7 +142,6 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( 
SwTextFormatInfo ,
 : pField->ExpandField(bInClipboard, 
pFrame->getRootFrame()) );
 pRet = new SwFieldPortion( aStr );
 }
-static_cast(pRet)->m_nAttrFieldType= 
ATTR_PAGECOUNTFLD;
 break;
 
 case SwFieldIds::PageNumber:
@@ -170,7 +169,6 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( 
SwTextFormatInfo ,
 : pField->ExpandField(bInClipboard, 
pFrame->getRootFrame()) );
 pRet = new SwFieldPortion( aStr );
 }
-static_cast(pRet)->m_nAttrFieldType= 
ATTR_PAGENUMBERFLD;
 break;
 }
 case SwFieldIds::GetExp:
@@ -250,10 +248,6 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( 
SwTextFormatInfo ,
 : pField->ExpandField(bInClipboard, 
pFrame->getRootFrame()) );
 pRet = new SwFieldPortion(str);
 }
-if( subType == REF_BOOKMARK  )
-static_cast(pRet)->m_nAttrFieldType = 
ATTR_BOOKMARKFLD;
-else if( subType == REF_SETREFATTR )
-static_cast(pRet)->m_nAttrFieldType = 
ATTR_SETREFATTRFLD;
 }
 break;
 case SwFieldIds::DateTime:
@@ -264,10 +258,6 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( 
SwTextFormatInfo ,
 : pField->ExpandField(bInClipboard, 
pFrame->getRootFrame()) );
 pRet = new SwFieldPortion(str);
 }
-if( subType & DATEFLD  )
-static_cast(pRet)->m_nAttrFieldType= 
ATTR_DATEFLD;
-else if( subType & TIMEFLD )
-static_cast(pRet)->m_nAttrFieldType = 
ATTR_TIMEFLD;
 break;
 default:
 {


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

2023-10-25 Thread Michael Stahl (via logerrit)
 sw/source/core/text/itrpaint.cxx   |9 +++--
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |9 ++---
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 5dfae9e00f245da78613224ed8e0dbd8b6633192
Author: Michael Stahl 
AuthorDate: Wed Oct 25 12:03:53 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 25 13:37:10 2023 +0200

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

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

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

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 31bd418e94e2..4f0d412f2597 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -412,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);
@@ -435,14 +436,18 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 // note: numbering portion may be split if it has multiple scripts
 && !static_cast(pPor)->HasFollow()) // so 
wait for the last one
 {
-assert(roTaggedLabel);
-roTaggedLabel.reset(); // close Lbl
 if 
(!GetInfo().GetTextFrame()->GetTextNodeForParaProps()->IsOutline())
 {
+assert(roTaggedLabel);
+roTaggedLabel.reset(); // close Lbl
 assert(!roTaggedParagraph);
 Frame_Info aFrameInfo(*m_pFrame, false); // open LBody
 roTaggedParagraph.emplace(nullptr, , nullptr, 
*pOut);
 }
+else
+{
+assert(!roTaggedLabel);
+}
 }
 
 // reset underline font
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 70da866889aa..10881186be42 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3954,13 +3954,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157703)
 CPPUNIT_ASSERT(pKidsD0);
 auto pKidsD0v = pKidsD0->GetElements();
 auto pRefKidD00 = 
dynamic_cast(pKidsD0v[0]);
-CPPUNIT_ASSERT(pRefKidD00);
-auto pObjectD00 = pRefKidD00->LookupObject();
-CPPUNIT_ASSERT(pObjectD00);
-auto pTypeD00 = 
dynamic_cast(pObjectD00->Lookup("Type"));
-CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD00->GetValue());
-auto pSD00 = 
dynamic_cast(pObjectD00->Lookup("S"));
-CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pSD00->GetValue());
+// MCID for label
+CPPUNIT_ASSERT(!pRefKidD00);
 
 // MCID for text
 auto pRefKidD01 = 
dynamic_cast(pKidsD0v[1]);


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

2023-10-25 Thread Mike Kaganski (via logerrit)
 sw/source/core/text/txtfld.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 09e04efc7c33407271819c1fe7d4d500ca8fff2a
Author: Mike Kaganski 
AuthorDate: Wed Oct 25 11:47:56 2023 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 25 13:30:47 2023 +0200

Simplify a bit

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

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index a912e169995b..a728c36aec8b 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -64,14 +64,10 @@ static bool lcl_IsInBody( SwFrame const *pFrame )
 {
 if ( pFrame->IsInDocBody() )
 return true;
-else
-{
-const SwFrame *pTmp = pFrame;
-const SwFlyFrame *pFly;
-while ( nullptr != (pFly = pTmp->FindFlyFrame()) )
-pTmp = pFly->GetAnchorFrame();
-return pTmp->IsInDocBody();
-}
+
+while (const SwFlyFrame* pFly = pFrame->FindFlyFrame())
+pFrame = pFly->GetAnchorFrame();
+return pFrame->IsInDocBody();
 }
 
 SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo ,


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

2023-10-24 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 a5851d0a6fdc3e08e93daf8cf0ae7f6fc2d73ef6
Author: Michael Stahl 
AuthorDate: Fri Oct 20 20:03:11 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 24 14:25:43 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 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 46f8e1d07f84..ff47a693769f 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -523,6 +523,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() ) ||
@@ -664,6 +665,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 :
@@ -672,7 +679,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 =
@@ -1270,6 +1276,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
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 

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

2023-10-24 Thread Baole Fang (via logerrit)
 sw/source/ui/fldui/flddok.cxx |   11 +++
 sw/source/ui/fldui/flddok.hxx |2 +-
 sw/uiconfig/swriter/ui/flddocumentpage.ui |   11 +--
 3 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 27fde46937ecb71e7ce738cba430119a79cea77f
Author: Baole Fang 
AuthorDate: Sat Oct 21 01:13:59 2023 -0400
Commit: Heiko Tietze 
CommitDate: Tue Oct 24 09:10:13 2023 +0200

tdf#154052: Change "Level" spinbox to combobox

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

diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index a195ed026ec0..1a2857bedbdd 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -42,7 +42,7 @@ SwFieldDokPage::SwFieldDokPage(weld::Container* pPage, 
weld::DialogController* p
 , m_xValueFT(m_xBuilder->weld_label("valueft"))
 , m_xValueED(m_xBuilder->weld_entry("value"))
 , m_xLevelFT(m_xBuilder->weld_label("levelft"))
-, m_xLevelED(m_xBuilder->weld_spin_button("level"))
+, m_xLevelED(m_xBuilder->weld_combo_box("level"))
 , m_xDateFT(m_xBuilder->weld_label("daysft"))
 , m_xTimeFT(m_xBuilder->weld_label("minutesft"))
 , m_xDateOffsetED(m_xBuilder->weld_spin_button("offset"))
@@ -65,7 +65,10 @@ SwFieldDokPage::SwFieldDokPage(weld::Container* pPage, 
weld::DialogController* p
 m_xFormatLB->connect_row_activated(LINK(this, SwFieldDokPage, 
TreeViewInsertHdl));
 m_xNumFormatLB->connect_row_activated(LINK(this, SwFieldDokPage, 
NumFormatHdl));
 
-m_xLevelED->set_max(MAXLEVEL);
+for (sal_uInt16 i = 1; i <= MAXLEVEL; i++)
+m_xLevelED->append_text(OUString::number(i));
+
+m_xLevelED->set_active(0);
 m_xDateOffsetED->set_range(INT_MIN, INT_MAX);
 //enable 'active' language selection
 m_xNumFormatLB->SetShowLanguageControl(true);
@@ -356,7 +359,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, 
void)
 case SwFieldTypesEnum::Chapter:
 m_xValueFT->set_label(SwResId(STR_LEVEL));
 if (IsFieldEdit())
-
m_xLevelED->set_text(OUString::number(static_cast(GetCurField())->GetLevel(GetWrtShell()->GetLayout())
 + 1));
+
m_xLevelED->set_active(static_cast(GetCurField())->GetLevel(GetWrtShell()->GetLayout()));
 bLevel = true;
 break;
 
@@ -598,7 +601,7 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
 }
 
 case SwFieldTypesEnum::Chapter:
-aVal = m_xLevelED->get_text();
+aVal = OUString::number(m_xLevelED->get_active());
 break;
 
 default:
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
index b532b06f01f6..3192ecc0c6c2 100644
--- a/sw/source/ui/fldui/flddok.hxx
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -35,7 +35,7 @@ class SwFieldDokPage : public SwFieldPage
 std::unique_ptr m_xValueFT;
 std::unique_ptr m_xValueED;
 std::unique_ptr m_xLevelFT;
-std::unique_ptr m_xLevelED;
+std::unique_ptr m_xLevelED;
 std::unique_ptr m_xDateFT;
 std::unique_ptr m_xTimeFT;
 std::unique_ptr m_xDateOffsetED;
diff --git a/sw/uiconfig/swriter/ui/flddocumentpage.ui 
b/sw/uiconfig/swriter/ui/flddocumentpage.ui
index 6849333aabd3..75fca470e644 100644
--- a/sw/uiconfig/swriter/ui/flddocumentpage.ui
+++ b/sw/uiconfig/swriter/ui/flddocumentpage.ui
@@ -2,13 +2,6 @@
 
 
   
-  
-1
-10
-1
-1
-10
-  
   
 100
 1
@@ -356,11 +349,9 @@
   
 
 
-  
+  
 True
 True
-adjustment1
-True
 Select the first prior heading for 
display whose outline level is less than or equal to the specified 
value.
 
   


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

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

New commits:
commit e9ca8fb1af1e3d41160c13e8002f05a610a0bd0b
Author: Michael Stahl 
AuthorDate: Fri Oct 20 17:33:42 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 23 12:56:17 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 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index d66af6331c93..e9ba79f92e50 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3515,7 +3515,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: sw/source

2023-10-22 Thread Mike Kaganski (via logerrit)
 sw/source/core/access/acccontext.cxx   |   10 -
 sw/source/core/access/accdoc.cxx   |   12 -
 sw/source/core/access/accpara.cxx  |   12 -
 sw/source/core/doc/textboxhelper.cxx   |3 
 sw/source/core/docnode/finalthreadmanager.cxx  |2 
 sw/source/core/unocore/SwXTextDefaults.cxx |   14 -
 sw/source/core/unocore/unobkm.cxx  |4 
 sw/source/core/unocore/unochart.cxx|2 
 sw/source/core/unocore/unocoll.cxx |   54 +++---
 sw/source/core/unocore/unocontentcontrol.cxx   |   24 +-
 sw/source/core/unocore/unodraw.cxx |   20 +-
 sw/source/core/unocore/unofield.cxx|   20 +-
 sw/source/core/unocore/unoflatpara.cxx |2 
 sw/source/core/unocore/unoframe.cxx|   16 -
 sw/source/core/unocore/unoidx.cxx  |   27 +--
 sw/source/core/unocore/unoobj.cxx  |   23 +-
 sw/source/core/unocore/unoparagraph.cxx|   24 +-
 sw/source/core/unocore/unoport.cxx |   14 -
 sw/source/core/unocore/unorefmk.cxx|   18 +-
 sw/source/core/unocore/unosect.cxx |   22 +-
 sw/source/core/unocore/unosett.cxx |   18 +-
 sw/source/core/unocore/unosrch.cxx |6 
 sw/source/core/unocore/unostyle.cxx|   46 ++---
 sw/source/core/unocore/unotbl.cxx  |  183 ++---
 sw/source/uibase/config/StoredChapterNumbering.cxx |2 
 sw/source/uibase/uno/SwXDocumentSettings.cxx   |2 
 sw/source/uibase/uno/unoatxt.cxx   |2 
 sw/source/uibase/uno/unodispatch.cxx   |8 
 sw/source/uibase/uno/unomailmerge.cxx  |   36 ++--
 sw/source/uibase/uno/unotxdoc.cxx  |9 -
 sw/source/uibase/uno/unotxvw.cxx   |   49 ++---
 31 files changed, 333 insertions(+), 351 deletions(-)

New commits:
commit 69c7722b6c70db7a39657026689103f541543d4a
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:15:07 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Oct 22 13:43:03 2023 +0200

Use getXWeak in sw

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

diff --git a/sw/source/core/access/acccontext.cxx 
b/sw/source/core/access/acccontext.cxx
index 781533207793..46c4f4a825c7 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -529,7 +529,7 @@ void SwAccessibleContext::ThrowIfDisposed()
 if (IsDisposed())
 {
 throw lang::DisposedException("object is nonfunctional",
-static_cast(this));
+getXWeak());
 }
 }
 
@@ -828,7 +828,7 @@ uno::Reference< XAccessible > SAL_CALL 
SwAccessibleContext::getAccessibleAtPoint
 vcl::Window *pWin = GetWindow();
 if (!pWin)
 {
-throw uno::RuntimeException("no Window", 
static_cast(this));
+throw uno::RuntimeException("no Window", getXWeak());
 }
 
 Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
@@ -887,11 +887,11 @@ awt::Rectangle SwAccessibleContext::getBoundsImpl(bool 
bRelative)
 
 if (!pParent)
 {
-throw uno::RuntimeException("no Parent", 
static_cast(this));
+throw uno::RuntimeException("no Parent", getXWeak());
 }
 if (!pWin)
 {
-throw uno::RuntimeException("no Window", 
static_cast(this));
+throw uno::RuntimeException("no Window", getXWeak());
 }
 
 SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip 
relative to document root
@@ -947,7 +947,7 @@ awt::Point SAL_CALL 
SwAccessibleContext::getLocationOnScreen()
 vcl::Window *pWin = GetWindow();
 if (!pWin)
 {
-throw uno::RuntimeException("no Window", 
static_cast(this));
+throw uno::RuntimeException("no Window", getXWeak());
 }
 
 AbsoluteScreenPixelPoint aPixPosAbs = 
pWin->OutputToAbsoluteScreenPixel(aPixPos);
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 5c8cfde0faa5..d1bb9d84b150 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -228,7 +228,7 @@ awt::Rectangle SAL_CALL 
SwAccessibleDocumentBase::getBounds()
 vcl::Window *pWin = GetWindow();
 if (!pWin)
 {
-throw uno::RuntimeException("no Window", 
static_cast(this));
+throw uno::RuntimeException("no Window", getXWeak());
 }
 
 tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 
*pWin->GetAccessibleParentWindow() ) );
@@ -250,7 +250,7 @@ awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
 vcl::Window *pWin = GetWindow();
 if (!pWin)
 {
-throw uno::RuntimeException("no Window", 
static_cast(this));
+throw uno::RuntimeException("no Window", 

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

2023-10-20 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/uiview/view.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f0f1d74bdeafa09655813091b5259581f17b358d
Author: Caolán McNamara 
AuthorDate: Thu Oct 19 21:32:32 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 20 13:49:53 2023 +0200

ofz#63374 avoid Abrt

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

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 3bad54a839b8..a59bd9b5389d 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -486,7 +486,7 @@ void SwView::SelectShell()
 }
 
 // Show Mail Merge toolbar initially for documents with Database fields
-if (!m_bInitOnceCompleted && GetWrtShell().IsAnyDatabaseFieldInDoc())
+if (!m_bInitOnceCompleted && GetWrtShell().IsAnyDatabaseFieldInDoc() 
&& !utl::ConfigManager::IsFuzzing())
 ShowUIElement("private:resource/toolbar/mailmerge");
 
 // Activate the toolbar to the new selection which also was active 
last time.


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

2023-10-20 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/anchoredobject.cxx |   26 ++
 sw/source/core/text/xmldump.cxx  |   26 --
 2 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit d52982f4b3ba3f54adf21a9f185c726fb1a3db9a
Author: Miklos Vajna 
AuthorDate: Thu Oct 19 20:12:33 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 20 08:14:08 2023 +0200

sw layout xml dump: move SwAnchoredObject dumper

Next to the rest of the anchored object code.

So it's more likely that it gets updated as SwAnchoredObject changes.

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

diff --git a/sw/source/core/layout/anchoredobject.cxx 
b/sw/source/core/layout/anchoredobject.cxx
index 5f8a307867bf..42e7dd39fcd2 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -941,4 +941,30 @@ SwFlyFrame* SwAnchoredObject::DynCastFlyFrame()
 return nullptr;
 }
 
+void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const
+{
+(void)xmlTextWriterStartElement( writer, BAD_CAST( getElementName() ) );
+(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", 
this );
+(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("anchor-frame"), 
BAD_CAST(OString::number(mpAnchorFrame->GetFrameId()).getStr()));
+if (mpPageFrame)
+{
+(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("page-frame"), 
BAD_CAST(OString::number(mpPageFrame->GetFrameId()).getStr()));
+}
+SwTextFrame* pAnchorCharFrame = 
const_cast(this)->FindAnchorCharFrame();
+if (pAnchorCharFrame)
+{
+(void)xmlTextWriterWriteAttribute(writer, 
BAD_CAST("anchor-char-frame"), 
BAD_CAST(OString::number(pAnchorCharFrame->GetFrameId()).getStr()));
+}
+
+(void)xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
+// don't call GetObjBoundRect(), it modifies the layout
+SwRect(GetDrawObj()->GetLastBoundRect()).dumpAsXmlAttributes(writer);
+(void)xmlTextWriterEndElement( writer );
+
+if (const SdrObject* pObject = GetDrawObj())
+pObject->dumpAsXml(writer);
+
+(void)xmlTextWriterEndElement( writer );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 345740858783..8284ac3fdc58 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -252,30 +252,4 @@ void SwFrame::dumpChildrenAsXml( xmlTextWriterPtr writer ) 
const
 }
 }
 
-void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const
-{
-(void)xmlTextWriterStartElement( writer, BAD_CAST( getElementName() ) );
-(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", 
this );
-(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("anchor-frame"), 
BAD_CAST(OString::number(mpAnchorFrame->GetFrameId()).getStr()));
-if (mpPageFrame)
-{
-(void)xmlTextWriterWriteAttribute(writer, BAD_CAST("page-frame"), 
BAD_CAST(OString::number(mpPageFrame->GetFrameId()).getStr()));
-}
-SwTextFrame* pAnchorCharFrame = 
const_cast(this)->FindAnchorCharFrame();
-if (pAnchorCharFrame)
-{
-(void)xmlTextWriterWriteAttribute(writer, 
BAD_CAST("anchor-char-frame"), 
BAD_CAST(OString::number(pAnchorCharFrame->GetFrameId()).getStr()));
-}
-
-(void)xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
-// don't call GetObjBoundRect(), it modifies the layout
-SwRect(GetDrawObj()->GetLastBoundRect()).dumpAsXmlAttributes(writer);
-(void)xmlTextWriterEndElement( writer );
-
-if (const SdrObject* pObject = GetDrawObj())
-pObject->dumpAsXml(writer);
-
-(void)xmlTextWriterEndElement( writer );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-10-19 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   |   21 +-
 vcl/qa/cppunit/pdfexport/data/LO_Lbl_Lbody_bug_report.fodt |  125 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   83 
 5 files changed, 227 insertions(+), 9 deletions(-)

New commits:
commit 7cb283cf0e92cba4bd53b1cd69816ac7037937e4
Author: Michael Stahl 
AuthorDate: Wed Oct 18 19:15:22 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Oct 19 17:15:48 2023 +0200

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)

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

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index b71b699b8e36..50e62aeff964 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1305,7 +1305,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 43f5922999d4..57458a021817 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..6d07ef7dc468 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);
@@ -436,9 +437,12 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 {
 assert(roTaggedLabel);
 roTaggedLabel.reset(); // close Lbl
-assert(!roTaggedParagraph);
-Frame_Info aFrameInfo(*m_pFrame, false); // open LBody
-roTaggedParagraph.emplace(nullptr, , nullptr, *pOut);
+if 
(!GetInfo().GetTextFrame()->GetTextNodeForParaProps()->IsOutline())
+{
+assert(!roTaggedParagraph);
+Frame_Info aFrameInfo(*m_pFrame, false); // open LBody
+roTaggedParagraph.emplace(nullptr, , nullptr, 
*pOut);
+}
 }
 
 // reset underline font
@@ -461,7 +465,7 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
  pNext && pNext->IsHolePortion() ) ?
pNext :
nullptr;
-if (!pPor && isPDFTaggingEnabled && !roTaggedParagraph)
+if (!pPor && isPDFTaggingEnabled && (roTaggedLabel || 

[Libreoffice-commits] core.git: 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 adef72f8411a49920a75d3ceee7c1dc61ca0a470
Author: Michael Stahl 
AuthorDate: Wed Oct 18 15:17:29 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 18 20:18:03 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 

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: sw/source

2023-10-18 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 626fe9ab5ebebc4ef36e35f4aa597c03a3564d22
Author: Miklos Vajna 
AuthorDate: Wed Oct 18 08:52:44 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 18 14:20:37 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

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index f7bfd409322a..c3fa35fcdc7b 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 7e4841fdb0c6..14d5d842e604 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2779,13 +2779,42 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo 
 )
 

[Libreoffice-commits] core.git: 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 680ae3e989c3b665b29f536c2e30dd86bbc3edac
Author: Michael Weghorn 
AuthorDate: Wed Oct 18 10:59:33 2023 +0200
Commit: Michael Weghorn 
CommitDate: Wed Oct 18 13:47:35 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 

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 143472a83042..8d6239497eb6 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: sw/source

2023-10-18 Thread Mike Kaganski (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4fc2c23a42b7225f482ffc68d9e2cffed4cc1602
Author: Mike Kaganski 
AuthorDate: Tue Oct 17 12:38:48 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Oct 18 08:20:56 2023 +0200

Simplify a bit

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4a4d440abc44..6921b32d0043 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5118,7 +5118,7 @@ void DocxAttributeOutput::WriteSrcRect(
 nCropB -= pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM );
 }
 
-if ( !((0 != nCropL) || (0 != nCropT) || (0 != nCropR) || (0 != nCropB)) )
+if (nCropL == 0 && nCropT == 0 && nCropR == 0 && nCropB == 0)
 return;
 
 double  widthMultiplier  = 10.0/aOriginalSize.Width();


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

2023-10-17 Thread Julien Nabet (via logerrit)
 sw/source/filter/xml/xmltbli.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 0875594b381e2765f2b6413074c470f9eec33201
Author: Julien Nabet 
AuthorDate: Tue Oct 17 15:10:00 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Oct 17 16:42:33 2023 +0200

Related tdf#157726: make iterators local to loops

to avoid crash in debug mode, see bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=190245)

+ use != for iterator comparisons

Change-Id: I5b1e502097d723e6acc17687171195d81c60dcbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158086
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 1c9c6a8345b2..72b99fb0f7ec 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2218,7 +2218,6 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox 
*pUpper,
 void SwXMLTableContext::MakeTable_( SwTableBox *pBox )
 {
 // fix column widths
-std::vector::iterator colIter;
 sal_uInt32 nCols = GetColumnCount();
 
 // If there are empty rows (because of some row span of previous rows)
@@ -2316,7 +2315,7 @@ void SwXMLTableContext::MakeTable_( SwTableBox *pBox )
 {
 double n = static_cast(m_nWidth) / 
static_cast(nRelWidth);
 nRelWidth = 0;
-for( colIter = m_aColumnWidths.begin(); colIter < 
m_aColumnWidths.end() - 1; ++colIter)
+for( auto colIter = m_aColumnWidths.begin(); colIter != 
(m_aColumnWidths.end() - 1); ++colIter)
 {
 sal_Int32 nW = static_cast( colIter->width * n);
 colIter->width = o3tl::narrowing(nW);
@@ -2417,7 +2416,7 @@ void SwXMLTableContext::MakeTable_( SwTableBox *pBox )
 // column widths, every column get some extra width.
 sal_Int32 nExtraAbs = m_nWidth - nAbsWidth;
 sal_Int32 nAbsLastCol = m_aColumnWidths.back().width + 
nExtraAbs;
-for( colIter = m_aColumnWidths.begin(); colIter < 
m_aColumnWidths.end()-1; ++colIter )
+for( auto colIter = m_aColumnWidths.begin(); colIter != 
(m_aColumnWidths.end() - 1); ++colIter )
 {
 sal_Int32 nAbsCol = colIter->width;
 sal_Int32 nExtraAbsCol = (nAbsCol * nExtraAbs) /
@@ -2435,7 +2434,7 @@ void SwXMLTableContext::MakeTable_( SwTableBox *pBox )
 // Every column gets the minimum width plus some extra width.
 sal_Int32 nExtraAbs = m_nWidth - (nCols * MINLAY);
 sal_Int32 nAbsLastCol = MINLAY + nExtraAbs;
-for( colIter = m_aColumnWidths.begin(); colIter < 
m_aColumnWidths.end()-1; ++colIter )
+for( auto colIter = m_aColumnWidths.begin(); colIter != 
(m_aColumnWidths.end() - 1); ++colIter )
 {
 sal_Int32 nAbsCol = colIter->width;
 sal_Int32 nExtraAbsCol = (nAbsCol * nExtraAbs) /


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

2023-10-16 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/glbltree.cxx |   28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 2a05fd0fd2b6c4ad8fd900565f3640f1ef47a165
Author: Jim Raykowski 
AuthorDate: Mon Oct 9 20:22:04 2023 -0800
Commit: Jim Raykowski 
CommitDate: Tue Oct 17 07:24:37 2023 +0200

tdf#144349 related: Make master document navigator track Text content

Done, with a related patch to make the master document navigator track TOX 
content, to make the Navigator less likely not to have an item selected, which 
may be enough to resolve tdf#155741 - Allow insertion of items into master 
without a selected item

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

diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index fe18195e7c22..8c8fef089161 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -787,12 +787,12 @@ IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
 }
 }
 
+// track GlobalDocContentType at the cursor position in the document
 void SwGlobalTree::UpdateTracking()
 {
 if (!m_pActiveShell)
 return;
 
-// track section at cursor position in document
 m_xTreeView->unselect_all();
 
 const SwSection* pActiveShellCurrSection = 
m_pActiveShell->GetCurrSection();
@@ -816,6 +816,32 @@ void SwGlobalTree::UpdateTracking()
 }
 }
 }
+else
+{
+const SwCursor* pCursor = m_pActiveShell->GetCursor();
+const SwNode& rNode = pCursor->GetPoint()->GetNode();
+if (rNode.IsTextNode())
+{
+// only the first text node in each series of text nodes is stored 
in the
+// SwGlblDocContents array
+SwNodeIndex aIdx(rNode);
+do
+{
+--aIdx;
+} while (aIdx.GetNode().IsTextNode());
+++aIdx;
+SwNodeOffset aTextNodeIndex(aIdx.GetNode().GetIndex());
+for (const std::unique_ptr& rGlblDocContent : 
*m_pSwGlblDocContents)
+{
+if (rGlblDocContent->GetType() == 
GlobalDocContentType::GLBLDOC_UNKNOWN
+&& rGlblDocContent->GetDocPos() == aTextNodeIndex)
+{
+const OUString& rId(weld::toId(rGlblDocContent.get()));
+m_xTreeView->select(m_xTreeView->find_id(rId));
+}
+}
+}
+}
 
 Select();
 }


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

2023-10-16 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/glbltree.cxx |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit b97aa4eada3164b20f663a9817e92af78495109f
Author: Jim Raykowski 
AuthorDate: Sun Oct 8 22:42:09 2023 -0800
Commit: Jim Raykowski 
CommitDate: Tue Oct 17 05:20:05 2023 +0200

tdf#144349 related: Make master document navigator track TOX content

Done, with a related patch to make the master document navigator track 
'Text' content, to make the Navigator less likely not to have an item selected, 
which may be enough to resolve tdf#155741 - Allow insertion of items into 
master without a selected item

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

diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index 26dd58f5b7ea..fe18195e7c22 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -801,7 +801,20 @@ void SwGlobalTree::UpdateTracking()
 const SwSection* pSection = pActiveShellCurrSection;
 while (SwSection* pParent = pSection->GetParent())
 pSection = pParent;
-m_xTreeView->select_text(pSection->GetSectionName());
+for (const std::unique_ptr& rGlblDocContent : 
*m_pSwGlblDocContents)
+{
+if (rGlblDocContent->GetType() == 
GlobalDocContentType::GLBLDOC_UNKNOWN)
+continue;
+if ((pSection->GetType() == SectionType::ToxContent
+ && rGlblDocContent->GetTOX() == pSection->GetTOXBase())
+|| (pSection->GetType() != SectionType::ToxContent
+&& rGlblDocContent->GetSection() == pSection))
+{
+const OUString& rId(weld::toId(rGlblDocContent.get()));
+m_xTreeView->select(m_xTreeView->find_id(rId));
+break;
+}
+}
 }
 
 Select();


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

2023-10-16 Thread Mike Kaganski (via logerrit)
 sw/source/core/edit/eddel.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2247b00230e479e63ab996d4e1694b1d74aeba81
Author: Mike Kaganski 
AuthorDate: Mon Oct 16 20:04:10 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Oct 16 22:06:04 2023 +0200

Simplify a bit

Non-negative nCommentPos implies non-empty selection.

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

diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 989cddfd3a28..9eb51da617b1 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -382,12 +382,12 @@ bool SwEditShell::ReplaceKeepComments( const OUString& 
rNewStr)
 OUString aSelectedText = pCursor->GetText();
 sal_Int32 nCommentPos(aSelectedText.lastIndexOf(CH_TXTATR_INWORD));
 // go sure that we have a valid selection and a comment has been 
found
-while((nCommentPos > -1) && (aSelectedText.getLength() > 0) && 
(pCursor->HasMark()))
+while (nCommentPos > -1)
 {
 // select the part of the text after the last found comment
 // selection start:
 pCursor->GetPoint()->AdjustContent(nCommentPos + 1);
-// selection end ist left where it is -> will be adjusted 
later on
+// selection end is left where it is -> will be adjusted later 
on
 // delete the part of the word after the last found comment
 Replace(OUString(), false);
 // put the selection start back to the beginning of the word


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

2023-10-16 Thread Mike Kaganski (via logerrit)
 sw/source/core/layout/ftnfrm.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 2b8b6ced7c67e6a56f06b02e92f0555a796f3b16
Author: Mike Kaganski 
AuthorDate: Mon Oct 16 20:05:42 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Oct 16 20:41:05 2023 +0200

Simplify a bit

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

diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 78d25949c91b..4baed772787b 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2558,9 +2558,9 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const
 if( pBody )
 {
 SwRectFnSet aRectFnSet(this);
+nRet = aRectFnSet.GetHeight(pBody->getFrameArea());
 if( IsInSct() )
 {
-nRet = 0;
 SwTwips nTmp = aRectFnSet.YDiff( aRectFnSet.GetPrtTop(*pBody),

aRectFnSet.GetTop(getFrameArea()) );
 const SwSectionFrame* pSect = FindSctFrame();
@@ -2594,12 +2594,11 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const
 }
 }
 }
-if( nTmp < nRet )
-nRet = nTmp;
+if( nTmp < 0 )
+nRet += nTmp;
 }
 else
-nRet = - aRectFnSet.GetHeight(pPg->getFramePrintArea())/5;
-nRet += aRectFnSet.GetHeight(pBody->getFrameArea());
+nRet -= aRectFnSet.GetHeight(pPg->getFramePrintArea())/5;
 if( nRet < 0 )
 nRet = 0;
 }


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

2023-10-16 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/pormulti.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 00904f994a2f03638ec7f284396aeb730746e68d
Author: Caolán McNamara 
AuthorDate: Mon Oct 16 17:01:59 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 16 20:11:36 2023 +0200

ofz#63295 Null-dereference READ

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

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 2067adcfc155..7a2e8c44c653 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -2505,7 +2505,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const 
SwLineLayout* pLine,
 pTmp = new SwDoubleLinePortion( *pCreate, nMultiPos );
 else if( pHelpMulti->IsBidi() )
 pTmp = new SwBidiPortion( nMultiPos, pCreate->nLevel );
-else if (IsIncompleteRuby(*pHelpMulti))
+else if (IsIncompleteRuby(*pHelpMulti) && pCreate->pAttr)
 {
 TextFrameIndex nRubyOffset = static_cast(pHelpMulti)->GetRubyOffset();
 pTmp = new SwRubyPortion( *pCreate, *GetInfo().GetFont(),


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

2023-10-16 Thread Pranam Lashkari (via logerrit)
 sw/source/uibase/utlui/content.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 5af582071da444af338c8cd0a9657f73f9a5f52f
Author: Pranam Lashkari 
AuthorDate: Tue Aug 29 17:37:38 2023 +0800
Commit: Caolán McNamara 
CommitDate: Mon Oct 16 09:43:23 2023 +0200

LOK: update navigator instantly on heading level change

problem:
i.e: when you change the header level,
it was not reflected instantly in navigator and required reopening it.
That was due to header level change was not registed as change in LOK case

Change-Id: I503eb6a3fe9d2801ea5b45b0a1096e8174360ddc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156239
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Attila Szűcs 
(cherry picked from commit 1fca94be7fafc305cf02c0134fbc2d7e5cfb2a03)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157967
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index ca4e431f8038..a5079e411331 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3024,18 +3024,24 @@ bool SwContentTree::HasContentChanged()
 // In case of LOK, empty contentTypes are hidden, even in all 
content view
 // so it is not enough to check only the m_xTreeView.
 bool bCountChanged = false;
+bool bHasContentChanged = false;
 for (ContentTypeId i : o3tl::enumrange())
 {
 if (m_aActiveContentArr[i])
 {
 auto nLastTMCount = 
m_aActiveContentArr[i]->GetMemberCount();
-m_aActiveContentArr[i]->FillMemberList();
+if (i == ContentTypeId::OUTLINE) // this is required for 
checking if header level is changed
+
m_aActiveContentArr[i]->FillMemberList();
+else
+m_aActiveContentArr[i]->FillMemberList();
 // If the member count of a type is changed, then the 
content is surely changed
 if (m_aActiveContentArr[i]->GetMemberCount() != 
nLastTMCount)
 bCountChanged = true;
+if (bHasContentChanged)
+bContentChanged = true;
 }
 }
-if (bCountChanged)
+if (bCountChanged || bContentChanged)
 return true;
 }
 


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

2023-10-15 Thread Attila Szűcs (via logerrit)
 sw/source/uibase/utlui/content.cxx |   29 +
 1 file changed, 29 insertions(+)

New commits:
commit 52500239e8a5a8c897a1af25b40e6b4d004eb21b
Author: Attila Szűcs 
AuthorDate: Thu Jun 8 11:21:16 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sun Oct 15 11:25:51 2023 +0200

LOK: navigator: hide empty contentTypes

In case of LOK, do not insert empty contenttype to tree,
and implement new way to find changes in contents, in hidden
contentTypes, because the original checked only on the tree.

Change-Id: Ib1e4da5e05b2ad4161c6a66a9c54111d558f66f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152735
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
(cherry picked from commit ed3bb61461e4e394bd476b4ec57ff3025eca153f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157983
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 64e2c4aad25b..ca4e431f8038 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -2616,6 +2617,13 @@ void SwContentTree::Display( bool bActive )
 
 OUString aImage(GetImageIdForContentTypeId(nCntType));
 bool bChOnDemand = 0 != rpContentT->GetMemberCount();
+
+// In case of LOK, empty content types must be hidden in the 
contenttree
+if (comphelper::LibreOfficeKit::isActive() && !bChOnDemand)
+{
+continue;
+}
+
 OUString sId(weld::toId(rpContentT.get()));
 insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, 
xEntry.get());
 m_xTreeView->set_image(*xEntry, aImage);
@@ -3010,6 +3018,27 @@ bool SwContentTree::HasContentChanged()
 // is detected only fill member lists for remaining content types. The 
Display function
 // will clear and recreate the treeview from the content type member 
arrays if content has
 // changed.
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+// In case of LOK, empty contentTypes are hidden, even in all 
content view
+// so it is not enough to check only the m_xTreeView.
+bool bCountChanged = false;
+for (ContentTypeId i : o3tl::enumrange())
+{
+if (m_aActiveContentArr[i])
+{
+auto nLastTMCount = 
m_aActiveContentArr[i]->GetMemberCount();
+m_aActiveContentArr[i]->FillMemberList();
+// If the member count of a type is changed, then the 
content is surely changed
+if (m_aActiveContentArr[i]->GetMemberCount() != 
nLastTMCount)
+bCountChanged = true;
+}
+}
+if (bCountChanged)
+return true;
+}
+
 std::unique_ptr xEntry(m_xTreeView->make_iterator());
 
 // lambda function to find the next content type entry


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

2023-10-15 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/wrtsh/wrtsh1.cxx |   35 ---
 1 file changed, 8 insertions(+), 27 deletions(-)

New commits:
commit 148394645cf753e8548b7cff6effe4ae69ca0fbd
Author: Jim Raykowski 
AuthorDate: Thu Oct 12 14:36:38 2023 -0800
Commit: Jim Raykowski 
CommitDate: Sun Oct 15 08:55:46 2023 +0200

tdf#154701 Fix move paragraph not working properly with outline folding

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

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9dc476fb18ba..912283dd20fc 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2334,7 +2334,7 @@ bool SwWrtShell::IsOutlineContentVisible(const size_t 
nPos)
 
 // no layout frame means outline folding is set to include sub levels and 
the outline node has
 // a parent outline node with outline content visible attribute false 
(folded outline content)
-if (!pOutlineNode->GetTextNode()->getLayoutFrame(nullptr))
+if (!pOutlineNode->GetTextNode()->getLayoutFrame(GetLayout()))
 return false;
 
 // try the next node to determine if this outline node has visible content
@@ -2357,7 +2357,7 @@ bool SwWrtShell::IsOutlineContentVisible(const size_t 
nPos)
 return GetAttrOutlineContentVisible(nPos);
 
 if (aIdx.GetNode().IsTextNode())
-return aIdx.GetNode().GetTextNode()->getLayoutFrame(nullptr);
+return aIdx.GetNode().GetTextNode()->getLayoutFrame(GetLayout());
 if (aIdx.GetNode().IsTableNode())
 {
 SwTable& rTable = aIdx.GetNode().GetTableNode()->GetTable();
@@ -2592,43 +2592,24 @@ void 
SwWrtShell::MakeAllFoldedOutlineContentVisible(bool bMakeVisible)
 }
 else
 {
-if (SdrView* pSdrView = GetDrawView(); pSdrView && 
pSdrView->IsTextEdit() )
-{
-bool bLockView = IsViewLocked();
-LockView(true);
-EndTextEdit();
-LockView(bLockView);
-}
-if (IsSelFrameMode() || IsObjSelected())
-{
-UnSelectFrame();
-LeaveSelFrameMode();
-GetView().LeaveDrawCreate();
-EnterStdMode();
-}
-
-// Get current frame in which the cursor is positioned for use in 
placing the cursor.
-const SwFrame* pCurrFrame = GetCurrFrame(false);
+AssureStdMode();
 
+// Get the outline position of the cursor so the cursor can be place 
at a visible outline
+// node if it is not visible after InvalidateOutlineContentVisiblity 
below.
 SwOutlineNodes::size_type nPos = GetOutlinePos();
 
 StartAction();
 InvalidateOutlineContentVisibility();
 EndAction();
 
-// If needed, find visible outline node frame to place cursor.
-if (!pCurrFrame || !pCurrFrame->isFrameAreaDefinitionValid() || 
pCurrFrame->IsInDtor() ||
-(nPos != SwOutlineNodes::npos &&
- 
!GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr)))
+// If needed, find a visible outline node to place the cursor.
+if (nPos != SwOutlineNodes::npos && !IsOutlineContentVisible(nPos))
 {
 while (nPos != SwOutlineNodes::npos &&
-   
!GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr))
+   
!GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(GetLayout()))
 --nPos;
 if (nPos != SwOutlineNodes::npos)
-{
-EnterStdMode();
 GotoOutline(nPos);
-}
 }
 }
 GetView().GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));


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

2023-10-14 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 18f35dffae44e741ea492ed5304f2d2d9d000f2d
Author: Jim Raykowski 
AuthorDate: Thu Oct 12 09:01:27 2023 -0800
Commit: Jim Raykowski 
CommitDate: Sat Oct 14 20:38:44 2023 +0200

tdf#152029 related: Remove attention overlay on document view change

Fixes stale overlay that can happen when Navigator use causes a
document view change. For example, when the Navigator is used to
change a heading level or to delete a heading by key input.

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 9d96415c5c35..64e2c4aad25b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3272,6 +3272,7 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint 
const& rHint)
 break;
 }
 case SfxHintId::DocChanged:
+OverlayObject();
 if (!m_bIgnoreDocChange)
 {
 m_bDocHasChanged = true;


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

2023-10-14 Thread Andrea Gelmini (via logerrit)
 sw/source/core/doc/docredln.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f979ca1061a1b6fff123e150aec14756b8a5780d
Author: Andrea Gelmini 
AuthorDate: Sat Oct 14 12:25:30 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 14 16:29:41 2023 +0200

Fix typo

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

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 50c259faee6b..3a70299ce1a5 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1110,7 +1110,7 @@ bool SwRedlineData::CanCombine(const SwRedlineData& rCmp) 
const
 }
 
 // Check if we could/should accept/reject the 2 redlineData at the same time.
-// No need to check its childs equality
+// No need to check its children equality
 bool SwRedlineData::CanCombineForAcceptReject(const SwRedlineData& rCmp) const
 {
 return m_nAuthor == rCmp.m_nAuthor &&


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

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

New commits:
commit 79df80b642179fdd621538e8a7894a2f055ba16a
Author: Jim Raykowski 
AuthorDate: Sun Oct 8 23:13:51 2023 -0800
Commit: Jim Raykowski 
CommitDate: Fri Oct 13 21:28:48 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 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 7456d2a28e12..9d96415c5c35 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3981,36 +3981,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: sw/source sw/uiconfig

2023-10-12 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/inc/content.hxx   |7 --
 sw/source/uibase/utlui/content.cxx |   29 +++--
 sw/uiconfig/swriter/ui/navigatorcontextmenu.ui |9 +++
 3 files changed, 37 insertions(+), 8 deletions(-)

New commits:
commit 6afffcee5fcf7c9719abe7176468d20602e750bf
Author: Jim Raykowski 
AuthorDate: Tue Oct 10 19:06:21 2023 -0800
Commit: Jim Raykowski 
CommitDate: Thu Oct 12 19:13:59 2023 +0200

tdf#42787 SwNavigator: Add ability to delete Sections

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

diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx
index f7666e97244b..c2a922189894 100644
--- a/sw/source/uibase/inc/content.hxx
+++ b/sw/source/uibase/inc/content.hxx
@@ -60,15 +60,18 @@ class SwRegionContent final : public SwContent
 {
 
 sal_uInt8   m_nRegionLevel;
+const SwSectionFormat* m_pSectionFormat;
 
 public:
 SwRegionContent(const SwContentType* pCnt,
 const OUString& rName,
 sal_uInt8 nLevel,
-tools::Long nYPos) :
+tools::Long nYPos,
+const SwSectionFormat* pSectionFormat) :
 SwContent(pCnt, rName, nYPos),
-m_nRegionLevel(nLevel){}
+m_nRegionLevel(nLevel), 
m_pSectionFormat(pSectionFormat){}
 sal_uInt8   GetRegionLevel() const {return m_nRegionLevel;}
+const SwSectionFormat* GetSectionFormat() const {return m_pSectionFormat;}
 };
 
 class SwURLFieldContent final : public SwContent
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index c9a30aaddfe4..7456d2a28e12 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -378,7 +378,7 @@ SwContentType::SwContentType(SwWrtShell* pShell, 
ContentTypeId nType, sal_uInt8
 case ContentTypeId::REGION:
 m_sTypeToken = "region";
 m_bEdit = true;
-m_bDelete = false;
+m_bDelete = true;
 break;
 case ContentTypeId::INDEX:
 m_bEdit = true;
@@ -796,8 +796,10 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 pParentFormat = pParentFormat->GetParent();
 }
 
-std::unique_ptr pCnt(new SwRegionContent(this, 
sSectionName,
-nLevel, m_bAlphabeticSort ? 0 : 
getYPos(pNodeIndex->GetNode(;
+auto pCnt(std::make_unique(this, 
sSectionName, nLevel,
+m_bAlphabeticSort ? 0 : 
getYPos(pNodeIndex->GetNode()),
+pFormat));
+
 if(!pFormat->IsVisible())
 pCnt->SetInvisible();
 m_pMember->insert(std::move(pCnt));
@@ -1661,6 +1663,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
  bRemoveDeleteImageEntry = true,
  bRemoveDeleteOLEObjectEntry = true,
  bRemoveDeleteBookmarkEntry = true,
+ bRemoveDeleteRegionEntry = true,
  bRemoveDeleteHyperlinkEntry = true,
  bRemoveDeleteReferenceEntry = true,
  bRemoveDeleteIndexEntry= true,
@@ -1783,8 +1786,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 && 
m_pActiveShell->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS);
 const bool bEditable = pType->IsEditable() &&
 ((bVisible && !bProtected) || ContentTypeId::REGION == 
nContentType);
-const bool bDeletable = pType->IsDeletable() &&
-((bVisible && !bProtected && !bProtectBM) || 
ContentTypeId::REGION == nContentType);
+const bool bDeletable = pType->IsDeletable() && bVisible && 
!bProtected && !bProtectBM;
 const bool bRenamable = bEditable && !bReadonly &&
 (ContentTypeId::TABLE == nContentType ||
  ContentTypeId::FRAME == nContentType ||
@@ -1817,6 +1819,9 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 case ContentTypeId::BOOKMARK:
 bRemoveDeleteBookmarkEntry = false;
 break;
+case ContentTypeId::REGION:
+bRemoveDeleteRegionEntry = false;
+break;
 case ContentTypeId::URLFIELD:
 bRemoveDeleteHyperlinkEntry = false;
 break;
@@ -1962,6 +1967,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 xPop->remove("deleteoleobject");
 if (bRemoveDeleteBookmarkEntry)
 

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

2023-10-12 Thread Mike Kaganski (via logerrit)
 sw/source/core/txtnode/fntcache.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a0b003257aa87d34a4403531798d0074e19a18ac
Author: Mike Kaganski 
AuthorDate: Thu Oct 12 10:48:38 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Oct 12 14:16:46 2023 +0200

Fix Windows x64 build

...after 6f45c0cf86b21772740bb0cafb3d462b058523f3 "cool#7318 Calc rendering
acceleration" caused

> sw/source/core/txtnode/fntcache.cxx(540): error C2672: 'std::min': no 
matching overloaded function found
> 
C:\PROGRA~1\MICROS~3\2022\Preview\VC\Tools\MSVC\1438~1.331\Include\utility(108):
 note: could be '_Ty std::min(std::initializer_list<_Elem>)'
> sw/source/core/txtnode/fntcache.cxx(540): note: '_Ty 
std::min(std::initializer_list<_Elem>)': expects 1 arguments - 2 provided
> 
C:\PROGRA~1\MICROS~3\2022\Preview\VC\Tools\MSVC\1438~1.331\Include\utility(105):
 note: or   '_Ty std::min(std::initializer_list<_Elem>,_Pr)'
> sw/source/core/txtnode/fntcache.cxx(540): note: '_Ty 
std::min(std::initializer_list<_Elem>,_Pr)': could not deduce template argument 
for 'std::initializer_list<_Elem>' from 'sal_Int32'
> 
C:\PROGRA~1\MICROS~3\2022\Preview\VC\Tools\MSVC\1438~1.331\Include\utility(98): 
note: or   'const _Ty ::min(const _Ty &,const _Ty &) noexcept()'
> sw/source/core/txtnode/fntcache.cxx(540): note: 'const _Ty 
::min(const _Ty &,const _Ty &) noexcept()': template parameter '_Ty' 
is ambiguous
> sw/source/core/txtnode/fntcache.cxx(540): note: could be 'tools::Long'
> sw/source/core/txtnode/fntcache.cxx(540): note: or   'sal_Int32'
> sw/source/core/txtnode/fntcache.cxx(540): note: 'const _Ty 
::min(const _Ty &,const _Ty &) noexcept()': could not deduce template 
argument for 'const _Ty &' from 'tools::Long'
> 
C:\PROGRA~1\MICROS~3\2022\Preview\VC\Tools\MSVC\1438~1.331\Include\utility(88): 
note: or   'const _Ty ::min(const _Ty &,const _Ty &,_Pr) 
noexcept()'
> sw/source/core/txtnode/fntcache.cxx(540): note: 'const _Ty 
::min(const _Ty &,const _Ty &,_Pr) noexcept()': expects 3 arguments - 
2 provided

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

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index bc5dd603a433..4e9f2a1c1dc7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -516,7 +516,7 @@ void SwFntObj::GuessLeading( const SwViewShell&
 {
 // If the Leading on the Window is also 0, then it has to stay
 // that way (see also StarMath).
-tools::Long nTmpLeading = aWinMet.GetInternalLeading();
+sal_Int32 nTmpLeading = aWinMet.GetInternalLeading();
 if( nTmpLeading <= 0 )
 {
 pWin->SetFont( rMet );
@@ -537,7 +537,7 @@ void SwFntObj::GuessLeading( const SwViewShell&
 // Those who lie about their Leading, may lie about their
 // Ascent/Descent as well, hence the Font will be lowered a
 // little without changing its height.
-tools::Long nDiff = std::min( rMet.GetDescent() - 
aWinMet.GetDescent(),
+sal_Int32 nDiff = std::min( rMet.GetDescent() - 
aWinMet.GetDescent(),
 aWinMet.GetAscent() - rMet.GetAscent() - nTmpLeading );
 if( nDiff > 0 )
 {


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

2023-10-11 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/shells/translatehelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 44fed6aec98320bf7ec793f08447bb8d455abc4f
Author: Mike Kaganski 
AuthorDate: Wed Oct 11 18:01:19 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Oct 12 07:40:45 2023 +0200

Do not compare SwContentIndex instances from different nodes

It fires an assert in dbgutil builds; and it doesn't make sense
anyway: we must use the index from the beginning, not a strange
minimal value between indices in start node and end node.

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

diff --git a/sw/source/uibase/shells/translatehelper.cxx 
b/sw/source/uibase/shells/translatehelper.cxx
index c62e4a59749c..64cd27e1fe1d 100644
--- a/sw/source/uibase/shells/translatehelper.cxx
+++ b/sw/source/uibase/shells/translatehelper.cxx
@@ -178,7 +178,7 @@ void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const 
TranslateAPIConfig&
 else if (n == startNode)
 {
 cursor->SetMark();
-cursor->GetPoint()->nContent = std::min(aPoint.nContent, 
aMark.nContent);
+cursor->GetPoint()->nContent = aPoint.nContent;
 }
 else if (n == endNode)
 {


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

2023-10-11 Thread Caolán McNamara (via logerrit)
 sw/source/core/inc/txtfly.hxx  |4 ++--
 sw/source/core/text/txtfly.cxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 27a813ce1f88780dd7ddf64be98e23889b693e2e
Author: Caolán McNamara 
AuthorDate: Wed Oct 11 11:16:56 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 11 20:26:39 2023 +0200

InitAnchoredObjList never returns null

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

diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx
index fe0782dcf938..e363934a8ba1 100644
--- a/sw/source/core/inc/txtfly.hxx
+++ b/sw/source/core/inc/txtfly.hxx
@@ -153,7 +153,7 @@ class SwTextFly
  */
 SwRect GetFrame_( const SwRect  ) const;
 
-SwAnchoredObjList* InitAnchoredObjList();
+SwAnchoredObjList& InitAnchoredObjList();
 
 public:
 SwAnchoredObjList* GetAnchoredObjList() const;
@@ -315,7 +315,7 @@ inline SwAnchoredObjList* SwTextFly::GetAnchoredObjList() 
const
 {
 return mpAnchoredObjList
? mpAnchoredObjList.get()
-   : const_cast(this)->InitAnchoredObjList();
+   : _cast(this)->InitAnchoredObjList();
 }
 
 inline void SwTextFly::SetTopRule()
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 6028af382c7b..43be775725e9 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -863,7 +863,7 @@ SwRect SwTextFly::GetFrameArea() const
 }
 
 // #i68520#
-SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
+SwAnchoredObjList& SwTextFly::InitAnchoredObjList()
 {
 OSL_ENSURE( m_pCurrFrame, "InitFlyList: No Frame, no FlyList" );
 // #i68520#
@@ -982,7 +982,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
 }
 
 // #i68520#
-return mpAnchoredObjList.get();
+return *mpAnchoredObjList;
 }
 
 SwTwips SwTextFly::CalcMinBottom() const


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

2023-10-11 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/txtfly.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 56d01e3f9de146f4fc279b8c58f8c1450323f408
Author: Caolán McNamara 
AuthorDate: Wed Oct 11 11:15:24 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 11 18:17:16 2023 +0200

both branches set mpAnchoredObjList the same

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

diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index a290ac4d2010..6028af382c7b 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -887,11 +887,11 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
 
 m_bOn = false;
 
+// #i68520#
+mpAnchoredObjList.reset(new SwAnchoredObjList);
+
 if( nCount && bWrapAllowed )
 {
-// #i68520#
-mpAnchoredObjList.reset(new SwAnchoredObjList );
-
 SwRect const aRect(GetFrameArea());
 // Make ourselves a little smaller than we are,
 // so that 1-Twip-overlappings are ignored (#49532)
@@ -980,11 +980,6 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
 m_nMinBottom = nMax;
 }
 }
-else
-{
-// #i68520#
-mpAnchoredObjList.reset( new SwAnchoredObjList );
-}
 
 // #i68520#
 return mpAnchoredObjList.get();


[Libreoffice-commits] core.git: 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 a822df6379606ab9f62d6ebb2318d0294d9c959c
Author: László Németh 
AuthorDate: Tue Oct 10 15:49:38 2023 +0200
Commit: László Németh 
CommitDate: Wed Oct 11 09:00:37 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 

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: sw/source

2023-10-10 Thread Michael Stahl (via logerrit)
 sw/source/uibase/ribbar/workctrl.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 07e46bb789915b8046b192b2bd6389e9ef5cb5ce
Author: Michael Stahl 
AuthorDate: Mon Oct 9 20:21:34 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 10 10:51:01 2023 +0200

sw: SwTbxAutoTextCtrl should sort groups by title

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

diff --git a/sw/source/uibase/ribbar/workctrl.cxx 
b/sw/source/uibase/ribbar/workctrl.cxx
index 03c883dc0155..be1315e59de0 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -87,15 +87,18 @@ void SwTbxAutoTextCtrl::CreatePopupWindow()
 ScopedVclPtrInstance pPopup;
 SwGlossaryList* pGlossaryList = ::GetGlossaryList();
 const size_t nGroupCount = pGlossaryList->GetGroupCount();
+o3tl::sorted_vector titles;
 for(size_t i = 1; i <= nGroupCount; ++i)
 {
 OUString sTitle = pGlossaryList->GetGroupTitle(i - 1);
 const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1);
+auto const [it, _] = titles.insert(sTitle);
+size_t const menuIndex(::std::distance(titles.begin(), it));
 if(nBlockCount)
 {
 sal_uInt16 nIndex = o3tl::narrowing(100*i);
 // but insert without extension
-pPopup->InsertItem( i, sTitle);
+pPopup->InsertItem(i, sTitle, MenuItemBits::NONE, {}, 
menuIndex);
 VclPtrInstance pSub;
 pSub->SetSelectHdl(aLnk);
 pPopup->SetPopupMenu(i, pSub);


  1   2   3   4   5   6   7   8   9   10   >