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

2024-06-04 Thread Mike Kaganski (via logerrit)
 sw/inc/crsrsh.hxx   |   12 
 sw/inc/viewsh.hxx   |7 +++
 sw/qa/extras/uiwriter/uiwriter6.cxx |   10 ++
 sw/source/core/crsr/crsrsh.cxx  |   21 +
 sw/source/core/crsr/viscrs.cxx  |   27 ---
 sw/source/core/inc/txtfrm.hxx   |2 +-
 sw/source/core/txtnode/txtedt.cxx   |8 
 7 files changed, 51 insertions(+), 36 deletions(-)

New commits:
commit 44e618096511e8f6e0a6344fab19403503c25148
Author: Mike Kaganski 
AuthorDate: Wed Jun 5 00:41:03 2024 +0500
Commit: Mike Kaganski 
CommitDate: Wed Jun 5 05:28:02 2024 +0200

tdf#136294: trigger pending spellcheck in SwCursorShell::UpdateCursor

This allows to drop the partial fix created for tdf#124603  (except for unit
test). The problem solved in commit 4c91e94e892943ef5e031d65f6f42864233cb4cd
(tdf#92036: sw: fix idle spelling loop,  2015-09-09)  is kept solved; when a
word is marked pending,  this is signalled  to the viewshell.  SwCursorShell
stores that as a flag,  which will then start an idle on cursor update,  and
finally call SwViewShell::LayoutIdle, which does the spell checking.  If the
cursor is still in the word that is pending the check, the cycle will 
repeat,
trying spell checks only at cursor update, not as a busy loop.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index f5e52e398f3d..2417fb507cae 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -243,8 +244,14 @@ private:
 
 bool m_bMacroExecAllowed : 1;
 
+// SwViewShell::LayoutIdle needs to be called on cursor update to repeat a 
spell check,
+// because previous attempt marked a word as pending, because the word had 
cursor
+bool m_bNeedLayoutOnCursorUpdate : 1 = false;
+
 SwFrame* m_oldColFrame;
 
+Idle m_aLayoutIdle; // An idle to schedule another SwViewShell::LayoutIdle 
call
+
 void MoveCursorToNum();
 
 void ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing );
@@ -285,6 +292,9 @@ private:
 const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, 
bool bSelect );
 
 void sendLOKCursorUpdates();
+
+DECL_LINK(DoLayoutIdle, Timer*, void); // calls SwViewShell::LayoutIdle
+
 protected:
 
 inline SwMoveFnCollection const & MakeFindRange( SwDocPositions, 
SwDocPositions, SwPaM* ) const;
@@ -308,6 +318,8 @@ protected:
 protected:
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
+virtual void OnSpellWrongStatePending() override { 
m_bNeedLayoutOnCursorUpdate = true; }
+
 public:
 SwCursorShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt );
 // disguised copy constructor
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index b53a3ed7b719..01a3cc259929 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -609,6 +609,13 @@ public:
 void GetFirstLastVisPageNumbers(SwVisiblePageNumbers& rVisiblePageNumbers, 
SwView& rView);
 
 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+// SwTextFrame::AutoSpell_ calls this, to notify the shell, that a word 
has a spelling error,
+// but that couldn't be drawn, because the cursor was in that word (so 
that the user is not
+// annoyed while typing). The shell's task is to re-run the spell check 
(i.e., call LayoutIdle,
+// which internally does the spell check), when the cursor leaves that 
word (implemented in
+// SwCursorShell).
+virtual void OnSpellWrongStatePending() {}
 };
 
 // manages global ShellPointer
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index a27f506095b3..a9dc5530dab6 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2227,16 +2227,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603)
 bool bPending = !pNode->GetWrong() || !pNode->GetWrong()->Count();
 CPPUNIT_ASSERT(bPending);
 
-// Move right, leave the bad word
+// Move right, leave the bad word - since the fix for tdf#136294, this 
triggers the check
 
 pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
-// tdf#92036 still pending spell checking
-bPending = !pNode->GetWrong() || !pNode->GetWrong()->Count();
-CPPUNIT_ASSERT(bPending);
-
-// Move down to trigger spell checking
-
-pWrtShell->Down(/*bSelect=*/false, 1);
 Scheduler::ProcessEventsToIdle();
 CPPUNIT_ASSERT(pNode->GetWrong());
 // This was 0 (pending spell checking)
@@ -2286,6 +2279,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf45949)
 
 // Move down to trigger spell checking
 

core.git: sw/inc sw/source

2024-06-03 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/doc.hxx  |2 +-
 sw/inc/editsh.hxx   |2 +-
 sw/source/core/doc/docnum.cxx   |6 +++---
 sw/source/core/edit/ednumber.cxx|2 +-
 sw/source/uibase/shells/textsh1.cxx |4 +++-
 5 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 00c92662a688e04c0dcec0db6c253689d662faeb
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jun 3 10:59:04 2024 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jun 3 14:32:32 2024 +0200

tdf#161248 Don't duplicate bullets used in document

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 461f835bc2a5..77944005ec3d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1102,7 +1102,7 @@ public:
 const SvxNumberFormat::SvxNumPositionAndSpaceMode 
eDefaultNumberFormatPositionAndSpaceMode =
 SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
 sal_uInt16 FindNumRule( std::u16string_view rName ) const;
-std::vector GetUsedBullets();
+std::set GetUsedBullets();
 SW_DLLPUBLIC SwNumRule* FindNumRulePtr( const OUString& rName ) const;
 
 // Deletion only possible if Rule is not used!
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 85eb84bca3f5..0de62a1d27de 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -578,7 +578,7 @@ public:
  text node belongs, which applies the found list style. */
 const SwNumRule * SearchNumRule(const bool bNum,
 OUString& sListId );
-std::vector GetUsedBullets();
+std::set GetUsedBullets();
 
 /** Undo.
  Maintain UndoHistory in Document.
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index c4afeac7c50f..93f29d72f1fb 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2526,9 +2526,9 @@ sal_uInt16 SwDoc::FindNumRule( std::u16string_view rName 
) const
 return USHRT_MAX;
 }
 
-std::vector SwDoc::GetUsedBullets()
+std::set SwDoc::GetUsedBullets()
 {
-std::vector aUsedBullets;
+std::set aUsedBullets;
 for (size_t nRule = 0; nRule < mpNumRuleTable->size(); ++nRule)
 {
 for (int nLevel=0; nLevel<10; ++nLevel)
@@ -2543,7 +2543,7 @@ std::vector SwDoc::GetUsedBullets()
 sal_UCS4 cBullet = rFormat.GetBulletChar();
 OUString sBullet(, 1);
 OUString sFontName(aFont.GetFamilyName());
-aUsedBullets.emplace_back(sBullet + sFontName);
+aUsedBullets.emplace(sBullet + sFontName);
 }
 }
 return aUsedBullets;
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index d2d2a0749043..6a60cd47dd40 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -876,7 +876,7 @@ const SwNumRule * SwEditShell::SearchNumRule( const bool 
bNum,
 sListId, GetLayout() );
 }
 
-std::vector SwEditShell::GetUsedBullets()
+std::set SwEditShell::GetUsedBullets()
 {
 return GetDoc()->GetUsedBullets();
 }
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index fa4de6bd9d0d..4606b6228bbc 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2855,7 +2855,9 @@ void SwTextShell::GetState( SfxItemSet  )
 break;
 case FN_BUL_GET_DOC_BULLETS:
 {
-std::vector aBullets = rSh.GetUsedBullets();
+std::set aBulletsSet = rSh.GetUsedBullets();
+std::vector aBullets;
+std::copy(aBulletsSet.begin(), aBulletsSet.end(), 
std::back_inserter(aBullets));
 SfxStringListItem aItem(FN_BUL_GET_DOC_BULLETS);
 uno::Sequence aSeq(aBullets.data(),
  
static_cast(aBullets.size()));


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

2024-06-02 Thread Mike Kaganski (via logerrit)
 sw/inc/viewopt.hxx  |3 +
 sw/qa/extras/layout/data/tdf161368.fodt |   22 
 sw/qa/extras/layout/layout3.cxx |   14 
 sw/source/core/inc/txtfrm.hxx   |2 -
 sw/source/core/layout/pagechg.cxx   |2 -
 sw/source/core/layout/tabfrm.cxx|6 +--
 sw/source/core/layout/wsfrm.cxx |2 -
 sw/source/core/text/guess.cxx   |8 ++--
 sw/source/core/text/guess.hxx   |8 ++--
 sw/source/core/text/inftxt.cxx  |   20 +--
 sw/source/core/text/inftxt.hxx  |   44 -
 sw/source/core/text/itradj.cxx  |   16 -
 sw/source/core/text/itrform2.cxx|   32 +-
 sw/source/core/text/itrform2.hxx|2 -
 sw/source/core/text/itrtxt.hxx  |   19 +--
 sw/source/core/text/pordrop.hxx |   32 +-
 sw/source/core/text/porexp.cxx  |4 +-
 sw/source/core/text/porexp.hxx  |4 +-
 sw/source/core/text/porfld.cxx  |   45 --
 sw/source/core/text/porfld.hxx  |   27 +++
 sw/source/core/text/porfly.cxx  |6 +--
 sw/source/core/text/porftn.hxx  |8 ++--
 sw/source/core/text/porglue.cxx |8 ++--
 sw/source/core/text/porglue.hxx |   16 -
 sw/source/core/text/porhyph.hxx |4 +-
 sw/source/core/text/porlay.cxx  |2 -
 sw/source/core/text/porlin.cxx  |   25 ++
 sw/source/core/text/porlin.hxx  |5 +-
 sw/source/core/text/pormulti.cxx|8 ++--
 sw/source/core/text/porref.cxx  |2 -
 sw/source/core/text/porref.hxx  |4 +-
 sw/source/core/text/porrst.cxx  |   13 +++
 sw/source/core/text/porrst.hxx  |   14 
 sw/source/core/text/portab.hxx  |   24 ++---
 sw/source/core/text/portox.cxx  |2 -
 sw/source/core/text/portox.hxx  |4 +-
 sw/source/core/text/portxt.cxx  |   10 ++---
 sw/source/core/text/portxt.hxx  |8 ++--
 sw/source/core/text/txtdrop.cxx |   55 +++-
 sw/source/core/text/txtfrm.cxx  |   10 ++---
 sw/source/core/text/txtftn.cxx  |   27 +++
 sw/source/core/text/txthyph.cxx |4 +-
 sw/source/core/text/txttab.cxx  |   48 +--
 sw/source/uibase/config/viewopt.cxx |   17 -
 44 files changed, 330 insertions(+), 306 deletions(-)

New commits:
commit 7e9c23894bd45e015accf26ae0a77035b7eed452
Author: Mike Kaganski 
AuthorDate: Sun Jun 2 15:53:38 2024 +0500
Commit: Mike Kaganski 
CommitDate: Sun Jun 2 19:18:27 2024 +0200

tdf#161368: use SwTwips for twip sizes, instead of sal_uInt16

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

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index e32fea4975db..4f34c7286d3b 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include "swdllapi.h"
+#include "swtypes.hxx"
 
 class SwRect;
 class OutputDevice;
@@ -446,7 +447,7 @@ public:
 
 void PaintPostIts( OutputDevice *pOut, const SwRect ,
   bool bIsScript ) const;
-static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut );
+static SwTwips GetPostItsWidth(const OutputDevice* pOut);
 
 //show/hide tooltips on tracked changes
 bool IsShowInlineTooltips() const
diff --git a/sw/qa/extras/layout/data/tdf161368.fodt 
b/sw/qa/extras/layout/data/tdf161368.fodt
new file mode 100644
index ..72401c3fb29b
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf161368.fodt
@@ -0,0 +1,22 @@
+
+
+
+ 
+  
+ 
+ 
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum 
consequat mi quis pretium semper. Proin luctus orci ac neque venenatis, quis 
commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. Donec 
blandit auctor arcu, nec pellentesque eros molestie eget. In consectetur 
aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non 
pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper 
vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est 
orci.
+   Integer sodales tincidunt tristique. Sed a metus posuere, 
adipiscing nunc et, viverra odio. Donec auctor molestie sem, sit amet tristique 
lectus hendrerit sed. Cras sodales nisl sed orci mattis iaculis. Nunc eget 
dolor accumsan, pharetra risus a, vestibulum mauris. Nunc vulputate lobortis 
mollis. Vivamus nec tellus faucibus, tempor magna nec, facilisis felis. Donec 
commodo enim a vehicula pellentesque. Nullam vehicula vestibulum est vel 
ultricies.
+   Aliquam velit massa, laoreet vel leo nec, volutpat facilisis eros. 
Donec 

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

2024-05-31 Thread László Németh (via logerrit)
 sw/inc/fesh.hxx |2 -
 sw/qa/extras/uiwriter/uiwriter6.cxx |   65 ++--
 sw/source/core/frmedt/feshview.cxx  |   30 ++--
 sw/source/uibase/docvw/edtwin.cxx   |   11 +-
 4 files changed, 101 insertions(+), 7 deletions(-)

New commits:
commit 2f7bb481c57458a38769ebd961f07cc45767f1f7
Author: László Németh 
AuthorDate: Thu May 30 01:22:59 2024 +0200
Commit: László Németh 
CommitDate: Fri May 31 09:47:59 2024 +0200

tdf#161332 sw: fix missing selection of floating table

A fixed-height cell can contain a bigger image, which is
cropped by cell boundaries. In this case, it was not
possible to select the floating table by clicking on its
right border.

Note: fix also tests of tdf#44773 and tdf#160836 related
to DPI-dependent platforms, see tdf#160992.

Follow-up to commit 30de13743f144aced83bc43d310592f82788c910
"tdf#160836 sw: resize rows at images cropped by row height"
and commit f3b899655018397e71300dbb32cdf4f82940a68b
"tdf#160842 sw: select cell content instead of cropped part of image".

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

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 1c2d917ffd7c..b032a0b05b7b 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -297,7 +297,7 @@ public:
 /** Test if there is a draw object at that position and if it should be 
selected.
  The 'should' is aimed at Writer text fly frames which may be in front of
  the draw object. */
-bool ShouldObjectBeSelected(const Point& rPt);
+bool ShouldObjectBeSelected(const Point& rPt, bool 
*pSelectFrameInsteadOfCroppedImage = nullptr);
 
 bool MoveAnchor( SwMove nDir );
 
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 6322120748da..aedec9304791 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1470,7 +1470,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773)
 rEditWin.ReleaseMouse();
 
 // this was 396 (not modified row height previously)
-CPPUNIT_ASSERT_EQUAL(tools::Long(810), pCellA1->getFrameArea().Height());
+CPPUNIT_ASSERT_GREATER(tools::Long(750), pCellA1->getFrameArea().Height());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842)
@@ -1557,7 +1557,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836)
 rEditWin.ReleaseMouse();
 
 // this was 3910 (not modified row height previously)
-CPPUNIT_ASSERT_EQUAL(tools::Long(1980), pCellA1->getFrameArea().Height());
+CPPUNIT_ASSERT_LESS(tools::Long(2000), pCellA1->getFrameArea().Height());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261)
@@ -1622,6 +1622,67 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261)
 CPPUNIT_ASSERT_GREATER(sal_Int32(8000), xShape->getSize().Height);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161332)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+// the cursor is not in the table
+CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable());
+
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pPageFly = dynamic_cast(rPageObjs[0]);
+CPPUNIT_ASSERT(pPageFly);
+auto pTable = dynamic_cast(pPageFly->GetLower());
+CPPUNIT_ASSERT(pTable);
+auto pRow1 = pTable->GetLower();
+CPPUNIT_ASSERT(pRow1->IsRowFrame());
+auto pCellA1 = pRow1->GetLower();
+CPPUNIT_ASSERT(pCellA1);
+const SwRect& rCellA1Rect = pCellA1->getFrameArea();
+auto nRowHeight = rCellA1Rect.Height();
+
+// select text frame by clicking on it at the right side of the upper cell
+Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width(), rCellA1Rect.Top() + 
nRowHeight / 2);
+vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
+Point aFrom = rEditWin.LogicToPixel(ptFrom);
+MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent);
+rEditWin.MouseButtonUp(aClickEvent);
+
+// Then make sure that the text frame is selected:
+SelectionType eType = pWrtShell->GetSelectionType();
+// This was false (SelectionType::Graphic)
+CPPUNIT_ASSERT_EQUAL(SelectionType::Frame, eType);
+
+// remove selection
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+// select text frame by clicking on it at the right side of the bottom cell
+auto pRow2 = pRow1->GetNext();
+CPPUNIT_ASSERT(pRow2->IsRowFrame());
+auto pCellA2 = 

core.git: sw/inc sw/source

2024-05-29 Thread Pranam Lashkari (via logerrit)
 sw/inc/PostItMgr.hxx  |1 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |   22 +-
 sw/source/uibase/docvw/PostItMgr.cxx  |5 +
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 124a988ea99096ea5080060c0d1a801528bd7a5c
Author: Pranam Lashkari 
AuthorDate: Wed May 22 11:57:57 2024 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 29 14:24:31 2024 +0200

create comment reply synchronously

so we can bundle the creation of the comment and the insertion
of its "reply" characteristics together as a single Undo group.

wrap the new combination with a single undo operation showing "Insert
Comment" using Rewriter

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

diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 1a6dac4a8f62..e2922a045a1c 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -195,6 +195,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 sw::annotation::SwAnnotationWin* GetNextPostIt( sal_uInt16 aDirection,
 
sw::annotation::SwAnnotationWin* aPostIt);
 SwPostItField* GetLatestPostItField();
+sw::annotation::SwAnnotationWin* 
GetOrCreateAnnotationWindowForLatestPostItField();
 
 tools::Long GetNextBorder();
 
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 75edfe80edb2..a20255f1c37b 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1053,6 +1053,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 case FN_POSTIT:
 case FN_REPLY:
 {
+const bool bReply = nSlot == FN_REPLY;
 // if this note is empty, it will be deleted once losing the 
focus, so no reply, but only a new note
 // will be created
 if (!mpOutliner->GetEditEngine().GetText().isEmpty())
@@ -1063,16 +1064,35 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 if (mrMgr.HasActiveSidebarWin())
 mrMgr.SetActiveSidebarWin(nullptr);
 SwitchToFieldPos();
+
+SwDocShell* pShell = mrView.GetDocShell();
+if (bReply)
+
pShell->GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::START, nullptr);
+
+// synchronous dispatch
 mrView.GetViewFrame().GetDispatcher()->Execute(FN_POSTIT);
 
-if (nSlot == FN_REPLY)
+if (bReply)
 {
+SwUndoId nUndoId(SwUndoId::END);
+mrView.GetWrtShell().GetLastUndoInfo(nullptr, );
+
 // Get newly created SwPostItField and set its paraIdParent
 auto pPostItField = mrMgr.GetLatestPostItField();
 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
 
pPostItField->SetParentPostItId(GetTopReplyNote()->GetPostItField()->GetPostItId());
 this->GeneratePostItName();
 
pPostItField->SetParentName(GetTopReplyNote()->GetPostItField()->GetName());
+
+// In this case, force generating the associated window
+// synchronously so we can bundle its use of the registered
+// "Answer" into the same undo group that the synchronous
+// FN_POSTIT was put in
+mrMgr.GetOrCreateAnnotationWindowForLatestPostItField();
+
+SwRewriter aRewriter;
+aRewriter.AddRule(UndoArg1, pPostItField->GetDescription());
+pShell->GetDoc()->GetIDocumentUndoRedo().EndUndo(nUndoId, 
);
 }
 break;
 }
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index ebd1223c586d..afb2238c3a04 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1858,6 +1858,11 @@ SwPostItField* SwPostItMgr::GetLatestPostItField()
 return 
static_cast(mvPostItFields.back()->GetFormatField().GetField());
 }
 
+sw::annotation::SwAnnotationWin* 
SwPostItMgr::GetOrCreateAnnotationWindowForLatestPostItField()
+{
+return GetOrCreateAnnotationWindow(*mvPostItFields.back());
+}
+
 SwAnnotationWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
   SwAnnotationWin* aPostIt )
 {


core.git: sw/inc sw/source

2024-05-28 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtftntx.hxx  |1 +
 sw/source/core/layout/atrfrm.cxx |8 
 2 files changed, 9 insertions(+)

New commits:
commit f4ec4f6068a1ca265dd25c479cc40c546ae9223e
Author: Miklos Vajna 
AuthorDate: Tue May 28 09:51:56 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 28 15:11:34 2024 +0200

sw doc model xml dump: show SwFormatEndAtTextEnd

Decides if endnotes are collected at section end or the normal doc end.
Previously only the pool item name was visible, not the value.

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

diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx
index a5de432ccad7..16e63657abf7 100644
--- a/sw/inc/fmtftntx.hxx
+++ b/sw/inc/fmtftntx.hxx
@@ -110,6 +110,7 @@ public:
 }
 
 virtual SwFormatEndAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const 
override;
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 inline const SwFormatFootnoteAtTextEnd ::GetFootnoteAtTextEnd(bool 
bInP) const
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 67047d7b0bf9..0dee2d60520f 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1993,6 +1993,14 @@ SwFormatEditInReadonly* SwFormatEditInReadonly::Clone( 
SfxItemPool* ) const
 return new SwFormatEditInReadonly( *this );
 }
 
+void SwFormatEndAtTextEnd::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatEndAtTextEnd"));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), 
BAD_CAST(OString::number(Which()).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), 
BAD_CAST(OString::number(GetValue()).getStr()));
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 SwFormatLayoutSplit* SwFormatLayoutSplit::Clone( SfxItemPool* ) const
 {
 return new SwFormatLayoutSplit( *this );


core.git: sw/inc

2024-05-28 Thread Xisco Fauli (via logerrit)
 sw/inc/textboxhelper.hxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 0753aa966eba18ddf0534abd21ff92edcfdb7982
Author: Xisco Fauli 
AuthorDate: Tue May 28 09:55:09 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 28 15:10:19 2024 +0200

sw: use SAL_RET_MAYBENULL in getOtherTextBoxFormat()

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

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index c4f4c3d8fbbb..4afd6fa9960c 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -122,10 +122,11 @@ public:
  *
  * @see isTextBox
  */
-static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, 
sal_uInt16 nType,
-const SdrObject* pObject = 
nullptr);
+SAL_RET_MAYBENULL static SwFrameFormat*
+getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType,
+  const SdrObject* pObject = nullptr);
 /// If we have an associated TextFrame, then return that.
-static SwFrameFormat*
+SAL_RET_MAYBENULL static SwFrameFormat*
 getOtherTextBoxFormat(css::uno::Reference const& 
xShape);
 /// If we have an associated TextFrame, then return its XTextFrame.
 static css::uno::Reference


core.git: sw/inc sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/inc/contentindex.hxx|2 +-
 sw/source/core/txtnode/ndtxt.cxx   |2 +-
 sw/source/core/unocore/unotext.cxx |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6de49dee825c6bd093007b4c954f97812c3fdb47
Author: Miklos Vajna 
AuthorDate: Fri May 24 13:09:36 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 14:22:07 2024 +0200

sw: rename SwIndex to SwContentIndex in comments

Leftover from commit 9fdb06d65a8f2c3401392bffee9c4639e178aada (rename
SwIndex->SwContentIndex, 2022-07-25).

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

diff --git a/sw/inc/contentindex.hxx b/sw/inc/contentindex.hxx
index 873e1512ca4f..ea54b1c052a2 100644
--- a/sw/inc/contentindex.hxx
+++ b/sw/inc/contentindex.hxx
@@ -44,7 +44,7 @@ private:
 SwContentIndex * m_pNext;
 SwContentIndex * m_pPrev;
 
-/// points to the SwRangeRedline (if any) that contains this SwIndex, via 
SwPosition and SwPaM
+/// points to the SwRangeRedline (if any) that contains this 
SwContentIndex, via SwPosition and SwPaM
 SwRangeRedline * m_pRangeRedline = nullptr;
 
 /// Pointer to a mark that owns this position to allow fast lookup of 
marks of an SwContentIndexReg.
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 34619f0c7dfb..1d71a1cd8169 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1455,7 +1455,7 @@ void SwTextNode::Update(
 if (!(eMode & UpdateMode::Negative) && !(eMode & UpdateMode::Delete))
 {
 std::vector vMyRedlines;
-// walk the list of SwIndex attached to me and see if any of them are 
redlines
+// walk the list of SwContentIndex attached to me and see if any of 
them are redlines
 const SwContentIndex* pContentNodeIndex = GetFirstIndex();
 while (pContentNodeIndex)
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 50d9f75db63f..39b2016335ba 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1579,7 +1579,7 @@ SwXText::convertToTextFrame(
 (pStartStartNode != GetStartNode()))
 {
 // if not - remove the additional paragraphs and throw
-oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes
+oAnchorCheckPam.reset(); // clear SwContentIndex before deleting 
nodes
 if (bParaBeforeInserted)
 {
 SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
@@ -1653,7 +1653,7 @@ SwXText::convertToTextFrame(
 }
 }
 }
-oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes
+oAnchorCheckPam.reset(); // clear SwContentIndex before deleting nodes
 
 const rtl::Reference xNewFrame =
 SwXTextFrame::CreateXTextFrame(*m_pImpl->m_pDoc, nullptr);


core.git: sw/inc

2024-05-23 Thread Xisco Fauli (via logerrit)
 sw/inc/dcontact.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c7a09ea9d58fbf41090508e32334be3c0356b050
Author: Xisco Fauli 
AuthorDate: Fri May 17 17:49:54 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 23 11:47:47 2024 +0200

use SAL_RET_MAYBENULL in GetUserCall

after 495b5db74f0db59395ff68bacc8d8ca67595b66e
"sw: check GetUserCall"

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

diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index b4d501f44ccf..c8bfa42e1eab 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -57,7 +57,7 @@ void setContextWritingMode( SdrObject* pObj, SwFrame const * 
pAnchor );
 SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj );
 
 /// @return UserCall of group object (if applicable).
-SwContact* GetUserCall( const SdrObject* );
+SAL_RET_MAYBENULL SwContact* GetUserCall( const SdrObject* );
 
 /// @return TRUE if the SrdObject is a Marquee object.
 bool IsMarqueeTextObj( const SdrObject& rObj );


core.git: sw/inc sw/source

2024-05-22 Thread Caolán McNamara (via logerrit)
 sw/inc/PostItMgr.hxx |2 +
 sw/source/uibase/docvw/PostItMgr.cxx |   40 +--
 2 files changed, 26 insertions(+), 16 deletions(-)

New commits:
commit 80f7f3e8099e05632201d7b18de0112153ebc1ba
Author: Caolán McNamara 
AuthorDate: Wed May 22 11:13:12 2024 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 22 22:24:41 2024 +0200

split a piece of code out as a standalone GetOrCreateAnnotationWindow

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

diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 2278ae05ea6f..1a6dac4a8f62 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -132,6 +132,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 SwSidebarItem*  InsertItem( SfxBroadcaster* pItem, bool 
bCheckExistence, bool bFocus);
 voidRemoveItem( SfxBroadcaster* pBroadcast );
 
+VclPtr 
GetOrCreateAnnotationWindow(SwSidebarItem& rItem);
+
 public:
 SwPostItMgr(SwView* aDoc);
 virtual ~SwPostItMgr() override;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 32d0f938e71c..95eaea2a5557 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -695,6 +695,28 @@ void SwPostItMgr::PreparePageContainer()
 }
 }
 
+VclPtr 
SwPostItMgr::GetOrCreateAnnotationWindow(SwSidebarItem& rItem)
+{
+VclPtr pPostIt = rItem.mpPostIt;
+if (!pPostIt)
+{
+pPostIt = rItem.GetSidebarWindow( mpView->GetEditWin(),
+  *this );
+pPostIt->InitControls();
+pPostIt->SetReadonly(mbReadOnly);
+rItem.mpPostIt = pPostIt;
+if (mpAnswer)
+{
+if (pPostIt->GetPostItField()->GetParentPostItId() != 0) //do we 
really have another note in front of this one
+{
+pPostIt->InitAnswer(*mpAnswer);
+}
+mpAnswer.reset();
+}
+}
+return rItem.mpPostIt;
+}
+
 void SwPostItMgr::LayoutPostIts()
 {
 const bool bLoKitActive = comphelper::LibreOfficeKit::isActive();
@@ -724,24 +746,9 @@ void SwPostItMgr::LayoutPostIts()
 
 for (auto const& pItem : pPage->mvSidebarItems)
 {
-VclPtr pPostIt = pItem->mpPostIt;
-
 if (pItem->mbShow)
 {
-if (!pPostIt)
-{
-pPostIt = pItem->GetSidebarWindow( 
mpView->GetEditWin(),
-  *this );
-pPostIt->InitControls();
-pPostIt->SetReadonly(mbReadOnly);
-pItem->mpPostIt = pPostIt;
-if (mpAnswer)
-{
-if 
(pPostIt->GetPostItField()->GetParentPostItId() != 0) //do we really have 
another note in front of this one
-pPostIt->InitAnswer(*mpAnswer);
-mpAnswer.reset();
-}
-}
+VclPtr pPostIt = 
GetOrCreateAnnotationWindow(*pItem);
 
 pPostIt->SetChangeTracking(
 pItem->mLayoutStatus,
@@ -808,6 +815,7 @@ void SwPostItMgr::LayoutPostIts()
 }
 else // we don't want to see it
 {
+VclPtr pPostIt = pItem->mpPostIt;
 if (pPostIt)
 pPostIt->HideNote();
 }


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

2024-05-08 Thread Miklos Vajna (via logerrit)
 sw/inc/ftninfo.hxx|5 +
 sw/source/core/doc/docftn.cxx |   19 +++
 sw/source/core/doc/docnew.cxx |1 +
 3 files changed, 25 insertions(+)

New commits:
commit 90f19126fa405a0632eae4ee8525b66bbce12625
Author: Miklos Vajna 
AuthorDate: Wed May 8 08:59:47 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 8 12:49:04 2024 +0200

tdf#160984 sw continuous endnotes: introduce an endnote section

Word lays out endnotes at the end of the document inline after body
text, Writer puts them on one or more separate endnote pages.

There was already an attempt in the past to resolve this difference, see
commit 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (tdf#124601 sw: add
ContinuousEndnotes layout compat option, 2019-09-30). The approach back
then was to map such endnotes to footnotes, so the extra, unwanted page
doesn't appear. This turned out to be not working too well, the compat
option is only enabled for DOC, and even there commit
dc11f5b151e1a2ea2623fc8cf806a400763955d9 (tdf#143445 DOC import: limit
the usage of the CONTINUOUS_ENDNOTES compat flag, 2023-05-23) limited
the usage of the compat flag to 1 or 2 endnotes only.

Coming back to this, try a new approach: create a section that more or
less exists only at a layout level and put endnotes into that section.
This allows reusing all the complex logic on how to lay out endnotes
inline, on one or more pages. The plan is that this new approach is more
robust, can replace the old continuous endnotes layout code and then can
be enabled for DOCX as well.

This commit just introduces the backing section format and SwSection for
that special "endnotes section" (it's special because SwSection is
usually owned by an SwSectionNode, but here there is no doc model node
for the SwSection), SwFootnoteBossFrame::AppendFootnote() doesn't try to
use the new SwEndNoteInfo::GetSwSection() yet.

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

diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx
index 17742687c944..c5490ed885d0 100644
--- a/sw/inc/ftninfo.hxx
+++ b/sw/inc/ftninfo.hxx
@@ -28,12 +28,14 @@ class SwTextFormatColl;
 class SwPageDesc;
 class SwCharFormat;
 class SwDoc;
+class SwSection;
 
 class SW_DLLPUBLIC SwEndNoteInfo : public SwClient
 {
 mutable sw::WriterMultiListener m_aDepends;
 mutable SwTextFormatColl* m_pTextFormatColl;
 mutable SwPageDesc* m_pPageDesc;
+mutable std::unique_ptr m_pSwSection;
 mutable SwCharFormat* m_pCharFormat;
 mutable SwCharFormat* m_pAnchorFormat;
 OUString m_sPrefix;
@@ -51,6 +53,9 @@ public:
 bool KnowsPageDesc() const;
 bool DependsOn(const SwPageDesc*) const;
 
+SwSection* GetSwSection(SwDoc& rDoc) const;
+void ResetSwSection();
+
 void SetFootnoteTextColl(SwTextFormatColl& rColl);
 SwTextFormatColl* GetFootnoteTextColl() const { return m_pTextFormatColl; 
} // can be 0.
 
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 16f6694c94c5..f211dcdcc9f4 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
 {
@@ -130,6 +132,23 @@ void SwEndNoteInfo::ChgPageDesc(SwPageDesc* pDesc)
 m_aDepends.StartListening(m_pPageDesc);
 }
 
+SwSection* SwEndNoteInfo::GetSwSection(SwDoc& rDoc) const
+{
+if (!m_pSwSection)
+{
+SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
+pFormat->SetFormatName(UNO_NAME_ENDNOTE);
+pFormat->SetFormatAttr(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+m_pSwSection.reset(new SwSection(SectionType::Content, 
pFormat->GetName(), *pFormat));
+}
+return m_pSwSection.get();
+}
+
+void SwEndNoteInfo::ResetSwSection()
+{
+m_pSwSection.reset();
+}
+
 void SwEndNoteInfo::SetFootnoteTextColl(SwTextFormatColl& rFormat)
 {
 m_aDepends.EndListening(m_pTextFormatColl);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index a56e7343e8f1..daef5f64be75 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -505,6 +505,7 @@ SwDoc::~SwDoc()
 // do not have any dependencies anymore.
 m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
 rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
+mpEndNoteInfo->ResetSwSection();
 
 // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no 
clients
 for (const auto& pType : *mpTOXTypes)


core.git: sw/inc

2024-05-04 Thread Noel Grandin (via logerrit)
 sw/inc/format.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 02ce80ca2d69296dcbf799dc49302bf071887a25
Author: Noel Grandin 
AuthorDate: Sat May 4 15:05:45 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat May 4 20:12:42 2024 +0200

fix Windows build

probably since
commit 51f3916a102c3a3c16dd84310aadfa3c935e516b
Author: Noel Grandin 
Date:   Thu May 2 14:39:14 2024 +0200
replace createFromAscii with OUString literals in SwFormat

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

diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 5f0a2307893d..b38d9549b15e 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -66,7 +66,7 @@ class SAL_DLLPUBLIC_RTTI SwFormat : public 
sw::BorderCacheOwner, public sw::Broa
 virtual void InvalidateInSwFntCache(sal_uInt16) {};
 
 protected:
-SwFormat( SwAttrPool& rPool, const OUString& rFormatNm,
+SW_DLLPUBLIC SwFormat( SwAttrPool& rPool, const OUString& rFormatNm,
 const WhichRangesContainer& pWhichRanges, SwFormat *pDrvdFrame, 
sal_uInt16 nFormatWhich );
 SwFormat( const SwFormat& rFormat );
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;


core.git: sw/inc sw/source

2024-05-03 Thread Noel Grandin (via logerrit)
 sw/inc/fmtcol.hxx|   27 ++-
 sw/inc/format.hxx|4 +---
 sw/inc/frmfmt.hxx|7 ---
 sw/source/core/attr/format.cxx   |   25 ++---
 sw/source/core/doc/DocumentLayoutManager.cxx |2 +-
 sw/source/core/doc/docdesc.cxx   |4 ++--
 sw/source/core/doc/docfmt.cxx|4 ++--
 sw/source/core/doc/docnew.cxx|   10 +-
 sw/source/core/layout/atrfrm.cxx |   11 ---
 9 files changed, 15 insertions(+), 79 deletions(-)

New commits:
commit 51f3916a102c3a3c16dd84310aadfa3c935e516b
Author: Noel Grandin 
AuthorDate: Thu May 2 14:39:14 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri May 3 21:26:59 2024 +0200

replace createFromAscii with OUString literals in SwFormat

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

diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 04b28e5bcf30..8ff61b8d0e98 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -37,12 +37,6 @@ namespace sw{ class DocumentStylePoolManager; }
 class SAL_DLLPUBLIC_RTTI SwFormatColl: public SwFormat
 {
 protected:
-SwFormatColl( SwAttrPool& rPool, const char* pFormatName,
-const WhichRangesContainer& pWhichRanges, SwFormatColl* 
pDerFrom,
-sal_uInt16 nFormatWhich )
-  : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich 
)
-{ SetAuto(false); }
-
 SwFormatColl( SwAttrPool& rPool, const OUString ,
 const WhichRangesContainer& pWhichRanges, SwFormatColl* 
pDerFrom,
 sal_uInt16 nFormatWhich )
@@ -75,19 +69,8 @@ class SAL_DLLPUBLIC_RTTI SwTextFormatColl
 SwCharFormat* mpLinkedCharFormat = nullptr;
 
 protected:
-SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
-SwTextFormatColl* pDerFrom = nullptr,
-sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
-: SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, 
pDerFrom, nFormatWh)
-, mbStayAssignedToListLevelOfOutlineStyle(false)
-, mbAssignedToOutlineStyle(false)
-, m_bInSwFntCache(false)
-{
-mpNextTextFormatColl = this;
-}
-
 SwTextFormatColl( SwAttrPool& rPool, const OUString ,
-SwTextFormatColl* pDerFrom,
+SwTextFormatColl* pDerFrom = nullptr,
 sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
 : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, 
pDerFrom, nFormatWh)
 , mbStayAssignedToListLevelOfOutlineStyle(false)
@@ -177,14 +160,8 @@ class SwGrfFormatColl final : public SwFormatColl
 {
 friend class SwDoc;
 
-SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
-SwGrfFormatColl* pDerFrom = nullptr )
-: SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
-pDerFrom, RES_GRFFMTCOLL )
-{}
-
 SwGrfFormatColl( SwAttrPool& rPool, const OUString ,
-SwGrfFormatColl* pDerFrom )
+SwGrfFormatColl* pDerFrom = nullptr )
 : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
 pDerFrom, RES_GRFFMTCOLL )
 {}
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 92c7b73b73bf..5f0a2307893d 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -66,10 +66,8 @@ class SAL_DLLPUBLIC_RTTI SwFormat : public 
sw::BorderCacheOwner, public sw::Broa
 virtual void InvalidateInSwFntCache(sal_uInt16) {};
 
 protected:
-SwFormat( SwAttrPool& rPool, const char* pFormatNm,
+SwFormat( SwAttrPool& rPool, const OUString& rFormatNm,
 const WhichRangesContainer& pWhichRanges, SwFormat *pDrvdFrame, 
sal_uInt16 nFormatWhich );
-SwFormat( SwAttrPool& rPool, OUString aFormatNm, const 
WhichRangesContainer& pWhichRanges,
-SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
 SwFormat( const SwFormat& rFormat );
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 void Destr();
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 3c3203be5b89..a27ec875aef5 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -97,13 +97,6 @@ class SAL_DLLPUBLIC_RTTI SwFrameFormat
 };
 
 protected:
-SwFrameFormat(
-SwAttrPool& rPool,
-const char* pFormatNm,
-SwFrameFormat *pDrvdFrame,
-sal_uInt16 nFormatWhich = RES_FRMFMT,
-const WhichRangesContainer& pWhichRange = aFrameFormatSetRange);
-
 SwFrameFormat(
 SwAttrPool& rPool,
 const OUString ,
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index bcc8920cce73..8f38f7fc8ba8 100644
--- a/sw/source/core/attr/format.cxx
+++ 

core.git: sw/inc sw/source

2024-05-01 Thread Noel Grandin (via logerrit)
 sw/inc/unotxdoc.hxx|2 ++
 sw/source/uibase/uno/unotxdoc.cxx  |   14 ++
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx |   20 ++--
 3 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit ed015246b9b27e1ea1f87bc125262850d7128c0f
Author: Noel Grandin 
AuthorDate: Thu Apr 25 16:26:59 2024 +0200
Commit: Noel Grandin 
CommitDate: Wed May 1 09:09:07 2024 +0200

use more concrete UNO classes in writerfilter (SwXStyle)

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

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index b690a290b7b9..4bc4296633c2 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -531,6 +531,8 @@ public:
 SW_DLLPUBLIC rtl::Reference createTextFrame();
 SW_DLLPUBLIC rtl::Reference 
createTextGraphicObject();
 SW_DLLPUBLIC rtl::Reference createNumberingStyle();
+SW_DLLPUBLIC rtl::Reference createCharacterStyle();
+SW_DLLPUBLIC rtl::Reference createParagraphStyle();
 SW_DLLPUBLIC rtl::Reference createPageStyle();
 SW_DLLPUBLIC rtl::Reference createContentControl();
 SW_DLLPUBLIC rtl::Reference createFootnote();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index d9debd315fab..156f9aabad1f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1729,6 +1729,20 @@ rtl::Reference< SwXStyle > 
SwXTextDocument::createNumberingStyle()
 return 
SwXStyleFamilies::CreateStyleCharOrParaOrPseudo(SfxStyleFamily::Pseudo, 
GetDocOrThrow());
 }
 
+rtl::Reference< SwXStyle > SwXTextDocument::createCharacterStyle()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return 
SwXStyleFamilies::CreateStyleCharOrParaOrPseudo(SfxStyleFamily::Char, 
GetDocOrThrow());
+}
+
+rtl::Reference< SwXStyle > SwXTextDocument::createParagraphStyle()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return 
SwXStyleFamilies::CreateStyleCharOrParaOrPseudo(SfxStyleFamily::Para, 
GetDocOrThrow());
+}
+
 rtl::Reference< SwXPageStyle > SwXTextDocument::createPageStyle()
 {
 SolarMutexGuard aGuard;
diff --git a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx 
b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
index 6fb1b60c6d91..51bb40ddbc8c 100644
--- a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
+++ b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -1153,11 +1154,12 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const 
FontTablePtr& rFontTable, std::
 else
 {
 bInsert = true;
-xStyle.set(m_pImpl->m_xTextDocument->createInstance(
- bParaStyle ?
-getPropertyName( 
PROP_SERVICE_PARA_STYLE ) :
-(bListStyle ? 
OUString("com.sun.star.style.NumberingStyle") : getPropertyName( 
PROP_SERVICE_CHAR_STYLE ))),
-   uno::UNO_QUERY_THROW);
+if (bParaStyle)
+xStyle = 
m_pImpl->m_xTextDocument->createParagraphStyle();
+else if (bListStyle)
+xStyle = 
m_pImpl->m_xTextDocument->createNumberingStyle();
+else
+xStyle = 
m_pImpl->m_xTextDocument->createCharacterStyle();
 
 // Numbering styles have to be inserted early, as e.g. 
the NumberingRules property is only available after insertion.
 if (bListStyle)
@@ -1799,21 +1801,19 @@ OUString StyleSheetTable::getOrCreateCharStyle( 
PropertyValueVector_t& rCharProp
 throw uno::RuntimeException();
 try
 {
-uno::Reference< style::XStyle > xStyle( 
m_pImpl->m_xTextDocument->createInstance(
-getPropertyName( PROP_SERVICE_CHAR_STYLE )), uno::UNO_QUERY_THROW);
-uno::Reference< beans::XPropertySet > xStyleProps(xStyle, 
uno::UNO_QUERY_THROW );
+rtl::Reference< SwXStyle > xStyle = 
m_pImpl->m_xTextDocument->createCharacterStyle();
 for( const auto& rCharProp : rCharProperties)
 {
 try
 {
-xStyleProps->setPropertyValue( rCharProp.Name, rCharProp.Value 
);
+xStyle->setPropertyValue( rCharProp.Name, rCharProp.Value );
 }
 catch( const uno::Exception& )
 {
 TOOLS_WARN_EXCEPTION( "writerfilter", 
"StyleSheetTable::getOrCreateCharStyle - Style::setPropertyValue");
 }
 }
-xCharStyles->insertByName( sListLabel, uno::Any( xStyle) );
+xCharStyles->insertByName( sListLabel, 

core.git: sw/inc sw/source

2024-04-30 Thread Noel Grandin (via logerrit)
 sw/inc/unotxdoc.hxx   |2 ++
 sw/source/uibase/uno/unotxdoc.cxx |7 +++
 sw/source/writerfilter/dmapper/OLEHandler.cxx |   17 +++--
 sw/source/writerfilter/dmapper/OLEHandler.hxx |4 +++-
 4 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit 29a19f25f001ae63c60864c6a650220ecb3d0ca1
Author: Noel Grandin 
AuthorDate: Thu Apr 25 16:10:21 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 30 19:34:56 2024 +0200

use more concrete UNO classes in writerfilter (SvXMLEmbeddedObjectHelper)

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

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index b4a84c62029b..b690a290b7b9 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -118,6 +118,7 @@ class SwXTextGraphicObject;
 class SwXPageStyle;
 class SwXContentControl;
 class SwXTextEmbeddedObject;
+class SvXMLEmbeddedObjectHelper;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -535,6 +536,7 @@ public:
 SW_DLLPUBLIC rtl::Reference createFootnote();
 SW_DLLPUBLIC rtl::Reference createEndnote();
 SW_DLLPUBLIC rtl::Reference 
createTextEmbeddedObject();
+SW_DLLPUBLIC rtl::Reference 
createEmbeddedObjectResolver();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index c06ea2b32a0e..d9debd315fab 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1764,6 +1764,13 @@ rtl::Reference< SwXTextEmbeddedObject > 
SwXTextDocument::createTextEmbeddedObjec
 return SwXTextEmbeddedObject::CreateXTextEmbeddedObject(GetDocOrThrow(), 
nullptr);
 }
 
+rtl::Reference< SvXMLEmbeddedObjectHelper > 
SwXTextDocument::createEmbeddedObjectResolver()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return new SvXMLEmbeddedObjectHelper(*m_pDocShell, 
SvXMLEmbeddedObjectHelperMode::Read);
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/OLEHandler.cxx 
b/sw/source/writerfilter/dmapper/OLEHandler.cxx
index e0671c8a21b6..3c1d198d74eb 100644
--- a/sw/source/writerfilter/dmapper/OLEHandler.cxx
+++ b/sw/source/writerfilter/dmapper/OLEHandler.cxx
@@ -42,6 +42,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace writerfilter::dmapper {
 
@@ -277,23 +279,19 @@ OUString const & OLEHandler::GetVisAreaHeight() const
 return m_sVisAreaHeight;
 }
 
-OUString OLEHandler::copyOLEOStream(
-uno::Reference const& xTextDocument)
+OUString OLEHandler::copyOLEOStream(rtl::Reference const& 
xTextDocument)
 {
 OUString sRet;
 if( !m_xInputStream.is( ) )
 return sRet;
 try
 {
-uno::Reference < lang::XMultiServiceFactory > xFactory(xTextDocument, 
uno::UNO_QUERY_THROW);
-uno::Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver(
-
xFactory->createInstance("com.sun.star.document.ImportEmbeddedObjectResolver"), 
uno::UNO_QUERY_THROW );
+rtl::Reference< SvXMLEmbeddedObjectHelper > xEmbeddedResolver = 
xTextDocument->createEmbeddedObjectResolver();
 //hack to work with the ImportEmbeddedObjectResolver
 static sal_Int32 nObjectCount = 100;
-uno::Reference< container::XNameAccess > xNA( xEmbeddedResolver, 
uno::UNO_QUERY_THROW );
 OUString aURL = "Obj" + OUString::number( nObjectCount++ );
 uno::Reference < io::XOutputStream > xOLEStream;
-if( (xNA->getByName( aURL ) >>= xOLEStream) && xOLEStream.is() )
+if( (xEmbeddedResolver->getByName( aURL ) >>= xOLEStream) && 
xOLEStream.is() )
 {
 const sal_Int32 nReadRequest = 0x1000;
 uno::Sequence< sal_Int8 > aData;
@@ -309,14 +307,13 @@ OUString OLEHandler::copyOLEOStream(
 }
 }
 
-::oox::ole::SaveInteropProperties(xTextDocument, aURL, nullptr, 
m_sProgId);
+
::oox::ole::SaveInteropProperties(static_cast(xTextDocument.get()),
 aURL, nullptr, m_sProgId);
 
 OUString aPersistName( 
xEmbeddedResolver->resolveEmbeddedObjectURL( aURL ) );
 sRet = aPersistName.copy( strlen("vnd.sun.star.EmbeddedObject:") );
 
 }
-uno::Reference< lang::XComponent > xComp( xEmbeddedResolver, 
uno::UNO_QUERY_THROW );
-xComp->dispose();
+xEmbeddedResolver->dispose();
 m_aURL = aURL;
 }
 catch( const uno::Exception& )
diff --git a/sw/source/writerfilter/dmapper/OLEHandler.hxx 
b/sw/source/writerfilter/dmapper/OLEHandler.hxx
index 67fed0128186..1a7e40b6cecd 100644
--- 

core.git: sw/inc sw/source

2024-04-30 Thread Noel Grandin (via logerrit)
 sw/inc/unoframe.hxx  |2 
 sw/inc/unotxdoc.hxx  |2 
 sw/source/uibase/uno/unotxdoc.cxx|7 +
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   99 +--
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |3 
 5 files changed, 60 insertions(+), 53 deletions(-)

New commits:
commit da3913a70cd133478add296b63d0e7e28c2374bf
Author: Noel Grandin 
AuthorDate: Thu Apr 25 10:20:55 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 30 13:13:48 2024 +0200

use more concrete UNO classes in writerfilter (SwXTextEmbeddedObject)

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

diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 4ddb08e92baf..e94d99434bc2 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -266,7 +266,7 @@ typedef cppu::ImplInheritanceHelper
 css::document::XEventsSupplier
 > SwXTextEmbeddedObjectBaseClass;
 
-class SwXTextEmbeddedObject final : public SwXTextEmbeddedObjectBaseClass
+class SW_DLLPUBLIC SwXTextEmbeddedObject final : public 
SwXTextEmbeddedObjectBaseClass
 {
 css::uno::Reference m_xOLEListener;
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index bd6903b14882..b4a84c62029b 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -117,6 +117,7 @@ class SwXTextFrame;
 class SwXTextGraphicObject;
 class SwXPageStyle;
 class SwXContentControl;
+class SwXTextEmbeddedObject;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -533,6 +534,7 @@ public:
 SW_DLLPUBLIC rtl::Reference createContentControl();
 SW_DLLPUBLIC rtl::Reference createFootnote();
 SW_DLLPUBLIC rtl::Reference createEndnote();
+SW_DLLPUBLIC rtl::Reference 
createTextEmbeddedObject();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 5532c67c05a6..c06ea2b32a0e 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1757,6 +1757,13 @@ rtl::Reference< SwXFootnote > 
SwXTextDocument::createEndnote()
 return SwXFootnote::CreateXFootnote(GetDocOrThrow(), nullptr, true);
 }
 
+rtl::Reference< SwXTextEmbeddedObject > 
SwXTextDocument::createTextEmbeddedObject()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return SwXTextEmbeddedObject::CreateXTextEmbeddedObject(GetDocOrThrow(), 
nullptr);
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 14c9ebae3946..a0f0af0831f5 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3382,40 +3382,39 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
 {
 try
 {
-uno::Reference< text::XTextContent > xOLE( 
m_xTextDocument->createInstance("com.sun.star.text.TextEmbeddedObject"), 
uno::UNO_QUERY_THROW );
-uno::Reference< beans::XPropertySet > xOLEProperties(xOLE, 
uno::UNO_QUERY_THROW);
+rtl::Reference xOLE = 
m_xTextDocument->createTextEmbeddedObject();
 
 OUString aCLSID = pOLEHandler->getCLSID();
 if (aCLSID.isEmpty())
-xOLEProperties->setPropertyValue(getPropertyName( PROP_STREAM_NAME 
),
+xOLE->setPropertyValue(getPropertyName( PROP_STREAM_NAME ),
 uno::Any( rStreamName ));
 else
-xOLEProperties->setPropertyValue("CLSID", uno::Any(aCLSID));
+xOLE->setPropertyValue("CLSID", uno::Any(aCLSID));
 
 OUString aDrawAspect = pOLEHandler->GetDrawAspect();
 if(!aDrawAspect.isEmpty())
-xOLEProperties->setPropertyValue("DrawAspect", 
uno::Any(aDrawAspect));
+xOLE->setPropertyValue("DrawAspect", uno::Any(aDrawAspect));
 
 awt::Size aSize = pOLEHandler->getSize();
 if( !aSize.Width )
 aSize.Width = 1000;
 if( !aSize.Height )
 aSize.Height = 1000;
-xOLEProperties->setPropertyValue(getPropertyName( PROP_WIDTH ),
+xOLE->setPropertyValue(getPropertyName( PROP_WIDTH ),
 uno::Any(aSize.Width));
-xOLEProperties->setPropertyValue(getPropertyName( PROP_HEIGHT ),
+xOLE->setPropertyValue(getPropertyName( PROP_HEIGHT ),
 uno::Any(aSize.Height));
 
 OUString aVisAreaWidth = pOLEHandler->GetVisAreaWidth();
 if(!aVisAreaWidth.isEmpty())
-

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

2024-04-30 Thread Noel Grandin (via logerrit)
 sw/inc/unotext.hxx   |5 ++--
 sw/inc/unotxdoc.hxx  |3 ++
 sw/source/core/inc/unofootnote.hxx   |3 +-
 sw/source/uibase/uno/unotxdoc.cxx|   14 +
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   20 ++-
 5 files changed, 33 insertions(+), 12 deletions(-)

New commits:
commit efc8ce2c4e840cc68dbfc73da014434a3ddd0cda
Author: Noel Grandin 
AuthorDate: Thu Apr 25 10:09:01 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 30 09:34:29 2024 +0200

use more concrete UNO classes in writerfilter (SwXFootnote)

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

diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx
index 5dbb7e993fc9..67a3c60bddb1 100644
--- a/sw/inc/unotext.hxx
+++ b/sw/inc/unotext.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_SW_INC_UNOTEXT_HXX
 #define INCLUDED_SW_INC_UNOTEXT_HXX
 
+#include "swdllapi.h"
 #include 
 #include 
 #include 
@@ -120,7 +121,7 @@ public:
 // XTextRange
 virtual css::uno::Reference< css::text::XText >
 SAL_CALL getText() override;
-virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() 
override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::text::XTextRange > SAL_CALL 
getStart() override;
 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() 
override;
 virtual OUString SAL_CALL getString() override;
 virtual void SAL_CALL setString(const OUString& rString) override;
@@ -132,7 +133,7 @@ public:
 virtual void SAL_CALL insertControlCharacter(
 const css::uno::Reference< css::text::XTextRange > & xRange,
 sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
-virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL 
createTextCursorByRange(
+SW_DLLPUBLIC virtual css::uno::Reference< css::text::XTextCursor > 
SAL_CALL createTextCursorByRange(
 const ::css::uno::Reference< ::css::text::XTextRange >& 
aTextPosition ) override final;
 virtual rtl::Reference< SwXTextCursor > createXTextCursorByRange(
 const ::css::uno::Reference< ::css::text::XTextRange >& 
aTextPosition ) = 0;
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index e35a17d284b2..bd6903b14882 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -92,6 +92,7 @@ class SwXTextFieldTypes;
 class SwXTextFieldMasters;
 class SwXTextSections;
 class SwXNumberingRulesCollection;
+class SwXFootnote;
 class SwXFootnotes;
 class SwXContentControls;
 class SwXDocumentIndexes;
@@ -530,6 +531,8 @@ public:
 SW_DLLPUBLIC rtl::Reference createNumberingStyle();
 SW_DLLPUBLIC rtl::Reference createPageStyle();
 SW_DLLPUBLIC rtl::Reference createContentControl();
+SW_DLLPUBLIC rtl::Reference createFootnote();
+SW_DLLPUBLIC rtl::Reference createEndnote();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/core/inc/unofootnote.hxx 
b/sw/source/core/inc/unofootnote.hxx
index a7498a730749..c1fb2b5b1eb6 100644
--- a/sw/source/core/inc/unofootnote.hxx
+++ b/sw/source/core/inc/unofootnote.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -38,7 +39,7 @@ typedef ::cppu::WeakImplHelper
 ,   css::text::XFootnote
 > SwXFootnote_Base;
 
-class SwXFootnote final
+class SW_DLLPUBLIC SwXFootnote final
 : public SwXFootnote_Base
 , public SwXText
 {
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 90cae4b3324e..5532c67c05a6 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1743,6 +1743,20 @@ rtl::Reference< SwXContentControl > 
SwXTextDocument::createContentControl()
 return SwXContentControl::CreateXContentControl(GetDocOrThrow());
 }
 
+rtl::Reference< SwXFootnote > SwXTextDocument::createFootnote()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return SwXFootnote::CreateXFootnote(GetDocOrThrow(), nullptr);
+}
+
+rtl::Reference< SwXFootnote > SwXTextDocument::createEndnote()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return SwXFootnote::CreateXFootnote(GetDocOrThrow(), nullptr, true);
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 5ea4f174537c..14c9ebae3946 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -141,6 +141,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
@@ -4001,20 +4002,21 @@ void DomainMapper_Impl::PushFootOrEndnote( bool 

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

2024-04-29 Thread Noel Grandin (via logerrit)
 sw/inc/unotxdoc.hxx  |2 
 sw/source/core/inc/unocontentcontrol.hxx |3 
 sw/source/uibase/uno/unotxdoc.cxx|8 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   58 +--
 sw/source/writerfilter/dmapper/SdtHelper.cxx |   14 ++--
 5 files changed, 48 insertions(+), 37 deletions(-)

New commits:
commit 27ed452ae685c396d4507253b35099f106471d9d
Author: Noel Grandin 
AuthorDate: Thu Apr 25 09:55:12 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Apr 29 15:36:11 2024 +0200

use more concrete UNO classes in writerfilter (SwXContentControl)

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

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 4651ccaee190..e35a17d284b2 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -115,6 +115,7 @@ class SwXLineBreak;
 class SwXTextFrame;
 class SwXTextGraphicObject;
 class SwXPageStyle;
+class SwXContentControl;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -528,6 +529,7 @@ public:
 SW_DLLPUBLIC rtl::Reference 
createTextGraphicObject();
 SW_DLLPUBLIC rtl::Reference createNumberingStyle();
 SW_DLLPUBLIC rtl::Reference createPageStyle();
+SW_DLLPUBLIC rtl::Reference createContentControl();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/core/inc/unocontentcontrol.hxx 
b/sw/source/core/inc/unocontentcontrol.hxx
index 08e32afd7f54..3781512377cb 100644
--- a/sw/source/core/inc/unocontentcontrol.hxx
+++ b/sw/source/core/inc/unocontentcontrol.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 
@@ -48,7 +49,7 @@ typedef std::deque> 
TextRangeList_t;
  * UNO API wrapper around an SwContentControl, exposed as the 
com.sun.star.text.ContentControl
  * service.
  */
-class SwXContentControl final
+class SW_DLLPUBLIC SwXContentControl final
 : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 1107072b7c2a..90cae4b3324e 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -180,6 +180,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -1735,6 +1736,13 @@ rtl::Reference< SwXPageStyle > 
SwXTextDocument::createPageStyle()
 return SwXStyleFamilies::CreateStylePage(GetDocOrThrow());
 }
 
+rtl::Reference< SwXContentControl > SwXTextDocument::createContentControl()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return SwXContentControl::CreateXContentControl(GetDocOrThrow());
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 2fe1cde929a4..5ea4f174537c 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -140,6 +140,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
 #define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
@@ -1084,86 +1086,84 @@ void DomainMapper_Impl::PopSdt()
 }
 }
 
-uno::Reference xContentControl(
-m_xTextDocument->createInstance("com.sun.star.text.ContentControl"), 
uno::UNO_QUERY);
-uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+rtl::Reference xContentControl( 
m_xTextDocument->createContentControl());
 if (m_pSdtHelper->GetShowingPlcHdr())
 {
-xContentControlProps->setPropertyValue("ShowingPlaceHolder",
+xContentControl->setPropertyValue("ShowingPlaceHolder",

uno::Any(m_pSdtHelper->GetShowingPlcHdr()));
 }
 
 if (!m_pSdtHelper->GetPlaceholderDocPart().isEmpty())
 {
-xContentControlProps->setPropertyValue("PlaceholderDocPart",
+xContentControl->setPropertyValue("PlaceholderDocPart",

uno::Any(m_pSdtHelper->GetPlaceholderDocPart()));
 }
 
 if (!m_pSdtHelper->GetDataBindingPrefixMapping().isEmpty())
 {
-xContentControlProps->setPropertyValue("DataBindingPrefixMappings",
+xContentControl->setPropertyValue("DataBindingPrefixMappings",

uno::Any(m_pSdtHelper->GetDataBindingPrefixMapping()));
 }
 if (!m_pSdtHelper->GetDataBindingXPath().isEmpty())
 {
-xContentControlProps->setPropertyValue("DataBindingXpath",
+xContentControl->setPropertyValue("DataBindingXpath",
 

core.git: sw/inc sw/source

2024-04-28 Thread Noel Grandin (via logerrit)
 sw/inc/coreframestyle.hxx|   37 ++
 sw/inc/unostyle.hxx  |   26 -
 sw/inc/unotxdoc.hxx  |4 
 sw/inc/unoxstyle.hxx |  231 ++
 sw/source/core/unocore/unostyle.cxx  |  306 ++-
 sw/source/uibase/uno/unotxdoc.cxx|   15 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |3 
 sw/source/writerfilter/dmapper/NumberingManager.cxx  |   27 -
 sw/source/writerfilter/dmapper/NumberingManager.hxx  |6 
 sw/source/writerfilter/dmapper/PropertyMap.cxx   |   20 -
 sw/source/writerfilter/dmapper/PropertyMap.hxx   |5 
 11 files changed, 435 insertions(+), 245 deletions(-)

New commits:
commit 0cfaf93bf5c6e4e505b45f5e4fbac54edd77ddd6
Author: Noel Grandin 
AuthorDate: Wed Apr 24 16:39:23 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Apr 28 22:26:51 2024 +0200

use more concrete UNO classes in writerfilter (SwXStyle)

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

diff --git a/sw/inc/coreframestyle.hxx b/sw/inc/coreframestyle.hxx
new file mode 100644
index ..07d5ab5e33c2
--- /dev/null
+++ b/sw/inc/coreframestyle.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include 
+
+class SfxPoolItem;
+
+namespace sw
+{
+class ICoreFrameStyle
+{
+public:
+virtual void SetItem(sal_uInt16 eAtr, const SfxPoolItem& rItem) = 0;
+virtual const SfxPoolItem* GetItem(sal_uInt16 eAtr) = 0;
+virtual css::document::XEventsSupplier& GetEventsSupplier() = 0;
+virtual ~ICoreFrameStyle(){};
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index bcd2c96aba6a..77c2cc8856c0 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 
+#include "coreframestyle.hxx"
 #include "istyleaccess.hxx"
 #include 
 #include 
@@ -43,6 +44,10 @@ namespace com::sun::star::document { class XEventsSupplier; }
 class SwDocShell;
 class SwAutoStylesEnumImpl;
 class SfxItemSet;
+class SwXStyle;
+class SwXTextCellStyle;
+class SwXPageStyle;
+class SwXFrameStyle;
 
 class SwXStyleFamilies final : public cppu::WeakImplHelper
 <
@@ -84,23 +89,16 @@ public:
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
 static css::uno::Reference CreateStyle(SfxStyleFamily 
eFamily, SwDoc& rDoc);
+static rtl::Reference 
CreateStyleCharOrParaOrPseudo(SfxStyleFamily eFamily, SwDoc& rDoc);
+static rtl::Reference CreateStylePage(SwDoc& rDoc);
+static rtl::Reference CreateStyleFrame(SwDoc& rDoc);
+static rtl::Reference CreateStyleTable(SwDoc& rDoc);
+static rtl::Reference CreateStyleCell(SwDoc& rDoc);
 // FIXME: This is very ugly as is the whole conditional paragraph style
 // hackety. Should be folded into CreateStyle hopefully one day
 static css::uno::Reference 
CreateStyleCondParagraph(SwDoc& rDoc);
 };
 
-namespace sw
-{
-class ICoreFrameStyle
-{
-public:
-virtual void SetItem(sal_uInt16 eAtr, const SfxPoolItem& rItem) =0;
-virtual const SfxPoolItem* GetItem(sal_uInt16 eAtr) =0;
-virtual css::document::XEventsSupplier& GetEventsSupplier() =0;
-virtual ~ICoreFrameStyle() {};
-};
-}
-
 // access to all automatic style families
 class SwXAutoStyles final :
 public cppu::WeakImplHelper< css::style::XAutoStyles >,
@@ -318,7 +316,7 @@ public:
 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) 
override;
 virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() 
override;
 
-static css::uno::Reference 
CreateXTextTableStyle(SwDocShell* pDocShell, const OUString& 
rTableAutoFormatName);
+static rtl::Reference CreateXTextTableStyle(SwDocShell* 
pDocShell, const OUString& rTableAutoFormatName);
 };
 
 /// A text cell style is a UNO 

core.git: sw/inc sw/source

2024-04-28 Thread Noel Grandin (via logerrit)
 sw/inc/unotxdoc.hxx  |2 +
 sw/source/uibase/uno/unotxdoc.cxx|8 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   20 ++-
 3 files changed, 17 insertions(+), 13 deletions(-)

New commits:
commit 6a11bf9f7bd209a082254c861d5a04c7f5729d68
Author: Noel Grandin 
AuthorDate: Wed Apr 24 13:16:25 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Apr 28 15:59:26 2024 +0200

use more concrete UNO classes in writerfilter (SwXBookmark)

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

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 30edc2fb7c84..6a9b9de6fbe6 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -107,6 +107,7 @@ class SwXLinkTargetSupplier;
 class SwXRedlines;
 class SwXDocumentSettings;
 class SwXTextDefaults;
+class SwXBookmark;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -511,6 +512,7 @@ public:
 
 SW_DLLPUBLIC rtl::Reference createDocumentSettings();
 SW_DLLPUBLIC rtl::Reference createTextDefaults();
+SW_DLLPUBLIC rtl::Reference createBookmark();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 3bbaa1014aff..e72cf2a59ec5 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1667,6 +1667,14 @@ rtl::Reference< SwXTextDefaults > 
SwXTextDocument::createTextDefaults()
 return new SwXTextDefaults(());
 }
 
+rtl::Reference< SwXBookmark > SwXTextDocument::createBookmark()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return SwXBookmark::CreateXBookmark(GetDocOrThrow(), nullptr);
+}
+
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index db22d7f25fe6..103a836536bc 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -134,6 +134,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
 #define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
@@ -875,13 +876,8 @@ void DomainMapper_Impl::RemoveLastParagraph( )
 if (sBookmarkNameAfterRemoval.isEmpty())
 {
 // Yes, it was removed. Restore
-uno::Reference xBookmark(
-
m_xTextDocument->createInstance("com.sun.star.text.Bookmark"),
-uno::UNO_QUERY_THROW);
-
-uno::Reference xBkmNamed(xBookmark,
-
uno::UNO_QUERY_THROW);
-xBkmNamed->setName(sLastBookmarkName);
+rtl::Reference 
xBookmark(m_xTextDocument->createBookmark());
+xBookmark->setName(sLastBookmarkName);
 xTextAppend->insertTextContent(xCursor, xBookmark, 
!xCursor->isCollapsed());
 }
 }
@@ -8914,7 +8910,7 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
 {
 if (m_xTextDocument)
 {
-uno::Reference< text::XTextContent > xBookmark( 
m_xTextDocument->createInstance( "com.sun.star.text.Bookmark" ), 
uno::UNO_QUERY_THROW );
+rtl::Reference xBookmark( 
m_xTextDocument->createBookmark() );
 uno::Reference< text::XTextCursor > xCursor;
 uno::Reference< text::XText > xText = 
aBookmarkIter->second.m_xTextRange->getText();
 if( aBookmarkIter->second.m_bIsStartOfText && 
!bIsAfterDummyPara)
@@ -8944,10 +8940,9 @@ void DomainMapper_Impl::StartOrEndBookmark( const 
OUString& rId )
 xCursor->gotoRange(xStart, true );
 }
 }
-uno::Reference< container::XNamed > xBkmNamed( xBookmark, 
uno::UNO_QUERY_THROW );
 SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), 
"writerfilter.dmapper", "anonymous bookmark");
 //todo: make sure the name is not used already!
-xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
+xBookmark->setName( aBookmarkIter->second.m_sBookmarkName );
 xTextAppend->insertTextContent( uno::Reference< 
text::XTextRange >( xCursor, uno::UNO_QUERY_THROW), xBookmark, 
!xCursor->isCollapsed() );
 }
 m_aBookmarkMap.erase( aBookmarkIter );
@@ -9088,9 +9083,8 @@ void 
DomainMapper_Impl::startOrEndPermissionRange(sal_Int32 

core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-27 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk|1 +
 sw/inc/unotxdoc.hxx  |2 ++
 sw/source/core/inc/SwXTextDefaults.hxx   |3 ++-
 sw/source/uibase/uno/unotxdoc.cxx|8 
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |4 ++--
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |3 ++-
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx   |7 +++
 7 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit a77caf28bac50fe8e3592416d5dedf894a02cbbb
Author: Noel Grandin 
AuthorDate: Wed Apr 24 12:26:00 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 27 15:56:28 2024 +0200

use more concrete UNO classes in writerfilter (SwXTextDefaults)

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

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index 3be1a2d937c6..c48e727a5b85 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
 -I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
 -I$(SRCDIR)/sw/source/uibase/uno/ \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index ab655c6019c4..30edc2fb7c84 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -106,6 +106,7 @@ class SwXReferenceMarks;
 class SwXLinkTargetSupplier;
 class SwXRedlines;
 class SwXDocumentSettings;
+class SwXTextDefaults;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -509,6 +510,7 @@ public:
 SwDocShell* GetDocShell() {return m_pDocShell;}
 
 SW_DLLPUBLIC rtl::Reference createDocumentSettings();
+SW_DLLPUBLIC rtl::Reference createTextDefaults();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/core/inc/SwXTextDefaults.hxx 
b/sw/source/core/inc/SwXTextDefaults.hxx
index 0acab2a7d257..87743eb0cee7 100644
--- a/sw/source/core/inc/SwXTextDefaults.hxx
+++ b/sw/source/core/inc/SwXTextDefaults.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -27,7 +28,7 @@
 class SwDoc;
 class SfxItemPropertySet;
 
-class SwXTextDefaults final :  public cppu::WeakImplHelper
+class SW_DLLPUBLIC SwXTextDefaults final :  public cppu::WeakImplHelper
 <
 css::beans::XPropertyState,
 css::beans::XPropertySet,
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index f93d7438f363..3bbaa1014aff 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -175,6 +175,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::text;
@@ -1659,6 +1660,13 @@ rtl::Reference< SwXDocumentSettings > 
SwXTextDocument::createDocumentSettings()
 return new SwXDocumentSettings(this);
 }
 
+rtl::Reference< SwXTextDefaults > SwXTextDocument::createTextDefaults()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return new SwXTextDefaults(());
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 5a9f84aa3b0d..7d48b265f079 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -92,6 +92,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace oox;
@@ -172,8 +173,7 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 // the intended font to provide best layout match.
 try
 {
-uno::Reference< beans::XPropertySet > 
xDefProps(GetTextDocument()->createInstance("com.sun.star.text.Defaults"),
-uno::UNO_QUERY_THROW);
+rtl::Reference 
xDefProps(GetTextDocument()->createTextDefaults());
 xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), 
css::uno::Any(OUString("Calibri")));
 xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), 
css::uno::Any(double(11)));
 }
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index c9f8e4d2b077..db22d7f25fe6 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ 

core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-27 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk|1 
 sw/inc/unotxdoc.hxx  |3 +
 sw/source/uibase/uno/SwXDocumentSettings.hxx |4 +
 sw/source/uibase/uno/unotxdoc.cxx|7 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |7 +-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |6 +-
 sw/source/writerfilter/dmapper/SettingsTable.cxx |   49 +++
 sw/source/writerfilter/dmapper/SettingsTable.hxx |4 +
 sw/source/writerfilter/filter/WriterFilter.cxx   |4 -
 9 files changed, 46 insertions(+), 39 deletions(-)

New commits:
commit 87e0feafd3690a9b58890cc28f8ba0c521bfb557
Author: Noel Grandin 
AuthorDate: Wed Apr 24 12:11:46 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 27 12:47:57 2024 +0200

use more concrete UNO classes in writerfilter (SwXDocumentSettings)

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

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index 447752dabd43..3be1a2d937c6 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
 -I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/uibase/uno/ \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
 ))
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 018784174cbb..ab655c6019c4 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -105,6 +105,7 @@ class SwXLineNumberingProperties;
 class SwXReferenceMarks;
 class SwXLinkTargetSupplier;
 class SwXRedlines;
+class SwXDocumentSettings;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -506,6 +507,8 @@ public:
 css::uno::Reference< 
css::uno::XInterface > const & xLastResult);
 
 SwDocShell* GetDocShell() {return m_pDocShell;}
+
+SW_DLLPUBLIC rtl::Reference createDocumentSettings();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.hxx 
b/sw/source/uibase/uno/SwXDocumentSettings.hxx
index 3d722e40ba80..067e2e8fbc1b 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.hxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx
@@ -19,7 +19,9 @@
 
 #pragma once
 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,7 +32,7 @@ class SwDocShell;
 class SwDoc;
 class SfxPrinter;
 
-class SwXDocumentSettings final :
+class SW_DLLPUBLIC SwXDocumentSettings final :
 public comphelper::MasterPropertySet,
 public css::lang::XServiceInfo,
 public css::lang::XTypeProvider,
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index d2641b6c4db4..f93d7438f363 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1652,6 +1652,13 @@ css::uno::Reference 
SwXTextDocument::create(
 return xTmp;
 }
 
+rtl::Reference< SwXDocumentSettings > SwXTextDocument::createDocumentSettings()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return new SwXDocumentSettings(this);
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index aab27ef1a4bc..c9f8e4d2b077 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -132,6 +132,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
 #define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
@@ -523,11 +524,11 @@ uno::Reference< text::XText > const & 
DomainMapper_Impl::GetBodyText()
 }
 
 
-uno::Reference< beans::XPropertySet > const & 
DomainMapper_Impl::GetDocumentSettings()
+rtl::Reference const & 
DomainMapper_Impl::GetDocumentSettings()
 {
 if( !m_xDocumentSettings.is() && m_xTextDocument.is())
 {
-m_xDocumentSettings.set( 
m_xTextDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY );
+m_xDocumentSettings = m_xTextDocument->createDocumentSettings();
 }
 return m_xDocumentSettings;
 }
@@ -9592,7 +9593,7 @@ void DomainMapper_Impl::ApplySettingsTable()
 m_xTextDocument->setViewData(xBox);
 }
 
-uno::Reference< beans::XPropertySet > 
xSettings(m_xTextDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+rtl::Reference 

core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-25 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk  |2 
 sw/inc/unotxdoc.hxx|   30 +--
 sw/source/writerfilter/dmapper/DomainMapper.cxx|   90 --
 sw/source/writerfilter/dmapper/DomainMapper.hxx|4 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx   |  112 +
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx   |8 
 sw/source/writerfilter/dmapper/PropertyMap.cxx |   46 ++---
 sw/source/writerfilter/dmapper/SdtHelper.cxx   |5 
 sw/source/writerfilter/dmapper/SmartTagHandler.cxx |5 
 sw/source/writerfilter/dmapper/SmartTagHandler.hxx |4 
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx |   52 +++---
 sw/source/writerfilter/dmapper/StyleSheetTable.hxx |4 
 sw/source/writerfilter/dmapper/domainmapperfactory.cxx |2 
 sw/source/writerfilter/filter/RtfFilter.cxx|   10 -
 sw/source/writerfilter/filter/WriterFilter.cxx |   22 +-
 sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx |4 
 sw/source/writerfilter/inc/rtftok/RTFDocument.hxx  |4 
 sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx   |7 
 sw/source/writerfilter/rtftok/rtfdispatchflag.cxx  |6 
 sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx   |2 
 sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx  |   22 +-
 sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx  |4 
 sw/source/writerfilter/rtftok/rtfsdrimport.cxx |8 
 sw/source/writerfilter/rtftok/rtfsdrimport.hxx |5 
 24 files changed, 217 insertions(+), 241 deletions(-)

New commits:
commit d8d2a68271b5263777d3be8afd0bd39bd076bb87
Author: Noel Grandin 
AuthorDate: Tue Apr 23 21:33:19 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 25 18:50:09 2024 +0200

use more concrete UNO classes in writerfilter

starting with SwXTextDocument.

Replace some UNO_QUERY_THROW with
   if (!foo)
   throw uno::RuntimeException()
because rtl::Reference does not have UNO_QUERY_THROW
constructors

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

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index deebdf1439e1..447752dabd43 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -19,6 +19,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
+-I$(SRCDIR)/sw/inc \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
 ))
@@ -45,6 +46,7 @@ $(eval $(call gb_Library_use_libraries,sw_writerfilter,\
 sot \
 svt \
svxcore \
+sw \
 tl \
 utl \
 vcl \
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 9b7b6f16e4d4..018784174cbb 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -224,9 +224,6 @@ private:
 // is implemented.
 bool m_bApplyPagePrintSettingsFromXPagePrintable;
 
-using SfxBaseModel::addEventListener;
-using SfxBaseModel::removeEventListener;
-
 /** abstract SdrModel provider */
 virtual SdrModel& getSdrModelFromUnoModel() const override;
 
@@ -256,6 +253,9 @@ public:
 rtl::Reference< SwXBodyText > getBodyText();
 virtual void SAL_CALL reformat() override;
 
+using SfxBaseModel::addEventListener;
+using SfxBaseModel::removeEventListener;
+
 //XModel
 virtual sal_Bool SAL_CALL attachResource( const OUString& aURL, const 
css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override;
 virtual OUString SAL_CALL getURL(  ) override;
@@ -278,21 +278,21 @@ public:
 virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override;
 
 //XLineNumberingProperties
-virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL 
getLineNumberingProperties() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::beans::XPropertySet > 
SAL_CALL getLineNumberingProperties() override;
 
 //XChapterNumberingSupplier
-virtual css::uno::Reference< css::container::XIndexReplace >  SAL_CALL 
getChapterNumberingRules() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::container::XIndexReplace >  
SAL_CALL getChapterNumberingRules() override;
 
 //XNumberingRulesSupplier
 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL 
getNumberingRules() override;
 
 //XFootnotesSupplier
 SW_DLLPUBLIC virtual css::uno::Reference< css::container::XIndexAccess >  
SAL_CALL getFootnotes() override;
-virtual css::uno::Reference< css::beans::XPropertySet >  SAL_CALL 
getFootnoteSettings() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::beans::XPropertySet 

core.git: sw/inc sw/source

2024-04-16 Thread Noel Grandin (via logerrit)
 sw/inc/colwd.hxx|7 +--
 sw/inc/swabstdlg.hxx|3 +--
 sw/source/ui/dialog/swdlgfact.cxx   |4 ++--
 sw/source/ui/dialog/swdlgfact.hxx   |2 +-
 sw/source/ui/table/colwd.cxx|   27 +++
 sw/source/uibase/inc/tablemgr.hxx   |1 -
 sw/source/uibase/shells/tabsh.cxx   |   13 +++--
 sw/source/uibase/table/tablemgr.cxx |   16 
 8 files changed, 35 insertions(+), 38 deletions(-)

New commits:
commit 0fa363faaba5dc9c57cf7fd1d4aa0dd300310682
Author: Noel Grandin 
AuthorDate: Tue Apr 16 15:08:33 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 16 18:34:09 2024 +0200

tdf#160632 TABLE: Crash when using column width dialog

regression from
commit a08110be32a6958f27ce9ddb1e2cb2227265dfe1
Author: Noel Grandin 
Date:   Tue Jan 30 12:24:47 2024 +0200
convert table width dialog to async

we were referencing an object that had already been destroyed by the
time the dialog completed

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

diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx
index ab511ee118c0..63d8813b72c2 100644
--- a/sw/inc/colwd.hxx
+++ b/sw/inc/colwd.hxx
@@ -20,13 +20,15 @@
 #define INCLUDED_SW_INC_COLWD_HXX
 
 #include 
+#include 
 
 class SwTableFUNC;
+class SwWrtShell;
 
 class SwTableWidthDlg final : public weld::GenericDialogController
 {
 private:
-SwTableFUNC& m_rFnc;
+std::unique_ptr m_xFnc;
 
 std::unique_ptr m_xColNF;
 std::unique_ptr m_xWidthMF;
@@ -34,7 +36,8 @@ private:
 DECL_LINK(LoseFocusHdl, weld::SpinButton&, void);
 
 public:
-SwTableWidthDlg(weld::Window* pParent, SwTableFUNC& rFnc);
+SwTableWidthDlg(weld::Window* pParent, SwWrtShell* pShell);
+~SwTableWidthDlg();
 void Apply();
 };
 
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index fac76ae5c571..1d205f18624f 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -51,7 +51,6 @@ class SwSectionData;
 struct SwDBData;
 class Printer;
 class SwLabItem;
-class SwTableFUNC;
 class SwChildWinWrapper;
 struct SfxChildWinInfo;
 class SwTOXMark;
@@ -540,7 +539,7 @@ public:
 virtual VclPtr CreateSwBorderDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwBorderModes nType) = 0;
 virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pSh) = 0;
 
-virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwTableFUNC ) = 0;
+virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwWrtShell *pShell) = 0;
 virtual VclPtr CreateSwTableTabDlg(weld::Window* 
pParent,
 const SfxItemSet* pItemSet, SwWrtShell* pSh) = 0;
 
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 415bf658b3c3..42a46be6858f 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1223,9 +1223,9 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwWrapDlg(weld::Wi
 return 
VclPtr::Create(std::make_unique(pParent,
 rSet, pSh, true/*bDrawMode*/));
 }
 
-VclPtr 
SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(weld::Window *pParent, 
SwTableFUNC )
+VclPtr 
SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(weld::Window *pParent, 
SwWrtShell *pShell)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rFnc));
+return 
VclPtr::Create(std::make_unique(pParent,
 pShell));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index f94342e23b31..4fc2cea421a3 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -832,7 +832,7 @@ public:
 virtual VclPtr CreateSwBorderDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwBorderModes nType) override;
 
 virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pSh) override;
-virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwTableFUNC ) override;
+virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwWrtShell *pShell) override;
 virtual VclPtr CreateSwTableTabDlg(weld::Window* 
pParent,
 const SfxItemSet* pItemSet, SwWrtShell* pSh) override;
 virtual VclPtr CreateSwFieldDlg(SfxBindings* pB, 
SwChildWinWrapper* pCW, weld::Window *pParent) override;
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
index 70e47e19c9ed..65d225050555 100644
--- a/sw/source/ui/table/colwd.cxx
+++ b/sw/source/ui/table/colwd.cxx
@@ -29,38 +29,41 @@
 IMPL_LINK_NOARG(SwTableWidthDlg, LoseFocusHdl, weld::SpinButton&, void)
 {
 sal_uInt16 nId = o3tl::narrowing(m_xColNF->get_value()) - 1;
-const SwTwips lWidth = m_rFnc.GetColWidth(nId);
-

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

2024-04-12 Thread Sujatro Bhadra (via logerrit)
 sw/inc/swabstdlg.hxx   |2 
 sw/source/ui/dialog/swdlgfact.cxx  |5 
 sw/source/ui/dialog/swdlgfact.hxx  |2 
 sw/source/ui/table/convert.cxx |  184 
 sw/source/ui/table/tautofmt.cxx|  139 +--
 sw/source/uibase/inc/convert.hxx   |   42 +
 sw/source/uibase/inc/tautofmt.hxx  |   32 
 sw/uiconfig/swriter/ui/converttexttable.ui | 1083 +
 8 files changed, 957 insertions(+), 532 deletions(-)

New commits:
commit 1dd7cc9446233f047ace02f4275ef6405587b9c9
Author: Sujatro Bhadra 
AuthorDate: Thu Mar 21 18:07:40 2024 +0530
Commit: Heiko Tietze 
CommitDate: Fri Apr 12 12:40:37 2024 +0200

tdf#116091: Replaced 'AutoFormat' Button in Convert Text to Table dialog

Change-Id: If8eee099e79e65d5a6ca1b06d1cfb2a71bbe52f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165099
Tested-by: Jenkins
Reviewed-by: Sujatro Bhadra 
Reviewed-by: Heiko Tietze 

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 019684b11317..fac76ae5c571 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -280,6 +280,8 @@ public:
 virtual void GetValues( sal_Unicode& rDelim,
 SwInsertTableOptions& rInsTableFlags,
 SwTableAutoFormat const*& prTAFormat ) = 0;
+virtual std::unique_ptr FillAutoFormatOfIndex() const = 
0;
+virtual void Apply() = 0;
 };
 
 class AbstractSwInsertDBColAutoPilot :  public VclAbstractDialog
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 8275f5e65a1d..415bf658b3c3 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -647,6 +647,11 @@ void 
AbstractSwSelGlossaryDlg_Impl::SelectEntryPos(sal_Int32 nIdx)
 m_xDlg->SelectEntryPos( nIdx );
 }
 
+std::unique_ptr 
AbstractSwConvertTableDlg_Impl::FillAutoFormatOfIndex() const
+{
+return m_xDlg->FillAutoFormatOfIndex();
+}
+
 std::unique_ptr 
AbstractSwAutoFormatDlg_Impl::FillAutoFormatOfIndex() const
 {
 return m_xDlg->FillAutoFormatOfIndex();
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 5d8035b6bfcd..f94342e23b31 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -353,6 +353,8 @@ public:
 virtual short Execute() override;
 virtual void GetValues( sal_Unicode& rDelim,SwInsertTableOptions& 
rInsTableFlags,
 SwTableAutoFormat const*& prTAFormat) override;
+virtual std::unique_ptr FillAutoFormatOfIndex() const 
override;
+virtual void Apply() override { m_xDlg->Apply(); }
 };
 
 class AbstractSwInsertDBColAutoPilot_Impl :  public 
AbstractSwInsertDBColAutoPilot
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index 3f7a55ad1936..65a42f227892 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -31,6 +31,11 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+
 //keep the state of the buttons on runtime
 static int nSaveButtonState = -1; // 0: tab, 1: semicolon, 2: paragraph, 3: 
other, -1: not yet used
 static bool bIsKeepColumn = true;
@@ -87,6 +92,18 @@ void SwConvertTableDlg::GetValues(sal_Unicode& rDelim, 
SwInsertTableOptions& rIn
 SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable)
 : SfxDialogController(rView.GetFrameWeld(), 
"modules/swriter/ui/converttexttable.ui",
   "ConvertTextTableDialog")
+, m_aStrTitle(SwResId(STR_ADD_AUTOFORMAT_TITLE))
+, m_aStrLabel(SwResId(STR_ADD_AUTOFORMAT_LABEL))
+, m_aStrClose(SwResId(STR_BTN_AUTOFORMAT_CLOSE))
+, m_aStrDelTitle(SwResId(STR_DEL_AUTOFORMAT_TITLE))
+, m_aStrDelMsg(SwResId(STR_DEL_AUTOFORMAT_MSG))
+, m_aStrRenameTitle(SwResId(STR_RENAME_AUTOFORMAT_TITLE))
+, m_aStrInvalidFormat(SwResId(STR_INVALID_AUTOFORMAT_NAME))
+, m_nIndex(0)
+, m_nDfltStylePos(0)
+, m_bCoreDataChanged(false)
+, m_bSetAutoFormat(false)
+, m_xTableTable(new SwTableAutoFormatTable)
 , m_xTabBtn(m_xBuilder->weld_radio_button("tabs"))
 , m_xSemiBtn(m_xBuilder->weld_radio_button("semicolons"))
 , m_xParaBtn(m_xBuilder->weld_radio_button("paragraph"))
@@ -99,9 +116,23 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool 
bToTable)
 , m_xRepeatRows(m_xBuilder->weld_container("repeatrows"))
 , m_xRepeatHeaderNF(m_xBuilder->weld_spin_button("repeatheadersb"))
 , m_xDontSplitCB(m_xBuilder->weld_check_button("dontsplitcb"))
-, m_xAutoFormatBtn(m_xBuilder->weld_button("autofmt"))
+, m_xLbFormat(m_xBuilder->weld_tree_view("formatlb"))
+, m_xBtnNumFormat(m_xBuilder->weld_check_button("numformatcb"))
+, m_xBtnBorder(m_xBuilder->weld_check_button("bordercb"))
+, m_xBtnFont(m_xBuilder->weld_check_button("fontcb"))
+, m_xBtnPattern(m_xBuilder->weld_check_button("patterncb"))
+, 

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

2024-04-09 Thread Miklos Vajna (via logerrit)
 sw/inc/docary.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit e2b968e6821fe9617a795d95b7e4f53029a33018
Author: Miklos Vajna 
AuthorDate: Tue Apr 9 07:27:10 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Apr 9 10:25:17 2024 +0200

sw: document SwTextFormatColls

Text is never clear, it means paragraph in this case, since we have
SwCharFormats for character styles.

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

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 5cd132f0ef44..abe0adeecf8e 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -144,6 +144,7 @@ public:
 static void dumpAsXml(xmlTextWriterPtr /*pWriter*/) {};
 };
 
+/// Provides a generic container for Writer styles: paragraph, graphic, 
section, etc styles.
 template
 class SwFormatsModifyBase : public SwVectorModifyBase, public 
SwFormatsBase
 {
@@ -178,6 +179,7 @@ public:
 SwFrameFormatsV() : SwFormatsModifyBase( DestructorPolicy::KeepElements ) 
{}
 };
 
+/// Container of paragraph styles.
 class SwTextFormatColls final : public SwFormatsModifyBase
 {
 public:


core.git: sw/inc sw/source

2024-04-05 Thread Miklos Vajna (via logerrit)
 sw/inc/swtable.hxx   |2 ++
 sw/source/core/table/swtable.cxx |   28 +++-
 2 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 2b55a58a2b6918018eca11f8f8cd0452992f239a
Author: Miklos Vajna 
AuthorDate: Fri Apr 5 08:08:20 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 5 09:22:15 2024 +0200

sw doc model xml dump: show SwTableLine::m_aBoxes

Which means we get boxes (cells) grouped by lines (rows), instead of a
flat list of all cells in a table.

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

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 9d4ab72e0809..9e71c19482ff 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -436,6 +436,8 @@ public:
 // set/get (if it's possible, cached) redline type
 RedlineType GetRedlineType() const;
 void SetRedlineType(RedlineType eType) { m_eRedlineType = eType; }
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 /// SwTableBox is one table cell in the document model.
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index c71aec30e7aa..53ab9bbc465b 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1745,17 +1745,10 @@ void SwTable::dumpAsXml(xmlTextWriterPtr pWriter) const
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTable"));
 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("table-format"), 
"%p", GetFrameFormat());
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("lines"));
 for (const auto& pLine : m_aLines)
 {
-(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
-(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), 
"%p", pLine);
-pLine->GetFrameFormat()->dumpAsXml(pWriter);
-(void)xmlTextWriterEndElement(pWriter);
-}
-(void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("tab-sort-content-boxes"));
-for (const auto& pBox : m_TabSortContentBoxes)
-{
-pBox->dumpAsXml(pWriter);
+pLine->dumpAsXml(pWriter);
 }
 (void)xmlTextWriterEndElement(pWriter);
 (void)xmlTextWriterEndElement(pWriter);
@@ -2001,6 +1994,23 @@ RedlineType SwTableLine::GetRedlineType() const
 return RedlineType::None;
 }
 
+void SwTableLine::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+
+GetFrameFormat()->dumpAsXml(pWriter);
+
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("boxes"));
+for (const auto& pBox : m_aBoxes)
+{
+pBox->dumpAsXml(pWriter);
+}
+(void)xmlTextWriterEndElement(pWriter);
+
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, sal_uInt16 nLines, 
SwTableLine *pUp )
 : SwClient(nullptr)
 , m_aLines()


core.git: sw/inc sw/source

2024-04-04 Thread Oliver Specht (via logerrit)
 sw/inc/usrfld.hxx|2 -
 sw/source/filter/ww8/ww8par.cxx  |   43 +++
 sw/source/filter/ww8/ww8par5.cxx |   30 +--
 3 files changed, 51 insertions(+), 24 deletions(-)

New commits:
commit ad4b72a0eacf6bb6887236ea3a3807b1264de822
Author: Oliver Specht 
AuthorDate: Thu Mar 21 12:10:40 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Thu Apr 4 19:47:54 2024 +0200

tdf#160301 import DOCVARIABLE fields as user fields

DOCVARIBLE fields in *.doc files are imported as user fields.

Change-Id: Ib723d8a586ca644e0b158f839caef33b2b6225a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165096
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index 28d582c4c5ac..f7371ef52c6e 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -102,7 +102,7 @@ inline void SwUserFieldType::SetType(sal_uInt16 nSub)
  * Tracks the number format and the language, conversion between the float and
  * string representation is independent from the system locale.
  */
-class SwUserField final : public SwValueField
+class SW_DLLPUBLIC SwUserField final : public SwValueField
 {
 sal_uInt16  m_nSubType;
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b51239d436ac..77f4f2e76be2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -4806,27 +4807,35 @@ void SwWW8ImplReader::ReadDocVars()
 aDocVarStrings, , );
 if (m_bVer67)return;
 
-uno::Reference xDPS(
-m_pDocShell->GetModel(), uno::UNO_QUERY_THROW);
-uno::Reference xDocProps(
-xDPS->getDocumentProperties());
-OSL_ENSURE(xDocProps.is(), "DocumentProperties is null");
-uno::Reference xUserDefinedProps =
-xDocProps->getUserDefinedProperties();
-OSL_ENSURE(xUserDefinedProps.is(), "UserDefinedProperties is null");
-
-for(size_t i=0; i 
xFieldsSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY_THROW);
+uno::Reference 
xTextFactory(m_pDocShell->GetModel(), uno::UNO_QUERY);
+uno::Reference< container::XNameAccess > xFieldMasterAccess = 
xFieldsSupplier->getTextFieldMasters();
+for(size_t i = 0; i < aDocVarStrings.size(); i++)
 {
 const OUString  = aDocVarStrings[i];
 uno::Any aValue;
-aValue <<= rName;
-try {
-xUserDefinedProps->addProperty( rName,
-beans::PropertyAttribute::REMOVABLE,
-aValue );
-} catch (const uno::Exception &) {
-// ignore
+if (aDocValueStrings.size() > i)
+{
+OUString value = aDocValueStrings[i];
+value = value.replaceAll("
", "
");
+value = value.replaceAll(" ", "
");
+aValue <<= value;
+}
+
+uno::Reference< beans::XPropertySet > xMaster;
+OUString sFieldMasterService("com.sun.star.text.FieldMaster.User." + 
rName);
+
+// Find or create Field Master
+if (xFieldMasterAccess->hasByName(sFieldMasterService))
+{
+xMaster.set(xFieldMasterAccess->getByName(sFieldMasterService), 
uno::UNO_QUERY_THROW);
+}
+else
+{
+
xMaster.set(xTextFactory->createInstance("com.sun.star.text.FieldMaster.User"), 
uno::UNO_QUERY_THROW);
+xMaster->setPropertyValue("Name", uno::Any(rName));
 }
+xMaster->setPropertyValue("Content", aValue);
 }
 }
 
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index a5b9f881065e..47cb7e788223 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1830,12 +1831,29 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* 
pF, OUString& rStr )
 aData = aData.replaceAll("\"", "");
 }
 
-const auto pType(static_cast(
-
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocInfo)));
-SwDocInfoField aField(pType, nSub|nReg, aData, GetFieldResult(pF), 
nFormat);
-if (bDateTime)
-ForceFieldLanguage(aField, nLang);
-m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, 
SwFormatField(aField));
+bool bDone = false;
+if (DI_CUSTOM == nSub)
+{
+const auto pType(static_cast(
+m_rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::User, 
aData, false)));
+if (pType)
+{
+SwUserField aField(pType, 0, nFormat);
+if (bDateTime)
+ForceFieldLanguage(aField, nLang);
+m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, 
SwFormatField(aField));
+bDone = true;
+}
+}
+if (!bDone)
+{
+const auto 

core.git: sw/inc sw/qa

2024-03-27 Thread Miklos Vajna (via logerrit)
 sw/inc/crsrsh.hxx |2 +-
 sw/qa/core/edit/data/delete-sel-normalize.odt |binary
 sw/qa/core/edit/edit.cxx  |   25 +
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 261999bc552516a7dae0f96895259485e9ac77a2
Author: Miklos Vajna 
AuthorDate: Wed Mar 27 15:41:50 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 27 18:03:19 2024 +0100

tdf#109272 sw: add form filling testcase

Open the document, press tab to switch to a field, start typing, nothing
shows up.

Looking at the doc model dump, it turns out we inserted characters
between the field start and the field separator dummy characters,
instead of the field separator and the field end ones, which is quite
bad.

Turns out that in the meantime commit
c80606bb23fd42e41710d70a96b7ffaf948384a6 (tdf#109272: make sure that
Delete / Backspace move cursor correctly, 2024-01-18) fixed this, kind
of by accident: the comment says the motivation there was change
tracking.

Add a testcase to to make sure this now continues to work.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index e330974a7dcc..5b0031882487 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -734,7 +734,7 @@ public:
 
 bool GotoFormatContentControl(const SwFormatContentControl& 
rContentControl);
 
-void GotoFormControl(bool bNext);
+SW_DLLPUBLIC void GotoFormControl(bool bNext);
 
 static SwTextField* GetTextFieldAtPos(
 const SwPosition* pPos,
diff --git a/sw/qa/core/edit/data/delete-sel-normalize.odt 
b/sw/qa/core/edit/data/delete-sel-normalize.odt
new file mode 100644
index ..d7113204ba80
Binary files /dev/null and b/sw/qa/core/edit/data/delete-sel-normalize.odt 
differ
diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx
index 444887fbb0df..fa8fefa910c1 100644
--- a/sw/qa/core/edit/edit.cxx
+++ b/sw/qa/core/edit/edit.cxx
@@ -56,6 +56,31 @@ CPPUNIT_TEST_FIXTURE(Test, testAutocorrect)
 emulateTyping(*pTextDoc, u"But not now - with ");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testDeleteSelNormalize)
+{
+// Given a read-only document with a fillable form, the placeholder text 
is selected:
+createSwDoc("delete-sel-normalize.odt");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->GotoFormControl(/*bNext=*/true);
+
+// When you press 'delete' to type some content instead:
+pWrtShell->DelRight();
+
+// Then make sure the position after the delete is correct:
+SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint();
+// The full text is "key ", so 
this marks the position
+// after the field separator but before the field end.
+sal_Int32 nExpectedCharPos = strlen("key **");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 6
+// - Actual  : 5
+// so we started to type between the field start and the field separator, 
nothing was visible on
+// the screen.
+CPPUNIT_ASSERT_EQUAL(nExpectedCharPos, rCursor.nContent.GetIndex());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


core.git: sw/inc sw/source

2024-03-26 Thread Noel Grandin (via logerrit)
 sw/inc/ndindex.hxx  |1 -
 sw/source/filter/ww8/wrtww8.cxx |   15 +++
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit dd873175affb7926befb1b8a0a881540d00160df
Author: Noel Grandin 
AuthorDate: Mon Mar 25 07:47:15 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 26 15:35:40 2024 +0100

try to use more reliable mechanism in AddLinkTarget

The commit that introduces this code says
commit 89ffe6149a0e14bcde89d7981362aa1556849ab0
Author: Tünde Tóth 
Date:   Wed Sep 18 10:13:50 2019 +0200

tdf#127605 DOCX export: fix internal hyperlinks to image target

jumping to the paragraph anchored by the image as a workaround.

But using the SwNodeIndex ring to do this only works by accident,
there is no guarantee that the SwNodeIndex is organised in any
way at all.

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

diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 775546597500..5ebc32846739 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -119,7 +119,6 @@ public:
 const SwNodes& GetNodes() const { return m_pNode->GetNodes(); }
   SwNodes& GetNodes() { return m_pNode->GetNodes(); }
 
-const SwNodeIndex* GetNext() const { return GetNextInRing(); }
 SwNode& GetNode() const { return *m_pNode; }
 };
 
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 72ed190b4ec2..b252e4d1533d 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -118,6 +118,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace css;
 using namespace sw::util;
@@ -3280,8 +3281,11 @@ void MSWordExportBase::AddLinkTarget(std::u16string_view 
rURL)
 {
 OUString aName(BookmarkToWriter(aURL.subView(0, nPos)));
 if (const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, 
SwNodeType::Grf))
-if (const SwNodeIndex* pIdx = 
pFormat->GetContent().GetContentIdx())
-m_aImplicitBookmarks.emplace_back(aURL, 
pIdx->GetNext()->GetIndex());
+{
+const SwFormatAnchor& rFormatAnchor = pFormat->GetAnchor();
+if (SwNode* pAnchorNode = rFormatAnchor.GetAnchorNode())
+m_aImplicitBookmarks.emplace_back(aURL, 
pAnchorNode->GetIndex());
+}
 }
 else if( sCmp == "frame" )
 {
@@ -3294,8 +3298,11 @@ void MSWordExportBase::AddLinkTarget(std::u16string_view 
rURL)
 {
 OUString aName(BookmarkToWriter(aURL.subView(0, nPos)));
 if (const SwFlyFrameFormat* pFormat = m_rDoc.FindFlyByName(aName, 
SwNodeType::Ole))
-if (const SwNodeIndex* pIdx = 
pFormat->GetContent().GetContentIdx())
-m_aImplicitBookmarks.emplace_back(aURL, 
pIdx->GetNext()->GetIndex());
+{
+const SwFormatAnchor& rFormatAnchor = pFormat->GetAnchor();
+if (SwNode* pAnchorNode = rFormatAnchor.GetAnchorNode())
+m_aImplicitBookmarks.emplace_back(aURL, 
pAnchorNode->GetIndex());
+}
 }
 else if( sCmp == "region" )
 {


core.git: sw/inc

2024-03-26 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtfordr.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2c914532277061c86ed0cb681341d1b39d149029
Author: Miklos Vajna 
AuthorDate: Tue Mar 26 08:23:33 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 26 13:47:07 2024 +0100

sw: document SwFormatFillOrder

Something to be mostly ignored, I guess.

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

diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx
index 6c08df6e340a..2334e8f91165 100644
--- a/sw/inc/fmtfordr.hxx
+++ b/sw/inc/fmtfordr.hxx
@@ -33,6 +33,9 @@ enum SwFillOrder
 SW_FILL_ORDER_END
 };
 
+/// Some kind of fill order, mostly appears in the item set of a table line.
+///
+/// Doesn't seem to be used by the layout, also no UI to get or set it.
 class SwFormatFillOrder final : public SfxEnumItem
 {
 public:


core.git: sw/inc sw/source

2024-03-22 Thread Noel Grandin (via logerrit)
 sw/inc/bparr.hxx |5 
 sw/source/core/bastyp/bparr.cxx  |   41 +++
 sw/source/core/docnode/nodes.cxx |8 ---
 3 files changed, 47 insertions(+), 7 deletions(-)

New commits:
commit 284d80825ec7cf3c39af91959e4bf3d539b066f4
Author: Noel Grandin 
AuthorDate: Wed Mar 20 14:43:44 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri Mar 22 08:00:40 2024 +0100

tdf#158556 speed up SwNodes::RemoveNode

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

diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx
index 9f3e17f8d140..4f831c8bab19 100644
--- a/sw/inc/bparr.hxx
+++ b/sw/inc/bparr.hxx
@@ -91,6 +91,11 @@ public:
 void Move( sal_Int32 from, sal_Int32 to );
 void Replace( sal_Int32 pos, BigPtrEntry* p);
 
+/** Speed up the complicated removal logic in SwNodes::RemoveNode.
+Returns the entry before pNotTheOne.
+*/
+BigPtrEntry* ReplaceTheOneAfter( BigPtrEntry* pNotTheOne, BigPtrEntry* 
pNewEntry);
+
 SW_DLLPUBLIC BigPtrEntry* operator[]( sal_Int32 ) const;
 };
 
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
index b99385bfd3dc..03e035c69621 100644
--- a/sw/source/core/bastyp/bparr.cxx
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -397,6 +397,47 @@ void BigPtrArray::Replace( sal_Int32 idx, BigPtrEntry* 
pElem)
 p->mvData[ idx - p->nStart ] = pElem;
 }
 
+/** Speed up the complicated removal logic in SwNodes::RemoveNode.
+Replaces the node AFTER pNotTheOne.
+Returns the entry BEFORE pNotTheOne.
+*/
+BigPtrEntry* BigPtrArray::ReplaceTheOneAfter( BigPtrEntry* pNotTheOne, 
BigPtrEntry* pNewEntry)
+{
+assert(pNotTheOne->m_pBlock->pBigArr == this);
+BlockInfo* p = pNotTheOne->m_pBlock;
+sal_uInt16 nOffset = pNotTheOne->m_nOffset;
+
+// if the next node is inside the current block
+if (nOffset < p->nElem - 1)
+{
+++nOffset;
+p->mvData[nOffset] = pNewEntry;
+pNewEntry->m_nOffset = nOffset;
+pNewEntry->m_pBlock = p;
+--nOffset;
+}
+else
+{
+// slow path
+BigPtrArray::Replace( pNotTheOne->GetPos()+1, pNewEntry );
+}
+
+// if the previous node is inside the current block
+if (nOffset != 0)
+{
+--nOffset;
+return p->mvData[nOffset];
+}
+else
+{
+// slow path
+sal_Int32 nPrevPos = pNotTheOne->GetPos();
+if (nPrevPos == 0)
+return nullptr;
+return BigPtrArray::operator[]( nPrevPos - 1 );
+}
+}
+
 /** Compress the array */
 sal_uInt16 BigPtrArray::Compress()
 {
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 0e2a0bc95c5d..5f059f94c519 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2413,14 +2413,8 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, 
SwNodeOffset nSz, bool bDel )
 delete pDel;
 // coverity[use_after_free : FALSE] - pPrev will be reassigned if 
there will be another iteration to the loop
 pDel = pPrev;
-sal_uLong nPrevNdIdx = pPrev->GetPos();
 BigPtrEntry* pTempEntry = [sal_Int32(nCnt)];
-BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
-if( nCnt )
-pPrev = BigPtrArray::operator []( nPrevNdIdx  - 1 );
-// the accessed element can be a naked BigPtrEntry from
-// aTempEntries, so the downcast to SwNode* in
-// SwNodes::operator[] would be illegal (and unnecessary)
+pPrev = ReplaceTheOneAfter(pPrev, pTempEntry);
 }
 nDelPos = SwNodeOffset(pDel->GetPos() + 1);
 }


core.git: sw/inc

2024-03-21 Thread Noel Grandin (via logerrit)
 sw/inc/ring.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2326d6a2273e1a5d7c012e0c496fc5275a8e5d94
Author: Noel Grandin 
AuthorDate: Wed Mar 20 14:47:34 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 21 21:08:29 2024 +0100

fix some typos in sw::Ring

introduced by
commit d150ace12b6d8fbb30664d1de1001622720bd53b
Author: Bjoern Michaelsen 
Date:   Fri Dec 5 03:54:55 2014 +0100
stick to code conventions for new code

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

diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index e152899ec87a..194ed47db10b 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -144,7 +144,7 @@ namespace sw
 }
 
 /**
- * helper class that provides Svalue_typeL-style container iteration to 
the ring
+ * helper class that provides STL-style container iteration to the ring
  */
 template 
 class SAL_WARN_UNUSED RingContainer final
@@ -226,7 +226,7 @@ namespace sw
 value_type& dereference() const
 { return m_pCurrent ? *m_pCurrent : * m_pStart; }
 /**
- * value_type is:
+ * This is:
  * - pointing to the current item in the iteration in general
  * - nullptr if on the first item (begin())
  * - m_pStart when beyond the last item (end())


core.git: sw/inc sw/source

2024-03-21 Thread Noel Grandin (via logerrit)
 sw/inc/doc.hxx  |1 +
 sw/source/core/doc/docfly.cxx   |   19 +++
 sw/source/core/unocore/unoframe.cxx |   13 +
 3 files changed, 21 insertions(+), 12 deletions(-)

New commits:
commit 241e2d68664e0e53cf02fe9986462c4a9ecd8d42
Author: Noel Grandin 
AuthorDate: Wed Mar 20 09:59:09 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 21 08:39:46 2024 +0100

tdf#158556 speedup docx load

Avoid O(n^2) loop in SwXFrame::setPropertyValue, we even have an index
to search for this stuff

Reduces load time from 325s to 172s

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

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e359cb0ba293..5dc62530454a 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -838,6 +838,7 @@ public:
 SW_DLLPUBLIC std::vector GetFlyFrameFormats(
 FlyCntType eType,
 bool bIgnoreTextBoxes);
+SwFrameFormat* GetFlyFrameFormatByName( const OUString& sFrameFormatName );
 
 // Copy formats in own arrays and return them.
 SwFrameFormat  *CopyFrameFormat ( const SwFrameFormat& );
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index c492212487c3..203894123007 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -149,6 +149,25 @@ SwFrameFormat* SwDoc::GetFlyNum( size_t nIdx, FlyCntType 
eType, bool bIgnoreText
 return pRetFormat;
 }
 
+SwFrameFormat* SwDoc::GetFlyFrameFormatByName( const OUString& 
rFrameFormatName )
+{
+auto pFrameFormats = GetSpzFrameFormats();
+auto it = pFrameFormats->findByTypeAndName( RES_FLYFRMFMT, 
rFrameFormatName );
+auto endIt = pFrameFormats->typeAndNameEnd();
+for ( ; it != endIt; ++it)
+{
+sw::SpzFrameFormat* pFlyFormat = *it;
+const SwNodeIndex* pIdx = pFlyFormat->GetContent().GetContentIdx();
+if( !pIdx || !pIdx->GetNodes().IsDocNodes() )
+continue;
+
+const SwNode* pNd = GetNodes()[ pIdx->GetIndex() + 1 ];
+if( !pNd->IsNoTextNode())
+return pFlyFormat;
+}
+return nullptr;
+}
+
 std::vector SwDoc::GetFlyFrameFormats(
 FlyCntType const eType, bool const bIgnoreTextBoxes)
 {
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index f8509ad4626c..9eb773e7cd50 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1714,18 +1714,7 @@ void SwXFrame::setPropertyValue(const OUString& 
rPropertyName, const ::uno::Any&
 }
 else
 {
-const size_t nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
-
-SwFrameFormat* pChain = nullptr;
-for( size_t i = 0; i < nCount; ++i )
-{
-SwFrameFormat* pFormat2 = pDoc->GetFlyNum(i, 
FLYCNTTYPE_FRM);
-if(sChainName == pFormat2->GetName() )
-{
-pChain = pFormat2;
-break;
-}
-}
+SwFrameFormat* pChain = 
pDoc->GetFlyFrameFormatByName(sChainName);
 if(pChain)
 {
 SwFrameFormat* pSource = bNextFrame ? pFormat : pChain;


core.git: sw/inc sw/source

2024-03-20 Thread Noel Grandin (via logerrit)
 sw/inc/fesh.hxx  |2 +-
 sw/source/core/frmedt/fefly1.cxx |4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 62619de850773f55de646dea7e63a52a7e2ef819
Author: Noel Grandin 
AuthorDate: Tue Mar 19 16:07:04 2024 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 20 09:02:26 2024 +0100

remove dead code in SwFEShell::GetConnectableFrameFormats

ever since

commit 22fdd136fd549d69030ae375f56539540a291950
Author: Jens-Heiner Rechtien 
Date:   Thu Sep 27 07:51:18 2007 +
INTEGRATION: CWS swwarnings (1.35.128); FILE MERGED
2007/08/20 15:32:01 tl 1.35.128.5: RESYNC: (1.38-1.40); FILE MERGED

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

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index c84ff8646799..8a88674e124b 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -779,7 +779,7 @@ public:
 SW_DLLPUBLIC tools::Long GetSectionWidth( SwFormat const & rFormat ) const;
 
 SW_DLLPUBLIC void GetConnectableFrameFormats
-(SwFrameFormat & rFormat, const OUString & rReference, bool bSuccessors,
+(SwFrameFormat & rFormat, std::u16string_view rReference, bool bSuccessors,
  std::vector< OUString > & aPrevPageVec,
  std::vector< OUString > & aThisPageVec,
  std::vector< OUString > & aNextPageVec,
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 93ad4212cf65..4529e175afb3 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1920,7 +1920,7 @@ static sal_uInt16 SwFormatGetPageNum(const 
SwFlyFrameFormat * pFormat)
 }
 
 void SwFEShell::GetConnectableFrameFormats(SwFrameFormat & rFormat,
-  const OUString & rReference,
+  std::u16string_view rReference,
   bool bSuccessors,
   std::vector< OUString > & aPrevPageVec,
   std::vector< OUString > & aThisPageVec,
@@ -1944,8 +1944,6 @@ void SwFEShell::GetConnectableFrameFormats(SwFrameFormat 
& rFormat,
 /* potential successors resp. predecessors */
 std::vector< const SwFrameFormat * > aTmpSpzArray;
 
-mxDoc->FindFlyByName(rReference);
-
 for (size_t n = 0; n < nCnt; ++n)
 {
 const SwFrameFormat & rFormat1 = *(mxDoc->GetFlyNum(n, 
FLYCNTTYPE_FRM));


core.git: sw/inc

2024-03-19 Thread Miklos Vajna (via logerrit)
 sw/inc/swcrsr.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 9905a510fe62c1f64dc7786ac818fef9d5a8e25a
Author: Miklos Vajna 
AuthorDate: Tue Mar 19 08:10:29 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 19 09:55:14 2024 +0100

sw: document SwCursor

Not to be confused with SwShellCursor, which is only the UI cursor,
while this is more general.

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

diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index 0dcd5944a90b..33b5ea8d226c 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -67,6 +67,9 @@ namespace o3tl {
 template<> struct typed_flags : 
is_typed_flags {};
 }
 
+/// SwCursor is a base class for UI/shell, table and UNO/API cursors.
+///
+/// It's more than just a pair of doc model positions (SwPaM), e.g. can go 
left/right or up/down.
 class SAL_DLLPUBLIC_RTTI SwCursor : public SwPaM
 {
 friend class SwCursorSaveState;


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

2024-03-12 Thread Miklos Vajna (via logerrit)
 sw/inc/hints.hxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9a7b26a994362a71944f675c9c9cce8fa517
Author: Miklos Vajna 
AuthorDate: Tue Mar 12 08:19:21 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 12 09:24:57 2024 +0100

sw: extend the SwFormatChg documentation a little

It's not directly SwFormatChg that describes the change of a format,
it's sw::LegacyModifyHint that has pointers to the old and new pool
items, which can be SwFormatChg / RES_FMT_CHG.

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

diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index b3d400e06286..fa7a78200a26 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -65,9 +65,12 @@ public:
 {}
 };
 
-/*
+/**
  * SwFormatChg is sent when a format has changed to another format. 2 Hints 
are always sent
  * the old and the new format
+ *
+ * This is typically owned by an sw::LegacyModifyHint, which knows if this 
pool item is the old or
+ * the new format.
  */
 class SwFormatChg final : public SwMsgPoolItem
 {


core.git: sw/inc sw/source

2024-03-10 Thread Tuukka Orava (via logerrit)
 sw/inc/redline.hxx   |2 --
 sw/inc/swevent.hxx   |2 --
 sw/source/core/access/accfrmobjslist.hxx |6 --
 3 files changed, 10 deletions(-)

New commits:
commit c5bb6b0972f8f03b6c9d397d2d0f16c154c58e1c
Author: Tuukka Orava 
AuthorDate: Mon Mar 11 00:26:05 2024 +0200
Commit: Mike Kaganski 
CommitDate: Mon Mar 11 05:39:23 2024 +0100

tdf#157664 Drop operator != where respective operator == is defined

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

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index a8be390b1490..ef7c8129ce6a 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -120,8 +120,6 @@ public:
 ( m_pExtraData && rCmp.m_pExtraData &&
 *m_pExtraData == *rCmp.m_pExtraData ));
 }
-bool operator!=( const SwRedlineData& rCmp ) const
-{   return !operator==( rCmp ); }
 
 RedlineType GetType() const { return m_eType; }
 
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index b25246cb2e12..62bd39429a13 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -99,8 +99,6 @@ struct SwCallMouseEvent final
 PTR.pFormat == rEvent.PTR.pFormat &&
 PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
 }
-bool operator!=( const SwCallMouseEvent& rEvent ) const
-{   return !( *this == rEvent );}
 
 void Clear()
 {
diff --git a/sw/source/core/access/accfrmobjslist.hxx 
b/sw/source/core/access/accfrmobjslist.hxx
index 9df293d71e2f..e4f3141f4275 100644
--- a/sw/source/core/access/accfrmobjslist.hxx
+++ b/sw/source/core/access/accfrmobjslist.hxx
@@ -52,12 +52,6 @@ public:
 return m_aCurr == r.m_aCurr;
 }
 
-bool operator!=(
-const SwAccessibleChildSList_const_iterator& r ) const
-{
-return !(*this == r);
-}
-
 SwAccessibleChildSList_const_iterator& operator++();
 
 const sw::access::SwAccessibleChild& operator*() const


core.git: sw/inc

2024-03-06 Thread Mike Kaganski (via logerrit)
 sw/inc/fesh.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 94113c523865c3162ffd9a5a76bebeb61d652399
Author: Mike Kaganski 
AuthorDate: Wed Mar 6 12:04:47 2024 +0100
Commit: Mike Kaganski 
CommitDate: Wed Mar 6 12:58:17 2024 +0100

Fix build

... after commit fcd4222d36e1864452163e5c94976eea353bbaf0
(sw: SelectAll of section with RES_PAGEDESC corner-case, 2024-03-06).

uiwriter.o : error LNK2019: unresolved external symbol "public: class 
SwFrameFormat const * __cdecl SwFEShell::SelFlyGrabCursor(void)" 
(?SelFlyGrabCursor@SwFEShell@@QEAAPEBVSwFrameFormat@@XZ) referenced in function 
"public: void __cdecl testPasteTableAtFlyAnchor::TestBody(void)" 
(?TestBody@testPasteTableAtFlyAnchor@@QEAAXXZ)
C:\louild\workdir\LinkTarget\CppunitTest   est_sw_uiwriter.dll : fatal 
error LNK1120: 1 unresolved externals

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

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 6decb3bdf3a7..c84ff8646799 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -428,7 +428,7 @@ public:
 FlyCntType eType, bool bIgnoreTextBoxes);
 
 /// If a fly is selected, it draws cursor into the first ContentFrame.
-const SwFrameFormat* SelFlyGrabCursor();
+SW_DLLPUBLIC const SwFrameFormat* SelFlyGrabCursor();
 
 /// Get FlyFrameFormat; for UI macro linkage at Flys
 const SwFrameFormat* GetFlyFrameFormat() const;


core.git: sw/inc sw/source

2024-03-04 Thread Michael Stahl (via logerrit)
 sw/inc/undobj.hxx   |2 +-
 sw/source/core/doc/DocumentContentOperationsManager.cxx |2 +-
 sw/source/core/txtnode/ndtxt.cxx|2 +-
 sw/source/core/undo/untblk.cxx  |   15 ---
 4 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit cf4df3e51b609613134e3146f526d8e6b07946c3
Author: Michael Stahl 
AuthorDate: Fri Mar 1 14:30:42 2024 +0100
Commit: Michael Stahl 
CommitDate: Mon Mar 4 11:23:44 2024 +0100

sw: for Undo, add FLY_AT_PAGE in GetFlysAnchoredAt()

SwUndoInserts::IsCreateUndoForNewFly() now returns true for these, so
they get Undo objects on Paste, which is of course wrong.

(regression from commit 359e5af31c330a137fed6ba3140b77cd759c28bb)

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

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 03ad720aabe7..7fb61309ec29 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -244,7 +244,7 @@ class SwUndoInsLayFormat;
 namespace sw {
 
 std::optional>
-GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset nSttNode);
+GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset nSttNode, bool isAtPageIncluded);
 
 }
 
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index e799555b9dd7..1c3df58bd6cd 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5066,7 +5066,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 }
 else
 {
-pFlys = sw::GetFlysAnchoredAt(rDoc, rPos.GetNodeIndex());
+pFlys = sw::GetFlysAnchoredAt(rDoc, rPos.GetNodeIndex(), false);
 pFlysAtInsPos = pFlys ? &*pFlys : nullptr;
 }
 
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index dc2625d33c54..bbb725e5c13c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -462,7 +462,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 }
 
 bool bSplitFly = false;
-std::optional> oFlys = 
sw::GetFlysAnchoredAt(GetDoc(), GetIndex());
+std::optional> oFlys = 
sw::GetFlysAnchoredAt(GetDoc(), GetIndex(), false);
 if (oFlys.has_value())
 {
 // See if one of the flys is a split fly. If so, we need to keep
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 158167809712..328d901ca482 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -38,7 +38,7 @@
 namespace sw {
 
 std::optional>
-GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode)
+GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode, bool const 
isAtPageIncluded)
 {
 std::optional> pFrameFormats;
 const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
@@ -47,10 +47,11 @@ GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode)
 SwFrameFormat *const pFormat = (*rDoc.GetSpzFrameFormats())[n];
 SwFormatAnchor const*const pAnchor = >GetAnchor();
 SwNode const*const pAnchorNode = pAnchor->GetAnchorNode();
-if (pAnchorNode
- && nSttNode == pAnchorNode->GetIndex()
- && ((pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA)
- || (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)))
+if ((pAnchorNode
+&& nSttNode == pAnchorNode->GetIndex()
+&& ((pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA)
+|| (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)))
+|| (isAtPageIncluded && pAnchor->GetAnchorId() == 
RndStdIds::FLY_AT_PAGE))
 {
 if (!pFrameFormats)
 pFrameFormats.emplace();
@@ -89,7 +90,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& 
rPam )
 // These flys will be saved in pFrameFormats array (only flys which 
exist BEFORE insertion!)
 // Then in SwUndoInserts::SetInsertRange the flys saved in 
pFrameFormats will NOT create Undos.
 // m_FlyUndos will only be filled with newly inserted flys.
-m_pFrameFormats = sw::GetFlysAnchoredAt(rDoc, m_nSttNode);
+m_pFrameFormats = sw::GetFlysAnchoredAt(rDoc, m_nSttNode, true);
 }
 // consider Redline
 if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
@@ -392,7 +393,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & 
rContext)
 if( ( m_nSttNode != m_nEndNode || m_nSttContent != m_nEndContent ) && 
m_oUndoNodeIndex)
 {
 auto const pFlysAtInsPos(sw::GetFlysAnchoredAt(rDoc,
-rPam.GetPoint()->GetNodeIndex()));
+rPam.GetPoint()->GetNodeIndex(), false));
 
 ::std::optional oMvBkwrd = MovePtBackward(rPam);
 


core.git: sw/inc sw/source

2024-02-28 Thread Matt K (via logerrit)
 sw/inc/format.hxx|1 +
 sw/inc/ndtxt.hxx |4 ++--
 sw/source/core/attr/format.cxx   |   19 +--
 sw/source/core/doc/fmtcol.cxx|1 +
 sw/source/core/txtnode/ndtxt.cxx |   28 +---
 5 files changed, 34 insertions(+), 19 deletions(-)

New commits:
commit 6a064b1967e06e40be40817deff99d00c1a8554f
Author: Matt K 
AuthorDate: Sat Feb 3 17:04:19 2024 -0600
Commit: Matt K 
CommitDate: Wed Feb 28 22:08:38 2024 +0100

tdf#139004 Prevent crash when deleting footnote styles

The problem was that a pointer was assumed valid, but
was not, so now we check the value of the pointer
before using it.  Works now to delete footnote style.

Also, change assert to variable check to ensure the
proper method is only called when it is supposed to
be, and to prevent a failing assert.  We add a new
Destr method on SwFormat so that it can be called
from the SwTextFormatColl context and thus avoid
the assert.

Change-Id: Ia4b8029fb89e627cd685b3317606e2b9d60cf248
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162965
Tested-by: Jenkins
Reviewed-by: Matt K 

diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 91043b1621de..62ef891bc545 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -72,6 +72,7 @@ protected:
 SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
 SwFormat( const SwFormat& rFormat );
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
+void Destr();
 
 public:
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 352dad71c247..eb046bc9151d 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -454,8 +454,8 @@ public:
 
 inline SwTextFormatColl *GetTextColl() const;
 virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override;
-void ChgTextCollUpdateNum( const SwTextFormatColl* pOld,
-const SwTextFormatColl* pNew );
+void ChgTextCollUpdateNum(const SwTextFormatColl* pOld,
+  const SwTextFormatColl* pNew );
 
 /** Copy collection with all auto formats to dest-node.
 The latter might be in another document!
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 6f2f076881e9..fb03edef251b 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -200,27 +200,34 @@ void SwFormat::CopyAttrs( const SwFormat& rFormat )
 delete pChgSet;
 }
 
-SwFormat::~SwFormat()
+void SwFormat::Destr()
 {
 // This happens at an ObjectDying message. Thus put all dependent
 // ones on DerivedFrom.
-if(!HasWriterListeners())
+if (!HasWriterListeners())
 return;
 
 m_bFormatInDTOR = true;
 
-if(!DerivedFrom())
+if (!DerivedFrom())
 {
 SwFormat::ResetFormatAttr(RES_PAGEDESC);
-SAL_WARN("sw.core", "~SwFormat: format still has clients on death, but 
parent format is missing: " << GetName());
+SAL_WARN("sw.core",
+ "~SwFormat: format still has clients on death, but parent 
format is missing: "
+ << GetName());
 return;
 }
-SwIterator aIter(*this);
-for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next())
+SwIterator aIter(*this);
+for (SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next())
 pClient->CheckRegistrationFormat(*this);
 assert(!HasWriterListeners());
 }
 
+SwFormat::~SwFormat()
+{
+Destr();
+}
+
 void SwFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
 if (rHint.GetId() != SfxHintId::SwLegacyModify)
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 4d87241a03ba..02f2cb5bc2fd 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -124,6 +124,7 @@ SwTextFormatColl::~SwTextFormatColl()
 pCharFormat->SetLinkedParaFormat(nullptr);
 }
 }
+Destr();
 }
 void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& 
rHint)
 {
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 0a54b140b68c..dc2625d33c54 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1663,13 +1663,14 @@ void SwTextNode::Update(
 }
 }
 
-void SwTextNode::ChgTextCollUpdateNum( const SwTextFormatColl *pOldColl,
-const SwTextFormatColl *pNewColl)
+void SwTextNode::ChgTextCollUpdateNum(const SwTextFormatColl* pOldColl,
+  const SwTextFormatColl* pNewColl)
 {
 SwDoc& rDoc = GetDoc();
 // query the OutlineLevel and if it changed, notify the Nodes-Array!
-const int nOldLevel = pOldColl && 
pOldColl->IsAssignedToListLevelOfOutlineStyle() ?
- pOldColl->GetAssignedOutlineStyleLevel() : MAXLEVEL;
+const int nOldLevel = pOldColl && 

core.git: sw/inc

2024-02-27 Thread Miklos Vajna (via logerrit)
 sw/inc/fmteiro.hxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 3fb07fbd8edb7c048ca9e2ec5fa0a5206e05b8d0
Author: Miklos Vajna 
AuthorDate: Tue Feb 27 08:21:38 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 09:11:01 2024 +0100

sw: document SwFormatEditInReadonly

What it is, which item set can contain it, where is the UI.

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

diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx
index 15643f41d925..7ec165654c27 100644
--- a/sw/inc/fmteiro.hxx
+++ b/sw/inc/fmteiro.hxx
@@ -26,6 +26,11 @@
 
 class IntlWrapper;
 
+/// Allows you to edit the contents of a TextFrame in a document that is 
read-only.
+///
+/// Appears in the item set of an sw::SpzFrameFormat.
+///
+/// Insert -> Frame -> Frame -> Options -> Editable in read-only document on 
the UI.
 class SW_DLLPUBLIC SwFormatEditInReadonly final : public SfxBoolItem
 {
 public:


core.git: sw/inc sw/source

2024-02-24 Thread Michael Stahl (via logerrit)
 sw/inc/pagedesc.hxx|6 +--
 sw/source/core/doc/docfmt.cxx  |   12 +++---
 sw/source/core/layout/pagedesc.cxx |   74 ++---
 3 files changed, 46 insertions(+), 46 deletions(-)

New commits:
commit 5c4ae1b19c51dcd62dad8e1d3e8beb87a0311352
Author: Michael Stahl 
AuthorDate: Fri Feb 23 17:18:04 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Feb 24 09:44:41 2024 +0100

tdf#147731 sw: fix memory leak in SwDoc::CopyPageDesc()

Commit 963de9feb37105560fde14b44d992e47f341bb5b "sw: fix issue with
copying stashed frame format" fixed the actual bug here, but introduced
a new memory leak.

This causes an assert in CppunitTest_uiwriter3:
cppunittester: svl/source/items/itempool.cxx:779: void 
SfxItemPool::Remove(const SfxPoolItem&): Assertion `rItem.GetRefCount() && 
"RefCount == 0, Remove impossible"' failed.

The assert happens only when this is backported to the libreoffice-7-6
branch, because commit ab7c81f55621d7b0d1468c63305163016dd78837 "ITEM:
Get away from classic 'poolable' Item flag" removed the assert.

The problem is that a SwFormatFrameSize inside a footer SwFrameFormat is
leaked 4 times, because 4 SwFrameFormats are leaked; the leak is that
SwDoc::CopyPageDesc() creates a new pNewFormat, passed it to
StashFrameFormat(), which copies it but doesn't free it.

There is also a usage of std::shared_ptr here that is very questionable;
SwFrameFormat should never be shared between different SwPageDesc.

(regression from commit b802ab694a8a7357d4657f3e11b571144fa7c7bf)

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

diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 136117114b30..3ec919ce3c83 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -151,9 +151,9 @@ class SW_DLLPUBLIC SwPageDesc final
 
 struct StashedPageDesc
 {
-std::shared_ptr m_pStashedFirst;
-std::shared_ptr m_pStashedLeft;
-std::shared_ptr m_pStashedFirstLeft;
+std::optional m_oStashedFirst;
+std::optional m_oStashedLeft;
+std::optional m_oStashedFirstLeft;
 };
 
 mutable StashedPageDesc m_aStashedHeader;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 19974139d125..66a61ebb02c6 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1559,21 +1559,21 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, 
SwPageDesc& rDstDesc,
 {
 if (pStashedFormatSrc->GetDoc() != this)
 {
-SwFrameFormat* pNewFormat = new 
SwFrameFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat());
+SwFrameFormat newFormat(GetAttrPool(), "CopyDesc", 
GetDfltFrameFormat());
 
 SfxItemSet aAttrSet(pStashedFormatSrc->GetAttrSet());
 aAttrSet.ClearItem(RES_HEADER);
 aAttrSet.ClearItem(RES_FOOTER);
 
-pNewFormat->DelDiffs( aAttrSet );
-pNewFormat->SetFormatAttr( aAttrSet );
+newFormat.DelDiffs(aAttrSet);
+newFormat.SetFormatAttr(aAttrSet);
 
 if (bHeader)
-CopyHeader(*pStashedFormatSrc, *pNewFormat);
+CopyHeader(*pStashedFormatSrc, newFormat);
 else
-CopyFooter(*pStashedFormatSrc, *pNewFormat);
+CopyFooter(*pStashedFormatSrc, newFormat);
 
-rDstDesc.StashFrameFormat(*pNewFormat, bHeader, bLeft, 
bFirst);
+rDstDesc.StashFrameFormat(newFormat, bHeader, bLeft, 
bFirst);
 }
 else
 {
diff --git a/sw/source/core/layout/pagedesc.cxx 
b/sw/source/core/layout/pagedesc.cxx
index 2b7882332789..f9679bb2a8e7 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -83,13 +83,13 @@ SwPageDesc::SwPageDesc( const SwPageDesc  )
 , m_FootnoteInfo( rCpy.GetFootnoteInfo() )
 , m_pdList( nullptr )
 {
-m_aStashedHeader.m_pStashedFirst = rCpy.m_aStashedHeader.m_pStashedFirst;
-m_aStashedHeader.m_pStashedLeft = rCpy.m_aStashedHeader.m_pStashedLeft;
-m_aStashedHeader.m_pStashedFirstLeft = 
rCpy.m_aStashedHeader.m_pStashedFirstLeft;
+m_aStashedHeader.m_oStashedFirst = rCpy.m_aStashedHeader.m_oStashedFirst;
+m_aStashedHeader.m_oStashedLeft = rCpy.m_aStashedHeader.m_oStashedLeft;
+m_aStashedHeader.m_oStashedFirstLeft = 
rCpy.m_aStashedHeader.m_oStashedFirstLeft;
 
-m_aStashedFooter.m_pStashedFirst = rCpy.m_aStashedFooter.m_pStashedFirst;
-m_aStashedFooter.m_pStashedLeft = 

core.git: sw/inc sw/source

2024-02-23 Thread Miklos Vajna (via logerrit)
 sw/inc/swtable.hxx   |2 ++
 sw/source/core/docnode/node.cxx  |6 +-
 sw/source/core/table/swtable.cxx |9 +
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit ca22f880159d7845167f72f42c6a540191030613
Author: Miklos Vajna 
AuthorDate: Fri Feb 23 08:51:01 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Feb 23 10:03:33 2024 +0100

sw doc model xml dump: extract SwTableBox::dumpAsXml() from SwStartNode

Ideally each class should just dump itself.

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

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 3d0a5732d188..69138709ebac 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -556,6 +556,8 @@ public:
 SwRedlineTable::size_type GetRedline() const;
 // get redline type
 RedlineType GetRedlineType() const;
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 class SwCellFrame;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index ba3d9fdb6812..4425893bc880 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1040,11 +1040,7 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 {
 if (SwTableBox* pBox = GetTableBox())
 {
-(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBox"));
-(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), 
"%p", pBox);
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), 
BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
-pBox->GetFrameFormat()->dumpAsXml(pWriter);
-(void)xmlTextWriterEndElement(pWriter);
+pBox->dumpAsXml(pWriter);
 }
 }
 
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index bc32a108d792..ebe99f36de31 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -3046,6 +3046,15 @@ RedlineType SwTableBox::GetRedlineType() const
 return RedlineType::None;
 }
 
+void SwTableBox::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBox"));
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), 
BAD_CAST(OString::number(mnRowSpan).getStr()));
+GetFrameFormat()->dumpAsXml(pWriter);
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 struct SwTableCellInfo::Impl
 {
 const SwTable * m_pTable;


core.git: sw/inc sw/source

2024-02-17 Thread Mike Kaganski (via logerrit)
 sw/inc/docary.hxx |7 ++-
 sw/source/core/doc/docredln.cxx   |2 +-
 sw/source/core/doc/doctxm.cxx |6 +++---
 sw/source/core/docnode/nodes.cxx  |6 +++---
 sw/source/core/layout/findfrm.cxx |   12 +---
 sw/source/core/layout/tabfrm.cxx  |   14 +++---
 sw/source/core/layout/trvlfrm.cxx |   22 +++---
 7 files changed, 32 insertions(+), 37 deletions(-)

New commits:
commit b065496b23f249d9c08a6267d2aaa2fd1c81e56a
Author: Mike Kaganski 
AuthorDate: Sat Feb 17 16:41:41 2024 +0600
Commit: Mike Kaganski 
CommitDate: Sat Feb 17 13:50:51 2024 +0100

Remove more unneeded const_cast

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

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index dce6a44b7576..5cd132f0ef44 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -131,7 +131,7 @@ public:
 erase( begin() + aStartIdx, begin() + aEndIdx);
 }
 
-size_t GetPos(Value const& p) const
+size_t GetPos(typename std::remove_pointer_t const* const p) const
 {
 const_iterator const it = std::find(begin(), end(), p);
 return it == end() ? SIZE_MAX : it - begin();
@@ -159,9 +159,6 @@ public:
 virtual Value GetFormat(size_t idx) const override
 { return SwVectorModifyBase::operator[](idx); }
 
-size_t GetPos(const SwFormat *p) const
-{ return SwVectorModifyBase::GetPos( static_cast( 
const_cast( p ) ) ); }
-
 // Override return type to reduce casting
 virtual Value FindFormatByName(const OUString& rName) const override
 { return static_cast(SwFormatsBase::FindFormatByName(rName)); }
@@ -230,7 +227,7 @@ private:
 mutable sal_uInt32 m_nMaxMovedID = 1;   //every move-redline pair get a 
unique ID, so they can find each other.
 public:
 ~SwRedlineTable();
-bool Contains(const SwRangeRedline* p) const { return 
maVector.find(const_cast(p)) != maVector.end(); }
+bool Contains(const SwRangeRedline* p) const { return maVector.find(p) != 
maVector.end(); }
 size_type GetPos(const SwRangeRedline* p) const;
 
 bool Insert(SwRangeRedline*& p);
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 32696630e591..b8bb35056de1 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -658,7 +658,7 @@ SwRedlineTable::~SwRedlineTable()
 
 SwRedlineTable::size_type SwRedlineTable::GetPos(const SwRangeRedline* p) const
 {
-vector_type::const_iterator it = 
maVector.find(const_cast(p));
+vector_type::const_iterator it = maVector.find(p);
 if( it == maVector.end() )
 return npos;
 return it - maVector.begin();
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index af957c8a7318..8acfafbe6dea 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -859,7 +859,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 {
 if (!GetFormat())
 return;
-SwSectionNode const*const pSectNd(GetFormat()->GetSectionNode());
+SwSectionNode* const pSectNd(GetFormat()->GetSectionNode());
 if (nullptr == pSectNd ||
 !pSectNd->GetNodes().IsDocNodes() ||
 IsHiddenFlag() ||
@@ -873,7 +873,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 maMSTOCExpression.clear();
 }
 
-SwDoc& rDoc = const_cast(pSectNd->GetDoc());
+SwDoc& rDoc = pSectNd->GetDoc();
 
 if (pAttr && GetFormat())
 rDoc.ChgFormat(*GetFormat(), *pAttr);
@@ -949,7 +949,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 : nullptr;
 
 SwNode2LayoutSaveUpperFrames aN2L(*pSectNd);
-const_cast(pSectNd)->DelFrames();
+pSectNd->DelFrames();
 
 // This would be a good time to update the Numbering
 rDoc.UpdateNumRule();
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index d180a3a584c6..23729d1bedc0 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -283,7 +283,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, 
SwNodeOffset nSz,
 SwTextField* pTextField = 
static_txtattr_cast(pAttr);
 
rNds.GetDoc().getIDocumentFieldsAccess().InsDelFieldInFieldLst( !bToUndo, 
*pTextField );
 
-const SwFieldType* pTyp = 
pTextField->GetFormatField().GetField()->GetTyp();
+SwFieldType* pTyp = 
pTextField->GetFormatField().GetField()->GetTyp();
 if ( SwFieldIds::Postit == pTyp->Which() )
 {
 rNds.GetDoc().GetDocShell()->Broadcast(
@@ -296,9 +296,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, 
SwNodeOffset nSz,
 

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

2024-02-07 Thread Noel Grandin (via logerrit)
 sw/inc/IDocumentMarkAccess.hxx |7 +++
 sw/source/core/doc/docbm.cxx   |   10 ++
 sw/source/core/inc/MarkManager.hxx |1 +
 sw/source/filter/writer/writer.cxx |6 +++---
 4 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit 0a32def8b519461b35b1e249d71ae9961b04400a
Author: Noel Grandin 
AuthorDate: Wed Feb 7 14:52:05 2024 +0200
Commit: Noel Grandin 
CommitDate: Wed Feb 7 18:45:10 2024 +0100

tdf#158279 TOC links lost when converting .doc to HTML

regression from
commit 8ce36e943f0e50970925b2dd77729ef6036b4a49
Author: Noel Grandin 
Date:   Sun May 26 15:15:41 2019 +0200
move some searching inside IDocumentMarkAccess

where I called the wrong method from inside Writer::FindPos_Bkmk

The code was then removed in
commit 7bad1516c5f2a85b5bae3f49261ac2494cbb7162
Author: Noel Grandin 
Date:   Wed Jul 17 05:41:08 2019 +0200
loplugin:unusedmethods

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

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index d63b58f606c4..bc8f2e1c03d6 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -279,6 +279,13 @@ class IDocumentMarkAccess
 */
 virtual const_iterator_t findMark(const OUString& rMark) const =0;
 
+/** Find the first Mark that does not start before.
+
+@returns
+an iterator pointing to the mark, or pointing to getAllMarksEnd() 
if nothing was found.
+*/
+virtual const_iterator_t findFirstMarkNotStartsBefore(const 
SwPosition& rPos) const =0;
+
 // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, 
CROSSREF_HEADING_BOOKMARK )
 
 /** check if the selection would delete a BOOKMARK */
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 00681135b468..730da32625d4 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1410,6 +1410,16 @@ namespace sw::mark
 return IDocumentMarkAccess::iterator(ret);
 }
 
+// find the first Mark that does not start before
+IDocumentMarkAccess::const_iterator_t 
MarkManager::findFirstMarkNotStartsBefore(const SwPosition& rPos) const
+{
+return std::lower_bound(
+m_vAllMarks.begin(),
+m_vAllMarks.end(),
+rPos,
+CompareIMarkStartsBefore());
+}
+
 IDocumentMarkAccess::const_iterator_t MarkManager::getAllMarksBegin() const
 { return m_vAllMarks.begin(); }
 
diff --git a/sw/source/core/inc/MarkManager.hxx 
b/sw/source/core/inc/MarkManager.hxx
index ef0e79d74c11..dd7eb9f6f18b 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -81,6 +81,7 @@ namespace sw::mark {
 virtual const_iterator_t getAllMarksEnd() const override;
 virtual sal_Int32 getAllMarksCount() const override;
 virtual const_iterator_t findMark(const OUString& rName) const 
override;
+virtual const_iterator_t findFirstMarkNotStartsBefore(const 
SwPosition& rPos) const override;
 
 // bookmarks
 virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) 
const override;
diff --git a/sw/source/filter/writer/writer.cxx 
b/sw/source/filter/writer/writer.cxx
index a90482bfb31a..e21e81e5239c 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -157,9 +157,9 @@ bool Writer::CopyNextPam( SwPaM ** ppPam )
 sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const
 {
 const IDocumentMarkAccess* const pMarkAccess = 
m_pDoc->getIDocumentMarkAccess();
-const IDocumentMarkAccess::const_iterator_t ppBkmk = 
pMarkAccess->findFirstBookmarkStartsAfter(rPos);
-if(ppBkmk != pMarkAccess->getBookmarksEnd())
-return ppBkmk - pMarkAccess->getBookmarksBegin();
+const IDocumentMarkAccess::const_iterator_t ppBkmk = 
pMarkAccess->findFirstMarkNotStartsBefore(rPos);
+if(ppBkmk != pMarkAccess->getAllMarksEnd())
+return ppBkmk - pMarkAccess->getAllMarksBegin();
 return -1;
 }
 


core.git: sw/inc

2024-02-06 Thread Miklos Vajna (via logerrit)
 sw/inc/shellio.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 8593e78e99ab9cf7e3e30db31a14a7fb016afea8
Author: Miklos Vajna 
AuthorDate: Tue Feb 6 08:03:13 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 6 11:45:40 2024 +0100

sw: document connection between SwTextBlocks and autotext

See e.g. commit 87670fa998a26ab059e40bbe8f5e0acf0ad6ea04 (DOCX autotext
import: speed up handling of large amount of blocks, 2019-03-14).

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

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 5a7c6f2a7635..c9fc67ea378e 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -305,6 +305,8 @@ public:
 
 class SwImpBlocks;
 
+/// Used for autotext handling. The list of autotexts get imported to a 
temporary document, and then
+/// this class provides the actual glossary document which is the final target 
for autotext.
 class SW_DLLPUBLIC SwTextBlocks
 {
 std::unique_ptr m_pImp;


core.git: sw/inc sw/source

2024-01-31 Thread Noel Grandin (via logerrit)
 sw/inc/swabstdlg.hxx |   10 +-
 sw/source/ui/dialog/swdlgfact.cxx|   10 --
 sw/source/ui/dialog/swdlgfact.hxx|   10 ++
 sw/source/uibase/inc/DateFormFieldDialog.hxx |9 +
 sw/source/uibase/shells/textsh1.cxx  |   27 +++
 5 files changed, 43 insertions(+), 23 deletions(-)

New commits:
commit 1195df679859b2ebfafb60bd456dcba90ff6bfae
Author: Noel Grandin 
AuthorDate: Wed Jan 31 11:00:23 2024 +0200
Commit: Noel Grandin 
CommitDate: Wed Jan 31 17:22:19 2024 +0100

make date-form-field dialog async

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

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 2af7aea2ef29..019684b11317 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -460,6 +460,14 @@ public:
 virtual void UpdateFields() = 0;
 };
 
+class AbstractDateFormFieldDialog : public VclAbstractDialog
+{
+protected:
+virtual ~AbstractDateFormFieldDialog() override = default;
+public:
+virtual void Apply() = 0;
+};
+
 class SwAbstractDialogFactory
 {
 public:
@@ -500,7 +508,7 @@ public:
 SwField* pField, bool bPrevButton, bool bNextButton) = 0;
 virtual VclPtr 
CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* 
pDropDownField) = 0;
 
-virtual VclPtr CreateDateFormFieldDialog(weld::Widget* 
pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc) = 0;
+virtual VclPtr 
CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* 
pDateField, SwDoc& rDoc) = 0;
 
 virtual VclPtr CreateSwEnvDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0;
 
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 6ae455d3600c..50498ab480db 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -243,7 +243,13 @@ bool 
AbstractDropDownFormFieldDialog_Impl::StartExecuteAsync(AsyncContext )
 
 short AbstractDateFormFieldDialog_Impl::Execute()
 {
-return m_xDlg->run();
+assert(false);
+return -1;
+}
+
+bool AbstractDateFormFieldDialog_Impl::StartExecuteAsync(AsyncContext )
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
 }
 
 short AbstractSwLabDlg_Impl::Execute()
@@ -1116,7 +1122,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateDrop
 return 
VclPtr::Create(std::make_unique(pParent,
 pDropDownField));
 }
 
-VclPtr 
SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(weld::Widget *pParent, 
sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc)
+VclPtr 
SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(weld::Widget *pParent, 
sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc)
 {
 return 
VclPtr::Create(std::make_unique(pParent,
 pDateField, rDoc));
 }
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index bb795127cf5e..d1f8f4c2b5bd 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -395,15 +395,17 @@ public:
 virtual void Apply() override { m_xDlg->Apply(); }
 };
 
-class AbstractDateFormFieldDialog_Impl : public VclAbstractDialog
+class AbstractDateFormFieldDialog_Impl : public AbstractDateFormFieldDialog
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit 
AbstractDateFormFieldDialog_Impl(std::unique_ptr p)
+explicit 
AbstractDateFormFieldDialog_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext ) override;
+virtual void Apply() override { m_xDlg->Apply(); }
 };
 
 class AbstractSwLabDlg_Impl  : public AbstractSwLabDlg
@@ -799,7 +801,7 @@ public:
 virtual VclPtr 
CreateDropDownFieldDialog(weld::Widget* pParent, SwWrtShell ,
 SwField* pField, bool bPrevButton, bool bNextButton) override;
 virtual VclPtr 
CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* 
pDropDownField) override;
-virtual VclPtr CreateDateFormFieldDialog(weld::Widget* 
pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc) override;
+virtual VclPtr 
CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* 
pDateField, SwDoc& rDoc) override;
 
 virtual VclPtr CreateSwEnvDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) 
override;
 virtual VclPtr CreateSwLabDlg(weld::Window* pParent, 
const SfxItemSet& rSet,
diff --git a/sw/source/uibase/inc/DateFormFieldDialog.hxx 
b/sw/source/uibase/inc/DateFormFieldDialog.hxx
index 2b4573af7dea..81a0b790831c 100644
--- a/sw/source/uibase/inc/DateFormFieldDialog.hxx
+++ b/sw/source/uibase/inc/DateFormFieldDialog.hxx
@@ -31,20 +31,13 @@ private:
 
 

core.git: sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk

2024-01-28 Thread Jim Raykowski (via logerrit)
 sw/UIConfig_swriter.mk|1 
 sw/inc/bitmaps.hlst   |2 
 sw/inc/strings.hrc|6 
 sw/source/uibase/dochdl/swdtflvr.cxx  |   18 -
 sw/source/uibase/inc/conttree.hxx |3 
 sw/source/uibase/inc/navicfg.hxx  |   10 
 sw/source/uibase/inc/navicont.hxx |   12 -
 sw/source/uibase/inc/navipi.hxx   |8 
 sw/source/uibase/inc/swcont.hxx   |   10 
 sw/source/uibase/inc/wrtsh.hxx|3 
 sw/source/uibase/utlui/content.cxx|  254 --
 sw/source/uibase/utlui/navicfg.cxx|   42 +--
 sw/source/uibase/utlui/navipi.cxx |   61 -
 sw/source/uibase/wrtsh/wrtsh2.cxx |  208 +-
 sw/uiconfig/swriter/ui/navigatorcontextmenu.ui|   14 -
 sw/uiconfig/swriter/ui/navigatordraginsertmenu.ui |9 
 sw/uiconfig/swriter/ui/navigatorpanel.ui  |   61 -
 17 files changed, 388 insertions(+), 334 deletions(-)

New commits:
commit 95d1e7f0873a2bbb9ab4b0aa171fec29d36c3f55
Author: Jim Raykowski 
AuthorDate: Thu Dec 28 15:13:52 2023 -0900
Commit: Jim Raykowski 
CommitDate: Sun Jan 28 21:46:57 2024 +0100

tdf#36310 Insert cross reference from Navigator by DnD

This enhancement provides the ability to insert cross-references by
drag and drop from the Navigator. It replaces the 'drag mode' way of
inserting a hyperlink, section link, and section copy with a popup
menu on drop that shows insert-as kinds available for the dragged
content type.

There is an oddity with X11 that on drop the mouse pointer does not
change from a drag pointer to a menu item select pointer for
approximately 5 seconds and during that time the popup menu items
can't be selected.

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

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index a371b4928ea5..43ab167dd197 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -243,6 +243,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/mmsendmails \
sw/uiconfig/swriter/ui/mmsalutationpage \
sw/uiconfig/swriter/ui/navigatorcontextmenu \
+   sw/uiconfig/swriter/ui/navigatordraginsertmenu \
sw/uiconfig/swriter/ui/navigatorpanel \
sw/uiconfig/swriter/ui/notebookbar \
sw/uiconfig/swriter/ui/notebookbar_compact \
diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst
index b1f30b0932f1..80ab4eb3b17a 100644
--- a/sw/inc/bitmaps.hlst
+++ b/sw/inc/bitmaps.hlst
@@ -97,8 +97,6 @@ inline constexpr OUString RID_BMP_NAVI_TEXTFIELD = 
u"sw/res/nc20005.png"_ustr;
 inline constexpr OUString RID_BMP_NAVI_FOOTNOTE = u"sw/res/nc20012.png"_ustr;
 inline constexpr OUString RID_BMP_NAVI_ENDNOTE = u"sw/res/nc20013.png"_ustr;
 inline constexpr OUString RID_BMP_DROP_REGION = u"sw/res/sc20235.png"_ustr;
-inline constexpr OUString RID_BMP_DROP_LINK = u"sw/res/sc20238.png"_ustr;
-inline constexpr OUString RID_BMP_DROP_COPY = u"sw/res/sc20239.png"_ustr;
 
 inline constexpr OUString RID_BMP_WRAP_RIGHT = u"sw/res/wr03.png"_ustr;
 inline constexpr OUString RID_BMP_WRAP_CONTOUR_RIGHT = u"sw/res/wr09.png"_ustr;
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 2986e03b9a85..9e0cf978aa3b 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -421,6 +421,9 @@
 #define STR_HIDDEN_CHANGES_DETAIL3  
NC_("STR_HIDDEN_CHANGES_DETAIL3", "Document contains tracked changes.")
 #define STR_FLDREF_FOOTNOTE NC_("STR_FLDREF_FOOTNOTE", 
"Footnote")
 #define STR_FLDREF_ENDNOTE  NC_("STR_FLDREF_ENDNOTE", 
"Endnote")
+#define STR_HYPERLINK   NC_("STR_HYPERLINK", 
"Hyperlink")
+#define STR_SECTIONLINK NC_("STR_SECTIONLINK", 
"Section Link")
+#define STR_SECTIONCOPY NC_("STR_SECTIONCOPY", 
"Section Copy")
 
 // Undo
 #define STR_CANT_UNDO   NC_("STR_CANT_UNDO", "not 
possible")
@@ -699,9 +702,6 @@
 
 #define STR_EXPANDALL   NC_("STR_EXPANDALL", "Expand 
All")
 #define STR_COLLAPSEALL NC_("STR_COLLAPSEALL", 
"Collapse All")
-#define STR_HYPERLINK   NC_("STR_HYPERLINK", "Insert 
as Hyperlink")
-#define STR_LINK_REGION NC_("STR_LINK_REGION", "Insert 
as Link")
-#define STR_COPY_REGION NC_("STR_COPY_REGION", "Insert 
as Copy")
 #define STR_DISPLAY NC_("STR_DISPLAY", "Display")
 #define STR_ACTIVE_VIEW NC_("STR_ACTIVE_VIEW", "Active 
Window")
 #define STR_HIDDEN  

core.git: sw/inc sw/source

2024-01-28 Thread Caolán McNamara (via logerrit)
 sw/inc/ndole.hxx|3 +++
 sw/source/core/doc/notxtfrm.cxx |   17 +
 sw/source/core/ole/ndole.cxx|   19 +++
 3 files changed, 39 insertions(+)

New commits:
commit dee3cff90d5d5948e1f8dcba084f192af2e5eb07
Author: Caolán McNamara 
AuthorDate: Sat Jan 27 22:00:15 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Jan 28 15:39:28 2024 +0100

Set chart outliner background to the page bg to resolve 'auto' color

when writer does this direct primitive rendering of the chart

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

diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index 5caa29ab43bf..6265160219f9 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+class SvxDrawPage;
 class SwGrfFormatColl;
 class SwDoc;
 class SwOLENode;
@@ -81,6 +82,8 @@ public:
 bool bSynchron);
 void resetBufferedData();
 
+SvxDrawPage* tryToGetChartDrawPage() const;
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index b97ae500a021..362054bd592a 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -75,7 +75,10 @@
 
 // MM02 needed for VOC mechanism and getting the OC - may be moved to an own 
file
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1385,11 +1388,25 @@ void SwNoTextFrame::ImplPaintPictureBitmap( 
vcl::RenderContext* pOut,
 rAlignedGrfArea.Left(), rAlignedGrfArea.Top(),
 rAlignedGrfArea.Right(), rAlignedGrfArea.Bottom());
 
+Color aOldBackColor;
+SvxDrawPage* pDrawPage = 
pOLENd->GetOLEObj().tryToGetChartDrawPage();
+SdrPage* pPage = pDrawPage ? pDrawPage->GetSdrPage() : nullptr;
+if (pPage)
+{
+SdrModel& rModel = pPage->getSdrModelFromSdrPage();
+SdrOutliner& rOutl = rModel.GetDrawOutliner();
+aOldBackColor = rOutl.GetBackgroundColor();
+rOutl.SetBackgroundColor(pPage->GetPageBackgroundColor());
+}
+
 bDone = paintUsingPrimitivesHelper(
 *pOut,
 aSequence,
 aSourceRange,
 aTargetRange);
+
+if (pPage)
+
pPage->getSdrModelFromSdrPage().GetDrawOutliner().SetBackgroundColor(aOldBackColor);
 }
 }
 
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index de94986797f3..00a727c72a6d 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,11 +48,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1235,6 +1238,22 @@ drawinglayer::primitive2d::Primitive2DContainer const & 
SwOLEObj::tryToGetChartC
 return m_aPrimitive2DSequence;
 }
 
+SvxDrawPage* SwOLEObj::tryToGetChartDrawPage() const
+{
+if (!m_xOLERef.is() || !m_xOLERef.IsChart())
+return nullptr;
+const uno::Reference xModel(m_xOLERef->getComponent(), 
uno::UNO_QUERY);
+if (!xModel.is())
+return nullptr;
+const uno::Reference xDrawPageSupplier(xModel, 
uno::UNO_QUERY);
+if (!xDrawPageSupplier)
+return nullptr;
+const uno::Reference 
xDrawPage(xDrawPageSupplier->getDrawPage());
+if (!xDrawPage)
+return nullptr;
+return comphelper::getFromUnoTunnel(xDrawPage);
+}
+
 void SwOLEObj::resetBufferedData()
 {
 m_aPrimitive2DSequence = drawinglayer::primitive2d::Primitive2DContainer();


core.git: sw/inc sw/source

2024-01-26 Thread Michael Weghorn (via logerrit)
 sw/inc/accmap.hxx|7 ++-
 sw/source/core/access/accmap.cxx |   17 ++---
 2 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit 2cedb1a19ad605df4e148589e9027512e4dd9265
Author: Michael Weghorn 
AuthorDate: Fri Jan 26 18:37:11 2024 +0100
Commit: Michael Weghorn 
CommitDate: Fri Jan 26 22:12:22 2024 +0100

sw a11y: Return MapMode instead of using out param

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

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 9daf15b8ae07..d99d8dc16c7a 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -297,12 +297,9 @@ private:
 input parameter - constant reference to point to determine the mapping
 mode adjustments for page/print preview.
 
-@param _orMapMode
-output parameter - reference to the mapping mode, which is determined
-by the method
+@return mapping mode, which is determined by the method
 */
-void GetMapMode( const Point& _rPoint,
- MapMode& _orMapMode ) const;
+MapMode GetMapMode(const Point& _rPoint) const;
 public:
 virtual bool IsDocumentSelAll() override;
 };
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index aa34fdf2d568..704dac005566 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2949,8 +2949,7 @@ Point SwAccessibleMap::LogicToPixel( const Point& rPoint 
) const
 Point aPoint = o3tl::toTwips( rPoint, o3tl::Length::mm100 );
 if (const vcl::Window* pWin = GetShell()->GetWin())
 {
-MapMode aMapMode;
-GetMapMode( aPoint, aMapMode );
+const MapMode aMapMode = GetMapMode(aPoint);
 aPoint = pWin->LogicToPixel( aPoint, aMapMode );
 aPoint = Point(pWin->OutputToAbsoluteScreenPixel( aPoint ));
 }
@@ -2963,8 +2962,7 @@ Size SwAccessibleMap::LogicToPixel( const Size& rSize ) 
const
 Size aSize( o3tl::toTwips( rSize, o3tl::Length::mm100 ) );
 if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
 {
-MapMode aMapMode;
-GetMapMode( Point(0,0), aMapMode );
+const MapMode aMapMode = GetMapMode(Point(0, 0));
 aSize = pWin->LogicToPixel( aSize, aMapMode );
 }
 
@@ -3073,8 +3071,7 @@ Point SwAccessibleMap::PixelToCore( const Point& rPoint ) 
const
 Point aPoint;
 if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
 {
-MapMode aMapMode;
-GetMapMode( rPoint, aMapMode );
+const MapMode aMapMode = GetMapMode(rPoint);
 aPoint = pWin->PixelToLogic( rPoint, aMapMode );
 }
 return aPoint;
@@ -3118,8 +3115,7 @@ tools::Rectangle SwAccessibleMap::CoreToPixel( const 
SwRect& rRect ) const
 tools::Rectangle aRect;
 if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
 {
-MapMode aMapMode;
-GetMapMode( rRect.TopLeft(), aMapMode );
+const MapMode aMapMode = GetMapMode(rRect.TopLeft());
 aRect = pWin->LogicToPixel( rRect.SVRect(), aMapMode );
 
 tools::Rectangle aTmpRect = pWin->PixelToLogic( aRect, aMapMode );
@@ -3137,8 +3133,7 @@ tools::Rectangle SwAccessibleMap::CoreToPixel( const 
SwRect& rRect ) const
 output device for mapping logic document positions to page preview window
 positions and vice versa and doesn't take care to recover its changes.
 */
-void SwAccessibleMap::GetMapMode( const Point& _rPoint,
-  MapMode& _orMapMode ) const
+MapMode SwAccessibleMap::GetMapMode(const Point& _rPoint) const
 {
 MapMode aMapMode = GetShell()->GetWin()->GetMapMode();
 if( GetShell()->IsPreview() )
@@ -3146,7 +3141,7 @@ void SwAccessibleMap::GetMapMode( const Point& _rPoint,
 assert(mpPreview != nullptr);
 mpPreview->AdjustMapMode( aMapMode, _rPoint );
 }
-_orMapMode = aMapMode;
+return aMapMode;
 }
 
 Size SwAccessibleMap::GetPreviewPageSize(sal_uInt16 const nPreviewPageNum) 
const


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

2024-01-26 Thread Miklos Vajna (via logerrit)
 sw/inc/viewopt.hxx  |4 
 sw/source/core/view/viewsh.cxx  |1 +
 sw/source/uibase/config/viewopt.cxx |   15 +++
 3 files changed, 20 insertions(+)

New commits:
commit 8fc478308f680227d7253b4becfc698e289f2be1
Author: Miklos Vajna 
AuthorDate: Fri Jan 26 08:00:46 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Jan 26 09:01:28 2024 +0100

sw layout xml dump: show if formatting marks are on

Because that influences the layout, and sometimes it's far from trivial
that it gets disabled, e.g. during printing/PDF export.

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

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 95c547e5c691..a98da0dc3cdf 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -137,6 +137,8 @@ struct ViewOptFlags1
 && bShowChangesInMargin == rOther.bShowChangesInMargin
 && bShowChangesInMargin2 == rOther.bShowChangesInMargin2;
 }
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 enum class ViewOptCoreFlags2 {
@@ -854,6 +856,8 @@ public:
 sal_uInt8 GetIdxEntryLvl() const { return m_nIdxEntryLvl; }
 void SetIdxEntryLvl(sal_uInt8 n) { m_nIdxEntryLvl = n; }
 
+void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
 // Useful for when getting the current view SwViewOption is not possible 
otherwise
 static const SwViewOption& GetCurrentViewOptions();
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a7222d95b049..e7dfd326791f 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -156,6 +156,7 @@ bool SwViewShell::isOutputToWindow() const
 void SwViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwViewShell"));
+mpOpt->dumpAsXml(pWriter);
 (void)xmlTextWriterEndElement(pWriter);
 }
 
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index abd8bbc85768..4ffb7a7c47f9 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -638,4 +638,19 @@ const SwViewOption& SwViewOption::GetCurrentViewOptions()
 return aDefaultViewOptions;
 }
 
+void SwViewOption::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwViewOption"));
+m_nCoreOptions.dumpAsXml(pWriter);
+(void)xmlTextWriterEndElement(pWriter);
+}
+
+void ViewOptFlags1::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("ViewOptFlags1"));
+(void)xmlTextWriterWriteFormatAttribute(pWriter, 
BAD_CAST("view-metachars"), "%s",
+
BAD_CAST(OString::boolean(bViewMetachars).getStr()));
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: sw/inc sw/source

2024-01-25 Thread Noel Grandin (via logerrit)
 sw/inc/swabstdlg.hxx |2 -
 sw/source/ui/dialog/swdlgfact.cxx|7 +-
 sw/source/ui/dialog/swdlgfact.hxx|7 +++---
 sw/source/ui/frmdlg/wrap.cxx |5 ++--
 sw/source/uibase/inc/drwbassh.hxx|2 -
 sw/source/uibase/inc/wrap.hxx|7 +-
 sw/source/uibase/shells/drwbassh.cxx |   39 +--
 7 files changed, 45 insertions(+), 24 deletions(-)

New commits:
commit 630494adc98a245feadd573aa8463f46b15c7787
Author: Noel Grandin 
AuthorDate: Thu Jan 25 15:40:51 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Jan 25 21:41:05 2024 +0100

make wrap dialog async

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

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index a9ceb855b337..690b20c6ea3b 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -486,7 +486,7 @@ public:
   bool 
bSetAutoFormat = true,
   const 
SwTableAutoFormat* pSelFormat = nullptr ) = 0;
 virtual VclPtr CreateSwBorderDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwBorderModes nType) = 0;
-virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwWrtShell* pSh) = 0;
+virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pSh) = 0;
 
 virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwTableFUNC ) = 0;
 virtual VclPtr CreateSwTableTabDlg(weld::Window* 
pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 30e41e4edaf4..412e3682a910 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -112,6 +112,11 @@ short SwAbstractSfxController_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool SwAbstractSfxController_Impl::StartExecuteAsync(AsyncContext )
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractNumFormatDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -1126,7 +1131,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwBorderDlg(weld::
 return 
VclPtr::Create(std::make_unique(pParent,
 rSet, nType));
 }
 
-VclPtr 
SwAbstractDialogFactory_Impl::CreateSwWrapDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwWrtShell* pSh)
+VclPtr 
SwAbstractDialogFactory_Impl::CreateSwWrapDlg(weld::Window* pParent, const 
SfxItemSet& rSet, SwWrtShell* pSh)
 {
 return 
VclPtr::Create(std::make_unique(pParent,
 rSet, pSh, true/*bDrawMode*/));
 }
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index c2c043bb3eb6..ac79f2652ddc 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -116,13 +116,14 @@ public:
 
 class SwAbstractSfxController_Impl : public SfxAbstractDialog
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit 
SwAbstractSfxController_Impl(std::unique_ptr p)
+explicit 
SwAbstractSfxController_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext ) override;
 virtual const SfxItemSet* GetOutputItemSet() const override;
 virtual void SetText(const OUString& rStr) override;
 };
@@ -793,7 +794,7 @@ public:
   const 
SwTableAutoFormat* pSelFormat = nullptr) override;
 virtual VclPtr CreateSwBorderDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwBorderModes nType) override;
 
-virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
SfxItemSet& rSet, SwWrtShell* pSh) override;
+virtual VclPtr CreateSwWrapDlg(weld::Window* pParent, 
const SfxItemSet& rSet, SwWrtShell* pSh) override;
 virtual VclPtr CreateSwTableWidthDlg(weld::Window 
*pParent, SwTableFUNC ) override;
 virtual VclPtr CreateSwTableTabDlg(weld::Window* 
pParent,
 const SfxItemSet* pItemSet, SwWrtShell* pSh) override;
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index 684fe38b22bb..a6ebfec47619 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -51,10 +51,11 @@ const WhichRangesContainer 
SwWrapTabPage::s_aWrapPageRg(svl::Items<
 >);
 
 SwWrapDlg::SwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, 
SwWrtShell* pWrtShell, bool bDrawMode)
-: SfxSingleTabDialogController(pParent, , 
"modules/swriter/ui/wrapdialog.ui", "WrapDialog")
+: SwWrapDlgBase{rSet}, // this is an async dialog, so we need to store a 
copy of the rSet
+  SfxSingleTabDialogController(pParent, , 
"modules/swriter/ui/wrapdialog.ui", "WrapDialog")
 {
 // create TabPage
-auto xNewPage = SwWrapTabPage::Create(get_content_area(), this, );
+auto xNewPage = 

core.git: sw/inc sw/source

2024-01-25 Thread Caolán McNamara (via logerrit)
 sw/inc/viewopt.hxx  |2 ++
 sw/source/core/view/viewsh.cxx  |9 +
 sw/source/uibase/config/viewopt.cxx |   12 
 3 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 9e917a7ce95d1564814e90188bc915a38ac69468
Author: Caolán McNamara 
AuthorDate: Thu Jan 25 09:51:24 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 25 13:26:43 2024 +0100

extract this to a explanatory SyncLayoutRelatedViewOptions function

no change intended here

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

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 72659849a627..95c547e5c691 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -856,6 +856,8 @@ public:
 
 // Useful for when getting the current view SwViewOption is not possible 
otherwise
 static const SwViewOption& GetCurrentViewOptions();
+
+void SyncLayoutRelatedViewOptions(const SwViewOption& rOpt);
 };
 
 inline bool SwViewOption::operator==( const SwViewOption  ) const
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 9ad7015e236f..a7222d95b049 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2217,14 +2217,7 @@ void SwViewShell::ApplyViewOptions( const SwViewOption 
 )
 if( == this)
 continue;
 SwViewOption aOpt( *rSh.GetViewOptions() );
-aOpt.SetFieldName( rOpt.IsFieldName() );
-aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
-aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
-aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
-aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
-aOpt.SetHideWhitespaceMode(rOpt.IsHideWhitespaceMode());
-aOpt.SetViewLayoutColumns(rOpt.GetViewLayoutColumns());
-aOpt.SetPostIts(rOpt.IsPostIts());
+aOpt.SyncLayoutRelatedViewOptions(rOpt);
 if ( !(aOpt == *rSh.GetViewOptions()) )
 rSh.ImplApplyViewOptions( aOpt );
 }
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 3cf82bee15ab..abd8bbc85768 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -612,6 +612,18 @@ bool SwViewOption::IsIgnoreProtectedArea()
 return gIgnoreProtectedArea.get();
 }
 
+void SwViewOption::SyncLayoutRelatedViewOptions(const SwViewOption& rOpt)
+{
+SetFieldName(rOpt.IsFieldName());
+SetShowHiddenField(rOpt.IsShowHiddenField());
+SetShowHiddenPara(rOpt.IsShowHiddenPara());
+SetShowHiddenChar(rOpt.IsShowHiddenChar());
+SetViewLayoutBookMode(rOpt.IsViewLayoutBookMode());
+SetHideWhitespaceMode(rOpt.IsHideWhitespaceMode());
+SetViewLayoutColumns(rOpt.GetViewLayoutColumns());
+SetPostIts(rOpt.IsPostIts());
+}
+
 const SwViewOption& SwViewOption::GetCurrentViewOptions()
 {
 SfxViewShell* pCurrentShell = SfxViewShell::Current();


core.git: sw/inc sw/source

2024-01-25 Thread Michael Weghorn (via logerrit)
 sw/inc/accmap.hxx|3 +--
 sw/source/core/access/accmap.cxx |   15 ++-
 2 files changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 8479bbecd2434d65eb6c26100a783ecf96f6da12
Author: Michael Weghorn 
AuthorDate: Wed Jan 24 12:10:32 2024 +0100
Commit: Michael Weghorn 
CommitDate: Thu Jan 25 09:41:38 2024 +0100

sw a11y: Return SwAccessibleContext to avoid casting

Let `SwAccessibleMap::GetDocumentView_` return the
more concrete `rtl::Reference`
instead of `uno::Reference`, which
avoids having to cast in one place in
`SwAccessibleMap::DoInvalidateShapeSelection`
(and more places in upcoming changes).

Replace the null check by an assert, as
`SwAccessibleMap::GetDocumentView_` never
returns an empty reference.

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

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 6e5c189a97b4..9daf15b8ae07 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -131,8 +131,7 @@ class SwAccessibleMap final : public 
::accessibility::IAccessibleViewForwarder,
 
 void InvalidateRelationSet_( const SwFrame* pFrame, bool bFrom );
 
-css::uno::Reference
-GetDocumentView_( bool bPagePreview );
+rtl::Reference GetDocumentView_(bool bPagePreview);
 
 /** method to build up a new data structure of the accessible paragraphs,
 which have a selection
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index ebc877601efc..0a6da3f501b8 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1556,14 +1556,11 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool 
bInvalidateFocusMode /*=fa
 const unsigned int SELECTION_WITH_NUM = 10;
 if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
 {
- uno::Reference< XAccessible > xDoc = GetDocumentView( );
- SwAccessibleContext * pCont = static_cast(xDoc.get());
- if (pCont)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- pCont->FireAccessibleEvent(aEvent);
- }
+rtl::Reference xDoc = GetDocumentView_(false);
+assert(xDoc.is());
+AccessibleEventObject aEvent;
+aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+xDoc->FireAccessibleEvent(aEvent);
 }
 else
 {
@@ -1696,7 +1693,7 @@ SwAccessibleMap::~SwAccessibleMap()
 mpVSh->GetLayout()->RemoveAccessibleShell();
 }
 
-uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView_(
+rtl::Reference SwAccessibleMap::GetDocumentView_(
 bool bPagePreview )
 {
 DBG_TESTSOLARMUTEX();


core.git: sw/inc sw/source

2024-01-22 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/PostItMgr.hxx |4 +
 sw/source/uibase/docvw/PostItMgr.cxx |   84 +++
 sw/source/uibase/docvw/edtwin.cxx|   19 +++
 sw/source/uibase/inc/edtwin.hxx  |1 
 sw/source/uibase/misc/swruler.cxx|3 -
 5 files changed, 80 insertions(+), 31 deletions(-)

New commits:
commit b9368eab798a766b5a24658c783a6ee73dbf2caa
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jan 22 10:57:06 2024 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jan 22 12:19:47 2024 +0100

tdf#159145 Allow changing width of comment column on right border

not only on the ruler as implemented in 
ac2720dcbe4e51e7f6733a385b5f7b571c6431e9

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

diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index ec6604c43a23..2278ae05ea6f 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -150,7 +150,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 bool ShowScrollbar(const tools::ULong aPage) const;
 bool HasNotes() const ;
 bool ShowNotes() const;
-void SetSidebarWidth(sal_uInt16 nPx);
+void SetSidebarWidth(Point aPoint);
+tools::Rectangle GetSidebarRect(const Point& rPointLogic);
 tools::ULong GetSidebarWidth(bool bPx = false) const;
 tools::ULong GetSidebarBorderWidth(bool bPx = false) const;
 
@@ -183,6 +184,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 bool IsHit(const Point );
 /// Get the matching window that is responsible for handling mouse 
events of rPointLogic, if any.
 vcl::Window* IsHitSidebarWindow(const Point& rPointLogic);
+bool IsHitSidebarDragArea(const Point& rPointLogic);
 Color GetArrowColor(sal_uInt16 aDirection, tools::ULong aPage) const;
 
 sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* 
pField) const;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 24abcc14a2a5..7af447a63a5d 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1979,32 +1979,25 @@ bool SwPostItMgr::ShowScrollbar(const tools::ULong 
aPage) const
 return false;
 }
 
-bool SwPostItMgr::IsHit(const Point )
+bool SwPostItMgr::IsHit(const Point& aPointPixel)
 {
-if (HasNotes() && ShowNotes())
-{
-const Point aPoint = mpEditWin->PixelToLogic(aPointPixel);
-const SwRootFrame* pLayout = mpWrtShell->GetLayout();
-SwRect aPageFrame;
-const tools::ULong nPageNum = SwPostItHelper::getPageInfo( aPageFrame, 
pLayout, aPoint );
-if( nPageNum )
-{
-tools::Rectangle aRect;
-OSL_ENSURE(mPages.size()>nPageNum-1,"SwPostitMgr:: page container 
size wrong");
-aRect = mPages[nPageNum-1]->eSidebarPosition == 
sw::sidebarwindows::SidebarPosition::LEFT
-? 
tools::Rectangle(Point(aPageFrame.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrame.Top()),Size(GetSidebarWidth(),aPageFrame.Height()))
-: tools::Rectangle( 
Point(aPageFrame.Right()+GetSidebarBorderWidth(),aPageFrame.Top()) , 
Size(GetSidebarWidth(),aPageFrame.Height()));
-if (aRect.Contains(aPoint))
-{
-// we hit the note's sidebar
-// lets now test for the arrow area
-if (mPages[nPageNum-1]->bScrollbar)
-return ScrollbarHit(nPageNum,aPoint);
-else
-return false;
-}
-}
-}
+if (!HasNotes() || !ShowNotes())
+return false;
+
+const Point aPoint = mpEditWin->PixelToLogic(aPointPixel);
+tools::Rectangle aRect(GetSidebarRect(aPoint));
+if (!aRect.Contains(aPoint))
+return false;
+
+// we hit the note's sidebar
+// lets now test for the arrow area
+SwRect aPageFrame;
+const tools::ULong nPageNum
+= SwPostItHelper::getPageInfo(aPageFrame, mpWrtShell->GetLayout(), 
aPoint);
+if (!nPageNum)
+return false;
+if (mPages[nPageNum - 1]->bScrollbar)
+return ScrollbarHit(nPageNum, aPoint);
 return false;
 }
 
@@ -2038,6 +2031,38 @@ vcl::Window* SwPostItMgr::IsHitSidebarWindow(const 
Point& rPointLogic)
 return pRet;
 }
 
+tools::Rectangle SwPostItMgr::GetSidebarRect(const Point& rPointLogic)
+{
+const SwRootFrame* pLayout = mpWrtShell->GetLayout();
+SwRect aPageFrame;
+const tools::ULong nPageNum = SwPostItHelper::getPageInfo(aPageFrame, 
pLayout, rPointLogic);
+if (!nPageNum)
+return tools::Rectangle();
+
+OSL_ENSURE(mPages.size() > nPageNum - 1, "SwPostitMgr:: page container 
size wrong");
+return mPages[nPageNum - 1]->eSidebarPosition == 
sw::sidebarwindows::SidebarPosition::LEFT
+  

core.git: sw/inc sw/source

2024-01-18 Thread Mike Kaganski (via logerrit)
 sw/inc/editsh.hxx |4 ++--
 sw/source/core/edit/eddel.cxx |8 +---
 sw/source/uibase/wrtsh/delete.cxx |4 ++--
 3 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit c80606bb23fd42e41710d70a96b7ffaf948384a6
Author: Mike Kaganski 
AuthorDate: Thu Jan 18 14:56:54 2024 +0600
Commit: Mike Kaganski 
CommitDate: Thu Jan 18 14:14:06 2024 +0100

tdf#109272: make sure that Delete / Backspace move cursor correctly

... in change tracking mode. Cursor's end position now doesn't depend
on the selection direction; it is at the deletion's beginning in case
of Backspace, and at deletion's end in case of Delete.

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

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 1fb9ff3a5bae..2b753530159a 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -152,7 +152,7 @@ class SW_DLLPUBLIC SwEditShell : public SwCursorShell
  that will be used by GetGraphic() and GetGraphicSize(). */
 SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ;
 
-SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, 
bool* pUndo = nullptr);
+SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, 
bool goLeft = false, bool* pUndo = nullptr);
 
 SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const 
SfxItemSet& rSet );
 
@@ -178,7 +178,7 @@ public:
 
 /** Delete content of all ranges.
  If whole nodes are selected, these nodes get deleted. */
-bool Delete(bool isArtificialSelection = false);
+bool Delete(bool isArtificialSelection = false, bool goLeft = false);
 
 /// Remove a complete paragraph.
 bool DelFullPara();
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 9eb51da617b1..b8d6b0e39554 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -33,7 +33,8 @@
 #include 
 #include 
 
-void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, 
bool *const pUndo)
+void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, 
bool goLeft,
+bool* const pUndo)
 {
 auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None
 ? ExtendedSelectedAll()
@@ -127,11 +128,12 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const 
isArtificialSelection, bool
 }
 }
 
+rPam.Normalize(goLeft); // change tracking case: will make sure to end up 
in the correct point
 // Selection is not needed anymore
 rPam.DeleteMark();
 }
 
-bool SwEditShell::Delete(bool const isArtificialSelection)
+bool SwEditShell::Delete(bool const isArtificialSelection, bool goLeft)
 {
 CurrShell aCurr( this );
 bool bRet = false;
@@ -159,7 +161,7 @@ bool SwEditShell::Delete(bool const isArtificialSelection)
 
 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
 {
-DeleteSel(rPaM, isArtificialSelection, );
+DeleteSel(rPaM, isArtificialSelection, goLeft, );
 }
 
 // If undo container then close here
diff --git a/sw/source/uibase/wrtsh/delete.cxx 
b/sw/source/uibase/wrtsh/delete.cxx
index e7a09d016587..46b0a40cca5d 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -171,7 +171,7 @@ bool SwWrtShell::DelLeft()
 {
 SwActContext aActContext(this);
 ResetCursorStack();
-Delete(false);
+Delete(false, true);
 UpdateAttr();
 }
 if( IsBlockMode() )
@@ -274,7 +274,7 @@ bool SwWrtShell::DelLeft()
 SwCursorShell::Pop( SwCursorShell::PopMode::DeleteStack );
 }
 }
-bool bRet = Delete(true);
+bool bRet = Delete(true, true);
 if( !bRet && bSwap )
 SwCursorShell::SwapPam();
 CloseMark( bRet );


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

2024-01-16 Thread Miklos Vajna (via logerrit)
 sw/inc/undobj.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit a92924c3340617ea37ed94dbef0cd40723173317
Author: Miklos Vajna 
AuthorDate: Tue Jan 16 08:25:30 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 16 09:21:28 2024 +0100

sw: document SwUndoCpyDoc

Explain how this differs from SwUndoInsDoc, when both insert content to
the document.

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

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 9feaec0521b7..03ad720aabe7 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -288,6 +288,8 @@ public:
 SwUndoInsDoc( const SwPaM& );
 };
 
+/// Undo for copying from part of a document and then inserting that text, as 
opposed to inserting
+/// it from a file or clipboard.
 class SwUndoCpyDoc final : public SwUndoInserts
 {
 public:


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

2024-01-13 Thread Matt K (via logerrit)
 sw/inc/anchoredobject.hxx|1 
 sw/source/core/doc/docdraw.cxx   |   17 ++-
 sw/source/core/draw/dview.cxx|   19 ++--
 sw/source/core/frmedt/feshview.cxx   |   36 ---
 sw/source/core/layout/anchoredobject.cxx |  134 -
 sw/source/core/layout/flylay.cxx |  113 
 sw/source/core/layout/frmtool.cxx|6 -
 sw/source/core/layout/sortedobjs.cxx |4 
 sw/source/core/text/txtfly.cxx   |  143 ---
 sw/source/uibase/docvw/edtwin.cxx|   28 +++---
 sw/source/uibase/shells/drwbassh.cxx |   16 ++-
 11 files changed, 288 insertions(+), 229 deletions(-)

New commits:
commit 19062c98da5b2e9edc7a99068fa06a83c7578826
Author: Matt K 
AuthorDate: Thu Jan 11 20:37:01 2024 -0600
Commit: Mike Kaganski 
CommitDate: Sat Jan 13 18:21:02 2024 +0100

tdf#132810 Prevent crashes with gallery objects

The problem is the formats for the gallery objects
may be non-existent but the code attempts to use
them anyway, causing crashes.  The fix is to check
for the existence of the proper format objects
before using them, so as to prevent the crashes.
I tested creating/deleting multiple objects with
multiple rounds of undo/redo and believe this change
to cover all the crashes that can occur (there were
several).

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

diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 19cd2e75802b..9af198425714 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -318,6 +318,7 @@ class SW_DLLPUBLIC SwAnchoredObject
 void SetCurrRelPos( Point _aRelPos );
 
 // accessors to the format
+bool HasFrameFormat() const;
 virtual SwFrameFormat& GetFrameFormat() = 0;
 virtual const SwFrameFormat& GetFrameFormat() const = 0;
 
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index aecbe2ac824f..521ca2b0ba15 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -463,14 +463,17 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
 SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
 if( dynamic_cast( pObj) ==  nullptr )
 {
-SwDrawContact *pC = 
static_cast(GetUserCall(pObj));
-SwDrawFrameFormat *pFrameFormat = 
static_cast(pC->GetFormat());
-if( pFrameFormat &&
-RndStdIds::FLY_AS_CHAR == 
pFrameFormat->GetAnchor().GetAnchorId() )
+if (SwDrawContact* pC = 
static_cast(GetUserCall(pObj)))
 {
-rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), 
true );
---i;
-getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat );
+SwDrawFrameFormat* pFrameFormat
+= static_cast(pC->GetFormat());
+if (pFrameFormat
+&& RndStdIds::FLY_AS_CHAR == 
pFrameFormat->GetAnchor().GetAnchorId())
+{
+rDrawView.MarkObj(pObj, rDrawView.Imp().GetPageView(), 
true);
+--i;
+
getIDocumentLayoutAccess().DelLayoutFormat(pFrameFormat);
+}
 }
 }
 }
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index f7ab7cda9fbd..98c0014b1a17 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -979,16 +979,19 @@ void SwDrawView::DeleteMarked()
 {
 SdrObject *pObject = rMarkList.GetMark(i)->GetMarkedSdrObj();
 SwContact* pContact = GetUserCall(pObject);
-SwFrameFormat* pFormat = pContact->GetFormat();
-if (pObject->getChildrenOfSdrObject())
+if (pContact)
 {
-auto pChildTextBoxes = SwTextBoxHelper::CollectTextBoxes(pObject, 
pFormat);
-for (auto& rChildTextBox : pChildTextBoxes)
-aTextBoxesToDelete.push_back(rChildTextBox);
-}
-else
-if (SwFrameFormat* pTextBox = 
SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT))
+SwFrameFormat* pFormat = pContact->GetFormat();
+if (pObject->getChildrenOfSdrObject())
+{
+auto pChildTextBoxes = 
SwTextBoxHelper::CollectTextBoxes(pObject, pFormat);
+for (auto& rChildTextBox : pChildTextBoxes)
+aTextBoxesToDelete.push_back(rChildTextBox);
+}
+else if (SwFrameFormat* pTextBox
+ = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, 
RES_DRAWFRMFMT))
 aTextBoxesToDelete.push_back(pTextBox);
+}
   

core.git: sw/inc sw/source

2024-01-11 Thread Samuel Mehrbrodt (via logerrit)
 sw/inc/PostItMgr.hxx  |   41 --
 sw/source/uibase/docvw/AnnotationWin2.cxx |3 +-
 sw/source/uibase/docvw/PostItMgr.cxx  |9 --
 3 files changed, 3 insertions(+), 50 deletions(-)

New commits:
commit fb443c6d4d210d73795bdb3b7cb392765726f3a1
Author: Samuel Mehrbrodt 
AuthorDate: Thu Jan 4 15:04:06 2024 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jan 11 12:44:39 2024 +0100

Use officecfg instead of utl::ConfigItem

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

diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 510a4fa55a2a..ec6604c43a23 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -82,45 +82,6 @@ struct FieldShadowState
 }
 };
 
-class SwNoteProps final : public utl::ConfigItem
-{
-private:
-bool m_bIsShowAnchor;
-
-virtual void ImplCommit() override;
-
-public:
-SwNoteProps()
-: ConfigItem("Office.Writer/Notes")
-, m_bIsShowAnchor(false)
-{
-const css::uno::Sequence< OUString >& rNames = GetPropertyNames();
-css::uno::Sequence< css::uno::Any > aValues = 
GetProperties(rNames);
-const css::uno::Any* pValues = aValues.getConstArray();
-SAL_WARN_IF(aValues.getLength() != rNames.getLength(), "sw", 
"GetProperties failed");
-if (aValues.hasElements())
-pValues[0]>>=m_bIsShowAnchor;
-}
-
-bool IsShowAnchor() const
-{
-return m_bIsShowAnchor;
-}
-static css::uno::Sequence< OUString >& GetPropertyNames()
-{
-static css::uno::Sequence< OUString > aNames;
-if(!aNames.hasElements())
-{
-aNames.realloc(1);
-OUString* pNames = aNames.getArray();
-pNames[0] = "ShowAnkor";
-}
-return aNames;
-}
-
-virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames 
) override;
-};
-
 class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener
 {
 private:
@@ -140,7 +101,6 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 FieldShadowStatemShadowState;
 std::optional mpAnswer;
 OUStringmaAnswerText;
-boolmbIsShowAnchor;
 
 // data structure to collect the  instances for 
certain  instances.
 std::unique_ptr 
mpFrameSidebarWinContainer;
@@ -190,7 +150,6 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 bool ShowScrollbar(const tools::ULong aPage) const;
 bool HasNotes() const ;
 bool ShowNotes() const;
-bool IsShowAnchor() const { return mbIsShowAnchor;}
 void SetSidebarWidth(sal_uInt16 nPx);
 tools::ULong GetSidebarWidth(bool bPx = false) const;
 tools::ULong GetSidebarBorderWidth(bool bPx = false) const;
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index e3bc460d941c..5588b9cc2644 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -79,6 +79,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -953,7 +954,7 @@ void SwAnnotationWin::HideNote()
 Window::Hide();
 if (mpAnchor)
 {
-if (mrMgr.IsShowAnchor())
+if (officecfg::Office::Writer::Notes::ShowAnkor::get())
 mpAnchor->SetAnchorState(AnchorState::Tri);
 else
 mpAnchor->setVisible(false);
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index e50641a9176e..24abcc14a2a5 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -56,7 +56,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -77,6 +76,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -205,14 +205,10 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
 , mbLayouting(false)
 , mbReadOnly(mpView->GetDocShell()->IsReadOnly())
 , mbDeleteNote(true)
-, mbIsShowAnchor( false )
 {
 if(!mpView->GetDrawView() )
 mpView->GetWrtShell().MakeDrawView();
 
-SwNoteProps aProps;
-mbIsShowAnchor = aProps.IsShowAnchor();
-
 //make sure we get the colour yellow always, even if not the first one of 
comments or redlining
 SW_MOD()->GetRedlineAuthor();
 
@@ -2548,7 +2544,4 @@ void SwPostItMgr::UpdateResolvedStatus(const 
sw::annotation::SwAnnotationWin* to
 }
 }
 
-void SwNoteProps::ImplCommit() {}
-void SwNoteProps::Notify( const css::uno::Sequence< OUString >& ) {}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: sw/inc sw/source

2024-01-09 Thread Mike Kaganski (via logerrit)
 sw/inc/numrule.hxx|2 +-
 sw/source/core/attr/swatrset.cxx  |2 +-
 sw/source/core/doc/DocumentSettingManager.cxx |2 +-
 sw/source/core/doc/docfmt.cxx |2 +-
 sw/source/core/doc/docnum.cxx |8 
 sw/source/core/doc/number.cxx |6 +++---
 sw/source/core/docnode/node.cxx   |2 +-
 sw/source/core/docnode/nodes.cxx  |2 +-
 sw/source/filter/html/htmlgrin.cxx|2 +-
 sw/source/filter/html/htmlnumreader.cxx   |4 ++--
 10 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 8aeddf624dca4a34a4f2cf84c32cab0c99ef4db8
Author: Mike Kaganski 
AuthorDate: Wed Jan 10 11:13:05 2024 +0600
Commit: Mike Kaganski 
CommitDate: Wed Jan 10 08:27:04 2024 +0100

SwNumRule: SetInvalidRule(bool) -> Invalidate()

It should only be validated using Validate().
In SwHTMLParser::SetNodeNum, it was setting the "invalid" flag to false,
while the comment was telling the opposite. It was this way since commit
7b0b5cdfeed656b279bc32cd929630d5fc25878b (initial import, 2000-09-18).
It seems that the call could be safely removed (it looks wrong to set it
valid forcefully; but then, if it worked, why change it?); but first,
let's change it to what the comment says, and see if something fixes
magically.

In fact, it also seems wrong to invalidate it explicitly from outer code:
other setters should do it automatically; TODO/LATER.

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

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index af0655272936..aaa09236c8e4 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -232,7 +232,7 @@ public:
 void SetAutoRule( bool bFlag )  { mbAutoRuleFlag = bFlag; }
 
 bool IsInvalidRule() const  { return mbInvalidRuleFlag; }
-void SetInvalidRule(bool bFlag) { mbInvalidRuleFlag = bFlag; }
+void Invalidate() { mbInvalidRuleFlag = true; }
 
 bool IsContinusNum() const  { return mbContinusNum; }
 void SetContinusNum( bool bFlag )   { mbContinusNum = bFlag; }
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index fc4612757dcc..c0155317c76e 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -396,7 +396,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod 
) const
 {
 SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
 if( pDestRule )
-pDestRule->SetInvalidRule( true );
+pDestRule->Invalidate();
 else
 pDstDoc->MakeNumRule( rNm, pSrcDoc->FindNumRulePtr( 
rNm ) );
 }
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 355b704a3a05..81079008b023 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -300,7 +300,7 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, /*[in]*/ boo
 
 const SwNumRuleTable& rNmTable = m_rDoc.GetNumRuleTable();
 for( SwNumRuleTable::size_type n = 0; n < rNmTable.size(); ++n 
)
-rNmTable[n]->SetInvalidRule(true);
+rNmTable[n]->Invalidate();
 
 m_rDoc.UpdateNumRule();
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 21a4da06dc6b..26a9e2a5f69a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1229,7 +1229,7 @@ SwTextFormatColl* SwDoc::CopyTextColl( const 
SwTextFormatColl& rColl )
 {
 SwNumRule* pDestRule = FindNumRulePtr( rName );
 if( pDestRule )
-pDestRule->SetInvalidRule( true );
+pDestRule->Invalidate();
 else
 MakeNumRule( rName, pRule );
 }
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0735380e5dc2..1c7d1792abe5 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -156,7 +156,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
 }
 
 PropagateOutlineRule();
-mpOutlineRule->SetInvalidRule(true);
+mpOutlineRule->Invalidate();
 UpdateNumRule();
 
 // update if we have foot notes && numbering by chapter
@@ -825,7 +825,7 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& 
rRule )
 
 if ( bInvalidateNumRule )
 {
-pOld->SetInvalidRule(true);
+pOld->Invalidate();
 }
 
 return ;
@@ -852,7 +852,7 @@ static void lcl_ChgNumRule( 

core.git: sw/inc sw/source

2024-01-09 Thread Mike Kaganski (via logerrit)
 sw/inc/numrule.hxx|2 +-
 sw/source/core/doc/number.cxx |8 
 2 files changed, 1 insertion(+), 9 deletions(-)

New commits:
commit a924532c27d6b745ebf4d6959083fb02ad3493b0
Author: Mike Kaganski 
AuthorDate: Wed Jan 10 10:35:47 2024 +0600
Commit: Mike Kaganski 
CommitDate: Wed Jan 10 06:48:02 2024 +0100

Simplify a bit

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

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 20ac33bbfc60..af0655272936 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -232,7 +232,7 @@ public:
 void SetAutoRule( bool bFlag )  { mbAutoRuleFlag = bFlag; }
 
 bool IsInvalidRule() const  { return mbInvalidRuleFlag; }
-void SetInvalidRule( bool bFlag );
+void SetInvalidRule(bool bFlag) { mbInvalidRuleFlag = bFlag; }
 
 bool IsContinusNum() const  { return mbContinusNum; }
 void SetContinusNum( bool bFlag )   { mbContinusNum = bFlag; }
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 93265bca2fa2..8b7b22059467 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -1053,14 +1053,6 @@ SvxNumRule SwNumRule::MakeSvxNumRule() const
 return aRule;
 }
 
-void SwNumRule::SetInvalidRule(bool bFlag)
-{
-if (mbInvalidRuleFlag == bFlag)
-return;
-
-mbInvalidRuleFlag = bFlag;
-}
-
 /// change indent of all list levels by given difference
 void SwNumRule::ChangeIndent( const sal_Int32 nDiff )
 {


core.git: sw/inc sw/source

2024-01-09 Thread Armin Le Grand (allotropia) (via logerrit)
 sw/inc/textcontentcontrol.hxx |4 -
 sw/inc/textlinebreak.hxx  |2 
 sw/inc/txatbase.hxx   |   72 ++
 sw/inc/txtannotationfld.hxx   |2 
 sw/inc/txtatr.hxx |   19 +-
 sw/inc/txtflcnt.hxx   |4 +
 sw/inc/txtfld.hxx |4 -
 sw/inc/txtftn.hxx |4 +
 sw/inc/txtinet.hxx|5 +
 sw/inc/txtrfmrk.hxx   |6 +-
 sw/inc/txttxmrk.hxx   |6 +-
 sw/source/core/crsr/crstrvl.cxx   |   21 +--
 sw/source/core/text/itratr.cxx|2 
 sw/source/core/text/redlnitr.cxx  |2 
 sw/source/core/txtnode/atrfld.cxx |   12 ++--
 sw/source/core/txtnode/atrflyin.cxx   |7 +-
 sw/source/core/txtnode/atrftn.cxx |7 +-
 sw/source/core/txtnode/atrref.cxx |9 ++-
 sw/source/core/txtnode/atrtox.cxx |   11 ++-
 sw/source/core/txtnode/attrcontentcontrol.cxx |   23 
 sw/source/core/txtnode/attrlinebreak.cxx  |5 +
 sw/source/core/txtnode/ndtxt.cxx  |4 -
 sw/source/core/txtnode/thints.cxx |   65 +++
 sw/source/core/txtnode/txatbase.cxx   |   16 ++---
 sw/source/core/txtnode/txtatr2.cxx|   47 +++-
 sw/source/core/undo/rolbck.cxx|   10 +--
 26 files changed, 217 insertions(+), 152 deletions(-)

New commits:
commit 55e97eaabf6cce91f424e440af392143f11f3343
Author: Armin Le Grand (allotropia) 
AuthorDate: Mon Jan 8 18:58:11 2024 +0100
Commit: Armin Le Grand 
CommitDate: Tue Jan 9 10:49:42 2024 +0100

Decouple SwTextAttr from DirectPutItemInPool

SwTextAttr uses a 'const SfxPoolItem*' and the
mentioned DirectPutItemInPool/DirectRemoveItemFromPool
to force creation of a ref-counted SfxPoolItem to
work with. There is now tooling to do so, so changed
to using SfxPoolItemHolder. That works like a small
SfxItemSet - it transforms the Item to ref-count
form and takes over management. It is safe to
pass around, cheap to copy and it does not need manual
cleanup of SfxPoolItems (automatic -as in SfxItemPool).

Change-Id: I41401d5144c9cd59d5b10362ea17d63e35ab1eb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161799
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/sw/inc/textcontentcontrol.hxx b/sw/inc/textcontentcontrol.hxx
index b3926bd25ce9..89a69970efcc 100644
--- a/sw/inc/textcontentcontrol.hxx
+++ b/sw/inc/textcontentcontrol.hxx
@@ -28,12 +28,12 @@ class SW_DLLPUBLIC SwTextContentControl final : public 
SwTextAttrNesting
 {
 SwContentControlManager* m_pManager;
 
-SwTextContentControl(SwContentControlManager* pManager, 
SwFormatContentControl& rAttr,
+SwTextContentControl(SwContentControlManager* pManager, const 
SfxPoolItemHolder& rAttr,
  sal_Int32 nStart, sal_Int32 nEnd);
 
 public:
 static SwTextContentControl* CreateTextContentControl(SwDoc& rDoc, 
SwTextNode* pTargetTextNode,
-  
SwFormatContentControl& rAttr,
+  const 
SfxPoolItemHolder& rHolder,
   sal_Int32 nStart, 
sal_Int32 nEnd,
   bool bIsCopy);
 
diff --git a/sw/inc/textlinebreak.hxx b/sw/inc/textlinebreak.hxx
index 5b5e8c6854c3..57f6b3ecb60e 100644
--- a/sw/inc/textlinebreak.hxx
+++ b/sw/inc/textlinebreak.hxx
@@ -33,7 +33,7 @@ class SW_DLLPUBLIC SwTextLineBreak final : public SwTextAttr
 SwTextNode* m_pTextNode;
 
 public:
-SwTextLineBreak(SwFormatLineBreak& rAttr, sal_Int32 nStart);
+SwTextLineBreak(const SfxPoolItemHolder& rAttr, sal_Int32 nStart);
 
 ~SwTextLineBreak() override;
 
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 00e2f9b51470..2b3595709bf1 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -44,7 +44,8 @@ class SW_DLLPUBLIC SwTextAttr
 {
 friend class SwpHints;
 private:
-SfxPoolItem * const m_pAttr;
+// use SfxPoolItemHolder for safe reference to 'const SfxPoolItem*'
+SfxPoolItemHolder m_aAttr;
 sal_Int32 m_nStart;
 bool m_bDontExpand  : 1;
 bool m_bLockExpandFlag  : 1;
@@ -66,7 +67,7 @@ private:
 protected:
 SwpHints * m_pHints = nullptr;  // the SwpHints holds a pointer to this, 
and needs to be notified if the start/end changes
 
-SwTextAttr( SfxPoolItem& rAttr, sal_Int32 nStart );
+SwTextAttr(const SfxPoolItemHolder& rAttr, sal_Int32 nStart );
 virtual ~SwTextAttr() COVERITY_NOEXCEPT_FALSE;
 
 void SetLockExpandFlag( bool bFlag ){ m_bLockExpandFlag = bFlag; }
@@ -81,7 +82,7 @@ protected:
 public:
 

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);
 }
 

core.git: sw/inc sw/source

2023-12-29 Thread Noel Grandin (via logerrit)
 sw/inc/unocoll.hxx   |3 ++-
 sw/source/core/docnode/section.cxx   |2 +-
 sw/source/core/unocore/unocoll.cxx   |4 ++--
 sw/source/core/unocore/unocrsrhelper.cxx |5 +++--
 sw/source/core/unocore/unoredline.cxx|4 +++-
 sw/source/core/unocore/unotbl.cxx|8 +---
 6 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 02f8e04778596e4395c01271540298a044eee17a
Author: Noel Grandin 
AuthorDate: Fri Dec 29 18:07:26 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 29 19:36:57 2023 +0100

use more concrete UNO types in sw

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

diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index 48e1196f520e..751a4033f20e 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -39,6 +39,7 @@ class SwFormatFootnote;
 class SwSectionFormat;
 struct SvEventDescription;
 class SwXFootnote;
+class SwXTextSection;
 
 const SvEventDescription* sw_GetSupportedMacroItems();
 
@@ -393,7 +394,7 @@ public:
 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
-static css::uno::Reference< css::text::XTextSection> GetObject( 
SwSectionFormat& rFormat );
+static rtl::Reference GetObject( SwSectionFormat& rFormat 
);
 };
 
 class SwXBookmarks final : public SwCollectionBaseClass,
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index 12d9e281c2f0..000d4fc15527 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -973,7 +973,7 @@ bool SwSectionFormat::IsInContent() const
 uno::Reference< rdf::XMetadatable >
 SwSectionFormat::MakeUnoObject()
 {
-uno::Reference xMeta;
+rtl::Reference xMeta;
 SwSection *const pSection( GetSection() );
 if (pSection)
 {
diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 9f7677899c9e..a03d6e2535ed 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1375,7 +1375,7 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
 if( !rSectFormats[i]->IsInNodesArr())
 nIndex2++;
 else if (nIndex2 == i)
-return Any(GetObject(*rSectFormats[i]));
+return Any(css::uno::Reference< 
css::text::XTextSection>(GetObject(*rSectFormats[i])));
 }
 throw IndexOutOfBoundsException();
 }
@@ -1475,7 +1475,7 @@ sal_Bool SwXTextSections::hasElements()
 return nCount > 0;
 }
 
-uno::Reference< XTextSection >  SwXTextSections::GetObject( SwSectionFormat& 
rFormat )
+rtl::Reference< SwXTextSection >  SwXTextSections::GetObject( SwSectionFormat& 
rFormat )
 {
 return SwXTextSection::CreateXTextSection();
 }
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 70a724814cc6..ec4b772c675d 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -636,8 +637,8 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& 
rEntry
 {
 if( pAny )
 {
-uno::Reference< XTextSection >  xSect = 
SwXTextSections::GetObject( *pSect->GetFormat() );
-*pAny <<= xSect;
+rtl::Reference< SwXTextSection > xSect = 
SwXTextSections::GetObject( *pSect->GetFormat() );
+*pAny <<= uno::Reference< XTextSection >(xSect);
 }
 }
 else
diff --git a/sw/source/core/unocore/unoredline.cxx 
b/sw/source/core/unocore/unoredline.cxx
index fe16324e4238..2ac7eebf5695 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -411,7 +412,8 @@ uno::Any SwXRedline::getPropertyValue( const OUString& 
rPropertyName )
 {
 SwSectionNode* pSectNode = pNode->GetSectionNode();
 OSL_ENSURE(pSectNode, "No section node!");
-xRet = SwXTextSections::GetObject( 
*pSectNode->GetSection().GetFormat() );
+rtl::Reference< SwXTextSection > xSect = 
SwXTextSections::GetObject( *pSectNode->GetSection().GetFormat() );
+xRet = uno::Reference< text::XTextSection >(xSect);
 }
 break;
 case SwNodeType::Table :
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index c2f92df7f1cf..eb683b0b1c69 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 

core.git: sw/inc sw/source

2023-12-29 Thread Noel Grandin (via logerrit)
 sw/inc/unocoll.hxx |3 +
 sw/source/core/access/accpara.cxx  |2 -
 sw/source/core/inc/unoport.hxx |   51 -
 sw/source/core/unocore/unocoll.cxx |2 -
 sw/source/core/unocore/unoport.cxx |   20 ++--
 sw/source/core/unocore/unoportenum.cxx |   34 +-
 sw/source/core/unocore/unoredline.cxx  |2 -
 7 files changed, 56 insertions(+), 58 deletions(-)

New commits:
commit c921e11a4c2a282279aef9e9a72199478240f728
Author: Noel Grandin 
AuthorDate: Thu Dec 28 22:53:08 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 29 18:10:40 2023 +0100

use more concrete UNO types in sw

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

diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index 74009f9f2450..48e1196f520e 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -38,6 +38,7 @@ namespace com::sun::star::text
 class SwFormatFootnote;
 class SwSectionFormat;
 struct SvEventDescription;
+class SwXFootnote;
 
 const SvEventDescription* sw_GetSupportedMacroItems();
 
@@ -472,7 +473,7 @@ public:
 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
-static css::uno::Reference< css::text::XFootnote> GetObject( SwDoc& rDoc, 
const SwFormatFootnote& rFormat );
+static rtl::Reference GetObject( SwDoc& rDoc, const 
SwFormatFootnote& rFormat );
 };
 
 class SwXReferenceMarks final : public SwCollectionBaseClass,
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index f0bd0f0653d1..c1d04758269d 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -500,7 +500,7 @@ rtl::Reference 
SwAccessibleParagraph::CreateUnoPortion(
 *pUnoCursor->GetMark() = pFrame->MapViewToModelPos(nEnd);
 
 // create a (dummy) text portion to be returned
-uno::Reference aEmpty;
+uno::Reference aEmpty;
 return new SwXTextPortion ( pUnoCursor.get(), aEmpty, PORTION_TEXT);
 }
 
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index d64936a70353..d932622a1138 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -37,6 +37,13 @@
 #include 
 
 #include 
+#include "unorefmark.hxx"
+#include "unoidx.hxx"
+#include "unofootnote.hxx"
+#include "unometa.hxx"
+#include "unocontentcontrol.hxx"
+#include "unolinebreak.hxx"
+#include "unobookmark.hxx"
 
 namespace com::sun::star::beans { struct PropertyValue; }
 namespace com::sun::star::text { class XTextField; }
@@ -96,22 +103,16 @@ class SwXTextPortion : public cppu::WeakImplHelper
 private:
 
 const SfxItemPropertySet *  m_pPropSet;
-const css::uno::Reference< css::text::XText >
-m_xParentText;
-css::uno::Reference< css::text::XTextContent >
-m_xRefMark;
-css::uno::Reference< css::text::XTextContent >
-m_xTOXMark;
-css::uno::Reference< css::text::XTextContent >
-m_xBookmark;
-css::uno::Reference< css::text::XFootnote >
-m_xFootnote;
+const css::uno::Reference< SwXText > m_xParentText;
+rtl::Reference< SwXReferenceMark > m_xRefMark;
+rtl::Reference< SwXDocumentIndexMark > m_xTOXMark;
+rtl::Reference< SwXBookmark > m_xBookmark;
+rtl::Reference< SwXFootnote > m_xFootnote;
 css::uno::Reference< css::text::XTextField >
 m_xTextField;
-css::uno::Reference< css::text::XTextContent >
-m_xMeta;
-css::uno::Reference m_xLineBreak;
-css::uno::Reference m_xContentControl;
+rtl::Reference< SwXMeta > m_xMeta;
+rtl::Reference m_xLineBreak;
+rtl::Reference m_xContentControl;
 std::optional< css::uno::Any > m_oRubyText;
 std::optional< css::uno::Any > m_oRubyStyle;
 std::optional< css::uno::Any > m_oRubyAdjust;
@@ -157,13 +158,13 @@ protected:
 virtual void Notify(const SfxHint& rHint) override;
 
 public:
-SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< 
css::text::XText > xParent, SwTextPortionType   eType   );
-SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< 
css::text::XText > xParent, SwFrameFormat& rFormat );
+SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< 
SwXText > xParent, SwTextPortionType   eType   );
+SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< 
SwXText > xParent, SwFrameFormat& rFormat );
 
 // for Ruby
 SwXTextPortion(const SwUnoCursor* pPortionCursor,
 SwTextRuby const& rAttr,
-css::uno::Reference< css::text::XText > xParent,
+css::uno::Reference< SwXText > xParent,
 bool bIsEnd );
 
 //XTextRange
@@ -209,30 +210,30 @@ public:
 virtual css::uno::Reference< css::container::XEnumeration > 

core.git: sw/inc sw/source

2023-12-27 Thread Mike Kaganski (via logerrit)
 sw/inc/unotxdoc.hxx   |   69 ++
 sw/source/uibase/uno/unotxdoc.cxx |  248 +-
 2 files changed, 136 insertions(+), 181 deletions(-)

New commits:
commit 1d1d5522ed3eec4f19887feec6765f3058930e2a
Author: Mike Kaganski 
AuthorDate: Wed Dec 27 16:16:13 2023 +0600
Commit: Mike Kaganski 
CommitDate: Wed Dec 27 12:17:50 2023 +0100

Use rtl::Reference to avoid static_casts, and simplify

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

diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 32ae6c27e452..4fce95eda9ec 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -84,6 +84,27 @@ class SwPrintData;
 class SwRenderData;
 class SwViewShell;
 class SfxItemPropertySet;
+class SwXTextTables;
+class SwXTextFrames;
+class SwXTextGraphicObjects;
+class SwXTextEmbeddedObjects;
+class SwXTextFieldTypes;
+class SwXTextFieldMasters;
+class SwXTextSections;
+class SwXNumberingRulesCollection;
+class SwXFootnotes;
+class SwXContentControls;
+class SwXDocumentIndexes;
+class SwXStyleFamilies;
+class SwXAutoStyles;
+class SwXBookmarks;
+class SwXChapterNumbering;
+class SwXFootnoteProperties;
+class SwXEndnoteProperties;
+class SwXLineNumberingProperties;
+class SwXReferenceMarks;
+class SwXLinkTargetSupplier;
+class SwXRedlines;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -153,29 +174,29 @@ private:
 rtl::Reference m_xBodyText;
 css::uno::Reference< css::uno::XAggregation >   
m_xNumFormatAgg;
 
-css::uno::Reference< css::container::XIndexAccess > 
mxXNumberingRules;
-css::uno::Reference< css::container::XIndexAccess > mxXFootnotes;
-css::uno::Reference< css::beans::XPropertySet > 
mxXFootnoteSettings;
-css::uno::Reference< css::container::XIndexAccess > mxXEndnotes;
-css::uno::Reference< css::beans::XPropertySet > 
mxXEndnoteSettings;
-css::uno::Reference< css::container::XIndexAccess > 
mxXContentControls;
-css::uno::Reference< css::container::XNameAccess >  
mxXReferenceMarks;
-css::uno::Reference< css::container::XEnumerationAccess >   
mxXTextFieldTypes;
-css::uno::Reference< css::container::XNameAccess >  
mxXTextFieldMasters;
-css::uno::Reference< css::container::XNameAccess >  
mxXTextSections;
-css::uno::Reference< css::container::XNameAccess >  mxXBookmarks;
-css::uno::Reference< css::container::XNameAccess >  mxXTextTables;
-css::uno::Reference< css::container::XNameAccess >  mxXTextFrames;
-css::uno::Reference< css::container::XNameAccess >  
mxXGraphicObjects;
-css::uno::Reference< css::container::XNameAccess >  
mxXEmbeddedObjects;
-css::uno::Reference< css::container::XNameAccess >  
mxXStyleFamilies;
-mutable css::uno::Reference< css::style::XAutoStyles >  mxXAutoStyles;
-css::uno::Reference< css::container::XIndexReplace >
mxXChapterNumbering;
-css::uno::Reference< css::container::XIndexAccess > 
mxXDocumentIndexes;
-
-css::uno::Reference< css::beans::XPropertySet > 
mxXLineNumberingProperties;
-css::uno::Reference< css::container::XNameAccess >  
mxLinkTargetSupplier;
-css::uno::Reference< css::container::XEnumerationAccess >   mxXRedlines;
+rtl::Reference 
mxXNumberingRules;
+rtl::ReferencemxXFootnotes;
+rtl::Reference   
mxXFootnoteSettings;
+rtl::ReferencemxXEndnotes;
+rtl::Reference
mxXEndnoteSettings;
+rtl::Reference  
mxXContentControls;
+rtl::Reference   
mxXReferenceMarks;
+rtl::Reference   
mxXTextFieldTypes;
+rtl::Reference 
mxXTextFieldMasters;
+rtl::Reference 
mxXTextSections;
+rtl::ReferencemxXBookmarks;
+rtl::Reference   mxXTextTables;
+rtl::Reference   mxXTextFrames;
+rtl::Reference   
mxXGraphicObjects;
+rtl::Reference  
mxXEmbeddedObjects;
+rtl::Reference
mxXStyleFamilies;
+mutable rtl::Reference   mxXAutoStyles;
+rtl::Reference 
mxXChapterNumbering;
+rtl::Reference  
mxXDocumentIndexes;
+
+rtl::Reference  
mxXLineNumberingProperties;
+rtl::Reference   

core.git: sw/inc sw/source

2023-12-27 Thread Mike Kaganski (via logerrit)
 sw/inc/unocoll.hxx   |   10 -
 sw/inc/unotxdoc.hxx  |3 
 sw/source/core/unocore/unocoll.cxx   |  234 +--
 sw/source/core/unocore/unocontentcontrol.cxx |   21 --
 sw/source/core/unocore/unofield.cxx  |   28 +--
 sw/source/core/unocore/unoidx.cxx|   31 +--
 sw/source/core/unocore/unoredlines.cxx   |   19 --
 sw/source/core/unocore/unosett.cxx   |2 
 sw/source/uibase/uno/unotxdoc.cxx|  214 
 9 files changed, 231 insertions(+), 331 deletions(-)

New commits:
commit 4df22b4d3d4ae1ec0c4d32f614bd2cd8ec13143e
Author: Mike Kaganski 
AuthorDate: Wed Dec 27 12:45:20 2023 +0600
Commit: Mike Kaganski 
CommitDate: Wed Dec 27 10:31:44 2023 +0100

tdf#158862: check if document is initialized

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

diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index 90f634ab9cbc..74009f9f2450 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -44,19 +44,19 @@ const SvEventDescription* sw_GetSupportedMacroItems();
 class SwUnoCollection
 {
 SwDoc*  m_pDoc;
-boolm_bObjectValid;
 
 public:
 SwUnoCollection(SwDoc* p) :
-m_pDoc(p),
-m_bObjectValid(true){}
+m_pDoc(p){}
 
 virtual ~SwUnoCollection() {}
 
 virtual voidInvalidate();
-boolIsValid() const {return m_bObjectValid;}
 
-SwDoc*  GetDoc() const {return m_pDoc;}
+protected:
+bool IsValid() const { return m_pDoc; }
+
+SwDoc& GetDoc() const;
 };
 
 /** entries in this enum are mapped in an array in unocoll.cxx */
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 01619df1d382..32ae6c27e452 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -210,6 +210,9 @@ private:
 virtual SdrModel& getSdrModelFromUnoModel() const override;
 
 virtual ~SwXTextDocument() override;
+
+SwDoc& GetDocOrThrow() const;
+
 public:
 SwXTextDocument(SwDocShell* pShell);
 
diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 1b2c4f3c07d0..d0f33324214b 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::document;
@@ -857,21 +858,19 @@ sal_Int32 SwXTextTables::getCount()
 SolarMutexGuard aGuard;
 sal_Int32 nRet = 0;
 if(IsValid())
-nRet = 
static_cast(GetDoc()->GetTableFrameFormatCount(true));
+nRet = static_cast(GetDoc().GetTableFrameFormatCount(true));
 return nRet;
 }
 
 uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex)
 {
 SolarMutexGuard aGuard;
-if (!IsValid())
-throw uno::RuntimeException();
 
 if (nInputIndex < 0)
 throw IndexOutOfBoundsException();
 
 size_t nIndex = static_cast(nInputIndex);
-for(SwTableFormat* pFormat: *GetDoc()->GetTableFrameFormats())
+for(SwTableFormat* pFormat: *GetDoc().GetTableFrameFormats())
 {
 if(!pFormat->IsUsed())
 continue;
@@ -892,14 +891,12 @@ uno::Any SwXTextTables::getByName(const OUString& 
rItemName)
 {
 SolarMutexGuard aGuard;
 uno::Any aRet;
-if(!IsValid())
-throw uno::RuntimeException();
 
-const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
+const size_t nCount = GetDoc().GetTableFrameFormatCount(true);
 uno::Reference< XTextTable >  xTable;
 for( size_t i = 0; i < nCount; ++i)
 {
-SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
+SwFrameFormat& rFormat = GetDoc().GetTableFrameFormat(i, true);
 if (rItemName == rFormat.GetName())
 {
 xTable = SwXTextTables::GetObject(rFormat);
@@ -916,16 +913,14 @@ uno::Any SwXTextTables::getByName(const OUString& 
rItemName)
 uno::Sequence< OUString > SwXTextTables::getElementNames()
 {
 SolarMutexGuard aGuard;
-if(!IsValid())
-throw uno::RuntimeException();
-const size_t nCount = GetDoc()->GetTableFrameFormatCount(true);
+const size_t nCount = GetDoc().GetTableFrameFormatCount(true);
 uno::Sequence aSeq(static_cast(nCount));
 if(nCount)
 {
 OUString* pArray = aSeq.getArray();
 for( size_t i = 0; i < nCount; ++i)
 {
-SwFrameFormat& rFormat = GetDoc()->GetTableFrameFormat(i, true);
+SwFrameFormat& rFormat = GetDoc().GetTableFrameFormat(i, true);
 
 pArray[i] = rFormat.GetName();
 }
@@ -937,13 +932,11 @@ sal_Bool SwXTextTables::hasByName(const OUString& rName)
 {
 SolarMutexGuard aGuard;
 bool bRet= false;
-if(!IsValid())
-throw uno::RuntimeException();
 
-const 

core.git: sw/inc

2023-12-18 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtfld.hxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 83cbadeaf6b784fa9ae2ca47d1a10bc942adfe79
Author: Miklos Vajna 
AuthorDate: Mon Dec 18 20:22:48 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 19 08:09:21 2023 +0100

sw: document SwFormatFieldHint

Describe the typical producer and typical consumer.

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

diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 0c8d5fda7110..ab1953f00114 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -180,6 +180,11 @@ enum class SwFormatFieldHintWhich
 RESOLVED   = 5
 };
 
+/// This SfxHint subclass is produced by code that changes the doc model (e.g. 
SwNodes::ChgNode()),
+/// the typical which id is SwFormatFieldHintWhich::INSERTED or 
SwFormatFieldHintWhich::REMOVED.
+///
+/// The consumer of this hint is SwPostItMgr::Notify(), i.e. the sidebar on 
the right hand side of
+/// the Writer edit window that hosts the comments as post-its.
 class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint
 {
 const SwFormatField*   m_pField;


core.git: sw/inc sw/source

2023-12-14 Thread Miklos Vajna (via logerrit)
 sw/inc/fmtruby.hxx  |1 +
 sw/source/core/txtnode/fmtatr2.cxx  |   13 +
 sw/source/core/txtnode/txatbase.cxx |5 -
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 437062f29360146995ae37ccde79f449d09102c8
Author: Miklos Vajna 
AuthorDate: Thu Dec 14 20:16:04 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 15 08:24:12 2023 +0100

sw doc model xml dump: add initial ruby support

Fixes this warning when some text portion has ruby on it:

warn:sw.core:19310:19310:sw/source/core/txtnode/txatbase.cxx:180: Unhandled 
TXTATR

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

diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx
index e0e756b1db7a..6741102ed489 100644
--- a/sw/inc/fmtruby.hxx
+++ b/sw/inc/fmtruby.hxx
@@ -74,6 +74,7 @@ public:
 
 css::text::RubyAdjust GetAdjustment() const   { return m_eAdjustment; }
 void SetAdjustment( css::text::RubyAdjust nNew )  { m_eAdjustment = nNew; }
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 #endif
diff --git a/sw/source/core/txtnode/fmtatr2.cxx 
b/sw/source/core/txtnode/fmtatr2.cxx
index 3e888b660f6a..d9fe78377de3 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -426,6 +426,19 @@ SwFormatRuby::~SwFormatRuby()
 {
 }
 
+void SwFormatRuby::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatRuby"));
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pTextAttr"), 
"%p", m_pTextAttr);
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("ruby-text"),
+  BAD_CAST(m_sRubyText.toUtf8().getStr()));
+SfxPoolItem::dumpAsXml(pWriter);
+
+
+(void)xmlTextWriterEndElement(pWriter);
+}
+
 SwFormatRuby& SwFormatRuby::operator=( const SwFormatRuby& rAttr )
 {
 // SwFormatRuby is not shareable, so ptr compare is OK
diff --git a/sw/source/core/txtnode/txatbase.cxx 
b/sw/source/core/txtnode/txatbase.cxx
index 1d57f0e0dda5..8e48806901a2 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -176,8 +176,11 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
 case RES_TXTATR_INETFMT:
 GetINetFormat().dumpAsXml(pWriter);
 break;
+case RES_TXTATR_CJK_RUBY:
+GetRuby().dumpAsXml(pWriter);
+break;
 default:
-SAL_WARN("sw.core", "Unhandled TXTATR");
+SAL_WARN("sw.core", "Unhandled TXTATR: " << Which());
 break;
 }
 


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

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

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

sw: document SwFormatRefMark

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

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

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


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

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

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

sw: fix issue with copying stashed frame format

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

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

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

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

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

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

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

sw: document SwFormatRuby

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

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

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


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

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

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

Convert SwHashTable to std::unordered_map

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

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

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

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

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

tdf#158336: Only Change current table

For that, use the same logic as TryBoxNmToPtr

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

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

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


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

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

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

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

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

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

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

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

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

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index f49117e58f86..bd5d831f7f2f 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -140,6 +140,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/attr/fmtwrapinfluenceonobjpos \
 sw/source/core/attr/format \
 sw/source/core/attr/formatflysplit \
+sw/source/core/attr/formatwraptextatflystart \
 sw/source/core/attr/hints \
 sw/source/core/attr/swatrset \
 sw/source/core/bastyp/SwSmartTagMgr \
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index f420afcf512e..8ded8c6f61f3 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -240,6 +240,7 @@ public:
 inline const SwFormatLayoutSplit ( bool = true ) const;
 inline const SwFormatRowSplit  ( bool = true ) const;
 inline const SwFormatFlySplit  ( bool = true ) const;
+inline const SwFormatWrapTextAtFlyStart ( bool = 
true ) const;
 inline const SwFormatChain   ( bool = true ) const;
 inline const SwFormatFootnoteAtTextEnd ( bool = 
true ) const;
 inline const SwFormatEndAtTextEnd ( bool = true ) 
const;
diff --git a/sw/inc/formatwraptextatflystart.hxx 
b/sw/inc/formatwraptextatflystart.hxx
new file mode 100644
index ..02305247df7c
--- /dev/null
+++ b/sw/inc/formatwraptextatflystart.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include 
+
+#include "swdllapi.h"
+#include "hintids.hxx"
+#include "format.hxx"
+
+/// Determines if text wraps around a split fly on all pages (i.e. wrap text 
at fly start) or only
+/// on the last page.
+class SW_DLLPUBLIC SwFormatWrapTextAtFlyStart final : public SfxBoolItem
+{
+public:
+SwFormatWrapTextAtFlyStart(bool bAtStart = false);
+
+SwFormatWrapTextAtFlyStart* Clone(SfxItemPool* pPool = nullptr) const 
override;
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline const SwFormatWrapTextAtFlyStart& SwAttrSet::GetWrapTextAtFlyStart(bool 
bInP) const
+{
+return Get(RES_WRAP_TEXT_AT_FLY_START, bInP);
+}
+
+inline const SwFormatWrapTextAtFlyStart& SwFormat::GetWrapTextAtFlyStart(bool 
bInP) const
+{
+return m_aSet.GetWrapTextAtFlyStart(bInP);
+}
+
+/* 

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

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

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

sw: document SwFormatFrameSize

Where this can appear, size type, percent relations.

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

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


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

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

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

tdf#117651 Add AutoCorrect support for italic and strikethrough

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

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

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

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

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

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

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

for Writer - AutoCaption Page.

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

diff --git a/sw/inc/SwCapConfigProp.hxx b/sw/inc/SwCapConfigProp.hxx
new file mode 100644
index ..20257f3d9716
--- /dev/null
+++ b/sw/inc/SwCapConfigProp.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX
+#define INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX
+
+enum CapConfigProp
+{
+PROP_CAP_OBJECT_ENABLE = 0, //0
+PROP_CAP_OBJECT_CATEGORY, //1
+PROP_CAP_OBJECT_NUMBERING, //2
+PROP_CAP_OBJECT_NUMBERINGSEPARATOR, //3
+PROP_CAP_OBJECT_CAPTIONTEXT, //4
+PROP_CAP_OBJECT_DELIMITER, //5
+PROP_CAP_OBJECT_LEVEL, //6
+PROP_CAP_OBJECT_POSITION, //7
+PROP_CAP_OBJECT_CHARACTERSTYLE, //8
+PROP_CAP_OBJECT_APPLYATTRIBUTES, //9
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 675a2d48e8d6..3adf4dce4e34 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -55,6 +55,436 @@
 
 using namespace ::com::sun::star;
 
+static bool lcl_isPropertyReadOnly(const SwCapObjType eType, const 
CapConfigProp ePropType, const SvGlobalName& rOleId)
+{
+bool bReadOnly = false;
+
+switch (ePropType)
+{
+case PROP_CAP_OBJECT_ENABLE:
+{
+switch (eType)
+{
+case TABLE_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Table::Enable::isReadOnly();
+break;
+case FRAME_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Frame::Enable::isReadOnly();
+break;
+case GRAPHIC_CAP:
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::WriterObject::Graphic::Enable::isReadOnly();
+break;
+case OLE_CAP:
+{
+if (rOleId == SvGlobalName(SO3_SC_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Calc::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SIMPRESS_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Impress::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SCH_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Chart::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SM_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Formula::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_SDRAW_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::Draw::Enable::isReadOnly();
+} else if (rOleId == SvGlobalName(SO3_OUT_CLASSID)) {
+bReadOnly = 
officecfg::Office::Writer::Insert::Caption::OfficeObject::OLEMisc::Enable::isReadOnly();
+} else {
+// Should not reach it.
+}
+}
+break;
+default:
+break;
+

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

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

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

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

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

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

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

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

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

we can have just one LoadURL for writer

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

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


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

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

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

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

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

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


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

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

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

loplugin:fieldcast in SwDocShell

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

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


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

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

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

loplugin:fieldcast in SwSelPaintRects

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

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


  1   2   3   4   5   6   7   8   9   10   >