core.git: sw/inc sw/qa sw/source

2024-05-22 Thread Miklos Vajna (via logerrit)
 sw/inc/pagedesc.hxx |2 
 sw/qa/core/layout/data/inline-endnote-position.docx |binary
 sw/qa/core/layout/ftnfrm.cxx|   20 
 sw/source/core/layout/ftnfrm.cxx|   49 +++-
 sw/source/filter/ww8/docxattributeoutput.cxx|   10 +++-
 5 files changed, 77 insertions(+), 4 deletions(-)

New commits:
commit d1ddd136a1b0e452492464d58715eaec144fd811
Author: Miklos Vajna 
AuthorDate: Wed May 22 13:56:40 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 22 17:50:10 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote container's top margin

Comparing the Word vs Writer output for the bugdoc, the vertical
position of the endnote text is not correct: the y pos should be larger
than it is, see the red reference at e.g.
.

Seems this is caused by the different height of the rectangle around the
endnote separator: the top margin is 124 twips in Writer, which is a
hardcoded default from the SwPageFootnoteInfo ctor, while Word has this
separator as a special character, inside a paragraph, which inherits the
height of the default paragraph style.

Fix the problem by extending sw::FootnoteSeparatorHeight() to also work
from RES_POOLCOLL_STANDARD in the Word compat case. Note that it's not
enough to take the font size (11pt in this case) from the paragraph
style, we want to work with the real font, which knows the spacing
between lines (15% in this case). SwFont::GetHeight() has this logic,
it's also what e.g. SwTextFrame::FormatEmpty() uses.

Note that footnotes have the same problem, but given that they grow from
the bottom of the page, the text position was correct, even if the
separator height is incorrect. Also, the separator line itself is not
changed in this commit, we just make sure that the height is OK, so text
below the line has the correct position.

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

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 3ec919ce3c83..a8241f15f6f0 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -399,7 +399,7 @@ public:
 namespace sw {
 class PageFootnoteHint final : public SfxHint {};
 
-SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwPageFootnoteInfo const&);
+SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwDoc& rDoc, 
SwPageFootnoteInfo const&);
 }
 
 typedef boost::multi_index_container<
diff --git a/sw/qa/core/layout/data/inline-endnote-position.docx 
b/sw/qa/core/layout/data/inline-endnote-position.docx
new file mode 100644
index ..3905208f9f0e
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-position.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index 1cf31809e5a7..a7640e26ca9a 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -102,4 +102,24 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndSection)
 CPPUNIT_ASSERT_EQUAL(2, nToplevelSections);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
+{
+// Given a document, ContinuousEndnotes is true:
+createSwDoc("inline-endnote-position.docx");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure the endnote separator (line + spacing around it) is 
large enough, so the
+// endnote text below the separator has the correct position:
+sal_Int32 nEndnoteContTopMargin
+= parseDump("//column/ftncont/infos/prtBounds"_ostr, 
"top"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 269
+// - Actual  : 124
+// i.e. the top margin wasn't the default font size with its spacing, but 
the Writer default,
+// which shifted endnote text up, incorrectly.
+CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index b7851a131e44..548d8228063e 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -42,9 +42,41 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #define ENDNOTE 0x8000
 
+namespace
+{
+/// Calculates the height of the line that hosts the separator line (the top 
margin of the
+/// container), based on the default paragraph style in rDoc.
+bool FootnoteSeparatorHeightFromParagraph(SwDoc& rDoc, SwTwips& rHeight)
+{
+const SwTextFormatColl* pDefaultParaFormat
+= 
rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD);
+if 

core.git: sw/inc sw/qa sw/source

2024-05-17 Thread Michael Stahl (via logerrit)
 sw/inc/doc.hxx  |8 +-
 sw/qa/extras/uiwriter/uiwriter8.cxx |   46 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   11 ++-
 sw/source/core/doc/docnum.cxx   |   55 +++-
 4 files changed, 109 insertions(+), 11 deletions(-)

New commits:
commit 2bcaa374ea418cd81f9dbf62cd7e896f5977992a
Author: Michael Stahl 
AuthorDate: Fri May 17 13:58:41 2024 +0200
Commit: Michael Stahl 
CommitDate: Fri May 17 19:24:29 2024 +0200

tdf#161137 sw: AutoText or Paste should copy paragraph indents for lists

The first commit made the start and end node of the paste look like the
list it was inserted into, but the middle nodes may have different
paragraph styles and may have different left margin / first line indent.

In addition to the SwNumRule, also copy any left margin or first line
indent if it is effective on the node that the SwNumRule was taken from.

Now all the list labels should be in the same place.

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 659af3ba1e91..b1b68bec2dba 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1073,7 +1073,9 @@ public:
  const SwNumRule&,
  SetNumRuleMode mode,
  SwRootFrame const* pLayout = nullptr,
- const OUString& sContinuedListId = OUString());
+ const OUString& sContinuedListId = OUString(),
+ SvxTextLeftMarginItem const* pTextLeftMarginToPropagate = 
nullptr,
+ SvxFirstLineIndentItem const* pFirstLineIndentToPropagate 
= nullptr);
 void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
 
 void MakeUniqueNumRules(const SwPaM & rPaM);
@@ -1151,7 +1153,9 @@ public:
 int nNonEmptyAllowed,
 OUString& sListId,
 SwRootFrame const* pLayout,
-const bool bInvestigateStartNode = false );
+const bool bInvestigateStartNode = false,
+SvxTextLeftMarginItem const** 
o_ppTextLeftMargin = nullptr,
+SvxFirstLineIndentItem const** 
o_ppFirstLineIndent = nullptr);
 
 // Paragraphs without numbering but with indents.
 bool NoNum( const SwPaM& );
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 2ff8bc3472b6..e1924b16a512 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -877,7 +878,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, 
testInsertAutoTextIntoListFromParaStyle)
 pWrtShell->FwdPara();
 pWrtShell->EndPara(/*bSelect=*/false);
 // expands autotext (via F3)
-pWrtShell->Insert(" dt");
+pWrtShell->Insert(" jacr");
 
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
@@ -886,6 +887,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, 
testInsertAutoTextIntoListFromParaStyle)
 pWrtShell->SttEndDoc(/*bStt=*/true);
 pWrtShell->FwdPara();
 
+SwNumRule* pNumRule;
+SvxTextLeftMarginItem const* pTextLeftMargin;
+SvxFirstLineIndentItem const* pFirstLineIndent;
+
 {
 SwTextNode& rNode{ 
*pWrtShell->GetCursor()->GetPoint()->GetNode().GetTextNode() };
 // numrule from paragraph style, but not from direct formatting
@@ -902,7 +907,32 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, 
testInsertAutoTextIntoListFromParaStyle)
 CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, 
pSet->GetItemState(RES_MARGIN_TEXTLEFT, false));
 CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
pSet->GetItemState(RES_MARGIN_TEXTLEFT, true));
 CPPUNIT_ASSERT_EQUAL(u"ListAndIndents"_ustr, 
rNode.GetTextColl()->GetName());
-CPPUNIT_ASSERT(rNode.GetText().startsWith("Item He heard quiet 
steps"));
+CPPUNIT_ASSERT_EQUAL(u"Item We confirm receipt of your application 
material."_ustr,
+ rNode.GetText());
+pNumRule = rNode.GetNumRule();
+pTextLeftMargin = (RES_MARGIN_TEXTLEFT);
+pFirstLineIndent = (RES_MARGIN_FIRSTLINE);
+}
+
+pWrtShell->FwdPara();
+
+{
+SwTextNode& rNode{ 
*pWrtShell->GetCursor()->GetPoint()->GetNode().GetTextNode() };
+auto pSet{ rNode.GetpSwAttrSet() };
+CPPUNIT_ASSERT(pSet);
+// list id was set
+CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
pSet->GetItemState(RES_PARATR_LIST_ID, false));
+// middle paragraph was pasted - has numrule and 

core.git: sw/inc sw/qa sw/source

2024-05-17 Thread Michael Stahl (via logerrit)
 sw/inc/doc.hxx  |   26 +-
 sw/qa/extras/uiwriter/data/stylewithlistandindents.fodt |  182 
 sw/qa/extras/uiwriter/uiwriter8.cxx |   81 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |7 
 sw/source/core/doc/docnum.cxx   |   47 ++--
 sw/source/core/edit/autofmt.cxx |2 
 sw/source/core/edit/ednumber.cxx|   12 -
 sw/source/core/undo/unnum.cxx   |4 
 sw/source/core/unocore/unocrsrhelper.cxx|8 
 sw/source/filter/basflt/fltshell.cxx|2 
 10 files changed, 332 insertions(+), 39 deletions(-)

New commits:
commit 7698f386413e514a4478a1af69a8a3be93dfecab
Author: Michael Stahl 
AuthorDate: Thu May 16 18:09:18 2024 +0200
Commit: Michael Stahl 
CommitDate: Fri May 17 19:23:45 2024 +0200

tdf#161137 sw: fix AutoText or Paste overriding paragraph indents

The problem is that when a paragraph style specifies a SwNumRule, then
this style's indents override the indents of the SwNumRule, but if the
same SwNumRule is also added to the SwTextNode's mpAttrSet, then the
style's indents no longer take effect.

This happens both when inserting an AutoText, and when Pasting, into a
list item, because DocumentContentOperationsManager::CopyImplImpl()
sets the pNumRuleToPropagate as direct formatting on every pasted node.

Add another flag to SwDoc::SetNumRule() to check if pNumRuleToPropagate
was already in effect due to the paragraph style.

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index b4d3d0e54f86..659af3ba1e91 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1052,23 +1052,28 @@ public:
 
 SW_DLLPUBLIC bool GotoOutline(SwPosition& rPos, const OUString& rName, 
SwRootFrame const* = nullptr) const;
 
-/** Accept changes of outline styles for OutlineRule.
- @param bResetIndentAttrs Optional parameter - default value false:
-  If  equals true, the indent attributes "before text"
-  and "first line indent" are additionally reset at the provided PaM, if
-  the list style makes use of the new list level attributes.
- @param bCreateNewList indicates if a new list is created by applying the 
given list style.
+enum class SetNumRuleMode {
+Default = 0,
+/// indicates if a new list is created by applying the given list 
style.
+CreateNewList = 1,
+DontSetItem = 2,
+/** If enabled, the indent attributes "before text" and
+  "first line indent" are additionally reset at the provided PaM,
+  if the list style makes use of the new list level attributes. */
+ResetIndentAttrs = 4,
+DontSetIfAlreadyApplied = 8
+};
+
+/** Set or change numbering rule on text nodes, as direct formatting.
  @param sContinuedListId If bCreateNewList is false, may contain the
   list Id of a list which has to be continued by applying the given list 
style
 
  @return the set ListId if bSetItem is true */
 OUString SetNumRule( const SwPaM&,
  const SwNumRule&,
- bool bCreateNewList,
+ SetNumRuleMode mode,
  SwRootFrame const* pLayout = nullptr,
- const OUString& sContinuedListId = OUString(),
- bool bSetItem = true,
- const bool bResetIndentAttrs = false );
+ const OUString& sContinuedListId = OUString());
 void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
 
 void MakeUniqueNumRules(const SwPaM & rPaM);
@@ -1705,6 +1710,7 @@ private:
 
 namespace o3tl {
 template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 
 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
diff --git a/sw/qa/extras/uiwriter/data/stylewithlistandindents.fodt 
b/sw/qa/extras/uiwriter/data/stylewithlistandindents.fodt
new file mode 100644
index ..afb7ae06aac2
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/stylewithlistandindents.fodt
@@ -0,0 +1,182 @@
+
+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; 

core.git: sw/inc sw/qa sw/source

2024-05-13 Thread Thorsten Behrens (via logerrit)
 sw/inc/authfld.hxx   |   22 ++---
 sw/inc/docsh.hxx |   27 +++---
 sw/inc/docstyle.hxx  |   14 +--
 sw/inc/docufld.hxx   |   12 +-
 sw/inc/expfld.hxx|6 -
 sw/inc/fmtcol.hxx|   10 +-
 sw/inc/fmtfld.hxx|   10 +-
 sw/inc/format.hxx|   22 ++---
 sw/inc/formatcontentcontrol.hxx  |2 
 sw/inc/frmfmt.hxx|6 -
 sw/inc/ndole.hxx |   12 +-
 sw/inc/ndtxt.hxx |   76 +-
 sw/inc/node.hxx  |   18 ++--
 sw/inc/section.hxx   |   20 ++--
 sw/inc/swtable.hxx   |   24 ++---
 sw/inc/tblafmt.hxx   |   12 +-
 sw/inc/textboxhelper.hxx |   22 ++---
 sw/inc/txtftn.hxx|4 
 sw/inc/unotbl.hxx|6 -
 sw/inc/unotextrange.hxx  |   14 +--
 sw/inc/unotxdoc.hxx  |  126 +++
 sw/inc/view.hxx  |   47 +--
 sw/inc/viscrs.hxx|2 
 sw/qa/core/layout/ftnfrm.cxx |2 
 sw/qa/core/txtnode/txtnode.cxx   |2 
 sw/qa/uibase/shells/shells.cxx   |2 
 sw/qa/uibase/shells/textsh.cxx   |2 
 sw/source/core/inc/cellfrm.hxx   |6 -
 sw/source/core/inc/cntfrm.hxx|2 
 sw/source/core/inc/dflyobj.hxx   |2 
 sw/source/core/inc/flyfrms.hxx   |8 -
 sw/source/core/inc/pagefrm.hxx   |4 
 sw/source/core/inc/tabfrm.hxx|2 
 sw/source/core/inc/txtfrm.hxx|   22 ++---
 sw/source/filter/inc/wrtswtbl.hxx|6 -
 sw/source/uibase/inc/basesh.hxx  |4 
 sw/source/uibase/inc/mailmergehelper.hxx |   18 ++--
 sw/source/uibase/inc/pview.hxx   |2 
 sw/source/uibase/inc/textsh.hxx  |8 -
 sw/source/uibase/uiview/view.cxx |5 -
 40 files changed, 301 insertions(+), 310 deletions(-)

New commits:
commit f4d15c1cf34f8dac870c2771d6317a56b3fdf038
Author: Thorsten Behrens 
AuthorDate: Fri Apr 26 09:05:38 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Mon May 13 08:17:31 2024 +0200

Revert "reduce symbol visibility in sw"

This reverts commit 1a6711276f0c8abeb0028a47cc345a7453374a38.

After some discussion and experiments, it turned out this rather
fundamentally breaks clang's PCH build. Conclusion was: this change is
not significant enough to warrant making life harder for developers.

Excerpt of errors (affected were vbaswobj, msword & swui libs):

- ld.lld: error: undefined symbol: SwFormat::~SwFormat()
  >>> referenced by fmtcol.hxx:37 (sw/inc/fmtcol.hxx:37)
  >>>   
core/workdir/CxxObject/sw/inc/pch/precompiled_vbaswobj.o:(SwFormatColl::~SwFormatColl())
- ld.lld: error: undefined symbol: 
SwFrameFormat::SetPositionLayoutDir(short)
  >>> referenced by precompiled_msword.cxx
  >>>   
core/workdir/CxxObject/sw/inc/pch/precompiled_msword.o:(vtable for 
sw::SpzFrameFormat)
- ld.lld: error: undefined symbol: 
SwFrameFormat::SetLayoutDir(SwFrameFormat::tLayoutDir)
  >>> referenced by precompiled_swui.cxx
  >>>   
core/workdir/CxxObject/sw/inc/pch/precompiled_swui.o:(vtable for 
sw::SpzFrameFormat)

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

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index f20c07c929b3..6996f5090b68 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -62,7 +62,7 @@ struct SwTOXSortKey
 typedef std::vector SortKeyArr;
 typedef std::vector> SwAuthDataArr;
 
-class SAL_DLLPUBLIC_RTTI SwAuthorityFieldType final : public SwFieldType
+class SW_DLLPUBLIC SwAuthorityFieldType final : public SwFieldType
 {
 SwDoc*  m_pDoc;
 SwAuthDataArr   m_DataArr;
@@ -97,8 +97,8 @@ public:
 m_SequArrRLHidden.clear();
 }
 
-SW_DLLPUBLIC void   GetAllEntryIdentifiers( std::vector& rToFill 
) const;
-SW_DLLPUBLIC SwAuthEntry* GetEntryByIdentifier(std::u16string_view 
rIdentifier) const;
+voidGetAllEntryIdentifiers( std::vector& rToFill 
) const;
+SwAuthEntry*GetEntryByIdentifier(std::u16string_view rIdentifier) 
const;
 
 boolChangeEntryContent(const SwAuthEntry* pNewEntry);
 // import interface
@@ -129,13 +129,13 @@ public:
 m_bSortByDocument = bSet;
 }
 
-SW_DLLPUBLIC sal_uInt16 GetSortKeyCount() const ;
-SW_DLLPUBLIC const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const 

core.git: sw/inc sw/qa sw/source

2024-05-08 Thread Justin Luth (via logerrit)
 dev/null|binary
 sw/inc/crsrsh.hxx   |2 -
 sw/qa/uitest/writer_tests8/tdf150037.py |   43 
 sw/source/core/crsr/crbm.cxx|9 ++
 sw/source/uibase/docvw/edtwin.cxx   |6 
 sw/source/uibase/inc/edtwin.hxx |2 -
 sw/source/uibase/inc/wrtsh.hxx  |2 -
 sw/source/uibase/uitest/uiobject.cxx|   37 ---
 sw/source/uibase/wrtsh/wrtsh3.cxx   |4 +-
 9 files changed, 8 insertions(+), 97 deletions(-)

New commits:
commit 22dd422f7ccf7a1ce4dc7fe5b274263a55e464c7
Author: Justin Luth 
AuthorDate: Sat May 4 13:26:53 2024 -0400
Commit: Justin Luth 
CommitDate: Wed May 8 15:28:08 2024 +0200

Revert "tdf#150037 Writer: text fieldmark behaviour changed"

This reverts 24.8 commit 96323a10d3a55d212c350886e2a1344c0cd2ba95.
A mouse click selects the fieldmark to be able to overwrite
the field with the next text input.
But I did not revert:
Additionally the EN SPACE (0x2002) character is visualized
by the DEGREE symbol when 'View/Formatting Marks' is active.

The problem was that the field itself was also selected,
so not only was the placeholder text overwritten,
but so was the entire field.

Additionally, it is ONLY placeholder text that should be selected,
but this was also selecting non-placeholder
(i.e. custom user-entered text) that was being pre-selected
which is NOT what happens in MS Word.

The whole point of the patch in the first place was to
emulate MS Word's response to placeholder text,
so we should also be emulating what happens
to non-placeholder text. That would require tracking
whether the field's text was placeholder or not,
which is not currently track in legacy fields.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 23dd92da39e1..f5e52e398f3d 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -593,7 +593,7 @@ public:
 ::sw::mark::IFieldmark* GetCurrentFieldmark();
 sw::mark::IFieldmark* GetFieldmarkAfter();
 sw::mark::IFieldmark* GetFieldmarkBefore();
-bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark, bool 
completeSelection = false );
+bool GotoFieldmark(const ::sw::mark::IFieldmark* const pMark);
 
 // update Cursr, i.e. reset it into content should only be called when the
 // cursor was set to a random position e.g. when deleting frames
diff --git a/sw/qa/uitest/data/tdf150037.docx b/sw/qa/uitest/data/tdf150037.docx
deleted file mode 100644
index 4fcb18efd724..
Binary files a/sw/qa/uitest/data/tdf150037.docx and /dev/null differ
diff --git a/sw/qa/uitest/data/tdf150037.odt b/sw/qa/uitest/data/tdf150037.odt
deleted file mode 100644
index 15d75a694b0a..
Binary files a/sw/qa/uitest/data/tdf150037.odt and /dev/null differ
diff --git a/sw/qa/uitest/writer_tests8/tdf150037.py 
b/sw/qa/uitest/writer_tests8/tdf150037.py
deleted file mode 100644
index e81cf947affc..
--- a/sw/qa/uitest/writer_tests8/tdf150037.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-
-class tdf150037(UITestCase):
-
-def test_tdf150037(self):
-
-with self.ui_test.load_file(get_url_for_data_file("tdf150037.docx")) 
as document:
-
-xWriterDoc = self.xUITest.getTopFocusWindow()
-xWriterEdit = xWriterDoc.getChild("writer_edit")
-
-xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": 
"14", "END_POS": "14"}))
-xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": 
"Replacement"}))
-xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": 
"0", "END_POS": "22"}))
-windowState = xWriterEdit.getState();
-self.assertEqual(windowState[14].Value, "Fieldmark: Replacement")
-
-def test_tdf150037_protected(self):
-
-with self.ui_test.load_file(get_url_for_data_file("tdf150037.odt")) as 
document:
-
-xWriterDoc = self.xUITest.getTopFocusWindow()
-xWriterEdit = xWriterDoc.getChild("writer_edit")
-
-xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
-xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": 
"14", "END_POS": 

core.git: sw/inc sw/qa sw/source

2024-04-30 Thread Caolán McNamara (via logerrit)
 sw/inc/calbck.hxx |   12 ++--
 sw/inc/deletelistener.hxx |6 +-
 sw/inc/fchrfmt.hxx|2 
 sw/inc/swevent.hxx|4 -
 sw/inc/tox.hxx|2 
 sw/qa/core/uwriter.cxx|   14 ++--
 sw/source/core/attr/calbck.cxx|   53 --
 sw/source/core/attr/format.cxx|   10 +--
 sw/source/core/crsr/callnk.cxx|2 
 sw/source/core/crsr/crsrsh.cxx|4 -
 sw/source/core/doc/docdesc.cxx|2 
 sw/source/core/doc/docfmt.cxx |   18 +++---
 sw/source/core/doc/fmtcol.cxx |2 
 sw/source/core/doc/lineinfo.cxx   |4 -
 sw/source/core/doc/number.cxx |4 -
 sw/source/core/doc/tblrwcl.cxx|4 -
 sw/source/core/docnode/ndtbl.cxx  |4 -
 sw/source/core/docnode/ndtbl1.cxx |4 -
 sw/source/core/docnode/node.cxx   |5 +
 sw/source/core/docnode/section.cxx|2 
 sw/source/core/layout/atrfrm.cxx  |   17 ++---
 sw/source/core/layout/colfrm.cxx  |2 
 sw/source/core/layout/ssfrm.cxx   |4 -
 sw/source/core/layout/tabfrm.cxx  |8 +-
 sw/source/core/layout/wsfrm.cxx   |2 
 sw/source/core/para/paratr.cxx|2 
 sw/source/core/table/swtable.cxx  |   24 
 sw/source/core/text/txtfrm.cxx|2 
 sw/source/core/tox/tox.cxx|6 +-
 sw/source/core/txtnode/atrfld.cxx |   10 +--
 sw/source/core/txtnode/atrtox.cxx |2 
 sw/source/core/txtnode/attrcontentcontrol.cxx |2 
 sw/source/core/txtnode/fmtatr2.cxx|2 
 sw/source/core/txtnode/thints.cxx |4 -
 sw/source/core/txtnode/txtatr2.cxx|4 -
 sw/source/core/undo/rolbck.cxx|2 
 sw/source/core/undo/untbl.cxx |2 
 sw/source/filter/ww8/ww8par.cxx   |4 -
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |4 -
 39 files changed, 130 insertions(+), 131 deletions(-)

New commits:
commit b2ab2c862c289d1ab6aabd3de21f4ea45f7a4aed
Author: Caolán McNamara 
AuthorDate: Mon Apr 29 14:24:25 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 30 11:16:34 2024 +0200

SwModify::Add/Remove always derefs arg

an effort to remove C6011 Dereferencing NULL pointer 'pDepend'

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

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index f4133a2853fa..59a20220da1d 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -198,8 +198,8 @@ public:
 
 virtual ~SwModify() override;
 
-void Add(SwClient *pDepend);
-SwClient* Remove(SwClient *pDepend);
+void Add(SwClient& rDepend);
+void Remove(SwClient& rDepend);
 bool HasWriterListeners() const { return m_pWriterListeners; }
 bool HasOnlyOneListener() const { return m_pWriterListeners && 
m_pWriterListeners->IsLast(); }
 
@@ -248,7 +248,7 @@ namespace sw
 ListenerEntry& operator=(ListenerEntry&& other) noexcept
 {
 m_pToTell = other.m_pToTell;
-other.GetRegisteredIn()->Add(this);
+other.GetRegisteredIn()->Add(*this);
 other.EndListeningAll();
 return *this;
 }
@@ -275,8 +275,8 @@ namespace sw
 };
 class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase >
 {
-friend SwClient* SwModify::Remove(SwClient*);
-friend void SwModify::Add(SwClient*);
+friend void SwModify::Remove(SwClient&);
+friend void SwModify::Add(SwClient&);
 protected:
 const SwModify& m_rRoot;
 // the current object in an iteration
@@ -424,7 +424,7 @@ SwClient::SwClient( SwModify* pToRegisterIn )
 : m_pRegisteredIn( nullptr )
 {
 if(pToRegisterIn)
-pToRegisterIn->Add(this);
+pToRegisterIn->Add(*this);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/deletelistener.hxx b/sw/inc/deletelistener.hxx
index 4d0b142c3561..023e5e638720 100644
--- a/sw/inc/deletelistener.hxx
+++ b/sw/inc/deletelistener.hxx
@@ -25,7 +25,7 @@ private:
 auto pLegacy = static_cast();
 if (pLegacy->GetWhich() == RES_OBJECTDYING)
 {
-m_pModify->Remove(this);
+

core.git: sw/inc sw/qa sw/source

2024-04-29 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 +
 sw/qa/uibase/uno/uno.cxx  |   24 
 sw/source/core/doc/DocumentSettingManager.cxx |   10 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/filter/xml/xmlexp.cxx   |1 +
 sw/source/filter/xml/xmlimp.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 ++
 7 files changed, 65 insertions(+)

New commits:
commit c675eaf923cf579670b8ba2f7794b47be7fad39e
Author: Miklos Vajna 
AuthorDate: Mon Apr 29 10:39:43 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon Apr 29 20:30:43 2024 +0200

tdf#160833 sw: add a DoNotMirrorRtlDrawObjs compat flag

The DOCX bugdoc has a circle shape anchored inside an RTL paragraph:
this shows up on the right hand side in Word, but on the left hand side
in Writer.

What happens is that Writer implicitly mirrors draw objects anchored in
RTL paragraphs, while Word doesn't do this.

Start fixing the problem by adding a new layout compatibility flag that
can be used by the DOCX import in the future, to leave the behavior
unchanged for new & existing ODT documents.

An alternative would be to do something similar to the DOC import's
SwWW8ImplReader::MiserableRTLGraphicsHack(), but 1) we don't have the
page margins by the time we import the shape and 2) as its name says, it
doesn't feel like a clean solution, it's better to handle this
difference at a layout level.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 0dd9467bdf13..264860b854c4 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -99,6 +99,7 @@ enum class DocumentSettingId
 // tdf#119908 new paragraph justification
 JUSTIFY_LINES_WITH_SHRINKING,
 APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
+DO_NOT_MIRROR_RTL_DRAW_OBJS,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index d38d0bbfc967..3e6d9c93d51c 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -560,6 +560,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testAllowTextAfterFloatingTableBreak)
 CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotMirrorRtlDrawObjs)
+{
+// Given an empty document:
+createSwDoc();
+
+// When checking the state of the DoNotMirrorRtlDrawObjs compat flag:
+uno::Reference xDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xSettings(
+xDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+bool bDoNotMirrorRtlDrawObjs{};
+// Without the accompanying fix in place, this test would have failed with:
+// An uncaught exception of type 
com.sun.star.beans.UnknownPropertyException
+// i.e. the compat flag was not recognized.
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+// Then make sure it's false by default:
+CPPUNIT_ASSERT(!bDoNotMirrorRtlDrawObjs);
+
+// And when setting DoNotMirrorRtlDrawObjs=true:
+xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+// Then make sure it gets enabled:
+xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= 
bDoNotMirrorRtlDrawObjs;
+CPPUNIT_ASSERT(bDoNotMirrorRtlDrawObjs);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 4e093c9230bf..55b625932efb 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -257,6 +257,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 return mbDoNotBreakWrappedTables;
 case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
 return mbAllowTextAfterFloatingTableBreak;
+case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+return mbDoNotMirrorRtlDrawObjs;
 case DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING:
 return mbJustifyLinesWithShrinking;
 case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
@@ -451,6 +453,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbApplyTextAttrToEmptyLineAtEndOfParagraph = value;
 break;
 
+case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+mbDoNotMirrorRtlDrawObjs = value;
+break;
+
 case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:

core.git: sw/inc sw/qa sw/source writerfilter/source

2024-04-09 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 
 sw/qa/core/text/data/A011-charheight.rtf  |   27 ++
 sw/qa/core/text/itrform2.cxx  |   18 +
 sw/qa/extras/ooxmlexport/data/fdo74110.docx   |binary
 sw/source/core/doc/DocumentSettingManager.cxx |   11 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/itrform2.cxx  |   13 +---
 sw/source/filter/ww8/ww8par.cxx   |1 
 sw/source/filter/xml/xmlimp.cxx   |   10 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +
 writerfilter/source/filter/WriterFilter.cxx   |1 
 11 files changed, 98 insertions(+), 3 deletions(-)

New commits:
commit 2b47fae7e3e23ee7c733708500cb0482ad7f8af1
Author: Michael Stahl 
AuthorDate: Mon Apr 8 15:26:00 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue Apr 9 14:10:19 2024 +0200

tdf#88214 sw: text formatting: adapt empty line at end of para to Word

For an empty line at the end of an empty paragraph, Writer already uses
any existing text attribute in the paragraph, see for example
testEmptyTrailingSpans.

For an empty line at the end of a non-empty paragraph, Writer text
formatting uses only paragraph attributes, ignoring any text attributes,
whereas the UI will display the attributes from the text attributes
(such as font height) if you move the cursor there.

Word uses text attributes also in this case, so adapt the inconsistent
Writer behaviour: text formatting now uses text attributes too.

Apparently this can be achieved by calling SeekAndChgBefore() instead of
SeekAndChg().

Add another compat flag "ApplyTextAttrToEmptyLineAtEndOfParagraph" to
preserve the formatting of existing ODF documents.

Adapt test document fdo74110.docx, it has a line break with "Angsana
New" font.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 74b123dc462e..0dd9467bdf13 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -98,6 +98,7 @@ enum class DocumentSettingId
 ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
 // tdf#119908 new paragraph justification
 JUSTIFY_LINES_WITH_SHRINKING,
+APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/data/A011-charheight.rtf 
b/sw/qa/core/text/data/A011-charheight.rtf
new file mode 100644
index ..4b56ecdd6a15
--- /dev/null
+++ b/sw/qa/core/text/data/A011-charheight.rtf
@@ -0,0 +1,27 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang3079\deflangfe3079
   hemelang3079hemelangfe0 hemelangcs0
+{onttbl{0bidi romancharset0prq2Times New Roman{\*alt Arial};}
+}
+{\*\defchp 0s22\lang3079\langfe1033\langfenp1033 }
+{\*\defpap \ql \li0 i0\sa200\sl276\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
+
oqfpromote
+{\stylesheet
+{\ql \li0 i0\sa200\sl276\slmult1\widctlpar\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f0fs22lang1025 \ltrchcs0
+0s23\lang3079\langfe1033+{\s15\ql \li0 i0\widctlpar  qc  x4536   qr  
x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs22lang1025 \ltrchcs0 0s23\lang3079\langfe1033+\sbasedon0 \snext15 
\slink16 \sunhideused header;}
+{\*+}
+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0  
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0
+
+\ltrpar \pard\plain \ltrpar\s15\qc \li0 i0\widctlpar
+   qc  x4536   qr  x9072\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0 tlchcs1 f0fs22lang1025 \ltrchcs0 0
s23\lang3079\langfe1033+s16 \line \line \line
+\par \line
+\par }
+}
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 

core.git: sw/inc sw/qa sw/source

2024-03-13 Thread Noel Grandin (via logerrit)
 sw/inc/authfld.hxx   |   22 -
 sw/inc/docsh.hxx |   27 +--
 sw/inc/docstyle.hxx  |   14 ++---
 sw/inc/docufld.hxx   |   12 ++---
 sw/inc/expfld.hxx|6 +-
 sw/inc/fmtcol.hxx|   10 ++--
 sw/inc/fmtfld.hxx|   10 ++--
 sw/inc/format.hxx|   20 
 sw/inc/formatcontentcontrol.hxx  |2 
 sw/inc/frmfmt.hxx|6 +-
 sw/inc/ndole.hxx |   12 ++---
 sw/inc/ndtxt.hxx |   74 +++
 sw/inc/node.hxx  |   18 +++
 sw/inc/section.hxx   |   20 
 sw/inc/swtable.hxx   |   24 +-
 sw/inc/tblafmt.hxx   |   12 ++---
 sw/inc/textboxhelper.hxx |   22 +
 sw/inc/txtftn.hxx|4 -
 sw/inc/unotbl.hxx|6 +-
 sw/inc/unotextrange.hxx  |   14 ++---
 sw/inc/unotxdoc.hxx  |   66 +--
 sw/inc/view.hxx  |   47 ++-
 sw/inc/viscrs.hxx|2 
 sw/qa/core/layout/ftnfrm.cxx |2 
 sw/qa/core/txtnode/txtnode.cxx   |2 
 sw/qa/uibase/shells/shells.cxx   |2 
 sw/qa/uibase/shells/textsh.cxx   |2 
 sw/source/core/inc/cellfrm.hxx   |6 +-
 sw/source/core/inc/cntfrm.hxx|2 
 sw/source/core/inc/dflyobj.hxx   |2 
 sw/source/core/inc/flyfrms.hxx   |8 +--
 sw/source/core/inc/pagefrm.hxx   |4 -
 sw/source/core/inc/tabfrm.hxx|2 
 sw/source/core/inc/txtfrm.hxx|   22 -
 sw/source/filter/inc/wrtswtbl.hxx|6 +-
 sw/source/uibase/inc/basesh.hxx  |4 -
 sw/source/uibase/inc/mailmergehelper.hxx |   18 +++
 sw/source/uibase/inc/pview.hxx   |2 
 sw/source/uibase/inc/textsh.hxx  |8 +--
 sw/source/uibase/uiview/view.cxx |5 ++
 40 files changed, 278 insertions(+), 269 deletions(-)

New commits:
commit 1a6711276f0c8abeb0028a47cc345a7453374a38
Author: Noel Grandin 
AuthorDate: Tue Mar 12 10:06:49 2024 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 13 10:45:51 2024 +0100

reduce symbol visibility in sw

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

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 6996f5090b68..f20c07c929b3 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -62,7 +62,7 @@ struct SwTOXSortKey
 typedef std::vector SortKeyArr;
 typedef std::vector> SwAuthDataArr;
 
-class SW_DLLPUBLIC SwAuthorityFieldType final : public SwFieldType
+class SAL_DLLPUBLIC_RTTI SwAuthorityFieldType final : public SwFieldType
 {
 SwDoc*  m_pDoc;
 SwAuthDataArr   m_DataArr;
@@ -97,8 +97,8 @@ public:
 m_SequArrRLHidden.clear();
 }
 
-voidGetAllEntryIdentifiers( std::vector& rToFill 
) const;
-SwAuthEntry*GetEntryByIdentifier(std::u16string_view rIdentifier) 
const;
+SW_DLLPUBLIC void   GetAllEntryIdentifiers( std::vector& rToFill 
) const;
+SW_DLLPUBLIC SwAuthEntry* GetEntryByIdentifier(std::u16string_view 
rIdentifier) const;
 
 boolChangeEntryContent(const SwAuthEntry* pNewEntry);
 // import interface
@@ -129,13 +129,13 @@ public:
 m_bSortByDocument = bSet;
 }
 
-sal_uInt16  GetSortKeyCount() const ;
-const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ;
+SW_DLLPUBLIC sal_uInt16 GetSortKeyCount() const ;
+SW_DLLPUBLIC const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ;
 voidSetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const 
nKeys[]);
 
 //initui.cxx
-static OUString const & GetAuthFieldName(ToxAuthorityField eType);
-static OUString const & GetAuthTypeName(ToxAuthorityType eType);
+SW_DLLPUBLIC static OUString const & GetAuthFieldName(ToxAuthorityField 
eType);
+SW_DLLPUBLIC static OUString const & GetAuthTypeName(ToxAuthorityType 
eType);
 
 LanguageTypeGetLanguage() const {return m_eLanguage;}
 voidSetLanguage(LanguageType nLang)  {m_eLanguage = nLang;}
@@ -157,7 +157,7 @@ public:
 one of the instances with the same m_nHandle is actually in the document,
 they're all cloned via CopyField()...
  */
-class SW_DLLPUBLIC SwAuthorityField final : public SwField
+class SAL_DLLPUBLIC_RTTI SwAuthorityField final : public SwField
 {
 rtl::Reference  m_xAuthEntry;
 mutable sal_IntPtr  m_nTempSequencePos;

core.git: sw/inc sw/qa sw/source

2024-02-16 Thread Miklos Vajna (via logerrit)
 sw/inc/viewsh.hxx  |4 +
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   64 +
 sw/source/core/view/viewsh.cxx |7 --
 sw/source/uibase/uiview/view2.cxx  |2 
 sw/source/uibase/uiview/viewmdi.cxx|2 
 5 files changed, 71 insertions(+), 8 deletions(-)

New commits:
commit ce350b840ce806c4060f9fdbd67fa4c95c82edf5
Author: Miklos Vajna 
AuthorDate: Fri Feb 16 12:00:24 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 16 14:58:41 2024 +0100

cool#8270 sw lok: fix bad statusbar pagenum string on async binding update

This is similar to commit 51d8a2ef54751403fa707816e27ddb4e7faa8231
(cool#7492 sfx2 lok: fix bad view id / statusbar string on async binding
update, 2024-01-08), but here the problem was that the async job tried
to get the current view from the model, which is not correct.

Fix the buggy page number string in the status bar by requesting callers
of SwViewShell::GetFirstLastVisPageNumbers() to provide the view, given
that SwViewShell itself doesn't have access to SwView, only the
SwWrtShell subclass would have that.

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

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index aa3999efbf7f..9318c51196fe 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -105,6 +105,8 @@ struct SwVisiblePageNumbers
 OUString sFirstCustomVirt, sLastCustomVirt;
 };
 
+class SwView;
+
 class SW_DLLPUBLIC SwViewShell : public sw::Ring
 {
 friend void SetOutDev( SwViewShell *pSh, OutputDevice *pOut );
@@ -596,7 +598,7 @@ public:
 bool isOutputToWindow() const;
 void OnGraphicArrived(const SwRect&);
 
-void GetFirstLastVisPageNumbers(SwVisiblePageNumbers& rVisiblePageNumbers);
+void GetFirstLastVisPageNumbers(SwVisiblePageNumbers& rVisiblePageNumbers, 
SwView& rView);
 
 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 8dccfeb9271a..94b203ef3d48 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -54,6 +55,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -64,6 +66,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -777,6 +780,7 @@ namespace {
 boost::property_tree::ptree m_aRedlineTableModified;
 /// Post-it / annotation payload.
 boost::property_tree::ptree m_aComment;
+std::vector m_aStateChanges;
 TestLokCallbackWrapper m_callbackWrapper;
 
 ViewCallback(SfxViewShell* pViewShell = nullptr, 
std::function const & rBeforeInstallFunc = {})
@@ -940,6 +944,11 @@ namespace {
 m_aComment = m_aComment.get_child("comment");
 }
 break;
+case LOK_CALLBACK_STATE_CHANGED:
+{
+m_aStateChanges.push_back(pPayload);
+break;
+}
 }
 }
 };
@@ -4165,6 +4174,61 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testSwitchingChartToDarkMode)
 CPPUNIT_ASSERT(nBlackPixels > nWhitePixels);
 }
 
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testStatusBarPageNumber)
+{
+// Given a document with 2 pages, first view on page 1, second view on 
page 2:
+SwXTextDocument* pXTextDocument = createDoc();
+int nView1 = SfxLokHelper::getView();
+SwWrtShell* pWrtShell1 = pXTextDocument->GetDocShell()->GetWrtShell();
+pWrtShell1->InsertPageBreak();
+SwRootFrame* pLayout = 
pWrtShell1->getIDocumentLayoutAccess().GetCurrentLayout();
+SwFrame* pPage1 = pLayout->GetLower();
+CPPUNIT_ASSERT(pPage1);
+SwFrame* pPage2 = pPage1->GetNext();
+CPPUNIT_ASSERT(pPage2);
+SfxLokHelper::createView();
+int nView2 = SfxLokHelper::getView();
+
pXTextDocument->initializeForTiledRendering(uno::Sequence());
+SfxLokHelper::setView(nView1);
+ViewCallback aView1;
+pWrtShell1->SttEndDoc(/*bStt=*/true);
+pWrtShell1->Insert("start");
+pWrtShell1->GetView().SetVisArea(pPage1->getFrameArea().SVRect());
+SfxLokHelper::setView(nView2);
+ViewCallback aView2;
+SwWrtShell* pWrtShell2 = pXTextDocument->GetDocShell()->GetWrtShell();
+pWrtShell2->SttEndDoc(/*bStt=*/false);
+pWrtShell2->Insert("end");
+pWrtShell2->GetView().SetVisArea(pPage2->getFrameArea().SVRect());
+{
+// Listen to StatePageNumber changes in view 2:
+SfxViewFrame& rFrame = pWrtShell2->GetView().GetViewFrame();
+SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool();
+

core.git: sw/inc sw/qa sw/source

2024-02-15 Thread Mike Kaganski (via logerrit)
 sw/inc/ndarr.hxx|   17 
 sw/qa/extras/odfimport/odfimport.cxx|2 
 sw/qa/extras/uiwriter/uiwriter3.cxx |4 
 sw/qa/extras/uiwriter/uiwriter6.cxx |   14 
 sw/qa/extras/uiwriter/uiwriter8.cxx |2 
 sw/source/core/crsr/crsrsh.cxx  |   25 -
 sw/source/core/crsr/crstrvl.cxx |   12 
 sw/source/core/crsr/pam.cxx |9 
 sw/source/core/crsr/swcrsr.cxx  |   32 -
 sw/source/core/crsr/trvlfnfl.cxx|2 
 sw/source/core/crsr/trvlreg.cxx |8 
 sw/source/core/crsr/trvltbl.cxx |5 
 sw/source/core/crsr/viscrs.cxx  |8 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |2 
 sw/source/core/doc/DocumentFieldsManager.cxx|2 
 sw/source/core/doc/DocumentRedlineManager.cxx   |   10 
 sw/source/core/doc/doc.cxx  |2 
 sw/source/core/doc/docbm.cxx|6 
 sw/source/core/doc/docfld.cxx   |8 
 sw/source/core/doc/docglos.cxx  |2 
 sw/source/core/doc/docredln.cxx |4 
 sw/source/core/doc/docsort.cxx  |4 
 sw/source/core/doc/doctxm.cxx   |   15 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/docnode/ndsect.cxx   |   27 -
 sw/source/core/docnode/ndtbl.cxx|   12 
 sw/source/core/docnode/node.cxx |7 
 sw/source/core/docnode/nodes.cxx|  394 +---
 sw/source/core/docnode/section.cxx  |2 
 sw/source/core/draw/dcontact.cxx|2 
 sw/source/core/edit/acorrect.cxx|2 
 sw/source/core/edit/edatmisc.cxx|2 
 sw/source/core/edit/edattr.cxx  |2 
 sw/source/core/edit/edglbldc.cxx|3 
 sw/source/core/edit/edglss.cxx  |6 
 sw/source/core/edit/editsh.cxx  |2 
 sw/source/core/fields/cellfml.cxx   |2 
 sw/source/core/fields/expfld.cxx|2 
 sw/source/core/fields/reffld.cxx|5 
 sw/source/core/frmedt/fecopy.cxx|4 
 sw/source/core/frmedt/fetab.cxx |4 
 sw/source/core/frmedt/tblsel.cxx|4 
 sw/source/core/layout/atrfrm.cxx|2 
 sw/source/core/layout/flylay.cxx|2 
 sw/source/core/layout/ftnfrm.cxx|6 
 sw/source/core/layout/newfrm.cxx|2 
 sw/source/core/table/swtable.cxx|2 
 sw/source/core/txtnode/atrflyin.cxx |2 
 sw/source/core/txtnode/atrftn.cxx   |4 
 sw/source/core/txtnode/ndtxt.cxx|3 
 sw/source/core/undo/undobj.cxx  |3 
 sw/source/core/undo/untbl.cxx   |8 
 sw/source/core/unocore/unochart.cxx |2 
 sw/source/core/unocore/unocrsr.cxx  |2 
 sw/source/core/unocore/unoframe.cxx |2 
 sw/source/core/unocore/unoobj.cxx   |4 
 sw/source/core/unocore/unoredline.cxx   |4 
 sw/source/core/unocore/unotext.cxx  |4 
 sw/source/core/view/vprint.cxx  |4 
 sw/source/filter/basflt/fltshell.cxx|   47 -
 sw/source/filter/basflt/shellio.cxx |4 
 sw/source/filter/html/htmltab.cxx   |2 
 sw/source/filter/html/swhtml.cxx|2 
 sw/source/filter/inc/fltshell.hxx   |4 
 sw/source/filter/writer/writer.cxx  |2 
 sw/source/filter/ww8/writerhelper.cxx   |2 
 sw/source/filter/ww8/wrtw8nds.cxx   |2 
 sw/source/filter/ww8/wrtww8.cxx |2 
 sw/source/filter/ww8/ww8atr.cxx |2 
 sw/source/filter/ww8/ww8glsy.cxx|2 
 sw/source/filter/ww8/ww8par.cxx |4 
 sw/source/filter/ww8/ww8par6.cxx|2 
 sw/source/uibase/app/docsh.cxx  |2 
 sw/source/uibase/dochdl/swdtflvr.cxx|2 
 sw/source/uibase/utlui/content.cxx  |   10 
 75 files changed, 335 insertions(+), 491 deletions(-)

New commits:
commit 

core.git: sw/inc sw/qa sw/source

2024-02-15 Thread Mike Kaganski (via logerrit)
 sw/inc/crsrsh.hxx|2 
 sw/inc/ndarr.hxx |9 ++-
 sw/qa/extras/uiwriter/data/FrameInHiddenSection.fodt |   20 +++
 sw/qa/extras/uiwriter/uiwriter9.cxx  |   21 +++
 sw/source/core/crsr/crsrsh.cxx   |   13 +++-
 sw/source/core/crsr/swcrsr.cxx   |4 -
 sw/source/core/docnode/nodes.cxx |   52 ---
 7 files changed, 105 insertions(+), 16 deletions(-)

New commits:
commit 691cfd22c6351416d8c758e040c7534383494f90
Author: Mike Kaganski 
AuthorDate: Wed Feb 14 19:22:42 2024 +0600
Commit: Mike Kaganski 
CommitDate: Thu Feb 15 14:53:56 2024 +0100

tdf#159565: make sure to handle leading hidden section correctly

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index eafc6a0c31e4..ecf253281205 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -334,7 +334,7 @@ public:
 void ExtendedSelectAll(bool bFootnotes = true);
 /// If ExtendedSelectAll() was called and selection didn't change since 
then.
 ::std::optional<::std::pair>> 
ExtendedSelectedAll() const;
-enum class StartsWith { None, Table, HiddenPara };
+enum class StartsWith { None, Table, HiddenPara, HiddenSection };
 /// If document body starts with a table or starts/ends with hidden 
paragraph.
 StartsWith StartsWith_();
 
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 7afe8d2bce46..7383c253a2e8 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -131,6 +131,11 @@ class SW_DLLPUBLIC SwNodes final
 
 SwNodes(SwDoc& rDoc);
 
+// Returns start of the document section 
(PostIts/Inserts/Autotext/Redlines/Content),
+// or of a specific fly / header / footer / footnote, where this node is, 
which must not
+// be crossed when moving backwards
+SwNodeOffset StartOfGlobalSection(const SwNode& node) const;
+
 public:
 ~SwNodes();
 
@@ -188,8 +193,8 @@ public:
 
 SwContentNode* GoNext(SwNodeIndex *) const;
 SwContentNode* GoNext(SwPosition *) const;
-static SwContentNode* GoPrevious(SwNodeIndex *);
-static SwContentNode* GoPrevious(SwPosition *);
+static SwContentNode* GoPrevious(SwNodeIndex *, bool canCrossBoundary = 
false);
+static SwContentNode* GoPrevious(SwPosition *, bool canCrossBoundary = 
false);
 
 /** Go to next content-node that is not protected or hidden
(Both set FALSE ==> GoNext/GoPrevious!!!). */
diff --git a/sw/qa/extras/uiwriter/data/FrameInHiddenSection.fodt 
b/sw/qa/extras/uiwriter/data/FrameInHiddenSection.fodt
new file mode 100644
index ..2095c7173046
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/FrameInHiddenSection.fodt
@@ -0,0 +1,20 @@
+
+
+
+ 
+  
+   
+
+ 
+  
+ lorem
+
+
+
+
+ ipsum
+
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 7b5103bc4524..cafda2aa260e 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -251,6 +253,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, 
testHiddenSectionsAroundPageBreak)
 CPPUNIT_ASSERT_EQUAL(u"Landscape"_ustr, getProperty(xCursor, 
"PageStyleName"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159565)
+{
+// Given a document with a hidden section in the beginning, additionally 
containing a frame
+createSwDoc("FrameInHiddenSection.fodt");
+
+dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+
+// Check that the selection covers the whole visible text
+auto xModel(mxComponent.queryThrow());
+auto 
xSelSupplier(xModel->getCurrentController().queryThrow());
+auto 
xSelections(xSelSupplier->getSelection().queryThrow());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSelections->getCount());
+auto 
xSelection(xSelections->getByIndex(0).queryThrow());
+
+// Without the fix, this would fail - there was no selection
+CPPUNIT_ASSERT_EQUAL(u"" SAL_NEWLINE_STRING SAL_NEWLINE_STRING 
"ipsum"_ustr,
+ xSelection->getString());
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 13d2776d83dd..06cc3a4fd64a 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -775,6 +775,8 @@ static typename SwCursorShell::StartsWith 
StartsWith(SwStartNode const& rStart)
 switch (rNode.GetNodeType())
 {
 case SwNodeType::Section:
+if (rNode.GetSectionNode()->GetSection().IsHidden())
+return SwCursorShell::StartsWith::HiddenSection;
  

core.git: sw/inc sw/qa sw/source

2024-02-14 Thread Mike Kaganski (via logerrit)
 sw/inc/crsrsh.hxx |2 
 sw/inc/node.hxx   |2 
 sw/qa/extras/layout/data/largeTopMarginAndHiddenFirstSection.fodt |   15 +
 sw/qa/extras/layout/data/pageBreakInHiddenSection.fodt|   90 
+++
 sw/qa/extras/layout/layout3.cxx   |   68 -
 sw/qa/extras/uiwriter/data/hiddenSectionsAroundPageBreak.fodt |   21 +
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   16 +
 sw/source/core/crsr/crsrsh.cxx|   12 -
 sw/source/core/crsr/pam.cxx   |5 
 sw/source/core/doc/docedt.cxx |4 
 sw/source/core/docnode/ndsect.cxx |4 
 sw/source/core/docnode/nodes.cxx  |6 
 sw/source/core/docnode/section.cxx|7 
 sw/source/core/edit/editsh.cxx|2 
 sw/source/core/inc/frame.hxx  |2 
 sw/source/core/inc/sectfrm.hxx|2 
 sw/source/core/inc/txtfrm.hxx |2 
 sw/source/core/layout/calcmove.cxx|   13 -
 sw/source/core/layout/findfrm.cxx |8 
 sw/source/core/layout/flowfrm.cxx |  119 
--
 sw/source/core/layout/frmtool.cxx |   23 -
 sw/source/core/layout/ftnfrm.cxx  |   10 
 sw/source/core/layout/pagechg.cxx |5 
 sw/source/core/layout/sectfrm.cxx |   37 +++
 sw/source/core/layout/tabfrm.cxx  |6 
 sw/source/core/layout/trvlfrm.cxx |   25 +-
 sw/source/core/text/txtfrm.cxx|   19 -
 27 files changed, 362 insertions(+), 163 deletions(-)

New commits:
commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1
Author: Mike Kaganski 
AuthorDate: Fri Feb 9 11:56:19 2024 +0600
Commit: Mike Kaganski 
CommitDate: Wed Feb 14 21:54:55 2024 +0100

tdf#159565 prerequisite: make hidden sections have zero-height frames

As mentioned in commit bb733957dd39e6f0b9d80bb59eb0177188794797 (tdf#114973
sw: enable SelectAll with hidden para at start/end, 2023-01-27), the hidden
sections didn't have frames. That prevented correct handling of the case
when such a frame was in the beginning of the document.

This change re-implements the hidden section to use 0-height frames, like
hidden paragraphs, as a pre-requisite for a follow-up change.

Some layout breakages noticed while working on this are unit-tested now.

This change needed to handle the case when the first section is hidden, and
then goes a page break with page style. In this case, the page style must
apply to the very first page of the document. Implementing this now, when
the frame that defines the page style is not the first in the document, I
accidentally fixed also the previously broken case when the first paragraph
was hidden. Now the page style defined in the second paragraph's page break
will apply correctly.

This change makes hidden sections break outer section's frames. This means
that when text borders are shown, there will be an artifact in the place of
the hidden sections (a horizontal line breaking outer frame). I suppose
it's not a problem, actually helping to see the layout better, so in line
with the "show text borders" helper functionality. If this proves to be
problematic, this can be handled specially in a follow-up.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 5823a49a1599..eafc6a0c31e4 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -267,7 +267,7 @@ private:
 SAL_DLLPRIVATE bool LRMargin( bool, bool bAPI = false );
 SAL_DLLPRIVATE bool IsAtLRMargin( bool, bool bAPI = false ) const;
 
-SAL_DLLPRIVATE bool isInHiddenTextFrame(SwShellCursor* pShellCursor);
+SAL_DLLPRIVATE bool isInHiddenFrame(SwShellCursor* pShellCursor);
 
 SAL_DLLPRIVATE bool GoStartWordImpl();
 SAL_DLLPRIVATE bool GoEndWordImpl();
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index de7e24a0b152..b1e3309d596f 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -590,7 +590,7 @@ public:
 const SwSection& GetSection() const { return *m_pSection; }
   SwSection& GetSection()   { return *m_pSection; }
 
-SwFrame *MakeFrame( SwFrame* );
+SwFrame* MakeFrame(SwFrame* pSib, bool bHidden);
 
 

core.git: sw/inc sw/qa sw/source

2024-01-26 Thread Caolán McNamara (via logerrit)
 dev/null   |binary
 sw/inc/viewopt.hxx |5 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   53 -
 sw/source/uibase/config/viewopt.cxx|6 --
 4 files changed, 39 insertions(+), 25 deletions(-)

New commits:
commit ee52e5385497a04b23bcc907ec43cafd8bfadf28
Author: Caolán McNamara 
AuthorDate: Thu Jan 25 14:50:29 2024 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 26 10:47:53 2024 +0100

revert: 'LOKit: always display hidden chars when showing formatting...'

and add a counter-reason test.

When we have multiple views of a document, whether in LOKit or in
desktop via "Window, New Window" then we have just one layout and render
that layout in each view. So with default settings: View, Formatting
Marks, we can correctly render the Pilcows in one view but not in the
another even though we share a single layout.

If "Show Hidden Characters" is enabled, then when "view formatting" is
also enabled then hidden characters are shown when view formatting is
enabled, and not when it is disabled.

But if "show hidden characters" are enabled, then if formatting marks
are enabled in one view and and not another then the hidden characters
will be either shown in both views or hidden in both views, depending on
whether the shared layout is done with "show/hide hidden characters". So
we currently can't show/hide the hidden characters per-view.

revert:
commit 7a6b80995f69304149e0ab7a8e1fa92a15b20d07
Date:   Wed Oct 4 10:04:42 2023 -0400

LOKit: always display hidden chars when showing formatting marks

This arises from noting that in kit then on turning on formatting marks
in one view, then the other view rendering options changed, which isn't
wanted. But on attempting to keep the other ViewShell settings
unaffected it turns out to be futile given the shared layout.

Change-Id: I210b86fae84bc8137af415cb9c93dacdeab7d448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162579
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 5234435a552d3d4cc421ba5c8600d8215f9f8f4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162549
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index a98da0dc3cdf..8aac21e745b3 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -489,7 +489,10 @@ public:
 void SetTreatSubOutlineLevelsAsContent(bool b)
 { m_nCoreOptions.bTreatSubOutlineLevelsAsContent = b; }
 
-bool IsShowHiddenChar(bool bHard = false) const;
+bool IsShowHiddenChar(bool bHard = false) const
+{ return !m_bReadonly && m_nCoreOptions.bCharHidden &&
+(m_nCoreOptions.bViewMetachars || bHard); }
+
 void SetShowHiddenChar( bool b )
 { m_nCoreOptions.bCharHidden = b; }
 
diff --git a/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx 
b/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx
deleted file mode 100644
index 0802f6e7d314..
Binary files a/sw/qa/extras/tiledrendering/data/hiddenLoremIpsum.docx and 
/dev/null differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 7f9bb18c0498..8f52f59211cc 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -762,6 +762,7 @@ namespace {
 bool m_bOwnSelectionSet;
 bool m_bViewSelectionSet;
 OString m_aViewSelection;
+OString m_aViewRenderState;
 bool m_bTilesInvalidated;
 bool m_bViewCursorVisible;
 bool m_bGraphicViewSelection;
@@ -909,6 +910,11 @@ namespace {
 m_bViewLock = 
aTree.get_child("rectangle").get_value() != "EMPTY";
 }
 break;
+case LOK_CALLBACK_VIEW_RENDER_STATE:
+{
+m_aViewRenderState = pPayload;
+}
+break;
 case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
 {
 m_aRedlineTableChanged.clear();
@@ -2986,24 +2992,6 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testPilcrowRedlining)
 comphelper::dispatchCommand(".uno:ControlCodes", {});
 }
 
-CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testShowHiddenCharsWhenShowFormatting)
-{
-// In LOKit, ignore the config setting for
-// Tools - Options - Writer - Formatting Aids - Display Formatting - 
Hidden characters
-// and always show hidden content when showing pilcrow formatting
-
-createSwDoc("hiddenLoremIpsum.docx");
-
-// Since LOKit is active in TiledRendering, turning on "Show formatting" 
will show hidden text.
-

core.git: sw/inc sw/qa sw/source

2024-01-17 Thread Oliver Specht (via logerrit)
 sw/inc/crsrsh.hxx   |2 -
 sw/qa/uitest/data/tdf150037.docx|binary
 sw/qa/uitest/data/tdf150037.odt |binary
 sw/qa/uitest/writer_tests8/tdf150037.py |   44 
 sw/source/core/crsr/crbm.cxx|9 --
 sw/source/core/inc/swfont.hxx   |2 +
 sw/source/core/txtnode/fntcache.cxx |9 --
 sw/source/uibase/docvw/edtwin.cxx   |6 +++-
 sw/source/uibase/inc/edtwin.hxx |2 +
 sw/source/uibase/inc/wrtsh.hxx  |2 -
 sw/source/uibase/uitest/uiobject.cxx|   37 ++
 sw/source/uibase/wrtsh/wrtsh3.cxx   |4 +-
 12 files changed, 106 insertions(+), 11 deletions(-)

New commits:
commit 96323a10d3a55d212c350886e2a1344c0cd2ba95
Author: Oliver Specht 
AuthorDate: Wed Dec 20 07:15:53 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Jan 17 22:24:25 2024 +0100

tdf#150037 Writer: text fieldmark behaviour changed

A mouse click selects the fieldmark to be able to overwrite the field
with the next text input. Additionally the EN SPACE (0x2002) character
is visualized by the DEGREE symbol when 'View/Formatting Marks' is
active.

Word's FORMTEXT ist usually filled with EN SPACE.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index db0667002ee2..5823a49a1599 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -593,7 +593,7 @@ public:
 ::sw::mark::IFieldmark* GetCurrentFieldmark();
 sw::mark::IFieldmark* GetFieldmarkAfter(bool bLoop);
 sw::mark::IFieldmark* GetFieldmarkBefore(bool bLoop);
-bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark );
+bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark, bool 
completeSelection = false );
 
 // update Cursr, i.e. reset it into content should only be called when the
 // cursor was set to a random position e.g. when deleting frames
diff --git a/sw/qa/uitest/data/tdf150037.docx b/sw/qa/uitest/data/tdf150037.docx
new file mode 100755
index ..4fcb18efd724
Binary files /dev/null and b/sw/qa/uitest/data/tdf150037.docx differ
diff --git a/sw/qa/uitest/data/tdf150037.odt b/sw/qa/uitest/data/tdf150037.odt
new file mode 100755
index ..15d75a694b0a
Binary files /dev/null and b/sw/qa/uitest/data/tdf150037.odt differ
diff --git a/sw/qa/uitest/writer_tests8/tdf150037.py 
b/sw/qa/uitest/writer_tests8/tdf150037.py
new file mode 100644
index ..39ea5eda7dec
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf150037.py
@@ -0,0 +1,44 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH
+
+class tdf150037(UITestCase):
+
+def test_tdf150037(self):
+
+with self.ui_test.load_file(get_url_for_data_file("tdf150037.docx")) 
as document:
+
+xWriterDoc = self.xUITest.getTopFocusWindow()
+xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": 
"14", "END_POS": "14"}))
+xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": 
"Replacement"}))
+xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": 
"0", "END_POS": "22"}))
+windowState = xWriterEdit.getState();
+self.assertEqual(windowState[14].Value, "Fieldmark: Replacement")
+
+def test_tdf150037_protected(self):
+
+with self.ui_test.load_file(get_url_for_data_file("tdf150037.odt")) as 
document:
+
+xWriterDoc = self.xUITest.getTopFocusWindow()
+xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": 
"14", "END_POS": "14"}))
+xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": 
"Replacement"}))
+xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": 
"0", "END_POS": "23"}))
+windowState = xWriterEdit.getState();
+self.assertEqual(windowState[14].Value, "Fieldmark: Replacement")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index e296bd50e8fe..fbc2ab28e1da 100644
--- 

core.git: sw/inc sw/qa sw/source

2024-01-14 Thread Mike Kaganski (via logerrit)
 sw/inc/anchoreddrawobject.hxx  |4 
 sw/inc/anchoredobject.hxx  |5 
 sw/qa/core/text/text.cxx   |2 
 sw/qa/extras/layout/layout3.cxx|4 
 sw/qa/extras/uiwriter/uiwriter5.cxx|4 
 sw/source/core/doc/doclay.cxx  |6 -
 sw/source/core/draw/dcontact.cxx   |8 -
 sw/source/core/draw/dview.cxx  |4 
 sw/source/core/fields/postithelper.cxx |4 
 sw/source/core/frmedt/fefly1.cxx   |   32 ++---
 sw/source/core/frmedt/feshview.cxx |   12 +-
 sw/source/core/frmedt/fews.cxx |4 
 sw/source/core/inc/flyfrm.hxx  |4 
 sw/source/core/layout/anchoreddrawobject.cxx   |   58 
+-
 sw/source/core/layout/anchoredobject.cxx   |   46 
+++
 sw/source/core/layout/atrfrm.cxx   |2 
 sw/source/core/layout/calcmove.cxx |8 -
 sw/source/core/layout/flowfrm.cxx  |   16 +-
 sw/source/core/layout/fly.cxx  |   34 ++---
 sw/source/core/layout/flycnt.cxx   |   10 -
 sw/source/core/layout/flyincnt.cxx |2 
 sw/source/core/layout/flylay.cxx   |   10 -
 sw/source/core/layout/frmtool.cxx  |6 -
 sw/source/core/layout/layact.cxx   |2 
 sw/source/core/layout/objectformattertxtfrm.cxx|   17 +-
 sw/source/core/layout/pagechg.cxx  |   26 ++--
 sw/source/core/layout/sortedobjs.cxx   |   22 +--
 sw/source/core/layout/tabfrm.cxx   |   32 ++---
 sw/source/core/layout/trvlfrm.cxx  |7 -
 sw/source/core/layout/wsfrm.cxx|6 -
 sw/source/core/objectpositioning/anchoredobjectposition.cxx|2 
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx |4 
 sw/source/core/text/EnhancedPDFExportHelper.cxx|2 
 sw/source/core/text/frmform.cxx|2 
 sw/source/core/text/itratr.cxx |2 
 sw/source/core/text/itrform2.cxx   |2 
 sw/source/core/text/porfly.cxx |2 
 sw/source/core/text/porlay.cxx |2 
 sw/source/core/text/txtfly.cxx |   39 
+++---
 sw/source/core/text/txtfrm.cxx |2 
 sw/source/core/txtnode/ndtxt.cxx   |6 -
 sw/source/core/unocore/unoobj2.cxx |   12 +-
 42 files changed, 237 insertions(+), 237 deletions(-)

New commits:
commit b5c81b6c36dcd539d3104e7902373d96b3e025f6
Author: Mike Kaganski 
AuthorDate: Sun Jan 14 17:53:03 2024 +0600
Commit: Mike Kaganski 
CommitDate: Sun Jan 14 14:44:22 2024 +0100

Let SwAnchoredObject::GetFrameFormat return pointer, and drop HasFrameFormat

In commit 19062c98da5b2e9edc7a99068fa06a83c7578826, it was important to
check if objects have frame format before using GetFrameFormat.

Thic change makes it simpler amd more obvious. Also, it allows to avoid
two calls to GetUserCall, by obtaining the pointer once and checking it.

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

diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx
index 609582d4d326..bfc40fe07a3c 100644
--- a/sw/inc/anchoreddrawobject.hxx
+++ b/sw/inc/anchoreddrawobject.hxx
@@ -115,8 +115,8 @@ class SwAnchoredDrawObject final : public SwAnchoredObject
 }
 
 // accessors to the format
-virtual SwFrameFormat& GetFrameFormat() override;
-virtual const SwFrameFormat& GetFrameFormat() const override;
+virtual SwFrameFormat* GetFrameFormat() override;
+virtual const SwFrameFormat* GetFrameFormat() const override;
 
 // accessors to the object area and its position
 virtual SwRect GetObjRect() const override;
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 9af198425714..48b192f69ba9 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -318,9 +318,8 @@ class SW_DLLPUBLIC 

core.git: sw/inc sw/qa sw/source

2024-01-02 Thread Justin Luth (via logerrit)
 sw/inc/crsrsh.hxx|   10 ++
 sw/inc/crstate.hxx   |4 -
 sw/qa/extras/uiwriter/data/tdf111969_field.fodt  |   10 ++
 sw/qa/extras/uiwriter/data/tdf111969_fieldB.fodt |   10 ++
 sw/qa/extras/uiwriter/uiwriter9.cxx  |   86 +++
 sw/source/core/crsr/crsrsh.cxx   |3 
 sw/source/uibase/docvw/edtwin.cxx|4 -
 7 files changed, 122 insertions(+), 5 deletions(-)

New commits:
commit e73dfbf860b977f3b862fb75a87a7ad726d9a4c7
Author: Justin Luth 
AuthorDate: Mon Dec 25 20:23:52 2023 -0500
Commit: Miklos Vajna 
CommitDate: Wed Jan 3 08:45:34 2024 +0100

tdf#111969 sw: acknowledge field start/end for context menu

This fixes the right-click menu building
missing out on the edit/update field option about
half-a-character too soon at the end.

It also fixes itrcrsr adding field actions to the menu
half-a-char too soon in the edge case of a 1-len portion.
This edge case is not limited to fields - it fixes it
for redlines (and hyperlinks if other bugs are fixed).

make CppunitTest_sw_uiwriter9 CPPUNIT_TEST_NAME=testTdf111969

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 20636648c794..db0667002ee2 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -401,7 +401,15 @@ public:
 //  return values:
 //  CRSR_POSCHG: when cursor was corrected from SPoint by the layout
 //  CRSR_POSOLD: when the cursor was not changed
-int SetCursor( const Point , bool bOnlyText = false, bool bBlock = 
true );
+/**
+ * @param bFieldInfo
+ * false: Over the last half of the character, place cursor behind it. 
This is used when
+ *the cursor is actually being moved by the user to the closest 
valid point.
+ *  true: Place the cursor at the start of the character/field. This is 
used when setting
+ *the cursor is done in order to get at the properties under the 
mouse pointer.
+ */
+int SetCursor(const Point& rPt, bool bOnlyText = false, bool bBlock = true,
+  bool bFieldInfo = false);
 
 /*
  * Notification that the visible area was changed. m_aVisArea is reset, 
then
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
index acf13bfe45d7..018106514714 100644
--- a/sw/inc/crstate.hxx
+++ b/sw/inc/crstate.hxx
@@ -139,7 +139,7 @@ struct SwCursorMoveState
 sal_uInt8m_nCursorBidiLevel;
 bool m_bStop;
 bool m_bRealHeight;   ///< should the real height be calculated?
-bool m_bFieldInfo;///< should be fields recognized?
+bool m_bFieldInfo;///< should fields be recognized? (get 
position of field start)
 bool m_bPosCorr;  ///< Point had to be corrected
 bool m_bFootnoteNoInfo;///< recognized footnote numbering
 bool m_bExactOnly;/**< let GetModelPositionForViewPoint look 
for exact matches only,
@@ -151,7 +151,7 @@ struct SwCursorMoveState
 bool m_bNoScroll; ///< No scrolling of undersized textframes
 bool m_bPosMatchesBounds; /**< GetModelPositionForViewPoint should 
not return the next
position if screen position is inside 
second
-   have of bound rect */
+   half of bound rect */
 
 bool m_bContentCheck;   // #i43742# Cursor position over content?
 
diff --git a/sw/qa/extras/uiwriter/data/tdf111969_field.fodt 
b/sw/qa/extras/uiwriter/data/tdf111969_field.fodt
new file mode 100644
index ..4048fa03c42b
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf111969_field.fodt
@@ -0,0 +1,10 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   ––
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/data/tdf111969_fieldB.fodt 
b/sw/qa/extras/uiwriter/data/tdf111969_fieldB.fodt
new file mode 100644
index ..18de3f586a94
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf111969_fieldB.fodt
@@ -0,0 +1,10 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index c12be545512d..8febc2f2145e 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -68,6 +68,92 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158785)
 CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::NONE, aContentAtPos.eContentAtPos);
 }
 

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

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

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

sw: fix issue with copying stashed frame format

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

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

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

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

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

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

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

tdf#158336: Only Change current table

For that, use the same logic as TryBoxNmToPtr

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

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

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


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

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

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

Add flags to STYLEREF

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

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

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

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

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

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

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

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

This reverts commit e37f06f534ac864f9fe8cd20b07a85c36e697d41.
and ui test from Ia1a2387e137f8a672a24056b13234d4275a77ca4

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

LOKit: always display hidden chars when showing formatting marks

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

Doing this only for Online.

make CppunitTest_sw_tiledrendering \
CPPUNIT_TEST_NAME=testShowHiddenCharsWhenShowFormatting

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

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


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

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

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

SW comments: Provide parent / child relations without position.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Rewrite writerfilter in sw;

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

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

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

diff --git a/sw/inc/autostyle_helper.hxx b/sw/inc/autostyle_helper.hxx
new file mode 100644
index ..9336085db02e
--- /dev/null
+++ b/sw/inc/autostyle_helper.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "istyleaccess.hxx"
+#include "swatrset.hxx"
+
+class SwDoc;
+
+std::shared_ptr
+PropValuesToAutoStyleItemSet(SwDoc& rDoc, IStyleAccess::SwAutoStyleFamily 
eFamily,
+ const 
css::uno::Sequence& Values,
+ SfxItemSet& rSet);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git 
a/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx
new file mode 100644
index ..6cbb8fb72e9d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf141969-font_in_table_with_style.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 20b190d59af6..a0a4d8051686 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1177,6 +1177,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078)
 CPPUNIT_ASSERT(numberPixelsFound);
 }
 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

tdf#103064 sw: add a comment style

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

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

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

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

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

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

This reverts 7.4 commit 41b012767feb8552b60a68c7be18d80c403304bf,

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

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

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

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

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

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

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

tdf#81720 Don't expand Reference Marks

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2023-05-13 Thread Thorsten Behrens (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |2 +-
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |7 +++
 sw/source/core/access/AccessibilityCheck.cxx |3 +--
 3 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 5351b8789805154219fe57b92b41b17c0e0cd765
Author: Thorsten Behrens 
AuthorDate: Fri May 12 10:42:56 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Sat May 13 13:25:08 2023 +0200

related tdf#57423: make a11y checker accept image description too

For LibreOffice, alt text and image description text are treated
mostly the same during PDF export (and merged, if both are set), so
having at least one of them set should make the checker happy enough.

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

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 805f525b37e2..cb461b1013f8 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -13,7 +13,7 @@
 
 #define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String))
 
-#define STR_NO_ALT  NC_("STR_NO_ALT", "No alt text for 
graphic “%OBJECT_NAME%”.")
+#define STR_NO_ALT  NC_("STR_NO_ALT", "No alt or 
description text for graphic “%OBJECT_NAME%”.")
 #define STR_TABLE_MERGE_SPLIT   NC_("STR_TABLE_MERGE_SPLIT", "Table 
“%OBJECT_NAME%” contains merges or splits.")
 #define STR_FAKE_NUMBERING  NC_("STR_FAKE_NUMBERING", "Simulated 
numbering “%NUMBERING%”.")
 #define STR_HYPERLINK_TEXT_IS_LINK  NC_("STR_HYPERLINK_TEXT_IS_LINK", 
"Hyperlink text is the same as the link address “%LINK%”.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index d24a0922b73e..2b99f49b0cb2 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -48,15 +48,14 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testTableSplitMergeAndAltText)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(7), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(size_t(6), aIssues.size());
 
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_GRAPHIC, 
aIssues[0]->m_eIssueID);
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_OLE, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, 
aIssues[1]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, 
aIssues[2]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, 
aIssues[3]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, 
aIssues[4]->m_eIssueID);
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, 
aIssues[5]->m_eIssueID);
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_SHAPE, 
aIssues[6]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_SHAPE, 
aIssues[5]->m_eIssueID);
 }
 
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues)
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index bae9b9d0c586..3a2bf556d112 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -97,8 +97,7 @@ class NoTextNodeAltTextCheck : public NodeCheck
 if (!pNoTextNode)
 return;
 
-OUString sAlternative = pNoTextNode->GetTitle();
-if (!sAlternative.isEmpty())
+if (!pNoTextNode->GetTitle().isEmpty() || 
!pNoTextNode->GetDescription().isEmpty())
 return;
 
 OUString sName = pNoTextNode->GetFlyFormat()->GetName();


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

2023-05-11 Thread Maxim Monastirsky (via logerrit)
 sw/inc/strings.hrc |4 ++--
 sw/qa/extras/odfexport/data/tdf103091.fodt |2 +-
 sw/qa/extras/odfexport/odfexport.cxx   |2 +-
 sw/qa/extras/rtfexport/data/fdo69384-paste.rtf |2 +-
 sw/qa/extras/rtfexport/rtfexport2.cxx  |4 ++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx |2 +-
 sw/qa/extras/uiwriter/uiwriter7.cxx|   10 +-
 sw/qa/uitest/styleInspector/styleInspector.py  |2 +-
 sw/source/uibase/sidebar/StylePresetsPanel.cxx |2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit c83d241effbd09491e9f96d3e435ab91700f58b0
Author: Maxim Monastirsky 
AuthorDate: Thu May 11 00:56:56 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu May 11 11:20:47 2023 +0200

tdf#154933 Rename "Text Body" para style to "Body Text"

- Change only the UI name, leaving the programmatic name
which used by ODF and UNO API unchanged.

- DOCX shouldn't be affected either, as that style is
mapped to Word's "Text Body".

- RTF export used to use the UI name (at least in 7.5).
Which means that files created in older LO will show 2
styles for old and new names (same would happen also with
files created with a different UI language). It seems to
be no longer the case in current master.

Change-Id: I8a4866d5db5f964a5d45071fb09a99ed4996fae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151653
Tested-by: Maxim Monastirsky 
Reviewed-by: Heiko Tietze 
Reviewed-by: Maxim Monastirsky 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 733193103d1e..e9f4927c6200 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -73,10 +73,10 @@
 #define STR_POOLFRM_LABEL   NC_("STR_POOLFRM_LABEL", 
"Labels")
 // Template names
 #define STR_POOLCOLL_STANDARD   NC_("STR_POOLCOLL_STANDARD", 
"Default Paragraph Style")
-#define STR_POOLCOLL_TEXT   NC_("STR_POOLCOLL_TEXT", "Text 
Body")
+#define STR_POOLCOLL_TEXT   NC_("STR_POOLCOLL_TEXT", "Body 
Text")
 #define STR_POOLCOLL_TEXT_IDENT NC_("STR_POOLCOLL_TEXT_IDENT", 
"First Line Indent")
 #define STR_POOLCOLL_TEXT_NEGIDENT  
NC_("STR_POOLCOLL_TEXT_NEGIDENT", "Hanging Indent")
-#define STR_POOLCOLL_TEXT_MOVE  NC_("STR_POOLCOLL_TEXT_MOVE", 
"Text Body Indent")
+#define STR_POOLCOLL_TEXT_MOVE  NC_("STR_POOLCOLL_TEXT_MOVE", 
"Body Text, Indented")
 #define STR_POOLCOLL_GREETING   NC_("STR_POOLCOLL_GREETING", 
"Complimentary Close")
 #define STR_POOLCOLL_SIGNATURE  NC_("STR_POOLCOLL_SIGNATURE", 
"Signature")
 #define STR_POOLCOLL_HEADLINE_BASE  
NC_("STR_POOLCOLL_HEADLINE_BASE", "Heading")
diff --git a/sw/qa/extras/odfexport/data/tdf103091.fodt 
b/sw/qa/extras/odfexport/data/tdf103091.fodt
index 1da98f49d828..7b7d35cd4672 100644
--- a/sw/qa/extras/odfexport/data/tdf103091.fodt
+++ b/sw/qa/extras/odfexport/data/tdf103091.fodt
@@ -32,7 +32,7 @@


   
-  
+  



diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index cdafc3abc4ba..1b2c83309e79 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1271,7 +1271,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103091)
 // check that all conditional paragraph style conditions are imported
 uno::Reference 
xParaStyles(getStyles("ParagraphStyles"));
 uno::Reference xStyle1(xParaStyles->getByName(
-"Text Body"), uno::UNO_QUERY);
+"Text body"), uno::UNO_QUERY);
 auto conditions(getProperty>(xStyle1, 
"ParaStyleConditions"));
 
 CPPUNIT_ASSERT_EQUAL(sal_Int32(28), conditions.getLength());
diff --git a/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf 
b/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf
index e0a9733c7475..0f8856654b79 100644
--- a/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf
+++ b/sw/qa/extras/rtfexport/data/fdo69384-paste.rtf
@@ -8,7 +8,7 @@
 
{\s4\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext4
 Object without fill;}
 
{\s5\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext5
 Object with no fill and no line;}
 
{\s6\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext6
 Text;}
-{\s7\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs132\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs136\fs136\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext7
 Text Body;}
+{\s7\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs132\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs136\fs136\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext7
 Body Text;}
 

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

2023-05-09 Thread Michael Stahl (via logerrit)
 sw/inc/crsrsh.hxx|   14 -
 sw/qa/extras/odfimport/odfimport.cxx |4 
 sw/qa/extras/uiwriter/uiwriter3.cxx  |8 
 sw/source/core/crsr/crsrsh.cxx   |  281 ---
 sw/source/core/edit/eddel.cxx|   20 --
 sw/source/core/edit/edglss.cxx   |   20 --
 sw/source/uibase/wrtsh/move.cxx  |   46 +
 sw/source/uibase/wrtsh/select.cxx|   36 ++--
 8 files changed, 348 insertions(+), 81 deletions(-)

New commits:
commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda
Author: Michael Stahl 
AuthorDate: Mon May 8 16:38:03 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue May 9 10:34:40 2023 +0200

tdf#154877 sw: generalise ExtendedSelectAll()

This used to work only in the body text; make it work in any text, so
also text frame, header/footer, footnote, table cell.

(fixes regression from commit 0590cd2857f68f48b8847071a9c1a7dbef135721)

This is made much more difficult by table cells, which may contain
nested tables; there is already some code to switch between text
selection (via m_pCurrentCursor) and table cell selection (via
m_pTableCursor).

There were also a few things that looked kinda wrong, but i forgot
where.

One tricky case that can't be handled well is if there are multiple
tables in a text but no paragraph (this is impossible in the body but
possible in other texts by removing the paragraph via Ctrl+Shift+Delete)
... here the most we get is one table fully selected, because the
SwTableCursor can't select cells from multiple tables.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 5f99deff126b..57bb90a11a5d 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -331,7 +331,7 @@ public:
 // only for usage in special cases allowed!
 void ExtendedSelectAll(bool bFootnotes = true);
 /// If ExtendedSelectAll() was called and selection didn't change since 
then.
-bool ExtendedSelectedAll();
+SwNode const* ExtendedSelectedAll() const;
 enum class StartsWith { None, Table, HiddenPara };
 /// If document body starts with a table or starts/ends with hidden 
paragraph.
 StartsWith StartsWith_();
@@ -593,8 +593,11 @@ public:
 // fields etc.
 OUString GetSelText() const;
 
-// Check of SPoint or Mark of current cursor are placed within a table.
-inline const SwTableNode* IsCursorInTable() const;
+/// Check if Point of current cursor is placed within a table.
+const SwTableNode* IsCursorInTable() const;
+bool MoveOutOfTable();
+bool TrySelectOuterTable();
+bool MoveStartText();
 
 bool IsCursorInFootnote() const;
 
@@ -912,11 +915,6 @@ inline bool SwCursorShell::IsMultiSelection() const
 return m_pCurrentCursor->GetNext() != m_pCurrentCursor;
 }
 
-inline const SwTableNode* SwCursorShell::IsCursorInTable() const
-{
-return m_pCurrentCursor->GetPointNode().FindTableNode();
-}
-
 inline bool SwCursorShell::IsCursorPtAtEnd() const
 {
 return m_pCurrentCursor->End() == m_pCurrentCursor->GetPoint();
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index add0d98789b6..7225be2d4b8e 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -732,6 +732,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo37606)
 
 pWrtShell->SelAll(); // Selects the whole table.
 pWrtShell->SelAll(); // Selects the whole document.
+pShellCursor = pWrtShell->getShellCursor(false);
+
 SwTextNode& rStart = 
dynamic_cast(pShellCursor->Start()->GetNode());
 CPPUNIT_ASSERT_EQUAL(OUString("A1"), rStart.GetText());
 
@@ -798,11 +800,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69862)
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
 SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
-SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
 
 pWrtShell->SelAll(); // Selects A1.
 pWrtShell->SelAll(); // Selects the whole table.
 pWrtShell->SelAll(); // Selects the whole document.
+SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
 SwTextNode& rStart = 
dynamic_cast(pShellCursor->Start()->GetNode());
 // This was "Footnote.", as Ctrl-A also selected footnotes, but it should 
not.
 CPPUNIT_ASSERT_EQUAL(OUString("A1"), rStart.GetText());
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 9580cd93c67f..c1a8faef373a 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -246,10 +246,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf114973)
 {
 createSwDoc("tdf114973.fodt");
 
-dispatchCommand(mxComponent, ".uno:SelectAll", {});

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

2023-05-08 Thread László Németh (via logerrit)
 sw/inc/ndtxt.hxx  |2 +
 sw/qa/extras/uiwriter/data/tdf150824.fodt |   48 ++
 sw/qa/extras/uiwriter/uiwriter5.cxx   |   36 ++
 sw/source/core/doc/docredln.cxx   |   43 --
 4 files changed, 118 insertions(+), 11 deletions(-)

New commits:
commit 4d3d1527c4cf8ab6675d42d02cf313796398b220
Author: László Németh 
AuthorDate: Fri May 5 14:44:11 2023 +0200
Commit: László Németh 
CommitDate: Mon May 8 13:33:51 2023 +0200

tdf#147180 sw: fix lost change tracking of empty rows

during partitionating the redline of a tracked text
containing tables.

Empty tracked table rows use a dummy redline to store
tracking data. Insert this, when tracked tables in a
single redline are partitionated after modifying its
text content, deleting its rows, or using tabulator to
move cursor in the next cell.

Follow-up to commit a9cf949efcfdb9eb459cabe1b9e15f993e789c73
"tdf#147180 sw: fix lost change tracking of modified tables".

Tests:

1) Load a tracked empty table, and insert a character
   in the first cell;

2) Insert a tracked empty table with multiple rows, and insert
   two paragraphs in the first cell;

3) Insert a tracked empty table with multiple rows, and delete
   the first row.

4. Insert a tracked empty table with multiple rows, insert a
   character and press tabulator (which triggers partitionating
   as a new regression).

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

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index a22d1afeb2c1..c16a643ec76c 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -278,6 +278,8 @@ public:
 OUString InsertText( const OUString & rStr, const SwPosition & rIdx,
  const SwInsertFlags nMode
  = SwInsertFlags::DEFAULT );
+/// Add a dummy character to the redline of the table changes
+void InsertDummy() { m_Text = OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR); }
 
 /** delete text content
 ATTENTION: must not be called with a range that overlaps the start of
diff --git a/sw/qa/extras/uiwriter/data/tdf150824.fodt 
b/sw/qa/extras/uiwriter/data/tdf150824.fodt
new file mode 100644
index ..c1e437a12198
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf150824.fodt
@@ -0,0 +1,48 @@
+
+
+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" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+
+ 
+  
+   Unknown Author
+   2022-09-06T14:47:25
+  
+ 
+
+   
+   
+   
+
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+
+ 
+  
+ 

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

2023-04-28 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |6 -
 sw/inc/frameformats.hxx |   14 
 sw/inc/frmfmt.hxx   |   52 +++-
 sw/inc/textboxhelper.hxx|7 +-
 sw/qa/core/attr/attr.cxx|4 -
 sw/qa/core/doc/doc.cxx  |   13 +---
 sw/qa/core/draw/draw.cxx|2 
 sw/qa/core/layout/flycnt.cxx|4 -
 sw/qa/core/txtnode/txtnode.cxx  |4 -
 sw/qa/core/undo/undo.cxx|2 
 sw/qa/core/view/view.cxx|6 -
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |2 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter8.cxx |   12 +--
 sw/qa/extras/ww8export/ww8export.cxx|4 -
 sw/qa/filter/html/html.cxx  |8 +-
 sw/qa/filter/ww8/ww8.cxx|4 -
 sw/qa/uibase/docvw/docvw.cxx|4 -
 sw/qa/uibase/uno/uno.cxx|4 -
 sw/source/core/crsr/crstrvl.cxx |5 -
 sw/source/core/doc/CntntIdxStore.cxx|4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 -
 sw/source/core/doc/DocumentLayoutManager.cxx|   11 +--
 sw/source/core/doc/dbgoutsw.cxx |   13 +---
 sw/source/core/doc/docbasic.cxx |   12 +--
 sw/source/core/doc/doccomp.cxx  |   10 +--
 sw/source/core/doc/docedt.cxx   |   30 -
 sw/source/core/doc/docfly.cxx   |   23 +--
 sw/source/core/doc/docfmt.cxx   |   11 +--
 sw/source/core/doc/doclay.cxx   |   11 +--
 sw/source/core/doc/docnew.cxx   |4 -
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|5 -
 sw/source/core/docnode/ndtbl.cxx|3 
 sw/source/core/docnode/node.cxx |   20 ++
 sw/source/core/draw/dcontact.cxx|9 +-
 sw/source/core/frmedt/fecopy.cxx|   12 +--
 sw/source/core/frmedt/fefly1.cxx|6 -
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/inc/frmtool.hxx  |8 +-
 sw/source/core/inc/rolbck.hxx   |9 +-
 sw/source/core/layout/atrfrm.cxx|   29 ++--
 sw/source/core/layout/frmtool.cxx   |   18 ++---
 sw/source/core/layout/pagechg.cxx   |   29 
 sw/source/core/layout/tabfrm.cxx|6 -
 sw/source/core/layout/wsfrm.cxx |4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/core/text/itratr.cxx  |6 -
 sw/source/core/undo/rolbck.cxx  |   10 +--
 sw/source/core/undo/undel.cxx   |   24 ++-
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/undobj1.cxx |8 +-
 sw/source/core/undo/undraw.cxx  |   28 
 sw/source/core/undo/untbl.cxx   |4 -
 sw/source/core/unocore/unocoll.cxx  |   10 ---
 sw/source/core/unocore/unoobj2.cxx  |9 --
 sw/source/core/view/viewsh.cxx  |9 --
 sw/source/filter/html/htmlforw.cxx  |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |5 -
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/ww8/wrtw8esh.cxx   |2 
 66 files changed, 290 insertions(+), 324 deletions(-)

New commits:
commit 6fab79859ec97a9153e033fe00fd01e4e46620ce
Author: Bjoern Michaelsen 
AuthorDate: Thu Apr 27 22:57:09 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Fri Apr 28 14:53:45 2023 +0200

Revert "Revert "introduce sw::SpzFrameFormat ...""

apparently, in SwHistoryChangeFlyAnchor::SetInDoc, m_rFormat might
actually reference a DrawFormat, not a FlyFormat, and that is likely
fundamentally broken. But for now, lets just make m_rFormat a

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

2023-04-27 Thread Stephan Bergmann (via logerrit)
 sw/inc/doc.hxx  |6 -
 sw/inc/frameformats.hxx |   14 
 sw/inc/frmfmt.hxx   |   52 
 sw/inc/textboxhelper.hxx|7 --
 sw/qa/core/attr/attr.cxx|4 -
 sw/qa/core/doc/doc.cxx  |   13 ++--
 sw/qa/core/draw/draw.cxx|2 
 sw/qa/core/layout/flycnt.cxx|4 -
 sw/qa/core/txtnode/txtnode.cxx  |4 -
 sw/qa/core/undo/undo.cxx|2 
 sw/qa/core/view/view.cxx|6 +
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |2 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter8.cxx |   12 +--
 sw/qa/extras/ww8export/ww8export.cxx|4 -
 sw/qa/filter/html/html.cxx  |8 +-
 sw/qa/filter/ww8/ww8.cxx|4 -
 sw/qa/uibase/docvw/docvw.cxx|4 -
 sw/qa/uibase/uno/uno.cxx|4 -
 sw/source/core/crsr/crstrvl.cxx |5 -
 sw/source/core/doc/CntntIdxStore.cxx|4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 +
 sw/source/core/doc/DocumentLayoutManager.cxx|   11 +--
 sw/source/core/doc/dbgoutsw.cxx |   13 ++--
 sw/source/core/doc/docbasic.cxx |   12 +--
 sw/source/core/doc/doccomp.cxx  |   10 +--
 sw/source/core/doc/docedt.cxx   |   30 -
 sw/source/core/doc/docfly.cxx   |   23 +--
 sw/source/core/doc/docfmt.cxx   |   11 +--
 sw/source/core/doc/doclay.cxx   |   11 ++-
 sw/source/core/doc/docnew.cxx   |4 -
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|5 -
 sw/source/core/docnode/ndtbl.cxx|3 
 sw/source/core/docnode/node.cxx |   20 +++---
 sw/source/core/draw/dcontact.cxx|9 +-
 sw/source/core/frmedt/fecopy.cxx|   12 +--
 sw/source/core/frmedt/fefly1.cxx|6 -
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/inc/frmtool.hxx  |8 +-
 sw/source/core/layout/atrfrm.cxx|   29 ++--
 sw/source/core/layout/frmtool.cxx   |   18 +++--
 sw/source/core/layout/pagechg.cxx   |   29 
 sw/source/core/layout/tabfrm.cxx|6 -
 sw/source/core/layout/wsfrm.cxx |4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 +
 sw/source/core/text/itratr.cxx  |6 -
 sw/source/core/undo/rolbck.cxx  |2 
 sw/source/core/undo/undel.cxx   |   24 ---
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/undobj1.cxx |8 +-
 sw/source/core/undo/undraw.cxx  |   28 
 sw/source/core/undo/untbl.cxx   |4 -
 sw/source/core/unocore/unocoll.cxx  |   10 ++-
 sw/source/core/unocore/unoobj2.cxx  |9 +-
 sw/source/core/view/viewsh.cxx  |9 ++
 sw/source/filter/html/htmlforw.cxx  |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |5 -
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/ww8/wrtw8esh.cxx   |2 
 65 files changed, 318 insertions(+), 279 deletions(-)

New commits:
commit 52acefd6024ec79f8333ba40eef83816eda3046f
Author: Stephan Bergmann 
AuthorDate: Thu Apr 27 07:58:23 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Apr 27 09:14:08 2023 +0200

Revert "introduce sw::SpzFrameFormat ..."

This reverts commit 09cdcb5f37bb4e42da7b28db6e757b9f2affed14.  It  broke at
least CppunitTest_sw_uiwriter3
(),

> /sw/source/core/undo/rolbck.cxx:938:46: runtime error: downcast of 
address 0x61300041fd00 which does not point to an 

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

2023-04-25 Thread László Németh (via logerrit)
 sw/inc/swtable.hxx   |3 +
 sw/qa/extras/ooxmlexport/data/tdf150824.fodt |   48 +++
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |   13 +++
 sw/source/core/table/swtable.cxx |   14 +++
 sw/source/filter/ww8/docxtableexport.cxx |4 ++
 5 files changed, 82 insertions(+)

New commits:
commit dd5e5f3fab4b8f736baeda0f706c77a4ea9b6804
Author: László Németh 
AuthorDate: Tue Apr 25 11:04:05 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 25 14:27:57 2023 +0200

tdf#150824 sw DOCX: fix export of new tracked tables

New tracked tables handled by a single redline, which
lost during the export: only the tracked text changes
of the cells were exported, but not the table changes.
This resulted also problems in MSO, e.g. rejecting text
changes removed only single cells of the tables,
modifying the table structure. To fix this, add missing
tracking to the table rows, if needed.

Follow-up to commit 896c2199d9f0a28bd405dd2d1068f5e2973cdf06
"tdf#79069 DOCX: support tracked table (row) deletion".

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

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 272ba18393f1..bd674486278f 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -426,6 +426,9 @@ public:
 // Cache also the type of the redline associated to the changed table row.
 SwRedlineTable::size_type UpdateTextChangesOnly(
 SwRedlineTable::size_type& rRedlinePos, bool bUpdateProperty = true) 
const;
+// tracked text changes, i.e. a single redline can contain tables
+// get that redline for the table row, if it exists
+SwRedlineTable::size_type GetTableRedline() const;
 // is it a tracked row
 bool IsTracked(SwRedlineTable::size_type& rRedlinePos, bool bOnlyDeleted = 
false) const;
 // is it a tracked deleted row
diff --git a/sw/qa/extras/ooxmlexport/data/tdf150824.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf150824.fodt
new file mode 100644
index ..c1e437a12198
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf150824.fodt
@@ -0,0 +1,48 @@
+
+
+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" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+
+ 
+  
+   Unknown Author
+   2022-09-06T14:47:25
+  
+ 
+
+   
+   
+   
+
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+   
+   
+  
+ 
+
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index c97a60677b3c..661d2415e6cb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ 

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

2023-04-24 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |6 -
 sw/inc/frameformats.hxx |   14 
 sw/inc/frmfmt.hxx   |   52 +++-
 sw/inc/textboxhelper.hxx|7 +-
 sw/qa/core/attr/attr.cxx|4 -
 sw/qa/core/doc/doc.cxx  |   13 +---
 sw/qa/core/draw/draw.cxx|2 
 sw/qa/core/layout/flycnt.cxx|4 -
 sw/qa/core/txtnode/txtnode.cxx  |4 -
 sw/qa/core/undo/undo.cxx|2 
 sw/qa/core/view/view.cxx|6 -
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |2 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |2 
 sw/qa/extras/uiwriter/uiwriter2.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 -
 sw/qa/extras/uiwriter/uiwriter8.cxx |   12 +--
 sw/qa/extras/ww8export/ww8export.cxx|4 -
 sw/qa/filter/html/html.cxx  |8 +-
 sw/qa/filter/ww8/ww8.cxx|4 -
 sw/qa/uibase/docvw/docvw.cxx|4 -
 sw/qa/uibase/uno/uno.cxx|4 -
 sw/source/core/crsr/crstrvl.cxx |5 -
 sw/source/core/doc/CntntIdxStore.cxx|4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 -
 sw/source/core/doc/DocumentLayoutManager.cxx|   11 +--
 sw/source/core/doc/dbgoutsw.cxx |   13 +---
 sw/source/core/doc/docbasic.cxx |   12 +--
 sw/source/core/doc/doccomp.cxx  |   10 +--
 sw/source/core/doc/docedt.cxx   |   30 -
 sw/source/core/doc/docfly.cxx   |   23 +--
 sw/source/core/doc/docfmt.cxx   |   11 +--
 sw/source/core/doc/doclay.cxx   |   11 +--
 sw/source/core/doc/docnew.cxx   |4 -
 sw/source/core/doc/docsort.cxx  |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|5 -
 sw/source/core/docnode/ndtbl.cxx|3 
 sw/source/core/docnode/node.cxx |   20 ++
 sw/source/core/draw/dcontact.cxx|9 +-
 sw/source/core/frmedt/fecopy.cxx|   12 +--
 sw/source/core/frmedt/fefly1.cxx|6 -
 sw/source/core/frmedt/tblsel.cxx|2 
 sw/source/core/inc/frmtool.hxx  |8 +-
 sw/source/core/layout/atrfrm.cxx|   29 ++--
 sw/source/core/layout/frmtool.cxx   |   18 ++---
 sw/source/core/layout/pagechg.cxx   |   29 
 sw/source/core/layout/tabfrm.cxx|6 -
 sw/source/core/layout/wsfrm.cxx |4 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/core/text/itratr.cxx  |6 -
 sw/source/core/undo/rolbck.cxx  |2 
 sw/source/core/undo/undel.cxx   |   24 ++-
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/undo/undobj1.cxx |8 +-
 sw/source/core/undo/undraw.cxx  |   28 
 sw/source/core/undo/untbl.cxx   |4 -
 sw/source/core/unocore/unocoll.cxx  |   10 ---
 sw/source/core/unocore/unoobj2.cxx  |9 --
 sw/source/core/view/viewsh.cxx  |9 --
 sw/source/filter/html/htmlforw.cxx  |   10 +--
 sw/source/filter/html/htmlgrin.cxx  |5 -
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/ww8/wrtw8esh.cxx   |2 
 65 files changed, 279 insertions(+), 318 deletions(-)

New commits:
commit 09cdcb5f37bb4e42da7b28db6e757b9f2affed14
Author: Bjoern Michaelsen 
AuthorDate: Sat Apr 15 20:51:52 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Mon Apr 24 21:59:04 2023 +0200

introduce sw::SpzFrameFormat ...

- ... as a base class of frame formats allowed into the
  spz frame format container
- with a private ctor and friends SwDrawFrameFormat and SwFlyFrameFormat
  so only these two classes derive from it
- with that, switch over the SpzFrameFormats to only ever allow these
  types into the 

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

2023-04-19 Thread Bjoern Michaelsen (via logerrit)
 sw/inc/doc.hxx  |   10 +
 sw/inc/docary.hxx   |1 
 sw/inc/frameformats.hxx |  200 
 sw/inc/frmfmt.hxx   |6 -
 sw/inc/swtblfmt.hxx |3 
 sw/qa/extras/layout/layout3.cxx |2 
 sw/qa/filter/html/html.cxx  |2 
 sw/source/core/doc/docchart.cxx |8 -
 sw/source/core/doc/docfmt.cxx   |   21 ++-
 sw/source/core/doc/docnew.cxx   |2 
 sw/source/core/doc/doctxm.cxx   |3 
 sw/source/core/docnode/ndcopy.cxx   |4 
 sw/source/core/docnode/ndtbl.cxx|8 -
 sw/source/core/edit/edglss.cxx  |2 
 sw/source/core/fields/cellfml.cxx   |4 
 sw/source/core/layout/atrfrm.cxx|   10 -
 sw/source/core/undo/unattr.cxx  |3 
 sw/source/core/unocore/unocoll.cxx  |2 
 sw/source/core/unocore/unostyle.cxx |2 
 sw/source/core/unocore/unotbl.cxx   |4 
 sw/source/uibase/utlui/content.cxx  |   17 +--
 21 files changed, 258 insertions(+), 56 deletions(-)

New commits:
commit b12ff94a771db17843f642a82820b2864bec4744
Author: Bjoern Michaelsen 
AuthorDate: Tue Apr 11 21:20:41 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Thu Apr 20 07:33:22 2023 +0200

introduce sw::FrameFormats<>

- a drop-in replacement for SwFrameFormats
- ... but strongly typed sw::FrameFormats returns
  SwTableFormats
- replace in SwDoc for GetTableFormats

- also: use tags to name indices, lose the references to them as members
- add an explicit Rename() member to allow both SwFrameFormats and
  sw::FrameFormat<> to be updated if a format is rename. This should be
  removed once all SwFrameFormats have been moved to sw::FrameFormats<>.

- Ultimately it seems like a few linear iterations of the table formats
  can be replaced with an index-based accesss by name (in a follow-up).

Change-Id: I1c49d64621104c964c95c6da0c84e01ee7f97028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150243
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index df07fbae0043..1296fbaa866d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -34,6 +34,7 @@
 #include 
 #include "tox.hxx"
 #include "frmfmt.hxx"
+#include "frameformats.hxx"
 #include "charfmt.hxx"
 #include "docary.hxx"
 #include "charformats.hxx"
@@ -163,6 +164,7 @@ namespace sw {
 class DocumentLayoutManager;
 class DocumentStylePoolManager;
 class DocumentExternalDataManager;
+template class FrameFormats;
 class GrammarContact;
 class OnlineAccessibilityCheck;
 }
@@ -248,7 +250,7 @@ class SW_DLLPUBLIC SwDoc final
 std::unique_ptr mpCharFormatTable;
 std::unique_ptrmpSpzFrameFormatTable;
 std::unique_ptr  mpSectionFormatTable;
-std::unique_ptrmpTableFrameFormatTable; //< For tables
+std::unique_ptrmpTableFrameFormatTable; //< For 
tables
 std::unique_ptr mpTextFormatCollTable;   //< 
FormatCollections
 std::unique_ptr  mpGrfFormatCollTable;
 
@@ -819,10 +821,10 @@ public:
 SwGrfFormatColl *pDerivedFrom);
 
 // Table formatting
-const SwFrameFormats* GetTableFrameFormats() const  { return 
mpTableFrameFormatTable.get(); }
-  SwFrameFormats* GetTableFrameFormats(){ return 
mpTableFrameFormatTable.get(); }
+const sw::TableFrameFormats* GetTableFrameFormats() const  { return 
mpTableFrameFormatTable.get(); }
+  sw::TableFrameFormats* GetTableFrameFormats(){ return 
mpTableFrameFormatTable.get(); }
 size_t GetTableFrameFormatCount( bool bUsed ) const;
-SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
+SwTableFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
 SwTableFormat* MakeTableFrameFormat(const OUString , 
SwFrameFormat *pDerivedFrom);
 voidDelTableFrameFormat( SwTableFormat* pFormat );
 SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = 
false ) const;
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 98c84cbbd270..64f251957a06 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -49,6 +49,7 @@ public:
 
 // default linear search implementation, some subclasses will override 
with a more efficient search
 virtual SwFormat* FindFormatByName(const OUString& rName) const;
+virtual void Rename(const SwFrameFormat&, const OUString&) {};
 
 SwFormatsBase() = default;
 SwFormatsBase(SwFormatsBase const &) = default;
diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx
index 4e06efe44b04..97c86408e867 100644
--- a/sw/inc/frameformats.hxx
+++ b/sw/inc/frameformats.hxx
@@ -19,12 +19,17 @@
 #pragma once
 
 #include "docary.hxx"
+#include "swtblfmt.hxx"
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+
+class SwFrameFormat;
+class SwTableFormat;
 
 // Like o3tl::find_partialorder_ptrequals

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

2023-03-12 Thread Mike Kaganski (via logerrit)
 sw/inc/ndindex.hxx|8 
 sw/qa/extras/uiwriter/uiwriter4.cxx   |2 +-
 sw/source/core/doc/DocumentRedlineManager.cxx |3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 2d9e35063c81e22ef681be0aa39eb3311f00784a
Author: Mike Kaganski 
AuthorDate: Sun Mar 12 11:43:16 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 12 12:55:08 2023 +

Assert that we only order nodes of the same array

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

diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index bbe76f1be706..04848f00479e 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -96,10 +96,10 @@ public:
 bool operator==( SwNodeOffset nOther ) const { return GetIndex() == 
nOther; }
 bool operator!=( SwNodeOffset nOther ) const { return GetIndex() != 
nOther; }
 
-bool operator<( const SwNode& rNd ) const { return 
operator<(rNd.GetIndex()); }
-bool operator<=( const SwNode& rNd ) const { return 
operator<=(rNd.GetIndex()); }
-bool operator>( const SwNode& rNd ) const { return 
operator>(rNd.GetIndex()); }
-bool operator>=( const SwNode& rNd ) const { return 
operator>=(rNd.GetIndex()); }
+bool operator<( const SwNode& rNd ) const { assert(() == 
()); return operator<(rNd.GetIndex()); }
+bool operator<=( const SwNode& rNd ) const { return operator==(rNd) || 
operator<(rNd); }
+bool operator>( const SwNode& rNd ) const { assert(() == 
()); return operator>(rNd.GetIndex()); }
+bool operator>=( const SwNode& rNd ) const { return operator==(rNd) || 
operator>(rNd); }
 bool operator==( const SwNode& rNd ) const { return m_pNode ==  }
 bool operator!=( const SwNode& rNd ) const { return m_pNode !=  }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 8771d5d15fe2..d8e24dfc6f9d 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -1480,7 +1480,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699)
 pMarkAccess = aClipboard.getIDocumentMarkAccess();
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 ::sw::mark::IFieldmark* pFieldMark
-= 
pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()), 
false);
+= 
pMarkAccess->getFieldmarkAfter(SwPosition(aClipboard.GetNodes().GetEndOfExtras()),
 false);
 CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"),
  pFieldMark->GetFieldname());
 }
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index e3ab6bed2c09..4e9176cc340a 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1210,6 +1210,9 @@ SwExtraRedlineTable& 
DocumentRedlineManager::GetExtraRedlineTable()
 
 bool DocumentRedlineManager::IsInRedlines(const SwNode & rNode) const
 {
+if (() != _rDoc.GetNodes())
+return false;
+
 SwPosition aPos(rNode);
 SwNode & rEndOfRedlines = m_rDoc.GetNodes().GetEndOfRedlines();
 SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),


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

2023-03-10 Thread Michael Stahl (via logerrit)
 sw/inc/EnhancedPDFExportHelper.hxx  |6 
 sw/qa/extras/globalfilter/globalfilter.cxx  |  423 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   38 +-
 sw/source/core/text/frmpaint.cxx|   26 +
 sw/source/core/text/itrpaint.cxx|   30 +
 sw/source/core/text/itrpaint.hxx|7 
 sw/source/core/text/porlay.cxx  |   15 
 sw/source/core/text/porlay.hxx  |1 
 8 files changed, 531 insertions(+), 15 deletions(-)

New commits:
commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd
Author: Michael Stahl 
AuthorDate: Wed Mar 8 14:25:26 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Mar 10 10:59:26 2023 +

sw: PDF/UA export: produce Lbl tagged element

Commit bd66a0201fb6d1a127139287cc8b5bd27e3a92c3 did this for editengine
text in shapes, but it turns out it's a little more complicated in sw.

The SwTaggedPDFHelper nicely lived stack allocated, but list labels are
SwLinePortions inside a paragraph, and they can't be painted separately,
so if there's a list label the creation of LBody has to be delayed until
that is processed.

The SwNumberPortion can't even generate the Lbl itself, because there
can be multiple portions, they are broken across lines and at script
boundaries, and checking their follow flags is also tricky (see previous
commit).

Change-Id: I0dd383089a7ca0edddf6f805e79615c611a446f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148556
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 2843e7a78a67..e928e417a0f0 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -110,8 +110,10 @@ struct Por_Info
 {
 const SwLinePortion& mrPor;
 const SwTextPainter& mrTextPainter;
-Por_Info( const SwLinePortion& rPor, const SwTextPainter& rTextPainer )
-: mrPor( rPor ), mrTextPainter( rTextPainer ) {};
+bool const m_isNumberingLabel;
+
+Por_Info(const SwLinePortion& rPor, const SwTextPainter& rTextPainer, bool 
const isNumberingLabel)
+: mrPor(rPor), mrTextPainter(rTextPainer), 
m_isNumberingLabel(isNumberingLabel) {};
 };
 
 struct lt_TableColumn
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 77a0b8aa2011..6351989aa541 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1230,6 +1231,428 @@ void Test::testBulletAsImage()
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport)
+{
+createSwDoc();
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference xText(xDoc->getText());
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference xNumRule(
+xFactory->createInstance("com.sun.star.text.NumberingRules"),
+uno::UNO_QUERY_THROW);
+OUString listFormat;
+for (sal_Int32 i = 0; i < xNumRule->getCount(); ++i)
+{
+uno::Sequence format;
+format.getArray();
+xNumRule->getByIndex(i) >>= format;
+{
+auto it(::std::find_if(format.begin(), format.end(),
+[](auto const& r) { return r.Name == "NumberingType"; }));
+// need something RTL
+const_cast(it->Value) <<= 
style::NumberingType::CHARS_ARABIC;
+}
+{
+#if 0
+// this doesn't work any more
+auto it(::std::find_if(format.begin(), format.end(),
+[](auto const& r) { return r.Name == "ParentNumbering"; 
}));
+const_cast(it->Value) <<= sal_Int16(i + 1);
+#endif
+listFormat += "%" + OUString::number(i+1) + "%.";
+auto it(::std::find_if(format.begin(), format.end(),
+[](auto const& r) { return r.Name == "ListFormat"; }));
+const_cast(it->Value) <<= listFormat;
+}
+xNumRule->replaceByIndex(i, uno::Any(format));
+}
+uno::Reference(getParagraph(1), 
uno::UNO_QUERY_THROW)->setPropertyValue("NumberingRules", uno::Any(xNumRule));
+xText->insertControlCharacter(xText->getEnd(), 
text::ControlCharacter::PARAGRAPH_BREAK, false);
+uno::Reference(getParagraph(2), 
uno::UNO_QUERY_THROW)->setPropertyValue("NumberingLevel", 
uno::Any(sal_Int16(1)));
+xText->insertControlCharacter(xText->getEnd(), 
text::ControlCharacter::PARAGRAPH_BREAK, false);
+uno::Reference(getParagraph(3), 
uno::UNO_QUERY_THROW)->setPropertyValue("NumberingLevel", 
uno::Any(sal_Int16(2)));
+
+// check PDF export of the list items (label in particular)
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+// Enable PDF/UA
+   

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

2023-03-08 Thread László Németh (via logerrit)
 sw/inc/redline.hxx|6 +++
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx|   42 --
 sw/source/core/doc/DocumentRedlineManager.cxx |   19 +++
 3 files changed, 52 insertions(+), 15 deletions(-)

New commits:
commit 8f26482986fd9af5eac4efd44ec56fd994ec69f1
Author: László Németh 
AuthorDate: Wed Mar 8 12:56:22 2023 +0100
Commit: László Németh 
CommitDate: Wed Mar 8 21:01:03 2023 +

tdf#136904 tdf#116084 tdf#121176 sw: fix Undo & anonymized w:del in w:ins

Undo/Redo crash resulted by the workaround for anonymized
w:del in w:ins. Anonymized (no time stamp) redlines
are loaded with Epoch time (1970-01-01) since
commit 2c51746997478ad5d0e7cc64aa6489769c473d43
"tdf#146171 DOCX: fix loss of change tracking, if no date",
so it's possible to fix the original DOCX import problem
using this value: don't combine anonymized deletion
inside/over anonymized insertion, and remove all the
workaround, keeping only their adjusted unit tests,
and add new tests for the export fixed finally, which
keeps anonymized w:del in anonymized w:ins.

Revert commit 2de1fd7d8b8bd42c66190140cc4506df0c3367f1
"tdf#125187 DOCX track changes: fix w:del within w:ins",
commit df4f405a153603551f67e289bbaccf9ac39b923c
"tdf#121176 DOCX track changes: same size w:del in w:ins" and
commit 7a810d6a9fb79a24d00e5dbd8e1223e6f8b09677
"tdf#116084 DOCX track changes: fix w:del within w:ins".

Regression from commit 2de1fd7d8b8bd42c66190140cc4506df0c3367f1
"tdf#125187 DOCX track changes: fix w:del within w:ins".

See also commit 64dcedcf7c073d1819794d68a33651b14877e1b5
"tdf#147760 tdf#142902 DOCX export: anonymize date and moveFromRangeStart".

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

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index f2d6c31a40ac..1fccb405e192 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -128,6 +128,12 @@ public:
 std::size_t GetAuthor() const{ return m_nAuthor; }
 const OUString& GetComment() const{ return m_sComment; }
 const DateTime& GetTimeStamp() const{ return m_aStamp; }
+bool IsAnonymized() const
+{
+return m_aStamp.GetYear() == 1970 &&
+m_aStamp.GetMonth() == 1 && m_aStamp.GetDay() == 1;
+}
+
 const SwRedlineData* Next() const{ return m_pNext; }
 
 void SetComment( const OUString& rS ) { m_sComment = rS; }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 2713a582c9d9..b3c2bceef5bb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1959,8 +1959,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116084, "tdf116084.docx")
 // tracked line is not a single text portion: w:del is recognized within 
w:ins
 CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(1), 
1)->getString());
 CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 1), "RedlineType"));
-CPPUNIT_ASSERT_EQUAL(OUString("There should be a better start to this. "),
- getRun(getParagraph(1), 2)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("There "), getRun(getParagraph(1), 
2)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(1), 
4)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 4), "RedlineType"));
+CPPUNIT_ASSERT_EQUAL(OUString("must"), getRun(getParagraph(1), 
5)->getString());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf116084_anonymized)
+{
+loadAndSave("tdf116084.docx");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+// w:del in w:ins is exported correctly
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p/w:ins/w:del/w:r/w:delText", "must");
+
+// no date (anonymized changes)
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins[@date]", 0);
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins/w:del[@w:date]", 0);
+
+// w:ins and w:del have w:author attributes, and the same
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins/w:del[@w:author]", 1);
+OUString sAuthor = getXPath(pXmlDoc, "/w:document/w:body/w:p/w:ins[2]", 
"author");
+OUString sAuthor2 = getXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:ins/w:del", "author");
+CPPUNIT_ASSERT_EQUAL(sAuthor, sAuthor2);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf121176, "tdf121176.docx")
@@ -1971,6 +1991,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121176, "tdf121176.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("must"), getRun(getParagraph(1), 
2)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf121176_anonymized)
+{
+loadAndSave("tdf121176.docx");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+// w:del in w:ins is 

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

2023-02-23 Thread Michael Stahl (via logerrit)
 sw/inc/fmtcol.hxx |3 
 sw/inc/ndtxt.hxx  |   10 -
 sw/inc/paratr.hxx |9 +
 sw/qa/extras/odfexport/data/WordTest_edit.odt |binary
 sw/qa/extras/odfexport/odfexport2.cxx |  163 ++
 sw/source/core/doc/docfmt.cxx |   13 +-
 sw/source/core/doc/fmtcol.cxx |   20 ++-
 sw/source/core/layout/frmtool.cxx |1 
 sw/source/core/text/itrcrsr.cxx   |   10 -
 sw/source/core/txtnode/ndtxt.cxx  |   94 ++
 sw/source/core/txtnode/thints.cxx |   17 +-
 sw/source/filter/ww8/wrtw8nds.cxx |   14 +-
 sw/source/filter/ww8/ww8par6.cxx  |3 
 sw/source/uibase/app/docstyle.cxx |   17 +-
 14 files changed, 312 insertions(+), 62 deletions(-)

New commits:
commit 0168e1eb65103afde24d4a2a62175946b1c0d33e
Author: Michael Stahl 
AuthorDate: Thu Feb 16 19:39:33 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Feb 24 07:32:30 2023 +

tdf#78510 sw: combine items from SwTextNode and SwNumFormat

Tweak SwTextFormatColl::AreListLevelIndentsApplicable() and
SwTextNode::AreListLevelIndentsApplicable() to return a bitmask
so that SvxFirstLineIndentItem and SvxTextLeftMarginItem from paragraph
or numbering can be freely combined.

Particularly confusing was SwTextNode::GetLeftMarginWithNum()
and its baffling usage in SwTextMargin::CtorInitTextMargin(); it
appears easiest (if unintuitive) to interpret its return value as a
delta to be added to the paragraph's items.

This fixes the ODF interop problem.

It looks like no compat setting is needed because every OOo/LO generated
document should have either both fo:text-indent and fo:margin-left on a
paragraph style/list level, or neither.

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

diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 6a477e1f5ca3..c914a6058ccf 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -143,7 +143,8 @@ public:
 return mbStayAssignedToListLevelOfOutlineStyle;
 }
 
-bool AreListLevelIndentsApplicable() const;
+::sw::ListLevelIndents AreListLevelIndentsApplicable() const;
+bool AreListLevelIndentsApplicableImpl(sal_uInt16 nWhich) const;
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 virtual void FormatDropNotify(const SwFormatDrop& rDrop) override
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 0ea123233d69..4b15545b41bc 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -516,9 +516,10 @@ public:
 /**
Returns the additional indents of this text node and its numbering.
 
-   @param bTextLeft  ???
+   @param bTextLeft return text-left-margin instead of left-margin
+(include negative first-line-indent, see lrspitem.hxx)
 
-   @return additional indents
+   @return additional num indents - a delta to be added to node's items
  */
  tools::Long GetLeftMarginWithNum( bool bTextLeft = false ) const;
 
@@ -693,9 +694,10 @@ public:
   style hierarchy from the paragraph to the paragraph style with the
   list style no indent attributes are found.
 
-@return boolean
+@return bitmask
 */
-bool AreListLevelIndentsApplicable() const;
+::sw::ListLevelIndents AreListLevelIndentsApplicable() const;
+bool AreListLevelIndentsApplicableImpl(sal_uInt16 nWhich) const;
 
 /** Retrieves the list tab stop position, if the paragraph's list level 
defines
 one and this list tab stop has to merged into the tap stops of the 
paragraph
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx
index c6848491f8e9..9b5f2b156430 100644
--- a/sw/inc/paratr.hxx
+++ b/sw/inc/paratr.hxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class SwTextNode;
 class IntlWrapper;
@@ -47,6 +48,9 @@ class IntlWrapper;
 class SwFormatDrop;
 
 namespace sw {
+
+enum class ListLevelIndents { No, FirstLine, LeftMargin };
+
 class SW_DLLPUBLIC FormatDropDefiner {
 protected:
 virtual ~FormatDropDefiner() {};
@@ -55,6 +59,11 @@ namespace sw {
 };
 }
 
+namespace o3tl
+{
+template<> struct typed_flags : 
is_typed_flags {};
+}
+
 /** If SwFormatDrop is a Client, it is the CharFormat that describes the font 
for the
DropCaps. If it is not a Client, formatting uses the CharFormat of the 
paragraph.
If the CharFormat is modified, this change is propagated to the paragraphs
diff --git a/sw/qa/extras/odfexport/data/WordTest_edit.odt 
b/sw/qa/extras/odfexport/data/WordTest_edit.odt
new file mode 100644
index ..4c14295e930d
Binary files /dev/null and b/sw/qa/extras/odfexport/data/WordTest_edit.odt 
differ
diff --git 

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

2023-02-14 Thread Vojtěch Doležal (via logerrit)
 sw/inc/authfld.hxx |   19 +-
 sw/qa/core/fields/fields.cxx   |4 -
 sw/source/core/fields/authfld.cxx  |  111 ++---
 sw/source/core/inc/txmsrt.hxx  |2 
 sw/source/core/tox/txmsrt.cxx  |2 
 sw/source/uibase/docvw/edtwin2.cxx |   11 +--
 6 files changed, 115 insertions(+), 34 deletions(-)

New commits:
commit a3a151ccfbb7560f7e96523efa350b174888f359
Author: Vojtěch Doležal 
AuthorDate: Mon Feb 13 00:51:59 2023 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 15 07:19:08 2023 +

Refactored SwAuthorityField::GetAuthority

The current version takes pointer to too complex of a structure, does some 
insane (and completely pointless) const_casting with it, and isn't very 
practically usable due to only supporting calculation for format of a default 
TOX. This refactor solves all these issues.

Change-Id: I582be2ecdbd83650c0c30ee9df786feffdc6cb99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147000
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 764aa42190b6..f708457748d9 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -19,6 +19,8 @@
 #ifndef INCLUDED_SW_INC_AUTHFLD_HXX
 #define INCLUDED_SW_INC_AUTHFLD_HXX
 
+#include 
+
 #include "swdllapi.h"
 #include "fldbas.hxx"
 #include "toxe.hxx"
@@ -31,6 +33,7 @@
 
 class SwTOXInternational;
 class SwTextAttr;
+class SwForm;
 
 class SwAuthEntry final : public salhelper::SimpleReferenceObject
 {
@@ -186,11 +189,23 @@ public:
 
 virtual OUString GetDescription() const override;
 
-/// Returns the line matching the source's default row in the ToX.
-OUString GetAuthority(const SwTextAttr* pTextAttr, const SwRootFrame* 
pLayout) const;
+/**
+ * Returns the line matching the source's default row in the ToX.
+ *
+ * \param   pLayout layout to be used
+ * \param   pTOXbibliography table to take the format of the 
string from
+ * \return  entry formated as the appropriate authority type 
in the table
+ */
+OUString GetAuthority(const SwRootFrame *pLayout,
+  const SwForm *pTOX = nullptr) const;
 
 bool HasURL() const;
 OUString GetAbsoluteURL() const;
+/**
+ * Returns full URI for the URL, relative if specified
+ * \param   bRelative   whether the path should be relative (when dealing 
with local files)
+ */
+OUString GetURI(bool bRelative) const;
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 6f1fd79ee582..7282d2027088 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -61,10 +61,8 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
 auto pField = dynamic_cast(
 SwCursorShell::GetFieldAtCursor(pCursor, 
/*bIncludeInputFieldAtStart=*/true));
 CPPUNIT_ASSERT(pField);
-SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode();
-const SwTextAttr* pTextAttr = pTextNode->GetSwpHints().Get(0);
 const SwRootFrame* pLayout = pWrtShell->GetLayout();
-OUString aTooltip = pField->GetAuthority(pTextAttr, pLayout);
+OUString aTooltip = pField->GetAuthority(pLayout);
 
 // Without the accompanying fix in place, generating this tooltip text was 
not possible without
 // first inserting an empty bibliography table into the document.
diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 8a6212e22738..44d1e39dd3ae 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -17,14 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
 #include 
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +51,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -559,31 +564,31 @@ OUString SwAuthorityField::GetDescription() const
 return SwResId(STR_AUTHORITY_ENTRY);
 }
 
-OUString SwAuthorityField::GetAuthority(const SwTextAttr* pTextAttr,
-const SwRootFrame* pLayout) const
+OUString SwAuthorityField::GetAuthority(const SwRootFrame* pLayout, const 
SwForm* pTOX) const
 {
 OUString aText;
 
-SwForm aForm(TOX_AUTHORITIES);
-if (!pTextAttr)
+std::unique_ptr pDefaultTOX;
+if (!pTOX)
 {
-return aText;
+pDefaultTOX = std::make_unique(TOX_AUTHORITIES);
+pTOX = pDefaultTOX.get();
 }
 
-auto& rFormatField = 
const_cast(pTextAttr->GetFormatField());
-SwTextField* pTextField = rFormatField.GetTextField();
-if (!pTextField)
-{
-return aText;
-}
-
-const SwTextNode& rNode = pTextField->GetTextNode();
-const auto pFieldType = 

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

2023-02-11 Thread Justin Luth (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx  |2 +-
 sw/qa/extras/globalfilter/globalfilter.cxx  |2 +-
 sw/source/core/crsr/crbm.cxx|2 +-
 sw/source/core/crsr/crstrvl.cxx |2 +-
 sw/source/core/crsr/pam.cxx |4 ++--
 sw/source/core/crsr/swcrsr.cxx  |2 +-
 sw/source/core/doc/DocumentContentOperationsManager.cxx |2 +-
 sw/source/core/doc/docbm.cxx|   11 +++
 sw/source/core/inc/MarkManager.hxx  |2 +-
 sw/source/core/text/inftxt.cxx  |2 +-
 sw/source/core/text/itrform2.cxx|2 +-
 sw/source/core/text/redlnitr.cxx|2 +-
 sw/source/core/txtnode/modeltoviewhelper.cxx|4 ++--
 sw/source/core/unocore/unotext.cxx  |4 ++--
 sw/source/filter/ww8/wrtw8nds.cxx   |4 ++--
 sw/source/uibase/shells/textfld.cxx |6 +++---
 sw/source/uibase/shells/textsh1.cxx |8 
 sw/source/uibase/uno/loktxdoc.cxx   |2 +-
 sw/source/uibase/uno/unotxdoc.cxx   |4 ++--
 19 files changed, 35 insertions(+), 32 deletions(-)

New commits:
commit f7afed99a807a9ce42edf84cab36a4710ddcd58e
Author: Justin Luth 
AuthorDate: Thu Jan 12 11:35:02 2023 -0500
Commit: Justin Luth 
CommitDate: Sat Feb 11 12:10:55 2023 +

sw: rename getFieldmarkFor() to getInnerFieldmarkFor()

The same change was made for getBookmarkFor()
in https://gerrit.libreoffice.org/c/core/+/145412

Because otherwise it's quite confusing
that we have a For() and an At()
which could only be differentiated by a code read.

Also improve getInnerFieldmarkFor() a tiny bit,
so we process the first hit only once.

Suggested at

.

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index e86a4efc8f1a..d53f180d3fe9 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -329,7 +329,7 @@ class IDocumentMarkAccess
 
 /// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
 virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) 
const =0;
-virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) 
const =0;
+virtual sw::mark::IFieldmark* getInnerFieldmarkFor(const SwPosition& 
pos) const = 0;
 virtual sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& 
pos, bool bLoop) const =0;
 virtual sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos, 
bool bLoop) const =0;
 
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 7beb928dd344..2b8c37114ce1 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -889,7 +889,7 @@ static auto verifyNestedFieldmark(OUString const& rTestName,
 + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), outerString);
 
 // must return innermost mark
-CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getFieldmarkFor(innerPos));
+CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getInnerFieldmarkFor(innerPos));
 }
 
 void Test::testNestedFieldmark()
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 53d2538538d8..e296bd50e8fe 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -287,7 +287,7 @@ bool SwCursorShell::IsFormProtected()
 {
 // TODO: Refactor
 SwPosition pos(*GetCursor()->Start());
-return getIDocumentMarkAccess()->getFieldmarkFor(pos);
+return getIDocumentMarkAccess()->getInnerFieldmarkFor(pos);
 }
 
 sw::mark::IFieldmark* SwCursorShell::GetFieldmarkAfter(bool bLoop)
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 954e9ba6707c..966127cece62 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1612,7 +1612,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 if( !bRet && IsAttrAtPos::FormControl & 
rContentAtPos.eContentAtPos )
 {
 IDocumentMarkAccess* pMarksAccess = 
GetDoc()->getIDocumentMarkAccess( );
-sw::mark::IFieldmark* pFieldBookmark = 
pMarksAccess->getFieldmarkFor( aPos );
+sw::mark::IFieldmark* pFieldBookmark = 
pMarksAccess->getInnerFieldmarkFor(aPos);
 if (bCursorFoundExact && pFieldBookmark)
 {
 rContentAtPos.eContentAtPos = 

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

2023-01-30 Thread Justin Luth (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx  |3 
 sw/inc/crsrsh.hxx   |2 
 sw/inc/textcontentcontrol.hxx   |1 
 sw/qa/extras/uiwriter/data/tdf151548_tabNavigation.docm |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx |   40 +
 sw/source/core/crsr/crstrvl.cxx |  126 
 sw/source/core/doc/docbm.cxx|2 
 sw/source/core/inc/MarkManager.hxx  |1 
 sw/source/core/txtnode/attrcontentcontrol.cxx   |6 
 sw/source/uibase/docvw/edtwin.cxx   |   39 +++-
 10 files changed, 210 insertions(+), 10 deletions(-)

New commits:
commit 745650e2227bdf27fc322b357780a1aa3dc5fa73
Author: Justin Luth 
AuthorDate: Thu Jan 26 14:50:19 2023 -0500
Commit: Miklos Vajna 
CommitDate: Mon Jan 30 08:35:54 2023 +

tdf#151548 sw content controls: keyboard navigation with tab key

Combine content controls with legacy formfield controls
in keyboard tab navigation.

MS Word (I tested 2010) is extremely irrational and inconsistent
in its behaviour, so I modeled my implementation on the specification
and general logic, and not at all on "compatible misbehaviour".

There is a third category of form control (activeX rich content),
but these are mapped to internal LO controls that are only exposed
at VCL level, and don't pass the keystrokes back to SW.
Plus, they are not inline, but fly controls.

However, it is still a TODO to handle these if reasonably possible.

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index b1317993dfb7..ee5efbf95692 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -325,6 +325,9 @@ class IDocumentMarkAccess
 */
 virtual const_iterator_t getFieldmarksEnd() const =0;
 
+/// returns the number of IFieldmarks.
+virtual sal_Int32 getFieldmarksCount() const = 0;
+
 /// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
 virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) 
const =0;
 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) 
const =0;
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 689a354fffc7..efc8aa1eec49 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -718,6 +718,8 @@ public:
 
 bool GotoFormatContentControl(const SwFormatContentControl& 
rContentControl);
 
+void GotoFormControl(bool bNext);
+
 static SwTextField* GetTextFieldAtPos(
 const SwPosition* pPos,
 ::sw::GetTextAttrMode eMode);
diff --git a/sw/inc/textcontentcontrol.hxx b/sw/inc/textcontentcontrol.hxx
index 3fb7ea124b99..b3926bd25ce9 100644
--- a/sw/inc/textcontentcontrol.hxx
+++ b/sw/inc/textcontentcontrol.hxx
@@ -64,6 +64,7 @@ public:
 size_t GetCount() const { return m_aContentControls.size(); }
 bool IsEmpty() const { return m_aContentControls.empty(); }
 SwTextContentControl* Get(size_t nIndex);
+SwTextContentControl* UnsortedGet(size_t nIndex);
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
diff --git a/sw/qa/extras/uiwriter/data/tdf151548_tabNavigation.docm 
b/sw/qa/extras/uiwriter/data/tdf151548_tabNavigation.docm
new file mode 100644
index ..1b173e2041c2
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf151548_tabNavigation.docm differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index b7f05b3960e6..c8e99868a790 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -1491,6 +1491,46 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699)
  pFieldMark->GetFieldname());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf151548_tabNavigation)
+{
+// given a form-protected doc with 4 unchecked legacy fieldmark checkboxes 
(and several modern
+// content controls which all have a tabstop of -1 to disable tabstop 
navigation to them)
+// we want to test that tab navigation completes and loops around to 
continue at the beginning.
+createSwDoc("tdf151548_tabNavigation.docm");
+SwDoc* pDoc = getSwDoc();
+SwXTextDocument* pXTextDocument = 
dynamic_cast(mxComponent.get());
+
+IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pMarkAccess->getFieldmarksCount());
+
+// Tab and toggle 4 times, verifying beforehand that the state was 
unchecked
+for (auto it = pMarkAccess->getFieldmarksBegin(); it != 
pMarkAccess->getFieldmarksEnd(); ++it)
+{
+sw::mark::ICheckboxFieldmark* pCheckBox
+  

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

2023-01-24 Thread Justin Luth (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx  |4 ++--
 sw/inc/crsrsh.hxx   |4 ++--
 sw/qa/extras/uiwriter/uiwriter4.cxx |2 +-
 sw/source/core/crsr/crbm.cxx|8 
 sw/source/core/doc/docbm.cxx|   27 ---
 sw/source/core/inc/MarkManager.hxx  |4 ++--
 sw/source/ui/vba/vbaformfield.cxx   |   10 ++
 sw/source/uibase/docvw/edtwin.cxx   |6 --
 sw/source/uibase/wrtsh/wrtsh1.cxx   |4 ++--
 9 files changed, 43 insertions(+), 26 deletions(-)

New commits:
commit e125e6623fa1c0f39d927bb37547ca6d1e299cb1
Author: Justin Luth 
AuthorDate: Mon Jan 23 11:18:44 2023 -0500
Commit: Justin Luth 
CommitDate: Tue Jan 24 22:22:11 2023 +

related tdf#151548 formfield navigation: loop to beginning/end

When reaching the end of the form using keyboard navigation,
the next tabstop should return the user to the beginning of
the form.

This patch adds that to the existing legacy formfield navigation.
I'll wait with a unit test until I have added
activeX/contentControls into the mix.

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 391be58a077a..b1317993dfb7 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -328,8 +328,8 @@ class IDocumentMarkAccess
 /// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
 virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) 
const =0;
 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) 
const =0;
-virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& 
pos) const =0;
-virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& 
pos) const =0;
+virtual sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& 
pos, bool bLoop) const =0;
+virtual sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos, 
bool bLoop) const =0;
 
 virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) 
const=0;
 virtual std::vector<::sw::mark::IFieldmark*> 
getNoTextFieldmarksIn(const SwPaM ) const=0;
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2e9a9f0f1e62..31cad2cd6e71 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -579,8 +579,8 @@ public:
 
 bool IsFormProtected();
 ::sw::mark::IFieldmark* GetCurrentFieldmark();
-::sw::mark::IFieldmark* GetFieldmarkAfter();
-::sw::mark::IFieldmark* GetFieldmarkBefore();
+sw::mark::IFieldmark* GetFieldmarkAfter(bool bLoop);
+sw::mark::IFieldmark* GetFieldmarkBefore(bool bLoop);
 bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark );
 
 // update Cursr, i.e. reset it into content should only be called when the
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 77b42667ee87..b7f05b3960e6 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -1486,7 +1486,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699)
 pMarkAccess = aClipboard.getIDocumentMarkAccess();
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
 ::sw::mark::IFieldmark* pFieldMark
-= 
pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()));
+= 
pMarkAccess->getFieldmarkAfter(SwPosition(pDoc->GetNodes().GetEndOfExtras()), 
false);
 CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"),
  pFieldMark->GetFieldname());
 }
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 4e0b808c7fba..53d2538538d8 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -290,16 +290,16 @@ bool SwCursorShell::IsFormProtected()
 return getIDocumentMarkAccess()->getFieldmarkFor(pos);
 }
 
-::sw::mark::IFieldmark* SwCursorShell::GetFieldmarkAfter()
+sw::mark::IFieldmark* SwCursorShell::GetFieldmarkAfter(bool bLoop)
 {
 SwPosition pos(*GetCursor()->GetPoint());
-return getIDocumentMarkAccess()->getFieldmarkAfter(pos);
+return getIDocumentMarkAccess()->getFieldmarkAfter(pos, bLoop);
 }
 
-::sw::mark::IFieldmark* SwCursorShell::GetFieldmarkBefore()
+sw::mark::IFieldmark* SwCursorShell::GetFieldmarkBefore(bool bLoop)
 {
 SwPosition pos(*GetCursor()->GetPoint());
-return getIDocumentMarkAccess()->getFieldmarkBefore(pos);
+return getIDocumentMarkAccess()->getFieldmarkBefore(pos, bLoop);
 }
 
 bool SwCursorShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 56a34fb72a3a..cd6afc472350 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -312,7 +312,8 @@ 

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

2023-01-13 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |1 
 sw/qa/extras/layout/data/Hyphenated-link.fodt |  258 ++
 sw/qa/extras/layout/data/Hyphenated-link.rtf  |   41 
 sw/qa/extras/layout/layout2.cxx   |   26 ++
 sw/source/core/doc/DocumentSettingManager.cxx |9 
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/guess.cxx |   30 +++
 sw/source/filter/ww8/ww8par.cxx   |1 
 sw/source/filter/xml/xmlimp.cxx   |   10 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +
 writerfilter/source/filter/WriterFilter.cxx   |1 
 11 files changed, 396 insertions(+)

New commits:
commit de2b1a3a22a0a3bf5dfdd44c57c09e1fd0ba39d2
Author: Michael Stahl 
AuthorDate: Thu Jan 12 14:24:11 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Jan 13 15:51:02 2023 +

tdf#152952 sw: don't hyphenate URLs by default

New compatibility flag HyphenateURLs, disabled by default for Word
interop and enabled for old ODT documents.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 1f81ead70645..e891a2b8c058 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -92,6 +92,7 @@ enum class DocumentSettingId
 EMPTY_DB_FIELD_HIDES_PARA,
 // tdf#129448: Auto first-line indent should not be effected by line space
 AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
+HYPHENATE_URLS, ///< tdf#152952
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/extras/layout/data/Hyphenated-link.fodt 
b/sw/qa/extras/layout/data/Hyphenated-link.fodt
new file mode 100644
index ..0371cf4406f1
--- /dev/null
+++ b/sw/qa/extras/layout/data/Hyphenated-link.fodt
@@ -0,0 +1,258 @@
+
+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" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ Gabor Kelemen 
LO2023-01-09T23:24:002023-01-09T23:25:003PT3SLibreOfficeDev/7.4.5.0.0$Linux_X86_64
 
LibreOffice_project/f2d3658697f22090ee138cebda4d10c3ede21230Gábor Kelemen2010
+ 
+  
+   0
+   0
+   0
+   0
+   true
+   false
+  
+  
+   false
+   false
+   false
+   true
+   true
+   true
+   true
+   true
+   false
+   0
+   false
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   true
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   0
+   1
+   true
+   true
+   
+   high-resolution
+   true
+   
+   
+   false
+   false
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   
+   true
+   1180787
+   
+   true
+ 

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

2023-01-11 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx |2 +
 sw/qa/uibase/uno/uno.cxx   |   33 +++
 sw/source/core/doc/docbm.cxx   |   23 +++
 sw/source/core/inc/MarkManager.hxx |1 
 sw/source/uibase/uno/loktxdoc.cxx  |   44 +++--
 5 files changed, 101 insertions(+), 2 deletions(-)

New commits:
commit 4bcb66ec7b417fbe113267f2615e78fe47eb55ca
Author: Miklos Vajna 
AuthorDate: Wed Jan 11 10:38:05 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 11 13:13:48 2023 +

sw lok: expose name of bookmark under cursor

It was possible to get the names of all bookmarks, but you could not get
the name of the (innermost) bookmark under the current cursor.

Getting the name of the current bookmark is useful for Zotero: if we
already have a citation and want to insert one more, then we should turn
the current citation into a citation cluster.

Fix the problem by adding an API similar to what commit
bb20dee2ef1b0804065e1cda2c834d257fdd90ed (sw lok: expose field type &
command of fieldmark under cursor, 2023-01-05) did, but here we deal
with bookmarks, not fieldmarks.

Handle the actual bookmark lookup in MarkManager, such functionality
looks useful outside LOK as well.

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 93690fb2b305..20f876d16495 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -313,6 +313,8 @@ class IDocumentMarkAccess
 */
 virtual const_iterator_t findFirstBookmarkStartsAfter(const 
SwPosition& rPos) const =0;
 
+/// Get the innermost bookmark that contains rPos.
+virtual sw::mark::IMark* getBookmarkFor(const SwPosition& rPos) const 
= 0;
 
 // Fieldmarks
 /** returns a STL-like random access iterator to the begin of the 
sequence of fieldmarks.
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 4b21bca0bb0c..d2be66457b81 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -442,6 +442,39 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetSections)
 CPPUNIT_ASSERT_EQUAL(static_cast(1), 
aTree.get_child("sections").count(""));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmark)
+{
+// Given a document with a bookmark:
+createSwDoc();
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("Bookmark", 
uno::Any(OUString("ZOTERO_BREF_1"))),
+comphelper::makePropertyValue("BookmarkText", 
uno::Any(OUString("aaabbb"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs);
+
+// When stepping into the bookmark with the cursor and getting the command 
value for
+// .uno:Bookmark:
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->SttEndDoc(/*bStt=*/false);
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+tools::JsonWriter aJsonWriter;
+std::string_view aCommand(".uno:Bookmark?namePrefix=ZOTERO_BREF_");
+auto pXTextDocument = dynamic_cast(mxComponent.get());
+pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+// Then make sure we find the inserted bookmark:
+std::unique_ptr 
pJSON(aJsonWriter.extractData());
+std::stringstream aStream(pJSON.get());
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+boost::property_tree::ptree aBookmark = aTree.get_child("bookmark");
+// Without the accompanying fix in place, this test would have failed with:
+// - No such node (bookmark)
+// i.e. the returned JSON was an empty object.
+CPPUNIT_ASSERT_EQUAL(std::string("ZOTERO_BREF_1"), 
aBookmark.get("name"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 8e4d2ef72e95..7152c2a2314a 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1437,6 +1437,29 @@ namespace sw::mark
 return dynamic_cast(pFieldmark);
 }
 
+IMark* MarkManager::getBookmarkFor(const SwPosition& rPos) const
+{
+auto it = std::find_if(m_vBookmarks.begin(), m_vBookmarks.end(),
+   [](const sw::mark::MarkBase* pMark)
+   { return pMark->IsCoveringPosition(rPos); });
+if (it == m_vBookmarks.end())
+{
+return nullptr;
+}
+sw::mark::IMark* pBookmark = *it;
+for (; it != m_vBookmarks.end() && (*it)->GetMarkStart() <= rPos; ++it)
+{
+// Find the innermost bookmark.
+if (rPos < (*it)->GetMarkEnd()
+

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

2023-01-10 Thread Michael Stahl (via logerrit)
 sw/inc/doc.hxx  |3 
 sw/qa/extras/layout/data/hidden-para-separator.docx |binary
 sw/qa/extras/layout/layout2.cxx |   37 +
 sw/source/core/doc/doctxm.cxx   |5 -
 sw/source/core/docnode/ndsect.cxx   |2 
 sw/source/core/inc/UndoSection.hxx  |5 -
 sw/source/core/inc/rootfrm.hxx  |9 +-
 sw/source/core/layout/newfrm.cxx|3 
 sw/source/core/layout/wsfrm.cxx |   22 -
 sw/source/core/text/redlnitr.cxx|   75 ++--
 sw/source/core/undo/unsect.cxx  |   14 ++-
 sw/source/core/view/viewsh.cxx  |8 +-
 12 files changed, 155 insertions(+), 28 deletions(-)

New commits:
commit 2bcfb7231b5ca74f02274cfb74ca8463f78905d6
Author: Michael Stahl 
AuthorDate: Fri Jan 6 19:07:35 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Jan 10 15:44:27 2023 +

tdf#152872 sw: conditionally hide paragraph breaks

Add a 3rd kind of hiding to SwRootFrame and CheckParaRedlineMerge().

This is quite simple as only consecutive paragraphs are merged.

There is an existing similar feature described in
http://www.openoffice.org/specs/writer/hidden_text/hidden_text.sxw
which results in 0-height text frames if all text is hidden
- but that is unconditional, while Word shows the paragraph when
control chars are shown, and hides it otherwise *iff* its paragraph
marker is hidden (and there's no page break on it).

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8412f1aebf63..dd2973fb7447 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -142,6 +142,7 @@ namespace sw::mark { class MarkManager; }
 namespace sw {
 enum class RedlineMode;
 enum class FieldmarkMode;
+enum class ParagraphBreakMode;
 class MetaFieldManager;
 class UndoManager;
 class IShellCursorSupplier;
@@ -1339,7 +1340,7 @@ public:
 
 // insert section (the ODF kind of section, not the nodesarray kind)
 SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
-std::tuple 
const* pTOXBase,
+std::tuple const* pTOXBase,
 SfxItemSet const*const pAttr, bool const bUpdate = true);
 static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
 const SwNode** ppSttNd = nullptr );
diff --git a/sw/qa/extras/layout/data/hidden-para-separator.docx 
b/sw/qa/extras/layout/data/hidden-para-separator.docx
new file mode 100644
index ..1d5d26075f22
Binary files /dev/null and 
b/sw/qa/extras/layout/data/hidden-para-separator.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b8ba46bebc20..c5b4bbecf24a 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -636,6 +636,43 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf149711_importDOCXMoveToParagraphMar
 assertXPath(pXmlDoc, "/root/page[1]/body/txt", 5);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
+{
+createSwDoc("hidden-para-separator.docx");
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2);
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 
"portion", "C DE");
+assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion", 0); // 5 is 
empty
+assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds", "height", 
"379");
+
+dispatchCommand(mxComponent, ".uno:ControlCodes", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 5);
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 
"portion", "C ");
+assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout", 
"portion", "D");
+// 3 is an empty paragraph with RES_CHRATR_HIDDEN which results in 0-height
+// frame; ideally it should only be hidden when control codes are hidden
+// and be a full-height frame now, but that needs more work...
+assertXPath(pXmlDoc, "/root/page/body/txt[3]/infos/bounds", "height", "0");
+assertXPath(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout", 
"portion", "E");
+assertXPath(pXmlDoc, "/root/page/body/txt[5]/SwParaPortion", 0); // 5 is 
empty
+assertXPath(pXmlDoc, "/root/page/body/txt[5]/infos/bounds", "height", 
"379");
+
+dispatchCommand(mxComponent, ".uno:ControlCodes", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2);
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 
"portion", "C 

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

2023-01-01 Thread Radhey Parekh (via logerrit)
 sw/inc/shellio.hxx   |4 ---
 sw/qa/extras/txtimport/txtimport.cxx |   42 +++
 sw/source/filter/ascii/parasc.cxx|   11 -
 3 files changed, 42 insertions(+), 15 deletions(-)

New commits:
commit 745898eb2af2686ffbdfdc0e44984db67b172a59
Author: Radhey Parekh 
AuthorDate: Mon Jan 2 06:25:33 2023 +0100
Commit: Hossein 
CommitDate: Mon Jan 2 07:36:05 2023 +

tdf#70423 Remove txtimport break in 10k chars line

This patch fixes the tdf#70423 which is an unexpected line break for
~10k characters. The fix consists of removing part of the code that
creates a new paragraph when reaching ~10k characters. The limit was
not exactly 10k characters, because the code tried to break at space
character when reaching around 10k-100 characters.

A test is also created, which can be checked by invoking:

make CPPUNIT_TEST_NAME="testTdf70423" -sr CppunitTest_sw_txtimport

The test checks that there should be exactly 1 paragraph with 30k
characters inside it.

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

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 0fe3985597ef..e666442d19a9 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -51,10 +51,6 @@ struct Writer_Impl;
 namespace sw::mark { class IMark; }
 namespace com::sun::star::embed { class XStorage; }
 
-// Defines the count of chars at which a paragraph read via ASCII/W4W-Reader
-// is forced to wrap. It has to be always greater than 200!!!
-#define MAX_ASCII_PARA 1
-
 class SW_DLLPUBLIC SwAsciiOptions
 {
 OUString m_sFont;
diff --git a/sw/qa/extras/txtimport/txtimport.cxx 
b/sw/qa/extras/txtimport/txtimport.cxx
index 8be577b4b328..10a4e54d429c 100644
--- a/sw/qa/extras/txtimport/txtimport.cxx
+++ b/sw/qa/extras/txtimport/txtimport.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class TxtImportTest : public SwModelTestBase
 {
@@ -190,6 +191,47 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf115088)
 CPPUNIT_ASSERT_EQUAL(OUString("1\n"), aActual.replaceAll("\r", "\n"));
 }
 
+CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf70423)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+constexpr sal_Int32 size = 3; // It should be multiple of 10
+constexpr sal_Int32 parts = size / 10;
+
+rtl::OUStringBuffer s(size);
+
+for (size_t i = 0; i < parts; i++)
+{
+s.append("0123456789");
+}
+
+OUString aResStr = s.makeStringAndClear();
+pWrtShell->Insert(aResStr);
+
+save("Text", "maTempFile"); //Saving the resulting file
+reload(mpFilter, "Text"); //Reloading the file again
+
+// Without the fix, this test would have failed with:
+// - Expected: 1
+// - Actual: 3
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+uno::Reference xPara(getParagraph(1));
+OUString aPara = xPara->getString();
+
+// Without the fix, this test would have failed with:
+// - Expected: 3
+// - Actual: 1
+CPPUNIT_ASSERT_EQUAL(size, aPara.getLength());
+
+//Matching the paragraph text and created string
+CPPUNIT_ASSERT_EQUAL(aResStr, aPara);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ascii/parasc.cxx 
b/sw/source/filter/ascii/parasc.cxx
index b29251bcbd8b..eab7a59e898b 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -474,17 +474,6 @@ ErrCode SwASCIIParser::ReadChars()
 
 if( bIns )
 {
-if( ( nLineLen >= MAX_ASCII_PARA - 100 ) &&
-( ( *pStt == ' ' ) || ( nLineLen >= MAX_ASCII_PARA - 1 ) ) )
-{
-sal_Unicode c = *pStt;
-*pStt = 0;
-InsertText( OUString( pLastStt ));
-
m_rDoc.getIDocumentContentOperations().SplitNode(*m_oPam->GetPoint(), false);
-pLastStt = pStt;
-nLineLen = 0;
-*pStt = c;
-}
 ++pStt;
 ++nLineLen;
 }


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

2022-12-20 Thread offtkp (via logerrit)
 sw/inc/strings.hrc   |1 
 sw/qa/extras/ooxmlexport/data/tdf125338.docm |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|   10 ++-
 sw/source/filter/ww8/docxexport.cxx  |3 +-
 sw/source/filter/ww8/docxexportfilter.cxx|   35 +++
 5 files changed, 43 insertions(+), 6 deletions(-)

New commits:
commit cbca5617387aaa39c9ee86272166bb3df7874b25
Author: offtkp 
AuthorDate: Wed Dec 14 22:21:34 2022 +0200
Commit: Justin Luth 
CommitDate: Tue Dec 20 14:46:21 2022 +

tdf#125338 Do not export macros when saving as .docx

Docx files that have macros should be saved as .docm. Now displays a
warning that macros won't be saved if exporting a .docm as a .docx and
doesn't export them.

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

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index afd0c2873fad..425d31f88d30 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -331,6 +331,7 @@
 #define STR_SOUTH   NC_("STR_SOUTH", "South")
 #define STR_SUM NC_("STR_SUM", "Sum")
 #define STR_INVALID_AUTOFORMAT_NAME 
NC_("STR_INVALID_AUTOFORMAT_NAME", "You have entered an invalid name.\nThe 
desired AutoFormat could not be created. \nTry again using a different name.")
+#define STR_CANT_SAVE_MACROSNC_("STR_CANT_SAVE_MACROS", 
"This document has macros, but macros will not be saved in this file format.")
 #define STR_NUMERIC NC_("STR_NUMERIC", "Numeric")
 #define STR_ROW NC_("STR_ROW", "Rows")
 #define STR_COL NC_("STR_COL", "Column")
diff --git a/sw/qa/extras/ooxmlexport/data/tdf125338.docm 
b/sw/qa/extras/ooxmlexport/data/tdf125338.docm
new file mode 100644
index ..44e943531d30
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125338.docm differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 26a7e7167667..a066f88ba13b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -129,7 +129,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109063, "tdf109063.docx")
 CPPUNIT_ASSERT_EQUAL(0, getShapes());
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf108269)
+CPPUNIT_TEST_FIXTURE(DocmTest, testTdf108269)
 {
 loadAndReload("tdf108269.docm");
 uno::Reference xNameAccess = 
packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
 maTempFile.GetURL());
@@ -139,6 +139,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108269)
 CPPUNIT_ASSERT(xNameAccess->hasByName("word/vbaData.xml"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf125338)
+{
+loadAndSave("tdf125338.docm");
+uno::Reference xNameAccess = 
packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
 maTempFile.GetURL());
+// docm files should not retain macros when saved as docx
+CPPUNIT_ASSERT(!xNameAccess->hasByName("word/vbaProject.bin"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf92045, "tdf92045.docx")
 {
 // This was true,  resulted in setting the 
blinking font effect.
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index ea59775eda15..f060773576eb 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -549,7 +549,8 @@ ErrCode DocxExport::ExportDocument_Impl()
 
 WriteEmbeddings();
 
-WriteVBA();
+if (m_bDocm)
+WriteVBA();
 
 m_aLinkedTextboxesHelper.clear();   //final cleanup
 m_pStyles.reset();
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx 
b/sw/source/filter/ww8/docxexportfilter.cxx
index 08308ca9398c..5ffd32f4c25b 100644
--- a/sw/source/filter/ww8/docxexportfilter.cxx
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -63,6 +63,37 @@ bool DocxExportFilter::exportDocument()
 pViewShell->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
 }
 
+OUString aFilterName;
+auto& rMediaDescriptor = getMediaDescriptor();
+rMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] >>= aFilterName;
+bool bDocm = aFilterName.endsWith("VBA");
+
+if (!bDocm)
+{
+// Check whether application is in headless mode
+if (!Application::IsHeadlessModeEnabled())
+{
+uno::Reference 
xStorageBasedDocument(
+pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+if (xStorageBasedDocument.is())
+{
+uno::Reference xDocumentStorage =
+xStorageBasedDocument->getDocumentStorage();
+if (xDocumentStorage.is() && 
xDocumentStorage->hasByName(u"_MS_VBA_Macros"))
+{
+// Let user know that 

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

2022-12-08 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |5 -
 sw/qa/core/layout/layout.cxx|5 +++--
 sw/qa/extras/uiwriter/uiwriter7.cxx |   13 -
 sw/qa/extras/unowriter/unowriter.cxx|5 +++--
 sw/qa/uibase/shells/shells.cxx  |5 +++--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   14 --
 sw/source/core/inc/DocumentContentOperationsManager.hxx |3 ---
 7 files changed, 17 insertions(+), 33 deletions(-)

New commits:
commit 2d9a3f8137e82af4a419441b58f80c027eee51b1
Author: Miklos Vajna 
AuthorDate: Thu Dec 8 20:06:15 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 9 07:10:50 2022 +

sw: remove unused DocumentContentOperationsManager::InsertGraphicObject()

Only tests called it, migrate those to
DocumentContentOperationsManager::InsertGraphic() instead, which is what
SwFEShell::Insert() and SwXFrame::attachToRange() use.

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

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index 5a95d0ba95b8..3294e9869b4c 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -186,11 +186,6 @@ public:
 const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet,
 SwFrameFormat*) = 0;
 
-virtual SwFlyFrameFormat* InsertGraphicObject(
-const SwPaM& rRg, const GraphicObject& rGrfObj,
-const SfxItemSet* pFlyAttrSet,
-const SfxItemSet* pGrfAttrSet) = 0;
-
 /** Transpose graphic (with undo)
  */
 virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& 
rFltName, const Graphic* pGraphic) = 0;
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 8479a3a075aa..f95cfcf09bc9 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -865,8 +865,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testFollowTextFlowWrapInBackground)
 aFrameSet.Put(aSize);
 SwFormatFollowTextFlow aFlow(true);
 aFrameSet.Put(aFlow);
-GraphicObject aGrf;
-rIDCO.InsertGraphicObject(*pWrtShell->GetCursor(), aGrf, , 
);
+Graphic aGrf;
+rIDCO.InsertGraphic(*pWrtShell->GetCursor(), OUString(), OUString(), 
, ,
+, nullptr);
 
 // When laying out that document:
 calcLayout();
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 8c14e7184f44..f04c802ea3b0 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -1830,11 +1830,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, 
testUndoDelAsCharTdf107512)
 pShell->ClearMark();
 SwFormatAnchor anchor(RndStdIds::FLY_AS_CHAR);
 frameSet.Put(anchor);
-GraphicObject grf;
+Graphic grf;
 pShell->SttEndDoc(true);
-CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, 
, ));
+CPPUNIT_ASSERT(rIDCO.InsertGraphic(*pShell->GetCursor(), OUString(), 
OUString(), ,
+   , , nullptr));
 pShell->SttEndDoc(false);
-CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, 
, ));
+CPPUNIT_ASSERT(rIDCO.InsertGraphic(*pShell->GetCursor(), OUString(), 
OUString(), ,
+   , , nullptr));
 CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF));
 SvxCharHiddenItem hidden(true, RES_CHRATR_HIDDEN);
 pShell->SelectTextModel(1, 4);
@@ -2017,8 +2019,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsChar)
 SfxItemSet grfSet(pDoc->GetAttrPool(), svl::Items);
 SwFormatAnchor anchor(RndStdIds::FLY_AS_CHAR);
 frameSet.Put(anchor);
-GraphicObject grf;
-CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, 
, ));
+Graphic grf;
+CPPUNIT_ASSERT(rIDCO.InsertGraphic(*pShell->GetCursor(), OUString(), 
OUString(), ,
+   , , nullptr));
 CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF));
 pShell->SetMark();
 pShell->Left(1, SwCursorSkipMode::Chars);
diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index 14ffc152d921..61b9b524b399 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -695,8 +695,9 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, 
testDeleteFlyAtCharAtStart)
 SfxItemSet grfSet(pDoc->GetAttrPool(), svl::Items);
 SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
 frameSet.Put(anchor);
-GraphicObject grf;
-CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pWrtShell->GetCursor(), grf, 
, ));
+Graphic grf;
+CPPUNIT_ASSERT(rIDCO.InsertGraphic(*pWrtShell->GetCursor(), OUString(), 
OUString(), ,
+

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

2022-12-01 Thread Justin Luth (via logerrit)
 sw/inc/textcontentcontrol.hxx |2 ++
 sw/qa/core/data/docm/testModernVBA.docm   |binary
 sw/source/core/txtnode/attrcontentcontrol.cxx |   14 ++
 sw/source/ui/vba/vbacontentcontrol.cxx|5 ++---
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 982f9ec1e07364e317fbcd25f1ef06f984cc0ce8
Author: Justin Luth 
AuthorDate: Wed Nov 23 18:12:20 2022 -0500
Commit: Justin Luth 
CommitDate: Thu Dec 1 21:32:05 2022 +0100

tdf#151548 ContentControls: Add Delete()

Needed a function to delete a control,
so it seemed to make sense to include it here.

[I saw a nice bExact flag, but it doesn't work because
 RES_TXTATTR_CONTENTCONTROLS is outside of a certain
 range. Oh well.]

make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME=testVba

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

diff --git a/sw/inc/textcontentcontrol.hxx b/sw/inc/textcontentcontrol.hxx
index a9bc4e4a1054..3fb7ea124b99 100644
--- a/sw/inc/textcontentcontrol.hxx
+++ b/sw/inc/textcontentcontrol.hxx
@@ -41,6 +41,8 @@ public:
 
 void ChgTextNode(SwTextNode* pNode);
 
+void Delete(bool bSaveContents);
+
 SwTextNode* GetTextNode() const;
 /// Get the current (potentially invalid) string from the doc
 OUString ToString() const;
diff --git a/sw/qa/core/data/docm/testModernVBA.docm 
b/sw/qa/core/data/docm/testModernVBA.docm
index dd96686659ca..be7d99a24b84 100644
Binary files a/sw/qa/core/data/docm/testModernVBA.docm and 
b/sw/qa/core/data/docm/testModernVBA.docm differ
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index e3d0c2237b3b..890bf20c1376 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -675,6 +675,20 @@ void SwTextContentControl::ChgTextNode(SwTextNode* pNode)
 }
 }
 
+void SwTextContentControl::Delete(bool bSaveContents)
+{
+if (!GetTextNode())
+return;
+
+if (bSaveContents)
+GetTextNode()->RstTextAttr(GetStart(), *End() - GetStart(), 
RES_TXTATR_CONTENTCONTROL);
+else
+{
+SwPaM aPaM(*GetTextNode(), GetStart(), *GetTextNode(), *End());
+
GetTextNode()->GetDoc().getIDocumentContentOperations().DeleteAndJoin(aPaM);
+}
+}
+
 SwTextNode* SwTextContentControl::GetTextNode() const
 {
 auto& rFormatContentControl = static_cast(GetAttr());
diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx 
b/sw/source/ui/vba/vbacontentcontrol.cxx
index d75ce84d7f4a..da3f3ec6f4ee 100644
--- a/sw/source/ui/vba/vbacontentcontrol.cxx
+++ b/sw/source/ui/vba/vbacontentcontrol.cxx
@@ -676,15 +676,14 @@ void SwVbaContentControl::Cut()
 SAL_INFO("sw.vba",
  "SwVbaContentControl::Cut[" << getID() << "], but missing sending 
to clipboard");
 
-Delete(uno::Any(false));
+m_rCC.Delete(/*bSaveContents=*/false);
 }
 
 void SwVbaContentControl::Delete(const uno::Any& DeleteContents)
 {
 bool bDeleteContents = false;
 DeleteContents >>= bDeleteContents;
-SAL_INFO("sw.vba", "SwVbaContentControl::Delete[" << DeleteContents << "] 
stub");
-//m_rCC.ChgTextNode(nullptr); // works, but crashes on UI touch - probably 
requires invalidation
+m_rCC.Delete(!bDeleteContents);
 }
 
 void SwVbaContentControl::SetCheckedSymbol(sal_Int32 Character, const 
uno::Any& Font)


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

2022-11-24 Thread Noel Grandin (via logerrit)
 sw/inc/fesh.hxx  |2 +-
 sw/qa/core/frmedt/frmedt.cxx |8 
 sw/source/core/frmedt/fews.cxx   |8 
 sw/source/ui/frmdlg/frmpage.cxx  |2 +-
 sw/source/uibase/docvw/edtwin.cxx|   12 ++--
 sw/source/uibase/frmdlg/frmmgr.cxx   |2 +-
 sw/source/uibase/inc/frmmgr.hxx  |2 +-
 sw/source/uibase/inc/frmpage.hxx |2 +-
 sw/source/uibase/shells/drwbassh.cxx |6 +++---
 9 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 493a714d4a62f78a4726d09d3258c425939c94c3
Author: Noel Grandin 
AuthorDate: Thu Nov 24 15:21:24 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 24 18:55:43 2022 +0100

pass SwFormatAnchor to SwFEShell::CalcBoundRect

part of the process of making SwFormatAnchor not use an SwPosition
(because SwFormatAnchor does weird does with the internals of an
SwPosition)

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

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 8a94960d3e29..63dc89afbc74 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -333,7 +333,7 @@ public:
 const RndStdIds _nAnchorId,
 const sal_Int16 _eHoriRelOrient = 
css::text::RelOrientation::FRAME,
 const sal_Int16 _eVertRelOrient = 
css::text::RelOrientation::FRAME,
-const SwPosition* _pToCharContentPos = nullptr,
+const SwFormatAnchor* _pToCharContentPos = nullptr,
 const bool _bFollowTextFlow = false,
 bool _bMirror = false,
 Point* _opRef = nullptr,
diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx
index 473dd414c293..6d6c3735724a 100644
--- a/sw/qa/core/frmedt/frmedt.cxx
+++ b/sw/qa/core/frmedt/frmedt.cxx
@@ -54,9 +54,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor)
 SwFrameFormat* pTextFrameFormat = FindFrameFormat(pTextFrameObj);
 CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), pTextFrameFormat->GetName());
 SwFrameFormat* pDrawShapeFormat = FindFrameFormat(pDrawShape);
-SwNodeOffset nOldAnchor = 
pDrawShapeFormat->GetAnchor().GetContentAnchor()->GetNodeIndex();
+SwNodeOffset nOldAnchor = 
pDrawShapeFormat->GetAnchor().GetAnchorNode()->GetIndex();
 pShell->FindAnchorPos(pTextFrameObj->GetLastBoundRect().Center(), true);
-SwNodeOffset nNewAnchor = 
pDrawShapeFormat->GetAnchor().GetContentAnchor()->GetNodeIndex();
+SwNodeOffset nNewAnchor = 
pDrawShapeFormat->GetAnchor().GetAnchorNode()->GetIndex();
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 6
 // - Actual  : 9
@@ -94,13 +94,13 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, 
testVertPosFromBottomBoundingBox)
 RndStdIds eAnchorType = RndStdIds::FLY_AT_CHAR;
 SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
 const auto& rFrameFormats = *pDoc->GetFrameFormats();
-const SwPosition* pContentPos = 
rFrameFormats[0]->GetAnchor().GetContentAnchor();
+const SwFormatAnchor* pFormatAhchor = [0]->GetAnchor();
 sal_Int16 eHoriRelOrient = text::RelOrientation::PAGE_FRAME;
 sal_Int16 eVertRelOrient = text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
 bool bFollowTextFlow = false;
 bool bMirror = false;
 Size aPercentSize;
-pWrtShell->CalcBoundRect(aBoundRect, eAnchorType, eHoriRelOrient, 
eVertRelOrient, pContentPos,
+pWrtShell->CalcBoundRect(aBoundRect, eAnchorType, eHoriRelOrient, 
eVertRelOrient, pFormatAhchor,
  bFollowTextFlow, bMirror, nullptr, );
 
 // Without the accompanying fix in place, this test would have failed with:
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 034adb425ca1..c89e26cf6a2c 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -691,7 +691,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
const RndStdIds _nAnchorId,
const sal_Int16 _eHoriRelOrient,
const sal_Int16 _eVertRelOrient,
-   const SwPosition* _pToCharContentPos,
+   const SwFormatAnchor* _pToCharContentPos,
const bool _bFollowTextFlow,
bool _bMirror,
Point* _opRef,
@@ -993,7 +993,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
 SwRect aChRect;
 if ( _pToCharContentPos )
 {
-pTextFrame->GetAutoPos( aChRect, *_pToCharContentPos );
+pTextFrame->GetAutoPos( aChRect, 
*_pToCharContentPos->GetContentAnchor() );
 }

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

2022-11-24 Thread Noel Grandin (via logerrit)
 sw/inc/fmtanchr.hxx |2 +
 sw/qa/extras/layout/layout.cxx  |   30 
 sw/qa/extras/layout/layout2.cxx |6 ++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |4 +--
 sw/qa/extras/uiwriter/uiwriter8.cxx |   10 
 sw/qa/uibase/wrtsh/wrtsh.cxx|4 +--
 sw/source/core/attr/swatrset.cxx|2 -
 sw/source/core/crsr/findtxt.cxx |   14 +--
 sw/source/core/doc/DocumentLayoutManager.cxx|8 +++---
 sw/source/core/doc/dbgoutsw.cxx |4 +--
 sw/source/core/doc/docfly.cxx   |   26 ++--
 sw/source/core/doc/docglbl.cxx  |   10 
 sw/source/core/doc/docnew.cxx   |2 -
 sw/source/core/doc/docsort.cxx  |6 ++--
 sw/source/core/doc/tblcpy.cxx   |6 ++--
 sw/source/core/doc/textboxhelper.cxx|   22 +++--
 sw/source/core/docnode/ndtbl.cxx|8 +++---
 sw/source/core/docnode/node.cxx |   18 ++
 sw/source/core/docnode/swbaslnk.cxx |   10 
 sw/source/core/draw/dcontact.cxx|8 +++---
 sw/source/core/frmedt/fecopy.cxx|   14 +--
 sw/source/core/frmedt/fefly1.cxx|6 ++--
 sw/source/core/frmedt/feshview.cxx  |2 -
 sw/source/core/frmedt/tblsel.cxx|6 ++--
 sw/source/core/layout/anchoredobject.cxx|2 -
 sw/source/core/layout/atrfrm.cxx|9 +++
 sw/source/core/layout/flowfrm.cxx   |2 -
 sw/source/core/layout/flycnt.cxx|2 -
 sw/source/core/layout/flylay.cxx|2 -
 sw/source/core/layout/pagechg.cxx   |4 +--
 sw/source/core/ole/ndole.cxx|4 +--
 sw/source/core/text/EnhancedPDFExportHelper.cxx |6 ++--
 sw/source/core/text/itratr.cxx  |6 ++--
 sw/source/core/text/txtfly.cxx  |2 -
 sw/source/core/txtnode/atrflyin.cxx |4 ---
 sw/source/core/txtnode/ndtxt.cxx|2 -
 sw/source/core/txtnode/thints.cxx   |2 -
 sw/source/core/undo/unattr.cxx  |4 +--
 sw/source/core/undo/undel.cxx   |9 +++
 sw/source/core/undo/undobj1.cxx |   10 
 sw/source/core/undo/undraw.cxx  |2 -
 sw/source/core/undo/untbl.cxx   |8 +++---
 sw/source/core/undo/untblk.cxx  |   14 +--
 sw/source/filter/basflt/shellio.cxx |2 -
 sw/source/filter/html/css1atr.cxx   |   15 +---
 sw/source/filter/html/htmlflywriter.cxx |6 ++--
 sw/source/filter/html/htmlform.cxx  |4 +--
 sw/source/filter/html/htmlforw.cxx  |6 ++--
 sw/source/filter/html/htmlgrin.cxx  |6 ++--
 sw/source/filter/html/htmltab.cxx   |   12 -
 sw/source/filter/ww8/writerhelper.cxx   |2 -
 sw/source/filter/ww8/wrtw8esh.cxx   |6 ++--
 sw/source/filter/ww8/wrtw8nds.cxx   |   12 -
 sw/source/filter/ww8/ww8glsy.cxx|6 ++--
 sw/source/filter/ww8/ww8par2.cxx|6 ++--
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |4 +--
 sw/source/uibase/wrtsh/delete.cxx   |2 -
 57 files changed, 206 insertions(+), 205 deletions(-)

New commits:
commit dd90710a0acd58ac76bdbe9809382fa266733167
Author: Noel Grandin 
AuthorDate: Thu Nov 24 10:52:52 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 24 11:58:04 2022 +0100

add SwFormatAnchor::GetAnchorNode method

as a step towards switching away from using SwPosition inside
SwFormatAnchor (because SwFormatAnchor wants to do weird stuff with the
internals of SwPosition)

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

diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx
index 8dc5ecf59db6..582801d379f0 100644
--- a/sw/inc/fmtanchr.hxx
+++ b/sw/inc/fmtanchr.hxx
@@ -70,6 +70,8 @@ public:
 // #i28701#
 sal_uInt32 GetOrder() const { return m_nOrder;}
 
+SwNode* GetAnchorNode() const;
+
 void SetType( RndStdIds nRndId ) { m_eAnchorId = nRndId; }
 void SetPageNum( sal_uInt16 nNew ) { m_nPageNumber = nNew; }
 void SetAnchor( const SwPosition *pPos );
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index c84b21f4e5bc..2707f940dfbf 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -341,7 +341,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 if (i == 1) // secondly, try with different 

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

2022-11-09 Thread Paris Oplopoios (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   14 +++
 sw/qa/core/accessibilitycheck/data/TabsTest.odt  |binary
 sw/source/core/access/AccessibilityCheck.cxx |   68 ++-
 4 files changed, 64 insertions(+), 19 deletions(-)

New commits:
commit 3c0be5564afe1b9cc843a49aba88b72af74c43ab
Author: Paris Oplopoios 
AuthorDate: Mon Oct 24 14:12:44 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Wed Nov 9 23:54:58 2022 +0100

a11y: Add check for tabs used for formatting

Add accessibility check and relevant test for a document that uses
tabs for formatting

Useful to detect fake tables made of tabs

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

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 7245a2b8d3e0..baa61cbcb8ba 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -27,6 +27,7 @@
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
 #define STR_AVOID_SPACES_SPACE  NC_("STR_AVOID_SPACES_SPACE", "Avoid 
spaces to create space.")
+#define STR_AVOID_TABS_FORMATTING   NC_("STR_AVOID_TABS_FORMATTING", 
"Avoid using tabs for formatting.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index cc8b3742be74..9397832bebf5 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -168,6 +168,20 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTableFormatting)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_FORMATTING, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting)
+{
+SwDoc* pDoc = createSwDoc("TabsTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[2]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[3]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
b/sw/qa/core/accessibilitycheck/data/TabsTest.odt
new file mode 100644
index ..29b415df87a7
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index ce0409d6ba5b..897ee0d43c58 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -791,33 +791,63 @@ public:
 const OUString& sParagraphText = pTextNode->GetText();
 sal_Int32 nSpaceCount = 0;
 sal_Int32 nSpaceStart = 0;
+sal_Int32 nTabCount = 0;
 bool bNonSpaceFound = false;
+bool bPreviousWasChar = false;
 for (sal_Int32 i = 0; i < nParagraphLength; i++)
 {
-if (sParagraphText[i] == ' ')
+switch (sParagraphText[i])
 {
-if (bNonSpaceFound)
+case ' ':
 {
-nSpaceCount++;
-if (nSpaceCount == 2)
-nSpaceStart = i;
+if (bNonSpaceFound)
+{
+nSpaceCount++;
+if (nSpaceCount == 2)
+nSpaceStart = i;
+}
+break;
 }
-}
-else
-{
-if (nSpaceCount >= 2)
+case '\t':
 {
-auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_SPACES_SPACE),
-  
sfx::AccessibilityIssueID::TEXT_FORMATTING);
-

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

2022-11-07 Thread László Németh (via logerrit)
 sw/inc/swtable.hxx  |   12 ---
 sw/qa/extras/uiwriter/uiwriter5.cxx |   19 +
 sw/source/core/table/swtable.cxx|   39 +---
 3 files changed, 60 insertions(+), 10 deletions(-)

New commits:
commit 0d295ee0c34ed505a9673580b40ade3ce6947d99
Author: László Németh 
AuthorDate: Mon Nov 7 13:06:56 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 7 16:50:32 2022 +0100

tdf#151658 sw: accept of row deletions with nested tables

Accepting tracked row deletion didn't delete the table row,
only its row content, if the table row contained cell
starting nested tables.

Extend SwTableBox::IsEmpty() to detect a table cell as empty,
if it contains only a cell starting empty table.

Note: Without change tracking, deleting content of a selected
table cell leaves the cell starting nested table in
the cell, but deleting row removed the row with nested table,
too.

Follow-up to commit 6383362999b72160eab6abdfc6ea6bdbd231b100
"tdf#151657 sw: delete row with nested table in Hide Changes" and
commit c809867f3ee92a8eb36cbab840bd6d6c5b3b1c26
"tdf#150976 sw: fix tracked deletion of row with nested table".

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

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 49f5bf8418af..0ad1deffb42e 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -354,6 +354,9 @@ public:
 bool IsDeleted() const;
 // is it a table with deleted row(s)
 bool HasDeletedRow() const;
+// it doesn't contain box content (except single empty nested tables of 
the boxes
+// which could remain after deletion of text content of the selected table)
+bool IsEmpty() const;
 };
 
 /// SwTableLine is one table row in the document model.
@@ -397,7 +400,8 @@ public:
 
 bool hasSoftPageBreak() const;
 
-// it doesn't contain box content
+// it doesn't contain box content (except single empty nested tables of 
the boxes
+// which could remain after deletion of text content of the selected table 
row)
 bool IsEmpty() const;
 
 // Update TextChangesOnly property based on the redlines of the table row.
@@ -473,8 +477,10 @@ public:
 void RemoveFromTable();
 const SwStartNode *GetSttNd() const { return m_pStartNode; }
 SwNodeOffset GetSttIdx() const;
-// it doesn't contain box content
-bool IsEmpty() const;
+// it doesn't contain box content or if bWithRemainingNestedTable = true,
+// it contains only an empty nested table as box content (which
+// could remain after deletion of the text content of the selected box).
+bool IsEmpty( bool bWithRemainingNestedTable = true ) const;
 
 // Search next/previous box with content.
 SwTableBox* FindNextBox( const SwTable&, const SwTableBox*,
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 3aaedff5f662..4fd84528ba11 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -1895,6 +1895,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976)
 
 // This was false (not deleted row)
 CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRow());
+
+// accept all tracked changes
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+
+// tdf#151658 This was 1: not deleted table row (and table)
+assertXPath(pXmlDoc, "//page[1]//body/tab", 0);
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657)
@@ -1938,6 +1947,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657)
 
 // This was false (not deleted row)
 CPPUNIT_ASSERT(pTabFrame->GetTable()->HasDeletedRow());
+
+// accept all tracked changes
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+Scheduler::ProcessEventsToIdle();
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+
+// tdf#151658 This was 1: not deleted table row (and table)
+assertXPath(pXmlDoc, "//page[1]//body/tab", 0);
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testSelectRowWithNestedTable)
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 9e4c1b066a5d..7fa3c3caea4d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1570,6 +1570,16 @@ bool SwTableLine::IsEmpty() const
 return true;
 }
 
+bool SwTable::IsEmpty() const
+{
+for (size_t i = 0; i < m_aLines.size(); ++i)
+{
+if ( !m_aLines[i]->IsEmpty() )
+return false;
+}
+return true;
+}
+
 bool SwTable::HasDeletedRow() const
 {
 const SwRedlineTable& aRedlineTable = 
GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
@@ -1626,7 +1636,7 @@ 

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

2022-10-29 Thread Noel Grandin (via logerrit)
 sw/inc/ndtxt.hxx|4 ++--
 sw/qa/extras/uiwriter/uiwriter7.cxx |3 +--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   12 +---
 sw/source/core/txtnode/thints.cxx   |5 ++---
 sw/source/core/txtnode/txtedt.cxx   |6 ++
 sw/source/core/undo/unsect.cxx  |5 +
 sw/source/core/undo/untbl.cxx   |2 +-
 sw/source/core/undo/untblk.cxx  |2 +-
 8 files changed, 15 insertions(+), 24 deletions(-)

New commits:
commit 9cd0f4c2d25462feba0ffcbd906c199273821243
Author: Noel Grandin 
AuthorDate: Sat Oct 29 11:29:38 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 29 21:26:29 2022 +0200

tdf#126788 no need to allocate an SwContentIndex when calling RstTextAttr

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

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index a37661e18547..42cc43380f1a 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -290,7 +290,7 @@ public:
 /** delete all attributes.
 If neither pSet nor nWhich is given, delete all attributes (except
 refmarks, toxmarks, meta) in range.
-@param rIdx start position
+@param nContentStart start position
 @param nLen range in which attributes will be deleted
 @param pSet if not 0, delete only attributes contained in pSet
 @param nWhich   if not 0, delete only attributes with matching which
@@ -302,7 +302,7 @@ public:
 which are simply included in the range.
  */
 void RstTextAttr(
-const SwContentIndex ,
+const sal_Int32 nContentStart,
 const sal_Int32 nLen,
 const sal_uInt16 nWhich = 0,
 const SfxItemSet* pSet = nullptr,
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 52e1eb6aa1de..e9c79cd2e527 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -594,9 +594,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf72788)
 }
 //Clear all the Direct Formatting ( Ctrl + M )
 SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode();
-SwContentIndex aSt(pTextNode, 0);
 sal_Int32 nEnd = pTextNode->Len();
-pTextNode->RstTextAttr(aSt, nEnd - aSt.GetIndex());
+pTextNode->RstTextAttr(0, nEnd);
 //In case of Regression RstTextAttr() call will result to infinite 
recursion
 //Check that bold is removed in first paragraph
 aSet.ClearItem();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d7896c6c113d..a49ed387aac3 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1468,8 +1468,7 @@ namespace //local functions originally from docfmt.cxx
 {
 pCurrentNode->ResetAttr(RES_PARATR_LIST_AUTOFMT);
 // reset also paragraph marker
-SwContentIndex nIdx( pCurrentNode, pCurrentNode->Len() 
);
-pCurrentNode->GetTextNode()->RstTextAttr(nIdx, 1);
+
pCurrentNode->GetTextNode()->RstTextAttr(pCurrentNode->Len(), 1);
 }
 pCurrentNode = SwNodes::GoPrevious(  );
 }
@@ -1745,18 +1744,17 @@ namespace //local functions originally from docfmt.cxx
 if( !(nFlags & SetAttrMode::DONTREPLACE ) &&
 pTextNd->HasHints() && !nMkPos && nPtPos == 
rStr.getLength())
 {
-SwContentIndex aSt( pTextNd );
 if( pHistory )
 {
 // Save all attributes for the Undo.
 SwRegHistory aRHst( *pTextNd, pHistory );
 pTextNd->GetpSwpHints()->Register(  );
-pTextNd->RstTextAttr( aSt, nPtPos, 0, pCharSet );
+pTextNd->RstTextAttr( 0, nPtPos, 0, pCharSet );
 if( pTextNd->GetpSwpHints() )
 pTextNd->GetpSwpHints()->DeRegister();
 }
 else
-pTextNd->RstTextAttr( aSt, nPtPos, 0, pCharSet );
+pTextNd->RstTextAttr( 0, nPtPos, 0, pCharSet );
 }
 
 if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
@@ -4058,13 +4056,13 @@ bool DocumentContentOperationsManager::lcl_RstTextAttr( 
SwNode* pNd, void* pArgs
 // Save all attributes for the Undo.
 SwRegHistory aRHst( *pTextNode, pPara->pHistory );
 pTextNode->GetpSwpHints()->Register(  );
- 

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

2022-10-17 Thread offtkp (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   11 +++
 sw/qa/core/accessibilitycheck/data/SpaceTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx |   49 +++
 4 files changed, 61 insertions(+)

New commits:
commit 2c44f57b3f59012057a7a0a4d912648d362cf6f3
Author: offtkp 
AuthorDate: Wed Oct 12 19:29:28 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 16:33:40 2022 +0200

a11y: Add check for spacing spaces

Add accessibility check and relevant test for a document that uses
multiple spaces for spacing

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

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 4d65bd095f51..9c45cb84ecd9 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -23,6 +23,7 @@
 #define STR_AVOID_ENDNOTES  NC_("STR_AVOID_ENDNOTES", "Avoid 
endnotes.")
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
+#define STR_AVOID_SPACES_SPACE  NC_("STR_AVOID_SPACES_SPACE", "Avoid 
spaces to create space.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 7a60b1578e21..98b08b5a207c 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -82,6 +82,17 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckNewlineSpace)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "SpaceTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/SpaceTest.odt 
b/sw/qa/core/accessibilitycheck/data/SpaceTest.odt
new file mode 100644
index ..0f00f78f9698
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/SpaceTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index f56bdf3e0c7b..9746e17c0794 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -670,6 +670,54 @@ public:
 }
 };
 
+class SpaceSpacingCheck : public NodeCheck
+{
+public:
+SpaceSpacingCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
+: NodeCheck(rIssueCollection)
+{
+}
+void check(SwNode* pCurrent) override
+{
+if (!pCurrent->IsTextNode())
+return;
+SwTextNode* pTextNode = pCurrent->GetTextNode();
+auto nParagraphLength = pTextNode->GetText().getLength();
+const OUString& sParagraphText = pTextNode->GetText();
+sal_Int32 nSpaceCount = 0;
+sal_Int32 nSpaceStart = 0;
+bool bNonSpaceFound = false;
+for (sal_Int32 i = 0; i < nParagraphLength; i++)
+{
+if (sParagraphText[i] == ' ')
+{
+if (bNonSpaceFound)
+{
+nSpaceCount++;
+if (nSpaceCount == 2)
+nSpaceStart = i;
+}
+}
+else
+{
+if (nSpaceCount >= 2)
+{
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_SPACES_SPACE),
+  
sfx::AccessibilityIssueID::TEXT_FORMATTING);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+SwDoc& rDocument = pTextNode->GetDoc();
+pIssue->setDoc(rDocument);
+pIssue->setStart(nSpaceStart);
+pIssue->setEnd(nSpaceStart + nSpaceCount - 1);
+}
+

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

2022-10-17 Thread Paris Oplopoios (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc   |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx   |   12 +
 sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt |binary
 sw/qa/core/accessibilitycheck/data/NewlineTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |   87 +
 5 files changed, 100 insertions(+)

New commits:
commit f03d285d51ba5d5b30e9f8a2b1165270140d5a20
Author: Paris Oplopoios 
AuthorDate: Mon Oct 17 12:37:30 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 16:32:13 2022 +0200

a11y: Add check for spacing newlines

Add accessibility check and relevant test for a document that uses
newlines for spacing

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

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 858de1a47d93..4d65bd095f51 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -22,6 +22,7 @@
 #define STR_AVOID_FOOTNOTES NC_("STR_AVOID_FOOTNOTES", "Avoid 
footnotes.")
 #define STR_AVOID_ENDNOTES  NC_("STR_AVOID_ENDNOTES", "Avoid 
endnotes.")
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
+#define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 2c36d2b5d4e7..7a60b1578e21 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -70,6 +70,18 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckBackgroundImage)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "NewlineTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
index 2e319f58e7a2..6b55335e773d 100644
Binary files a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt and 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt differ
diff --git a/sw/qa/core/accessibilitycheck/data/NewlineTest.odt 
b/sw/qa/core/accessibilitycheck/data/NewlineTest.odt
new file mode 100644
index ..9ff715916fc2
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/NewlineTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index de0a5bf63472..f56bdf3e0c7b 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -584,6 +584,92 @@ public:
 }
 };
 
+class NewlineSpacingCheck : public NodeCheck
+{
+private:
+static SwTextNode* getNextTextNode(SwNode* pCurrent)
+{
+SwTextNode* pTextNode = nullptr;
+
+auto nIndex = pCurrent->GetIndex();
+auto nCount = pCurrent->GetNodes().Count();
+
+nIndex++; // go to next node
+
+while (pTextNode == nullptr && nIndex < nCount)
+{
+auto pNode = pCurrent->GetNodes()[nIndex];
+if (pNode->IsTextNode())
+pTextNode = pNode->GetTextNode();
+nIndex++;
+}
+
+return pTextNode;
+}
+
+public:
+NewlineSpacingCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
+: NodeCheck(rIssueCollection)
+{
+}
+void check(SwNode* pCurrent) override
+{
+if (!pCurrent->IsTextNode())
+return;
+
+SwTextNode* pTextNode = pCurrent->GetTextNode();
+auto nParagraphLength = pTextNode->GetText().getLength();
+if (nParagraphLength == 0)
+{
+SwTextNode* pNextTextNode = getNextTextNode(pCurrent);
+if 

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

2022-10-14 Thread Miklos Vajna (via logerrit)
 sw/inc/doc.hxx   |2 +-
 sw/qa/core/doc/data/copy-bookmarks.docx  |binary
 sw/qa/core/doc/doc.cxx   |   18 ++
 sw/source/core/doc/DocumentLayoutManager.cxx |9 +
 sw/source/core/doc/doclay.cxx|   26 +++---
 5 files changed, 47 insertions(+), 8 deletions(-)

New commits:
commit 8d4f64427528f76afa4bf39a23edaa991850a50a
Author: Miklos Vajna 
AuthorDate: Fri Oct 14 14:28:41 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 14 15:24:07 2022 +0200

sw: improve duplicated images in copied header/footer text

DOCX import currently maps linked headers to 2 Writer headers, the
second header has a copy of the first header's content. The image in the
first header is named 'Picture 1', the copied header names the image as
'Image1'.

This is similar to what commit 41403fbff8140ad0ca7cf8f81d37cddcfbd19197
(sw: improve duplicated bookmarks in copied header/footer text,
2022-10-13) fixed for bookmarks, what happens is that
sw::DocumentLayoutManager::CopyLayoutFormat() clears the name of the
image, and then these are filled in at the end of the import in one
shot, to improve performance. The downside is that it's not possible for
an API user to know which was the original image and which is the copy.

Fix the problem by tweaking the in-header-footer && not-in-mail-merge
case to generate a name like 'Picture 1 Copy 1': this is meant to
preserve the lost connection between the original image and its copy,
while maintaining performance for the mail merge and body text cases
where we expect lots of images.

In the long run it would probably make sense to rather support linked
headers/footers in Writer core so we don't have to create such a copy in
the first place.

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index f5e868494cf6..f3662cb02b17 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -684,7 +684,7 @@ public:
 SwDBData const & GetDBData();
 
 // Some helper functions
-OUString GetUniqueGrfName() const;
+OUString GetUniqueGrfName(std::u16string_view rPrefix = 
std::u16string_view()) const;
 OUString GetUniqueOLEName() const;
 OUString GetUniqueFrameName() const;
 OUString GetUniqueShapeName() const;
diff --git a/sw/qa/core/doc/data/copy-bookmarks.docx 
b/sw/qa/core/doc/data/copy-bookmarks.docx
index 3fb27b430a17..a9bedb487946 100644
Binary files a/sw/qa/core/doc/data/copy-bookmarks.docx and 
b/sw/qa/core/doc/data/copy-bookmarks.docx differ
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 98548befa9ee..90e69ddc7f73 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -278,6 +278,24 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks)
 // - Actual  : 2
 // i.e. the 2nd header had a duplicated bookmark without "Copy" in its 
name.
 CPPUNIT_ASSERT_EQUAL(static_cast(1), nActual);
+
+// Also, when checking the # of non-copy images in the resulting doc model:
+nActual = 0;
+SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats();
+for (size_t i = 0; i < rFrameFormats.size(); ++i)
+{
+if (rFrameFormats[i]->GetName().indexOf("Copy") == -1)
+{
+++nActual;
+}
+}
+
+// Then make sure we have a single non-copy image, with no duplications:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 2
+// i.e. the 2nd header had a duplicated image without "Copy" in its name.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nActual);
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLinkedStyleDelete)
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index bbe90610e8b9..5bd14376a0ec 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -335,15 +335,16 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 // 2) anchored in a header/footer
 // 3) anchored (to paragraph?)
 bool bMayNotCopy = false;
+const auto pCAnchor = rNewAnchor.GetContentAnchor();
+bool bInHeaderFooter = pCAnchor && 
m_rDoc.IsInHeaderFooter(pCAnchor->GetNode());
 if(bDraw)
 {
-const auto pCAnchor = rNewAnchor.GetContentAnchor();
 bool bCheckControlLayer = false;
 
rSource.CallSwClientNotify(sw::CheckDrawFrameFormatLayerHint());
 bMayNotCopy =
 bCheckControlLayer &&
 ((RndStdIds::FLY_AT_PARA == rNewAnchor.GetAnchorId()) || 
(RndStdIds::FLY_AT_FLY  == rNewAnchor.GetAnchorId()) || (RndStdIds::FLY_AT_CHAR 
== rNewAnchor.GetAnchorId())) 

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

2022-10-13 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |3 --
 sw/inc/strings.hrc  |2 +
 sw/qa/core/doc/doc.cxx  |   24 ++--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   16 ++
 sw/source/core/doc/docbm.cxx|4 ++
 sw/source/core/doc/docdesc.cxx  |4 +-
 sw/source/core/doc/docfmt.cxx   |2 -
 sw/source/core/inc/DocumentContentOperationsManager.hxx |2 -
 sw/source/core/unocore/unotext.cxx  |   22 ++
 writerfilter/source/dmapper/PropertyMap.cxx |   11 ---
 10 files changed, 33 insertions(+), 57 deletions(-)

New commits:
commit 41403fbff8140ad0ca7cf8f81d37cddcfbd19197
Author: Miklos Vajna 
AuthorDate: Thu Oct 13 13:53:33 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 13 15:16:04 2022 +0200

sw: improve duplicated bookmarks in copied header/footer text

Bookmarks in copied text were renamed in a way that made it hard to
differentiate between the original bookmark and the copy, e.g. "Bookmark
1" was renamed to "Bookmark 11".

Bookmarks are supposed to have a unique name, so renaming makes sense,
and it's probably better to do that compared to what commit
3ec224dcb15e0e663ba85077b8ea0e632f8f03f8 (DOCX import: avoid duplicated
bookmarks in copied header/footer text, 2022-09-08) did to just omit
them during copy. That solved the duplicated bookmarks, but if one had
bookmarks around images to find them, now it doesn't work to find all
such images.

Fix the problem by going back to copying bookmarks, but copy "Bookmark
1" as "Bookmark 1 Copy 1" (and "Bookmark 1 Copy 2", etc), so API users
can identify the original and the copied bookmarks.

A similar problem is there for images as well, but that's not yet
addressed here.

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

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index 60d45d47a0a3..5a95d0ba95b8 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -75,12 +75,11 @@ enum class SwCopyFlags
 CopyAll = (1<<0), ///< copy break attributes even when source is 
single node
 CheckPosInFly   = (1<<1), ///< check if target position is in fly anchored 
at source range
 IsMoveToFly = (1<<2), ///< MakeFlyAndMove
-SkipBookmarks   = (1<<3), ///< skip bookmarks, but not other kind of marks
 // TODO: mbCopyIsMove? mbIsRedlineMove?
 };
 namespace o3tl
 {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 enum class SwDeleteFlags
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 4f2dd39ff86b..e1859f1432d0 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1446,6 +1446,8 @@
 // in order to change %PRODUCTNAME at runtime is expensive, so limit doing 
that as much as possible.
 #define STR_A11Y_DESC_AUTO  
NC_("insertcaption|extended_tip|auto", "Opens the Caption dialog. It has the 
same information as the dialog you get by menu %PRODUCTNAME Writer - 
AutoCaption in the Options dialog box.")
 
+#define STR_MARK_COPY NC_("STR_MARK_COPY", "%1 Copy ")
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
b/sw/qa/core/doc/data/copy-bookmarks.docx
similarity index 100%
rename from sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx
rename to sw/qa/core/doc/data/copy-bookmarks.docx
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 8c882e906373..98548befa9ee 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -256,19 +256,27 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
 CPPUNIT_ASSERT_EQUAL(OUString("\x0001test\x0001"), pTextNode->GetText());
 }
 
-CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyFlagSkipBookmarks)
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks)
 {
 // Given a document with a bookmark in a header that is linked later:
-SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-flag-skip-bookmarks.docx");
-
-// When checking the # of bookmarks in the resulting doc model:
-sal_Int32 nActual = pDoc->getIDocumentMarkAccess()->getAllMarksCount();
-
-// Then make sure we have a single bookmark, with no duplications:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-bookmarks.docx");
+
+// When checking the # of non-copy bookmarks in the resulting doc model:
+sal_Int32 nActual = 0;
+for (auto it = pDoc->getIDocumentMarkAccess()->getBookmarksBegin();
+ it != pDoc->getIDocumentMarkAccess()->getBookmarksEnd(); ++it)
+{
+if 

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

2022-10-11 Thread Noel Grandin (via logerrit)
 sw/inc/ToxWhitespaceStripper.hxx |2 
 sw/inc/calc.hxx  |8 +--
 sw/inc/doc.hxx   |2 
 sw/inc/docufld.hxx   |2 
 sw/inc/fmtmeta.hxx   |2 
 sw/inc/hhcwrp.hxx|2 
 sw/inc/modcfg.hxx|2 
 sw/inc/ndtxt.hxx |2 
 sw/inc/shellio.hxx   |2 
 sw/inc/swtable.hxx   |2 
 sw/inc/tox.hxx   |6 +-
 sw/inc/unocrsrhelper.hxx |4 -
 sw/inc/unotbl.hxx|   10 ++--
 sw/inc/unotextcursor.hxx |2 
 sw/inc/unotextrange.hxx  |2 
 sw/qa/core/test_ToxMiscTest.cxx  |2 
 sw/qa/core/test_ToxWhitespaceStripper.cxx|   22 -
 sw/qa/core/uwriter.cxx   |   58 
 sw/qa/extras/odfexport/odfexport.cxx |   12 ++---
 sw/qa/extras/uiwriter/uiwriter7.cxx  |8 +--
 sw/source/core/access/accpara.cxx|8 +--
 sw/source/core/access/accpara.hxx|4 -
 sw/source/core/doc/docchart.cxx  |   18 +++
 sw/source/core/doc/docnum.cxx|6 +-
 sw/source/core/docnode/ndtbl.cxx |6 +-
 sw/source/core/edit/autofmt.cxx  |   18 +++
 sw/source/core/fields/docufld.cxx|   16 ++
 sw/source/core/fields/reffld.cxx |6 +-
 sw/source/core/inc/UndoCore.hxx  |   16 +++---
 sw/source/core/inc/scriptinfo.hxx|4 -
 sw/source/core/inc/swblocks.hxx  |4 -
 sw/source/core/inc/txtfrm.hxx|2 
 sw/source/core/swg/swblocks.cxx  |   12 ++---
 sw/source/core/text/itratr.hxx   |2 
 sw/source/core/text/porlay.cxx   |6 +-
 sw/source/core/text/redlnitr.cxx |4 -
 sw/source/core/text/txtfrm.cxx   |8 +--
 sw/source/core/tox/ToxWhitespaceStripper.cxx |4 -
 sw/source/core/tox/tox.cxx   |   64 +--
 sw/source/core/txtnode/fmtatr2.cxx   |4 -
 sw/source/core/txtnode/justify.cxx   |   21 
 sw/source/core/txtnode/justify.hxx   |8 +--
 sw/source/core/txtnode/txtedt.cxx|   14 ++---
 sw/source/core/undo/undel.cxx|   16 +++---
 sw/source/core/undo/undobj.cxx   |   10 ++--
 sw/source/core/unocore/unocrsrhelper.cxx |   20 
 sw/source/core/unocore/unoobj.cxx|8 +--
 sw/source/core/unocore/unoobj2.cxx   |   18 +++
 sw/source/core/unocore/unotbl.cxx|   34 +++---
 sw/source/core/unocore/unotext.cxx   |4 -
 sw/source/filter/html/htmlflywriter.cxx  |   28 ++-
 sw/source/filter/html/htmlftn.cxx|   20 
 sw/source/filter/html/swhtml.hxx |4 -
 sw/source/filter/html/wrthtml.hxx|2 
 sw/source/filter/ww8/writerwordglue.cxx  |   30 ++--
 sw/source/filter/ww8/wrtw8sty.cxx|8 +--
 sw/source/filter/ww8/wrtww8.hxx  |2 
 sw/source/filter/ww8/ww8par.cxx  |   18 +++
 sw/source/filter/ww8/ww8par.hxx  |6 +-
 sw/source/filter/ww8/ww8par5.cxx |   46 +--
 sw/source/filter/ww8/ww8scan.cxx |8 +--
 sw/source/ui/dbui/dbinsdlg.cxx   |   15 +++---
 sw/source/ui/dialog/uiregionsw.cxx   |4 -
 sw/source/ui/vba/vbarangehelper.cxx  |   14 ++---
 sw/source/ui/vba/vbarangehelper.hxx  |2 
 sw/source/ui/vba/vbatemplate.cxx |8 +--
 sw/source/uibase/config/modcfg.cxx   |   12 ++---
 sw/source/uibase/dbui/mailmergehelper.cxx|   10 ++--
 sw/source/uibase/dochdl/gloshdl.cxx  |4 -
 sw/source/uibase/docvw/srcedtw.cxx   |   26 +-
 sw/source/uibase/inc/gloshdl.hxx |2 
 sw/source/uibase/inc/mailmergehelper.hxx |2 
 sw/source/uibase/inc/srcedtw.hxx |2 
 sw/source/uibase/lingu/hhcwrp.cxx|6 +-
 sw/source/uibase/misc/glosdoc.cxx|   10 ++--
 sw/source/uibase/uiview/view2.cxx|   26 +-
 76 files changed, 416 insertions(+), 416 deletions(-)

New commits:
commit 71337b4327805b73e92c995153c5746d89793b13
Author: Noel Grandin 
AuthorDate: Mon Oct 10 12:09:44 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 11 08:44:09 2022 +0200

use more string_view in sw

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

diff --git a/sw/inc/ToxWhitespaceStripper.hxx b/sw/inc/ToxWhitespaceStripper.hxx
index 9decbc020bf4..755c3f721af2 100644

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

2022-10-04 Thread Miklos Vajna (via logerrit)
 sw/inc/charfmt.hxx|3 ++-
 sw/inc/fmtcol.hxx |2 +-
 sw/qa/core/doc/doc.cxx|   30 ++
 sw/source/core/doc/fmtcol.cxx |   15 ++-
 sw/source/core/txtnode/chrfmt.cxx |   19 ++-
 sw/source/uibase/app/docstyle.cxx |4 ++--
 6 files changed, 67 insertions(+), 6 deletions(-)

New commits:
commit 3aff88ae021c571b6e218f6e2a0f62728bb86394
Author: Miklos Vajna 
AuthorDate: Mon Oct 3 23:04:41 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 4 08:21:57 2022 +0200

tdf#151094 ODT export: fix crash when linked paragraph style is deleted

If a document contains a linked paragraph-character style pair and the
paragraph style gets deleted, we crash on save.

Commit 3227975c0f42ff23d528f5ab94b4538c8af764c (sw: paragraph styles:
add doc model & UNO API for a linked character style, 2021-09-24) added
support for linked para/char styles, but it failed to get the lifecycle
correctly when it comes to deleting these styles.

Fix the dangling para/char style references by explicitly looking what
styles may refer to us and clear their references.

An alternative would be to clear the "link" pointer of our own "link"
pointer only, but broken documents may e.g. link multiple paragraph
styles to a single character style, so this is probably not enough.

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

diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index e08d2f5f3a3f..84571d26263a 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -36,10 +36,11 @@ class SW_DLLPUBLIC SwCharFormat final : public SwFormat
 {}
 
 public:
+~SwCharFormat();
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
-void SetLinkedParaFormat(SwTextFormatColl& rLink);
+void SetLinkedParaFormat(SwTextFormatColl* pLink);
 
 const SwTextFormatColl* GetLinkedParaFormat() const;
 };
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index b5706dc0761b..00e5208b73f4 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -103,7 +103,7 @@ public:
 inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
 SwTextFormatColl& GetNextTextFormatColl() const { return 
*mpNextTextFormatColl; }
 
-void SetLinkedCharFormat(SwCharFormat& rLink);
+void SetLinkedCharFormat(SwCharFormat* pLink);
 
 const SwCharFormat* GetLinkedCharFormat() const;
 
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 2ee2ee342bd3..8c882e906373 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -271,6 +272,35 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testCopyFlagSkipBookmarks)
 CPPUNIT_ASSERT_EQUAL(static_cast(1), nActual);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLinkedStyleDelete)
+{
+// Given a document with linked styles: myparastyle is linked to 
mycharstyle and vica versa:
+createSwDoc();
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xParaStyle(
+xFactory->createInstance("com.sun.star.style.ParagraphStyle"), 
uno::UNO_QUERY);
+uno::Reference xCharStyle(
+xFactory->createInstance("com.sun.star.style.CharacterStyle"), 
uno::UNO_QUERY);
+uno::Reference 
xParaStyles(getStyles("ParagraphStyles"),
+  uno::UNO_QUERY);
+xParaStyles->insertByName("myparastyle", uno::Any(xParaStyle));
+uno::Reference 
xCharStyles(getStyles("CharacterStyles"),
+  uno::UNO_QUERY);
+xCharStyles->insertByName("mycharstyle", uno::Any(xCharStyle));
+xParaStyle->setPropertyValue("LinkStyle", 
uno::Any(OUString("mycharstyle")));
+xCharStyle->setPropertyValue("LinkStyle", 
uno::Any(OUString("myparastyle")));
+
+// When deleting the paragraph style (and only that):
+xParaStyles->removeByName("myparastyle");
+
+// Then make sure we don't crash on save:
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("FilterName", OUString("writer8")),
+};
+xStorable->storeAsURL(maTempFile.GetURL(), aArgs);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index b2e66b7c4d31..6454a40581a2 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -113,6 +113,19 @@ SwTextFormatColl::~SwTextFormatColl()
 {
 if(m_bInSwFntCache)
 pSwFontCache->Delete( this );
+
+if (GetDoc()->IsInDtor())
+{
+return;
+}
+
+for (const auto& pCharFormat : *GetDoc()->GetCharFormats())
+{
+if 

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

2022-09-27 Thread Michael Stahl (via logerrit)
 sw/inc/crsrsh.hxx|4 ++--
 sw/inc/ndtxt.hxx |   10 ++
 sw/inc/swtypes.hxx   |   10 ++
 sw/qa/core/txtnode/txtnode.cxx   |4 ++--
 sw/source/core/crsr/annotationmark.cxx   |2 +-
 sw/source/core/crsr/crstrvl.cxx  |   27 ++-
 sw/source/core/crsr/pam.cxx  |2 +-
 sw/source/core/crsr/swcrsr.cxx   |4 ++--
 sw/source/core/crsr/viscrs.cxx   |6 +++---
 sw/source/core/doc/DocumentFieldsManager.cxx |2 +-
 sw/source/core/doc/docredln.cxx  |2 +-
 sw/source/core/edit/edfld.cxx|4 ++--
 sw/source/core/layout/flycnt.cxx |2 +-
 sw/source/core/text/itrform2.cxx |2 +-
 sw/source/core/txtnode/ndtxt.cxx |   25 ++---
 sw/source/core/txtnode/thints.cxx|2 +-
 sw/source/core/txtnode/txtedt.cxx|4 ++--
 sw/source/core/unocore/unocrsrhelper.cxx |   10 +-
 sw/source/core/unocore/unofield.cxx  |6 +++---
 sw/source/filter/basflt/fltshell.cxx |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |4 ++--
 sw/source/ui/misc/contentcontroldlg.cxx  |4 ++--
 sw/source/uibase/docvw/edtwin.cxx|6 +++---
 sw/source/uibase/shells/textfld.cxx  |2 +-
 sw/source/uibase/uno/unotxdoc.cxx|4 ++--
 sw/source/uibase/wrtsh/delete.cxx|2 +-
 26 files changed, 80 insertions(+), 72 deletions(-)

New commits:
commit 70973680f05c587c866d2de2a16bff9ebf8007ca
Author: Michael Stahl 
AuthorDate: Tue Sep 27 16:32:51 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Sep 27 21:18:19 2022 +0200

sw: fix inserting fields between 2 adjacent input fields

Primarily this is achieved by using GetTextAttrMode PARENT in
SwCursorShell::CursorInsideInputField() and
SwCursorShell::PosInsideInputField().

But this requires some refactoring to make this parameter available.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2c1001b44c50..2e9a9f0f1e62 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -719,10 +719,10 @@ public:
 
 static SwTextField* GetTextFieldAtPos(
 const SwPosition* pPos,
-const bool bIncludeInputFieldAtStart );
+::sw::GetTextAttrMode eMode);
 static SwTextField* GetTextFieldAtCursor(
 const SwPaM* pCursor,
-const bool bIncludeInputFieldAtStart );
+::sw::GetTextAttrMode eMode);
 static SwField* GetFieldAtCursor(
 const SwPaM* pCursor,
 const bool bIncludeInputFieldAtStart );
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 12b823a52f7c..a86b495515b0 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -381,12 +381,6 @@ public:
 bool DontExpandFormat( sal_Int32 nContentIdx, bool bFlag = true,
 bool bFormatToTextAttributes = true );
 
-enum GetTextAttrMode {
-DEFAULT,/// DEFAULT: (Start <= nIndex <  End)
-EXPAND, /// EXPAND : (Start <  nIndex <= End)
-PARENT, /// PARENT : (Start <  nIndex <  End)
-};
-
 /** get the innermost text attribute covering position nIndex.
 @param nWhich   only attribute with this id is returned.
 @param eModethe predicate for matching (@see GetTextAttrMode).
@@ -398,7 +392,7 @@ public:
 SwTextAttr *GetTextAttrAt(
 sal_Int32 const nIndex,
 sal_uInt16 const nWhich,
-enum GetTextAttrMode const eMode = DEFAULT ) const;
+::sw::GetTextAttrMode const eMode = ::sw::GetTextAttrMode::Default) 
const;
 
 /** get the innermost text attributes covering position nIndex.
 @param nWhich   only attributes with this id are returned.
@@ -429,7 +423,7 @@ public:
 
 SwTextField* GetFieldTextAttrAt(
 const sal_Int32 nIndex,
-const bool bIncludeInputFieldAtStart = false ) const;
+::sw::GetTextAttrMode const eMode = ::sw::GetTextAttrMode::Expand) 
const;
 
 bool Spell(SwSpellArgs*);
 bool Convert( SwConversionArgs & );
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 857165217237..55ed0c22240d 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -156,6 +156,16 @@ namespace o3tl
 template<> struct typed_flags : is_typed_flags {};
 }
 
+namespace sw {
+
+enum class GetTextAttrMode {
+Default,/// DEFAULT: (Start <= nIndex <  End)
+Expand, /// EXPAND : (Start <  nIndex <= End)
+Parent, /// PARENT : (Start <  nIndex <  End)
+};
+
+} // namespace sw
+
 constexpr bool SW_ISPRINTABLE(sal_Unicode c) { return c >= ' ' && 127 != c; }
 
 #define CHAR_HARDBLANK  u'\x00A0'
diff --git 

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

2022-09-20 Thread Justin Luth (via logerrit)
 sw/inc/fmtautofmt.hxx |2 -
 sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc |binary
 sw/qa/extras/ww8export/ww8export4.cxx |7 
 sw/source/core/text/txtfld.cxx|5 +--
 sw/source/filter/ww8/ww8par.cxx   |   23 ++
 5 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 6e1c8bcec511444d2d51c5c5143be56d1900e5e6
Author: Justin Luth 
AuthorDate: Sat Sep 3 08:37:19 2022 -0400
Commit: Michael Stahl 
CommitDate: Tue Sep 20 10:53:01 2022 +0200

tdf#150613 sw: better DOC import of paragraph marker formatting

Following the lead of LO 6.4
commit 5ba30f588d6e41a13d68b1461345fca7a7ca61ac.

This fixes a LO 7.2 regression from tdf#108518.
This patch depends on tdf#117994 being fixed in order
for ww8export3's testTdf108518_CRnumformatting to round-trip.

The problem here is that Word allows formatting the paragraph end
marker, and applies the same formatting to the generated numbering
string; Writer has no such marker thing.

On m_xCtrlStck, the rPos is pointing to the end of the paragraph.
GetStackAttr looks for char properties that are still m_bOpen
or else where the Point (Mark is the Start, Point is the End)
is greater than aPos. Well, at the end of the paragraph
I don't think there can be any empty (point==mark) hints in .DOC,
so this should only pick up properties that are spilling
over onto the CR - just like we want.

Change-Id: I06cab075f102d40f93d33fedf5ae0ce8e165e9fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139329
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Michael Stahl 

diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx
index 5773bffd5329..f4ac2fae7035 100644
--- a/sw/inc/fmtautofmt.hxx
+++ b/sw/inc/fmtautofmt.hxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 
-class SAL_DLLPUBLIC_RTTI SwFormatAutoFormat final : public SfxPoolItem
+class SW_DLLPUBLIC SwFormatAutoFormat final : public SfxPoolItem
 {
 std::shared_ptr mpHandle;
 
diff --git a/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc 
b/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc
new file mode 100644
index ..99744382a82b
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf117994_CRnumformatting.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index e6d1d27f53a4..22ed17e6f849 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -64,6 +64,13 @@ DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, 
"tdf150197_anlv2ListFormat
  getProperty(getParagraph(4), 
"ListLabelString"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf117994_CRnumformatting, 
"tdf117994_CRnumformatting.doc")
+{
+CPPUNIT_ASSERT_EQUAL(OUString("1."), 
parseDump("//body/txt[1]/Special[@nType='PortionType::Number']", "rText"));
+//Without this fix in place, it would become 200 (and non-bold).
+CPPUNIT_ASSERT_EQUAL(OUString("160"), 
parseDump("//body/txt[1]/Special[@nType='PortionType::Number']", "nHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 22875f247210..22127dd30e21 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -432,9 +432,10 @@ static void 
checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
 SwFormatAutoFormat const& 
rListAutoFormat(rInf.GetTextFrame()->GetTextNodeForParaProps()->GetAttr(RES_PARATR_LIST_AUTOFMT));
 std::shared_ptr pSet(rListAutoFormat.GetStyleHandle());
 
-// TODO remove this fallback (for WW8/RTF)
+// TODO remove this fallback for RTF
+bool isDOC = pIDSA->get(DocumentSettingId::ADD_FLY_OFFSETS);
 bool isDOCX = pIDSA->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
-if (!isDOCX && !pSet)
+if (!isDOC && !isDOCX && !pSet)
 {
 TextFrameIndex const 
nTextLen(rInf.GetTextFrame()->GetText().getLength());
 SwTextNode const* pNode(nullptr);
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 77805814fc46..82dec7f3105d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -103,6 +103,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "sprmids.hxx"
 
@@ -121,6 +122,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2423,6 +2425,27 @@ void SwWW8ImplReader::AppendTextNode(SwPosition& rPos)
 if (pText != nullptr)
 pRule = sw::util::GetNumRuleFromTextNode(*pText);
 
+// tdf#64222 / tdf#150613 filter out the "paragraph marker" formatting and
+// set it as a separate paragraph property, just like we do for DOCX.
+// This is only being used for 

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

2022-09-19 Thread Miklos Vajna (via logerrit)
 sw/inc/txatbase.hxx   |2 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   43 ---
 sw/source/filter/ww8/attributeoutputbase.hxx  |8 --
 sw/source/filter/ww8/docxattributeoutput.cxx  |   86 +++---
 sw/source/filter/ww8/docxattributeoutput.hxx  |   11 --
 sw/source/filter/ww8/docxexport.cxx   |2 
 sw/source/filter/ww8/rtfattributeoutput.cxx   |3 
 sw/source/filter/ww8/rtfattributeoutput.hxx   |3 
 sw/source/filter/ww8/wrtw8nds.cxx |   29 +--
 sw/source/filter/ww8/ww8atr.cxx   |4 -
 sw/source/filter/ww8/ww8attributeoutput.hxx   |2 
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 ++
 writerfilter/source/dmapper/SdtHelper.hxx |4 -
 14 files changed, 93 insertions(+), 127 deletions(-)

New commits:
commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a
Author: Miklos Vajna 
AuthorDate: Mon Sep 19 10:01:36 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 19 11:31:05 2022 +0200

sw content controls, plain text: enable DOCX filter with data binding

- writerfilter/ had explicit code to not map plain text SDT to Writer 
content
  controls if it has data bindings specified, lift this limitation and set 
the
  value of content control from data binding, like Word does and Writer did 
it
  for input fields since b5c616d10bff3213840d4893d13b4493de71fa56 
(tdf#104823:
  support for sdt plain text fields, 2021-11-24)

- call DocxExport::AddSdtData() on the export side to do the opposite on 
export

- give up on the idea to export content controls to DOCX by finding the text
  attribute in SwWW8AttrIter::OutAttrWithRange(): this needs buffering in 
both
  directions (need to start the SDT before the start of the run, need to 
end it
  after the end of the run), and solving this using marks and merges at a
  fast-serializer level looks like hacks on top of hacks. To be more 
specific,
  CppunitTest_sw_ooxmlexport7's testSdtAndShapeOverlapping seems to be very 
hard
  to fix with this design

- instead, give not only the start position but also the length of the run 
to
  DocxAttributeOutput::EndRun(), which has random access to the doc model 
and can
  look up if there is a content control start or end that needs writing at 
the
  current position of the XML output, without any buffering, which also
  means less code

- adapt CppunitTest_sw_ooxmlfieldexport's testSdtBeforeField, which didn't 
like
  the empty run at the start of content controls, which seems to be harmless
  otherwise

- fix CppunitTest_sw_ooxmlfieldexport 
CPPUNIT_TEST_NAME=testSdtDateDuplicate by
  disabling the "set content control value from data binding" logic for date
  pickers because that logic in writerfilter/ sets the value as-is and it 
has to
  consider the requested date format before this can be enabled

As a side effect, this gives PDF export for plain text SDTs, even if they 
have
data binding set. CppunitTest_sw_ooxmlfieldexport's testTdf104823 is now
updated to ensure that we import such SDTs as Writer content controls.

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

diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 183e254f8817..00e2f9b51470 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -132,7 +132,7 @@ public:
 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
-class SAL_DLLPUBLIC_RTTI SwTextAttrEnd : public virtual SwTextAttr
+class SW_DLLPUBLIC SwTextAttrEnd : public virtual SwTextAttr
 {
 protected:
 sal_Int32 m_nEnd;
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 073918d31c48..f5db919b4c7e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -596,7 +596,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBeforeField)
 loadAndReload("sdt-before-field.docx");
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 // Make sure the field doesn't sneak inside the SDT: the SDT should 
contain only a single run (there were 6 ones).
-assertXPath(pXmlDoc, "//w:sdt/w:sdtContent/w:r", 1);
+assertXPath(pXmlDoc, "//w:p/w:sdt/w:sdtContent/w:r/w:t", 1);
+assertXPath(pXmlDoc, "//w:p/w:r/w:fldChar", 3);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testfdo81946)
@@ -901,36 +902,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf104823.docx";
 loadURL(aURL, nullptr);
 
-css::uno::Reference xTextFieldsSupplier(
-mxComponent, css::uno::UNO_QUERY_THROW);
-auto 

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

2022-09-12 Thread Miklos Vajna (via logerrit)
 sw/inc/formatcontentcontrol.hxx   |2 
 sw/qa/core/text/text.cxx  |   33 +
 sw/source/core/text/itrform2.cxx  |   89 +-
 sw/source/core/txtnode/attrcontentcontrol.cxx |   30 
 4 files changed, 152 insertions(+), 2 deletions(-)

New commits:
commit 82d90529dc2b3cb8359dec78852cbd910a66d275
Author: Miklos Vajna 
AuthorDate: Mon Sep 12 09:30:38 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 12 10:16:11 2022 +0200

sw content controls, rich text: add initial PDF export

Similar to how such form widgets are emitted for form shapes in

drawinglayer::processor2d::VclMetafileProcessor2D::processControlPrimitive2D().

This is just initial support for rich and plain text, the other types
from SwContentControlType are not yet handled.

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

diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index d265d2f098e9..fa7c237acaf7 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -317,6 +317,8 @@ public:
 void SetReadWrite(bool bReadWrite) { m_bReadWrite = bReadWrite; }
 
 bool GetReadWrite() const { return m_bReadWrite; }
+
+SwContentControlType GetType() const;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 50739240ad70..0e832f074cd9 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/text/data/";
 
@@ -623,6 +624,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf43100_CursorMoveToSpacesOverMargin)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF)
+{
+// Given a file with a content control:
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
+
+// When exporting to PDF:
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+xStorable->storeToURL(maTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+
+// Then make sure that a fillable form widget is emitted:
+SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
+SvMemoryStream aMemory;
+aMemory.WriteStream(aFile);
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+{
+return;
+}
+std::unique_ptr pPdfDocument
+= pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// i.e. the content control was just exported as normal text.
+CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 6c38bdbe3586..5073e826457b 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -55,8 +55,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -872,9 +874,13 @@ public:
 /// A content control portion is a text portion that is inside 
RES_TXTATR_CONTENTCONTROL.
 class SwContentControlPortion : public SwTextPortion
 {
+SwTextContentControl* m_pTextContentControl;
 public:
-SwContentControlPortion() { SetWhichPor(PortionType::ContentControl); }
+SwContentControlPortion(SwTextContentControl* pTextContentControl);
 virtual void Paint(const SwTextPaintInfo& rInf) const override;
+
+/// Emits a PDF form widget for this portion on success, does nothing on 
failure.
+bool DescribePDFControl(const SwTextPaintInfo& rInf) const;
 };
 }
 
@@ -892,11 +898,78 @@ void SwMetaPortion::Paint( const SwTextPaintInfo  ) 
const
 }
 }
 
+SwContentControlPortion::SwContentControlPortion(SwTextContentControl* 
pTextContentControl)
+: m_pTextContentControl(pTextContentControl)
+{
+SetWhichPor(PortionType::ContentControl);
+}
+
+bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) 
const
+{
+auto pPDFExtOutDevData = 
dynamic_cast(rInf.GetOut()->GetExtOutDevData());
+if (!pPDFExtOutDevData)
+{
+return false;
+}
+
+if (!pPDFExtOutDevData->GetIsExportFormFields())
+{
+return false;
+}
+
+if (!m_pTextContentControl)
+{
+return false;
+}
+
+const SwFormatContentControl& 

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

2022-09-09 Thread László Németh (via logerrit)
 sw/inc/doc.hxx  |4 +++-
 sw/qa/extras/uiwriter/uiwriter5.cxx |   29 +
 sw/source/core/doc/tblrwcl.cxx  |2 +-
 sw/source/core/docnode/ndtbl1.cxx   |   35 ---
 4 files changed, 53 insertions(+), 17 deletions(-)

New commits:
commit d011ae00cbfa714b9b2b4e8ca64fa18896ecde4d
Author: László Németh 
AuthorDate: Wed Sep 7 15:22:37 2022 +0200
Commit: László Németh 
CommitDate: Fri Sep 9 08:38:34 2022 +0200

tdf#150876 sw: track new rows inserted after a tracked row insertion

New row insertions after an already tracked row insertion
weren't tracked.

Regression from commit b251228d2e5e2832e0a617213173e8841f5b7428
"tdf#150666 sw: allow to delete tracked table row insertions"

Follow-up to commit dbc82c02eb24ec1c97c6ee32069771d8deb394f9
"tdf#143358 sw: track insertion of empty table rows".

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 978e95d38737..4ee71e762d30 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1493,7 +1493,9 @@ public:
 static bool GetRowBackground( const SwCursor& rCursor, 
std::unique_ptr& rToFill );
 /// rNotTracked = false means that the row was deleted or inserted with 
its tracked cell content
 /// bAll: delete all table rows without selection
-void SetRowNotTracked( const SwCursor& rCursor, const SvxPrintItem 
, bool bAll = false );
+/// bIns: insert table row
+void SetRowNotTracked( const SwCursor& rCursor,
+const SvxPrintItem , bool bAll = false, 
bool bIns = false );
 /// don't call SetRowNotTracked() for rows with tracked row change
 static bool HasRowNotTracked( const SwCursor& rCursor );
 void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index ea2542a40044..1ea8b51bb80e 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2086,6 +2086,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666_regression)
+{
+// load a table with tracked insertion of an empty row
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-rowadd.docx");
+
+// check table count
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+// check table row count
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+
+// select the second row (tracked table row insertion)
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Down(/*bSelect=*/false);
+
+// insert a new table row with track changes
+dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+
+// This was 4 (the inserted table row wasn't tracked)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144748)
 {
 // load a table with an empty row, and an empty line before the table
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index a665016a6f07..d45457e138d7 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -598,7 +598,7 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& 
rBoxes,
 SwPaM aPaM(*pNewTableLine->GetTabBoxes()[0]->GetSttNd(), 
SwNodeOffset(1));
 pDoc->getIDocumentContentOperations().InsertString( aPaM,
 OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) );
-pDoc->SetRowNotTracked( aCursor, aSetTracking );
+pDoc->SetRowNotTracked( aCursor, aSetTracking, /*bAll=*/false, 
/*bIns=*/true );
 }
 }
 }
diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 0f1dac38ea25..53d925912d25 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -578,7 +578,8 @@ bool SwDoc::HasRowNotTracked( const SwCursor& rCursor )
 return false;
 }
 
-void SwDoc::SetRowNotTracked( const SwCursor& rCursor, const SvxPrintItem 
, bool bAll )
+void SwDoc::SetRowNotTracked( const SwCursor& rCursor,
+ const SvxPrintItem , bool bAll, bool 
bIns )
 {
 

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

2022-09-08 Thread Miklos Vajna (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |3 +-
 sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx   |binary
 sw/qa/core/doc/doc.cxx  |   16 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   16 ---
 sw/source/core/doc/docdesc.cxx  |4 +-
 sw/source/core/doc/docfmt.cxx   |2 -
 sw/source/core/inc/DocumentContentOperationsManager.hxx |2 -
 sw/source/core/unocore/unotext.cxx  |   22 +---
 writerfilter/source/dmapper/PropertyMap.cxx |   11 
 9 files changed, 64 insertions(+), 12 deletions(-)

New commits:
commit 3ec224dcb15e0e663ba85077b8ea0e632f8f03f8
Author: Miklos Vajna 
AuthorDate: Thu Sep 8 16:41:46 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 8 17:46:05 2022 +0200

DOCX import: avoid duplicated bookmarks in copied header/footer text

In case a DOCX document has 2 sections and the 2nd section has a linked
header, writerfilter/ copies the header text from the 1st page style to
the 2nd page style. This leads to duplicated bookmarks in the doc model,
which causes an unexpected increase in bookmark count on export.

This went wrong with 8885bdf2f564bb7b56181c50baf39ff99d551ec9
(tdf#128106 sw: copy bookmarks at start if whole node is copied,
2021-08-27), previously at least bookmarks at the start of the header
were not duplicated, though that was also inconsistent, since other
bookmarks were still duplicated. Interestingly the DOC import doesn't
have this problem, because it first copies header text and only later
imports the bookmarks.

Fix the problem by introducing a new SwCopyFlags::SkipBookmarks flag,
add UNO API to set this from writerfilter/ code and skip copying
bookmarks (but not other marks) in sw::CopyBookmarks() accordingly.
Copying other marks is still needed, because e.g. fieldmarks have a mark
and a field, and it would be inconsistent to copy the field, but not the
mark.

Note that the text is still duplicated in header/footer, linked
header/footer is a missing feature on the Writer side.

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

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index 5a95d0ba95b8..60d45d47a0a3 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -75,11 +75,12 @@ enum class SwCopyFlags
 CopyAll = (1<<0), ///< copy break attributes even when source is 
single node
 CheckPosInFly   = (1<<1), ///< check if target position is in fly anchored 
at source range
 IsMoveToFly = (1<<2), ///< MakeFlyAndMove
+SkipBookmarks   = (1<<3), ///< skip bookmarks, but not other kind of marks
 // TODO: mbCopyIsMove? mbIsRedlineMove?
 };
 namespace o3tl
 {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 enum class SwDeleteFlags
diff --git a/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
b/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx
new file mode 100644
index ..3fb27b430a17
Binary files /dev/null and b/sw/qa/core/doc/data/copy-flag-skip-bookmarks.docx 
differ
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 87bfd2697621..2ee2ee342bd3 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -255,6 +255,22 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testContentControlDelete)
 CPPUNIT_ASSERT_EQUAL(OUString("\x0001test\x0001"), pTextNode->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyFlagSkipBookmarks)
+{
+// Given a document with a bookmark in a header that is linked later:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "copy-flag-skip-bookmarks.docx");
+
+// When checking the # of bookmarks in the resulting doc model:
+sal_Int32 nActual = pDoc->getIDocumentMarkAccess()->getAllMarksCount();
+
+// Then make sure we have a single bookmark, with no duplications:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 2
+// i.e. the 2nd header had a duplicated bookmark.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index c642cde1c8c7..62c362eba181 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -232,7 +232,7 @@ namespace
 namespace sw
 {
 // TODO: use SaveBookmark (from DelBookmarks)
-void CopyBookmarks(const SwPaM& rPam, 

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

2022-08-25 Thread Justin Luth (via logerrit)
 sw/inc/IDocumentContentOperations.hxx   |1 +
 sw/qa/extras/uiwriter/uiwriter3.cxx |   11 ---
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   11 +++
 sw/source/core/inc/DocumentContentOperationsManager.hxx |1 +
 sw/source/uibase/wrtsh/wrtsh1.cxx   |2 +-
 5 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 3e3328987b69a2a549d24c79ee71b353b9a3e288
Author: Justin Luth 
AuthorDate: Thu Aug 25 05:51:11 2022 -0400
Commit: Justin Luth 
CommitDate: Thu Aug 25 21:04:38 2022 +0200

tdf#109285 sw numbering: RemoveLeadingWhiteSpace from all paras

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

diff --git a/sw/inc/IDocumentContentOperations.hxx 
b/sw/inc/IDocumentContentOperations.hxx
index bac97d685927..94bb7102dee0 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -250,6 +250,7 @@ public:
 /** Removes any leading white space from the paragraph
 */
 virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
+virtual void RemoveLeadingWhiteSpace(SwPaM& rPaM) = 0;
 
 protected:
 virtual ~IDocumentContentOperations() {};
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 8b661082e8ba..062fb0acc195 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -4587,15 +4587,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899)
 IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations());
 
 // Create an Ordered List
-rIDCO.InsertString(*pCursor, "a");
+rIDCO.InsertString(*pCursor, "\ta");
 pWrtShell->SplitNode();
-rIDCO.InsertString(*pCursor, "b");
+rIDCO.InsertString(*pCursor, "   b");
 pWrtShell->SplitNode();
-rIDCO.InsertString(*pCursor, "c");
+rIDCO.InsertString(*pCursor, "  \t  c");
 
 dispatchCommand(mxComponent, ".uno:SelectAll", {});
 dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
 
+// tdf#109285: RemoveLeadingWhiteSpace from all numbered paragraphs
+getParagraph(1, "a");
+getParagraph(2, "b");
+getParagraph(3, "c");
+
 // Save it as DOCX & load it again
 reload("Office Open XML Text", "tdf97899-tmp.docx");
 uno::Reference xNumberingRules
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d751ac3d19f9..59bfafb5d313 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3616,6 +3616,17 @@ void 
DocumentContentOperationsManager::RemoveLeadingWhiteSpace(const SwPosition
 }
 }
 
+void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(SwPaM& rPaM )
+{
+for (SwPaM& rSel :rPaM.GetRingContainer())
+{
+SwNodeOffset nStt = rSel.Start()->nNode.GetIndex();
+SwNodeOffset nEnd = rSel.End()->nNode.GetIndex();
+for (SwNodeOffset nPos = nStt; nPos<=nEnd; nPos++)
+RemoveLeadingWhiteSpace(SwPosition(rSel.GetBound().GetNodes(), 
nPos));
+}
+}
+
 // Copy method from SwDoc - "copy Flys in Flys"
 /// note: rRg/rInsPos *exclude* a partially selected start text node;
 ///   pCopiedPaM *includes* a partially selected start text node
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx 
b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index decc16c14648..6b45e6ca01ae 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -96,6 +96,7 @@ public:
 SwRootFrame const* pLayout = nullptr) override;
 
 void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
+void RemoveLeadingWhiteSpace(SwPaM& rPaM) override;
 
 
 //Non-Interface methods
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 6606b65ff49f..5b6649861a74 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1549,7 +1549,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
 const SwTwips nWidthOfTabs = pTextNode
  ? pTextNode->GetWidthOfLeadingTabs()
  : 0;
-GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace( 
*GetCursor()->GetPoint() );
+
GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace(*GetCursor());
 
 const bool bHtml = dynamic_cast( pDocSh ) !=  nullptr;
 const bool bRightToLeft = IsInRightToLeftText();


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

2022-08-24 Thread Noel Grandin (via logerrit)
 sw/inc/flypos.hxx   |   22 --
 sw/qa/extras/ww8export/ww8export.cxx|4 ++--
 sw/qa/extras/ww8import/ww8import.cxx|8 
 sw/source/core/doc/DocumentDrawModelManager.cxx |4 ++--
 sw/source/core/doc/doclay.cxx   |   10 +-
 sw/source/core/layout/flypos.cxx|   24 +++-
 sw/source/core/unocore/unoobj2.cxx  |4 ++--
 sw/source/filter/html/htmlfly.cxx   |2 +-
 sw/source/filter/html/htmlflywriter.cxx |6 +++---
 sw/source/filter/ww8/writerhelper.cxx   |6 +++---
 10 files changed, 37 insertions(+), 53 deletions(-)

New commits:
commit 3369a24c48781fd5b8afe9bb707f92588825f6c3
Author: Noel Grandin 
AuthorDate: Wed Aug 24 21:03:01 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 25 07:57:57 2022 +0200

Use SwNode instead of SwNodeIndex in SwPosFlyFrame

part of hiding the internals of SwPosition.

Also
(*) Just define the whole class in the header, it is a
dead simple data carrier.
Then the virtual destructor and the SAL_DLLPUBLIC_RTTI
becomes unnecessary.
(*) No need to use shared_ptr, these are never
shared, the call sites read the data and then discard
them.

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

diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx
index fc098c4ffaab..d04ff03bff24 100644
--- a/sw/inc/flypos.hxx
+++ b/sw/inc/flypos.hxx
@@ -24,31 +24,25 @@
 #include 
 
 class SwFrameFormat;
-class SwNodeIndex;
+class SwNode;
 
 /// For querying current flys in document.
-class SAL_DLLPUBLIC_RTTI SwPosFlyFrame final
+class SwPosFlyFrame final
 {
 const SwFrameFormat* m_pFrameFormat;///< FlyFrameFormat
-SwNodeIndex* m_pNodeIndex;///< Index for node is sufficient.
+const SwNode* m_pNode;
 sal_uInt32 m_nOrdNum;
+
 public:
-SwPosFlyFrame( const SwNodeIndex& , const SwFrameFormat*, sal_uInt16 
nArrPos );
-virtual ~SwPosFlyFrame(); ///< Virtual for Writer (DLL !!)
+SwPosFlyFrame(const SwNode& rNd, const SwFrameFormat* pFormat, sal_uInt16 
nArrPos);
 
 const SwFrameFormat& GetFormat() const { return *m_pFrameFormat; }
-const SwNodeIndex& GetNdIndex() const { return *m_pNodeIndex; }
+const SwNode& GetNode() const { return *m_pNode; }
 sal_uInt32 GetOrdNum() const { return m_nOrdNum; }
 };
 
-// define needed classes to safely handle an array of allocated 
SwPosFlyFrame(s).
-// SwPosFlyFrames can be handled by value (as return value), only refcounts to
-// contained SwPosFlyFrame* will be copied. When releasing the last 
SwPosFlyFramePtr
-// instance the allocated instance will be freed. The array is sorted by
-// GetNdIndex by using a std::set container.
-typedef std::shared_ptr< SwPosFlyFrame > SwPosFlyFramePtr;
-struct SwPosFlyFrameCmp { bool operator()(const SwPosFlyFramePtr& rA, const 
SwPosFlyFramePtr& rB) const; };
-typedef std::set< SwPosFlyFramePtr, SwPosFlyFrameCmp > SwPosFlyFrames;
+struct SwPosFlyFrameCmp { bool operator()(const SwPosFlyFrame& rA, const 
SwPosFlyFrame& rB) const; };
+typedef std::set< SwPosFlyFrame, SwPosFlyFrameCmp > SwPosFlyFrames;
 
 #endif // INCLUDED_SW_INC_FLYPOS_HXX
 
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 998b67971e3f..802717ad1ed5 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -809,9 +809,9 @@ DECLARE_WW8EXPORT_TEST(testTdf122425_2, "tdf122425_2.doc")
 SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false);
 // There is one fly frame in the document: the text box
 CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size());
-for (const auto& rPosFlyFrame : aPosFlyFrames)
+for (const SwPosFlyFrame& rPosFlyFrame : aPosFlyFrames)
 {
-const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat();
+const SwFrameFormat& rFormat = rPosFlyFrame.GetFormat();
 const SfxPoolItem* pItem = nullptr;
 
 // Check for correct explicitly-set values of UL spacings. Previously 
this was "DEFAULT",
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index ab35fa9d7346..c41b86d2f8e2 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -156,9 +156,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121734)
 SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false);
 // There is only one fly frame in the document: the one with the imported 
floating table
 CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size());
-for (const auto& rPosFlyFrame : aPosFlyFrames)
+for (const SwPosFlyFrame& rPosFlyFrame : aPosFlyFrames)
 {
-const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat();
+const 

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

2022-08-23 Thread Michael Stahl (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx|2 +-
 sw/inc/crsrsh.hxx |2 +-
 sw/inc/pam.hxx|2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |4 ++--
 sw/source/core/crsr/crsrsh.cxx|8 
 sw/source/core/crsr/pam.cxx   |4 ++--
 sw/source/core/doc/docbm.cxx  |9 ++---
 sw/source/core/edit/eddel.cxx |2 +-
 sw/source/core/edit/edfcol.cxx|2 +-
 sw/source/core/inc/MarkManager.hxx|2 +-
 10 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 27892a5e12dada80226f778ab2bd14b1bdaab58a
Author: Michael Stahl 
AuthorDate: Mon Aug 22 15:29:58 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Aug 23 10:25:09 2022 +0200

sw: enable Replace with Protect Bookmarks

The dialog calls Replace on the whole bookmark, and with commit
7974cea6c788e02d7c36573e2d10dcc51884f70e the bookmark is preserved, so
the HasReadonlySel() should not prevent this replace from happening.

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 98037c7917e3..ca63a45c7ce8 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -282,7 +282,7 @@ class IDocumentMarkAccess
 // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, 
CROSSREF_HEADING_BOOKMARK )
 
 /** check if the selection would delete a BOOKMARK */
-virtual bool isBookmarkDeleted(SwPaM const& rPaM) const =0;
+virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) 
const =0;
 
 /** returns a STL-like random access iterator to the begin of the 
sequence the IBookmarks.
 */
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 306acf96f3fc..d552cba2b503 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -477,7 +477,7 @@ public:
 
 // Cursor is placed in something that is protected or selection contains
 // something that is protected.
-bool HasReadonlySel() const;
+bool HasReadonlySel(bool isReplace = false) const;
 
 // Can the cursor be set to read only ranges?
 bool IsReadOnlyAvailable() const { return m_bSetCursorInReadOnly; }
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index a56677cfaa5a..7002d07a017d 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -304,7 +304,7 @@ public:
 
 /** Is in something protected (readonly) or selection contains
something protected. */
-bool HasReadonlySel( bool bFormView ) const;
+bool HasReadonlySel(bool bFormView, bool isReplace) const;
 
 bool ContainsPosition(const SwPosition & rPos) const
 {
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index d34e5ce957f0..4e3812960d90 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1262,11 +1262,11 @@ CPPUNIT_TEST_FIXTURE(Test, 
tdf122201_editUnprotectedText)
 
 // check protected area
 SwPaM aPaMProtected(aDocStart);
-CPPUNIT_ASSERT(aPaMProtected.HasReadonlySel(false));
+CPPUNIT_ASSERT(aPaMProtected.HasReadonlySel(false, false));
 
 // check unprotected area
 SwPaM aPaMUnprotected(aDocEnd);
-CPPUNIT_ASSERT(!aPaMUnprotected.HasReadonlySel(false));
+CPPUNIT_ASSERT(!aPaMUnprotected.HasReadonlySel(false, false));
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testSectionHeader)
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 17718f8357b6..c37595430761 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2743,7 +2743,7 @@ bool SwCursorShell::IsOverReadOnlyPos( const Point& rPt ) 
const
 SwPaM aPam( *m_pCurrentCursor->GetPoint() );
 GetLayout()->GetModelPositionForViewPoint( aPam.GetPoint(), aPt );
 // form view
-return aPam.HasReadonlySel( GetViewOptions()->IsFormView() );
+return aPam.HasReadonlySel(GetViewOptions()->IsFormView(), false);
 }
 
 /** Get the number of elements in the ring of cursors
@@ -3356,7 +3356,7 @@ void SwCursorShell::SetReadOnlyAvailable( bool bFlag )
 }
 }
 
-bool SwCursorShell::HasReadonlySel() const
+bool SwCursorShell::HasReadonlySel(bool const isReplace) const
 {
 if (GetViewOptions()->IsShowOutlineContentVisibilityButton())
 {
@@ -3393,13 +3393,13 @@ bool SwCursorShell::HasReadonlySel() const
 if ( m_pTableCursor != nullptr )
 {
 bRet = m_pTableCursor->HasReadOnlyBoxSel()
-   || m_pTableCursor->HasReadonlySel( 
GetViewOptions()->IsFormView() );
+   || 
m_pTableCursor->HasReadonlySel(GetViewOptions()->IsFormView(), isReplace);
 }
 else
 {
 for(const SwPaM& rCursor : m_pCurrentCursor->GetRingContainer())
  

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

2022-08-17 Thread László Németh (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |5 +
 sw/qa/extras/layout/data/tdf150200.docx   |binary
 sw/qa/extras/layout/data/tdf150200.odt|binary
 sw/qa/extras/layout/data/tdf150438.docx   |binary
 sw/qa/extras/layout/data/tdf150438.odt|binary
 sw/qa/extras/layout/layout2.cxx   |   88 ++
 sw/source/core/doc/DocumentSettingManager.cxx |   10 ++
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/txtdrop.cxx   |   14 
 sw/source/filter/xml/xmlimp.cxx   |   12 +++
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   30 ++--
 writerfilter/source/filter/WriterFilter.cxx   |1 
 12 files changed, 152 insertions(+), 9 deletions(-)

New commits:
commit a18a74d6762e56a20093ca51cfd12925697c2524
Author: László Németh 
AuthorDate: Tue Aug 16 11:00:54 2022 +0200
Commit: László Németh 
CommitDate: Wed Aug 17 18:07:24 2022 +0200

tdf#150200 tdf#150438 sw, DOCX: fix drop cap dash, quotation etc.

In drop cap layout, set smaller size for all glyphs positioned
over the baseline, e.g. dashes (dash, en-dash, em-dash, figure dash),
bullet, asterisks and quotation marks by extending the bounding box
of the glyph to the baseline, like MSO does.

Add "DropCapPunctuation", a new default compatibility option for this.
Only old ODT files loads the old layout (which was partially broken:
e.g. dashes were too long, often missing from the drop cap area or
the drop cap was disabled). New ODT and imported DOCX documents
use the new default layout for better typesetting and interoperability.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 548419576168..1f81ead70645 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -123,7 +123,10 @@ enum class DocumentSettingId
 // docx enable this flag. For details see ticket tdf#100680.
 WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
 // Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
-NO_NUMBERING_SHOW_FOLLOWBY
+NO_NUMBERING_SHOW_FOLLOWBY,
+// drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
+// by extending the rounding box of the glyph to the baseline
+DROP_CAP_PUNCTUATION
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/extras/layout/data/tdf150200.docx 
b/sw/qa/extras/layout/data/tdf150200.docx
new file mode 100644
index ..8f3a57d764b9
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150200.docx differ
diff --git a/sw/qa/extras/layout/data/tdf150200.odt 
b/sw/qa/extras/layout/data/tdf150200.odt
new file mode 100644
index ..224d5c4c4b3e
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150200.odt differ
diff --git a/sw/qa/extras/layout/data/tdf150438.docx 
b/sw/qa/extras/layout/data/tdf150438.docx
new file mode 100644
index ..87aa1c5f6de2
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150438.docx differ
diff --git a/sw/qa/extras/layout/data/tdf150438.odt 
b/sw/qa/extras/layout/data/tdf150438.odt
new file mode 100644
index ..5634ab91adb4
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf150438.odt differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 09e113fc4ed0..eafb21646cdf 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2009,6 +2009,94 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf118672)
 "setetur");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150200)
+{
+createSwDoc(DATA_DIRECTORY, "tdf150200.odt");
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// dash
+OUString sFirstLine = 
parseDump("/root/page/body/txt[1]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"-(dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(93), sFirstLine.getLength());
+// en-dash
+sFirstLine = parseDump("/root/page/body/txt[2]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"–(en-dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(88), sFirstLine.getLength());
+// em-dash
+sFirstLine = parseDump("/root/page/body/txt[3]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"—(em-dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(77), sFirstLine.getLength());
+// figure dash
+sFirstLine = parseDump("/root/page/body/txt[4]/LineBreak[1]/@Line");
+CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‒(figure dash)"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(87), sFirstLine.getLength());
+}
+
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150200_DOCX)
+{
+createSwDoc(DATA_DIRECTORY, 

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

2022-08-14 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx   |6 +---
 sw/inc/unocrsrhelper.hxx |4 +--
 sw/qa/core/uwriter.cxx   |   18 +++---
 sw/qa/extras/uiwriter/uiwriter.cxx   |4 +--
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   12 -
 sw/qa/extras/uiwriter/uiwriter4.cxx  |4 +--
 sw/source/core/crsr/callnk.cxx   |2 -
 sw/source/core/crsr/crsrsh.cxx   |   28 +++---
 sw/source/core/crsr/crstrvl.cxx  |4 +--
 sw/source/core/crsr/findattr.cxx |   10 
 sw/source/core/crsr/findfmt.cxx  |2 -
 sw/source/core/crsr/findtxt.cxx  |4 +--
 sw/source/core/crsr/pam.cxx  |2 -
 sw/source/core/crsr/swcrsr.cxx   |   38 +++
 sw/source/core/crsr/trvltbl.cxx  |2 -
 sw/source/core/doc/docbm.cxx |4 +--
 sw/source/core/doc/doccomp.cxx   |6 ++--
 sw/source/core/doc/docglos.cxx   |2 -
 sw/source/core/doc/docredln.cxx  |8 +++---
 sw/source/core/doc/docsort.cxx   |4 +--
 sw/source/core/docnode/ndtbl.cxx |2 -
 sw/source/core/docnode/ndtbl1.cxx|   14 +--
 sw/source/core/edit/acorrect.cxx |2 -
 sw/source/core/edit/eddel.cxx|4 +--
 sw/source/core/edit/edfcol.cxx   |2 -
 sw/source/core/edit/edfmt.cxx|2 -
 sw/source/core/edit/edglss.cxx   |6 ++--
 sw/source/core/edit/edlingu.cxx  |2 -
 sw/source/core/edit/edtab.cxx|2 -
 sw/source/core/frmedt/fecopy.cxx |2 -
 sw/source/core/frmedt/fedesc.cxx |4 +--
 sw/source/core/frmedt/fefly1.cxx |2 -
 sw/source/core/frmedt/fews.cxx   |4 +--
 sw/source/core/frmedt/tblsel.cxx |   26 ++---
 sw/source/core/layout/layact.cxx |2 -
 sw/source/core/layout/trvlfrm.cxx|6 ++--
 sw/source/core/table/swnewtable.cxx  |2 -
 sw/source/core/undo/undobj.cxx   |6 ++--
 sw/source/core/undo/unins.cxx|8 +++---
 sw/source/core/undo/unredln.cxx  |   10 
 sw/source/core/undo/untbl.cxx|2 -
 sw/source/core/undo/untblk.cxx   |2 -
 sw/source/core/unocore/unocrsr.cxx   |8 +++---
 sw/source/core/unocore/unocrsrhelper.cxx |6 ++--
 sw/source/core/unocore/unoobj.cxx|   12 -
 sw/source/core/unocore/unoparagraph.cxx  |2 -
 sw/source/core/unocore/unoportenum.cxx   |2 -
 sw/source/core/view/vprint.cxx   |8 --
 sw/source/filter/basflt/shellio.cxx  |2 -
 sw/source/filter/html/htmlgrin.cxx   |2 -
 sw/source/filter/html/swhtml.cxx |6 ++--
 sw/source/filter/ww8/wrtw8sty.cxx|2 -
 sw/source/filter/ww8/ww8par.cxx  |   12 -
 sw/source/filter/ww8/ww8par2.cxx |8 +++---
 sw/source/filter/xml/swxml.cxx   |   10 
 sw/source/filter/xml/xmlimp.cxx  |2 -
 sw/source/uibase/docvw/edtwin.cxx|4 +--
 sw/source/uibase/uiview/viewling.cxx |4 +--
 sw/source/uibase/uno/unotxdoc.cxx|2 -
 59 files changed, 185 insertions(+), 183 deletions(-)

New commits:
commit edc5240a96f003b9aec8f8d2ce92db39ad603fd7
Author: Noel Grandin 
AuthorDate: Wed Aug 10 13:43:56 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 14 12:03:26 2022 +0200

rename SwPaM::GetContentNode to GetPointContentNode/GetMarkContentNode

Using a parameter to select point/mark makes the code much harder to
read

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

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index d5d6c74e7031..90b6b8d00e71 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -280,10 +280,8 @@ public:
 SwNode& GetMarkNode() const { return m_pMark->nNode.GetNode(); }
 
 /// @return current ContentNode at Point/Mark
-SwContentNode* GetContentNode( bool bPoint = true ) const
-{
-return (bPoint ? m_pPoint->nNode : 
m_pMark->nNode).GetNode().GetContentNode();
-}
+SwContentNode* GetPointContentNode() const { return 
m_pPoint->nNode.GetNode().GetContentNode(); }
+SwContentNode* GetMarkContentNode() const { return 
m_pMark->nNode.GetNode().GetContentNode(); }
 
 /**
Normalizes PaM, i.e. sort point and mark.
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index dd9e44b21d96..014421371ba0 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -88,8 +88,8 @@ namespace SwUnoCursorHelper
 inline bool IsStartOfPara(SwPaM& rUnoCursor)
 { return 
rUnoCursor.GetPoint()->nContent == 0;}
 inline bool IsEndOfPara(SwPaM& rUnoCursor)
-{ 

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

2022-08-14 Thread Noel Grandin (via logerrit)
 sw/inc/crsrsh.hxx   |2 
 sw/inc/pam.hxx  |   10 
 sw/qa/core/doc/doc.cxx  |4 
 sw/qa/core/fields/fields.cxx|2 
 sw/qa/core/txtnode/txtnode.cxx  |2 
 sw/qa/core/unocore/unocore.cxx  |   16 -
 sw/qa/core/uwriter.cxx  |   44 ++--
 sw/qa/extras/htmlexport/htmlexport.cxx  |2 
 sw/qa/extras/htmlimport/htmlimport.cxx  |2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |   16 -
 sw/qa/extras/uiwriter/uiwriter.cxx  |   16 -
 sw/qa/extras/uiwriter/uiwriter2.cxx |   30 +-
 sw/qa/extras/uiwriter/uiwriter3.cxx |   16 -
 sw/qa/extras/uiwriter/uiwriter4.cxx |4 
 sw/qa/extras/uiwriter/uiwriter5.cxx |   10 
 sw/qa/extras/uiwriter/uiwriter6.cxx |   20 +
 sw/qa/extras/uiwriter/uiwriter7.cxx |  166 
 sw/qa/extras/unowriter/unowriter.cxx|2 
 sw/qa/uibase/wrtsh/wrtsh.cxx|   20 -
 sw/source/core/crsr/crsrsh.cxx  |   20 -
 sw/source/core/crsr/crstrvl.cxx |8 
 sw/source/core/crsr/swcrsr.cxx  |   34 +--
 sw/source/core/crsr/trvlfnfl.cxx|2 
 sw/source/core/crsr/trvlreg.cxx |2 
 sw/source/core/crsr/trvltbl.cxx |2 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 
 sw/source/core/doc/doc.cxx  |4 
 sw/source/core/doc/docnew.cxx   |   10 
 sw/source/core/doc/docredln.cxx |2 
 sw/source/core/doc/number.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx|2 
 sw/source/core/docnode/ndtbl.cxx|6 
 sw/source/core/docnode/ndtbl1.cxx   |2 
 sw/source/core/edit/acorrect.cxx|   16 -
 sw/source/core/edit/autofmt.cxx |   12 -
 sw/source/core/edit/edattr.cxx  |2 
 sw/source/core/edit/eddel.cxx   |8 
 sw/source/core/edit/editsh.cxx  |   24 +-
 sw/source/core/edit/edlingu.cxx |   10 
 sw/source/core/edit/ednumber.cxx|   10 
 sw/source/core/edit/edtab.cxx   |6 
 sw/source/core/edit/edws.cxx|8 
 sw/source/core/frmedt/fecopy.cxx|   24 +-
 sw/source/core/frmedt/fefly1.cxx|2 
 sw/source/core/frmedt/fetab.cxx |4 
 sw/source/core/frmedt/tblsel.cxx|6 
 sw/source/core/layout/trvlfrm.cxx   |   10 
 sw/source/core/table/swnewtable.cxx |4 
 sw/source/core/text/frmcrsr.cxx |   12 -
 sw/source/core/text/itrform2.cxx|2 
 sw/source/core/undo/unattr.cxx  |6 
 sw/source/core/undo/undel.cxx   |2 
 sw/source/core/undo/undobj.cxx  |   10 
 sw/source/core/undo/undobj1.cxx |2 
 sw/source/core/undo/unmove.cxx  |4 
 sw/source/core/undo/unovwr.cxx  |4 
 sw/source/core/undo/unredln.cxx |4 
 sw/source/core/undo/unsort.cxx  |2 
 sw/source/core/undo/unspnd.cxx  |2 
 sw/source/core/undo/untbl.cxx   |   12 -
 sw/source/core/unocore/unocrsrhelper.cxx|   36 +--
 sw/source/core/unocore/unodraw.cxx  |6 
 sw/source/core/unocore/unofield.cxx |4 
 sw/source/core/unocore/unoframe.cxx |8 
 sw/source/core/unocore/unoftn.cxx   |4 
 sw/source/core/unocore/unolinebreak.cxx |2 
 sw/source/core/unocore/unoobj.cxx   |   14 -
 sw/source/core/unocore/unoobj2.cxx  |   14 -
 sw/source/core/unocore/unoport.cxx  |2 
 sw/source/core/unocore/unoportenum.cxx  |2 
 sw/source/core/unocore/unoredline.cxx   |   10 
 sw/source/core/unocore/unorefmk.cxx |8 
 sw/source/core/unocore/unosect.cxx  |4 
 sw/source/core/unocore/unotbl.cxx   |   10 
 sw/source/core/unocore/unotext.cxx  |   38 +--
 sw/source/filter/basflt/fltshell.cxx|4 
 

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

2022-08-08 Thread Noel Grandin (via logerrit)
 sw/inc/redline.hxx  |9 +--
 sw/qa/core/uwriter.cxx  |2 
 sw/source/core/doc/docredln.cxx |   62 
 sw/source/core/undo/undobj.cxx  |4 -
 sw/source/core/unocore/unoredline.cxx   |   10 +--
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |2 
 6 files changed, 46 insertions(+), 43 deletions(-)

New commits:
commit 00f3bbc84634a9f07c046140d84445303585817c
Author: Noel Grandin 
AuthorDate: Sun Aug 7 20:37:56 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 8 21:00:59 2022 +0200

unique_ptr->optional in SwRangeRedline

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

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index c8123f178c22..1ad8c456b56c 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -156,7 +156,7 @@ public:
 class SW_DLLPUBLIC SwRangeRedline final : public SwPaM
 {
 SwRedlineData* m_pRedlineData;
-SwNodeIndex* m_pContentSect;
+std::optional m_oContentSect;
 std::optional m_oLOKLastNodeTop;
 sal_uInt32 m_nId;
 bool m_bDelLastPara : 1;
@@ -176,7 +176,7 @@ public:
 // For sw3io: pData is taken over!
 SwRangeRedline(SwRedlineData* pData, const SwPosition& rPos,
bool bDelLP) :
-SwPaM( rPos ), m_pRedlineData( pData ), m_pContentSect( nullptr ),
+SwPaM( rPos ), m_pRedlineData( pData ),
 m_nId( s_nLastId++ ), m_bDelLastPara( bDelLP ), m_bIsVisible( true )
 {
 GetBound().SetRedline(this);
@@ -186,9 +186,10 @@ public:
 virtual ~SwRangeRedline() override;
 
 sal_uInt32 GetId() const { return m_nId; }
-SwNodeIndex* GetContentIdx() const { return m_pContentSect; }
+const SwNodeIndex* GetContentIdx() const { return m_oContentSect ? 
&*m_oContentSect : nullptr; }
 // For Undo.
-void SetContentIdx( const SwNodeIndex* );
+void SetContentIdx( const SwNodeIndex& );
+void ClearContentIdx();
 
 bool IsVisible() const { return m_bIsVisible; }
 bool IsDelLastPara() const { return m_bDelLastPara; }
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 7cd0b38ec2ae..79545969c457 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -788,7 +788,7 @@ void SwDocTest::testSwScanner()
 SwNodes& rNds = m_pDoc->GetNodes();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), 
rTable.size());
 
-SwNodeIndex* pNodeIdx = rTable[0]->GetContentIdx();
+const SwNodeIndex* pNodeIdx = rTable[0]->GetContentIdx();
 CPPUNIT_ASSERT(pNodeIdx);
 
 pTextNode = rNds[ pNodeIdx->GetIndex() + 1 ]->GetTextNode();
//first deleted txtnode
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 3449a6420c5f..0f76346217d9 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1099,7 +1099,6 @@ sal_uInt32 SwRangeRedline::s_nLastId = 1;
 SwRangeRedline::SwRangeRedline(RedlineType eTyp, const SwPaM& rPam )
 : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
 m_pRedlineData( new SwRedlineData( eTyp, 
GetDoc().getIDocumentRedlineAccess().GetRedlineAuthor() ) ),
-m_pContentSect( nullptr ),
 m_nId( s_nLastId++ )
 {
 GetBound().SetRedline(this);
@@ -1122,7 +1121,6 @@ SwRangeRedline::SwRangeRedline(RedlineType eTyp, const 
SwPaM& rPam )
 SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPaM& rPam )
 : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
 m_pRedlineData( new SwRedlineData( rData )),
-m_pContentSect( nullptr ),
 m_nId( s_nLastId++ )
 {
 GetBound().SetRedline(this);
@@ -1137,7 +1135,6 @@ SwRangeRedline::SwRangeRedline( const SwRedlineData& 
rData, const SwPaM& rPam )
 SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPosition& 
rPos )
 : SwPaM( rPos ),
 m_pRedlineData( new SwRedlineData( rData )),
-m_pContentSect( nullptr ),
 m_nId( s_nLastId++ )
 {
 GetBound().SetRedline(this);
@@ -1150,7 +1147,6 @@ SwRangeRedline::SwRangeRedline( const SwRedlineData& 
rData, const SwPosition& rP
 SwRangeRedline::SwRangeRedline( const SwRangeRedline& rCpy )
 : SwPaM( *rCpy.GetMark(), *rCpy.GetPoint() ),
 m_pRedlineData( new SwRedlineData( *rCpy.m_pRedlineData )),
-m_pContentSect( nullptr ),
 m_nId( s_nLastId++ )
 {
 GetBound().SetRedline(this);
@@ -1164,12 +1160,12 @@ SwRangeRedline::SwRangeRedline( const SwRangeRedline& 
rCpy )
 
 SwRangeRedline::~SwRangeRedline()
 {
-if( m_pContentSect )
+if( m_oContentSect )
 {
 // delete the ContentSection
 if( !GetDoc().IsInDtor() )
-GetDoc().getIDocumentContentOperations().DeleteSection( 
_pContentSect->GetNode() );
-delete m_pContentSect;
+GetDoc().getIDocumentContentOperations().DeleteSection( 
_oContentSect->GetNode() );
+ 

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

2022-08-02 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx  |4 +---
 sw/qa/core/macros-test.cxx  |2 +-
 sw/source/core/crsr/crsrsh.cxx  |2 +-
 sw/source/core/crsr/pam.cxx |   16 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 ++--
 sw/source/core/doc/DocumentRedlineManager.cxx   |2 +-
 sw/source/core/doc/dbgoutsw.cxx |2 +-
 sw/source/core/doc/docedt.cxx   |8 
 sw/source/core/edit/eddel.cxx   |4 ++--
 sw/source/core/layout/fly.cxx   |2 +-
 sw/source/core/txtnode/ndtxt.cxx|2 +-
 sw/source/core/undo/undobj.cxx  |2 +-
 sw/source/core/undo/unins.cxx   |2 +-
 sw/source/filter/xml/swxml.cxx  |4 ++--
 14 files changed, 27 insertions(+), 29 deletions(-)

New commits:
commit e49156aff90861cb5e488bab5e83cb7a00f109df
Author: Noel Grandin 
AuthorDate: Mon Aug 1 10:52:49 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 2 21:38:43 2022 +0200

introduce SwPosition::GetContentNode

as part of the process of hiding the internals of SwPosition

largely done by doing:
git grep -lF 'nContent.GetContentNode' | xargs perl -pi -e
's/\bnContent\.GetContentNode/GetContentNode/g'

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

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index c8ff813893d4..fef6206cb95e 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -72,14 +72,12 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
 
 
 SwNodeOffset GetNodeIndex() const { return nNode.GetIndex(); }
-
-// Gets pointer on NodesArray.
 const SwNodes& GetNodes() const { return nNode.GetNodes(); }
 SwNodes& GetNodes() { return nNode.GetNodes(); }
-
 SwNode& GetNode() const { return nNode.GetNode(); }
 
 
+const SwContentNode* GetContentNode() const { return 
nContent.GetContentNode(); }
 sal_Int32 GetContentIndex() const { return nContent.GetIndex(); }
 void SetMark(const sw::mark::IMark* pMark) { nContent.SetMark(pMark); }
 void SetRedline(SwRangeRedline* pRangeRedline) { 
nContent.SetRedline(pRangeRedline); }
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 8d768a24ee1c..02d097a2a8bb 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -199,7 +199,7 @@ void SwMacrosTest::testBookmarkDeleteAndJoin()
 for (IDocumentMarkAccess::const_iterator_t i = rIDMA.getAllMarksBegin(); i 
!= rIDMA.getAllMarksEnd(); ++i)
 {
 // problem was that the nContent was pointing at deleted node
-CPPUNIT_ASSERT_EQUAL((*i)->GetMarkStart().nContent.GetContentNode(),
+CPPUNIT_ASSERT_EQUAL((*i)->GetMarkStart().GetContentNode(),
 static_cast((*i)->GetMarkStart().GetNode().GetContentNode()));
 }
 }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f32d0a40ace9..e415a6c7fdc3 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3589,7 +3589,7 @@ static const SwStartNode* lcl_NodeContext( const SwNode& 
rNode )
 bool sw_PosOk(const SwPosition & aPos)
 {
 return nullptr != aPos.GetNode().GetContentNode() &&
-   aPos.nContent.GetContentNode();
+   aPos.GetContentNode();
 }
 
 /**
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0698b3f6d3a6..9a37b1867587 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -106,8 +106,8 @@ bool SwPosition::operator<(const SwPosition ) const
 {
 // note that positions with text node but no SwContentIndex registered 
are
 // created for text frames anchored at para (see SwXFrame::getAnchor())
-SwContentNode const*const pThisReg(nContent.GetContentNode());
-SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+SwContentNode const*const pThisReg(GetContentNode());
+SwContentNode const*const pOtherReg(rPos.GetContentNode());
 if (pThisReg && pOtherReg)
 {
 return (nContent < rPos.nContent);
@@ -127,8 +127,8 @@ bool SwPosition::operator>(const SwPosition ) const
 {
 // note that positions with text node but no SwContentIndex registered 
are
 // created for text frames anchored at para (see SwXFrame::getAnchor())
-SwContentNode const*const pThisReg(nContent.GetContentNode());
-SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+SwContentNode const*const pThisReg(GetContentNode());
+SwContentNode const*const pOtherReg(rPos.GetContentNode());
 if (pThisReg && pOtherReg)
 {

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

2022-08-02 Thread Vasily Melenchuk (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx |4 +++-
 sw/qa/extras/ooxmlexport/data/tdf148360.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx|   15 +++
 sw/source/core/doc/DocumentSettingManager.cxx |9 +++--
 sw/source/core/inc/DocumentSettingManager.hxx |1 +
 sw/source/core/text/txtfld.cxx|3 ++-
 sw/source/core/txtnode/ndtxt.cxx  |   18 --
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 +-
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 9 files changed, 58 insertions(+), 12 deletions(-)

New commits:
commit a7d9837a8aa6d1233f4c21e4db5d32428a3ffc58
Author: Vasily Melenchuk 
AuthorDate: Thu May 26 12:05:58 2022 +0300
Commit: Thorsten Behrens 
CommitDate: Tue Aug 2 15:59:35 2022 +0200

tdf#148360: sw: do not ignore list label followed by

...even if numbering is empty.

Since this is a core change to avoid impact on other formats
(mostly ODT) it is implemented as a new document setting.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index eee38ef7678e..548419576168 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -121,7 +121,9 @@ enum class DocumentSettingId
 FOOTNOTE_IN_COLUMN_TO_PAGEEND,
 // AsChar anchored flys wrapped differently in ooxml than normally so in 
case of
 // docx enable this flag. For details see ticket tdf#100680.
-WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML
+WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML,
+// Should we display follow by symbol for numbered paragraph if numbering 
exists, but "None"?
+NO_NUMBERING_SHOW_FOLLOWBY
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/extras/ooxmlexport/data/tdf148360.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148360.docx
new file mode 100644
index ..8f09f685d26f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148360.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index ee5b0dd19b14..bb9d30fc97d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1054,6 +1054,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8000), getXPath(pXmlDoc, 
"/root/page[2]/infos/bounds", "width").toInt32());
 }
 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx")
+{
+const auto& pLayout = parseLayoutDump();
+
+// Ensure first element is a tab
+assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::TabLeft");
+// and only then goes content
+assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", 
"PortionType::Text");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx")
 {
 uno::Reference xShape(getShape(1), uno::UNO_QUERY);
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 851aec5b9e10..5f2a57099938 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -106,8 +106,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbFootnoteInColumnToPageEnd(false),
 mnImagePreferredDPI(0),
 mbAutoFirstLineIndentDisregardLineSpace(true),
-mbWrapAsCharFlysLikeInOOXML(false)
-
+mbWrapAsCharFlysLikeInOOXML(false),
+mbNoNumberingShowFollowBy(false)
 // COMPATIBILITY FLAGS END
 {
 // COMPATIBILITY FLAGS START
@@ -246,6 +246,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
 return mbAutoFirstLineIndentDisregardLineSpace;
 case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return 
mbWrapAsCharFlysLikeInOOXML;
+case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return 
mbNoNumberingShowFollowBy;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -428,6 +429,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 mbWrapAsCharFlysLikeInOOXML = value;
 break;
 
+case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY:
+mbNoNumberingShowFollowBy = value;
+break;
+
 // COMPATIBILITY FLAGS END
 
 case DocumentSettingId::BROWSE_MODE: //can be used temporary 
(load/save) when no SwViewShell is available
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx 
b/sw/source/core/inc/DocumentSettingManager.hxx
index b6656a934676..f37696df1a3e 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ 

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

2022-08-02 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx  |3 
 sw/inc/swcrsr.hxx   |6 
 sw/qa/core/txtnode/txtnode.cxx  |6 
 sw/qa/core/uwriter.cxx  |   50 ++--
 sw/qa/extras/globalfilter/globalfilter.cxx  |   18 -
 sw/qa/extras/layout/layout.cxx  |   18 -
 sw/qa/extras/rtfexport/rtfexport4.cxx   |4 
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |   10 
 sw/qa/extras/uiwriter/uiwriter.cxx  |   18 -
 sw/qa/extras/uiwriter/uiwriter2.cxx |   20 -
 sw/qa/extras/uiwriter/uiwriter4.cxx |4 
 sw/qa/extras/uiwriter/uiwriter5.cxx |4 
 sw/qa/extras/uiwriter/uiwriter7.cxx |   18 -
 sw/qa/uibase/uno/uno.cxx|2 
 sw/qa/uibase/wrtsh/wrtsh.cxx|4 
 sw/source/core/access/accframebase.cxx  |6 
 sw/source/core/access/accmap.cxx|6 
 sw/source/core/access/accpara.cxx   |4 
 sw/source/core/crsr/annotationmark.cxx  |2 
 sw/source/core/crsr/bookmark.cxx|   42 ++--
 sw/source/core/crsr/callnk.cxx  |4 
 sw/source/core/crsr/crbm.cxx|4 
 sw/source/core/crsr/crossrefbookmark.cxx|2 
 sw/source/core/crsr/crsrsh.cxx  |   32 +--
 sw/source/core/crsr/crstrvl.cxx |   36 +--
 sw/source/core/crsr/findattr.cxx|   30 +-
 sw/source/core/crsr/findfmt.cxx |4 
 sw/source/core/crsr/findtxt.cxx |6 
 sw/source/core/crsr/pam.cxx |   20 -
 sw/source/core/crsr/swcrsr.cxx  |   62 +++---
 sw/source/core/crsr/trvlfnfl.cxx|6 
 sw/source/core/crsr/trvlreg.cxx |6 
 sw/source/core/crsr/trvltbl.cxx |4 
 sw/source/core/crsr/viscrs.cxx  |4 
 sw/source/core/doc/CntntIdxStore.cxx|   24 +-
 sw/source/core/doc/DocumentContentOperationsManager.cxx |  164 
 sw/source/core/doc/DocumentFieldsManager.cxx|2 
 sw/source/core/doc/DocumentLayoutManager.cxx|4 
 sw/source/core/doc/DocumentRedlineManager.cxx   |   16 -
 sw/source/core/doc/dbgoutsw.cxx |2 
 sw/source/core/doc/doc.cxx  |4 
 sw/source/core/doc/docbm.cxx|   30 +-
 sw/source/core/doc/doccomp.cxx  |   10 
 sw/source/core/doc/doccorr.cxx  |6 
 sw/source/core/doc/docedt.cxx   |   30 +-
 sw/source/core/doc/docfld.cxx   |   16 -
 sw/source/core/doc/docfly.cxx   |8 
 sw/source/core/doc/docfmt.cxx   |   12 -
 sw/source/core/doc/docftn.cxx   |4 
 sw/source/core/doc/doclay.cxx   |   16 -
 sw/source/core/doc/docnum.cxx   |   12 -
 sw/source/core/doc/docredln.cxx |   18 -
 sw/source/core/doc/docruby.cxx  |   12 -
 sw/source/core/doc/doctxm.cxx   |2 
 sw/source/core/doc/extinput.cxx |   14 -
 sw/source/core/doc/swserv.cxx   |4 
 sw/source/core/docnode/ndsect.cxx   |   26 +-
 sw/source/core/docnode/ndtbl.cxx|   12 -
 sw/source/core/docnode/nodes.cxx|   20 -
 sw/source/core/edit/acorrect.cxx|8 
 sw/source/core/edit/autofmt.cxx |4 
 sw/source/core/edit/edattr.cxx  |   18 -
 sw/source/core/edit/eddel.cxx   |2 
 sw/source/core/edit/edfcol.cxx  |4 
 sw/source/core/edit/edfmt.cxx   |   12 -
 sw/source/core/edit/editsh.cxx  |   16 -
 sw/source/core/edit/edlingu.cxx |   52 ++---
 sw/source/core/edit/edsect.cxx  |8 
 sw/source/core/edit/edtab.cxx   |4 
 sw/source/core/fields/postithelper.cxx  |6 
 sw/source/core/fields/reffld.cxx|4 
 sw/source/core/frmedt/fefly1.cxx|4 
 sw/source/core/frmedt/feshview.cxx  |2 
 sw/source/core/frmedt/fetab.cxx |2 
 sw/source/core/frmedt/fews.cxx  |2 
 sw/source/core/layout/atrfrm.cxx 

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

2022-08-02 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx  |2 
 sw/inc/swcrsr.hxx   |6 
 sw/qa/core/frmedt/frmedt.cxx|4 
 sw/qa/core/uwriter.cxx  |   60 -
 sw/qa/extras/globalfilter/globalfilter.cxx  |   10 -
 sw/qa/extras/layout/layout.cxx  |   10 -
 sw/qa/extras/mailmerge/mailmerge.cxx|4 
 sw/qa/extras/rtfexport/rtfexport4.cxx   |4 
 sw/qa/extras/uiwriter/uiwriter.cxx  |   16 +-
 sw/qa/extras/uiwriter/uiwriter5.cxx |2 
 sw/qa/extras/uiwriter/uiwriter6.cxx |6 
 sw/source/core/access/accframebase.cxx  |4 
 sw/source/core/access/accmap.cxx|   10 -
 sw/source/core/access/accpara.cxx   |   18 +-
 sw/source/core/crsr/bookmark.cxx|   10 -
 sw/source/core/crsr/callnk.cxx  |2 
 sw/source/core/crsr/crsrsh.cxx  |   26 ++--
 sw/source/core/crsr/crstrvl.cxx |6 
 sw/source/core/crsr/findattr.cxx|   16 +-
 sw/source/core/crsr/findtxt.cxx |   12 -
 sw/source/core/crsr/pam.cxx |8 -
 sw/source/core/crsr/swcrsr.cxx  |   44 +++
 sw/source/core/crsr/trvlfnfl.cxx|4 
 sw/source/core/crsr/trvlreg.cxx |2 
 sw/source/core/crsr/trvltbl.cxx |6 
 sw/source/core/crsr/viscrs.cxx  |4 
 sw/source/core/doc/CntntIdxStore.cxx|   10 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |  100 
 sw/source/core/doc/DocumentLayoutManager.cxx|2 
 sw/source/core/doc/DocumentRedlineManager.cxx   |   36 ++---
 sw/source/core/doc/dbgoutsw.cxx |2 
 sw/source/core/doc/docbm.cxx|   12 -
 sw/source/core/doc/doccomp.cxx  |8 -
 sw/source/core/doc/docedt.cxx   |   16 +-
 sw/source/core/doc/docfld.cxx   |   12 -
 sw/source/core/doc/docfly.cxx   |4 
 sw/source/core/doc/docfmt.cxx   |4 
 sw/source/core/doc/docftn.cxx   |4 
 sw/source/core/doc/doclay.cxx   |8 -
 sw/source/core/doc/docnew.cxx   |4 
 sw/source/core/doc/docnum.cxx   |   56 
 sw/source/core/doc/docredln.cxx |   12 -
 sw/source/core/doc/docsort.cxx  |6 
 sw/source/core/doc/extinput.cxx |4 
 sw/source/core/doc/swserv.cxx   |   10 -
 sw/source/core/docnode/ndsect.cxx   |   10 -
 sw/source/core/docnode/ndtbl.cxx|   22 +--
 sw/source/core/docnode/nodes.cxx|8 -
 sw/source/core/edit/acorrect.cxx|6 
 sw/source/core/edit/edattr.cxx  |   24 +--
 sw/source/core/edit/eddel.cxx   |4 
 sw/source/core/edit/edglbldc.cxx|2 
 sw/source/core/edit/editsh.cxx  |   10 -
 sw/source/core/edit/ednumber.cxx|   16 +-
 sw/source/core/edit/edtab.cxx   |4 
 sw/source/core/fields/postithelper.cxx  |2 
 sw/source/core/frmedt/fecopy.cxx|   10 -
 sw/source/core/frmedt/fetab.cxx |4 
 sw/source/core/frmedt/fews.cxx  |2 
 sw/source/core/frmedt/tblsel.cxx|6 
 sw/source/core/layout/atrfrm.cxx|4 
 sw/source/core/layout/flowfrm.cxx   |2 
 sw/source/core/layout/flycnt.cxx|2 
 sw/source/core/layout/frmtool.cxx   |8 -
 sw/source/core/text/frmcrsr.cxx |8 -
 sw/source/core/text/frmpaint.cxx|4 
 sw/source/core/text/itratr.cxx  |4 
 sw/source/core/text/porlay.cxx  |8 -
 sw/source/core/text/redlnitr.cxx|   12 -
 sw/source/core/text/txtfld.cxx  |4 
 sw/source/core/text/txtfly.cxx  |2 
 sw/source/core/tox/txmsrt.cxx   |2 
 sw/source/core/txtnode/ndtxt.cxx|2 
 sw/source/core/undo/SwUndoField.cxx |2 
 sw/source/core/undo/rolbck.cxx  |   16 +-
 sw/source/core/undo/unattr.cxx 

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

2022-08-02 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx|2 
 sw/qa/core/crsr/crsr.cxx  |2 
 sw/qa/core/doc/doc.cxx|2 
 sw/qa/core/macros-test.cxx|6 
 sw/qa/core/txtnode/txtnode.cxx|2 
 sw/qa/extras/htmlexport/htmlexport.cxx|   30 +--
 sw/qa/extras/layout/layout2.cxx   |2 
 sw/qa/extras/odfimport/odfimport.cxx  |   22 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx|   28 +--
 sw/qa/extras/uiwriter/uiwriter.cxx|8 
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   12 -
 sw/qa/extras/uiwriter/uiwriter4.cxx   |2 
 sw/qa/uibase/wrtsh/wrtsh.cxx  |2 
 sw/source/core/access/accdoc.cxx  |2 
 sw/source/core/access/accframebase.cxx|4 
 sw/source/core/access/accmap.cxx  |8 
 sw/source/core/access/accpara.cxx |2 
 sw/source/core/access/acctable.cxx|2 
 sw/source/core/crsr/annotationmark.cxx|2 
 sw/source/core/crsr/bookmark.cxx  |   18 -
 sw/source/core/crsr/callnk.cxx|2 
 sw/source/core/crsr/crbm.cxx  |4 
 sw/source/core/crsr/crossrefbookmark.cxx  |2 
 sw/source/core/crsr/crsrsh.cxx|   48 ++---
 sw/source/core/crsr/crstrvl.cxx   |   32 +--
 sw/source/core/crsr/findattr.cxx  |4 
 sw/source/core/crsr/findfmt.cxx   |2 
 sw/source/core/crsr/findtxt.cxx   |   10 -
 sw/source/core/crsr/pam.cxx   |   56 +++---
 sw/source/core/crsr/swcrsr.cxx|   62 +++---
 sw/source/core/crsr/trvlfnfl.cxx  |4 
 sw/source/core/crsr/trvlreg.cxx   |2 
 sw/source/core/crsr/trvltbl.cxx   |   16 -
 sw/source/core/crsr/viscrs.cxx|   16 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx   |  128 +++---
 sw/source/core/doc/DocumentFieldsManager.cxx  |2 
 sw/source/core/doc/DocumentLayoutManager.cxx  |4 
 sw/source/core/doc/DocumentLinksAdministrationManager.cxx |2 
 sw/source/core/doc/DocumentRedlineManager.cxx |   88 -
 sw/source/core/doc/dbgoutsw.cxx   |2 
 sw/source/core/doc/doc.cxx|2 
 sw/source/core/doc/docbm.cxx  |   36 +--
 sw/source/core/doc/doccomp.cxx|6 
 sw/source/core/doc/doccorr.cxx|   10 -
 sw/source/core/doc/docedt.cxx |   46 ++---
 sw/source/core/doc/docfld.cxx |8 
 sw/source/core/doc/docfly.cxx |   14 -
 sw/source/core/doc/docfmt.cxx |   14 -
 sw/source/core/doc/docglos.cxx|2 
 sw/source/core/doc/doclay.cxx |   14 -
 sw/source/core/doc/docnew.cxx |2 
 sw/source/core/doc/docnum.cxx |   70 +++
 sw/source/core/doc/docredln.cxx   |   50 ++---
 sw/source/core/doc/docruby.cxx|2 
 sw/source/core/doc/docsort.cxx|4 
 sw/source/core/doc/doctxm.cxx |4 
 sw/source/core/doc/extinput.cxx   |6 
 sw/source/core/doc/list.cxx   |4 
 sw/source/core/doc/notxtfrm.cxx   |2 
 sw/source/core/doc/textboxhelper.cxx  |   12 -
 sw/source/core/docnode/ndsect.cxx |   28 +--
 sw/source/core/docnode/ndtbl.cxx  |   24 +-
 sw/source/core/docnode/ndtbl1.cxx |   32 +--
 sw/source/core/docnode/node.cxx   |8 
 sw/source/core/docnode/nodes.cxx  |   14 -
 sw/source/core/docnode/swbaslnk.cxx   |4 
 sw/source/core/draw/dcontact.cxx  |2 
 sw/source/core/edit/acorrect.cxx  |6 
 sw/source/core/edit/autofmt.cxx   |   10 -
 sw/source/core/edit/edatmisc.cxx  |2 
 sw/source/core/edit/edattr.cxx|6 
 sw/source/core/edit/eddel.cxx |4 
 sw/source/core/edit/edfcol.cxx|   18 -
 

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

2022-07-26 Thread Noel Grandin (via logerrit)
 sw/inc/crsrsh.hxx|6 +++---
 sw/inc/swcrsr.hxx|8 
 sw/qa/extras/uiwriter/uiwriter7.cxx  |   14 +++---
 sw/source/core/crsr/crsrsh.cxx   |   12 ++--
 sw/source/core/crsr/findattr.cxx |4 ++--
 sw/source/core/crsr/findcoll.cxx |4 ++--
 sw/source/core/crsr/findtxt.cxx  |4 ++--
 sw/source/core/crsr/swcrsr.cxx   |8 
 sw/source/core/edit/edtox.cxx|2 +-
 sw/source/uibase/inc/wrtsh.hxx   |6 +++---
 sw/source/uibase/uiview/viewsrch.cxx |2 +-
 sw/source/uibase/uno/unotxdoc.cxx|   20 ++--
 sw/source/uibase/wrtsh/select.cxx|   18 +-
 13 files changed, 54 insertions(+), 54 deletions(-)

New commits:
commit 4d42aeae86253e167facb1adfddd0c9976b7801a
Author: Noel Grandin 
AuthorDate: Tue Jul 26 20:14:05 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 26 22:43:25 2022 +0200

sal_uLong->sal_Int32 in the Find/Search methods

we cast this to sal_Int32 once it hits the UNO methods anyway

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 61c2b9f07611..2a64da5f5d26 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -370,18 +370,18 @@ public:
 bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & );
 
 // note: DO NOT call it FindText because windows.h
-sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
+sal_Int32 Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
 bool bSearchInNotes,
 SwDocPositions eStart, SwDocPositions eEnd,
 bool& bCancel,
 FindRanges eRng, bool bReplace = false );
 
-sal_uLong FindFormat( const SwTextFormatColl& rFormatColl,
+sal_Int32 FindFormat( const SwTextFormatColl& rFormatColl,
 SwDocPositions eStart, SwDocPositions eEnd,
 bool& bCancel,
 FindRanges eRng, const SwTextFormatColl* pReplFormat );
 
-sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
+sal_Int32 FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
 SwDocPositions eStart, SwDocPositions eEnd,
 bool& bCancel,
 FindRanges eRng,
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 0a2aafff36c7..27f42c0bd72d 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -76,7 +76,7 @@ class SW_DLLPUBLIC SwCursor : public SwPaM
 sal_uInt8 m_nCursorBidiLevel; // bidi level of the cursor
 bool m_bColumnSelection;  // true: cursor is aprt of a column selection
 
-sal_uLong FindAll( SwFindParas& , SwDocPositions, SwDocPositions, 
FindRanges, bool& bCancel );
+sal_Int32 FindAll( SwFindParas& , SwDocPositions, SwDocPositions, 
FindRanges, bool& bCancel );
 
 SwCursor(SwCursor const& rPaM) = delete;
 
@@ -114,20 +114,20 @@ public:
 SwPaM* ) const;
 
 // note: DO NOT call it FindText because windows.h
-sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
+sal_Int32 Find_Text( const i18nutil::SearchOptions2& rSearchOpt,
 bool bSearchInNotes,
 SwDocPositions nStart, SwDocPositions nEnd,
 bool& bCancel,
 FindRanges,
 bool bReplace = false,
 SwRootFrame const*const pLayout = nullptr);
-sal_uLong FindFormat( const SwTextFormatColl& rFormatColl,
+sal_Int32 FindFormat( const SwTextFormatColl& rFormatColl,
 SwDocPositions nStart, SwDocPositions nEnd,
 bool& bCancel,
 FindRanges,
 const SwTextFormatColl* pReplFormat,
 SwRootFrame const*const pLayout = nullptr);
-sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
+sal_Int32 FindAttrs( const SfxItemSet& rSet, bool bNoCollections,
 SwDocPositions nStart, SwDocPositions nEnd,
 bool& bCancel,
 FindRanges,
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 89a68b86e2bc..41a84f5bc264 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -684,7 +684,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, 
testSearchWithTransliterate)
 SearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE;
 SearchOpt.WildcardEscapeCharacter = 0;
 //transliteration option set so that at least one of the search strings is 
not found
-sal_uLong case1
+sal_Int32 case1
 = pWrtShell->SearchPattern(SearchOpt, true, SwDocPositions::Start, 
SwDocPositions::End);
 SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true);
 CPPUNIT_ASSERT_EQUAL(OUString(), 

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

2022-07-26 Thread Noel Grandin (via logerrit)
 sw/inc/crsrsh.hxx   |6 +-
 sw/inc/node.hxx |5 +
 sw/inc/swcrsr.hxx   |   16 ++---
 sw/qa/core/crsr/crsr.cxx|4 -
 sw/qa/core/fields/fields.cxx|2 
 sw/qa/core/text/text.cxx|8 +-
 sw/qa/core/txtnode/txtnode.cxx  |2 
 sw/qa/core/unocore/unocore.cxx  |8 +-
 sw/qa/extras/layout/layout.cxx  |   66 
 sw/qa/extras/layout/layout2.cxx |2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |   44 
 sw/qa/extras/txtimport/txtimport.cxx|2 
 sw/qa/extras/uiwriter/uiwriter.cxx  |   22 
 sw/qa/extras/uiwriter/uiwriter2.cxx |   66 
 sw/qa/extras/uiwriter/uiwriter3.cxx |   25 -
 sw/qa/extras/uiwriter/uiwriter4.cxx |   12 ++--
 sw/qa/extras/uiwriter/uiwriter5.cxx |   38 ++---
 sw/qa/extras/uiwriter/uiwriter6.cxx |4 -
 sw/qa/extras/uiwriter/uiwriter7.cxx |   16 ++---
 sw/qa/extras/unowriter/unowriter.cxx|8 +-
 sw/qa/uibase/dochdl/dochdl.cxx  |6 +-
 sw/qa/uibase/fldui/fldui.cxx|2 
 sw/qa/uibase/shells/shells.cxx  |6 +-
 sw/qa/uibase/uno/uno.cxx|2 
 sw/source/core/crsr/crsrsh.cxx  |2 
 sw/source/core/crsr/pam.cxx |   12 ++--
 sw/source/core/crsr/swcrsr.cxx  |8 +-
 sw/source/core/doc/docruby.cxx  |2 
 sw/source/core/docnode/node.cxx |   12 ++--
 sw/source/core/edit/edattr.cxx  |2 
 sw/source/core/edit/editsh.cxx  |4 -
 sw/source/core/edit/edlingu.cxx |4 -
 sw/source/core/inc/pamtyp.hxx   |7 +-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |8 +-
 sw/source/core/view/viewsh.cxx  |2 
 sw/source/ui/dbui/dbinsdlg.cxx  |2 
 sw/source/ui/fldui/fldedt.cxx   |2 
 sw/source/ui/misc/insfnote.cxx  |   12 ++--
 sw/source/uibase/app/appenv.cxx |2 
 sw/source/uibase/docvw/AnnotationWin2.cxx   |2 
 sw/source/uibase/docvw/edtwin.cxx   |6 +-
 sw/source/uibase/fldui/fldmgr.cxx   |6 +-
 sw/source/uibase/inc/wrtsh.hxx  |4 -
 sw/source/uibase/index/toxmgr.cxx   |2 
 sw/source/uibase/lingu/hhcwrp.cxx   |6 +-
 sw/source/uibase/lingu/olmenu.cxx   |2 
 sw/source/uibase/shells/basesh.cxx  |2 
 sw/source/uibase/shells/textsh1.cxx |2 
 sw/source/uibase/shells/txtcrsr.cxx |4 -
 sw/source/uibase/uiview/viewling.cxx|2 
 sw/source/uibase/uiview/viewport.cxx|2 
 sw/source/uibase/uno/unotxvw.cxx|4 -
 sw/source/uibase/utlui/content.cxx  |6 +-
 sw/source/uibase/utlui/unotools.cxx |2 
 sw/source/uibase/wrtsh/delete.cxx   |   20 +++
 sw/source/uibase/wrtsh/move.cxx |4 -
 sw/source/uibase/wrtsh/select.cxx   |8 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   10 +--
 sw/source/uibase/wrtsh/wrtsh2.cxx   |2 
 sw/source/uibase/wrtsh/wrtsh4.cxx   |   16 ++---
 60 files changed, 284 insertions(+), 281 deletions(-)

New commits:
commit 4c38f51c727fac25fdeb15d78a24d9203fabac5c
Author: Noel Grandin 
AuthorDate: Tue Jul 26 18:19:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 26 22:42:16 2022 +0200

convert CRSR_SKIP_* to typed enum

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index fb6e00106691..61c2b9f07611 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -254,7 +254,7 @@ private:
   const int nLevel );
 
 // private method(s) accessed from public inline method(s) must be 
exported.
-   bool LeftRight( bool, sal_uInt16, sal_uInt16, bool );
+   bool LeftRight( bool, sal_uInt16, SwCursorSkipMode, bool );
 SAL_DLLPRIVATE bool UpDown( bool, sal_uInt16 );
 SAL_DLLPRIVATE bool LRMargin( bool, bool bAPI = false );
 SAL_DLLPRIVATE bool IsAtLRMargin( bool, bool bAPI = false ) const;
@@ -352,9 +352,9 @@ public:
 // basic cursor travelling
 tools::Long GetUpDownX() const { return m_nUpDownX; }
 
-bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual = false )
+bool Left( sal_uInt16 nCnt, SwCursorSkipMode nMode, bool 

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

2022-07-25 Thread Noel Grandin (via logerrit)
 sw/inc/pam.hxx|   12 ++---
 sw/qa/extras/globalfilter/globalfilter.cxx|2 -
 sw/qa/extras/uiwriter/uiwriter2.cxx   |2 -
 sw/source/core/crsr/pam.cxx   |   17 +-
 sw/source/core/doc/DocumentContentOperationsManager.cxx   |3 --
 sw/source/core/doc/DocumentLinksAdministrationManager.cxx |2 -
 sw/source/core/docnode/ndtbl.cxx  |2 -
 sw/source/core/fields/docufld.cxx |2 -
 sw/source/core/fields/expfld.cxx  |2 -
 sw/source/core/layout/fly.cxx |2 -
 sw/source/core/table/swtable.cxx  |4 +--
 sw/source/core/undo/unsect.cxx|4 +--
 sw/source/core/undo/untbl.cxx |9 +++
 sw/source/core/unocore/unotext.cxx|5 +---
 sw/source/filter/ww8/writerhelper.cxx |5 +---
 15 files changed, 39 insertions(+), 34 deletions(-)

New commits:
commit 9acc54e65476e405bd8d9e4bca135be968448d3c
Author: Noel Grandin 
AuthorDate: Mon Jul 25 13:32:18 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 26 07:54:25 2022 +0200

elide some temporaries when constructing SwPosition

because the resulting pointer manipulation is not free, the temporary
has to be attached to a linked list and then immediately de-linked

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

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index fad762cab0e8..68282d98ca4e 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -39,9 +39,13 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
 SwContentIndex nContent;
 
 SwPosition( const SwNodeIndex , const SwContentIndex  );
-explicit SwPosition( const SwNodeIndex  );
-explicit SwPosition( const SwNode& rNode );
-explicit SwPosition( const SwContentNode& rNode, const sal_Int32 nOffset = 
0 );
+explicit SwPosition( SwNodes& rNodes, SwNodeOffset nIndex = 
SwNodeOffset(0) );
+explicit SwPosition( const SwNodeIndex , SwNodeOffset nDiff = 
SwNodeOffset(0) );
+explicit SwPosition( const SwNode& rNode, SwNodeOffset nDiff = 
SwNodeOffset(0) );
+explicit SwPosition( const SwContentNode& rNode, const sal_Int32 
nContentOffset = 0 );
+
+// callers should be using one of the other constructors to avoid creating 
a temporary
+SwPosition( SwNodeIndex && ) = delete;
 
 /**
Returns the document this position is in.
@@ -181,7 +185,7 @@ public:
 {
 /** clear the mark position; this helps if mark's SwContentIndex is
registered at some node, and that node is then deleted */
-*m_pMark = SwPosition( SwNodeIndex( GetNode().GetNodes() ) );
+*m_pMark = SwPosition( GetNode().GetNodes() );
 m_pMark = m_pPoint;
 }
 }
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index fefc1fbda8ee..654eb662786a 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -1242,7 +1242,7 @@ void Test::testRedlineFlags()
 CPPUNIT_ASSERT(pTextDoc);
 SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
 
-SwPaM pam(SwPosition(SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1)));
+SwPaM pam(SwPosition(pDoc->GetNodes().GetEndOfContent(), 
SwNodeOffset(-1)));
 pDoc->getIDocumentContentOperations().InsertString(pam, "foo bar baz");
 
 IDocumentRedlineAccess & rIDRA(pDoc->getIDocumentRedlineAccess());
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 38247a36ea4d..aa5515b131a1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -807,7 +807,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912)
 sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
 
 sw::UnoCursorPointer pCursor(
-
pDoc->CreateUnoCursor(SwPosition(SwNodeIndex(pDoc->GetNodes().GetEndOfContent(),
 -1;
+pDoc->CreateUnoCursor(SwPosition(pDoc->GetNodes().GetEndOfContent(), 
SwNodeOffset(-1;
 
 pDoc->getIDocumentContentOperations().InsertString(*pCursor, "foo");
 
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0ba3705781bd..4bd4ee78f839 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -62,18 +62,23 @@ SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, 
const SwContentIndex & r
 {
 }
 
-SwPosition::SwPosition( const SwNodeIndex & rNodeIndex )
-: nNode( rNodeIndex ), nContent( nNode.GetNode().GetContentNode() )
+SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, SwNodeOffset nDiff )
+: nNode( rNodeIndex, nDiff ), 

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

2022-07-25 Thread Noel Grandin (via logerrit)
 sw/inc/index.hxx|   22 ++--
 sw/inc/node.hxx |6 +
 sw/qa/core/macros-test.cxx  |2 
 sw/source/core/bastyp/index.cxx |   72 
 sw/source/core/crsr/crsrsh.cxx  |2 
 sw/source/core/crsr/pam.cxx |   16 +--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 
 sw/source/core/doc/DocumentRedlineManager.cxx   |2 
 sw/source/core/doc/dbgoutsw.cxx |2 
 sw/source/core/doc/doccorr.cxx  |2 
 sw/source/core/doc/docedt.cxx   |   17 ++-
 sw/source/core/docnode/node.cxx |   20 
 sw/source/core/edit/eddel.cxx   |4 
 sw/source/core/layout/fly.cxx   |2 
 sw/source/core/txtnode/ndtxt.cxx|   16 +++
 sw/source/core/undo/undobj.cxx  |2 
 sw/source/core/undo/unins.cxx   |4 
 sw/source/filter/xml/swxml.cxx  |4 
 18 files changed, 121 insertions(+), 78 deletions(-)

New commits:
commit 6cfa03bbfb7397c34fe2ea605a4ef573ae92e4ea
Author: Noel Grandin 
AuthorDate: Mon Jul 25 11:24:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 25 12:33:51 2022 +0200

SwIndex/SwIndexReg is only used to deal with SwContentNodes

so make that apparent in the type system and naming, instead of
implicit.

Which requires adding a small helper class for the one place we were
instantiating an SwIndexReg by itselg

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

diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 0e5e89125d92..22b9edf14e9d 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -24,19 +24,20 @@
 
 #include 
 
+class SwContentNode;
 class SwIndexReg;
 struct SwPosition;
 
 namespace sw::mark { class IMark; }
 
-/// Marks a character position inside a document model node.
+/// Marks a character position inside a document model content node 
(SwContentNode)
 class SAL_WARN_UNUSED SW_DLLPUBLIC SwIndex
 {
 private:
 friend class SwIndexReg;
 
 sal_Int32 m_nIndex;
-SwIndexReg * m_pIndexReg;
+SwContentNode * m_pContentNode;
 // doubly linked list of Indexes registered at m_pIndexReg
 SwIndex * m_pNext;
 SwIndex * m_pPrev;
@@ -49,7 +50,7 @@ private:
 void Remove();
 
 public:
-explicit SwIndex(SwIndexReg *const pReg, sal_Int32 const nIdx = 0);
+explicit SwIndex(SwContentNode *const pContentNode, sal_Int32 const nIdx = 
0);
 SwIndex( const SwIndex & );
 SwIndex( const SwIndex &, short nDiff );
 ~SwIndex() { Remove(); }
@@ -79,22 +80,22 @@ public:
 bool operator==( const SwIndex& rSwIndex ) const
 {
 return (m_nIndex== rSwIndex.m_nIndex)
-&& (m_pIndexReg == rSwIndex.m_pIndexReg);
+&& (m_pContentNode == rSwIndex.m_pContentNode);
 }
 
 bool operator!=( const SwIndex& rSwIndex ) const
 {
 return (m_nIndex!= rSwIndex.m_nIndex)
-|| (m_pIndexReg != rSwIndex.m_pIndexReg);
+|| (m_pContentNode != rSwIndex.m_pContentNode);
 }
 
 sal_Int32 GetIndex() const { return m_nIndex; }
 
 // Assignments without creating a temporary object.
-SwIndex (SwIndexReg *, sal_Int32);
+SwIndex (SwContentNode *, sal_Int32);
 
-// Returns pointer to IndexArray (for RTTI at SwIndexReg).
-const SwIndexReg* GetIdxReg() const { return m_pIndexReg; }
+// Returns pointer to SwContentNode (for RTTI at SwIndexReg).
+const SwContentNode* GetContentNode() const { return m_pContentNode; }
 const SwIndex* GetNext() const { return m_pNext; }
 
 const sw::mark::IMark* GetMark() const { return m_pMark; }
@@ -103,6 +104,7 @@ public:
 
 SW_DLLPUBLIC std::ostream& operator <<(std::ostream& s, const SwIndex& index);
 
+/// Helper base class for SwContentNode to manage the list of attached SwIndex
 class SAL_WARN_UNUSED SwIndexReg
 {
 friend class SwIndex;
@@ -117,11 +119,11 @@ protected:
 
 bool HasAnyIndex() const { return nullptr != m_pFirst; }
 
-public:
 SwIndexReg();
+public:
 virtual ~SwIndexReg();
 
-void MoveTo( SwIndexReg& rArr );
+void MoveTo( SwContentNode& rArr );
 const SwIndex* GetFirstIndex() const { return m_pFirst; }
 };
 
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index cf9ebc80bee7..e447c9132d99 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -113,6 +113,9 @@ private:
 protected:
 SwStartNode* m_pStartOfSection;
 
+/// only used by SwContentNodeTmp in SwTextNode::Update
+SwNode();
+
 SwNode( const SwNodeIndex , const SwNodeType nNodeId );
 
 /// for the initial 

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

2022-07-20 Thread Miklos Vajna (via logerrit)
 sw/inc/formatcontentcontrol.hxx   |8 ++
 sw/inc/unoprnms.hxx   |1 
 sw/qa/core/unocore/unocore.cxx|   33 ++
 sw/source/core/txtnode/attrcontentcontrol.cxx |2 +
 sw/source/core/unocore/unocontentcontrol.cxx  |   29 ++
 sw/source/core/unocore/unomap1.cxx|1 
 sw/source/uibase/wrtsh/wrtsh1.cxx |1 
 7 files changed, 75 insertions(+)

New commits:
commit da8e95ebe0dce032cfbe37602ebb013869dc1e6d
Author: Miklos Vajna 
AuthorDate: Wed Jul 20 14:42:55 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 20 23:01:11 2022 +0200

sw content controls, plain text: add doc model & UNO API

OOXML's  with  describes a plain text content control. We
are currently mapping this to fields, and then on export it's possible
to map this to FORMTEXT fields. The trouble is that our doc model could
not differentiate between content controls and fields for non-formatted
form text, so the exporter can't do the opposite of import.

This has the benefit that input fields do a reasonable job of providing
the feature set of plain text content controls, but it has the downside
that we map two OOXML features to a single Writer concept, loosing
formatting.

Fix this by introducing a dedicated "plain text" content control type,
which can be used for OOXML's  with , and keep using the
input field only for OOXML fields.

This commit just adds the document model & UNO API, follow-up commits
will add the remaining functionality.

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

diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 5d60ba40ecf1..975972573c30 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -45,6 +45,7 @@ enum class SwContentControlType
 DROP_DOWN_LIST,
 PICTURE,
 DATE,
+PLAIN_TEXT,
 };
 
 /// SfxPoolItem subclass that wraps an SwContentControl.
@@ -143,6 +144,9 @@ class SW_DLLPUBLIC SwContentControl : public 
sw::BroadcastingModify
 /// Date in -MM-DDT00:00:00Z format.
 OUString m_aCurrentDate;
 
+/// Plain text, i.e. not rich text.
+bool m_bPlainText = false;
+
 /// The placeholder's doc part: just remembered.
 OUString m_aPlaceholderDocPart;
 
@@ -258,6 +262,10 @@ public:
 /// Formats m_oSelectedDate, taking m_aDateFormat and m_aDateLanguage into 
account.
 OUString GetDateString() const;
 
+void SetPlainText(bool bPlainText) { m_bPlainText = bPlainText; }
+
+bool GetPlainText() const { return m_bPlainText; }
+
 void SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
 {
 m_aPlaceholderDocPart = rPlaceholderDocPart;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 7fcf2850f873..4f95a99c3a1f 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -883,6 +883,7 @@
 #define UNO_NAME_DATE_FORMAT "DateFormat"
 #define UNO_NAME_DATE_LANGUAGE "DateLanguage"
 #define UNO_NAME_CURRENT_DATE "CurrentDate"
+#define UNO_NAME_PLAIN_TEXT "PlainText"
 #define UNO_NAME_PLACEHOLDER_DOC_PART "PlaceholderDocPart"
 #define UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS "DataBindingPrefixMappings"
 #define UNO_NAME_DATA_BINDING_XPATH "DataBindingXpath"
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index bd2385d1eb54..9ec8b0a340b1 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -679,6 +679,39 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testListIdState)
 CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, eState);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPlainText)
+{
+// Given an empty document:
+SwDoc* pDoc = createSwDoc();
+
+// When inserting a plain text content control around a text portion:
+uno::Reference xMSF(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+xText->insertString(xCursor, "test", /*bAbsorb=*/false);
+xCursor->gotoStart(/*bExpand=*/false);
+xCursor->gotoEnd(/*bExpand=*/true);
+uno::Reference xContentControl(
+xMSF->createInstance("com.sun.star.text.ContentControl"), 
uno::UNO_QUERY);
+uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+xContentControlProps->setPropertyValue("PlainText", uno::Any(true));
+xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
+
+// Then make sure that the text attribute is inserted:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+SwTextNode* pTextNode = 

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

2022-07-15 Thread Miklos Vajna (via logerrit)
 sw/inc/crsrsh.hxx |3 ++-
 sw/inc/formatcontentcontrol.hxx   |7 +++
 sw/inc/viscrs.hxx |2 ++
 sw/qa/core/txtnode/txtnode.cxx|   21 +
 sw/source/core/crsr/contentcontrolbutton.cxx  |4 +++-
 sw/source/core/crsr/crstrvl.cxx   |8 
 sw/source/core/crsr/viscrs.cxx|5 +
 sw/source/core/inc/contentcontrolbutton.hxx   |2 ++
 sw/source/core/txtnode/attrcontentcontrol.cxx |   12 
 sw/source/uibase/docvw/edtwin.cxx |   21 +
 10 files changed, 79 insertions(+), 6 deletions(-)

New commits:
commit d65e85178abdd4f1bf068f161e49204e068bb5da
Author: Miklos Vajna 
AuthorDate: Fri Jul 15 11:37:58 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 15 12:47:40 2022 +0200

sw content control, dropdown: allow selecting via the keyboard

It was not possible to select an entry from a content control dropdown
using the keyboard, which breaks accessibility.

This had the benefit that the mouse handler code could contain the popup
start calls, but Word can do this with alt-down arrow, so make sense to
add it on our side as well.

Fix the problem by adding SwContentControl::ShouldOpenPopup(), which
knows that dropdowns want a popup with alt-down, and then connecting
SwEditWin::KeyInput() to it.

Date content controls probably will want something similar, but that's
not yet done in this commit.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2dd27529810a..fb6e00106691 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -59,6 +59,7 @@ class SwBlockCursor;
 class SwPostItField;
 class SwTextField;
 class SwTextFootnote;
+class SwTextContentControl;
 
 namespace i18nutil {
 struct SearchOptions2;
@@ -717,7 +718,7 @@ public:
 const bool bIncludeInputFieldAtStart );
 SwField* GetCurField( const bool bIncludeInputFieldAtStart = false ) const;
 bool CursorInsideInputField() const;
-bool CursorInsideContentControl() const;
+SwTextContentControl* CursorInsideContentControl() const;
 static bool PosInsideInputField( const SwPosition& rPos );
 bool DocPtInsideInputField( const Point& rDocPt ) const;
 static sal_Int32 StartOfInputFieldAtPos( const SwPosition& rPos );
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 839a7919ee6b..5d60ba40ecf1 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -29,6 +29,10 @@
 #include "calbck.hxx"
 #include "swdllapi.h"
 
+namespace vcl
+{
+class KeyCode;
+}
 class SwContentControl;
 class SwTextContentControl;
 class SwTextNode;
@@ -275,6 +279,9 @@ public:
 /// Should this character (during key input) interact with the content 
control?
 bool IsInteractingCharacter(sal_Unicode cCh);
 
+/// Given rKeyCode as a keyboard event, should a popup be opened for this 
content control?
+bool ShouldOpenPopup(const vcl::KeyCode& rKeyCode);
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
 void SetDataBindingPrefixMappings(const OUString& 
rDataBindingPrefixMappings)
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index c5d97fc023c1..6126f5ffa0c0 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -115,6 +115,8 @@ public:
 
 void SetShowContentControlOverlay(const bool bShow) { 
m_bShowContentControlOverlay = bShow; }
 
+VclPtr GetContentControlButton() const;
+
 const SwCursorShell* GetShell() const { return m_pCursorShell; }
 // check current MapMode of the shell and set possibly the static members.
 // Optional set the parameters pX, pY
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 55fece606c4c..7791cf82bbc3 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -249,6 +249,27 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testCheckboxContentControlKeyboard)
 CPPUNIT_ASSERT(pContentControl->GetChecked());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard)
+{
+// Given an already selected dropdown content control:
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
+
+// When checking if alt-down should open a popup:
+SwTextContentControl* pTextContentControl = 
pWrtShell->CursorInsideContentControl();
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+vcl::KeyCode aKeyCode(KEY_DOWN, KEY_MOD2);
+bool bShouldOpen = 

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

2022-07-14 Thread Miklos Vajna (via logerrit)
 sw/inc/formatcontentcontrol.hxx   |3 ++
 sw/qa/core/txtnode/txtnode.cxx|   29 ++
 sw/source/core/txtnode/attrcontentcontrol.cxx |   10 
 sw/source/uibase/docvw/edtwin.cxx |   23 
 4 files changed, 65 insertions(+)

New commits:
commit c6eb8713438d1ba791fc858c8dc6e3d4d6583e0a
Author: Miklos Vajna 
AuthorDate: Thu Jul 14 15:52:37 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 14 19:05:27 2022 +0200

sw content control, checkbox: allow toggling via the keyboard

Toggling a checkbox content control was only possible by clicking on it
with the mouse, which breaks accessiblity.

Trying to type into a checkbox content control triggered the read-only
popup (which is good), but there was no special handling for the space
character, which is meant to toggle the checkbox.

Fix the problem by adding a way to query if the current keycode is meant
to interact with the content control, and if so, invoke
GotoContentControl() from SwEditWin::KeyInput(), similar to how the
click handler already did this already.

This only handles checkboxes, but other types can be addressed in a
follow-up commits similarly.

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

diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 82f4fca9e2be..839a7919ee6b 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -272,6 +272,9 @@ public:
 
 std::optional GetSelectedDate() const { return m_oSelectedDate; }
 
+/// Should this character (during key input) interact with the content 
control?
+bool IsInteractingCharacter(sal_Unicode cCh);
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
 void SetDataBindingPrefixMappings(const OUString& 
rDataBindingPrefixMappings)
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index ad44a12f7c9b..55fece606c4c 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -25,6 +25,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/txtnode/data/";
 
@@ -220,6 +225,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testInsertDropDownContentControlTwice)
 pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testCheckboxContentControlKeyboard)
+{
+// Given an already selected checkbox content control:
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX);
+SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin();
+
+// When pressing space on the keyboard:
+KeyEvent aKeyEvent(' ', KEY_SPACE);
+rEditWin.KeyInput(aKeyEvent);
+
+// Then make sure the state is toggled:
+SwTextNode* pTextNode = pWrtShell->GetCursor()->GetNode().GetTextNode();
+SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, 
RES_TXTATR_CONTENTCONTROL);
+auto pTextContentControl = 
static_txtattr_cast(pAttr);
+auto& rFormatContentControl
+= static_cast(pTextContentControl->GetAttr());
+std::shared_ptr pContentControl = 
rFormatContentControl.GetContentControl();
+// Without the accompanying fix in place, this test would have failed, 
because the state
+// remained unchanged.
+CPPUNIT_ASSERT(pContentControl->GetChecked());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 4b5ff4554f15..1f3d26f6c2b6 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -301,6 +301,16 @@ double SwContentControl::GetCurrentDateValue() const
 return dCurrentDate;
 }
 
+bool SwContentControl::IsInteractingCharacter(sal_Unicode cCh)
+{
+if (GetCheckbox())
+{
+return cCh == ' ';
+}
+
+return false;
+}
+
 void SwContentControl::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwContentControl"));
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 420da9d0b295..b81ac632a0e5 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2414,6 +2414,29 @@ KEYINPUT_CHECKTABLE_INSDEL:
 aCh = '\t';
 [[fallthrough]];
 case SwKeyState::InsChar:
+if (rSh.CursorInsideContentControl())
+{
+const SwPosition* pStart = rSh.GetCursor()->Start();
+SwTextNode* pTextNode = 

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

2022-07-11 Thread Attila Bakos (NISZ) (via logerrit)
 sw/inc/textboxhelper.hxx  |   40 ++
 sw/qa/extras/layout/layout.cxx|5 
 sw/qa/extras/ooxmlexport/data/tdf149546.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|6 
 sw/source/core/doc/docfly.cxx |7 
 sw/source/core/doc/textboxhelper.cxx  |  309 ++
 sw/source/core/edit/edundo.cxx|9 
 sw/source/core/layout/atrfrm.cxx  |9 
 sw/source/core/text/porfly.cxx|7 
 sw/source/core/undo/undobj1.cxx   |   12 
 sw/source/core/unocore/unodraw.cxx|   22 +
 sw/source/core/unocore/unotext.cxx|   23 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +
 13 files changed, 348 insertions(+), 128 deletions(-)

New commits:
commit 1d3d2a995239c3c71432006cb795324c56a0412a
Author: Attila Bakos (NISZ) 
AuthorDate: Mon Jun 20 17:27:53 2022 +0200
Commit: László Németh 
CommitDate: Mon Jul 11 14:09:09 2022 +0200

tdf#148687 tdf#149173 tdf#149546 sw: fix crash with textboxes

Regression from 2110597ac730fa07dbbdd603fda82b182ed27c9e
"tdf#147485 sw: fix group shape crash using std::shared_ptr".

Details:

1) Using reference instead of copy assignment in SwTextBoxHelper.

2) Cleanup: Unused parts of SwTextBoxHelper were removed.

3) Fixing destruction of textboxes, in case when first the shape
is removed, with clearing all textboxes from the doc and the shape
before the pointer is released. All of this only have to be done if
the call is not coming from the swdoc dtor, unless there will be
double freeing.

4) Missing style conversion was fixed in writerfilter.

5) Don't import sections in textboxes, unless the hack of dummy
paragraph before tables in sections will be applied and the paragraph
with anchored objects inside will be removed with the objects;

6) ConvertTextRangeToTextFrame also fixed, so embed frames in
frames are imported from now. (Also textboxes in frames, this
can be useful when there is a floating table having group
textbox with nested complex content inside, or floating table
in floating table, etc...) Note: Follow up commit will enable
group textbox import in frames and tables.

7) Import of group textboxes with complex content in header/footer
was impossible, from now this is also supported both from DOCX and
ODT (test included).

8) Guard class for blocking unwanted recursive textbox sync
has been introduced, and maybe some speedup with group
textbox import has been achieved.

9) The anchor sync method got a new function which avoids
unnecessary sync when the anchor is the same.

10) Sync of As_char textboxes during layout calculation caused
crash so that has a workaround from now, for DOCX import anchor
change and Undo. That syncs starts before the layout calculation
so sync not needed later.

11) A memory leak was found in Undo, which has been fixed.

Note: layout test "testTdf147485Forcepoint" has to be limited
to Windows and Mac builds, because font substitution
causes crash on the Unix based systems.

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

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 112b312a0dab..ebf329342d8e 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -179,6 +179,9 @@ public:
 /// vector filled with the textboxes.
 static std::vector CollectTextBoxes(const SdrObject* 
pGroupObject,
 SwFrameFormat* 
pFormat);
+
+// Compares the anchor of the first and second given formats, and decides 
whether sync needed.
+static bool isAnchorSyncNeeded(const SwFrameFormat* pFirst, const 
SwFrameFormat* pSecond);
 };
 
 /// Textboxes are basically textframe + shape pairs. This means one shape has 
one frame.
@@ -187,6 +190,8 @@ public:
 /// it can have multiple textboxes.
 class SwTextBoxNode
 {
+friend class SwTextBoxLockGuard;
+
 // One TextBox-entry
 struct SwTextBoxElement
 {
@@ -194,8 +199,6 @@ class SwTextBoxNode
 SwFrameFormat* m_pTextBoxFormat;
 // The Draw object where the textbox belongs to
 SdrObject* m_pDrawObject;
-// This is for indicating if the textbox is in special case: for 
example during undo.
-bool m_bIsActive;
 };
 
 // This vector stores the textboxes what belongs to this node
@@ -204,8 +207,12 @@ class SwTextBoxNode
 // (and the textboxes)
 SwFrameFormat* m_pOwnerShapeFormat;
 
+// Prevents oscillating during recursive clone calling.
 mutable bool m_bIsCloningInProgress;
 
+// Protection 

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

2022-06-29 Thread Attila Bakos (NISZ) (via logerrit)
 sw/inc/textboxhelper.hxx |   11 +++
 sw/qa/extras/uiwriter/data/tdf149550.docx|binary
 sw/qa/extras/uiwriter/uiwriter6.cxx  |   23 +++
 sw/source/core/doc/DocumentLayoutManager.cxx |   65 +
 sw/source/core/doc/textboxhelper.cxx |   81 ++-
 5 files changed, 118 insertions(+), 62 deletions(-)

New commits:
commit cd67e988f27de819a39e75e5243b9b20ba56faab
Author: Attila Bakos (NISZ) 
AuthorDate: Tue Jun 14 10:38:46 2022 +0200
Commit: László Németh 
CommitDate: Wed Jun 29 10:35:53 2022 +0200

tdf#149550 sw: fix crash by implementing nested textbox copy

Grouped shapes with a nested textbox were copied without
the textbox with frequent crashing.

Regression from commit 2951cbdf3a6e2b62461665546b47e1d253fcb834
"tdf#143574 OOXML export/import of textboxes in group shapes".

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

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index d851a0fda7d2..112b312a0dab 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -26,6 +26,7 @@ class SdrObject;
 class SfxItemSet;
 class SwFrameFormat;
 class SwFrameFormats;
+class SwFormatAnchor;
 class SwFormatContent;
 class SwDoc;
 namespace tools
@@ -203,6 +204,8 @@ class SwTextBoxNode
 // (and the textboxes)
 SwFrameFormat* m_pOwnerShapeFormat;
 
+mutable bool m_bIsCloningInProgress;
+
 public:
 // Not needed.
 SwTextBoxNode() = delete;
@@ -250,6 +253,14 @@ public:
 size_t GetTextBoxCount() const { return m_pTextBoxes.size(); };
 // Returns with a const collection of textboxes owned by this node.
 std::map GetAllTextBoxes() const;
+
+void Clone(SwDoc* pDoc, const SwFormatAnchor& rNewAnc, SwFrameFormat* 
o_pTarget, bool bSetAttr,
+   bool bMakeFrame) const;
+
+private:
+void Clone_Impl(SwDoc* pDoc, const SwFormatAnchor& rNewAnc, SwFrameFormat* 
o_pTarget,
+const SdrObject* pSrcObj, SdrObject* pDestObj, bool 
bSetAttr,
+bool bMakeFrame) const;
 };
 
 #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
diff --git a/sw/qa/extras/uiwriter/data/tdf149550.docx 
b/sw/qa/extras/uiwriter/data/tdf149550.docx
new file mode 100644
index ..3434fc1fff93
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf149550.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index cf37fe5f28ee..b7187568cff4 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2014,6 +2014,29 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testHatchFill)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(30), getProperty(getShape(1), 
"FillTransparence"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testNestedGroupTextBoxCopyCrash)
+{
+createSwDoc(DATA_DIRECTORY, "tdf149550.docx");
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+Scheduler::ProcessEventsToIdle();
+dispatchCommand(mxComponent, ".uno:Copy", {});
+Scheduler::ProcessEventsToIdle();
+// This crashed here before the fix.
+SwXTextDocument* pXTextDocument = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pXTextDocument);
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_ESCAPE);
+Scheduler::ProcessEventsToIdle();
+dispatchCommand(mxComponent, ".uno:Paste", {});
+Scheduler::ProcessEventsToIdle();
+
+CPPUNIT_ASSERT_MESSAGE("Where is the doc, it crashed, isn't it?!", 
mxComponent);
+
+auto pLayout = parseLayoutDump();
+// There must be 2 textboxes!
+assertXPath(pLayout, "/root/page/body/txt/anchored/fly[2]");
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCaptionShape)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 006501b3aa36..a03d5dc1d60d 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -463,67 +463,6 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 if( bMakeFrames )
 pDest->MakeFrames();
 
-// If the draw format has a TextBox, then copy its fly format as well.
-if (rSource.Which() == RES_DRAWFRMFMT && rSource.GetOtherTextBoxFormats())
-{
-auto pObj = rSource.FindRealSdrObject();
-auto pTextBoxNd = 
std::make_shared(SwTextBoxNode(pDest));
-pDest->SetOtherTextBoxFormats(pTextBoxNd);
-
-if (pObj)
-{
-const bool bIsGroupObj = pObj->getChildrenOfSdrObject();
-for (size_t it = 0;
- it < (bIsGroupObj ? 
pObj->getChildrenOfSdrObject()->GetObjCount() : 1); it++)
-{
-auto pChild = bIsGroupObj ? 
pObj->getChildrenOfSdrObject()->GetObj(it)
-  : 

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

2022-06-24 Thread László Németh (via logerrit)
 sw/inc/list.hxx |   23 +++-
 sw/inc/ndtxt.hxx|   15 -
 sw/qa/extras/layout/data/tdf115523.fodt |   42 +++
 sw/qa/extras/layout/layout2.cxx |   27 --
 sw/source/core/doc/list.cxx |   13 +++-
 sw/source/core/text/txtfld.cxx  |   43 +---
 sw/source/core/txtnode/ndtxt.cxx|   86 
 7 files changed, 208 insertions(+), 41 deletions(-)

New commits:
commit 2413f213625253a9c2b1787b3b9fe859d724a9bd
Author: László Németh 
AuthorDate: Thu Jun 23 12:11:22 2022 +0200
Commit: László Németh 
CommitDate: Fri Jun 24 09:16:47 2022 +0200

tdf#115523 sw_redlinenum: show correct, also original numbering

in Show Changes mode, according to the name "Show Changes" and
according to the interoperability requirements.

Instead of the fake numbering which counted the deleted list items
in Show Changes mode, e.g.:

"3. This was the third originally, but now it's the second list item."

now show the correct number followed by the original number within braces:

"2.[3.] This was the third originally, but now it's the second list item."

Note: the tabulators after the longer numbering are replaced with spaces
to avoid messy indentation in Show Changes mode.

New enum values for the alternative lists:

SwListRedlineType::SHOW - the original (fake) numbering in Show Changes 
mode
SwListRedlineType::HIDDEN   - the original numbering of Hide Changes mode, 
and
  new numbering in Show Changes mode
SwListRedlineType::ORIGTEXT - the new numbering of Show Changes mode to show
  the original numbering of the deleted or 
inserted list items

Follow-up to commit c180c9447256588fe5e7991e06642883574760ae
"sw_redlinehide_3: add second SwNodeNum to SwTextNode".

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

diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx
index 14acb303ae07..d62d3a46ea86 100644
--- a/sw/inc/list.hxx
+++ b/sw/inc/list.hxx
@@ -29,6 +29,13 @@ class SwDoc;
 class SwNumRule;
 class SwNodes;
 
+enum class SwListRedlineType
+{
+SHOW,
+HIDDEN,
+ORIGTEXT,
+};
+
 class SwList
 {
 public:
@@ -44,7 +51,7 @@ class SwList
 void SetDefaultListStyleName(OUString const&);
 
 void InsertListItem(SwNodeNum& rNodeNum,
-bool isHiddenRedlines,
+SwListRedlineType eRedlines,
 const int nLevel,
 const SwDoc& rDoc);
 static void RemoveListItem(SwNodeNum& rNodeNum, const SwDoc& rDoc);
@@ -84,10 +91,20 @@ class SwList
 /// the previous node on the same level.
 /// The nodes of pRootRLHidden are a subset of the nodes of pRoot.
 std::unique_ptr pRootRLHidden;
+/// Tree that is missing those nodes that are merged or hidden
+/// by insert redlines; this is only used if there is a layout
+/// that has IsHideRedlines() disabled, and the numbering of the
+/// original text is also shown.
+/// A third tree is needed because not only are the numbers in
+/// the nodes different, the structure of the tree may be different
+/// The nodes of pRootOrigText are a subset of the nodes of pRoot.
+std::unique_ptr pRootOrigText;
 /// top-level SwNodes section
 std::unique_ptr pSection;
-tListTreeForRange(std::unique_ptr p1, 
std::unique_ptr p2, std::unique_ptr p3)
-: pRoot(std::move(p1)), pRootRLHidden(std::move(p2)), 
pSection(std::move(p3)) {}
+tListTreeForRange(std::unique_ptr p1, 
std::unique_ptr p2,
+std::unique_ptr p3, 
std::unique_ptr p4)
+: pRoot(std::move(p1)), pRootRLHidden(std::move(p2)),
+pRootOrigText(std::move(p3)), 
pSection(std::move(p4)) {}
 };
 std::vector maListTrees;
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index a2ca71ea197c..8007beff59cd 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -25,6 +25,7 @@
 #include "IDocumentContentOperations.hxx"
 #include "SwNumberTreeTypes.hxx"
 #include "hintids.hxx"
+#include "list.hxx"
 #include "modeltoviewhelper.hxx"
 #include "ndhints.hxx"
 #include "node.hxx"
@@ -94,6 +95,7 @@ class SW_DLLPUBLIC SwTextNode final
 
 mutable std::unique_ptr mpNodeNum;  ///< Numbering for this 
paragraph.
 mutable std::unique_ptr mpNodeNumRLHidden; ///< Numbering for 
this paragraph (hidden redlines)
+mutable std::unique_ptr mpNodeNumOrig; ///< Numbering for this 
paragraph (before changes)

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

2022-06-13 Thread Miklos Vajna (via logerrit)
 sw/inc/formatcontentcontrol.hxx   |   10 ++
 sw/qa/core/crsr/crsr.cxx  |   28 
 sw/source/core/crsr/pam.cxx   |   26 ++
 sw/source/uibase/wrtsh/wrtsh3.cxx |2 ++
 4 files changed, 66 insertions(+)

New commits:
commit c321498f915f4e8b3f4853232860ce040ab48e46
Author: Miklos Vajna 
AuthorDate: Fri Jun 10 08:16:48 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 13 08:07:02 2022 +0200

sw content controls: reject typing inside checkbox or picture content 
controls

Content controls are editable by default (and not only editable, but
also capable of hosting rich text content), and Writer doesn't limit
the possibility to edit explicitly, either.

Certain content control types (checkbox and picture for now) limit the
hosted content though: checkbox overwrites the content on click and
picture is meant to host a single as-char anchored image. So far the
simple implementation Writer didn't enforce these limits, leading the
unexpected behavior when clicking on checkbox content controls (possibly
not only a checked/non-checked checkmark was toggled, but other content
was removed).

Fix the problem by making these content control types read-only: this is
what also Word does and this way you can't loose the content when you
can't enter it earlier.

We may want to also do this for dropdowns in the future, once combo
boxes will be supported.

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

diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index 17ff97cd1fa6..82f4fca9e2be 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -160,6 +160,12 @@ class SW_DLLPUBLIC SwContentControl : public 
sw::BroadcastingModify
 /// Stores a date timestamp, in case the doc model is not yet updated.
 std::optional m_oSelectedDate;
 
+/**
+ * E.g. checkbox is read-only by default, but we still update contents on 
interaction
+ * internally. This flag is true for the duration of that interaction.
+ */
+bool m_bReadWrite = false;
+
 public:
 SwTextContentControl* GetTextAttr() const;
 
@@ -292,6 +298,10 @@ public:
 void SetColor(const OUString& rColor) { m_aColor = rColor; }
 
 OUString GetColor() const { return m_aColor; }
+
+void SetReadWrite(bool bReadWrite) { m_bReadWrite = bReadWrite; }
+
+bool GetReadWrite() const { return m_bReadWrite; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx
index 882f9b6bcbab..8f8d9963a285 100644
--- a/sw/qa/core/crsr/crsr.cxx
+++ b/sw/qa/core/crsr/crsr.cxx
@@ -136,6 +136,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, 
testContentControlLineBreak)
 CPPUNIT_ASSERT_EQUAL(OUString("t\nest"), 
pTextNode->GetExpandText(pWrtShell->GetLayout()));
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly)
+{
+// Given a document with a checkbox content control:
+SwDoc* pDoc = createSwDoc();
+uno::Reference xMSF(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+xText->insertString(xCursor, u"☐", /*bAbsorb=*/false);
+xCursor->gotoStart(/*bExpand=*/false);
+xCursor->gotoEnd(/*bExpand=*/true);
+uno::Reference xContentControl(
+xMSF->createInstance("com.sun.star.text.ContentControl"), 
uno::UNO_QUERY);
+uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+xContentControlProps->setPropertyValue("Checkbox", uno::Any(true));
+xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
+
+// When entering the content control:
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+// Then make sure that the cursor is read-only:
+// Without the accompanying fix in place, this test would have failed, it 
was possible to type
+// into the checkbox content control, just to loose the typed content on 
the next click.
+CPPUNIT_ASSERT(pWrtShell->HasReadonlySel());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index c54d500cb15d..f771e09f5739 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -49,6 +49,7 @@
 #include 
 
 #include 
+#include 
 
 // for the dump "MSC-" compiler
 static sal_Int32 GetSttOrEnd( bool bCondition, const SwContentNode& rNd )
@@ -811,6 +812,31 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const
 

  1   2   3   4   >