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

2023-12-04 Thread Caolán McNamara (via logerrit)
 sw/source/ui/vba/vbaformfields.cxx |2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 3bf1c0d23afccaa84c3d4ecd701c20e60f9e2994
Author: Caolán McNamara 
AuthorDate: Sun Dec 3 19:44:47 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 10:47:26 2023 +0100

cid#1546495 COPY_INSTEAD_OF_MOVE

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

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4bc611992c88..76ab50135427 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3718,8 +3718,7 @@ RTFError RTFDocumentImpl::handleEmbeddedObject()
 
 uno::Reference xInputStream(
 new utl::OSeekableInputStreamWrapper(pStream.release(), 
/*_bOwner=*/true));
-auto pStreamValue = new RTFValue(xInputStream);
-m_aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue);
+m_aOLEAttributes.set(NS_ooxml::LN_inputstream, new RTFValue(xInputStream));
 
 return RTFError::OK;
 }
commit 8c0ed1d92c128fa73b0441581a958bab317f6fa7
Author: Caolán McNamara 
AuthorDate: Sun Dec 3 19:43:33 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 10:47:14 2023 +0100

cid#1546497 COPY_INSTEAD_OF_MOVE

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

diff --git a/sw/source/ui/vba/vbaformfields.cxx 
b/sw/source/ui/vba/vbaformfields.cxx
index 586393e35818..9c8af450d345 100644
--- a/sw/source/ui/vba/vbaformfields.cxx
+++ b/sw/source/ui/vba/vbaformfields.cxx
@@ -81,7 +81,7 @@ class FormFieldsEnumWrapper : public EnumerationHelper_BASE
 sal_Int32 mnIndex;
 
 public:
-explicit FormFieldsEnumWrapper(uno::Reference 
xIndexAccess)
+explicit FormFieldsEnumWrapper(const 
uno::Reference& xIndexAccess)
 : mxIndexAccess(xIndexAccess)
 , mnIndex(0)
 {


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

2023-12-01 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/column.cxx   |2 +-
 sw/uiconfig/swriter/ui/columnpage.ui |2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit dfe551c816fcaf6f3d3ad9da6da5472900cf17d0
Author: Caolán McNamara 
AuthorDate: Fri Dec 1 17:11:09 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 21:57:50 2023 +0100

Related: tdf#158450 use SfxTabPage::GetFrameWeld

to get the parent window.

SfxTabPage::GetDialogController

returns mpImpl->mpSfxDialogController

and that is set in SfxTabPage::SfxTabPage ctor with

mpImpl->mpSfxDialogController = 
dynamic_cast(m_pDialogController);

and GetDialogController returns that mpImpl->mpSfxDialogController

while nearly everything is derived from OKDialogController, not
everything, like this column dialog case is, so
mpImpl->mpSfxDialogController is null and it all fails.

This same page is inside format, page styles as "columns" but that's the
usual multi-page dialog derived from SfxOkDialogController, its just
this single page dialog that is different.

The original idea was to wait until this parent dialog is needed to
figure out what to use. We have this SfxTabPage::SetDialogController so
the dialog controller and page can theoretically change after the ctor,
though maybe that doesn't happen in this case.

Looking at SfxTabPage::GetFrameWeld that one always returns the current
parent (of m_pDialogController, not the dynamically casted
mpImpl->mpSfxDialogController) so in the best choice to use in general.

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

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 380bbb768f16..8caa69fade8c 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -393,7 +393,7 @@ SwColumnPage::SwColumnPage(weld::Container* pPage, 
weld::DialogController* pCont
 , m_xTextDirectionFT(m_xBuilder->weld_label("textdirectionft"))
 , m_xTextDirectionLB(new 
svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirectionlb")))
 , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"),
-[pController]{ return pController->getDialog(); }))
+[this]{ return GetFrameWeld(); }))
 , m_xLineTypeDLB(new 
SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
 , m_xEd1(new 
SwPercentField(m_xBuilder->weld_metric_spin_button("width1mf", FieldUnit::CM)))
 , m_xEd2(new 
SwPercentField(m_xBuilder->weld_metric_spin_button("width2mf", FieldUnit::CM)))
commit 35c536023aad834a6fdd7e87b2af7ef20dc651b9
Author: Caolán McNamara 
AuthorDate: Fri Dec 1 14:04:08 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 21:57:40 2023 +0100

we need these label placeholders for gtk

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

diff --git a/sw/uiconfig/swriter/ui/columnpage.ui 
b/sw/uiconfig/swriter/ui/columnpage.ui
index 201b01928216..c72bb1e919cf 100644
--- a/sw/uiconfig/swriter/ui/columnpage.ui
+++ b/sw/uiconfig/swriter/ui/columnpage.ui
@@ -495,6 +495,7 @@
 False
 0
 True
+
 
   
 
@@ -568,6 +569,7 @@
 False
 0
 True
+
 
   
 


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

2023-11-14 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx  |   24 
 sw/source/uibase/inc/optpage.hxx |8 +
 sw/uiconfig/swriter/ui/optcomparison.ui  |  120 
 sw/uiconfig/swriter/ui/optredlinepage.ui |  152 ++-
 4 files changed, 220 insertions(+), 84 deletions(-)

New commits:
commit 1264cff53a3d4510f0e82706aeeaf1c63b4f04a6
Author: Balazs Varga 
AuthorDate: Tue Nov 14 13:38:14 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 14 19:47:13 2023 +0100

resave with newer glade version

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

diff --git a/sw/uiconfig/swriter/ui/optcomparison.ui 
b/sw/uiconfig/swriter/ui/optcomparison.ui
index 62d228c252e3..8010cbc0a9a2 100644
--- a/sw/uiconfig/swriter/ui/optcomparison.ui
+++ b/sw/uiconfig/swriter/ui/optcomparison.ui
@@ -1,77 +1,77 @@
 
-
+
 
   
   
 1
 99
 1
-1
-10
+1
+10
   
   
 True
-False
-6
+False
+6
 vertical
 12
 
   
 True
-False
-0
-none
+False
+0
+none
 
-  
+  
   
 True
-False
-6
+False
 12
 6
+6
 
   
 A_uto
 True
-True
-False
-True
+True
+False
+True
 True
-True
+True
   
   
-0
-0
+0
+0
   
 
 
   
 By w_ord
 True
-True
-False
-True
-True
+True
+False
+True
+True
 auto
   
   
-0
-1
+0
+1
   
 
 
   
 By _character
 True
-True
-False
-True
-True
+True
+False
+True
+True
 auto
   
   
-0
-2
+0
+2
   
 
   
@@ -79,7 +79,7 @@
 
   
 True
-False
+False
 Compare Documents
 
   
@@ -96,71 +96,71 @@
 
   
 True
-False
-0
-none
+False
+0
+none
 
-  
+  
   
 True
-False
-6
-12
+False
 12
 6
+6
+12
 
   
 Ignore _pieces of length:
 True
-True
-False
-True
-True
+True
+False
+True
+True
   
   
-0
-1
+0
+1
   
 
 
   
 Take it into account when comparing
 True
-True
-False
-True
-True
+True
+False
+True
+True
   
   
-0
-0
+0
+0
   
 
 
   
 True
-True
-True
+True
+True
 True
 adjustment1
   
   
-1
-1
+1
+1
   
 
 
   
 Store it when changing the document
 True
-True
-False
-True
-True
+True
+False
+True
+True
   
   
-0
-2
+0
+2
   
 
 
@@ -174,7 +174,7 @@
 
   
 True
-False
+False
 Random number to improve accuracy of document 
comparison
 
   
commit 23228e6fc60a10c41595302c9bf4ed9d753660da
Author: Balazs 

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

2023-11-14 Thread Balazs Varga (via logerrit)
 sw/source/ui/config/optpage.cxx  |   59 +
 sw/source/uibase/inc/optpage.hxx |   12 +
 sw/uiconfig/swriter/ui/optredlinepage.ui |  310 +++
 sw/uiconfig/swriter/ui/opttablepage.ui   |  229 --
 4 files changed, 421 insertions(+), 189 deletions(-)

New commits:
commit 164596c00b4361b5b378609f026a1b11ac653970
Author: Balazs Varga 
AuthorDate: Tue Nov 14 12:13:21 2023 +0100
Commit: Balazs Varga 
CommitDate: Tue Nov 14 19:46:41 2023 +0100

resave with newer glade version

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

diff --git a/sw/uiconfig/swriter/ui/optredlinepage.ui 
b/sw/uiconfig/swriter/ui/optredlinepage.ui
index f01c85075a5f..255bf2d6e851 100644
--- a/sw/uiconfig/swriter/ui/optredlinepage.ui
+++ b/sw/uiconfig/swriter/ui/optredlinepage.ui
@@ -1,64 +1,64 @@
 
-
+
 
   
-  
+  
   
 True
-False
+False
 True
 True
-6
-12
+6
+12
 
   
 True
-False
+False
 True
-0
-none
+0
+none
 
-  
+  
   
 True
-False
-True
-6
-12
+False
 12
 6
+True
+6
+12
 
   
 True
-False
+False
 _Attributes:
-True
-insert
+True
+insert
 0
   
   
-0
-0
+0
+0
   
 
 
   
 True
-False
+False
 Co_lor:
-True
-insertcolor
+True
+insertcolor
 0
   
   
-0
-1
+0
+1
   
 
 
   
 True
-False
+False
 center
 
   [None]
@@ -80,19 +80,18 @@
 
   
   
-1
-0
+1
+0
   
 
 
   
-
 True
-False
-False
+False
+False
 True
 0
-True
+True
 
   
 
@@ -104,26 +103,26 @@
 
   
   
-1
-1
+1
+1
   
 
 
   
 True
-False
+False
 True
-never
-never
-in
+never
+never
+in
 
   
 True
-False
+False
 
   
 True
-False
+False
 True
   
 
@@ -131,8 +130,8 @@
 
   
   
-2
-0
+2
+0
 2
   
 
@@ -141,7 +140,7 @@
 
   
 True
-False
+False
 Insertions
 0
 
@@ -151,59 +150,59 @@
 
   
   
-0
-0
+0
+0
   
 
 
   
 True
-False
+False
 True
-0
-none
+0
+none
 
-  
+  
   
 True
-False
-True
-6
-12
+False
 12
 6
+True
+6
+12
 
   
 True
-False
+False
 Attri_butes:
-True
-deleted
+True
+deleted
 0
   
   
-0
-0
+0
+0
   
 
 
   
 True
-False
+False
 Col_or:
-True
-deletedcolor
+True
+   

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

2023-11-13 Thread Caolán McNamara (via logerrit)
 sw/source/ui/misc/translatelangselect.cxx |1 -
 sw/source/uibase/uiview/viewport.cxx  |5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9fc42afd17e9115b488401f64804479e7a76a300
Author: Caolán McNamara 
AuthorDate: Sun Nov 12 19:49:40 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 13 11:04:07 2023 +0100

ofz#64106 Null-dereference READ

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

diff --git a/sw/source/uibase/uiview/viewport.cxx 
b/sw/source/uibase/uiview/viewport.cxx
index b66bbadab3bf..08d9b0c39338 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -315,8 +315,9 @@ void SwView::SetVisArea( const Point , bool 
bUpdateScrollbar )
 
 void SwView::CheckVisArea()
 {
-m_pHScrollbar->SetAuto( m_pWrtShell->GetViewOptions()->getBrowseMode() &&
-!GetViewFrame().GetFrame().IsInPlace() );
+if (m_pHScrollbar)
+m_pHScrollbar->SetAuto( m_pWrtShell->GetViewOptions()->getBrowseMode() 
&&
+!GetViewFrame().GetFrame().IsInPlace() );
 if ( IsDocumentBorder() )
 {
 if ( m_aVisArea.Left() != DOCUMENTBORDER ||
commit 333070dd1ca45e1966f312ba78dbc5985ab814d7
Author: Caolán McNamara 
AuthorDate: Sun Nov 12 20:59:21 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 13 11:03:56 2023 +0100

don't need this in the end

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

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


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

2023-11-08 Thread Noel Grandin (via logerrit)
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |6 ++--
 sw/source/filter/xml/XMLRedlineImportHelper.hxx |5 ++--
 sw/source/filter/xml/xmltbli.cxx|   30 +++-
 sw/source/filter/xml/xmltbli.hxx|4 +--
 sw/source/filter/xml/xmltexti.cxx   |2 -
 sw/source/filter/xml/xmltexti.hxx   |2 -
 6 files changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 0b8fd4aa900ac1e6102f4b2581cabbb1b81a7b13
Author: Noel Grandin 
AuthorDate: Tue Nov 7 15:37:19 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 17:12:57 2023 +0100

loplugin:fieldcast in SwXMLTableContext

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

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 72b99fb0f7ec..b2d312cad2e5 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -92,7 +92,7 @@ class SwXMLTableCell_Impl
 OUString m_sFormula;  // cell formula; valid if length > 0
 double m_dValue;  // formula value
 
-SvXMLImportContextRef   m_xSubTable;
+rtl::Reference m_xSubTable;
 
 const SwStartNode *m_pStartNode;
 sal_uInt32 m_nRowSpan;
@@ -193,7 +193,7 @@ inline void SwXMLTableCell_Impl::SetStartNode( const 
SwStartNode *pSttNd )
 
 inline SwXMLTableContext *SwXMLTableCell_Impl::GetSubTable() const
 {
-return static_cast(m_xSubTable.get());
+return m_xSubTable.get();
 }
 
 inline void SwXMLTableCell_Impl::Dispose()
@@ -302,7 +302,7 @@ class SwXMLTableCellContext_Impl : public SvXMLImportContext
 OUString m_sSaveParaDefault;
 OUString m_StringValue;
 
-SvXMLImportContextRef   m_xMyTable;
+rtl::Reference m_xMyTable;
 
 double m_fValue;
 bool m_bHasValue;
@@ -317,7 +317,7 @@ class SwXMLTableCellContext_Impl : public SvXMLImportContext
 boolm_bHasTextContent : 1;
 boolm_bHasTableContent : 1;
 
-SwXMLTableContext *GetTable() { return static_cast(m_xMyTable.get()); }
+SwXMLTableContext *GetTable() { return m_xMyTable.get(); }
 
 bool HasContent() const { return m_bHasTextContent || m_bHasTableContent; }
 inline void InsertContent_();
@@ -636,9 +636,9 @@ namespace {
 
 class SwXMLTableColContext_Impl : public SvXMLImportContext
 {
-SvXMLImportContextRef   m_xMyTable;
+rtl::Reference m_xMyTable;
 
-SwXMLTableContext *GetTable() { return static_cast(m_xMyTable.get()); }
+SwXMLTableContext *GetTable() { return m_xMyTable.get(); }
 
 public:
 
@@ -720,9 +720,9 @@ namespace {
 
 class SwXMLTableColsContext_Impl : public SvXMLImportContext
 {
-SvXMLImportContextRef   m_xMyTable;
+rtl::Reference   m_xMyTable;
 
-SwXMLTableContext *GetTable() { return static_cast(m_xMyTable.get()); }
+SwXMLTableContext *GetTable() { return m_xMyTable.get(); }
 
 public:
 
@@ -764,11 +764,11 @@ namespace {
 
 class SwXMLTableRowContext_Impl : public SvXMLImportContext
 {
-SvXMLImportContextRef   m_xMyTable;
+rtl::Reference m_xMyTable;
 
 sal_uInt32  m_nRowRepeat;
 
-SwXMLTableContext *GetTable() { return static_cast(m_xMyTable.get()); }
+SwXMLTableContext *GetTable() { return m_xMyTable.get(); }
 
 public:
 
@@ -875,11 +875,11 @@ namespace {
 
 class SwXMLTableRowsContext_Impl : public SvXMLImportContext
 {
-SvXMLImportContextRef   m_xMyTable;
+rtl::Reference m_xMyTable;
 
 bool m_bHeader;
 
-SwXMLTableContext *GetTable() { return static_cast(m_xMyTable.get()); }
+SwXMLTableContext *GetTable() { return m_xMyTable.get(); }
 
 public:
 
@@ -1679,8 +1679,7 @@ SwTableBox *SwXMLTableContext::NewTableBox( const 
SwStartNode *pStNd,
 // The topmost table is the only table that maintains the two members
 // pBox1 and bFirstSection.
 if( m_xParentTable.is() )
-return static_cast(m_xParentTable.get())->NewTableBox( pStNd,
-  pUpper );
+return m_xParentTable->NewTableBox( pStNd, pUpper );
 
 SwTableBox *pBox;
 
@@ -2684,8 +2683,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
 // The topmost table is the only table that maintains the two members
 // pBox1 and bFirstSection.
 if( m_xParentTable.is() )
-return static_cast(m_xParentTable.get())
-->InsertTableSection(pPrevSttNd, pStringValueStyleName);
+return m_xParentTable->InsertTableSection(pPrevSttNd, 
pStringValueStyleName);
 
 const SwStartNode *pStNd;
 
diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx
index 4a397b73c39e..400fc8ba0cda 100644
--- a/sw/source/filter/xml/xmltbli.hxx
+++ b/sw/source/filter/xml/xmltbli.hxx
@@ -81,7 +81,7 @@ class SwXMLTableContext : public XMLTextTableContext
   

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

2023-11-08 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/ww8par.hxx  |2 +-
 sw/source/filter/ww8/ww8par5.cxx |5 ++---
 sw/source/filter/xml/xmlitem.cxx |5 ++---
 sw/source/filter/xml/xmlitem.hxx |3 ++-
 4 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 5cc3533a11837ee6e6a0f774eee61a9561aa7432
Author: Noel Grandin 
AuthorDate: Tue Nov 7 15:45:01 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 17:12:38 2023 +0100

loplugin:fieldcast in SwWW8ImplReader

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

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index ccd1edd0d056..f98bcc2ff58e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1291,7 +1291,7 @@ private:
 std::unique_ptr m_pDrawEditEngine;
 std::unique_ptr m_xWWZOrder;
 
-SwFieldType* m_pNumFieldType;   // for number circle
+SwSetExpFieldType* m_pNumFieldType;   // for number circle
 
 std::unique_ptr m_xMSDffManager;
 
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index b63438893617..c87c33dde0e1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1474,10 +1474,9 @@ eF_ResT SwWW8ImplReader::Read_F_ANumber( WW8FieldDesc*, 
OUString& rStr )
 {
 if( !m_pNumFieldType ){ // 1st time
 SwSetExpFieldType aT( _rDoc, "AutoNr", nsSwGetSetExpType::GSE_SEQ );
-m_pNumFieldType = m_rDoc.getIDocumentFieldsAccess().InsertFieldType( 
aT );
+m_pNumFieldType = 
static_cast(m_rDoc.getIDocumentFieldsAccess().InsertFieldType(
 aT ));
 }
-SwSetExpField aField( static_cast(m_pNumFieldType), 
OUString(),
-GetNumberPara( rStr ) );
+SwSetExpField aField( m_pNumFieldType, OUString(), GetNumberPara( rStr ) );
 aField.SetValue( ++m_nFieldNum, nullptr );
 m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, 
SwFormatField( aField ) );
 return eF_ResT::OK;
commit 08640728b2c3793816ec4366924e60ac291cfd8c
Author: Noel Grandin 
AuthorDate: Tue Nov 7 15:43:31 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 17:12:32 2023 +0100

loplugin:fieldcast in SwXMLItemSetContext

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

diff --git a/sw/source/filter/xml/xmlitem.cxx b/sw/source/filter/xml/xmlitem.cxx
index 32c45bb5392e..ff98d2ff691b 100644
--- a/sw/source/filter/xml/xmlitem.cxx
+++ b/sw/source/filter/xml/xmlitem.cxx
@@ -45,8 +45,7 @@ SwXMLItemSetContext::~SwXMLItemSetContext()
 {
 if( m_xBackground.is() )
 {
-const SvxBrushItem& rItem =
-
static_cast(m_xBackground.get())->GetItem();
+const SvxBrushItem& rItem = m_xBackground->GetItem();
 m_rItemSet.Put( rItem );
 }
 }
@@ -75,7 +74,7 @@ SvXMLImportContextRef 
SwXMLItemSetContext::createFastChildContext( sal_Int32 nEl
const uno::Reference< 
xml::sax::XFastAttributeList >& xAttrList,
const SvXMLItemMapEntry& rEntry )
 {
-SvXMLImportContextRef xContext;
+rtl::Reference xContext;
 
 switch( rEntry.nWhichId )
 {
diff --git a/sw/source/filter/xml/xmlitem.hxx b/sw/source/filter/xml/xmlitem.hxx
index 4cff6aaafb79..cd6f9c8db62e 100644
--- a/sw/source/filter/xml/xmlitem.hxx
+++ b/sw/source/filter/xml/xmlitem.hxx
@@ -28,13 +28,14 @@ class SfxItemSet;
 class SvXMLImportItemMapper;
 class SvXMLUnitConverter;
 struct SvXMLItemMapEntry;
+class SwXMLBrushItemImportContext;
 
 class SwXMLItemSetContext final : public SvXMLImportContext
 {
 SfxItemSet  _rItemSet;
 const SvXMLImportItemMapper _rIMapper;
 const SvXMLUnitConverter_rUnitConv;
-SvXMLImportContextRef m_xBackground;
+rtl::Reference m_xBackground;
 
 public:
 


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

2023-11-07 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/tblrwcl.cxx  |2 -
 sw/source/core/edit/edlingu.cxx |4 +-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 +-
 sw/source/filter/html/htmlatr.cxx   |   17 -
 sw/source/filter/html/htmlgrin.cxx  |2 -
 sw/source/filter/html/wrthtml.cxx   |8 ++--
 sw/source/filter/html/wrthtml.hxx   |2 -
 sw/source/filter/ww8/ww8par.cxx |   33 -
 sw/source/filter/ww8/ww8par.hxx |5 ++
 sw/source/filter/ww8/ww8par3.cxx|7 +--
 sw/source/filter/ww8/ww8par5.cxx|7 +--
 sw/source/filter/ww8/ww8par6.cxx|   45 +---
 sw/source/filter/xml/swxml.cxx  |4 +-
 sw/source/ui/config/optpage.cxx |   12 +++---
 sw/source/uibase/app/docshini.cxx   |6 +--
 sw/source/uibase/inc/langhelper.hxx |4 +-
 sw/source/uibase/shells/annotsh.cxx |9 ++--
 sw/source/uibase/shells/drwtxtex.cxx|7 ++-
 sw/source/uibase/shells/langhelper.cxx  |   30 
 sw/source/uibase/uiview/view2.cxx   |2 -
 sw/source/uibase/uiview/viewdraw.cxx|4 +-
 21 files changed, 104 insertions(+), 111 deletions(-)

New commits:
commit 0054f303b030c2f552d9977a24b8e860b0ca15e0
Author: Noel Grandin 
AuthorDate: Tue Nov 7 11:18:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 7 15:13:12 2023 +0100

use more TypedWhichId

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

diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 2b5192804856..ef4b023d4fee 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -3203,7 +3203,7 @@ SwFrameFormat* SwShareBoxFormat::GetFormat( const 
SfxPoolItem& rItem ) const
 const SfxPoolItem* pItem;
 sal_uInt16 nWhich = rItem.Which();
 SwFrameFormat *pRet = nullptr, *pTmp;
-const SfxPoolItem& rFrameSz = m_pOldFormat->GetFormatAttr( RES_FRM_SIZE, 
false );
+const SwFormatFrameSize& rFrameSz = m_pOldFormat->GetFormatAttr( 
RES_FRM_SIZE, false );
 for( auto n = m_aNewFormats.size(); n; )
 if( SfxItemState::SET == ( pTmp = m_aNewFormats[ --n ])->
 GetItemState( nWhich, false,  ) && *pItem == rItem &&
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index 330204f89915..17ee6135ab98 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -385,10 +385,9 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, 
SwDoc *pDoc, SwDoc *pTem
 nBottomMargin = rULSpace.GetLower();
 
 // export language if it differs from the default language
-sal_uInt16 nWhichId =
+TypedWhichId nWhichId =
 SwHTMLWriter::GetLangWhichIdFromScript( nCSS1Script );
-const SvxLanguageItem& rLang =
-static_cast(pFormat->GetFormatAttr( nWhichId 
));
+const SvxLanguageItem& rLang = pFormat->GetFormatAttr( nWhichId );
 LanguageType eLang = rLang.GetLanguage();
 if( eLang != eDfltLang )
 {
@@ -398,15 +397,14 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, 
SwDoc *pDoc, SwDoc *pTem
 moItemSet->Put( rLang );
 }
 
-static const sal_uInt16 aWhichIds[3] =
+static const TypedWhichId aWhichIds[3] =
 { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
 RES_CHRATR_CTL_LANGUAGE };
-for(sal_uInt16 i : aWhichIds)
+for(const TypedWhichId& i : aWhichIds)
 {
 if( i != nWhichId )
 {
-const SvxLanguageItem& rTmpLang =
-static_cast(pFormat->GetFormatAttr(i));
+const SvxLanguageItem& rTmpLang = pFormat->GetFormatAttr(i);
 if( rTmpLang.GetLanguage() != eLang )
 {
 if( !moItemSet )
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d2b2968608e8..9418fa06466b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2809,7 +2809,7 @@ rtl_TextEncoding SwWW8ImplReader::GetCharSetFromLanguage()
  correctly set in the character runs involved, so it's hard to reproduce
  documents that require this to be sure of the process involved.
 */
-const SvxLanguageItem *pLang = static_cast(GetFormatAttr(RES_CHRATR_LANGUAGE));
+const SvxLanguageItem *pLang = GetFormatAttr(RES_CHRATR_LANGUAGE);
 LanguageType eLang = pLang ? pLang->GetLanguage() : LANGUAGE_SYSTEM;
 css::lang::Locale aLocale(LanguageTag::convertToLocale(eLang));
 return msfilter::util::getBestTextEncodingFromLocale(aLocale);
@@ -2827,7 +2827,7 @@ rtl_TextEncoding 
SwWW8ImplReader::GetCJKCharSetFromLanguage()
  correctly set in the character runs involved, so 

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

2023-11-01 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/ww8scan.cxx  |   17 ++---
 sw/source/filter/ww8/ww8scan.hxx  |2 --
 sw/source/uibase/fldui/fldmgr.cxx |   15 ---
 sw/source/uibase/inc/fldmgr.hxx   |1 -
 4 files changed, 10 insertions(+), 25 deletions(-)

New commits:
commit 2779984709d24ad263547407069a5da0fda36ceb
Author: Noel Grandin 
AuthorDate: Tue Oct 31 13:45:27 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 1 18:39:41 2023 +0100

WW8PLCFx_PCDAttrs::m_aShortSprm can be local

found by a new loplugin

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

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

SwFieldMgr::m_nCurFormat is unused

found by a new loplugin of mine

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

diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index 9187afa08832..ec509c92cd0c 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -441,30 +441,15 @@ SwField* SwFieldMgr::GetCurField()
 m_aCurPar1.clear();
 m_aCurPar2.clear();
 m_sCurFrame.clear();
-m_nCurFormat = 0;
 
 if(!m_pCurField)
 return nullptr;
 
 // preprocess current values; determine parameter 1 and parameter 2
-// as well as the format
-const SwFieldTypesEnum nTypeId = m_pCurField->GetTypeId();
 
-m_nCurFormat = m_pCurField->GetFormat();
 m_aCurPar1= m_pCurField->GetPar1();
 m_aCurPar2= m_pCurField->GetPar2();
 
-switch( nTypeId )
-{
-case SwFieldTypesEnum::PageNumber:
-case SwFieldTypesEnum::NextPage:
-case SwFieldTypesEnum::PreviousPage:
-case SwFieldTypesEnum::GetRefPage:
-if( m_nCurFormat == SVX_NUM_PAGEDESC )
-m_nCurFormat -= 2;
-break;
-default: break;
-}
 return m_pCurField;
 }
 
diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx
index 4bf88db3c3f3..48d4500513c4 100644

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

2023-10-29 Thread Attila Szűcs (via logerrit)
 sw/source/core/doc/docredln.cxx|8 ++--
 sw/source/uibase/misc/redlndlg.cxx |7 +--
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit a1c3ac4205226f192b94a36a912e915b959043d7
Author: Attila Szűcs 
AuthorDate: Wed Oct 25 13:09:22 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 00:39:22 2023 +0100

SW: small fix for manage changes dialog.

Fixed a continue, as it was planned to effect the outer loop.
(probably when it was replaced to an inner loop it was forgot to handle)

fixed a nullptr check also.

These problems may not result real problem right now,
but when interdependedt redlines will be improved,
they will result in problems.

Change-Id: Ie139f9a657abbacea9450176d2fe138392beddfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158457
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158613
Tested-by: Caolán McNamara 

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index b68bacbbef5c..532ea120ca2a 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -440,13 +440,16 @@ void SwRedlineAcceptDlg::Activate()
 {
 while (pRedlineData)
 {
-if (pRedlineData != pBackupData->pChild)
+if (!pBackupData || pRedlineData != pBackupData->pChild)
 {
 // Redline-Children were inserted, changed or deleted
 i = CalcDiff(i, true);
 if (i == SwRedlineTable::npos)
 return;
-continue;
+
+// here was a continue; targetted to the outer loop
+// now a break will do, as there is nothing after it in 
the outer loop
+break;
 }
 pBackupData = pBackupData->pNext;
 pRedlineData = pRedlineData->Next();
commit 2c3f731992a294d4f35b41193af034fe9a6dd65c
Author: Attila Szűcs 
AuthorDate: Wed Oct 25 11:40:23 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 00:39:12 2023 +0100

tdf#157663 SW: reenable move recognition improvements

Re-enabled the improvement of move recognition in redlines, that
is able to recognize movements split into more redlines.

Probably it does not effect performance too much, but if in some cases
it would become a problem then this small patch can be reverted easily.

Change-Id: I6598d4d4f98f472f3972aec41b82ec26d90db860
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158455
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158612

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 02ded9bc1acd..26a3c7bc24df 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -908,11 +908,7 @@ bool SwRedlineTable::isMoved(size_type rPos) const
 if (isMovedImpl(rPos, false))
 return true;
 else
-{
-// Commented out because of probably performance issue
-//return isMovedImpl(rPos, true);
-return false;
-}
+return isMovedImpl(rPos, true);
 }
 
 bool SwRedlineTable::isMovedImpl(size_type rPos, bool bTryCombined) const
@@ -982,7 +978,7 @@ bool SwRedlineTable::isMovedImpl(size_type rPos, bool 
bTryCombined) const
 size_type nStart = rPos > nLookahead ? rPos - nLookahead : 0;
 // first, try to compare to single redlines
 // next, try to compare to combined redlines
-for (int nPass = 0; nPass < (bTryCombined ? 2 : 1) && !bRet; nPass++)
+for (int nPass = 0; nPass < 2 && !bRet; nPass++)
 {
 for (size_type nPosAct = nStart; nPosAct < nEnd && !bRet; ++nPosAct)
 {


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

2023-10-07 Thread Mike Kaganski (via logerrit)
 sw/source/filter/html/htmltabw.cxx   |   17 +
 sw/source/filter/inc/wrtswtbl.hxx|   10 --
 sw/source/filter/writer/wrtswtbl.cxx |   22 +-
 3 files changed, 14 insertions(+), 35 deletions(-)

New commits:
commit 7b6fd0f92f4ae4bbdd79e6d0f2a65eaddbf1
Author: Mike Kaganski 
AuthorDate: Sat Oct 7 13:58:51 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 7 14:11:05 2023 +0200

Make fields private

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

diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index 64b08e83dc9d..d55512e1a44a 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -589,12 +589,12 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 {
 SwWriteTableRow* pRow = row->get();
 SwWriteTableRow* pNextRow = next->get();
-bool bBorder = ( pRow->m_bBottomBorder || pNextRow->m_bTopBorder );
+bool bBorder = ( pRow->HasBottomBorder() || pNextRow->HasTopBorder() );
 bRowsHaveBorder |= bBorder;
 bRowsHaveBorderOnly &= bBorder;
 
-pRow->m_bBottomBorder = bBorder;
-pNextRow->m_bTopBorder = bBorder;
+pRow->SetBottomBorder(bBorder);
+pNextRow->SetTopBorder(bBorder);
 }
 
 bool bColsHaveBorder = false;
@@ -792,7 +792,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 // can be outputted if there is a line below the cell.
 if( bTHead &&
 (bTSections || bColGroups) &&
-m_nHeadEndRowm_bBottomBorder )
+m_nHeadEndRowHasBottomBorder() )
 bTHead = false;
 
 // Output  only if  is outputted.
@@ -821,7 +821,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 --nSkipRows;
 }
 if( ( (bTHead && nRow==m_nHeadEndRow) ||
-  (bTBody && pRow->m_bBottomBorder) ) &&
+  (bTBody && pRow->HasBottomBorder()) ) &&
 nRow < m_aRows.size()-1 )
 {
 rWrt.DecIndentLevel(); // indent content of /
diff --git a/sw/source/filter/inc/wrtswtbl.hxx 
b/sw/source/filter/inc/wrtswtbl.hxx
index 104cbb870ec5..e3391e7ce74c 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -101,6 +101,8 @@ class SwWriteTableRow final
 
 tools::Long m_nPos;   // end position (twips) of the 
row
 bool mbUseLayoutHeights;
+bool m_bTopBorder; // which borders are there?
+bool m_bBottomBorder;
 
 SwWriteTableRow & operator= (const SwWriteTableRow &) = delete;
 
@@ -109,9 +111,6 @@ class SwWriteTableRow final
 
 public:
 
-bool m_bTopBorder : 1;// which borders are there?
-bool m_bBottomBorder : 1;
-
 SwWriteTableRow( tools::Long nPos, bool bUseLayoutHeights );
 
 SwWriteTableCell *AddCell( const SwTableBox *pBox,
@@ -127,7 +126,9 @@ public:
 const SvxBrushItem *GetBackground() const { return m_pBackground; }
 
 bool HasTopBorder() const   { return m_bTopBorder; }
+void SetTopBorder(bool value)   { m_bTopBorder = value; }
 bool HasBottomBorder() const{ return m_bBottomBorder; }
+void SetBottomBorder(bool value){ m_bBottomBorder = value; }
 
 const SwWriteTableCells& GetCells() const   { return m_Cells; }
 
diff --git a/sw/source/filter/writer/wrtswtbl.cxx 
b/sw/source/filter/writer/wrtswtbl.cxx
index 9f6c4976e126..223ccf96266b 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -688,10 +688,10 @@ void SwWriteTable::FillTableRowsCols( tools::Long 
nStartRPos, sal_uInt16 nStartR
 }
 
 if (!(nBorderMask & 1))
-pRow->m_bTopBorder = false;
+pRow->SetTopBorder(false);
 
 if (!(nBorderMask & 2))
-pEndRow->m_bBottomBorder = false;
+pEndRow->SetBottomBorder(false);
 }
 }
 else
@@ -842,11 +842,11 @@ SwWriteTable::SwWriteTable(const SwTable* pTable, const 
SwHTMLTableLayout *pLayo
 pCol->m_bRightBorder = false;
 
 if( !(nBorderMask & 1) )
-pRow->m_bTopBorder = false;
+pRow->SetTopBorder(false);
 
 SwWriteTableRow *pEndRow = m_aRows[nRow+nRowSpan-1].get();
 if( !(nBorderMask & 2) )
-pEndRow->m_bBottomBorder = false;
+pEndRow->SetBottomBorder(false);
 
 // The height requires only to be written once
 if( nHeight )
commit 8328f8c2620f8512c6056d54ea4d08ae3de97170
Author: Mike Kaganski 
AuthorDate: Sat Oct 7 13:22:36 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 7 14:10:57 2023 

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

2023-09-18 Thread Noel Grandin (via logerrit)
 sw/source/core/text/porlay.cxx |4 ++--
 sw/source/core/unocore/unoportenum.cxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 301e522e7ee440b9c026042dd94815134c88adf2
Author: Noel Grandin 
AuthorDate: Sun Sep 17 19:35:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 15:31:10 2023 +0200

use more concrete UNO types in sw

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

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 5208d6ab0320..0c247cbc8dc1 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -909,9 +909,9 @@ static Color getBookmarkColor(const SwTextNode& rNode, 
const sw::mark::IBookmark
 try
 {
 SwDoc& rDoc = const_cast(rNode.GetDoc());
-const uno::Reference< text::XTextContent > xRef = 
SwXBookmark::CreateXBookmark(rDoc,
+const rtl::Reference< SwXBookmark > xRef = 
SwXBookmark::CreateXBookmark(rDoc,
 const_cast(static_cast(pBookmark)));
-const css::uno::Reference xSubject(xRef, 
uno::UNO_QUERY);
+const css::uno::Reference xSubject(xRef);
 uno::Reference xModel = 
rDoc.GetDocShell()->GetBaseModel();
 
 static uno::Reference< uno::XComponentContext > xContext(
commit 34d6dfb68224f576fb316a0822143470233fd40a
Author: Noel Grandin 
AuthorDate: Sun Sep 17 19:33:31 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 15:31:00 2023 +0200

use more concrete UNO types in sw

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

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 791622ea875b..4b50a72cf5ad 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -543,7 +543,7 @@ lcl_CreateContentControlPortion(const 
css::uno::Reference& xParent,
 const SwUnoCursor* pUnoCursor, SwTextAttr& 
rAttr,
 std::unique_ptr&& 
pPortions)
 {
-uno::Reference xContentControl = 
SwXContentControl::CreateXContentControl(
+rtl::Reference xContentControl = 
SwXContentControl::CreateXContentControl(
 
*static_cast(rAttr.GetAttr()).GetContentControl(), 
xParent,
 std::move(pPortions));
 rtl::Reference pPortion;
@@ -995,7 +995,7 @@ lcl_ExportHints(
 if (*pUnoCursor->GetMark() == *pUnoCursor->GetPoint())
 break;
 pPortion = new SwXTextPortion(pUnoCursor, xParent, 
PORTION_LINEBREAK);
-uno::Reference xLineBreak
+rtl::Reference xLineBreak
 = SwXLineBreak::CreateXLineBreak(
 
_cast(pAttr->GetLineBreak()));
 pPortion->SetLineBreak(xLineBreak);


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

2023-09-18 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/unoportenum.cxx |8 +++-
 sw/source/core/unocore/unostyle.cxx|2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 6b3118be28fa6e5906b44c4963b0bb2ca804a863
Author: Noel Grandin 
AuthorDate: Sun Sep 17 19:24:35 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 08:09:25 2023 +0200

use more concrete UNO types in sw

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

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index e57beb1a72f7..70fc8b712266 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3065,7 +3065,7 @@ void SwXPageStyle::setPropertyValues(const 
uno::Sequence& rPropertyNam
 }
 }
 
-static uno::Reference lcl_makeHeaderFooter(const sal_uInt16 nRes, 
const bool bHeader, SwFrameFormat const*const pFrameFormat)
+static rtl::Reference lcl_makeHeaderFooter(const sal_uInt16 
nRes, const bool bHeader, SwFrameFormat const*const pFrameFormat)
 {
 if (!pFrameFormat)
 return nullptr;
commit af83536685cf50a564d9c8290bf6ea5982de73b7
Author: Noel Grandin 
AuthorDate: Sun Sep 17 19:19:13 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 18 08:09:16 2023 +0200

use more concrete UNO types in sw

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

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 420aa9a8bf95..791622ea875b 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -519,20 +519,18 @@ lcl_CreateMetaPortion(
 const SwUnoCursor * const pUnoCursor,
 SwTextAttr & rAttr, std::unique_ptr && pPortions)
 {
-const uno::Reference xMeta( SwXMeta::CreateXMeta(
+const rtl::Reference xMeta( SwXMeta::CreateXMeta(
 *static_cast(rAttr.GetAttr()).GetMeta(),
 xParent, std::move(pPortions)));
 rtl::Reference pPortion;
 if (RES_TXTATR_META == rAttr.Which())
 {
-const uno::Reference xContent(xMeta,
-uno::UNO_QUERY);
 pPortion = new SwXTextPortion(pUnoCursor, xParent, PORTION_META);
-pPortion->SetMeta(xContent);
+pPortion->SetMeta(xMeta);
 }
 else
 {
-const uno::Reference xField(xMeta, uno::UNO_QUERY);
+const uno::Reference 
xField(static_cast(xMeta.get()), uno::UNO_QUERY);
 pPortion = new SwXTextPortion(pUnoCursor, xParent, PORTION_FIELD);
 pPortion->SetTextField(xField);
 }


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

2023-09-14 Thread Caolán McNamara (via logerrit)
 sw/source/core/frmedt/feshview.cxx |   70 +++--
 1 file changed, 36 insertions(+), 34 deletions(-)

New commits:
commit b3fdd999f87312447d03915585812b3a5cd48141
Author: Caolán McNamara 
AuthorDate: Thu Sep 14 20:25:25 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 14 22:17:56 2023 +0200

unfold SwFEShell::IsShapeDefaultHoriTextDirR2L to something readable

return early on not meeting each successive condition

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

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 81f816c7bee8..7b1da09c118f 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -3181,45 +3181,44 @@ Color SwFEShell::GetShapeBackground() const
 */
 bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const
 {
-bool bRet = false;
-
 // check, if a draw view exists
-OSL_ENSURE( Imp()->GetDrawView(), "wrong usage of 
SwFEShell::GetShapeBackground - no draw view!");
-if( Imp()->GetDrawView() )
-{
-// determine list of selected objects
-const SdrMarkList* pMrkList = 
()->GetDrawView()->GetMarkedObjectList();
-// check, if exactly one object is selected.
-OSL_ENSURE( pMrkList->GetMarkCount() == 1, "wrong usage of 
SwFEShell::GetShapeBackground - no selected object!");
-if ( pMrkList->GetMarkCount() == 1)
-{
-// get selected object
-const SdrObject *pSdrObj = pMrkList->GetMark( 0 
)->GetMarkedSdrObj();
-// check, if selected object is a shape (drawing object)
-OSL_ENSURE( dynamic_cast( pSdrObj) ==  
nullptr, "wrong usage of SwFEShell::GetShapeBackground - selected object is not 
a drawing object!");
-if ( dynamic_cast( pSdrObj) ==  nullptr )
-{
-// determine page frame of the frame the shape is anchored.
-const SwContact* pContact = GetUserCall(pSdrObj);
-OSL_ENSURE( pContact, 
" - missing contact!" );
-if (!pContact)
-return false;
-const SwFrame* pAnchorFrame = static_cast(pContact)->GetAnchorFrame( pSdrObj );
-OSL_ENSURE( pAnchorFrame, "inconsistent model - no anchor at 
shape!");
-if ( pAnchorFrame )
-{
-const SwPageFrame* pPageFrame = 
pAnchorFrame->FindPageFrame();
-OSL_ENSURE( pPageFrame, "inconsistent model - no page!");
-if ( pPageFrame )
-{
-bRet = pPageFrame->IsRightToLeft();
-}
-}
-}
-}
-}
+OSL_ENSURE(Imp()->GetDrawView(), "wrong usage of 
SwFEShell::GetShapeBackground - no draw view!");
+if (!Imp()->GetDrawView())
+return false;
 
-return bRet;
+// determine list of selected objects
+const SdrMarkList& rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
+
+// check, if exactly one object is selected.
+OSL_ENSURE(rMrkList.GetMarkCount() == 1, "wrong usage of 
SwFEShell::GetShapeBackground - no selected object!");
+if (rMrkList.GetMarkCount() != 1)
+return false;
+
+// get selected object
+const SdrObject *pSdrObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
+
+// check, if selected object is a shape (drawing object)
+OSL_ENSURE(dynamic_cast(pSdrObj) == nullptr, 
"wrong usage of SwFEShell::GetShapeBackground - selected object is not a 
drawing object!");
+if (dynamic_cast(pSdrObj) != nullptr)
+return false;
+
+// determine page frame of the frame the shape is anchored.
+const SwContact* pContact = GetUserCall(pSdrObj);
+OSL_ENSURE(pContact, " - 
missing contact!");
+if (!pContact)
+return false;
+
+const SwFrame* pAnchorFrame = static_cast(pContact)->GetAnchorFrame(pSdrObj);
+OSL_ENSURE(pAnchorFrame, "inconsistent model - no anchor at shape!");
+if (!pAnchorFrame)
+return false;
+
+const SwPageFrame* pPageFrame = pAnchorFrame->FindPageFrame();
+OSL_ENSURE(pPageFrame, "inconsistent model - no page!");
+if (!pPageFrame)
+return false;
+
+return pPageFrame->IsRightToLeft();
 }
 
 Point SwFEShell::GetRelativePagePosition(const Point& rDocPos)
commit 105d1c010c4dc3caedf66a2080045c9c5f6fb9e3
Author: Caolán McNamara 
AuthorDate: Thu Sep 14 20:18:55 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 14 22:17:47 2023 +0200

crashreporting: apparent null deref at 
SwFEShell::IsShapeDefaultHoriTextDirR2L

https: 
//crashreport.libreoffice.org/stats/crash_details/73028951-19a0-409b-89d2-a080495df925
Change-Id: I440465a3c7d5b98ecdd1c5f1973a2b8f64d6772e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156931

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

2023-09-14 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/unoframe.cxx |   20 +---
 sw/source/core/unocore/unoftn.cxx   |4 
 sw/source/core/unocore/unoidx.cxx   |5 -
 sw/source/core/unocore/unolinebreak.cxx |4 
 sw/source/core/unocore/unoredline.cxx   |6 -
 sw/source/core/unocore/unosett.cxx  |4 
 sw/source/core/unocore/unotbl.cxx   |4 
 sw/source/core/unocore/unotext.cxx  |  156 ++--
 sw/source/uibase/uno/unoatxt.cxx|8 -
 9 files changed, 46 insertions(+), 165 deletions(-)

New commits:
commit e46162c8bf196e0b3ec83384b99db9c7ee3f8db9
Author: Noel Grandin 
AuthorDate: Thu Sep 14 15:33:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 14 19:01:32 2023 +0200

simplify some exception throwing

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

diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index 9a44be4045bc..61dde3157e31 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1886,9 +1886,7 @@ void SwXFrame::setPropertyValue(const OUString& 
rPropertyName, const ::uno::Any&
 SwFrameFormat* pFlyFormat = pAnchorNode ? 
pAnchorNode->GetFlyFormat() : nullptr;
 if(!pFlyFormat || pFlyFormat->Which() == RES_DRAWFRMFMT)
 {
-lang::IllegalArgumentException aExcept;
-aExcept.Message = "Anchor to frame: no frame found";
-throw aExcept;
+throw lang::IllegalArgumentException("Anchor to frame: 
no frame found", nullptr, 0);
 }
 else
 {
@@ -2961,9 +2959,7 @@ void 
SwXFrame::attachToRange(uno::Reference const& xTextRange,
 {
 if( !aClassName.MakeId( aCLSID ) )
 {
-lang::IllegalArgumentException aExcept;
-aExcept.Message = "CLSID invalid";
-throw aExcept;
+throw lang::IllegalArgumentException("CLSID invalid", 
nullptr, 0);
 }
 
 pCnt.reset( new comphelper::EmbeddedObjectContainer );
@@ -3183,16 +3179,12 @@ void SwXFrame::attach(const uno::Reference< 
text::XTextRange > & xTextRange)
 
 awt::Point SwXFrame::getPosition()
 {
-uno::RuntimeException aRuntime;
-aRuntime.Message = "position cannot be determined with this method";
-throw aRuntime;
+throw uno::RuntimeException("position cannot be determined with this 
method");
 }
 
 void SwXFrame::setPosition(const awt::Point& /*aPosition*/)
 {
-uno::RuntimeException aRuntime;
-aRuntime.Message = "position cannot be changed with this method";
-throw aRuntime;
+throw uno::RuntimeException("position cannot be changed with this method");
 }
 
 awt::Size SwXFrame::getSize()
@@ -3315,9 +3307,7 @@ rtl::Reference  
SwXTextFrame::createXTextCursor()
 aPam.GetPointNode().FindSttNodeByType(SwFlyStartNode);
 if(!pNewStartNode || pNewStartNode != pOwnStartNode)
 {
-uno::RuntimeException aExcept;
-aExcept.Message = "no text available";
-throw aExcept;
+throw uno::RuntimeException("no text available");
 }
 
 return new SwXTextCursor(
diff --git a/sw/source/core/unocore/unoftn.cxx 
b/sw/source/core/unocore/unoftn.cxx
index ef04f1f62d30..1a73e2e617d8 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -497,9 +497,7 @@ SwXFootnote::getPropertyValue(const OUString& rPropertyName)
 }
 else
 {
-beans::UnknownPropertyException aExcept;
-aExcept.Message = rPropertyName;
-throw aExcept;
+throw beans::UnknownPropertyException(rPropertyName);
 }
 }
 return aRet;
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 2b6afa848414..1e9f7cba274f 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2778,10 +2778,7 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
 pProperties[j].Value >>= nType;
 if(nType < 0 || nType > text::BibliographyDataField::LOCAL_URL)
 {
-lang::IllegalArgumentException aExcept;
-aExcept.Message = "BibliographyDataField - wrong value";
-aExcept.ArgumentPosition = static_cast< sal_Int16 >(j);
-throw aExcept;
+throw 
lang::IllegalArgumentException("BibliographyDataField - wrong value", nullptr, 
j);
 }
 aToken.nAuthorityField = nType;
 }
diff --git a/sw/source/core/unocore/unolinebreak.cxx 
b/sw/source/core/unocore/unolinebreak.cxx
index 4ad4f756bf03..d04011329022 100644

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

2023-08-29 Thread Sarper Akdemir (via logerrit)
 sw/source/uibase/docvw/edtwin.cxx   |4 ++--
 sw/source/uibase/uiview/formatclipboard.cxx |   15 +--
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit e9bb17369dc6fd3064fce55a1afacaacea4faae2
Author: Sarper Akdemir 
AuthorDate: Mon Jul 31 09:15:28 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Tue Aug 29 11:06:27 2023 +0200

related tdf#103706: sw: correct format paintbrush attribute reset

Reset all direct formatting before applying **any** attributes.

For instance, before this patch paragraph font colors were lost
on apply.

Change-Id: I62d202713e60e7e3690c67d63989179c3d5dc900
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155106
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/sw/source/uibase/uiview/formatclipboard.cxx 
b/sw/source/uibase/uiview/formatclipboard.cxx
index 74fd772f5cfa..e722c04e9046 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -450,6 +450,15 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, 
SfxStyleSheetBasePool* pPo
 
 ItemVector aItemVector;
 
+if (m_pItemSet_TextAttr && !( nSelectionType & SelectionType::DrawObject))
+{
+// reset all direct formatting before applying anything
+o3tl::sorted_vector aAttrs;
+for (sal_uInt16 nWhich = RES_CHRATR_BEGIN; nWhich < RES_CHRATR_END; 
nWhich++)
+aAttrs.insert(nWhich);
+rWrtShell.ResetAttr({ aAttrs });
+}
+
 if( nSelectionType & SelectionType::Text )
 {
 // apply the named text and paragraph formatting
@@ -535,12 +544,6 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, 
SfxStyleSheetBasePool* pPo
 // copy the stored automatic text attributes in a temporary 
SfxItemSet
 pTemplateItemSet->Put( *m_pItemSet_TextAttr );
 
-// reset all direct formatting
-o3tl::sorted_vector aAttrs;
-for( sal_uInt16 nWhich = RES_CHRATR_BEGIN; nWhich < 
RES_CHRATR_END; nWhich++ )
-aAttrs.insert( nWhich );
-rWrtShell.ResetAttr( { aAttrs } );
-
 // only attributes that were not apply by named style 
attributes and automatic
 // paragraph attributes should be applied
 lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
commit 36aa809fbd3c44da1ed266104f175e8c872d38b3
Author: Sarper Akdemir 
AuthorDate: Thu Jul 27 21:38:34 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Tue Aug 29 11:06:14 2023 +0200

tdf#103706: sw: Revert "Format paintbrush default behaviour"

This reverts commit 1574c76ec20d1da479ed7e9c85a6cefacc132dfe.

Reason for revert: The default behavior should copy *all* formatting.

Change-Id: If3ae81d412374433f2d95a04345c651a788de4f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155103
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index c5cbee04c77f..aa97df53e8ab 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5102,7 +5102,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
 SwWrtShell& rWrtShell = m_rView.GetWrtShell();
 SfxStyleSheetBasePool* pPool=nullptr;
 bool bNoCharacterFormats = false;
-bool bNoParagraphFormats = true;
+bool bNoParagraphFormats = false;
 {
 SwDocShell* pDocSh = m_rView.GetDocShell();
 if(pDocSh)
@@ -5113,7 +5113,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
 bNoParagraphFormats = false;
 }
 else if( rMEvt.GetModifier() & KEY_MOD1 )
-bNoParagraphFormats = false;
+bNoParagraphFormats = true;
 }
 //execute paste
 pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, 
bNoParagraphFormats );


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

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

New commits:
commit 61845b3d9fed6a8b97e90ec12126d1e1e4cc18d0
Author: Balazs Varga 
AuthorDate: Wed Aug 2 14:10:28 2023 +0200
Commit: Balazs Varga 
CommitDate: Thu Aug 3 19:40:27 2023 +0200

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

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

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 44427dde9ddd..80aef2c4123f 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1247,7 +1247,10 @@ public:
 }
 resultString
 = resultString.replaceAll("%LEVEL_CURRENT%", 
OUString::number(currentLevel));
-lclAddIssue(m_rIssueCollection, resultString);
+auto pIssue = lclAddIssue(m_rIssueCollection, resultString);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setDoc(pCurrent->GetDoc());
+pIssue->setNode(pCurrent);
 }
 
 // Updating previous level.
commit 22e8d9c42a2ffa19c9efeeaf581016c39c724134
Author: Balazs Varga 
AuthorDate: Wed Aug 2 13:05:37 2023 +0200
Commit: Balazs Varga 
CommitDate: Thu Aug 3 19:40:12 2023 +0200

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

warning message.

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

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


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

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

New commits:
commit 7f7ccf955fa1138b712233628de4a73b3f845c7e
Author: Michael Weghorn 
AuthorDate: Thu Jul 6 13:37:30 2023 +0200
Commit: Michael Weghorn 
CommitDate: Sat Jul 8 00:12:08 2023 +0200

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

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

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

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

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

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

tdf#155705 sw a11y: Unify iterator use in SwTextMarkupHelper

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

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

diff --git a/sw/source/core/access/textmarkuphelper.cxx 
b/sw/source/core/access/textmarkuphelper.cxx
index 5329241c6f1b..34be72fff584 100644
--- a/sw/source/core/access/textmarkuphelper.cxx
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -86,13 +86,13 @@ SwTextMarkupHelper::SwTextMarkupHelper( const 
SwAccessiblePortionData& rPortionD
 {
 }
 
-sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 
nTextMarkupType )
-{
-sal_Int32 nTextMarkupCount( 0 );
 
+std::unique_ptr 
SwTextMarkupHelper::getIterator(sal_Int32 nTextMarkupType)
+{
+std::unique_ptr pIter;
 

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

2023-07-03 Thread Michael Stahl (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx|   13 +
 vcl/inc/pdf/pdfwriter_impl.hxx   |3 
 vcl/qa/cppunit/pdfexport/data/tdf152231.fodt |  208 +++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |  110 ++
 vcl/source/gdi/pdfwriter_impl.cxx|   13 -
 5 files changed, 340 insertions(+), 7 deletions(-)

New commits:
commit 9eacbf7874320d44b79966cac8fa59c52a191715
Author: Michael Stahl 
AuthorDate: Fri Jun 30 14:56:48 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 3 13:51:59 2023 +0200

tdf#152231 vcl: PDF/UA export: content of comments in the margin

... is also Artifact.

The problem is that ImpEditEngine::Paint() always produces tags,
it can't easily check if it's inside a layout environment that is an
Artifact.

But it looks like PDFWriterImpl::beginStructureElement() already wants
to handle and suppress a structure element inside a NonStruct, except
that it calls endStructureElementMCSeq() before checkEmitStructure(),
so no structure marked content sequence is produced, but the content is
outside the Artifact marked content sequence, and possibly a second
Artifact marked content sequence will be opened once the structure
element is finished.

(btw, it's allowed to nest marked content sequences in PDF, but
nesting a structure element inside an Artifact appears dubious)

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index bad2d387511c..a9438be8fc13 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -1062,7 +1062,8 @@ i12626
 void endPage();
 
 void beginStructureElementMCSeq();
-void endStructureElementMCSeq();
+enum class EndMode { Default, OnlyStruct };
+void endStructureElementMCSeq(EndMode = EndMode::Default);
 /** checks whether a non struct element lies in the ancestor hierarchy
 of the current structure element
 
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf152231.fodt 
b/vcl/qa/cppunit/pdfexport/data/tdf152231.fodt
new file mode 100644
index ..26b5d329b2aa
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/tdf152231.fodt
@@ -0,0 +1,208 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ Gabor Kelemen 
LO2022-11-22T00:38:49.808002022-11-22T01:02:17.52400Gabor
 Kelemen 
LOPT23M25S11LibreOfficeDev/24.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/3d1f9c90605623e5c7e7dd2d28f87aaa45fb9c86aaa2023-06-30T17:07:42.601941685PDF
 files
+ 
+  
+  
+  
+  
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+  
+   
+
+ 
+
+   
+   

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

2023-05-18 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |5 -
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 4b3d3354119b643ec20aaad187d0a6506ea307fb
Author: Caolán McNamara 
AuthorDate: Wed May 17 19:58:40 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 18 10:38:52 2023 +0200

cid#1530394 Uncaught exception

and

cid#1530396 Uncaught exception

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

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 448d9492b30b..c0c8595408c6 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -97,7 +97,7 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* 
pParent, SfxBindings* p
 populateIssues();
 }
 
-A11yCheckIssuesPanel::~A11yCheckIssuesPanel()
+void A11yCheckIssuesPanel::ImplDestroy()
 {
 // Restore state when this panel is no longer used
 if (!mbAutomaticCheckEnabled)
@@ -111,6 +111,8 @@ A11yCheckIssuesPanel::~A11yCheckIssuesPanel()
 m_xAccessibilityCheckBox.reset();
 }
 
+A11yCheckIssuesPanel::~A11yCheckIssuesPanel() { 
suppress_fun_call_w_exception(ImplDestroy()); }
+
 void A11yCheckIssuesPanel::populateIssues()
 {
 if (!mpDoc)
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
index b3e33c049528..e13760135c25 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
@@ -56,6 +56,7 @@ public:
  boost::property_tree::ptree& /*rState*/) 
override{};
 
 A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* pBindings);
+void ImplDestroy();
 virtual ~A11yCheckIssuesPanel() override;
 
 private:
commit 2d5bad1d0904ab0d5a205b15cd109caf8eba6717
Author: Caolán McNamara 
AuthorDate: Wed May 17 19:56:44 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 18 10:38:45 2023 +0200

cid#1524496 Uninitialized scalar field

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

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 854f7f151230..448d9492b30b 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -74,6 +74,7 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* 
pParent, SfxBindings* p
 , mpDoc(nullptr)
 , maA11yCheckController(FN_STAT_ACCESSIBILITY_CHECK, *pBindings, *this)
 , mnIssueCount(0)
+, mbAutomaticCheckEnabled(false)
 {
 SwDocShell* pDocSh = dynamic_cast(SfxObjectShell::Current());
 if (!pDocSh)


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

2023-05-15 Thread Julien Nabet (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |2 +-
 vcl/skia/skia_denylist_vulkan.xml |9 +
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 880165e9c0786d5c70d5bf5804c17772e5f22f61
Author: Julien Nabet 
AuthorDate: Mon May 15 15:20:47 2023 +0200
Commit: Julien Nabet 
CommitDate: Mon May 15 19:51:27 2023 +0200

tdf#155143: blacklist 3 Nvidia cards for Skia hardware rendering

GeForce GTX 1660 SUPER (516.376.0)
GeForce GTX 970 (531.272.0)
Quadro P400 (516.376.0)

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

diff --git a/vcl/skia/skia_denylist_vulkan.xml 
b/vcl/skia/skia_denylist_vulkan.xml
index ee79abe6a61f..5c63283d9720 100644
--- a/vcl/skia/skia_denylist_vulkan.xml
+++ b/vcl/skia/skia_denylist_vulkan.xml
@@ -51,6 +51,15 @@
  
 
 
+ 
+
+
+ 
+
+
+ 
+
+
 
 
 
commit 2c6e275120fd557ece84267deaa1019f347c0b82
Author: Julien Nabet 
AuthorDate: Mon May 15 17:38:19 2023 +0200
Commit: Julien Nabet 
CommitDate: Mon May 15 19:51:13 2023 +0200

tdf#154927: Crash when a11y toolbar is visible and try to insert a math 
object

Since 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=403ea882af35337431e0f67aa973c5f046deb630
tdf#142978 Add a11y check sidebar

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

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 9392bad44ed3..f5673e24c058 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -116,7 +116,7 @@ void A11yCheckIssuesPanel::populateIssues()
 void A11yCheckIssuesPanel::NotifyItemUpdate(const sal_uInt16 nSid, const 
SfxItemState /* eState */,
 const SfxPoolItem* pState)
 {
-if (!m_xAccessibilityCheckBox) //disposed
+if (!m_xAccessibilityCheckBox || !pState) //disposed
 return;
 
 switch (nSid)


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

2023-05-12 Thread Noel Grandin (via logerrit)
 sw/source/filter/ascii/wrtasc.cxx |   14 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/NumberingManager.cxx  |   10 
 writerfilter/source/dmapper/PropertyIds.cxx   |  689 ++
 writerfilter/source/dmapper/PropertyIds.hxx   |2 
 writerfilter/source/dmapper/PropertyMap.cxx   |   20 
 6 files changed, 369 insertions(+), 370 deletions(-)

New commits:
commit 8be73da2284ffe963a464b4c65db4f2ff5d7f09f
Author: Noel Grandin 
AuthorDate: Fri May 12 10:59:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri May 12 14:50:12 2023 +0200

avoid some OUString construction in SwASCWriter::WriteStream

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

diff --git a/sw/source/filter/ascii/wrtasc.cxx 
b/sw/source/filter/ascii/wrtasc.cxx
index 97f21d398bb8..59097fa9aa86 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -90,19 +90,23 @@ SwASCWriter::~SwASCWriter() {}
 
 ErrCode SwASCWriter::WriteStream()
 {
+static constexpr OUStringLiteral STR_CR = u"\015";
+static constexpr OUStringLiteral STR_LF = u"\012";
+static constexpr OUStringLiteral STR_CRLF = u"\015\012";
+static constexpr OUStringLiteral STR_BLANK = u" ";
 bool bIncludeBOM = GetAsciiOptions().GetIncludeBOM();
 bool bIncludeHidden = GetAsciiOptions().GetIncludeHidden();
 
 if( m_bASCII_ParaAsCR )   // If predefined
-m_sLineEnd = "\015";
+m_sLineEnd = STR_CR;
 else if( m_bASCII_ParaAsBlank )
-m_sLineEnd = " ";
+m_sLineEnd = STR_BLANK;
 else
 switch( GetAsciiOptions().GetParaFlags() )
 {
-case LINEEND_CR:m_sLineEnd = "\015"; break;
-case LINEEND_LF:m_sLineEnd = "\012"; break;
-case LINEEND_CRLF:  m_sLineEnd = "\015\012"; break;
+case LINEEND_CR:m_sLineEnd = STR_CR; break;
+case LINEEND_LF:m_sLineEnd = STR_LF; break;
+case LINEEND_CRLF:  m_sLineEnd = STR_CRLF; break;
 }
 
 SwNodeOffset nMaxNode = m_pDoc->GetNodes().Count();
commit 58208b97b972d6ddca5122893b3084c67b0c5ecd
Author: Noel Grandin 
AuthorDate: Fri May 12 11:00:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri May 12 14:50:01 2023 +0200

avoid some OUString construction in writerfilter/

no need to repeatedly construct these

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 83ce570dcbab..7caa847e068e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1571,7 +1571,7 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector& r
 
 for( size_t nProperty = 0; nProperty < SAL_N_ELEMENTS( 
aBorderProperties ); ++nProperty)
 {
-OUString sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
+const OUString & sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
 beans::PropertyValue aValue;
 aValue.Name = sPropertyName;
 aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
@@ -4130,7 +4130,7 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 if ( bOnlyApplyCharHeight && eId != 
PROP_CHAR_HEIGHT )
 continue;
 
-const OUString sPropName = 
getPropertyName(eId);
+const OUString & sPropName = 
getPropertyName(eId);
 if ( beans::PropertyState_DEFAULT_VALUE == 
xShapePropertyState->getPropertyState(sPropName) )
 {
 const uno::Any aProp = 
GetPropertyFromStyleSheet(eId, pEntry, /*bDocDefaults=*/true, /*bPara=*/true);
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index a9535323b480..5b5ad07dce14 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -276,9 +276,9 @@ void ListLevel::AddParaProperties( uno::Sequence< 
beans::PropertyValue >* props
 {
 uno::Sequence< beans::PropertyValue >& aProps = *props;
 
-OUString sFirstLineIndent = getPropertyName(
+const OUString & sFirstLineIndent = getPropertyName(
 PROP_FIRST_LINE_INDENT );
-OUString sIndentAt = getPropertyName(
+const OUString & sIndentAt = getPropertyName(
 PROP_INDENT_AT );
 
 bool hasFirstLineIndent = lcl_findProperty( aProps, 

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

2023-05-12 Thread Szymon Kłos (via logerrit)
 sw/source/ui/dialog/uiregionsw.cxx |   10 --
 vcl/jsdialog/jsdialogbuilder.cxx   |1 +
 2 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 77b2fd00eee43cac9defe55b9622d95c3cb21542
Author: Szymon Kłos 
AuthorDate: Wed May 10 08:27:01 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri May 12 12:26:20 2023 +0200

jsdialog: don't send full update on message dialog close

this fixes regression introduced in:
commit 09976bda9c196b2426b8826941f21384a58bf536
jsdialog: don't close dialog on tab page destroy

when enable macro warning was shown it required to
close manually the dialog with 'x' button because
after click on "enable' or 'disable' it wasn't closed

Change-Id: I4741a874f93481ad03d043349520a1bf91a882be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151602
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151694
Tested-by: Jenkins

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 9b185b2701e5..ed3a0893dbcb 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -905,6 +905,7 @@ std::unique_ptr 
JSInstanceBuilder::weld_message_dialog(cons
 m_bHasTopLevelDialog = true;
 
 initializeSender(GetNotifierWindow(), GetContentWindow(), 
GetTypeOfJSON());
+m_bSentInitialUpdate = true;
 }
 
 pRet.reset(pMessageDialog ? new JSMessageDialog(this, pMessageDialog, 
this, false) : nullptr);
commit 29f6cea1bf55bc40d124fb0ca5cd8895c9053843
Author: Szymon Kłos 
AuthorDate: Mon May 1 16:34:07 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri May 12 12:26:06 2023 +0200

lok: Hide file name label

this is followup for:
commit 80c423520baa94cd3546e02cb383946a7d448ce9
lok: Hide file linking in section

Change-Id: I28f965766758d87f457e8471bf88b5db886fbba3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151232
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151692
Tested-by: Jenkins

diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index 2587cec535d7..96c5b7f8f708 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -418,15 +418,11 @@ SwEditRegionDlg::SwEditRegionDlg(weld::Window* pParent, 
SwWrtShell& rWrtSh)
 
 if(comphelper::LibreOfficeKit::isActive())
 {
-m_xBuilder->weld_label("label8")->hide(); // Link
-m_xFileCB->hide();
 m_xDDECB->hide();
 m_xDDECommandFT->hide();
 m_xFileNameFT->hide();
 m_xFileNameED->hide();
 m_xFilePB->hide();
-m_xSubRegionFT->hide();
-m_xSubRegionED->hide();
 }
 }
 
@@ -1188,7 +1184,8 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::Toggleable&, 
rButton, void)
 {
 m_xDDECommandFT->hide();
 m_xFileNameFT->set_sensitive(bFile);
-m_xFileNameFT->show();
+if(!comphelper::LibreOfficeKit::isActive())
+m_xFileNameFT->show();
 m_xSubRegionED->show();
 m_xSubRegionFT->show();
 m_xSubRegionED->set_sensitive(bFile);
@@ -1755,7 +1752,8 @@ IMPL_LINK( SwInsertSectionTabPage, DDEHdl, 
weld::Toggleable&, rButton, void )
 {
 m_xDDECommandFT->hide();
 m_xFileNameFT->set_sensitive(bFile);
-m_xFileNameFT->show();
+if(!comphelper::LibreOfficeKit::isActive())
+m_xFileNameFT->show();
 m_xSubRegionFT->show();
 m_xSubRegionED->show();
 m_xSubRegionED->set_sensitive(bFile);


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

2023-05-10 Thread Michael Stahl (via logerrit)
 sw/source/core/text/itrpaint.cxx |   47 +++
 sw/source/core/text/porlay.cxx   |4 +++
 2 files changed, 37 insertions(+), 14 deletions(-)

New commits:
commit 21e6aea941d297545b1acd6592e0769af2b4d8a6
Author: Michael Stahl 
AuthorDate: Wed May 10 13:15:15 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed May 10 19:03:09 2023 +0200

sw: fix crashtesting assert on moz386569-2.odt

itrpaint.cxx:434: SwTextPainter::DrawTextLine: Assertion 
`!roTaggedParagraph' failed.

The list item has the soft hyphen as a bullet char.  Surprisingly this
creates a SwSoftHyphPortion followed by an empty SwNumberPortion.

(regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)

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

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 8bfe1631db72..827f8d4fcfd2 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -405,7 +405,9 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 }
 
 // multiple numbering portions are possible :(
-if (pPor->InNumberGrp() // also footnote label
+if ((pPor->InNumberGrp() // also footnote label
+// weird special case, bullet with soft hyphen
+ || (pPor->InHyphGrp() && pNext && pNext->InNumberGrp()))
 && !roTaggedLabel) // note: CalcPaintOfst may skip some portions
 {
 assert(isPDFTaggingEnabled);
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 7111709aa6bc..d00dcc4992c0 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2695,6 +2695,10 @@ bool SwParaPortion::HasNumberingPortion(FootnoteOrNot 
const eFootnote) const
 pPortion = pPortion->GetNextPortion();
 }
 }
+if (pPortion && pPortion->InHyphGrp())
+{   // weird special case, bullet with soft hyphen
+pPortion = pPortion->GetNextPortion();
+}
 return pPortion && pPortion->InNumberGrp()
 && (eFootnote == SwParaPortion::FootnoteToo || 
!pPortion->IsFootnoteNumPortion());
 }
commit ef692c98d43aeb861afb5b01f62e46344e835cb2
Author: Michael Stahl 
AuthorDate: Wed May 10 12:41:46 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed May 10 19:02:56 2023 +0200

sw: fix crashtesting assert on fdo38226-1.odt

frmpaint.cxx:804: SwTextFrame::PaintSwFrame: Assertion `!oTaggedLabel' 
failed.

This is similar to what was fixed in commit
0913da454e2dd88fb8fc83cddd20c735b79f73ca except that the last numbering
portion is now in a subsequent line that isn't painted at all due to the
"aLine.Y() <= nBottom" check in SwTextFrame::PaintSwFrame().

(regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)

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

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index e0fc758fb597..8bfe1631db72 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -408,7 +408,7 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 if (pPor->InNumberGrp() // also footnote label
 && !roTaggedLabel) // note: CalcPaintOfst may skip some portions
 {
-assert(isPDFTaggingEnabled); (void) isPDFTaggingEnabled;
+assert(isPDFTaggingEnabled);
 Por_Info aPorInfo(*pPor, *this, true); // open Lbl
 roTaggedLabel.emplace(nullptr, nullptr, , *pOut);
 }
@@ -456,22 +456,39 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
  pNext && pNext->IsHolePortion() ) ?
pNext :
nullptr;
-if (!pPor) // check if the end of the list label is off-screen
-{
-while (pNext)
+if (!pPor && isPDFTaggingEnabled && !roTaggedParagraph)
+{   // check if the end of the list label is off-screen
+auto FindEndOfNumbering = [&](SwLinePortion const* pP) {
+while (pP)
+{
+if (pP->InNumberGrp()
+&& !static_cast(pP)->HasFollow())
+{
+if (roTaggedLabel)
+{
+roTaggedLabel.reset();
+} // else, if the numbering isn't visible at all, no 
Lbl
+Frame_Info aFrameInfo(*m_pFrame); // open LBody
+roTaggedParagraph.emplace(nullptr, , 
nullptr, *GetInfo().GetOut());
+return true;
+}
+pP = 

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

2023-05-09 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/acccontext.cxx |7 ++-
 sw/source/core/access/acccontext.hxx |2 ++
 sw/source/core/access/accmap.cxx |4 +++-
 vcl/inc/svdata.hxx   |1 -
 vcl/source/app/svapp.cxx |6 --
 5 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 5c73c3aa6875b1e69b2d58a47ba823faf78b8aa2
Author: Caolán McNamara 
AuthorDate: Tue May 9 11:59:40 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 9 20:42:35 2023 +0200

drop unused ImplPrepareExitMsg

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

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 6d1d8adac015..448262492054 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -168,7 +168,6 @@ struct ImplSVAppData
 bool m_bUseSystemLoop = false;
 
 DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, void);
-DECL_STATIC_LINK(ImplSVAppData, ImplPrepareExitMsg, void*, void);
 DECL_STATIC_LINK(ImplSVAppData, ImplEndAllDialogsMsg, void*, void);
 DECL_STATIC_LINK(ImplSVAppData, ImplEndAllPopupsMsg, void*, void);
 };
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 4690c534df70..c61d9ea0f2aa 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -339,12 +339,6 @@ void Application::notifyInvalidation(tools::Rectangle 
const* /*pRect*/) const
 {
 }
 
-IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplPrepareExitMsg, void*, void )
-{
-//now close top level frames
-(void)GetpApp()->QueryExit();
-}
-
 void Application::Execute()
 {
 ImplSVData* pSVData = ImplGetSVData();
commit 5e99e5d734f19fe7299a3e390b23a93db971e013
Author: Caolán McNamara 
AuthorDate: Tue May 9 14:16:20 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 9 20:42:22 2023 +0200

Resolves: tdf#138512 don't crash on removing already Disposed a11y context

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

diff --git a/sw/source/core/access/acccontext.cxx 
b/sw/source/core/access/acccontext.cxx
index 37cb87fb3114..3445114b2d78 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -518,9 +518,14 @@ bool SwAccessibleContext::IsEditableState()
 return bRet;
 }
 
+bool SwAccessibleContext::IsDisposed() const
+{
+return !(GetFrame() && GetMap());
+}
+
 void SwAccessibleContext::ThrowIfDisposed()
 {
-if (!(GetFrame() && GetMap()))
+if (IsDisposed())
 {
 throw lang::DisposedException("object is nonfunctional",
 static_cast(this));
diff --git a/sw/source/core/access/acccontext.hxx 
b/sw/source/core/access/acccontext.hxx
index 32d13efbf513..d64939089622 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -349,6 +349,8 @@ public:
 virtual bool SetSelectedState(bool bSelected);
 bool  IsSelectedInDoc() const { return m_isSelectedInDoc; }
 
+bool IsDisposed() const;
+
 static OUString GetResource(TranslateId pResId,
 const OUString *pArg1 = nullptr,
 const OUString *pArg2 = nullptr);
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index fe0384ca0ea2..5cc2fd73801b 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2673,7 +2673,9 @@ void SwAccessibleMap::InvalidateCursorPosition( const 
SwFrame *pFrame )
 
 for (SwAccessibleParagraph* pAccPara : m_setParaRemove)
 {
-if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && 
pAccPara->getSelectedText().getLength() == 0)
+if (pAccPara && !pAccPara->IsDisposed() &&
+pAccPara->getSelectedAccessibleChildCount() == 0 &&
+pAccPara->getSelectedText().getLength() == 0)
 {
 if(pAccPara->SetSelectedState(false))
 {


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

2023-05-06 Thread Caolán McNamara (via logerrit)
 sw/source/ui/index/swuiidxmrk.cxx   |   11 +++
 vcl/source/filter/graphicfilter.cxx |2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 31a95393e69dbf1b200e323d25182c8b381ddce8
Author: Caolán McNamara 
AuthorDate: Sat May 6 19:28:58 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 6 22:00:49 2023 +0200

cid#1529287 Explicit null dereferenced

after

commit c55d5586304f23f9d8acbaffefba68a3a11c6175
Date:   Sat Apr 1 16:10:33 2023 +0100

BinaryDataContainer: hand out shared_ptr's to SvStreams.

and

commit 0f2581204a70038ed7ca78089a9bd96d158e02c0
Date:   Mon Apr 3 09:34:54 2023 +0100

BinaryDataContainer swap out implementation.

it is possible that a eLinkType of GfxLinkType::NativeGif and a
nStreamLength of 0 could lead to BinaryDataContainer::getAsStream
being called on a default ctored BinaryDataContainer which would
mean an mpImpl of null and a null dereference here

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

diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index e51b027be701..2cbe95e50194 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -912,7 +912,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& 
rIStream, sal_uInt64 size
 {
 bool bAnimated = false;
 Size aLogicSize;
-if (eLinkType == GfxLinkType::NativeGif)
+if (eLinkType == GfxLinkType::NativeGif && 
!aGraphicContent.isEmpty())
 {
 std::shared_ptr pMemoryStream = 
aGraphicContent.getAsStream();
 bAnimated = IsGIFAnimated(*pMemoryStream, aLogicSize);
commit 7ef7bf9304414488ed7ceec71bb9c2400ebb99b8
Author: Caolán McNamara 
AuthorDate: Sat May 6 19:14:25 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 6 22:00:41 2023 +0200

cid#1529285 Uninitialized pointer field

and

cid#1529286 Explicit null dereferenced

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

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index b810ad14aef8..140b4e48d0a0 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1094,7 +1094,7 @@ class SwCreateAuthEntryDlg_Impl : public 
weld::GenericDialogController
 std::unique_ptr m_xLocalPageCB;
 std::unique_ptr m_xLocalPageSB;
 std::unique_ptr m_xTargetTypeListBox;
-weld::Entry* m_xTargetURLField;
+weld::Entry* m_pTargetURLField;
 
 DECL_LINK(IdentifierHdl, weld::ComboBox&, void);
 DECL_LINK(ShortNameHdl, weld::Entry&, void);
@@ -1592,6 +1592,7 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
 , m_xBox(m_xBuilder->weld_container("box"))
 , m_xLeft(m_xBuilder->weld_container("leftgrid"))
 , m_xRight(m_xBuilder->weld_container("rightgrid"))
+, m_pTargetURLField(nullptr)
 {
 bool bLeft = true;
 sal_Int32 nLeftRow(0), nRightRow(0);
@@ -1696,8 +1697,9 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
 
 if (AUTH_FIELD_TARGET_URL == aCurInfo.nToxField)
 {
-m_xTargetURLField = m_pEdits[nIndex].get();
-m_xTargetURLField->set_sensitive(
+m_pTargetURLField = m_pEdits[nIndex].get();
+assert(m_xTargetTypeListBox);
+m_pTargetURLField->set_sensitive(
 m_xTargetTypeListBox->get_active() == 
SwAuthorityField::TargetType::UseTargetURL);
 }
 
@@ -1858,7 +1860,8 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, 
weld::ComboBox&, rBox, void)
 
 IMPL_LINK(SwCreateAuthEntryDlg_Impl, TargetTypeHdl, weld::ComboBox&, rBox, 
void)
 {
-m_xTargetURLField->set_sensitive(rBox.get_active() == 
SwAuthorityField::TargetType::UseTargetURL);
+assert(m_pTargetURLField);
+m_pTargetURLField->set_sensitive(rBox.get_active() == 
SwAuthorityField::TargetType::UseTargetURL);
 }
 
 IMPL_LINK(SwCreateAuthEntryDlg_Impl, BrowseHdl, weld::Button&, rButton, void)


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

2023-05-03 Thread Noel Grandin (via logerrit)
 sw/source/core/txtnode/thints.cxx |   22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

New commits:
commit d4ec4b875b952b05b8b1e0ba73dc31c1bcd27e43
Author: Noel Grandin 
AuthorDate: Wed May 3 15:44:52 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 3 19:13:03 2023 +0200

Portion can use sal_Int32 for its key

which makes it a little more cache-dense on 64-bit platforms

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

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 5b5a8aa96f2e..75e80abb242a 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2699,7 +2699,7 @@ void SwpHints::NoteInHistory( SwTextAttr *pAttr, const 
bool bNew )
 namespace {
 struct Portion {
 SwTextAttr* pTextAttr;
-int nKey;
+sal_Int32 nKey;
 bool isRsidOnlyAutoFormat;
 };
 typedef std::vector< Portion > PortionMap;
commit e19c102e87002f953f2eb28c154da8f54b70068e
Author: Noel Grandin 
AuthorDate: Wed May 3 14:37:07 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 3 19:12:52 2023 +0200

tdf#136991 speed up rtf load

(*) since we are searching an ordered list, and we know that we want the
"next" range, a linear search is faster than a binary search, especially
when the list becomes large enough to exceed cache.
(*) Since element "i" and element  "i+1", we can start the second
search where the first search left off
(*) Since we are moving forward through the list, we can limit
subsequent searches by the results from the previous loop search.

This reduces the load time by 15%

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

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 229df8e3cda9..5b5a8aa96f2e 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2782,15 +2782,16 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
 RsidOnlyAutoFormatFlagMap[nKey] = isRsidOnlyAutoFormat;
 }
 
-// we add data strictly in-order, so we can binary-search the vector
+// we add data strictly in-order, so we can forward-search the vector
 auto equal_range = [](PortionMap::const_iterator startIt, 
PortionMap::const_iterator endIt, int i)
 {
-Portion key { nullptr, i, false  };
-return std::equal_range(startIt, endIt, key,
-[] (const Portion& lhs, const Portion& rhs) -> bool
-{
-return lhs.nKey < rhs.nKey;
-});
+auto it1 = startIt;
+while (it1 != endIt && it1->nKey < i)
+++it1;
+auto it2 = it1;
+while (it2 != endIt && it2->nKey == i)
+++it2;
+return std::pair{ it1, it2 };
 };
 
 // check if portion i can be merged with portion i+1:
@@ -2798,13 +2799,14 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
 // IgnoreEnd at first / last portion
 int i = 0;
 int j = i + 1;
-// Store these outside the loop, because we limit the search area on 
subsequent searches.
+// Store this outside the loop, because we limit the search area on 
subsequent searches.
 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > 
aRange1 { aPortionMap.begin(), aPortionMap.begin() + aPortionMap.size() };
 while ( i <= nKey )
 {
 aRange1 = equal_range( aRange1.first, aPortionMap.begin() + 
aPortionMap.size(), i );
+// start the search for this one from where the first search ended.
 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > 
aRange2
-= equal_range( aRange1.first, aPortionMap.begin() + 
aPortionMap.size(), j );
+= equal_range( aRange1.second, aPortionMap.begin() + 
aPortionMap.size(), j );
 
 MergeResult eMerge = lcl_Compare_Attributes(i, j, aRange1, aRange2, 
RsidOnlyAutoFormatFlagMap);
 


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

2023-05-03 Thread Michael Stahl (via logerrit)
 sw/source/core/text/itrpaint.cxx |   21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 0913da454e2dd88fb8fc83cddd20c735b79f73ca
Author: Michael Stahl 
AuthorDate: Tue May 2 20:37:12 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed May 3 11:19:53 2023 +0200

sw: fix crashtesting assert on tdf124604-1.docx

frmpaint.cxx:801: SwTextFrame::PaintSwFrame: Assertion `... || 
oTaggedParagraph || ...' failed.

Here the problem is that the numbering label on the last paragraph is so
indented that it ends up off the right end of the page, and so the loop
in SwTextPainter::DrawTextLine() terminates before seeing it.

Sigh, add another special case ...

(regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)

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

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 54935069d60d..e0fc758fb597 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -456,6 +456,24 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
  pNext && pNext->IsHolePortion() ) ?
pNext :
nullptr;
+if (!pPor) // check if the end of the list label is off-screen
+{
+while (pNext)
+{
+if (!roTaggedParagraph && pNext->InNumberGrp()
+&& !static_cast(pNext)->HasFollow())
+{
+if (roTaggedLabel)
+{
+roTaggedLabel.reset();
+} // else, if the numbering isn't visible at all, no Lbl
+Frame_Info aFrameInfo(*m_pFrame); // open LBody
+roTaggedParagraph.emplace(nullptr, , nullptr, 
*GetInfo().GetOut());
+break;
+}
+pNext = pNext->GetNextPortion();
+}
+}
 }
 
 // delete underline font
commit 336a3c3d5b5b8e502cb6edfecf4f5fa1780b13e3
Author: Michael Stahl 
AuthorDate: Tue May 2 19:47:03 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed May 3 11:19:47 2023 +0200

sw: fix crashtesting assert on ooo95981-1.odt

itrpaint.cxx:433: void SwTextPainter::DrawTextLine: Assertion 
`roTaggedLabel' failed

The problem is that there are 2 SwNumberingPortions, and CalcPaintOfst()
skips one of them.  So the portion that doesn't have a follow may never
be iterated.

(regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)

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

diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index f88e6ec07c70..54935069d60d 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -406,9 +406,8 @@ void SwTextPainter::DrawTextLine( const SwRect , 
SwSaveClip ,
 
 // multiple numbering portions are possible :(
 if (pPor->InNumberGrp() // also footnote label
-&& !static_cast(pPor)->IsFollow())
+&& !roTaggedLabel) // note: CalcPaintOfst may skip some portions
 {
-assert(!roTaggedLabel);
 assert(isPDFTaggingEnabled); (void) isPDFTaggingEnabled;
 Por_Info aPorInfo(*pPor, *this, true); // open Lbl
 roTaggedLabel.emplace(nullptr, nullptr, , *pOut);


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

2023-04-28 Thread Noel Grandin (via logerrit)
 sw/source/core/access/accmap.cxx |   36 +++-
 sw/source/core/doc/doclay.cxx|2 +-
 2 files changed, 20 insertions(+), 18 deletions(-)

New commits:
commit f701edb6f72e50fae5857a81081d3503e5363b8f
Author: Noel Grandin 
AuthorDate: Fri Apr 28 15:26:29 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 28 21:14:12 2023 +0200

fix type checks of raw SdrObject's in writer

Which are no longer possible since SdrObject is abstract now.

I assume the original code was gunning for the kind of objects that
were being created before

commit 24a374ebc9da56cc6721e8feaa1e15ba850bf41d
tdf#154040 use a SdrObjKind::NewFrame for frame creation in writer
Instead of (ab)using SdrObjKind::NONE for the temporary, empty

Since that is only explanation that makes sense

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

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 6dc1feaa8dd5..f52542eda72a 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -197,10 +197,11 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
 return;
 const SdrHint *pSdrHint = static_cast(  );
-if (pSdrHint->GetObject() &&
-   ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) !=  
nullptr ||
-  dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) 
!=  nullptr ||
- isType(pSdrHint->GetObject()) ) )
+const SdrObject* pObj = pSdrHint->GetObject();
+if (pObj &&
+   ( dynamic_cast< const SwFlyDrawObj* >(pObj) ||
+ dynamic_cast< const SwVirtFlyDrawObj* >(pObj) ||
+ pObj->GetObjIdentifier() == SdrObjKind::NewFrame ) )
 {
 return;
 }
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index d316ba264b82..0ab802a5b6cd 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -141,7 +141,7 @@ rtl::Reference SwDoc::CloneSdrObj( const 
SdrObject& rObj, bool bMoveW
 SdrLayerID nLayerIdForClone = rObj.GetLayer();
 if ( dynamic_cast( pObj.get() ) ==  nullptr &&
  dynamic_cast( pObj.get() ) ==  nullptr &&
- !isType(pObj.get()) )
+ pObj->GetObjIdentifier() != SdrObjKind::NewFrame )
 {
 if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone 
) )
 {
commit 4ab38a26bf4a6d37da6c03f7fdb999d0cacf2e63
Author: Noel Grandin 
AuthorDate: Fri Apr 28 15:15:21 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 28 21:14:02 2023 +0200

Revert "remove dead code in SwDrawModellListener_Impl::Notify"

This reverts commit e8c265d06a9f34fec382d67c65c38189f16ee323.

Reason for revert: I misunderstood how the isType is working here

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

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index b7f00ffea291..6dc1feaa8dd5 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -196,32 +196,23 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
 // are no shapes that need to know about them.
 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
 return;
+const SdrHint *pSdrHint = static_cast(  );
+if (pSdrHint->GetObject() &&
+   ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) !=  
nullptr ||
+  dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) 
!=  nullptr ||
+ isType(pSdrHint->GetObject()) ) )
+{
+return;
+}
 
 OSL_ENSURE( mpDrawModel, "draw model listener is disposed" );
 if( !mpDrawModel )
 return;
 
-const SdrHint *pSdrHint = static_cast(  );
-
 document::EventObject aEvent;
 if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
 return;
 
-
-// right now, we're only handling the specific event necessary to fix this 
performance problem
-if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
-{
-auto pSdrObject = const_cast(pSdrHint->GetObject());
-uno::Reference xShape(pSdrObject->getUnoShape(), 
uno::UNO_QUERY);
-std::unique_lock aGuard(maListenerMutex);
-auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
-for (auto it = itBegin; it != itEnd; ++it)
-it->second->notifyShapeEvent(aEvent);
-}
-
-if (pSdrHint->GetObject() )
-return;
-
 {
 std::unique_lock g(maListenerMutex);
 ::comphelper::OInterfaceIteratorHelper4 aIter( g, maEventListeners );
@@ 

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

2023-04-28 Thread Noel Grandin (via logerrit)
 sw/source/core/access/accmap.cxx |   35 +--
 1 file changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 08c09017bfa5c72ba2b9614237fcf0c0f9738037
Author: Noel Grandin 
AuthorDate: Thu Apr 27 19:08:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 28 12:33:55 2023 +0200

fix regression in "tdf#119388 add new UNO listener/broadcaster"

Upon further inspection, I note that part
of the the code I added in

commit ec940941e0bd7db15c5cf7d43df82226e0d849dc
Author: Noel Grandin 
Date:   Tue Aug 20 17:03:13 2019 +0200
tdf#119388 add new UNO listener/broadcaster

would never have been able to be hit. Re-arrange a little to fix that.

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

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 5d21e969311c..b7f00ffea291 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -196,18 +196,32 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
 // are no shapes that need to know about them.
 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
 return;
-const SdrHint *pSdrHint = static_cast(  );
-if (pSdrHint->GetObject() )
-return;
 
 OSL_ENSURE( mpDrawModel, "draw model listener is disposed" );
 if( !mpDrawModel )
 return;
 
+const SdrHint *pSdrHint = static_cast(  );
+
 document::EventObject aEvent;
 if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
 return;
 
+
+// right now, we're only handling the specific event necessary to fix this 
performance problem
+if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
+{
+auto pSdrObject = const_cast(pSdrHint->GetObject());
+uno::Reference xShape(pSdrObject->getUnoShape(), 
uno::UNO_QUERY);
+std::unique_lock aGuard(maListenerMutex);
+auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
+for (auto it = itBegin; it != itEnd; ++it)
+it->second->notifyShapeEvent(aEvent);
+}
+
+if (pSdrHint->GetObject() )
+return;
+
 {
 std::unique_lock g(maListenerMutex);
 ::comphelper::OInterfaceIteratorHelper4 aIter( g, maEventListeners );
@@ -224,16 +238,6 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
 }
 }
 
-// right now, we're only handling the specific event necessary to fix this 
performance problem
-if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
-{
-auto pSdrObject = const_cast(pSdrHint->GetObject());
-uno::Reference xShape(pSdrObject->getUnoShape(), 
uno::UNO_QUERY);
-std::unique_lock aGuard(maListenerMutex);
-auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
-for (auto it = itBegin; it != itEnd; ++it)
-it->second->notifyShapeEvent(aEvent);
-}
 }
 
 void SwDrawModellListener_Impl::Dispose()
commit e8c265d06a9f34fec382d67c65c38189f16ee323
Author: Noel Grandin 
AuthorDate: Thu Apr 27 19:05:50 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 28 12:33:41 2023 +0200

remove dead code in SwDrawModellListener_Impl::Notify

The
isType(pSdrHint->GetObject()) ) )
code has always been unconditionally true, because SdrHint has always
returned an SdrObject,

ever since it was introduced in

commit 12b8488b9cf659adcafd4b998227397c57cf51ba
Author: Vladimir Glazounov 
Date:   Wed Jul 9 08:16:20 2003 +
INTEGRATION: CWS sw020 (1.44.80); FILE MERGED
2003/07/01 11:50:20 od 1.44.80.1: #110554#
 - correction: no broadcast
of notifications for writer fly frames and plane
-objects.

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

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 6dc1feaa8dd5..5d21e969311c 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -197,13 +197,8 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& 
/*rBC*/,
 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
 return;
 const SdrHint *pSdrHint = static_cast(  );
-if (pSdrHint->GetObject() &&
-   ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) !=  
nullptr ||
-  dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) 
!=  nullptr ||
- isType(pSdrHint->GetObject()) ) )
-{
+if (pSdrHint->GetObject() )
 return;
-}
 
 OSL_ENSURE( mpDrawModel, "draw model listener is disposed" );
 if( !mpDrawModel )


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

2023-04-27 Thread Caolán McNamara (via logerrit)
 sw/source/ui/misc/pagenumberdlg.cxx |1 +
 vcl/source/gdi/metaact.cxx  |6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 0b35b7953507491fe1ebdead9ac6ce592bd9b674
Author: Caolán McNamara 
AuthorDate: Thu Apr 27 13:02:36 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 27 16:43:21 2023 +0200

cid#1528191 Uninitialized scalar field

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

diff --git a/sw/source/ui/misc/pagenumberdlg.cxx 
b/sw/source/ui/misc/pagenumberdlg.cxx
index 0c6357e7ef99..a4a329f62ca6 100644
--- a/sw/source/ui/misc/pagenumberdlg.cxx
+++ b/sw/source/ui/misc/pagenumberdlg.cxx
@@ -34,6 +34,7 @@ SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent)
 , m_xPreviewImage(m_xBuilder->weld_image("previewImage"))
 , m_aPageNumberPosition(1) // bottom
 , m_aPageNumberAlignment(1) // center
+, m_nPageNumberType(SVX_NUM_CHARS_UPPER_LETTER)
 {
 m_xOk->connect_clicked(LINK(this, SwPageNumberDlg, OkHdl));
 m_xPageNumberPosition->connect_changed(LINK(this, SwPageNumberDlg, 
PositionSelectHdl));
commit b9f78bec3558937d45b3a9d730c1c9d40a9c58d6
Author: Caolán McNamara 
AuthorDate: Thu Apr 27 13:14:52 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 27 16:43:06 2023 +0200

ofz#58380 Integer-overflow

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

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 00921c609bca..eab791889ce6 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -925,8 +925,12 @@ static bool AllowScale(const Size& rSource, const Size& 
rDest)
 
 void MetaBmpScaleAction::Execute( OutputDevice* pOut )
 {
-if (!AllowScale(maBmp.GetSizePixel(), pOut->LogicToPixel(maSz)))
+Size aPixelSize(pOut->LogicToPixel(maSz));
+if (!AllowRect(tools::Rectangle(pOut->LogicToPixel(maPt), aPixelSize)) ||
+!AllowScale(maBmp.GetSizePixel(), aPixelSize))
+{
 return;
+}
 
 pOut->DrawBitmap( maPt, maSz, maBmp );
 }


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

2023-04-13 Thread Caolán McNamara (via logerrit)
 sw/source/core/inc/unofield.hxx |2 +-
 sw/source/core/unocore/unofield.cxx |8 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 5464a1dad69c52d011b194baf7d543ce8dd27748
Author: Caolán McNamara 
AuthorDate: Thu Apr 13 15:50:25 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 13 20:25:57 2023 +0200

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

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

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 03761b0f28b3..019da24f7241 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1297,6 +1297,8 @@ SwXTextField::getTextFieldMaster()
 SolarMutexGuard aGuard;
 
 SwFieldType* pType = m_pImpl->GetFieldType();
+if (!pType && !m_pImpl->m_pDoc) // tdf#152619
+return nullptr;
 uno::Reference const xRet(
 SwXFieldMaster::CreateXFieldMaster(m_pImpl->m_pDoc, pType));
 return xRet;
commit c0d3b50213ffbed1cd58226a35e325fb7c769ec0
Author: Caolán McNamara 
AuthorDate: Thu Apr 13 15:41:19 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 13 20:25:47 2023 +0200

pointer is always dereferenced make it a reference

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

diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 4a8138bf8df9..55214020c038 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -54,7 +54,7 @@ private:
 SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc);
 
 /// descriptor
-SwXFieldMaster(SwDoc* pDoc, SwFieldIds nResId);
+SwXFieldMaster(SwDoc& rDoc, SwFieldIds nResId);
 
 public:
 
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 226a595d0aaf..03761b0f28b3 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -506,8 +506,8 @@ SwXFieldMaster::getSupportedServiceNames()
 return { "com.sun.star.text.TextFieldMaster", 
getServiceName(m_pImpl->m_nResTypeId) };
 }
 
-SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, SwFieldIds const nResId)
-: m_pImpl(new 
Impl(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD),
 pDoc, nResId))
+SwXFieldMaster::SwXFieldMaster(SwDoc& rDoc, SwFieldIds const nResId)
+: m_pImpl(new 
Impl(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD),
 , nResId))
 {
 }
 
@@ -534,7 +534,7 @@ SwXFieldMaster::CreateXFieldMaster(SwDoc * pDoc, 
SwFieldType *const pType,
 {
 SwXFieldMaster *const pFM( pType
 ? new SwXFieldMaster(*pType, pDoc)
-: new SwXFieldMaster(pDoc, nResId));
+: new SwXFieldMaster(*pDoc, nResId));
 xFM.set(pFM);
 if (pType)
 {


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

2023-04-02 Thread Eike Rathke (via logerrit)
 sw/source/core/fields/usrfld.cxx |2 +-
 sw/source/ui/fldui/fldvar.cxx|   25 -
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 8c8457526a11fd03ed63a86ecdeeb270d5551049
Author: Eike Rathke 
AuthorDate: Sat Apr 1 17:19:12 2023 +0200
Commit: Eike Rathke 
CommitDate: Sun Apr 2 11:29:05 2023 +0200

Related: tdf#154218 Actually use the top format selected

Choosing a format of Additional Formats replaces the listbox
content with the format's category so the assumption that Text
would be the first entry does not hold. For such format still Text
was assumed and the input used as literal string, which defeated
the actual value formatting capabilities and a possible formula
interpretation for SwUserFieldType.

Change-Id: I199575469672a9f8bada2d2edde5036766977501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149910
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index e0db9b458294..bf2456ee8c41 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -1006,8 +1006,15 @@ IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, 
rBox, void)
 {
 if (nNumFormatPos != -1)
 {
-sal_uInt32 nNumberFormat = nNumFormatPos == 0 ? 0 : 
m_xNumFormatLB->GetFormat();
-if (nNumberFormat)
+// The first listbox entry is Text and second is
+// Formula and both are SAL_MAX_UINT32 :-/ but only if
+// not another yet unlisted of Additional Formats was
+// selected that may claim the top position :-/
+sal_uInt32 nNumberFormat = m_xNumFormatLB->GetFormat();
+const bool bText = (nNumFormatPos == 0 && 
nNumberFormat == SAL_MAX_UINT32);
+if (bText)
+nNumberFormat = 0;
+if (nNumberFormat && nNumberFormat != SAL_MAX_UINT32)
 {   // Switch language to office-language because 
Kalkulator expects
 // String in office format and it should be fed 
into dialog like
 // that
@@ -1015,7 +1022,7 @@ IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, 
rBox, void)
 }
 
static_cast(pType)->SetContent(m_xValueED->get_text(), 
nNumberFormat);
 static_cast(pType)->SetType(
-nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING 
: nsSwGetSetExpType::GSE_EXPR );
+bText ? nsSwGetSetExpType::GSE_STRING : 
nsSwGetSetExpType::GSE_EXPR );
 }
 }
 else
@@ -1049,8 +1056,16 @@ IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, 
rBox, void)
 
 if (nNumFormatPos != -1)
 {
-aType.SetType(nNumFormatPos == 0 ? 
nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
-aType.SetContent( sValue, nNumFormatPos == 0 ? 0 : 
m_xNumFormatLB->GetFormat() );
+// The first listbox entry is Text and second is
+// Formula and both are SAL_MAX_UINT32 :-/ but only if
+// not another yet unlisted of Additional Formats was
+// selected that may claim the top position :-/
+sal_uInt32 nNumberFormat = m_xNumFormatLB->GetFormat();
+const bool bText = (nNumFormatPos == 0 && 
nNumberFormat == SAL_MAX_UINT32);
+if (bText)
+nNumberFormat = 0;
+aType.SetType(bText ? nsSwGetSetExpType::GSE_STRING : 
nsSwGetSetExpType::GSE_EXPR);
+aType.SetContent( sValue, nNumberFormat );
 m_xSelectionLB->append_text(sName);
 m_xSelectionLB->select_text(sName);
 GetFieldMgr().InsertFieldType( aType ); // Userfld new
commit ba6d84b854e1abd3e913423dbcfaf192f7ade7f2
Author: Eike Rathke 
AuthorDate: Sat Apr 1 16:59:07 2023 +0200
Commit: Eike Rathke 
CommitDate: Sun Apr 2 11:28:56 2023 +0200

Resolves: tdf#154218 Tie user field content value string to content locale

... instead of the format's locale.

Change-Id: I83aeaa1433486241626fafc1ab9b4e2b3802d3eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149909
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 33a5e7096dc4..4f84b8b7bcbb 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -307,7 +307,7 @@ void 

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

2023-03-16 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/frmpage.cxx   |3 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9a123a6e63600ba3998d22bbc300ac4b65b3da2c
Author: Caolán McNamara 
AuthorDate: Thu Mar 16 16:40:38 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 20:19:38 2023 +

cid#1522030 Uninitialized scalar field

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1c27e8ccfdc6..6f0c1dd0952f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -339,6 +339,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsColumnBreakDeferred( false ),
 m_bIsPageBreakDeferred( false ),
 m_nLineBreaksDeferred( 0 ),
+m_bIsBreakDeferredByAnchor(false),
 m_bSdtEndDeferred(false),
 m_bParaSdtEndDeferred(false),
 m_bStartTOC(false),
commit aa252a2d019c350d90b7c4a090246451a6006b87
Author: Caolán McNamara 
AuthorDate: Thu Mar 16 14:36:18 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 20:19:31 2023 +

Resolves: tdf#152704 old image remains underneath when new image drawn

in this dialog preview widget

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

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index e9cf9974d0ed..94c86e95df5e 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2658,7 +2658,8 @@ void BmpWindow::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 void BmpWindow::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
 {
 // Setup
-rRenderContext.SetBackground();
+
rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor()));
+rRenderContext.Erase();
 // #i119307# the graphic might have transparency, set up white as the color
 // to use when drawing a rectangle under the image
 rRenderContext.SetLineColor(COL_WHITE);


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

2023-03-08 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/uiview/view2.cxx |4 ++--
 vcl/jsdialog/executor.cxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ee5f8b0bb59f974293a1810b5163ecc0cab6cc09
Author: Caolán McNamara 
AuthorDate: Wed Mar 8 12:07:42 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 8 19:54:26 2023 +

cid#1521854 Unchecked return value

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

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index fea09391a051..48f38beb99f7 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1243,8 +1243,8 @@ void SwView::Execute(SfxRequest )
 const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
 if( !pBase )
 {
-m_pWrtShell->GotoNextTOXBase();
-pBase = m_pWrtShell->GetCurTOX();
+if (m_pWrtShell->GotoNextTOXBase())
+pBase = m_pWrtShell->GetCurTOX();
 }
 
 bool bAutoMarkApplied = false;
commit fa0f8dd9d3dcbbee2d8c23341981635f9c55e55f
Author: Caolán McNamara 
AuthorDate: Wed Mar 8 12:03:35 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 8 19:54:15 2023 +

cid#1521852 Unchecked dynamic_cast

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

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index be17d4ef353c..313661557893 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -143,7 +143,7 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 }
 else if (sAction == "toggle")
 {
-
LOKTrigger::trigger_toggled(*dynamic_cast(pWidget));
+
LOKTrigger::trigger_toggled(dynamic_cast(*pWidget));
 return true;
 }
 }


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

2023-03-06 Thread Pranam Lashkari (via logerrit)
 sw/source/ui/chrdlg/chardlg.cxx  |6 +-
 vcl/inc/jsdialog/jsdialogbuilder.hxx |2 ++
 vcl/jsdialog/enabled.cxx |   14 +-
 vcl/jsdialog/jsdialogbuilder.cxx |   12 
 4 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit f3aca61de33b396bad10d08ddbb6f83e1a29ac13
Author: Pranam Lashkari 
AuthorDate: Fri Mar 3 02:30:55 2023 +0530
Commit: Szymon Kłos 
CommitDate: Mon Mar 6 09:47:08 2023 +

jsdialog: enabled format Character dialog (writer)

can be found from:
Tabbed view > Format > Character
Sidebar > Character
Compact view > Format > Character

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

diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index 0cf38a652bec..efa16ce22797 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -167,7 +168,10 @@ SwCharURLPage::SwCharURLPage(weld::Container* pPage, 
weld::DialogController* pCo
 m_xCharStyleContainer->hide();
 }
 
-m_xURLPB->connect_clicked(LINK( this, SwCharURLPage, InsertFileHdl));
+if(comphelper::LibreOfficeKit::isActive())
+m_xURLPB->hide(); // Hide browse button in online (not supported yet)
+else
+m_xURLPB->connect_clicked(LINK( this, SwCharURLPage, InsertFileHdl));
 m_xEventPB->connect_clicked(LINK( this, SwCharURLPage, EventHdl));
 
 SwView *pView = ::GetActiveView();
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 9a10f5bc0079..b76bd70597b0 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -34,12 +34,22 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 }
 
 if (// cui
-rUIFile == u"cui/ui/formatnumberdialog.ui"
+rUIFile == u"cui/ui/areatabpage.ui"
+|| rUIFile == u"cui/ui/borderpage.ui"
+|| rUIFile == u"cui/ui/charnamepage.ui"
+|| rUIFile == u"cui/ui/colorpage.ui"
+|| rUIFile == u"cui/ui/effectspage.ui"
+|| rUIFile == u"cui/ui/eventassigndialog.ui"
+|| rUIFile == u"cui/ui/fontfeaturesdialog.ui"
+|| rUIFile == u"cui/ui/formatnumberdialog.ui"
 || rUIFile == u"cui/ui/macroselectordialog.ui"
 || rUIFile == u"cui/ui/numberingformatpage.ui"
 || rUIFile == u"cui/ui/password.ui"
+|| rUIFile == u"cui/ui/positionpage.ui"
+|| rUIFile == u"cui/ui/queryduplicatedialog.ui"
 || rUIFile == u"cui/ui/similaritysearchdialog.ui"
 || rUIFile == u"cui/ui/splitcellsdialog.ui"
+|| rUIFile == u"cui/ui/twolinespage.ui"
 || rUIFile == u"cui/ui/widgettestdialog.ui"
 // scalc
 || rUIFile == u"modules/scalc/ui/analysisofvariancedialog.ui"
@@ -78,6 +88,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/schart/ui/wizelementspage.ui"
 // swriter
 || rUIFile == u"modules/swriter/ui/captionoptions.ui"
+|| rUIFile == u"modules/swriter/ui/characterproperties.ui"
+|| rUIFile == u"modules/swriter/ui/charurlpage.ui"
 || rUIFile == u"modules/swriter/ui/contentcontroldlg.ui"
 || rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui"
 || rUIFile == u"modules/swriter/ui/dropdownfielddialog.ui"
commit 26486cd12f47090fbd505b4b51828ee9e79bf3b7
Author: Szymon Kłos 
AuthorDate: Sat Mar 4 15:14:49 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 6 09:47:02 2023 +

jsdialog: send full update when showing BuilderPage

BuilderPage when created welds only container.
Detect that case when full update wasn't sent
in weld_dialog or weld_assistant so we show new
tab pages.

Fixes problem in Characters -> Higlight -> Color

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

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index b7b0e941f2e0..f9dea1a3987d 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -221,6 +221,8 @@ class JSInstanceBuilder final : public SalInstanceBuilder, 
public JSDialogSender
 std::string m_sTypeOfJSON;
 bool m_bHasTopLevelDialog;
 bool m_bIsNotebookbar;
+/// used to detect when we have to send Full Update in container handler
+bool m_bSentInitialUpdate;
 /// When LOKNotifier is set by jsdialogs code we need to release it
 VclPtr m_aWindowToRelease;
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index cc1ca91262c8..db2481897fa3 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ 

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

2023-02-26 Thread Caolán McNamara (via logerrit)
 sw/source/filter/html/swhtml.cxx   |   28 ++--
 sw/source/uibase/misc/redlndlg.cxx |6 ++
 sw/source/uibase/utlui/content.cxx |5 +
 3 files changed, 17 insertions(+), 22 deletions(-)

New commits:
commit ee03f6453e6f11f3db0742b08c53ad2c6b4ebb63
Author: Caolán McNamara 
AuthorDate: Sat Feb 25 21:13:42 2023 +
Commit: Caolán McNamara 
CommitDate: Sun Feb 26 14:51:38 2023 +

cid#1521509 Logically dead code

and

cid#1521507 Logically dead code

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

diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 80e35dec095f..304c4d4a3a50 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -246,8 +246,6 @@ void SwRedlineAcceptDlg::InitAuthors()
 
 SwView *pView = ::GetActiveView();
 SwWrtShell* pSh = pView ? pView->GetWrtShellPtr() : nullptr;
-if (!pSh)
-return;
 
 SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage();
 
@@ -1131,12 +1129,12 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectHdl, 
weld::TreeView&, void)
 
 IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void)
 {
+m_aSelectTimer.Stop();
+
 SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
 if (!pSh)
 return;
 
-m_aSelectTimer.Stop();
-
 bool bIsNotFormated = false;
 bool bSel = false;
 
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 29aac4eadee1..6b22c60dd2ed 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3757,10 +3757,7 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, 
void)
 // Query view because the Navigator is cleared too late.
 SwView* pView = GetParentWindow()->GetCreateView();
 
-if (!pView)
-return;
-
-SwWrtShell* pActShell = pView->GetWrtShellPtr();
+SwWrtShell* pActShell = pView ? pView->GetWrtShellPtr() : nullptr;
 if(pActShell && pActShell->GetWin() &&
 (pActShell->GetWin()->HasFocus() || m_bDocHasChanged || 
m_bViewHasChanged) &&
 !IsInDrag() && !pActShell->ActionPend())
commit 1b7ebea25fb94efa08160792c4eb6ae9e8a9147f
Author: Caolán McNamara 
AuthorDate: Sat Feb 25 21:54:46 2023 +
Commit: Caolán McNamara 
CommitDate: Sun Feb 26 14:51:23 2023 +

ofz#56345 Heap-buffer-overflow

happening since:

commit db115bec9254417ef7a3faf687478fe5424ab378
Date:   Tue Feb 14 18:03:55 2023 +0100

tdf#78510 sw,cui: split SvxLRSpaceItem for SwTextNode, SwTextFormatColl

but due to

commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03
Date:   Mon Nov 23 16:17:37 2015 +0100

tdf#94088 add import of HTML inline graphics

splitting the condition that used to fall through to default handling
with an unrelated RES_BACKGROUND case instead

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

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index f6f52c8a45a3..14dc6b67b2b7 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2950,6 +2950,20 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool 
bBeforeTable,
 pAttr = pPrev;
 continue;
 
+// tdf#94088 expand RES_BACKGROUND to the new fill attribute
+// definitions in the range [XATTR_FILL_FIRST .. 
XATTR_FILL_LAST].
+// This is the right place in the future if the adapted fill 
attributes
+// may be handled more directly in HTML import to handle them.
+case RES_BACKGROUND:
+{
+const SvxBrushItem& rBrush = static_cast< SvxBrushItem& 
>(*pAttr->m_pItem);
+SfxItemSetFixed 
aNewSet(m_xDoc->GetAttrPool());
+
+setSvxBrushItemAsFillAttributesToTargetSet(rBrush, 
aNewSet);
+
m_xDoc->getIDocumentContentOperations().InsertItemSet(aAttrPam, aNewSet, 
SetAttrMode::DONTREPLACE);
+break;
+}
+
 case RES_LR_SPACE:
 assert(false);
 break;
@@ -2967,20 +2981,6 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool 
bBeforeTable,
 OSL_ENSURE( false,
 "LRSpace set over multiple paragraphs!" );
 [[fallthrough]]; // (shouldn't reach this point anyway)
-
-// tdf#94088 expand RES_BACKGROUND to the new fill attribute
-// definitions in the range [XATTR_FILL_FIRST .. 
XATTR_FILL_LAST].
-// This is the right place in 

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

2023-02-15 Thread Noel Grandin (via logerrit)
 sw/source/core/access/accmap.cxx   |   38 -
 unotools/source/ucbhelper/ucblockbytes.cxx |   16 +++-
 unotools/source/ucbhelper/ucblockbytes.hxx |   15 +++
 3 files changed, 41 insertions(+), 28 deletions(-)

New commits:
commit 17827ea4974fce0a52d9986679223c670d9889ae
Author: Noel Grandin 
AuthorDate: Wed Feb 15 15:38:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 16 07:23:48 2023 +

osl::Mutex->std::mutex in UcbLockBytes

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

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index 83ef4f75ad0a..ad5289f9310f 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -978,35 +978,39 @@ UcbLockBytes::~UcbLockBytes()
 
 Reference < XInputStream > UcbLockBytes::getInputStream()
 {
-osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 m_bDontClose = true;
 return m_xInputStream;
 }
 
 void UcbLockBytes::setStream( const Reference& aStream )
 {
-osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 if ( aStream.is() )
 {
 m_xOutputStream = aStream->getOutputStream();
-setInputStream( aStream->getInputStream(), false );
+setInputStreamImpl( aGuard, aStream->getInputStream(), false );
 m_xSeekable.set( aStream, UNO_QUERY );
 }
 else
 {
 m_xOutputStream.clear();
-setInputStream( Reference < XInputStream >() );
+setInputStreamImpl( aGuard, Reference < XInputStream >() );
 }
 }
 
 bool UcbLockBytes::setInputStream( const Reference 
, bool bSetXSeekable )
+{
+std::unique_lock aGuard( m_aMutex );
+return setInputStreamImpl(aGuard, rxInputStream, bSetXSeekable);
+}
+
+bool UcbLockBytes::setInputStreamImpl( std::unique_lock& 
/*rGuard*/, const Reference , bool bSetXSeekable )
 {
 bool bRet = false;
 
 try
 {
-osl::MutexGuard aGuard( m_aMutex );
-
 if ( !m_bDontClose && m_xInputStream.is() )
 m_xInputStream->closeInput();
 
diff --git a/unotools/source/ucbhelper/ucblockbytes.hxx 
b/unotools/source/ucbhelper/ucblockbytes.hxx
index 67a2d6216316..d866015b250f 100644
--- a/unotools/source/ucbhelper/ucblockbytes.hxx
+++ b/unotools/source/ucbhelper/ucblockbytes.hxx
@@ -21,9 +21,9 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
+#include 
 
 namespace com
 {
@@ -63,7 +63,7 @@ class UcbLockBytes : public SvLockBytes
 {
 osl::Condition  m_aInitialized;
 osl::Condition  m_aTerminated;
-osl::Mutex  m_aMutex;
+std::mutex  m_aMutex;
 
 css::uno::Reference < css::io::XInputStream >  m_xInputStream;
 css::uno::Reference < css::io::XOutputStream > m_xOutputStream;
@@ -112,19 +112,19 @@ public:
 
 css::uno::Reference < css::io::XInputStream > getInputStream() const
 {
-osl::MutexGuard aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
+std::unique_lock aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
 return m_xInputStream;
 }
 
 css::uno::Reference < css::io::XOutputStream > getOutputStream() const
 {
-osl::MutexGuard aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
+std::unique_lock aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
 return m_xOutputStream;
 }
 
 css::uno::Reference < css::io::XSeekable > getSeekable() const
 {
-osl::MutexGuard aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
+std::unique_lock aGuard( const_cast< 
UcbLockBytes* >(this)->m_aMutex );
 return m_xSeekable;
 }
 
@@ -132,6 +132,11 @@ public:
 { m_bDontClose = true; }
 
 voidSetStreamValid();
+
+private:
+boolsetInputStreamImpl( std::unique_lock& 
rGuard,
+ const css::uno::Reference < 
css::io::XInputStream > ,
+ bool bSetXSeekable = true );
 };
 
 }
commit e8bb6e555cb4579ece3a9627d19a0a324620568a
Author: Noel Grandin 
AuthorDate: Wed Feb 15 19:08:40 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 16 07:23:38 2023 +

osl::Mutex->std::mutex in SwDrawModellListener_Impl

Change-Id: I150ac67a3f053046a6d6a7cd79323fa4595078c3
Reviewed-on: 

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

2023-02-09 Thread Mert Tumer (via logerrit)
 sw/source/ui/table/instable.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 8620b204b51a9e0552a0002f7f06292bdfad37a7
Author: Mert Tumer 
AuthorDate: Fri Mar 25 17:56:30 2022 +0300
Commit: Szymon Kłos 
CommitDate: Thu Feb 9 19:11:09 2023 +

make default selected table style to Default Table Style for only online

unfortunately when the table has a style 
sw/qa/uitest/writer_tests4/tdf115573.py fails
because tables that have pre-applied style resets the style of the elements 
in their cells
when a new row is inserted and the ui test above relies on that. For now 
this is LOK only

Signed-off-by: Mert Tumer 
Change-Id: I2f60376fc2d929498aef45259a5ef291922ccdcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132124
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146723
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index 7383da93bdef..a5aa4cd83853 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -148,8 +148,13 @@ void SwInsTableDlg::InitAutoTableFormat()
 // Change this min variable if you add autotable manually.
 minTableIndexInLb = 1;
 maxTableIndexInLb = minTableIndexInLb + 
static_cast(m_xTableTable->size());
-m_xLbFormat->select( minTableIndexInLb );
-m_tbIndex = lbIndexToTableIndex( minTableIndexInLb );
+// 1 means default table style
+// unfortunately when the table has a style 
sw/qa/uitest/writer_tests4/tdf115573.py fails
+// because tables that have pre-applied style resets the style of the 
elements in their cells
+// when a new row is inserted and the ui test above relies on that. For 
now this is LOK only
+m_lbIndex = comphelper::LibreOfficeKit::isActive() ? 1 : 0;
+m_xLbFormat->select(m_lbIndex);
+m_tbIndex = lbIndexToTableIndex(m_lbIndex);
 
 SelFormatHdl( *m_xLbFormat );
 }
commit ef46afe71751929b8b17d278d83c8e3ceefc862f
Author: Mert Tumer 
AuthorDate: Wed Mar 23 14:23:23 2022 +0300
Commit: Szymon Kłos 
CommitDate: Thu Feb 9 19:10:58 2023 +

sw: change inserttable style option default to 1

Right now it is default to NONE in the list
if the user explicitly choses otherwise but that
does not align with inserttable option on the toolbar
there it is defaulted to "Default Table Style"
1 means "Default Table Style"

Signed-off-by: Mert Tumer 
Change-Id: I1db19f0292ac6775653b0db3f2860fea9e3b0adf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131971
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146722
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index e10279add315..7383da93bdef 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -148,9 +148,8 @@ void SwInsTableDlg::InitAutoTableFormat()
 // Change this min variable if you add autotable manually.
 minTableIndexInLb = 1;
 maxTableIndexInLb = minTableIndexInLb + 
static_cast(m_xTableTable->size());
-m_lbIndex = 0;
-m_xLbFormat->select( m_lbIndex );
-m_tbIndex = lbIndexToTableIndex(m_lbIndex);
+m_xLbFormat->select( minTableIndexInLb );
+m_tbIndex = lbIndexToTableIndex( minTableIndexInLb );
 
 SelFormatHdl( *m_xLbFormat );
 }


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

2023-01-21 Thread Noel Grandin (via logerrit)
 sw/source/uibase/inc/uivwimp.hxx |5 +++--
 sw/source/uibase/inc/unodispatch.hxx |6 --
 sw/source/uibase/uiview/uivwimp.cxx  |   11 ---
 sw/source/uibase/uno/unodispatch.cxx |   12 
 4 files changed, 7 insertions(+), 27 deletions(-)

New commits:
commit b228565546176b459eb610e11c026d9493771280
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:51:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 06:50:49 2023 +

avoid some casting in SwView_Impl

by just storing the underlying type

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

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 0d401d92f78d..cbdfb18c7fc9 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -87,7 +87,7 @@ class SwXDispatchProviderInterceptor;
 class SwView_Impl
 {
 rtl::Reference< SwXDispatchProviderInterceptor > 
m_xDispatchProviderInterceptor;
-css::uno::Reference< css::view::XSelectionSupplier >  
mxXTextView;   // UNO object
+rtl::Reference< SwXTextView > mxXTextView;   // UNO object
 std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
 
 // temporary document for printing text of selection / multi selection
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index f5dc49330f83..86b545db8d68 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -63,8 +63,7 @@ SwView_Impl::~SwView_Impl()
 {
 if(m_xDispatchProviderInterceptor)
 m_xDispatchProviderInterceptor->Invalidate();
-view::XSelectionSupplier* pTextView = mxXTextView.get();
-static_cast(pTextView)->Invalidate();
+mxXTextView->Invalidate();
 mxXTextView.clear();
 if( mxScanEvtLstnr.is() )
mxScanEvtLstnr->ViewDestroyed();
@@ -92,8 +91,7 @@ view::XSelectionSupplier*   SwView_Impl::GetUNOObject()
 
 SwXTextView*SwView_Impl::GetUNOObject_Impl()
 {
-view::XSelectionSupplier* pTextView = mxXTextView.get();
-return static_cast(pTextView);
+return mxXTextView.get();
 }
 
 void SwView_Impl::ExecuteScan( SfxRequest& rReq )
commit 8aaa1778bb7b65b6e498c26fb03fd8757a3329ae
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:49:33 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jan 22 06:50:35 2023 +

XUnoTunnel->dynamic_cast in SwXDispatchProviderInterceptor

just store the underlying type, elides the need for dynamic_cast

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

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 352469f33401..0d401d92f78d 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -82,10 +82,11 @@ public:
 };
 
 class SwMailMergeConfigItem;
+class SwXDispatchProviderInterceptor;
 
 class SwView_Impl
 {
-css::uno::Reference< css::frame::XDispatchProviderInterceptor >   
m_xDispatchProviderInterceptor;
+rtl::Reference< SwXDispatchProviderInterceptor > 
m_xDispatchProviderInterceptor;
 css::uno::Reference< css::view::XSelectionSupplier >  
mxXTextView;   // UNO object
 std::vector< unotools::WeakReference< SwTransferable > > mxTransferables;
 
diff --git a/sw/source/uibase/inc/unodispatch.hxx 
b/sw/source/uibase/inc/unodispatch.hxx
index b748d5a1052d..961637788f5a 100644
--- a/sw/source/uibase/inc/unodispatch.hxx
+++ b/sw/source/uibase/inc/unodispatch.hxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -35,7 +34,6 @@ class SwXDispatchProviderInterceptor final : public 
cppu::WeakImplHelper
 <
 css::frame::XDispatchProviderInterceptor,
 css::lang::XEventListener,
-css::lang::XUnoTunnel,
 css::frame::XInterceptorInfo
 >
 {
@@ -79,10 +77,6 @@ public:
 // XEventListener
 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) 
override;
 
-//XUnoTunnel
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
 // XInterceptorInfo
 virtual css::uno::Sequence SAL_CALL getInterceptedURLs() 
override;
 
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index ee9693bd8c3b..f5dc49330f83 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -61,9 +61,8 @@ SwView_Impl::SwView_Impl(SwView* pShell)
 
 SwView_Impl::~SwView_Impl()
 {
-auto pInterceptor = 
comphelper::getFromUnoTunnel(m_xDispatchProviderInterceptor);
-if(pInterceptor)
-pInterceptor->Invalidate();
+

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

2023-01-21 Thread Noel Grandin (via logerrit)
 sw/source/uibase/inc/glosdoc.hxx  |5 -
 sw/source/uibase/inc/unoatxt.hxx  |6 --
 sw/source/uibase/misc/glosdoc.cxx |   13 +
 sw/source/uibase/uno/unoatxt.cxx  |   11 ---
 unotools/source/misc/ZipPackageHelper.cxx |7 +++
 5 files changed, 12 insertions(+), 30 deletions(-)

New commits:
commit b09954a06a2e45417ed503165ff05f49d49395a2
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:41:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 21 18:07:05 2023 +

XUnoTunnel->dynamic_cast in SwXAutoTextEntry

just store the concrete type in the vector, which avoids all the
dynamic_cast anyway

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

diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx
index e6d01aa4481c..9206a7d02011 100644
--- a/sw/source/uibase/inc/glosdoc.hxx
+++ b/sw/source/uibase/inc/glosdoc.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSDOC_HXX
 
 #include 
+#include 
 #include 
 
 class SwTextBlocks;
@@ -35,8 +36,10 @@ typedef tools::SvRef SwDocShellRef;
 #include 
 #include 
 
+class SwXAutoTextEntry;
+
 typedef std::vector< css::uno::WeakReference< css::text::XAutoTextGroup > > 
UnoAutoTextGroups;
-typedef std::vector< css::uno::WeakReference< css::text::XAutoTextEntry > > 
UnoAutoTextEntries;
+typedef std::vector< unotools::WeakReference< SwXAutoTextEntry > > 
UnoAutoTextEntries;
 
 #define GLOS_DELIM u'*'
 
diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx
index 1526c06570a4..15e66d063095 100644
--- a/sw/source/uibase/inc/unoatxt.hxx
+++ b/sw/source/uibase/inc/unoatxt.hxx
@@ -155,7 +155,6 @@ class SwXAutoTextEntry final
 <
 css::text::XAutoTextEntry,
 css::lang::XServiceInfo,
-css::lang::XUnoTunnel,
 css::text::XText,
 css::document::XEventsSupplier
 >
@@ -197,11 +196,6 @@ class SwXAutoTextEntry final
 public:
 SwXAutoTextEntry(SwGlossaries* , OUString aGroupName, OUString aEntryName);
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-//XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
 //XText
 virtual css::uno::Reference< css::text::XTextCursor >  SAL_CALL 
createTextCursor() override;
 virtual css::uno::Reference< css::text::XTextCursor >  SAL_CALL 
createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & 
aTextPosition) override;
diff --git a/sw/source/uibase/misc/glosdoc.cxx 
b/sw/source/uibase/misc/glosdoc.cxx
index a5348f9c1a59..474d643acf97 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -459,7 +459,7 @@ void SwGlossaries::RemoveFileFromList( const OUString& 
rGroup )
 aLoop != m_aGlossaryEntries.end();
 )
 {
-auto pEntry = 
comphelper::getFromUnoTunnel(aLoop->get());
+rtl::Reference pEntry = aLoop->get();
 if ( pEntry && ( pEntry->GetGroupName() == rGroup ) )
 {
 pEntry->Invalidate();
@@ -511,7 +511,7 @@ void SwGlossaries::InvalidateUNOOjects()
 // invalidate all the AutoTextEntry-objects
 for (const auto& rEntry : m_aGlossaryEntries)
 {
-auto pEntry = 
comphelper::getFromUnoTunnel(rEntry.get());
+rtl::Reference pEntry = rEntry.get();
 if ( pEntry )
 pEntry->Invalidate();
 }
@@ -584,17 +584,14 @@ Reference< text::XAutoTextEntry > 
SwGlossaries::GetAutoTextEntry(
 if ( USHRT_MAX == nIdx )
 throw container::NoSuchElementException();
 
-Reference< text::XAutoTextEntry > xReturn;
+rtl::Reference< SwXAutoTextEntry > xReturn;
 
 UnoAutoTextEntries::iterator aSearch( m_aGlossaryEntries.begin() );
 for ( ; aSearch != m_aGlossaryEntries.end(); )
 {
-Reference< lang::XUnoTunnel > xEntryTunnel( aSearch->get(), UNO_QUERY 
);
+rtl::Reference< SwXAutoTextEntry > pEntry( aSearch->get() );
 
-SwXAutoTextEntry* pEntry = nullptr;
-if ( xEntryTunnel.is() )
-pEntry = 
comphelper::getFromUnoTunnel(xEntryTunnel);
-else
+if ( !pEntry )
 {
 // the object is dead in the meantime -> remove from cache
 aSearch = m_aGlossaryEntries.erase( aSearch );
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index a3960425ad29..cb0166062af2 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -655,17 +655,6 @@ uno::Sequence< OUString > 
SwXAutoTextGroup::getSupportedServiceNames()
 return aRet;
 }
 
-const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit 

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

2023-01-21 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unorefmark.hxx   |   10 +-
 sw/source/core/inc/unosection.hxx   |8 
 sw/source/core/unocore/unorefmk.cxx |   12 
 sw/source/core/unocore/unosect.cxx  |   12 
 sw/source/core/unocore/unotext.cxx  |   26 ++
 5 files changed, 7 insertions(+), 61 deletions(-)

New commits:
commit e3e9f296e34a0d6bba7f13b57286087755a4bf03
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:34:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 21 17:00:55 2023 +

XUnoTunnel->dynamic_cast in SwXTextSection

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

diff --git a/sw/source/core/inc/unosection.hxx 
b/sw/source/core/inc/unosection.hxx
index a90732e4bd5c..7527a2f11088 100644
--- a/sw/source/core/inc/unosection.hxx
+++ b/sw/source/core/inc/unosection.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOSECTION_HXX
 #define INCLUDED_SW_SOURCE_CORE_INC_UNOSECTION_HXX
 
-#include 
 #include 
 #include 
 #include 
@@ -38,7 +37,6 @@ class SwSectionFormat;
 
 typedef ::cppu::ImplInheritanceHelper
 <   ::sfx2::MetadatableMixin
-,   css::lang::XUnoTunnel
 ,   css::lang::XServiceInfo
 ,   css::beans::XPropertySet
 ,   css::beans::XPropertyState
@@ -73,12 +71,6 @@ public:
 virtual css::uno::Reference< css::frame::XModel >
 GetModel() override;
 
-static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
-const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unosect.cxx 
b/sw/source/core/unocore/unosect.cxx
index 5bb3ff0c119d..69ec954d063a 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -225,18 +225,6 @@ SwXTextSection::~SwXTextSection()
 {
 }
 
-const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXTextSectionUnoTunnelId;
-return theSwXTextSectionUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXTextSection::getSomething(const uno::Sequence< sal_Int8 >& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 uno::Reference< text::XTextSection > SAL_CALL
 SwXTextSection::getParentSection()
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index f0cb0d87a0a8..55270c1d8ee9 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -566,12 +566,10 @@ SwXText::insertTextContent(
 
 // special treatment for Contents that do not replace the range, but
 // instead are "overlaid"
-const uno::Reference xContentTunnel(xContent,
-uno::UNO_QUERY);
 SwXDocumentIndexMark *const pDocumentIndexMark =
 dynamic_cast(xContent.get());
 SwXTextSection *const pSection =
-comphelper::getFromUnoTunnel(xContentTunnel);
+dynamic_cast(xContent.get());
 SwXBookmark *const pBookmark =
 dynamic_cast(xContent.get());
 SwXReferenceMark *const pReferenceMark =
@@ -633,10 +631,7 @@ SwXText::insertTextContentBefore(
 }
 
 bool bRet = false;
-const uno::Reference xSuccTunnel(xSuccessor,
-uno::UNO_QUERY);
-SwXTextSection *const pXSection =
-comphelper::getFromUnoTunnel(xSuccTunnel);
+SwXTextSection *const pXSection = 
dynamic_cast(xSuccessor.get());
 SwXTextTable *const pXTable = 
dynamic_cast(xSuccessor.get());
 SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : 
nullptr;
 SwTextNode * pTextNode = nullptr;
@@ -686,10 +681,7 @@ SwXText::insertTextContentAfter(
 throw lang::IllegalArgumentException();
 }
 
-const uno::Reference xPredTunnel(xPredecessor,
-uno::UNO_QUERY);
-SwXTextSection *const pXSection =
-comphelper::getFromUnoTunnel(xPredTunnel);
+SwXTextSection *const pXSection = 
dynamic_cast(xPredecessor.get());
 SwXTextTable *const pXTable = 
dynamic_cast(xPredecessor.get());
 SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : 
nullptr;
 bool bRet = false;
@@ -735,10 +727,7 @@ SwXText::removeTextContentBefore(
 }
 
 bool bRet = false;
-const uno::Reference xSuccTunnel(xSuccessor,
-uno::UNO_QUERY);
-SwXTextSection *const pXSection =
-comphelper::getFromUnoTunnel(xSuccTunnel);
+SwXTextSection *const pXSection = 
dynamic_cast(xSuccessor.get());
 SwXTextTable *const pXTable = 
dynamic_cast(xSuccessor.get());
 SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : 
nullptr;
 if(pTableFormat && pTableFormat->GetDoc() == GetDoc())
@@ -786,10 +775,7 @@ 

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

2023-01-21 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unoport.hxx |   13 -
 sw/source/core/unocore/unodraw.cxx |3 +--
 sw/source/core/unocore/unoobj2.cxx |3 +--
 sw/source/core/unocore/unoport.cxx |   11 ---
 sw/source/core/unocore/unoportenum.cxx |   12 
 5 files changed, 2 insertions(+), 40 deletions(-)

New commits:
commit c97441a5ee8a86a37fac0b506d0af0c2ae6d51fb
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:29:04 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 21 16:23:45 2023 +

XUnoTunnel->dynamic_cast in SwXTextPortion

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

diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 3acaafdfee00..1315334d3992 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -88,7 +87,6 @@ class SwXTextPortion : public cppu::WeakImplHelper
 css::text::XTextRange,
 css::beans::XPropertyState,
 css::container::XContentEnumerationAccess,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo
 >,
 public SvtListener
@@ -200,10 +198,6 @@ public:
 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) 
override;
 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& 
aPropertyName ) override;
 
-//XUnoTunnel
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
 //XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index add34e200e7b..b65f3d855902 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1986,14 +1986,13 @@ void SwXShape::attach(const uno::Reference< 
text::XTextRange > & xTextRange)
 // get access to SwDoc
 // (see also SwXTextRange::XTextRangeToSwPaM)
 const SwDoc* pDoc = nullptr;
-uno::Reference xRangeTunnel( xTextRange, uno::UNO_QUERY);
 if (auto pRange = dynamic_cast(xTextRange.get()))
 pDoc = >GetDoc();
 else if (auto pText = dynamic_cast(xTextRange.get()))
 pDoc = pText->GetDoc();
 else if (auto pCursor = dynamic_cast(xTextRange.get()))
 pDoc = pCursor->GetDoc();
-else if (auto pPortion = 
comphelper::getFromUnoTunnel(xRangeTunnel))
+else if (auto pPortion = dynamic_cast(xTextRange.get()))
 pDoc = >GetCursor().GetDoc();
 else if (auto pParagraph = dynamic_cast(xTextRange.get());
  pParagraph && pParagraph->GetTextNode())
diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index 38dc4eb8b827..c73c2c34a458 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1093,10 +1093,9 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
 {
 bool bRet = false;
 
-uno::Reference xRangeTunnel( xTextRange, uno::UNO_QUERY);
 SwXTextRange* pRange = dynamic_cast(xTextRange.get());
 OTextCursorHelper* pCursor = 
dynamic_cast(xTextRange.get());
-SwXTextPortion* pPortion = 
comphelper::getFromUnoTunnel(xRangeTunnel);
+SwXTextPortion* pPortion = dynamic_cast(xTextRange.get());
 SwXText* pText = dynamic_cast(xTextRange.get());
 SwXParagraph* pPara = dynamic_cast(xTextRange.get());
 SwXHeadFootText* pHeadText
diff --git a/sw/source/core/unocore/unoport.cxx 
b/sw/source/core/unocore/unoport.cxx
index 2d5e3b17c7a6..80de35b5f381 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -836,17 +836,6 @@ uno::Reference< container::XEnumeration >  
SwXTextPortion::createContentEnumerat
 return SwXParaFrameEnumeration::Create(rUnoCursor, PARAFRAME_PORTION_CHAR, 
m_pFrameFormat);
 }
 
-const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXTextPortionUnoTunnelId;
-return theSwXTextPortionUnoTunnelId.getSeq();
-}
-
-sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId )
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames()
 {
 return { "com.sun.star.text.TextContent" };
commit e4d1c60fbbbfe2bc1cee13c7f794c47d25bb0dbd
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:27:05 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 21 16:23:34 2023 +

XUnoTunnel->dynamic_cast in SwXTextPortionEnumeration

Change-Id: I85deec68e8ed99eb9fe266ac90da04087ab1e075
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145921
Tested-by: Jenkins

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

2023-01-20 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unolinebreak.hxx |8 +---
 sw/source/core/inc/unometa.hxx  |8 
 sw/source/core/unocore/unolinebreak.cxx |   11 ---
 sw/source/core/unocore/unorefmk.cxx |   13 -
 sw/source/core/unocore/unotext.cxx  |3 +--
 5 files changed, 2 insertions(+), 41 deletions(-)

New commits:
commit f14640a60344452d31edfe246aaad73f91116e57
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:26:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 16:34:39 2023 +

XUnoTunnel->dynamic_cast in SwXMeta

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

diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
index d662c1adba36..e0ebf444ccdb 100644
--- a/sw/source/core/inc/unometa.hxx
+++ b/sw/source/core/inc/unometa.hxx
@@ -24,7 +24,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -50,7 +49,6 @@ namespace sw {
 
 typedef ::cppu::ImplInheritanceHelper
 <   ::sfx2::MetadatableMixin
-,   css::lang::XUnoTunnel
 ,   css::lang::XServiceInfo
 ,   css::container::XChild
 ,   css::container::XEnumerationAccess
@@ -112,12 +110,6 @@ public:
 virtual css::uno::Reference< css::frame::XModel >
 GetModel() override;
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
-const css::uno::Sequence< sal_Int8 >& Identifier ) override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unorefmk.cxx 
b/sw/source/core/unocore/unorefmk.cxx
index d2af2e8eaf3f..f01d1f90e6aa 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -830,19 +830,6 @@ bool SwXMeta::CheckForOwnMemberMeta(const SwPaM & rPam, 
const bool bAbsorb)
 return bForceExpandHints;
 }
 
-const uno::Sequence< sal_Int8 > & SwXMeta::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXMetaUnoTunnelId;
-return theSwXMetaUnoTunnelId.getSeq();
-}
-
-// XUnoTunnel
-sal_Int64 SAL_CALL
-SwXMeta::getSomething( const uno::Sequence< sal_Int8 > & i_rId )
-{
-return comphelper::getSomethingImpl(i_rId, this);
-}
-
 // XServiceInfo
 OUString SAL_CALL
 SwXMeta::getImplementationName()
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index d6c75f01efea..f7e9451efba8 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -576,8 +576,7 @@ SwXText::insertTextContent(
 dynamic_cast(xContent.get());
 SwXReferenceMark *const pReferenceMark =
 comphelper::getFromUnoTunnel(xContentTunnel);
-SwXMeta *const pMeta =
-comphelper::getFromUnoTunnel(xContentTunnel);
+SwXMeta *const pMeta = dynamic_cast(xContent.get());
 auto* pContentControl = dynamic_cast(xContent.get());
 SwXTextField* pTextField = dynamic_cast(xContent.get());
 if (pTextField && pTextField->GetServiceId() != 
SwServiceType::FieldTypeAnnotation)
commit 00e38f77443253f574be66bfa696400353995155
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:24:51 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 16:34:28 2023 +

XUnoTunnel->dynamic_cast in SwXLineBreak

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

diff --git a/sw/source/core/inc/unolinebreak.hxx 
b/sw/source/core/inc/unolinebreak.hxx
index b1a26e604ad0..700f35e3fff3 100644
--- a/sw/source/core/inc/unolinebreak.hxx
+++ b/sw/source/core/inc/unolinebreak.hxx
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -34,7 +33,7 @@ class SwFormatLineBreak;
 /// UNO API wrapper around an SwFormatLineBreak, exposed as the 
com.sun.star.text.LineBreak service.
 class SwXLineBreak final
 : public cppu::WeakImplHelper
+  css::text::XTextContent>
 {
 class Impl;
 ::sw::UnoImplPtr m_pImpl;
@@ -80,11 +79,6 @@ public:
 addEventListener(const css::uno::Reference& 
xListener) override;
 void SAL_CALL
 removeEventListener(const css::uno::Reference& 
xListener) override;
-
-// XUnoTunnel
-sal_Int64 SAL_CALL getSomething(const css::uno::Sequence& 
rIdentifier) override;
-
-static const css::uno::Sequence& getUnoTunnelId();
 };
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNOLINEBREAK_HXX
diff --git a/sw/source/core/unocore/unolinebreak.cxx 
b/sw/source/core/unocore/unolinebreak.cxx
index 0079a992ec97..156af6f7ca88 100644
--- a/sw/source/core/unocore/unolinebreak.cxx
+++ b/sw/source/core/unocore/unolinebreak.cxx
@@ -283,15 +283,4 @@ void SAL_CALL SwXLineBreak::removeVetoableChangeListener(
 

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

2023-01-20 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unoidx.hxx  |   17 +
 sw/source/core/unocore/unoidx.cxx  |   24 
 sw/source/core/unocore/unotext.cxx |2 +-
 3 files changed, 2 insertions(+), 41 deletions(-)

New commits:
commit 349844128c876041311d30ba0e7740e73fc89261
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:23:46 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 13:30:18 2023 +

XUnoTunnel->dynamic_cast in SwXDocumentIndex

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

diff --git a/sw/source/core/inc/unoidx.hxx b/sw/source/core/inc/unoidx.hxx
index b87dff47a919..30eca1011a1d 100644
--- a/sw/source/core/inc/unoidx.hxx
+++ b/sw/source/core/inc/unoidx.hxx
@@ -20,7 +20,6 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_UNOIDX_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -41,7 +40,6 @@ class SwTOXType;
 
 typedef ::cppu::ImplInheritanceHelper
 <   ::sfx2::MetadatableMixin
-,   css::lang::XUnoTunnel
 ,   css::lang::XServiceInfo
 ,   css::beans::XPropertySet
 ,   css::container::XNamed
@@ -79,12 +77,6 @@ public:
 virtual css::uno::Reference< css::frame::XModel >
 GetModel() override;
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
-const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 46218e70efdd..dd123d618267 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -424,18 +424,6 @@ SwXDocumentIndex::CreateXDocumentIndex(
 return xIndex;
 }
 
-const uno::Sequence< sal_Int8 > & SwXDocumentIndex::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXDocumentIndexUnoTunnelId;
-return theSwXDocumentIndexUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXDocumentIndex::getSomething(const uno::Sequence< sal_Int8 >& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 OUString SAL_CALL
 SwXDocumentIndex::getImplementationName()
 {
commit 730ce18b6a25172a0a7a120b0aa3fd3e4f41319b
Author: Noel Grandin 
AuthorDate: Fri Jan 20 10:22:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 13:30:10 2023 +

XUnoTunnel->dynamic_cast in SwXDocumentIndexMark

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

diff --git a/sw/source/core/inc/unoidx.hxx b/sw/source/core/inc/unoidx.hxx
index 8b1b67fc6771..b87dff47a919 100644
--- a/sw/source/core/inc/unoidx.hxx
+++ b/sw/source/core/inc/unoidx.hxx
@@ -143,8 +143,7 @@ public:
 };
 
 typedef ::cppu::WeakImplHelper
-<   css::lang::XUnoTunnel
-,   css::lang::XServiceInfo
+<   css::lang::XServiceInfo
 ,   css::beans::XPropertySet
 ,   css::text::XDocumentIndexMark
 > SwXDocumentIndexMark_Base;
@@ -172,12 +171,6 @@ public:
 CreateXDocumentIndexMark(SwDoc & rDoc,
 SwTOXMark * pMark, TOXTypes eType = TOX_INDEX);
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
-const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 736f25200022..46218e70efdd 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1639,18 +1639,6 @@ namespace
 {
 }
 
-const uno::Sequence< sal_Int8 > & SwXDocumentIndexMark::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXDocumentIndexMarkUnoTunnelId;
-return theSwXDocumentIndexMarkUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXDocumentIndexMark::getSomething(const uno::Sequence< sal_Int8 >& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 OUString SAL_CALL
 SwXDocumentIndexMark::getImplementationName()
 {
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 85b7caa92395..2e8587b80e38 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -569,7 +569,7 @@ SwXText::insertTextContent(
 const uno::Reference xContentTunnel(xContent,
 uno::UNO_QUERY);
 SwXDocumentIndexMark *const pDocumentIndexMark =
-comphelper::getFromUnoTunnel(xContentTunnel);
+dynamic_cast(xContent.get());
 SwXTextSection *const pSection =
 comphelper::getFromUnoTunnel(xContentTunnel);
 SwXBookmark *const pBookmark =


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

2023-01-20 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unofield.hxx|8 
 sw/source/core/inc/unoflatpara.hxx |7 ---
 sw/source/core/unocore/unofield.cxx|   19 ++-
 sw/source/core/unocore/unoflatpara.cxx |   27 ---
 sw/source/core/unocore/unotext.cxx |3 +--
 5 files changed, 7 insertions(+), 57 deletions(-)

New commits:
commit 500a3b85a621cda94ea1502b58a4e2cacf58261e
Author: Noel Grandin 
AuthorDate: Thu Jan 19 10:20:52 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 08:46:13 2023 +

XUnoTunnel->dynamic_cast in SwXFlatParagraph

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

diff --git a/sw/source/core/inc/unoflatpara.hxx 
b/sw/source/core/inc/unoflatpara.hxx
index 6523609a6a5c..1d68a7d1c8db 100644
--- a/sw/source/core/inc/unoflatpara.hxx
+++ b/sw/source/core/inc/unoflatpara.hxx
@@ -23,7 +23,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -42,7 +41,6 @@ typedef ::cppu::ImplInheritanceHelper
 <   SwXTextMarkup
 ,   css::beans::XPropertySet
 ,   css::text::XFlatParagraph
-,   css::lang::XUnoTunnel
 > SwXFlatParagraph_Base;
 
 class SwXFlatParagraph final
@@ -95,11 +93,6 @@ public:
 
 using SwXTextMarkup::GetTextNode;
 
-static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 
>& rId) override;
-
 private:
 SwXFlatParagraph( const SwXFlatParagraph & ) = delete;
 SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete;
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index ea86284fb4ab..94adf66e08b6 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -328,20 +328,6 @@ css::uno::Sequence< ::sal_Int32 > SAL_CALL 
SwXFlatParagraph::getLanguagePortions
 return css::uno::Sequence< ::sal_Int32>();
 }
 
-const uno::Sequence< sal_Int8 >&
-SwXFlatParagraph::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXFlatParagraphUnoTunnelId;
-return theSwXFlatParagraphUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXFlatParagraph::getSomething(
-const uno::Sequence< sal_Int8 >& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 
nType, bool bAutomatic )
 : mpDoc(  ),
   mnType( nType ),
@@ -519,10 +505,8 @@ uno::Reference< text::XFlatParagraph > 
SwXFlatParagraphIterator::getParaAfter(co
 if (!mpDoc)
 return xRet;
 
-const uno::Reference xFPTunnel(xPara, uno::UNO_QUERY);
-SAL_WARN_IF(!xFPTunnel.is(), "sw.core", "invalid argument");
-SwXFlatParagraph* const 
pFlatParagraph(comphelper::getFromUnoTunnel(xFPTunnel));
-
+SwXFlatParagraph* const 
pFlatParagraph(dynamic_cast(xPara.get()));
+SAL_WARN_IF(!pFlatParagraph, "sw.core", "invalid argument");
 if ( !pFlatParagraph )
 return xRet;
 
@@ -564,11 +548,8 @@ uno::Reference< text::XFlatParagraph > 
SwXFlatParagraphIterator::getParaBefore(c
 if (!mpDoc)
 return xRet;
 
-const uno::Reference xFPTunnel(xPara, uno::UNO_QUERY);
-
-SAL_WARN_IF(!xFPTunnel.is(), "sw.core", "invalid argument");
-SwXFlatParagraph* const 
pFlatParagraph(comphelper::getFromUnoTunnel(xFPTunnel));
-
+SwXFlatParagraph* const 
pFlatParagraph(dynamic_cast(xPara.get()));
+SAL_WARN_IF(!pFlatParagraph, "sw.core", "invalid argument");
 if ( !pFlatParagraph )
 return xRet;
 
commit 468a50db510f2d001e656cbfb285445e265af47c
Author: Noel Grandin 
AuthorDate: Thu Jan 19 10:18:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 08:46:05 2023 +

XUnoTunnel->dynamic_cast in SwXTextField

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

diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 0de0e886df6b..4a8138bf8df9 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX
 #define INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX
 
-#include 
 #include 
 #include 
 #include 
@@ -109,7 +108,6 @@ typedef ::cppu::WeakImplHelper
 <   css::text::XDependentTextField
 ,   css::lang::XServiceInfo
 ,   css::beans::XPropertySet
-,   css::lang::XUnoTunnel
 ,   css::util::XUpdatable
 > SwXTextField_Base;
 
@@ -142,12 +140,6 @@ public:
 CreateXTextField(SwDoc * pDoc, SwFormatField const* pFormat,
 SwServiceType nServiceId = SwServiceType::Invalid);
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
- 

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

2023-01-20 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/unocontentcontrol.hxx |   12 +++-
 sw/source/core/inc/unofield.hxx  |7 ---
 sw/source/core/unocore/unocontentcontrol.cxx |   12 
 sw/source/core/unocore/unofield.cxx  |   17 +
 sw/source/core/unocore/unotext.cxx   |2 +-
 5 files changed, 5 insertions(+), 45 deletions(-)

New commits:
commit 54d12f7b1fef71ca47682fc7dc2764512bd23946
Author: Noel Grandin 
AuthorDate: Thu Jan 19 10:16:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 08:45:58 2023 +

XUnoTunnel->dynamic_cast in SwXFieldMaster

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

diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 7ec3d45b9ff9..0de0e886df6b 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -39,7 +39,6 @@ class SwSetExpField;
 typedef ::cppu::WeakImplHelper
 <   css::beans::XPropertySet
 ,   css::lang::XServiceInfo
-,   css::lang::XUnoTunnel
 ,   css::lang::XComponent
 > SwXFieldMaster_Base;
 
@@ -69,12 +68,6 @@ public:
 
 SwFieldType* GetFieldType(bool bDontCreate = false) const;
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(
-const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index ffb0fa8bd9f8..7da18e20 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -457,18 +457,6 @@ protected:
 virtual void Notify(const SfxHint& rHint) override;
 };
 
-const uno::Sequence< sal_Int8 > & SwXFieldMaster::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXFieldMasterUnoTunnelId;
-return theSwXFieldMasterUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL
-SwXFieldMaster::getSomething(const uno::Sequence< sal_Int8 >& rId)
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 OUString SAL_CALL
 SwXFieldMaster::getImplementationName()
 {
@@ -1306,10 +1294,7 @@ void SAL_CALL SwXTextField::attachTextFieldMaster(
 
 if (!m_pImpl->IsDescriptor())
 throw uno::RuntimeException();
-uno::Reference< lang::XUnoTunnel > xMasterTunnel(xFieldMaster, 
uno::UNO_QUERY);
-if (!xMasterTunnel.is())
-throw lang::IllegalArgumentException();
-SwXFieldMaster* pMaster = 
comphelper::getFromUnoTunnel(xMasterTunnel);
+SwXFieldMaster* pMaster = 
dynamic_cast(xFieldMaster.get());
 
 SwFieldType* pFieldType = pMaster ? pMaster->GetFieldType() : nullptr;
 if (!pFieldType ||
commit 080b78ea0c27659468ae084c0416017d91e4392d
Author: Noel Grandin 
AuthorDate: Thu Jan 19 10:14:16 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 08:45:50 2023 +

XUnoTunnel->dynamic_cast in SwXContentControl

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

diff --git a/sw/source/core/inc/unocontentcontrol.hxx 
b/sw/source/core/inc/unocontentcontrol.hxx
index 409564d5bb0e..6f3d903d9d1b 100644
--- a/sw/source/core/inc/unocontentcontrol.hxx
+++ b/sw/source/core/inc/unocontentcontrol.hxx
@@ -23,7 +23,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -48,9 +47,9 @@ class SwContentControl;
  * service.
  */
 class SwXContentControl
-: public cppu::WeakImplHelper
+: public cppu::WeakImplHelper
 {
 class Impl;
 sw::UnoImplPtr m_pImpl;
@@ -83,11 +82,6 @@ public:
 bool SetContentRange(SwTextNode*& rpNode, sal_Int32& rStart, sal_Int32& 
rEnd) const;
 const css::uno::Reference& GetParentText() const;
 
-static const css::uno::Sequence& getUnoTunnelId();
-
-// XUnoTunnel
-sal_Int64 SAL_CALL getSomething(const css::uno::Sequence& 
Identifier) override;
-
 // XServiceInfo
 OUString SAL_CALL getImplementationName() override;
 sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
diff --git a/sw/source/core/unocore/unocontentcontrol.cxx 
b/sw/source/core/unocore/unocontentcontrol.cxx
index ceb7a2933dd5..12fd86341603 100644
--- a/sw/source/core/unocore/unocontentcontrol.cxx
+++ b/sw/source/core/unocore/unocontentcontrol.cxx
@@ -346,18 +346,6 @@ bool SwXContentControl::SetContentRange(SwTextNode*& 
rpNode, sal_Int32& rStart,
 return false;
 }
 
-const uno::Sequence& SwXContentControl::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theSwXContentControlUnoTunnelId;
-return theSwXContentControlUnoTunnelId.getSeq();
-}
-
-// XUnoTunnel
-sal_Int64 SAL_CALL 

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

2023-01-18 Thread Mike Kaganski (via logerrit)
 sw/source/filter/ww8/ww8atr.cxx |   16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

New commits:
commit eb760387efbc804c8a8b0c1cc630d6dba2699284
Author: Mike Kaganski 
AuthorDate: Wed Jan 18 08:05:49 2023 +
Commit: Mike Kaganski 
CommitDate: Wed Jan 18 13:15:45 2023 +

Use std::clamp

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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b8dedd686840..fbdedc3b64c9 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3693,15 +3693,7 @@ void AttributeOutputBase::ParaNumRule( const 
SwNumRuleItem& rNumRule )
 {
 if( pTextNd->IsCountedInList())
 {
-int nLevel = pTextNd->GetActualListLevel();
-
-if (nLevel < 0)
-nLevel = 0;
-
-if (nLevel >= MAXLEVEL)
-nLevel = MAXLEVEL - 1;
-
-nLvl = static_cast< sal_uInt8 >(nLevel);
+nLvl = std::clamp(pTextNd->GetActualListLevel(), 0, MAXLEVEL - 1);
 
 if (GetExport().GetExportFormat() == MSWordExportBase::DOCX) // 
FIXME
 {
commit 81d333990474615ba1474e4e4229588b3869424f
Author: Mike Kaganski 
AuthorDate: Wed Jan 18 06:30:56 2023 +
Commit: Mike Kaganski 
CommitDate: Wed Jan 18 13:15:39 2023 +

Use dynamic_cast result instead of following static_cast

And make the dynamic_cast more specific, matching the now-removed
unconditional static_cast.

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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d0bed9c5c5bf..b8dedd686840 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3689,10 +3689,8 @@ void AttributeOutputBase::ParaNumRule( const 
SwNumRuleItem& rNumRule )
 return;
 }
 
-if ( dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) 
!= nullptr  )
+if (pTextNd = dynamic_cast(GetExport().m_pOutFormatNode); pTextNd)
 {
-pTextNd = static_cast(GetExport().m_pOutFormatNode);
-
 if( pTextNd->IsCountedInList())
 {
 int nLevel = pTextNd->GetActualListLevel();
@@ -3761,7 +3759,7 @@ void AttributeOutputBase::ParaNumRule( const 
SwNumRuleItem& rNumRule )
 }
 else if ( auto pC = dynamic_cast< const SwTextFormatColl *>( 
GetExport().m_pOutFormatNode ) )
 {
-if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() )
+if (pC->IsAssignedToListLevelOfOutlineStyle())
 nLvl = static_cast< sal_uInt8 >( 
pC->GetAssignedOutlineStyleLevel() );
 else
 {


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

2023-01-17 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/HeaderFooterWin.cxx |9 -
 vcl/unx/gtk3/gtkframe.cxx  |   46 +
 2 files changed, 53 insertions(+), 2 deletions(-)

New commits:
commit b5480ea6c55ff550390ac8d146a2996f7234712e
Author: Caolán McNamara 
AuthorDate: Tue Jan 17 16:56:57 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 17 21:04:52 2023 +

gtk4: some basis for experimenting on a11y support

4.10 makes GtkAccessible public

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

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 864e8934c7ad..d8c48891e757 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -832,6 +832,48 @@ void GtkSalFrame::resizeWindow( tools::Long nWidth, 
tools::Long nHeight )
 window_resize(nWidth, nHeight);
 }
 
+#if GTK_CHECK_VERSION(4,9,0)
+
+#define LO_TYPE_DRAWING_AREA (lo_drawing_area_get_type())
+#define LO_DRAWING_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), 
LO_TYPE_DRAWING_AREA, LODrawingArea))
+#define LO_IS_DRAWING_AREA(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
LO_TYPE_DRAWING_AREA))
+
+struct LODrawingArea
+{
+GtkDrawingArea parent_instance;
+};
+
+struct LODrawingAreaClass
+{
+GtkDrawingAreaClass parent_class;
+};
+
+static void lo_drawing_area_accessible_init(GtkAccessibleInterface *iface)
+{
+// doesn't actually do anything useful yet, just forward back to base impl 
for now
+GtkAccessibleInterface *parent_iface = 
static_cast(g_type_interface_peek_parent(iface));
+iface->get_at_context = parent_iface->get_at_context;
+iface->get_platform_state = parent_iface->get_platform_state;
+}
+
+G_DEFINE_TYPE_WITH_CODE(LODrawingArea, lo_drawing_area, GTK_TYPE_DRAWING_AREA,
+G_IMPLEMENT_INTERFACE(GTK_TYPE_ACCESSIBLE, 
lo_drawing_area_accessible_init))
+
+static void lo_drawing_area_class_init(LODrawingAreaClass* /*klass*/)
+{
+}
+
+static void lo_drawing_area_init(LODrawingArea* /*area*/)
+{
+}
+
+GtkWidget* lo_drawing_area_new()
+{
+return GTK_WIDGET(g_object_new(LO_TYPE_DRAWING_AREA, nullptr));
+}
+
+#endif
+
 #if !GTK_CHECK_VERSION(4,0,0)
 // tdf#124694 GtkFixed takes the max size of all its children as its
 // preferred size, causing it to not clip its child, but grow instead.
@@ -960,7 +1002,11 @@ void GtkSalFrame::InitCommon()
 #else
 m_pOverlay = GTK_OVERLAY(gtk_overlay_new());
 m_pFixedContainer = GTK_FIXED(gtk_fixed_new());
+#if GTK_CHECK_VERSION(4,9,0)
+m_pDrawingArea = GTK_DRAWING_AREA(lo_drawing_area_new());
+#else
 m_pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
+#endif
 #endif
 gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true);
 gtk_widget_set_size_request(GTK_WIDGET(m_pFixedContainer), 1, 1);
commit a21258c86e7fd1c64b11216a809f430627a06476
Author: Caolán McNamara 
AuthorDate: Tue Jan 17 10:25:54 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 17 21:04:39 2023 +

Resolves: tdf#153059 after ChangeHeaderOrFooter the control can be disposed

If the cursor is still on page one then when a header, via a control on
another page, is added it jumps back to that page, so the widget on the
now hidden page is removed, but the click handler hasn't completed so
the follow up action to change it from a "plus" button to a dropdown
menubutton was on a disposed widget.

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

diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 0e79e1481012..539a310b08aa 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -549,8 +549,13 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, 
weld::Button&, void)
 
 const SwPageFrame* pPageFrame = 
SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
 const OUString& rStyleName = pPageFrame->GetPageDesc()->GetName();
-rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
-
+{
+VclPtr xThis(this);
+rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
+//tdf#153059 after ChangeHeaderOrFooter is it possible that "this" is 
disposed
+if (xThis->isDisposed())
+return;
+}
 m_xPushButton->hide();
 m_xMenuButton->show();
 PaintButton();


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

2023-01-05 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   26 +---
 sw/source/core/doc/doccorr.cxx  |2 -
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |5 +--
 xmloff/source/text/XMLChangedRegionImportContext.cxx|   11 --
 xmloff/source/text/txtparai.cxx |   17 --
 5 files changed, 40 insertions(+), 21 deletions(-)

New commits:
commit e5b5d9c8d33b1dd87e5a50856ad02f21df59dc5b
Author: Michael Stahl 
AuthorDate: Thu Jan 5 18:07:03 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Jan 5 18:26:15 2023 +

tdf#152710 xmloff: ignore exception in XMLChangedRegionImportContext

The xOldCursor must be restored in all cases.

Also XMLParaContext triggers an exception which ends up aborting the
import.

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

diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx 
b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 4d43a8de3027..fe00c4a058b9 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -122,9 +122,14 @@ void 
XMLChangedRegionImportContext::endFastElement(sal_Int32 )
 {
 // delete last paragraph
 // (one extra paragraph was inserted in the beginning)
-rtl::Reference rHelper =
-GetImport().GetTextImport();
-rHelper->DeleteParagraph();
+try
+{
+GetImport().GetTextImport()->DeleteParagraph();
+}
+catch (uno::Exception const&)
+{   // cursor may be disposed - must reset to old cursor!
+SAL_INFO("xmloff.text", "XMLChangedRegionImportContext: delete 
paragraph failed");
+}
 
 GetImport().GetTextImport()->SetCursor(xOldCursor);
 xOldCursor = nullptr;
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 9844e2628c89..5fffc202612a 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1688,10 +1688,19 @@ void XMLParaContext::endFastElement(sal_Int32 )
 {
 rtl::Reference < XMLTextImportHelper > xTxtImport(
 GetImport().GetTextImport());
-Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
-if( !xCrsrRange.is() )
-return; // Robust (defective file)
-Reference < XTextRange > xEnd(xCrsrRange->getStart());
+Reference xEnd;
+try
+{
+Reference const xCrsrRange(xTxtImport->GetCursorAsRange());
+if (!xCrsrRange.is())
+return; // Robust (defective file)
+xEnd = xCrsrRange->getStart();
+}
+catch (uno::Exception const&)
+{
+SAL_INFO("xmloff.text", "XMLParaContext: cursor disposed?");
+return;
+}
 
 // if we have an id set for this paragraph, get a cursor for this
 // paragraph and register it with the given identifier
commit 475e59d29b7a6cc7f058af8ff863b3bb1a2a84a5
Author: Michael Stahl 
AuthorDate: Thu Jan 5 13:17:17 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Jan 5 18:26:02 2023 +

tdf#152710 sw: call and fix DeleteSection() instead

Turns out there's a function to delete a complete nodes array section -
and it has the same problem?  Why does it move indexes only from
startnode + 1?  Let's try to fix it to be more consistent.

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 8f2318a0b1c4..4376278d7dc1 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2070,6 +2070,18 @@ DocumentContentOperationsManager::CopyRange( SwPaM& 
rPam, SwPosition& rPos,
 return bRet;
 }
 
+static auto GetCorrPosition(SwPaM const& rPam) -> SwPosition
+{
+// tdf#152710 target position must be on node that survives deletion
+// so that PaMCorrAbs can invalidate SwUnoCursors properly
+return rPam.GetPoint()->GetNode().IsContentNode()
+? *rPam.GetPoint()
+: rPam.GetMark()->GetNode().IsContentNode()
+? *rPam.GetMark()
+// this would be the result in SwNodes::RemoveNode()
+: SwPosition(rPam.End()->GetNode(), SwNodeOffset(+1));
+}
+
 /// Delete a full Section of the NodeArray.
 /// The passed Node is located somewhere in the designated Section.
 void DocumentContentOperationsManager::DeleteSection( SwNode *pNode )
@@ -2087,8 +2099,9 @@ void DocumentContentOperationsManager::DeleteSection( 
SwNode *pNode )
 
 {
 // move all Cursor/StackCursor/UnoCursor out 

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

2022-12-18 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unofield.cxx |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit ad387d5b984c906505d25685065f710ed55d
Author: Caolán McNamara 
AuthorDate: Mon Jun 27 21:29:11 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Dec 18 23:08:05 2022 +

crashtesting: failure on load of forum-en-7529.odt

==324198== Invalid read of size 8
==324198==at 0x2D840D75: std::__uniq_ptr_impl >::_M_ptr() const (unique_ptr.h:191)
==324198==by 0x2D840D54: std::unique_ptr >::get() const (unique_ptr.h:462)
==324198==by 0x2D932B9B: SwFormatField::GetField() (fmtfld.hxx:122)
==324198==by 0x2E740E7B: SwXTextField::Impl::GetField() const 
(unofield.cxx:2634)
==324198==by 0x2E7487EB: SwXTextField::setPropertyValue(rtl::OUString 
const&, com::sun::star::uno::Any const&) (unofield.cxx:2150)
==324198==by 0x1100C123: 
XMLPropertyBackpatcher::ResolveId(rtl::OUString const&, short) 
(XMLPropertyBackpatcher.cxx:73)
==324198==by 0x1100BB0F: 
XMLTextImportHelper::InsertFootnoteID(rtl::OUString const&, short) 
(XMLPropertyBackpatcher.cxx:180)
==324198==by 0x10FF7E71: 
XMLFootnoteImportContext::startFastElement(int, 
com::sun::star::uno::Reference 
const&) (XMLFootnoteImportContext.cxx:99)
==324198==by 0x10C40361: SvXMLImport::startFastElement(int, 
com::sun::star::uno::Reference 
const&) (xmlimp.cxx:812)
==324198==by 0x28FBFE71: (anonymous 
namespace)::Entity::startElement((anonymous namespace)::Event const*) 
(fastparser.cxx:470)
==324198==by 0x28FBED4E: 
sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, 
unsigned char const*, unsigned char const*, int, unsigned char const**, int, 
unsigned char const**) (fastparser.cxx:1304)
==324198==by 0x28FBCCAF: (anonymous 
namespace)::call_callbackStartElement(void*, unsigned char const*, unsigned 
char const*, unsigned char const*, int, unsigned char const**, int, int, 
unsigned char const**) (fastparser.cxx:333)
==324198==  Address 0x259e2b68 is 328 bytes inside a block of size 344 
free'd
==324198==at 0x4848669: operator delete(void*) (vg_replace_malloc.c:923)
==324198==by 0x2E4EC2B1: SwFormatField::~SwFormatField() 
(atrfld.cxx:132)
==324198==by 0x8635DA2: SfxItemPool::Remove(SfxPoolItem const&) 
(itempool.cxx:802)
==324198==by 0x2E5BB014: SwTextAttr::Destroy(SwTextAttr*, SfxItemPool&) 
(txatbase.cxx:63)
==324198==by 0x2E594EE2: SwTextNode::DestroyAttr(SwTextAttr*) 
(thints.cxx:1302)
==324198==by 0x2E55C4EC: SwTextNode::~SwTextNode() (ndtxt.cxx:238)
==324198==by 0x2E55CB38: SwTextNode::~SwTextNode() (ndtxt.cxx:227)
==324198==by 0x2DEE048F: SwNodes::RemoveNode(o3tl::strong_int, o3tl::strong_int, bool) 
(nodes.cxx:2325)
==324198==by 0x2DEE50C2: SwNodes::DelNodes(SwNodeIndex const&, 
o3tl::strong_int) (nodes.cxx:1384)
==324198==by 0x2DC87B02: 
sw::DocumentContentOperationsManager::DeleteSection(SwNode*) 
(DocumentContentOperationsManager.cxx:2118)
==324198==by 0x2DD2BB66: 
sw::DocumentLayoutManager::DelLayoutFormat(SwFrameFormat*) 
(DocumentLayoutManager.cxx:285)
==324198==by 0x2DB0900E: DelFlyInRange(SwNodeIndex const&, SwNodeIndex 
const&, SwIndex const*, SwIndex const*) (docedt.cxx:254)

maybe this is a problem since the various changes associated with:

commit 2c9298e4f667a5dd7606d79890fcedfff0f66e26
Date:   Fri Apr 5 23:14:47 2019 +0200

SwXTextField::Impl FieldTypeClient: SwClient no more

commit e18359445fabad9ba1a704600e9ee327112cc6ae
Date:   Sun Apr 14 13:33:35 2019 +0200

[API CHANGE] SwXTextField: no more SwModify/SwClient

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

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 0e20949b3ced..84ae8fe2d8f5 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1967,6 +1967,7 @@ void SAL_CALL SwXTextField::attach(
 if (!pTextAttr)
 throw uno::RuntimeException("no SwTextAttr inserted?");  // could 
theoretically happen, if paragraph is full
 
+m_pImpl->ClearFieldType();
 const SwFormatField& rField = pTextAttr->GetFormatField();
 m_pImpl->SetFormatField(const_cast(), pDoc);
 
@@ -1990,7 +1991,6 @@ void SAL_CALL SwXTextField::attach(
 m_pImpl->GetFormatField()->SetXTextField(this);
 m_pImpl->m_wThis = this;
 m_pImpl->m_bIsDescriptor = false;
-m_pImpl->ClearFieldType();
 m_pImpl->m_pProps.reset();
 if (m_pImpl->m_bCallUpdate)
 update();
commit 487e1d73393ae9e6fe7961c8a95dd77a3598b510
Author: Caolán McNamara 
AuthorDate: Sun Dec 18 21:12:24 2022 +
Commit: Caolán McNamara 

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

2022-12-16 Thread Stephan Bergmann (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx  |   10 +++---
 sw/source/filter/ww8/rtfattributeoutput.cxx   |   16 +++-
 sw/source/uibase/docvw/SidebarWinAcc.cxx  |3 ++-
 toolkit/source/helper/unowrapper.cxx  |3 ++-
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |7 ++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|9 +++--
 6 files changed, 19 insertions(+), 29 deletions(-)

New commits:
commit 1ae71d8f09771ba7180be6ebdf89d36a31eb8625
Author: Stephan Bergmann 
AuthorDate: Fri Dec 16 15:10:40 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Dec 16 20:18:04 2022 +

Revert "fix math export/import in docx/rtf"

This reverts commit 2b5953a19e36a02040f2ff08bc87efe4785f80bd.  Whatever that
"gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast 
directly
to the target class" issue actually was:  For one, our GCC 7 baseline 
presumably
would no longer have such an issue.  And for another, the added asserts 
that the
results of the dynamic_casts must be non-null were presumably all bogus (and
have in part been reverted again in the meantime), as all the sources are 
UNO
interface types that can presumably point at implementation objects of other
than the expected C++ class types.  (Those dynamic_casts from UNO interface
types will be addressed in a follow-up commit.  See the upcoming commit
introducing loplugin:unocast on why such dynamic_casts are dangerous.)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
sw/qa/extras/rtfexport/rtfexport.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
sw/source/filter/ww8/rtfattributeoutput.cxx
writerfilter/Library_writerfilter.mk
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index da951db02828..b78094da7401 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -99,7 +99,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -5986,14 +5985,11 @@ void DocxAttributeOutput::WritePostponedMath(const 
SwOLENode* pPostponedMath, sa
 SAL_WARN("sw.ww8", "Broken math object");
 return;
 }
-// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast 
directly to the target class,
-// so help it with an intermediate cast. I'm not sure what exactly the problem 
is, seems to be unrelated
-// to RTLD_GLOBAL, so most probably a gcc bug.
-oox::FormulaExportBase* formulaexport = 
dynamic_cast(dynamic_cast(xInterface.get()));
-assert( formulaexport != nullptr );
-if (formulaexport)
+if( oox::FormulaExportBase* formulaexport = dynamic_cast< 
oox::FormulaExportBase* >( xInterface.get()))
 formulaexport->writeFormulaOoxml( m_pSerializer, 
GetExport().GetFilter().getVersion(),
 oox::drawingml::DOCUMENT_DOCX, nAlign);
+else
+OSL_FAIL( "Math OLE object cannot write out OOXML" );
 }
 
 void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject)
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index cd2f81a2463e..e81a299ec9f9 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -66,7 +66,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -4188,16 +4187,15 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const 
SwFlyFrameFormat* pFlyFrameFormat
 uno::Reference xClosable = xObj->getComponent();
 if (!xClosable.is())
 return false;
-// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast 
directly to the target class,
-// so help it with an intermediate cast. I'm not sure what exactly the 
problem is, seems to be unrelated
-// to RTLD_GLOBAL, so most probably a gcc bug.
-auto pBase
-= 
dynamic_cast(dynamic_cast(xClosable.get()));
-assert(pBase != nullptr);
-OStringBuffer aBuf;
+auto pBase = dynamic_cast(xClosable.get());
+SAL_WARN_IF(!pBase, "sw.rtf", "Math OLE object cannot write out RTF");
 if (pBase)
+{
+OStringBuffer aBuf;
 pBase->writeFormulaRtf(aBuf, m_rExport.GetCurrentEncoding());
-m_aRunText->append(aBuf);
+m_aRunText->append(aBuf);
+}
+
 // Replacement graphic.
 m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATHPICT " ");
 FlyFrameOLEReplacement(pFlyFrameFormat, rOLENode, rSize);
diff --git 

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

2022-12-16 Thread Caolán McNamara (via logerrit)
 sw/source/filter/html/swhtml.cxx |2 +-
 vcl/source/outdev/textline.cxx   |   10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit db7b9d1dbfe647c0b859ef0e0fa26e7132ab758b
Author: Caolán McNamara 
AuthorDate: Fri Dec 16 10:05:00 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 16 14:50:41 2022 +

ofz#54334 Timeout on 8192 width/height font and underline

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

diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 7c0f2f55d7ce..c6d97ef2c56b 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -276,6 +276,14 @@ void OutputDevice::ImplDrawWaveTextLine( tools::Long 
nBaseX, tools::Long nBaseY,
  Color aColor,
  bool bIsAbove )
 {
+static bool bFuzzing = utl::ConfigManager::IsFuzzing();
+if (bFuzzing && nWidth > 1000)
+{
+SAL_WARN("vcl.gdi", "drawLine, skipping suspicious WaveTextLine of 
length: "
+<< nWidth << " for fuzzing performance");
+return;
+}
+
 LogicalFontInstance* pFontInstance = mpFontInstance.get();
 tools::LongnLineHeight;
 tools::LongnLinePos;
commit e9203786165181badfc96dc121b0abc54778e8d5
Author: Caolán McNamara 
AuthorDate: Fri Dec 16 09:56:36 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 16 14:50:31 2022 +

ofz#54318 Timeout

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

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 6f9c71494461..99db72f38518 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -4628,7 +4628,7 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext 
*pContext )
 short nFirstLineIndent = 0; // indentations
 
 auto nDepth = m_aContexts.size();
-if (m_bFuzzing && nDepth > 512)
+if (m_bFuzzing && nDepth > 128)
 {
 SAL_WARN("sw.html", "Not applying any more text collection attributes 
to a deeply nested node for fuzzing performance");
 nDepth = 0;


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

2022-12-15 Thread Caolán McNamara (via logerrit)
 sw/source/ui/fldui/fldtdlg.cxx  |7 ++-
 sw/source/ui/index/swuiidxmrk.cxx   |   15 +--
 sw/source/uibase/app/docst.cxx  |3 -
 sw/source/uibase/envelp/syncbtn.cxx |3 -
 sw/source/uibase/ribbar/workctrl.cxx|   14 --
 sw/source/uibase/shells/translatehelper.cxx |2 
 sw/source/uibase/sidebar/PageColumnControl.cxx  |   12 ++---
 sw/source/uibase/sidebar/PageMarginControl.cxx  |   42 +---
 sw/source/uibase/sidebar/PageOrientationControl.cxx |   25 ++-
 sw/source/uibase/sidebar/PageSizeControl.cxx|   32 ++-
 sw/source/uibase/uiview/viewsrch.cxx|6 +-
 sw/source/uibase/utlui/bookctrl.cxx |6 ++
 12 files changed, 91 insertions(+), 76 deletions(-)

New commits:
commit 3867cb55ddf1bfdefdb7d7a198b275793efb9ed1
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 16:48:09 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 15 21:30:38 2022 +

sw: check SfxViewFrame::Current()

these ones looks potentially worth backporting

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

diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index a3886591a4c2..3c83365a206f 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -180,8 +180,11 @@ void SwFieldDlg::ReInitDlg()
 
 if (bNewMode != m_bHtmlMode)
 {
-SfxViewFrame::Current()->GetDispatcher()->
-Execute(FN_INSERT_FIELD, 
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->
+Execute(FN_INSERT_FIELD, 
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 Close();
 }
 
diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 8166b4713c7e..fe3fa2b67282 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -686,8 +686,11 @@ IMPL_LINK_NOARG(SwIndexMarkPane, CloseHdl, weld::Button&, 
void)
 {
 if (m_bNewMark)
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
-SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
+SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 }
 else
 {
@@ -819,7 +822,8 @@ IMPL_LINK_NOARG(SwIndexMarkPane, DelHdl, weld::Button&, 
void)
 else
 {
 CloseHdl(*m_xCloseBT);
-
SfxViewFrame::Current()->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
 }
 }
 
@@ -1218,8 +1222,11 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, CloseHdl, 
weld::Button&, void)
 {
 if(m_bNewEntry)
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 }
 else
 {
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index baa2a4ca74ef..f13b90b70af6 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1186,7 +1186,8 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString 
, SfxStyleFamily nFa
 const SwNumRule* pNumRule = pStyle->GetNumRule();
 if (pNumRule->GetName() == SwResId(STR_POOLNUMRULE_NOLIST))
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
 break;
 }
 const OUString sListIdForStyle =pNumRule->GetDefaultListId();
diff --git a/sw/source/uibase/envelp/syncbtn.cxx 
b/sw/source/uibase/envelp/syncbtn.cxx
index 0b61ff8a6c72..0b30c494b044 100644
--- a/sw/source/uibase/envelp/syncbtn.cxx
+++ b/sw/source/uibase/envelp/syncbtn.cxx
@@ -80,7 +80,8 @@ SwSyncBtnDlg::~SwSyncBtnDlg()
 
 IMPL_STATIC_LINK_NOARG(SwSyncBtnDlg, BtnHdl, weld::Button&, void)
 {
-SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, 
SfxCallMode::ASYNCHRON);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, 
SfxCallMode::ASYNCHRON);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 

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

2022-12-12 Thread Patrick Luby (via logerrit)
 sw/source/core/layout/layact.cxx |   12 ++
 vcl/osx/salinst.cxx  |   44 ---
 vcl/source/gdi/print3.cxx|   10 
 3 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 229b0ce8d8453960c213da59770b8bb7b6dca895
Author: Patrick Luby 
AuthorDate: Wed Dec 7 11:40:18 2022 -0500
Commit: Noel Grandin 
CommitDate: Tue Dec 13 06:08:54 2022 +

tdf#151700 Display native print panel even if there are no printers

Prevent the non-native LibreOffice PrintDialog from displaying by creating 
a fake printer if there are no printers. This will allow the LibreOffice 
printing code to proceed with native NSPrintOperation which will display the 
native print panel.

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

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 22a024bc265d..e8a4a94efc08 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -60,6 +60,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -125,6 +126,20 @@ public:
 
 }
 
+static OUString& getFallbackPrinterName()
+{
+static OUString aFallbackPrinter;
+
+if ( aFallbackPrinter.isEmpty() )
+{
+aFallbackPrinter = VclResId( SV_PRINT_DEFPRT_TXT );
+if ( aFallbackPrinter.isEmpty() )
+aFallbackPrinter = "Printer";
+}
+
+return aFallbackPrinter;
+}
+
 void AquaSalInstance::delayedSettingsChanged( bool bInvalidate )
 {
 osl::Guard< comphelper::SolarMutex > aGuard( *GetYieldMutex() );
@@ -765,6 +780,20 @@ void AquaSalInstance::GetPrinterQueueInfo( 
ImplPrnQueueList* pList )
 pList->Add( std::move(pInfo) );
 }
 }
+
+// tdf#151700 Prevent the non-native LibreOffice PrintDialog from
+// displaying by creating a fake printer if there are no printers. This
+// will allow the LibreOffice printing code to proceed with native
+// NSPrintOperation which will display the native print panel.
+if ( !nNameCount )
+{
+std::unique_ptr pInfo(new SalPrinterQueueInfo);
+pInfo->maPrinterName= getFallbackPrinterName();
+pInfo->mnStatus = PrintQueueFlags::NONE;
+pInfo->mnJobs   = 0;
+
+pList->Add( std::move(pInfo) );
+}
 }
 
 void AquaSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* )
@@ -776,7 +805,9 @@ OUString AquaSalInstance::GetDefaultPrinter()
 // #i113170# may not be the main thread if called from UNO API
 SalData::ensureThreadAutoreleasePool();
 
-if( maDefaultPrinter.isEmpty() )
+// WinSalInstance::GetDefaultPrinter() fetches current default printer
+// on every call so do the same here
+OUString aDefaultPrinter;
 {
 NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo];
 SAL_WARN_IF( !pPI, "vcl", "no print info" );
@@ -786,13 +817,20 @@ OUString AquaSalInstance::GetDefaultPrinter()
 SAL_WARN_IF( !pPr, "vcl", "no printer in default info" );
 if( pPr )
 {
+// Related: tdf#151700 Return the name of the fake printer if
+// there are no printers so that the LibreOffice printing code
+// will be able to find the the fake printer returned by
+// AquaSalInstance::GetPrinterQueueInfo()
 NSString* pDefName = [pPr name];
 SAL_WARN_IF( !pDefName, "vcl", "printer has no name" );
-maDefaultPrinter = GetOUString( pDefName );
+if ( pDefName && [pDefName length])
+aDefaultPrinter = GetOUString( pDefName );
+else
+aDefaultPrinter = getFallbackPrinterName();
 }
 }
 }
-return maDefaultPrinter;
+return aDefaultPrinter;
 }
 
 SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* 
pQueueInfo,
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index e8acbcd38297..dc2fc5e74d35 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -538,6 +538,16 @@ bool 
Printer::PreparePrintJob(std::shared_ptr xController,
 {
 }
 }
+#ifdef MACOSX
+else
+{
+// The PrintDialog updates the printer list in its constructor so do
+// the same for printers that bring up their own dialog since. Not
+// sure if this is needed or not on Windows or X11, so limit only to
+// macOS for now.
+Printer::updatePrinters();
+}
+#endif
 
 xController->pushPropertiesToPrinter();
 return true;
commit d491791dad8c3a946dac8c4dfd28ef0c4cb65ce5
Author: Patrick Luby 
AuthorDate: Sun Dec 11 14:41:15 2022 -0500
Commit: Noel Grandin 
CommitDate: Tue Dec 13 06:08:40 2022 +

Fix infinite loop in sw_ooxmlexport17 unit test on macOS Intel

When running the sw_ooxmlexport17 unit test on 

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

2022-11-21 Thread Skyler Grey (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx |   22 +
 sw/source/ui/dialog/swdlgfact.hxx |   14 
 sw/source/ui/frmdlg/cption.cxx|   34 -
 sw/source/uibase/shells/tabsh.cxx |   60 --
 vcl/jsdialog/enabled.cxx  |5 ++-
 5 files changed, 90 insertions(+), 45 deletions(-)

New commits:
commit 19d02a1267cfa1e7a950af31a77d4a7888594630
Author: Skyler Grey 
AuthorDate: Fri Aug 12 10:31:42 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Nov 21 11:17:21 2022 +0100

Make the number format dialog an async jsdialog

- The dialog needs to be async in order for multiple people to be able
  to use it at once
- If we don't make the item set a shared pointer, we will crash out with
  an error when we try to copy it after the OK button is pressed
- As the dialog is tabbed, we need to enable the dialog for all UI files
  that the dialog uses rather than just the main dialog UI file

Change-Id: I8d684e9e9ad49b8a85ee940864d7219b4115a6e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138270
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142990
Tested-by: Jenkins

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 68135716fcb9..56bce661390d 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -110,6 +110,16 @@ short SwAbstractSfxController_Impl::Execute()
 return m_xDlg->run();
 }
 
+short AbstractNumFormatDlg_Impl::Execute()
+{
+return m_xDlg->run();
+}
+
+bool AbstractNumFormatDlg_Impl::StartExecuteAsync(AsyncContext )
+{
+return SfxSingleTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractSwAsciiFilterDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -356,11 +366,21 @@ const SfxItemSet* 
SwAbstractSfxController_Impl::GetOutputItemSet() const
 return m_xDlg->GetOutputItemSet();
 }
 
+const SfxItemSet* AbstractNumFormatDlg_Impl::GetOutputItemSet() const
+{
+return m_xDlg->GetOutputItemSet();
+}
+
 void SwAbstractSfxController_Impl::SetText(const OUString& rStr)
 {
 m_xDlg->set_title(rStr);
 }
 
+void AbstractNumFormatDlg_Impl::SetText(const OUString& rStr)
+{
+m_xDlg->set_title(rStr);
+}
+
 void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
 {
 m_xDlg->FillOptions(rOptions);
@@ -833,7 +853,7 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, 
const SfxItemSet& rSet)
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 rSet));
+return 
VclPtr::Create(std::make_shared(pParent,
 rSet));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index c0326249a15b..5e110dfbdd59 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -126,6 +126,20 @@ public:
 virtual void SetText(const OUString& rStr) override;
 };
 
+class AbstractNumFormatDlg_Impl : public SfxAbstractDialog
+{
+std::shared_ptr m_xDlg;
+public:
+explicit 
AbstractNumFormatDlg_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;
+};
+
 class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg
 {
 std::unique_ptr m_xDlg;
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index ab93b027e69f..3082c5e36e98 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -695,58 +695,62 @@ void SwTableShell::Execute(SfxRequest )
 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast( 
pView) !=  nullptr );
 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< 
sal_uInt16 >(eMetric)));
 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-SfxItemSetFixed
-aCoreSet( GetPool() );
+auto pCoreSet = 
std::make_shared>( GetPool() );
 
 SfxItemSetFixed
- aBoxSet( *aCoreSet.GetPool() );
+ aBoxSet( *pCoreSet->GetPool() );
 rSh.GetTableBoxFormulaAttrs( aBoxSet );
 
 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
 if(eState == SfxItemState::DEFAULT)
 {
-aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));

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

2022-11-16 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/notxtfrm.cxx |  467 
 sw/source/core/inc/notxtfrm.hxx |7 
 2 files changed, 247 insertions(+), 227 deletions(-)

New commits:
commit e1ecbe9335161accdea440d6b6e72c85cb032341
Author: Noel Grandin 
AuthorDate: Wed Nov 16 16:03:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 17 08:34:58 2022 +0100

flatten the ImplPaint* methods a little

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

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 1ac58cf5efc6..6d11624da3b1 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1211,141 +1211,141 @@ void SwNoTextFrame::ImplPaintPictureGraphic( 
vcl::RenderContext* pOut,
 }
 }
 
-if( bContinue )
+if( !bContinue )
+return;
+
+if( rGrfObj.GetGraphic().IsSupportedGraphic())
 {
-if( rGrfObj.GetGraphic().IsSupportedGraphic())
+const bool bAnimate = rGrfObj.IsAnimated() &&
+ !pShell->IsPreview() &&
+ 
!pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
+// #i9684# Stop animation during printing/pdf export
+  pShell->GetWin();
+
+if( bAnimate &&
+FindFlyFrame() != ::GetFlyFromMarked( nullptr, pShell ))
 {
-const bool bAnimate = rGrfObj.IsAnimated() &&
- !pShell->IsPreview() &&
- 
!pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
-// #i9684# Stop animation during printing/pdf export
-  pShell->GetWin();
-
-if( bAnimate &&
-FindFlyFrame() != ::GetFlyFromMarked( nullptr, pShell ))
+OutputDevice* pVout;
+if( pOut == pShell->GetOut() && SwRootFrame::FlushVout() )
 {
-OutputDevice* pVout;
-if( pOut == pShell->GetOut() && SwRootFrame::FlushVout() )
-{
-pVout = pOut;
-pOut = pShell->GetOut();
-}
-else if( pShell->GetWin() && pOut->IsVirtual() )
-{
-pVout = pOut;
-pOut = pShell->GetWin()->GetOutDev();
-}
-else
-pVout = nullptr;
-
-OSL_ENSURE( !pOut->IsVirtual() ||
-pShell->GetViewOptions()->IsPDFExport() || 
pShell->isOutputToWindow(),
-"pOut should not be a virtual device" );
-
-pGrfNd->StartGraphicAnimation(pOut, rAlignedGrfArea.Pos(),
-rAlignedGrfArea.SSize(), 
reinterpret_cast(this),
-pVout );
+pVout = pOut;
+pOut = pShell->GetOut();
+}
+else if( pShell->GetWin() && pOut->IsVirtual() )
+{
+pVout = pOut;
+pOut = pShell->GetWin()->GetOutDev();
 }
 else
+pVout = nullptr;
+
+OSL_ENSURE( !pOut->IsVirtual() ||
+pShell->GetViewOptions()->IsPDFExport() || 
pShell->isOutputToWindow(),
+"pOut should not be a virtual device" );
+
+pGrfNd->StartGraphicAnimation(pOut, rAlignedGrfArea.Pos(),
+rAlignedGrfArea.SSize(), 
reinterpret_cast(this),
+pVout );
+}
+else
+{
+// MM02 To allow system-dependent buffering of the involved
+// bitmaps it is necessary to re-use the involved primitives
+// and their already executed decomposition (also for
+// performance reasons). This is usually done in DrawingLayer
+// by using the VOC-Mechanism (see descriptions elsewhere).
+// To get that here, make the involved SwNoTextFrame (this)
+// a sdr::contact::ViewContact supplier by supporting
+// a GetViewContact() - call. For ObjectContact we can use
+// the already existing ObjectContact from the involved
+// DrawingLayer. For this, the helper classes
+// ViewObjectContactOfSwNoTextFrame
+// ViewContactOfSwNoTextFrame
+// are created which support the VOC-mechanism in its minimal
+// form. This allows automatic and view-dependent (multiple edit
+// windows, print, etc.) re-use of the created primitives.
+// Also: Will be very useful when completely changing the Writer
+// repaint to VOC and Primitives, too.
+static const char* 

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

2022-11-10 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   73 ++-
 1 file changed, 38 insertions(+), 35 deletions(-)

New commits:
commit 1c11bfc0420245ee19ff9ef1f09eaac79bae53e1
Author: Kevin Suo 
AuthorDate: Thu Nov 10 16:26:14 2022 +0800
Commit: Mike Kaganski 
CommitDate: Fri Nov 11 08:30:47 2022 +0100

Fix code block indent in SwTextGridPage::PutGridItem

Use 4 spaces rather than 8.

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

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 545694643b81..2e9f99e9d538 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -227,39 +227,39 @@ DeactivateRC SwTextGridPage::DeactivatePage( SfxItemSet* )
 
 void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 {
-SwTextGridItem aGridItem;
-aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE :
-m_xLinesGridRB->get_active() ? GRID_LINES_ONLY : GRID_LINES_CHARS 
);
-aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active());
-aGridItem.SetLines( static_cast< sal_uInt16 
>(m_xLinesPerPageNF->get_value()) );
-aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
-m_bRubyUserValue ? m_nRubyUserValue :
-
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
-// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
-// When in normal mode, the ruby height should be zero.
-if (m_bSquaredMode)
-
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
-else
-aGridItem.SetRubyHeight(0);
-aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
-aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
-aGridItem.SetSquaredMode(m_bSquaredMode);
-aGridItem.SetDisplayGrid(m_xDisplayCB->get_active());
-aGridItem.SetPrintGrid(m_xPrintCB->get_active());
-aGridItem.SetColor(m_xColorLB->GetSelectEntryColor());
-rSet.Put(aGridItem);
-
-SwView * pView = ::GetActiveView();
-if (pView && aGridItem.GetGridType() != GRID_NONE)
+SwTextGridItem aGridItem;
+aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE :
+m_xLinesGridRB->get_active() ? GRID_LINES_ONLY : GRID_LINES_CHARS );
+aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active());
+aGridItem.SetLines( static_cast< sal_uInt16 
>(m_xLinesPerPageNF->get_value()) );
+aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
+m_bRubyUserValue ? m_nRubyUserValue :
+
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
+// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
+// When in normal mode, the ruby height should be zero.
+if (m_bSquaredMode)
+
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
+else
+aGridItem.SetRubyHeight(0);
+aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
+aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
+aGridItem.SetSquaredMode(m_bSquaredMode);
+aGridItem.SetDisplayGrid(m_xDisplayCB->get_active());
+aGridItem.SetPrintGrid(m_xPrintCB->get_active());
+aGridItem.SetColor(m_xColorLB->GetSelectEntryColor());
+rSet.Put(aGridItem);
+
+SwView * pView = ::GetActiveView();
+if (pView && aGridItem.GetGridType() != GRID_NONE)
+{
+if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
 {
-if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
-{
-m_bHRulerChanged = true;
-}
-m_bVRulerChanged = true;
-
pView->GetHRuler().SetCharWidth(m_xCharWidthMF->get_value(FieldUnit::MM));
-
pView->GetVRuler().SetLineHeight(m_xTextSizeMF->get_value(FieldUnit::MM));
+m_bHRulerChanged = true;
 }
+m_bVRulerChanged = true;
+
pView->GetHRuler().SetCharWidth(m_xCharWidthMF->get_value(FieldUnit::MM));
+
pView->GetVRuler().SetLineHeight(m_xTextSizeMF->get_value(FieldUnit::MM));
+}
 }
 
 void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
commit 9b80b2d6140d1aad240f10755105e49d678b98f1
Author: Kevin Suo 
AuthorDate: Thu Nov 10 10:19:08 2022 +0800
Commit: Mike Kaganski 
CommitDate: Fri Nov 11 08:30:29 2022 +0100

tdf#151979: fix crash in Text Grid dialog when switching active view

GetActiveView() may return a nullptr when previously we are in Calc
window and then click the controls on the writer dialog.


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

2022-10-07 Thread Michael Stahl (via logerrit)
 sw/source/core/table/swnewtable.cxx |   29 +
 1 file changed, 29 insertions(+)

New commits:
commit ac8717e861608031e50230015c90e64282a10ad0
Author: Michael Stahl 
AuthorDate: Fri Oct 7 16:21:27 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Oct 7 17:45:08 2022 +0200

tdf#151375 sw: ODF import: delete any layout frames before ...

... converting subtables.

This avoids use-after-free by the frames or a11y code on deleted cells.

For file open, there is no layout at this point, but when inserting a
file the crash happens.

(regression from commit e366c928819c44b5c253c45dca6dae40b71c9808)

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

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index 8d6bcf023d2c..a0c420b1876c 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2382,6 +2382,8 @@ bool SwTable::CanConvertSubtables() const
 
 void SwTable::ConvertSubtables()
 {
+FndBox_ all(nullptr, nullptr);
+all.DelFrames(*this); // tdf#151375 avoid UAF by frames on deleted cells
 for (size_t i = 0; i < GetTabLines().size(); ++i)
 {
 SwTableLine *const pLine(GetTabLines()[i]);
@@ -2397,6 +2399,7 @@ void SwTable::ConvertSubtables()
 }
 GCLines();
 m_bNewModel = true;
+all.MakeFrames(*this);
 #if 0
 // note: outline nodes (and ordinary lists) are sorted by MoveNodes() 
itself
 //   (this could change order inside table of contents, but that's a
commit 4757dfc2a520f63fba0b27cc161fe732231dbd0e
Author: Michael Stahl 
AuthorDate: Fri Oct 7 16:13:05 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Oct 7 17:44:54 2022 +0200

tdf#145871 sw: ODF import: don't convert subtables if outer row ...

... has fixed or min height.

The code had 2 obvious problems: the fixed height on the outer row
wasn't cleared if the inner row didn't have a fixed height, and the code
to set lastSize on the last row erroneously set the first row's height
as well due to sharing the row format.

But it turns out that this doesn't work anyway in case any of the inner
rows are variable sized, because without layout it's not possible to
determine the height of these rows, and so the lastSize is going to be
too large in many cases.

(regression from commit e366c928819c44b5c253c45dca6dae40b71c9808)

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

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index d87c039185c0..8d6bcf023d2c 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2133,6 +2133,11 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, 
sal_uInt16 const nBox)
 assert(!pSubTableBox->GetTabLines().empty());
 // are relative (%) heights possible? apparently not
 SwFormatFrameSize const 
outerSize(pSourceLine->GetFrameFormat()->GetFrameSize());
+if (outerSize.GetHeightSizeType() != SwFrameSize::Variable)
+{   // tdf#145871 clear fixed size in first row
+pSourceLine->ClaimFrameFormat();
+pSourceLine->GetFrameFormat()->ResetFormatAttr(RES_FRM_SIZE);
+}
 tools::Long minHeights(0);
 {
 SwFrameFormat const& 
rSubLineFormat(*pSubTableBox->GetTabLines()[0]->GetFrameFormat());
@@ -2171,12 +2176,14 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, 
sal_uInt16 const nBox)
 && outerSize.GetHeightSizeType() != SwFrameSize::Variable
 && minHeights < outerSize.GetHeight())
 {
+assert(false); // this should be impossible currently, such 
subtable isn't converted because layout is needed to determine how much space 
is taken up by variable height rows
 SwFormatFrameSize 
lastSize(pNewLine->GetFrameFormat()->GetFrameSize());
 lastSize.SetHeight(lastSize.GetHeight() + outerSize.GetHeight() - 
minHeights);
 if (lastSize.GetHeightSizeType() == SwFrameSize::Variable)
 {
 lastSize.SetHeightSizeType(SwFrameSize::Minimum);
 }
+pNewLine->ClaimFrameFormat();
 pNewLine->GetFrameFormat()->SetFormatAttr(lastSize);
 }
 SfxPoolItem const* pRowBrush(nullptr);
@@ -2295,6 +2302,7 @@ bool SwTable::CanConvertSubtables() const
 return false;
 }
 haveSubtable = true;
+bool haveNonFixedInnerLine(false);
 for (SwTableLine const*const pInnerLine : pBox->GetTabLines())
 {
 // bitmap row background will look different
@@ -2311,6 

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

2022-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/table/swnewtable.cxx  |   15 ---
 sw/source/core/text/itratr.cxx   |3 +--
 sw/source/core/text/redlnitr.cxx |6 +++---
 sw/source/core/txtnode/atrftn.cxx|2 +-
 sw/source/core/txtnode/attrlinebreak.cxx |2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 13a10516e71609d677d7f7d274f3ddc98cb8df18
Author: Noel Grandin 
AuthorDate: Thu Sep 29 18:49:06 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 20:13:54 2022 +0200

use more SwPosition::AdjustContent

part of the process of hiding the internals of SwPosition

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

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 7e10a29d5629..a37536e76121 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1466,8 +1466,7 @@ SwTwips SwTextNode::GetWidthOfLeadingTabs() const
 
 if ( nIdx > 0 )
 {
-SwPosition aPos( *this );
-aPos.nContent += nIdx;
+SwPosition aPos( *this, nIdx );
 
 // Find the non-follow text frame:
 SwIterator 
aIter(*this);
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index e5d16f2215cc..03697cce97c2 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -156,13 +156,13 @@ public:
 {
 m_Fieldmark.second.emplace(
 sw::mark::FindFieldSep(*m_Fieldmark.first));
-++m_Fieldmark.second->nContent;
-++m_oNextFieldmarkHide->nContent; // skip start
+m_Fieldmark.second->AdjustContent(+1);
+m_oNextFieldmarkHide->AdjustContent(+1); // skip start
 }
 else
 {
 m_Fieldmark.second.emplace(pFieldmark->GetMarkEnd());
---m_Fieldmark.second->nContent;
+m_Fieldmark.second->AdjustContent(-1);
 }
 }
 }
diff --git a/sw/source/core/txtnode/atrftn.cxx 
b/sw/source/core/txtnode/atrftn.cxx
index 518bca0403b3..7cbba1e5efbf 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -276,7 +276,7 @@ uno::Reference 
SwFormatFootnote::getAnchor(SwDoc& rDoc) const
 return uno::Reference();
 SwPaM aPam(m_pTextAttr->GetTextNode(), m_pTextAttr->GetStart());
 aPam.SetMark();
-++aPam.GetMark()->nContent;
+aPam.GetMark()->AdjustContent(+1);
 const uno::Reference xRet =
 SwXTextRange::CreateXTextRange(rDoc, *aPam.Start(), aPam.End());
 return xRet;
diff --git a/sw/source/core/txtnode/attrlinebreak.cxx 
b/sw/source/core/txtnode/attrlinebreak.cxx
index 59d7c247e47b..1c5c7882ee31 100644
--- a/sw/source/core/txtnode/attrlinebreak.cxx
+++ b/sw/source/core/txtnode/attrlinebreak.cxx
@@ -85,7 +85,7 @@ uno::Reference 
SwFormatLineBreak::GetAnchor() const
 
 SwPaM aPam(m_pTextAttr->GetTextNode(), m_pTextAttr->GetStart());
 aPam.SetMark();
-++aPam.GetMark()->nContent;
+aPam.GetMark()->AdjustContent(+1);
 uno::Reference xRet
 = SwXTextRange::CreateXTextRange(aPam.GetDoc(), *aPam.Start(), 
aPam.End());
 return xRet;
commit 3c68edf8fc8343300de500f01b11ae36e02819a6
Author: Noel Grandin 
AuthorDate: Thu Sep 29 19:00:13 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 20:13:42 2022 +0200

use more SwPosition::Adjust

part of the process of hiding the internals of SwPosition

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

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index 59428ec61f97..d87c039185c0 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -884,11 +884,12 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, 
SwSelBoxes& rBoxes,
 // we do not transfer this paragraph.
 if( !IsEmptyBox( *pBox, aChkPam ) )
 {
-SwNodeIndex& rInsPosNd = aInsPos.nNode;
+SwNode& rInsPosNd = aInsPos.GetNode();
 SwPaM aPam( aInsPos );
-aPam.GetPoint()->nNode.Assign( 
*pBox->GetSttNd()->EndOfSectionNode(), -1 );
+aPam.GetPoint()->Assign( 
*pBox->GetSttNd()->EndOfSectionNode(), SwNodeOffset(-1) );
 SwContentNode* pCNd = aPam.GetPointContentNode();
-aPam.GetPoint()->nContent.Assign( pCNd, pCNd ? pCNd->Len() 
: 0 );
+if( pCNd )
+aPam.GetPoint()->SetContent( pCNd->Len() );
 SwNodeIndex aSttNdIdx( 

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

2022-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit b3e07612eb6536aa14f2108484705068fc8e30d8
Author: Noel Grandin 
AuthorDate: Thu Sep 29 13:39:36 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 17:46:31 2022 +0200

use more SwPosition::SetContent

part of the process of hiding the internals of SwPosition.

In thi case we just need to point aDelPam somewhere else, so
that is doesn't point into a node that is about to be deleted.

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 2221a5ec49d9..ec52d3ec1221 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4610,9 +4610,8 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
 OUString(), 
IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
 ::sw::mark::InsertMode::New);
 
-SwContentIndex& rIdx = aDelPam.GetPoint()->nContent;
-rIdx.Assign( nullptr, 0 );
-aDelPam.GetMark()->nContent = rIdx;
+aDelPam.GetPoint()->Assign( SwNodeOffset(0) );
+aDelPam.GetMark()->Assign( SwNodeOffset(0) );
 rPam.GetPoint()->Assign( SwNodeOffset(0) );
 *rPam.GetMark() = *rPam.GetPoint();
 m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
commit 22535b5a6591e1f9f1ebd6c95bc6173f570f0082
Author: Noel Grandin 
AuthorDate: Thu Sep 29 13:15:09 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 17:46:20 2022 +0200

use more SwPosition::SetContent

part of the process of hiding the internals of SwPosition

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 22c84d9bfb3c..2221a5ec49d9 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1812,7 +1812,7 @@ namespace //local functions originally from docfmt.cxx
 
 SwNodeIndex aSt( rDoc.GetNodes() );
 SwNodeIndex aEnd( rDoc.GetNodes() );
-SwContentIndex aCntEnd( pEnd->nContent );
+SwContentIndex aCntEnd( pEnd->GetContentNode(), 
pEnd->GetContentIndex() );
 
 if( pNode )
 {
@@ -1847,7 +1847,7 @@ namespace //local functions originally from docfmt.cxx
 }
 else
 aSt = pStt->GetNode();
-aCntEnd = pEnd->nContent; // aEnd was changed!
+aCntEnd.Assign(pEnd->GetContentNode(), pEnd->GetContentIndex()); 
// aEnd was changed!
 }
 else
 aSt.Assign( pStt->GetNode(), +1 );
@@ -3968,10 +3968,6 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
 : newPos.GetContentIndex();
 newPos.SetContent(nContent);
 }
-else
-{
-newPos.nContent.Assign( nullptr, 0 );
-}
 aAnchor.SetAnchor(  );
 
 // Check recursion: if copying content inside the same frame, then 
don't copy the format.
@@ -4980,7 +4976,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 // Don't copy the beginning completely?
 if( !bCopyCollFormat || bColumnSel || pStt->GetContentIndex() )
 {
-SwContentIndex aDestIdx( rPos.nContent );
+SwContentIndex aDestIdx( rPos.GetContentNode(), 
rPos.GetContentIndex() );
 bool bCopyOk = false;
 if( !pDestTextNd )
 {


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

2022-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/crsr/findfmt.cxx |4 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   34 
 2 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 867f7311c36c0ae6d8dd8b6e3f1466d6babe4817
Author: Noel Grandin 
AuthorDate: Thu Sep 29 13:56:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 16:07:21 2022 +0200

use more SwPosition::SetContent

part of the process of hiding the internals of SwPosition.

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d2187d8db1d6..22c84d9bfb3c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -967,10 +967,10 @@ namespace
 rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
 }
 
-bool lcl_SaveFootnote( const SwNodeIndex& rSttNd, const SwNodeIndex& 
rEndNd,
+bool lcl_SaveFootnote( const SwNode& rSttNd, const SwNode& rEndNd,
  const SwNode& rInsPos,
  SwFootnoteIdxs& rFootnoteArr, SwFootnoteIdxs& rSaveArr,
- const SwContentIndex* pSttCnt = nullptr, const 
SwContentIndex* pEndCnt = nullptr )
+ std::optional oSttCnt = std::nullopt, 
std::optional oEndCnt = std::nullopt )
 {
 bool bUpdateFootnote = false;
 const SwNodes& rNds = rInsPos.GetNodes();
@@ -982,7 +982,7 @@ namespace
 {
 
 size_t nPos = 0;
-rFootnoteArr.SeekEntry( rSttNd.GetNode(),  );
+rFootnoteArr.SeekEntry( rSttNd,  );
 SwTextFootnote* pSrch;
 const SwNode* pFootnoteNd;
 
@@ -992,12 +992,12 @@ namespace
 <= rEndNd.GetIndex() )
 {
 const sal_Int32 nFootnoteSttIdx = pSrch->GetStart();
-if( ( pEndCnt && pSttCnt )
-? (( () == pFootnoteNd &&
- pSttCnt->GetIndex() > nFootnoteSttIdx) ||
-   ( () == pFootnoteNd &&
-nFootnoteSttIdx >= pEndCnt->GetIndex() ))
-: ( () == pFootnoteNd ))
+if( ( oEndCnt && oSttCnt )
+? ((  == pFootnoteNd &&
+ *oSttCnt > nFootnoteSttIdx) ||
+   (  == pFootnoteNd &&
+nFootnoteSttIdx >= *oEndCnt ))
+: (  == pFootnoteNd ))
 {
 ++nPos; // continue searching
 }
@@ -1025,11 +1025,11 @@ namespace
 GetTextNode())->GetIndex() >= rSttNd.GetIndex() )
 {
 const sal_Int32 nFootnoteSttIdx = pSrch->GetStart();
-if( !pEndCnt || !pSttCnt ||
-!  (( () == pFootnoteNd &&
-pSttCnt->GetIndex() > nFootnoteSttIdx ) ||
-( () == pFootnoteNd &&
-nFootnoteSttIdx >= pEndCnt->GetIndex() )) )
+if( !oEndCnt || !oSttCnt ||
+!  ((  == pFootnoteNd &&
+*oSttCnt > nFootnoteSttIdx ) ||
+(  == pFootnoteNd &&
+nFootnoteSttIdx >= *oEndCnt )) )
 {
 if( bDelFootnote )
 {
@@ -2376,9 +2376,9 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
 }
 else
 {
-bUpdateFootnote = lcl_SaveFootnote( pStt->nNode, pEnd->nNode, 
rPos.GetNode(),
+bUpdateFootnote = lcl_SaveFootnote( pStt->GetNode(), pEnd->GetNode(), 
rPos.GetNode(),
 m_rDoc.GetFootnoteIdxs(), aTmpFntIdx,
->nContent, >nContent );
+pStt->GetContentIndex(), 
pEnd->GetContentIndex() );
 }
 
 bool bSplit = false;
@@ -2577,7 +2577,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( 
SwNodeRange& rRange, SwNod
 }
 else
 {
-bUpdateFootnote = lcl_SaveFootnote( rRange.aStart, rRange.aEnd, 
rDestNd,
+bUpdateFootnote = lcl_SaveFootnote( rRange.aStart.GetNode(), 
rRange.aEnd.GetNode(), rDestNd,
 m_rDoc.GetFootnoteIdxs(), aTmpFntIdx );
 }
 
commit 16844900b94e07975888745aa6d07e60c07ff680
Author: Noel Grandin 
AuthorDate: Thu Sep 29 12:56:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 29 16:07:07 2022 +0200

use more SwPosition::SetContent

part of the process of hiding the internals of SwPosition

Change-Id: I46fa167cafccb57baa4f8153528d2f130a4d96a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140732

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

2022-09-16 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit d87e1859cbd41a623f48a9522507ab0adc8e7324
Author: Jim Raykowski 
AuthorDate: Thu Sep 15 14:20:23 2022 -0800
Commit: Jim Raykowski 
CommitDate: Fri Sep 16 22:11:26 2022 +0200

SwNavigator: Make Drawing objects context menu entry 'Edit..' edit

This patch uses SwEditWin::KeyInput handling of KEY_RETURN for the
Drawing objects context menu entry 'Edit...' which moves focus of the
selected drawing object into the text box of the drawing object.
Previous to this patch the 'Edit...' menu entry would select the
drawing object the same as the 'Go to' menu entry.

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 2dfc91fbfdf1..68b77a6d9249 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -5110,6 +5110,12 @@ void SwContentTree::EditEntry(const weld::TreeIter& 
rEntry, EditEntryMode nMode)
 nSlot = SID_DELETE;
 else if(nMode == EditEntryMode::RENAME)
 nSlot = FN_NAME_SHAPE;
+else if (nMode == EditEntryMode::EDIT)
+{
+vcl::KeyCode aKeyCode(KEY_RETURN, false, false, false, false);
+KeyEvent aKeyEvent(0, aKeyCode);
+m_pActiveShell->GetWin()->KeyInput(aKeyEvent);
+}
 break;
 case ContentTypeId::FOOTNOTE:
 case ContentTypeId::ENDNOTE:
commit a5eb6660ed85afb706527704e1170a35e0677cf8
Author: Caolán McNamara 
AuthorDate: Fri Sep 16 16:33:05 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 16 22:11:13 2022 +0200

cid#1514676 perturb mysterious Logically dead code warning

throw a const at it

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 55e51b52d51b..2dfc91fbfdf1 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1878,7 +1878,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 if (bRemoveDeleteFieldEntry)
 xPop->remove("deletefield");
 
-bool bRemoveDeleteEntry =
+const bool bRemoveDeleteEntry =
 bRemoveDeleteChapterEntry ||
 bRemoveDeleteTableEntry ||
 bRemoveDeleteFrameEntry ||


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

2022-09-10 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/docbm.cxx  |   29 +
 sw/source/core/graphic/grfatr.cxx |5 -
 2 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit a868a9cd5f45eb0ea6703db3b68c48b7fa79b808
Author: Noel Grandin 
AuthorDate: Sat Sep 10 13:27:36 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 10 15:40:58 2022 +0200

crashtesting tdf135070-01.odt

asserts with
./instdir/program/soffice --headless --convert-to pdf ~/tdf135070-1.odt

ever since
commit 0f0cc045e06c8f3cd3f9780054f2259c6a0995f7
use more SwPosition::Assign

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

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 5b0b40a6b5ee..2347a68638b6 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1849,25 +1849,38 @@ void SaveBookmark::SetInDoc(
 {
 SwPaM aPam(rNewPos);
 if(oContentIdx)
-aPam.GetPoint()->SetContent( *oContentIdx );
+{
+if (aPam.GetPoint()->GetNode().IsContentNode())
+aPam.GetPoint()->SetContent( *oContentIdx );
+else
+SAL_WARN("sw", "trying to sent content index, but point node is 
not a content node");
+}
 
 if(NODE_OFFSET_MAX != m_nNode2)
 {
 aPam.SetMark();
 
 aPam.GetMark()->Adjust(m_nNode2);
-if(oContentIdx && !m_nNode2)
-aPam.GetMark()->SetContent(*oContentIdx + m_nContent2);
+if (aPam.GetMark()->GetNode().IsContentNode())
+{
+if(oContentIdx && !m_nNode2)
+aPam.GetMark()->SetContent(*oContentIdx + m_nContent2);
+else
+aPam.GetMark()->SetContent(m_nContent2);
+}
 else
-aPam.GetMark()->SetContent(m_nContent2);
+SAL_WARN("sw", "trying to sent content index, but mark node is not 
a content node");
 }
 
 aPam.GetPoint()->Adjust(m_nNode1);
 
-if(oContentIdx && !m_nNode1)
-aPam.GetPoint()->SetContent(*oContentIdx + m_nContent1);
-else
-aPam.GetPoint()->SetContent(m_nContent1);
+if (aPam.GetPoint()->GetNode().IsContentNode())
+{
+if(oContentIdx && !m_nNode1)
+aPam.GetPoint()->SetContent(*oContentIdx + m_nContent1);
+else
+aPam.GetPoint()->SetContent(m_nContent1);
+}
 
 if(aPam.HasMark()
 && !CheckNodesRange(aPam.GetPoint()->GetNode(), 
aPam.GetMark()->GetNode(), true))
commit 9908e48932e0cdac9785c05ff1d4c0e482ea78ca
Author: Noel Grandin 
AuthorDate: Sat Sep 10 13:46:36 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 10 15:40:46 2022 +0200

remove warnings in SwTransparencyGrf Get/Put Value

These have been here since
commit 930f64d3f903787368a8c8cc86857a2932da815e
Author: Oliver Specht 
Date:   Thu Dec 14 10:48:47 2000 +
#82036# graphic attributes added to the API

so it is unlikely that SwTransparencyGrf will ever be
changed to a sal_uInt16

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

diff --git a/sw/source/core/graphic/grfatr.cxx 
b/sw/source/core/graphic/grfatr.cxx
index 50a84c12fb8e..bf7ff665bc47 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -275,8 +275,6 @@ SwTransparencyGrf* SwTransparencyGrf::Clone( SfxItemPool * 
) const
 bool SwTransparencyGrf::QueryValue( uno::Any& rVal,
 sal_uInt8 ) const
 {
-//OSL_ENSURE(dynamic_cast( this ) !=  
nullptr,"Put/QueryValue should be removed!");
-SAL_WARN("sw", "Put/QueryValue should be removed!");
 sal_Int16 nRet = GetValue();
 OSL_ENSURE( 0 <= nRet && nRet <= 100, "value out of range" );
 rVal <<= nRet;
@@ -286,9 +284,6 @@ bool SwTransparencyGrf::QueryValue( uno::Any& rVal,
 bool SwTransparencyGrf::PutValue( const uno::Any& rVal,
 sal_uInt8 )
 {
-//temporary conversion until this is a SfxInt16Item!
-//OSL_ENSURE(dynamic_cast( this ) !=  
nullptr,"Put/QueryValue should be removed!");
-SAL_WARN("sw", "Put/QueryValue should be removed!");
 sal_Int16 nVal = 0;
 if(!(rVal >>= nVal) || nVal < -100 || nVal > 100)
 return false;


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

2022-08-31 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unocrsr.cxx |1 
 vcl/qa/cppunit/pdfexport/data/justified-arabic-kashida.odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   84 +
 3 files changed, 85 insertions(+)

New commits:
commit d8e70a0b831f53961249ef0ac93bab1bc66f2818
Author: Caolán McNamara 
AuthorDate: Wed Aug 31 12:22:02 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 31 21:17:34 2022 +0200

cid#1500692 silence Use after free

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

diff --git a/sw/source/core/unocore/unocrsr.cxx 
b/sw/source/core/unocore/unocrsr.cxx
index c61fa317c598..6c1006673283 100644
--- a/sw/source/core/unocore/unocrsr.cxx
+++ b/sw/source/core/unocore/unocrsr.cxx
@@ -48,6 +48,7 @@ SwUnoCursor::~SwUnoCursor()
 pNxt->MoveTo(nullptr); // remove from chain
 delete pNxt;   // and delete
 }
+// coverity[deref_arg] - GetNext() is not a use after free at this point
 }
 
 bool SwUnoCursor::IsReadOnlyAvailable() const
commit e8c0a88d640b32129eae6c9042fd908c2892c7e1
Author: Hossein 
AuthorDate: Wed Aug 31 13:13:14 2022 +0200
Commit: Hossein 
CommitDate: Wed Aug 31 21:17:19 2022 +0200

tdf#139627 Test justified Arabic/Persian text to avoid gaps/big overlaps

With the patches 3901e02..62ff105 from Khaled, many problems with the
justified Arabic/Persian text which were related to Kashida are fixed.
Here, we add a test for tdf#139627 which converts the example file to
the PDF format, then checks the width and the position of the characters
in the output to make sure:

* The characters are present in the PDF file in the correct order
* The characters are joined together
* The diacritic mark is positioned correctly
* The overlapping of the tatweel character is not more than 10% of the
  first character

Sample odt file uses "Noto Arabic Sans" font, which is available via
LibreOffice on all platforms.

One may run the test with:

make CPPUNIT_TEST_NAME=testTdf139627 -sr CppunitTest_vcl_pdfexport

Change-Id: I7a826a1b43ee842978decb0cf9a5e2a3b7219982
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138328
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/vcl/qa/cppunit/pdfexport/data/justified-arabic-kashida.odt 
b/vcl/qa/cppunit/pdfexport/data/justified-arabic-kashida.odt
new file mode 100644
index ..6ca6ad196546
Binary files /dev/null and 
b/vcl/qa/cppunit/pdfexport/data/justified-arabic-kashida.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 057773c3ddaf..4b25202bb2d4 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3535,6 +3535,90 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testBitmapScaledown)
 }
 } // end anonymous namespace
 
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139627)
+{
+aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+saveAsPDF(u"justified-arabic-kashida.odt");
+std::unique_ptr pPdfDocument = parseExport();
+CPPUNIT_ASSERT(pPdfDocument);
+
+// The document has one page.
+CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+std::unique_ptr pPdfPage = 
pPdfDocument->openPage(/*nIndex=*/0);
+CPPUNIT_ASSERT(pPdfPage);
+
+// 7 or 8 objects, 4 text, others are path
+int nPageObjectCount = pPdfPage->getObjectCount();
+CPPUNIT_ASSERT_GREATEREQUAL(7, nPageObjectCount);
+
+// 4 text objects, "رم" (reh+mim), then "ِ" (kasreh), tatweel, and "ج" 
(jeh)
+OUString sText[4];
+
+/* With "Noto Sans Arabic" font, these are the X ranges on Linux:
+0: ( 61.75 - 218.35)
+1: (479.70 - 520.02)
+2: (209.40 - 457.08)
+3: (447.80 - 546.62)
+*/
+basegfx::B2DRectangle aRect[4];
+
+std::unique_ptr pTextPage = 
pPdfPage->getTextPage();
+std::unique_ptr pPageObject;
+
+int nTextObjectCount = 0;
+for (int i = 0; i < nPageObjectCount; ++i)
+{
+pPageObject = pPdfPage->getObject(i);
+CPPUNIT_ASSERT_MESSAGE("no object", pPageObject != nullptr);
+if (pPageObject->getType() == vcl::pdf::PDFPageObjectType::Text)
+{
+sText[nTextObjectCount] = pPageObject->getText(pTextPage);
+aRect[nTextObjectCount] = pPageObject->getBounds();
+++nTextObjectCount;
+}
+}
+CPPUNIT_ASSERT_EQUAL(4, nTextObjectCount);
+
+// Text: جِـرم (which means "mass" in Persian)
+// Rendered as (left to right): "reh + mim" - "tahtweel" - "kasreh" - "jeh"
+int rehmim = 0, kasreh = 1, tatweel = 2, jeh = 3;
+
+// Bad rendering can cause tatweel enumerated before kasreh
+// This can be the end of journey, but let's accept this for now
+if (sText[2].equals(u"ِ"))
+  

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

2022-08-30 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 +++---
 sw/source/core/docnode/node.cxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 210042432462316db196464a83763405acc6b698
Author: Noel Grandin 
AuthorDate: Tue Aug 30 13:56:24 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 30 15:31:16 2022 +0200

use more SwPosition::Assign

part of hiding the internals of SwPosition

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index a53753299f22..1c8489ab95ce 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -,8 +,8 @@ bool 
DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam, SwDelet
 
 // If the Node that contained the Cursor has been deleted,
 // the Content has to be assigned to the current Content.
-pStt->nContent.Assign( pStt->GetNode().GetContentNode(),
-pStt->GetContentIndex() );
+if (pStt->GetNode().GetContentNode())
+pStt->SetContent( pStt->GetContentIndex() );
 
 // If we deleted across Node boundaries we have to correct the PaM,
 // because they are in different Nodes now.
@@ -5291,7 +5291,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 // If the next node is a start node, then step back: the start node
 // has been copied and needs to be in the selection for the undo
 if (pCopyPam->GetPoint()->GetNode().IsStartNode())
-pCopyPam->GetPoint()->nNode--;
+pCopyPam->GetPoint()->Adjust(SwNodeOffset(-1));
 
 }
 pCopyPam->Exchange();
commit 0e17717404d147a99d4c1f797298598ba54bb95f
Author: Noel Grandin 
AuthorDate: Tue Aug 30 13:28:35 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 30 15:30:55 2022 +0200

SAL_WARN->SAL_INFO in SwContentNode::ChkCondColl

we call this on all nodes, so it's not really a bug

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

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 58096ad98047..e8d415d9d1c2 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1999,7 +1999,7 @@ void SwContentNode::ChkCondColl(const SwTextFormatColl* 
pColl)
 {
 if(pColl != GetRegisteredIn())
 {
-SAL_WARN("sw.core", "Wrong cond collection, skipping check of Cond 
Colls.");
+SAL_INFO("sw.core", "Not our cond collection, skipping check of Cond 
Colls.");
 return;
 }
 if(() != ().GetNodes())


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

2022-08-24 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/ww8glsy.cxx |   33 +++--
 sw/source/filter/ww8/ww8glsy.hxx |2 +-
 sw/source/filter/ww8/ww8par.cxx  |   18 +-
 3 files changed, 21 insertions(+), 32 deletions(-)

New commits:
commit 55c638eb0d6aeacb7b5a8b0345add9b44aa6c889
Author: Noel Grandin 
AuthorDate: Wed Aug 24 11:04:48 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 24 14:29:41 2022 +0200

use SwNode instead of SwNodeIndex in HasBareGraphicEnd method

part of the process of hiding the internals of SwPosition

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

diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 8b8c92482510..2ad84960dcb1 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -56,7 +56,7 @@ WW8Glossary::WW8Glossary(tools::SvRef 
, sal_uInt8 nVer
 }
 }
 
-bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc,SwNodeIndex const )
+bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc, SwNode const )
 {
 bool bRet=false;
 for( sal_uInt16 nCnt = pDoc->GetSpzFrameFormats()->size(); nCnt; )
@@ -70,7 +70,7 @@ bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc,SwNodeIndex 
const )
 if (pAPos &&
 ((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) ||
  (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())) &&
-rIdx == pAPos->GetNodeIndex() )
+rIdx == pAPos->GetNode() )
 {
 bRet=true;
 break;
@@ -115,29 +115,28 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks 
,
 do {
 SwPaM aPam( aStart );
 {
-SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
-++rIdx;
-pCNd = rIdx.GetNode().GetTextNode();
+SwPosition& rPos = *aPam.GetPoint();
+rPos.Adjust(SwNodeOffset(1));
+pCNd = rPos.GetNode().GetTextNode();
 if( nullptr == pCNd )
 {
-pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl 
);
-rIdx = *pCNd;
+pCNd = pD->GetNodes().MakeTextNode( rPos.GetNode(), pColl 
);
+rPos.Assign(*pCNd);
 }
 }
-aPam.GetPoint()->nContent.Assign( pCNd, 0 );
 aPam.SetMark();
 {
-SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
-rIdx = aStart.GetNode().EndOfSectionIndex() - 1;
-if(( nullptr == ( pCNd = rIdx.GetNode().GetContentNode() ) )
-|| HasBareGraphicEnd(pD,rIdx))
+SwPosition& rPos = *aPam.GetPoint();
+rPos.Assign(aStart.GetNode().EndOfSectionIndex() - 1);
+if(( nullptr == ( pCNd = rPos.GetNode().GetContentNode() ) )
+|| HasBareGraphicEnd(pD,rPos.GetNode()))
 {
-++rIdx;
-pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl 
);
-rIdx = *pCNd;
+rPos.Adjust(SwNodeOffset(1));
+pCNd = pD->GetNodes().MakeTextNode( rPos.GetNode(), pColl 
);
+rPos.Assign(*pCNd);
 }
 }
-aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+aPam.GetPoint()->SetContent( pCNd->Len() );
 
 // now we have the right selection for one entry.  Copy this to
 // the defined TextBlock, but only if it is not an autocorrection
@@ -221,8 +220,6 @@ bool WW8Glossary::Load( SwTextBlocks , bool 
bSaveRelFile )
 pD->GetNodes().GoNext(  );
 }
 SwPaM aPamo( aIdx );
-
aPamo.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(),
-0);
 std::unique_ptr xRdr(new SwWW8ImplReader(
 m_xGlossary->m_nVersion, m_xStg.get(), m_rStrm.get(), *pD, 
rBlocks.GetBaseURL(),
 true, false, *aPamo.GetPoint()));
diff --git a/sw/source/filter/ww8/ww8glsy.hxx b/sw/source/filter/ww8/ww8glsy.hxx
index bff76efedecd..35babac1d07f 100644
--- a/sw/source/filter/ww8/ww8glsy.hxx
+++ b/sw/source/filter/ww8/ww8glsy.hxx
@@ -81,7 +81,7 @@ private:
 static bool MakeEntries(SwDoc *pD, SwTextBlocks , bool 
bSaveRelFile,
 const std::vector& rStrings,
 const std::vector& rExtra);
-static bool HasBareGraphicEnd(SwDoc *pD,SwNodeIndex const );
+static bool HasBareGraphicEnd(SwDoc *pD, SwNode const );
 
 WW8Glossary(const WW8Glossary&) = delete;
 WW8Glossary& operator=(const WW8Glossary&) = delete;
commit f067bfebf6fbdfb66d545585fea9fe6cec559038
Author: Noel Grandin 
AuthorDate: Wed Aug 24 11:01:51 2022 +0200
Commit:   

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

2022-08-24 Thread Noel Grandin (via logerrit)
 sw/source/core/bastyp/index.cxx  |2 +-
 sw/source/filter/ww8/ww8par.cxx  |2 +-
 sw/source/filter/ww8/ww8par2.cxx |6 +++---
 sw/source/filter/ww8/ww8par5.cxx |6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 2476104c9168969b4970bd613a11078fec699435
Author: Noel Grandin 
AuthorDate: Wed Aug 24 11:37:40 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 24 12:51:08 2022 +0200

fix ubsan signed integer overflow

after
commit 6b544507b01d479b991d3ba7c949cb70696a3f2e
Author: Noel Grandin 
Date:   Tue Aug 23 11:42:38 2022 +0200
Use more SwPosition::Adjust

ubsan started to complain because the SAL_WARN_IF here assumes that nVal
is >= 0. Make it work if nVal is < 0.

/sw/source/core/bastyp/index.cxx:332:5: runtime error: signed integer
overflow: 2147483647 - -1 cannot be represented in type 'int'
/sw/source/core/bastyp/index.cxx:332:5
/sw/source/core/crsr/pam.cxx:257:14
SwPaM*) /sw/source/uibase/wrtsh/wrtsh2.cxx:129:52
/sw/source/uibase/fldui/fldmgr.cxx:1490:39
SfxRequest const&) /sw/source/uibase/wrtsh/wrtsh1.cxx:2284:19

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

diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index f7868e8901e0..c7ded156ea26 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -329,7 +329,7 @@ sal_Int32 SwContentIndex::operator--()
 
 sal_Int32 SwContentIndex::operator+=( sal_Int32 const nVal )
 {
-SAL_WARN_IF( !(m_nIndex <= SAL_MAX_INT32 - nVal), "sw.core",
+SAL_WARN_IF( !(nVal > 0 ? m_nIndex <= SAL_MAX_INT32 - nVal : m_nIndex >= 
nVal), "sw.core",
  "SwContentIndex SwContentIndex::operator+=(sal_Int32) wraps 
around" );
 return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
 }
commit 47d51286103dc6fa2c4ddfa871bde4878aef17ef
Author: Noel Grandin 
AuthorDate: Wed Aug 24 09:56:51 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 24 12:50:57 2022 +0200

Use more SwPosition::Adjust

to keep the internal fields of SwPosition in sync.

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 078d2aae5ddc..e18ab2e655c7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6720,7 +6720,7 @@ bool SwWW8ImplReader::InEqualApo(int nLvl) const
 namespace sw::hack
 {
 Position::Position(const SwPosition )
-: maPtNode(rPos.nNode), mnPtContent(rPos.GetContentIndex())
+: maPtNode(rPos.GetNode()), mnPtContent(rPos.GetContentIndex())
 {
 }
 
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 9b6cdfe6c754..08b7e8017a46 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2366,7 +2366,7 @@ void wwSectionManager::PrependedInlineNode(const 
SwPosition ,
 {
 OSL_ENSURE(!maSegments.empty(),
 "should not be possible, must be at least one segment");
-if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
+if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.GetNode()))
 maSegments.back().maStart.Assign(rNode);
 }
 
@@ -2649,13 +2649,13 @@ void WW8TabDesc::MergeCells()
 if( rCell.bVertMerge && !rCell.bVertRestart )
 {
 SwPaM aPam( *m_pTabBox->GetSttNd(), 0 );
-aPam.GetPoint()->nNode++;
+aPam.GetPoint()->Adjust(SwNodeOffset(1));
 SwTextNode* pNd = aPam.GetPointNode().GetTextNode();
 while( pNd )
 {
 pNd->SetCountedInList( false );
 
-aPam.GetPoint()->nNode++;
+aPam.GetPoint()->Adjust(SwNodeOffset(1));
 pNd = aPam.GetPointNode().GetTextNode();
 }
 }
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 12b940b96a9d..f137dfec72a4 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -529,7 +529,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 case ww::eFORMTEXT:
 if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
 SwPosition aEndPos = *m_pPaM->GetPoint();
-SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), 
m_aFieldStack.back().GetPtContent(), aEndPos.nNode, aEndPos.GetContentIndex());
+SwPaM aFieldPam( m_aFieldStack.back().GetPtNode().GetNode(), 

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

2022-08-19 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/swstylemanager.cxx |   27 +++
 sw/source/core/text/pormulti.cxx  |   13 ++---
 sw/source/core/text/portxt.cxx|6 +++---
 sw/source/core/text/txttab.cxx|8 
 4 files changed, 24 insertions(+), 30 deletions(-)

New commits:
commit 9a3cde8f2ad603cf0c57eab66276dea977b20de8
Author: Noel Grandin 
AuthorDate: Thu Aug 18 22:04:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 19 10:12:00 2022 +0200

no need to allocate these separately in SwStyleManager

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

diff --git a/sw/source/core/doc/swstylemanager.cxx 
b/sw/source/core/doc/swstylemanager.cxx
index eec167202e2d..38f79d679af3 100644
--- a/sw/source/core/doc/swstylemanager.cxx
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -37,6 +37,7 @@ public:
 { mMap[ StylePool::nameOf(pStyle) ] = pStyle; }
 void addCompletePool( StylePool& rPool );
 std::shared_ptr getByName( const OUString& rName ) { return 
mMap[rName]; }
+void clear() { mMap.clear(); }
 };
 
 }
@@ -59,8 +60,8 @@ class SwStyleManager : public IStyleAccess
 {
 StylePool m_aAutoCharPool;
 StylePool m_aAutoParaPool;
-std::unique_ptr mpCharCache;
-std::unique_ptr mpParaCache;
+SwStyleCache maCharCache;
+SwStyleCache maParaCache;
 
 public:
 // accept empty item set for ignorable paragraph items.
@@ -88,8 +89,8 @@ std::unique_ptr createStyleManager( SfxItemSet 
const * pIgnorableP
 
 void SwStyleManager::clearCaches()
 {
-mpCharCache.reset();
-mpParaCache.reset();
+maCharCache.clear();
+maParaCache.clear();
 }
 
 std::shared_ptr SwStyleManager::getAutomaticStyle( const 
SfxItemSet& rSet,
@@ -109,15 +110,11 @@ std::shared_ptr 
SwStyleManager::cacheAutomaticStyle( const SfxItemSe
 std::shared_ptr pStyle = rAutoPool.insertItemSet( rSet );
 if (eFamily == IStyleAccess::AUTO_STYLE_CHAR)
 {
-if (!mpCharCache)
-mpCharCache.reset(new SwStyleCache());
-mpCharCache->addStyleName( pStyle );
+maCharCache.addStyleName( pStyle );
 }
 else
 {
-if (!mpParaCache)
-mpParaCache.reset(new SwStyleCache());
-mpParaCache->addStyleName( pStyle );
+maParaCache.addStyleName( pStyle );
 }
 return pStyle;
 }
@@ -127,17 +124,15 @@ std::shared_ptr SwStyleManager::getByName( 
const OUString& rName,
 {
 StylePool& rAutoPool
 = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? m_aAutoCharPool : 
m_aAutoParaPool;
-std::unique_ptr  = eFamily == 
IStyleAccess::AUTO_STYLE_CHAR ? mpCharCache : mpParaCache;
-if( !rpCache )
-rpCache.reset(new SwStyleCache());
-std::shared_ptr pStyle = rpCache->getByName( rName );
+SwStyleCache  = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? 
maCharCache : maParaCache;
+std::shared_ptr pStyle = rCache.getByName( rName );
 if( !pStyle )
 {
 // Ok, ok, it's allowed to ask for uncached styles (from UNO) but it 
should not be done
 // during loading a document
 OSL_FAIL( "Don't ask for uncached styles" );
-rpCache->addCompletePool( rAutoPool );
-pStyle = rpCache->getByName( rName );
+rCache.addCompletePool( rAutoPool );
+pStyle = rCache.getByName( rName );
 }
 return pStyle;
 }
commit 7d1b8ae00edc4510d754147aa2b3381accd0fa38
Author: Noel Grandin 
AuthorDate: Thu Aug 18 21:50:15 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 19 10:11:44 2022 +0200

unique_ptr->optional in SwFontSave

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

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 3fb6a3091ad0..8ca4b9c625ef 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1572,7 +1572,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect 
,
 
 SwSpaceManipulator aManip( GetInfo(), rMulti );
 
-std::unique_ptr pFontSave;
+std::optional oFontSave;
 std::unique_ptr pTmpFnt;
 
 if( rMulti.IsDouble() )
@@ -1583,11 +1583,10 @@ void SwTextPainter::PaintMultiPortion( const SwRect 
,
 SetPropFont( 50 );
 pTmpFnt->SetProportion( GetPropFont() );
 }
-pFontSave.reset(new SwFontSave( GetInfo(), pTmpFnt.get(), this ));
+oFontSave.emplace( GetInfo(), pTmpFnt.get(), this );
 }
 else
 {
-pFontSave = nullptr;
 pTmpFnt = nullptr;
 }
 
@@ -1843,7 +1842,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect 
,
 // Restore the saved values
 GetInfo().X( nOldX );
 GetInfo().SetLen( nOldLen );
-pFontSave.reset();
+oFontSave.reset();
 pTmpFnt.reset();
 SetPropFont( 0 

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

2022-08-17 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/accframebase.cxx |4 ++--
 vcl/unx/gtk3/gtkinst.cxx   |1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 996ded6b42c924124f279a20a10a67754df80a8a
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 12:36:47 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 17 09:53:31 2022 +0200

cid#1509302 Dereference after null check

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

diff --git a/sw/source/core/access/accframebase.cxx 
b/sw/source/core/access/accframebase.cxx
index 1a5a8adde5a1..e0821f3ded24 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -124,8 +124,8 @@ SwAccessibleFrameBase::SwAccessibleFrameBase(
 m_bIsSelected( false )
 {
 const SwFrameFormat* pFrameFormat = pFlyFrame->GetFormat();
-if(pFrameFormat)
-
StartListening(const_cast(pFrameFormat)->GetNotifier());
+
+StartListening(const_cast(pFrameFormat)->GetNotifier());
 
 SetName( pFrameFormat->GetName() );
 
commit 8575177e240f85850a3b9d27d41a61b3c5445fc7
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 12:32:39 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 17 09:53:19 2022 +0200

cid#1509184 silence Out-of-bounds access

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 74df879c85e1..1eb056936a41 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8761,6 +8761,7 @@ private:
 {
 disable_notify_events();
 int nPageNumber = get_page_number(pNotebook, ident);
+assert(nPageNumber != -1 && "asked to remove page that doesn't exist");
 gtk_notebook_remove_page(pNotebook, nPageNumber);
 enable_notify_events();
 return nPageNumber;


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

2022-08-10 Thread Noel Grandin (via logerrit)
 sw/source/core/inc/UndoDelete.hxx |3 ++-
 sw/source/core/inc/UndoInsert.hxx |3 ++-
 sw/source/core/undo/undel.cxx |   10 +-
 sw/source/core/undo/unins.cxx |   21 ++---
 4 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit 17073362f47425996575cefb682383f2710d3436
Author: Noel Grandin 
AuthorDate: Sun Aug 7 21:46:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 10 10:08:45 2022 +0200

unique_ptr->optional in SwUndoInsert

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

diff --git a/sw/source/core/inc/UndoInsert.hxx 
b/sw/source/core/inc/UndoInsert.hxx
index ae7b6c02dbd5..20bc4be7fdc5 100644
--- a/sw/source/core/inc/UndoInsert.hxx
+++ b/sw/source/core/inc/UndoInsert.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -41,7 +42,7 @@ enum class MirrorGraph;
 class SwUndoInsert final : public SwUndo, private SwUndoSaveContent
 {
 /// start of Content in UndoNodes for Redo
-std::unique_ptr m_pUndoNodeIndex;
+std::optional m_oUndoNodeIndex;
 std::optional maText;
 std::optional maUndoText;
 std::unique_ptr m_pRedlData;
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 6ba42b5327cc..e923db1f2fe9 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -185,13 +185,13 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
 
 SwUndoInsert::~SwUndoInsert()
 {
-if (m_pUndoNodeIndex) // delete the section from UndoNodes array
+if (m_oUndoNodeIndex) // delete the section from UndoNodes array
 {
 // Insert saves the content in IconSection
-SwNodes& rUNds = m_pUndoNodeIndex->GetNodes();
-rUNds.Delete(*m_pUndoNodeIndex,
-rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
-m_pUndoNodeIndex.reset();
+SwNodes& rUNds = m_oUndoNodeIndex->GetNodes();
+rUNds.Delete(*m_oUndoNodeIndex,
+rUNds.GetEndOfExtras().GetIndex() - m_oUndoNodeIndex->GetIndex());
+m_oUndoNodeIndex.reset();
 }
 else // the inserted text
 {
@@ -268,9 +268,8 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & 
rContext)
 
 if (!maText)
 {
-m_pUndoNodeIndex.reset(
-new SwNodeIndex(m_pDoc->GetNodes().GetEndOfContent()));
-MoveToUndoNds(aPaM, m_pUndoNodeIndex.get());
+m_oUndoNodeIndex.emplace(m_pDoc->GetNodes().GetEndOfContent());
+MoveToUndoNds(aPaM, &*m_oUndoNodeIndex);
 }
 m_nNode = aPaM.GetPoint()->GetNodeIndex();
 m_nContent = aPaM.GetPoint()->GetContentIndex();
@@ -341,9 +340,9 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & 
rContext)
 }
 else
 {
-// re-insert content again (first detach m_pUndoNodeIndex!)
-SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex();
-m_pUndoNodeIndex.reset();
+// re-insert content again (first detach m_oUndoNodeIndex!)
+SwNodeOffset const nMvNd = m_oUndoNodeIndex->GetIndex();
+m_oUndoNodeIndex.reset();
 MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
 }
 m_nNode = pPam->GetMark()->GetNodeIndex();
commit 296110d547903ef67f6d1048c044378d30cb1406
Author: Noel Grandin 
AuthorDate: Sun Aug 7 22:30:49 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 10 10:08:33 2022 +0200

unique_ptr->optional in SwUndoDelete

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

diff --git a/sw/source/core/inc/UndoDelete.hxx 
b/sw/source/core/inc/UndoDelete.hxx
index 2491af658c61..70e91367cb6b 100644
--- a/sw/source/core/inc/UndoDelete.hxx
+++ b/sw/source/core/inc/UndoDelete.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,7 +40,7 @@ class SwUndoDelete final
 , private SwUndRng
 , private SwUndoSaveContent
 {
-std::unique_ptr m_pMvStt;// Position of Nodes in 
UndoNodes-Array
+std::optional m_oMvStt;// Position of Nodes in 
UndoNodes-Array
 std::optional m_aSttStr, m_aEndStr;
 std::unique_ptr m_pRedlSaveData;
 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 82d5e9635b89..f60f8911815e 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -385,7 +385,7 @@ SwUndoDelete::SwUndoDelete(
 // Step 3: Moving into UndoArray...
 m_nNode = 

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

2022-07-28 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/docfmt.cxx  |7 +---
 sw/source/core/unocore/unocrsrhelper.cxx   |   41 -
 sw/source/core/unocore/unoobj.cxx  |2 -
 writerfilter/source/ooxml/OOXMLPropertySet.hxx |   34 ++--
 4 files changed, 48 insertions(+), 36 deletions(-)

New commits:
commit 156073b6ed57424da685bd141ee366bd4467c4e0
Author: Noel Grandin 
AuthorDate: Thu Jul 28 08:59:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 28 13:03:43 2022 +0200

these classes can be final

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

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
index b30fbaf61f9b..ceabfb586011 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
@@ -49,7 +49,7 @@ public:
 virtual OOXMLValue* clone() const;
 };
 
-class OOXMLProperty : public Sprm
+class OOXMLProperty final : public Sprm
 {
 public:
 typedef tools::SvRef Pointer_t;
@@ -79,7 +79,7 @@ public:
 void resolve(Properties& rProperties);
 };
 
-class OOXMLBinaryValue : public OOXMLValue
+class OOXMLBinaryValue final : public OOXMLValue
 {
 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
 
@@ -94,7 +94,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLBooleanValue : public OOXMLValue
+class OOXMLBooleanValue final : public OOXMLValue
 {
 bool mbValue;
 explicit OOXMLBooleanValue(bool bValue);
@@ -118,7 +118,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLStringValue : public OOXMLValue
+class OOXMLStringValue final : public OOXMLValue
 {
 OUString mStr;
 
@@ -139,7 +139,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLInputStreamValue : public OOXMLValue
+class OOXMLInputStreamValue final : public OOXMLValue
 {
 css::uno::Reference mxInputStream;
 
@@ -154,7 +154,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLPropertySet : public writerfilter::Reference
+class OOXMLPropertySet final : public writerfilter::Reference
 {
 public:
 typedef std::vector OOXMLProperties_t;
@@ -190,7 +190,7 @@ public:
 
 class OOXMLValue;
 
-class OOXMLTable : public writerfilter::Reference
+class OOXMLTable final : public writerfilter::Reference
 {
 public:
 typedef tools::SvRef ValuePointer_t;
@@ -211,7 +211,7 @@ private:
 PropertySets_t mPropertySets;
 };
 
-class OOXMLPropertySetValue : public OOXMLValue
+class OOXMLPropertySetValue final : public OOXMLValue
 {
 OOXMLPropertySet::Pointer_t mpPropertySet;
 
@@ -233,7 +233,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLIntegerValue : public OOXMLValue
+class OOXMLIntegerValue final : public OOXMLValue
 {
 sal_Int32 mnValue;
 explicit OOXMLIntegerValue(sal_Int32 nValue);
@@ -277,7 +277,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLHexColorValue : public OOXMLHexValue
+class OOXMLHexColorValue final : public OOXMLHexValue
 {
 public:
 explicit OOXMLHexColorValue(const char* pValue);
@@ -304,7 +304,7 @@ public:
 };
 
 /// npPt is quotient defining how much units are in 1 pt
-template  class OOXMLNthPtMeasureValue : public 
OOXMLUniversalMeasureValue
+template  class OOXMLNthPtMeasureValue final : public 
OOXMLUniversalMeasureValue
 {
 public:
 explicit OOXMLNthPtMeasureValue(const char* pValue)
@@ -320,7 +320,7 @@ typedef OOXMLNthPtMeasureValue<20> OOXMLTwipsMeasureValue;
 /// Handles OOXML's ST_HpsMeasure value.
 typedef OOXMLNthPtMeasureValue<2> OOXMLHpsMeasureValue;
 
-class OOXMLMeasurementOrPercentValue : public OOXMLValue
+class OOXMLMeasurementOrPercentValue final : public OOXMLValue
 {
 int mnValue;
 
@@ -334,7 +334,7 @@ public:
 #endif
 };
 
-class OOXMLShapeValue : public OOXMLValue
+class OOXMLShapeValue final : public OOXMLValue
 {
 css::uno::Reference mrShape;
 
@@ -349,7 +349,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLStarMathValue : public OOXMLValue
+class OOXMLStarMathValue final : public OOXMLValue
 {
 css::uno::Reference component;
 
@@ -364,7 +364,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLPropertySetEntryToString : public Properties
+class OOXMLPropertySetEntryToString final : public Properties
 {
 Id mnId;
 OUString mStr;
@@ -379,7 +379,7 @@ public:
 const OUString& getString() const { return mStr; }
 };
 
-class OOXMLPropertySetEntryToInteger : public Properties
+class OOXMLPropertySetEntryToInteger final : public Properties
 {
 Id mnId;
 int mnValue;
@@ -394,7 +394,7 @@ public:
 int getValue() const { return mnValue; }
 };
 
-class OOXMLPropertySetEntryToBool : public Properties
+class 

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

2022-06-16 Thread Stephan Bergmann (via logerrit)
 sw/source/ui/index/cnttab.cxx|   45 ++-
 sw/uiconfig/swriter/ui/assignstylesdialog.ui |1 
 vcl/source/treelist/treelist.cxx |3 +
 3 files changed, 40 insertions(+), 9 deletions(-)

New commits:
commit 7da269700347ced21a3a6b779366bb6ecc98b4ed
Author: Stephan Bergmann 
AuthorDate: Thu Jun 16 08:24:42 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 16 09:31:36 2022 +0200

This should apparently be a true assert

...as dereferencing a past-the-end iterator would be fatal, as seen with
 during 
UITest_sw_fieldDialog at

> warn:legacy.tools:19040:19040:vcl/source/treelist/treelist.cxx:1353: 
Entry not in model or wrong view
> 
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/debug/safe_iterator.h:283:
> error:
> attempt
> to
> dereference
> a
> past-the-end
>
> iterator
> .
>
> Objects involved in the operation:
> iterator "this" @ 0x0x7fc0a42e1fe8 {
> type = Hٷm�␡ (mutable iterator);
>   state = past-the-end;
>   references sequence with type 
`NSt7__debug13unordered_mapIP15SvTreeListEntrySt10unique_ptrI15SvViewDataEntrySt14default_deleteIS4_EESt4hashIS2_ESt8equal_toIS2_ESaISt4pairIKS2_S7_'
 @ 0x0x7fc0a42e1fe8
> }
>
>
> Fatal exception: Signal 6

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

diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index f118e5e35637..8f51e343fd98 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -1350,7 +1351,7 @@ const SvViewDataEntry* SvListView::GetViewData( const 
SvTreeListEntry* pEntry )
 SvViewDataEntry* SvListView::GetViewData( SvTreeListEntry* pEntry )
 {
 SvDataTable::iterator itr = m_pImpl->m_DataTable.find( pEntry );
-DBG_ASSERT(itr != m_pImpl->m_DataTable.end(),"Entry not in model or wrong 
view");
+assert(itr != m_pImpl->m_DataTable.end() && "Entry not in model or wrong 
view");
 return itr->second.get();
 }
 
commit 4e41879586fb24e925fb59dd06c43235f298e66d
Author: Caolán McNamara 
AuthorDate: Wed Jun 15 20:37:18 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 16 09:31:24 2022 +0200

Related: tdf#123846 don't auto toggle radiobuttons with left/right

just do the default cursor move, toggle can be triggered with
space/return or directly with 0-9 (+ a for 10)

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

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 1aac737639b9..759dccc46721 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -480,6 +480,8 @@ class SwAddStylesDlg_Impl : public SfxDialogController
 std::unique_ptr m_xRightPB;
 std::unique_ptr m_xHeaderTree;
 
+void ToggleOn(int nEntry, int nToggleColumn);
+
 DECL_LINK(OkHdl, weld::Button&, void);
 DECL_LINK(LeftRightHdl, weld::Button&, void);
 DECL_LINK(KeyInput, const KeyEvent&, bool);
@@ -614,15 +616,37 @@ IMPL_LINK(SwAddStylesDlg_Impl, KeyInput, const KeyEvent&, 
rKEvt, bool)
 vcl::KeyCode aCode = rKEvt.GetKeyCode();
 bool bHandled = false;
 
-if (aCode.GetCode() == KEY_ADD || aCode.GetCode() == KEY_RIGHT)
-{
-LeftRightHdl(*m_xRightPB);
-bHandled = true;
-}
-else if (aCode.GetCode() == KEY_SUBTRACT || aCode.GetCode() == KEY_LEFT)
+sal_uInt16 nCode = aCode.GetCode();
+switch (nCode)
 {
-LeftRightHdl(*m_xLeftPB);
-bHandled = true;
+case KEY_ADD:
+LeftRightHdl(*m_xRightPB);
+bHandled = true;
+break;
+case KEY_SUBTRACT:
+LeftRightHdl(*m_xLeftPB);
+bHandled = true;
+break;
+case KEY_0:
+case KEY_1:
+case KEY_2:
+case KEY_3:
+case KEY_4:
+case KEY_5:
+case KEY_6:
+case KEY_7:
+case KEY_8:
+case KEY_9:
+case KEY_A:
+{
+int nEntry = m_xHeaderTree->get_selected_index();
+if (nEntry != -1)
+{
+ToggleOn(nEntry, nCode != KEY_A ? nCode - KEY_0 : 10);
+bHandled = true;
+}
+break;
+}
 }
 
 return bHandled;
@@ -686,6 +710,11 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, 
weld::Button&, rBtn, void)
 ++nToggleColumn;
 }
 
+ToggleOn(nEntry, nToggleColumn);
+}
+
+void SwAddStylesDlg_Impl::ToggleOn(int nEntry, int 

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

2022-04-08 Thread Luboš Luňák (via logerrit)
 sw/source/core/inc/fntcache.hxx |7 ---
 sw/source/core/txtnode/fntcache.cxx |   14 +++---
 vcl/source/gdi/impglyphitem.cxx |7 ++-
 3 files changed, 13 insertions(+), 15 deletions(-)

New commits:
commit 7cc4b06fc44c06866cdabb4a8856c7cee3fcfe2d
Author: Luboš Luňák 
AuthorDate: Fri Apr 8 14:35:34 2022 +0200
Commit: Luboš Luňák 
CommitDate: Sat Apr 9 00:37:21 2022 +0200

use helper GetTextArray() in all places

Change-Id: Icec4326cf614574d7dabe6752f985b3ac4462fb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132744
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index 3b8934013059..4f58be568951 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -78,13 +78,6 @@ class SwFntObj final : public SwCacheObj
 bool m_bSymbol : 1;
 bool m_bPaintBlank : 1;
 
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
OUString& rStr,
- std::vector& rDXAry, sal_Int32 nIndex, 
sal_Int32 nLen,
- const vcl::text::TextLayoutCache* layoutCache = 
nullptr);
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry,
- sal_Int32 nLen);
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry);
-
 static tools::Long s_nPixWidth;
 static MapMode *s_pPixMap;
 
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 39e23613e669..65a4332b462d 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -756,20 +756,20 @@ static void lcl_DrawLineForWrongListData(
 rInf.GetOut().Pop();
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rDevice, const OUString& rStr, 
std::vector& rDXAry,
-sal_Int32 nIndex, sal_Int32 nLen, const 
vcl::text::TextLayoutCache* layoutCache)
+static void GetTextArray(const OutputDevice& rDevice, const OUString& rStr, 
std::vector& rDXAry,
+ sal_Int32 nIndex, sal_Int32 nLen, const 
vcl::text::TextLayoutCache* layoutCache = nullptr)
 {
 const SalLayoutGlyphs* pLayoutCache = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(, rStr, nIndex, nLen,
 0, layoutCache);
 rDevice.GetTextArray(rStr, , nIndex, nLen, layoutCache, 
pLayoutCache);
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry)
+static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry)
 {
 return GetTextArray(rOutputDevice, rInf.GetText(), rDXAry, 
rInf.GetIdx().get(), rInf.GetLen().get(), rInf.GetVclCache());
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry, sal_Int32 nLen)
+static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry, sal_Int32 nLen)
 {
 // Substring is fine.
 assert( nLen <= rInf.GetLen().get());
@@ -2246,7 +2246,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
 
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), ,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
 tools::Long nAvgWidthPerChar = aKernArray[sal_Int32(rInf.GetLen()) 
- 1] / sal_Int32(rInf.GetLen());
@@ -2277,7 +2277,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf );
 
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), ,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 tools::Long nCurrPos = aKernArray[sal_Int32(nTextBreak)] + 
nGridWidthAdd;
 while (++nTextBreak < rInf.GetLen() && nTextWidth >= nCurrPos)
@@ -2394,7 +2394,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 else if (nLn > nTextBreak2 + nTextBreak2)
 nLn = nTextBreak2 + nTextBreak2;
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), ,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
 if( rInf.GetScriptInfo()->Compress( aKernArray.data(), rInf.GetIdx(), 
nLn,
 rInf.GetKanaComp(), 
o3tl::narrowing(GetHeight( m_nActual )),
commit 

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

2022-03-29 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/utlui/content.cxx |3 ++-
 sw/source/uibase/utlui/navipi.cxx  |1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 7684e31b16408b8a2f36ea2aa733d45bd40f5bc6
Author: Caolán McNamara 
AuthorDate: Mon Mar 28 20:57:41 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Mar 29 10:21:25 2022 +0200

cid#1503287 silence Unchecked dynamic_cast

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

diff --git a/sw/source/uibase/utlui/navipi.cxx 
b/sw/source/uibase/utlui/navipi.cxx
index 3d9f8f73394c..669234d6bcf7 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -541,6 +541,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent,
 m_xContent2Dispatch->GetControllerForCommand(".uno:NavElement");
 NavElementToolBoxControl* pToolBoxControl =
 dynamic_cast(xController.get());
+assert(pToolBoxControl);
 m_pNavigateByComboBox = pToolBoxControl->GetComboBox();
 
 // Restore content tree settings before calling UpdateInitShow. 
UpdateInitShow calls Fillbox,
commit 1f83834bd0d78232762f7467a65ebdf0d4b9f7fa
Author: Caolán McNamara 
AuthorDate: Mon Mar 28 20:55:41 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Mar 29 10:21:10 2022 +0200

cid#1503286 Unchecked return value

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index fa5e28167be0..36f7801f375a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4532,7 +4532,8 @@ IMPL_LINK_NOARG(SwContentTree, SelectHdl, 
weld::TreeView&, void)
 return;
 // Select the content type in the Navigate By control
 std::unique_ptr xEntry(m_xTreeView->make_iterator());
-m_xTreeView->get_selected(xEntry.get());
+if (!m_xTreeView->get_selected(xEntry.get()))
+return;
 while (m_xTreeView->get_iter_depth(*xEntry))
 m_xTreeView->iter_parent(*xEntry);
 m_pDialog->SelectNavigateByContentType(m_xTreeView->get_text(*xEntry));


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

2022-03-09 Thread Michael Stahl (via logerrit)
 sw/source/core/edit/edlingu.cxx  |   19 +++
 sw/source/uibase/uiview/viewling.cxx |9 -
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit e07b9c5142af838648a4d03a0bdce76612cf7535
Author: Michael Stahl 
AuthorDate: Tue Mar 8 13:58:28 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 9 10:43:06 2022 +0100

tdf#147416 sw_redlinehide: fix spell checking popup

The problem is that SwEditShell::GetCorrection() uses the SwTextNode
text without filtering redlines.

Using ExpandMode::ReplaceMode should work as it will replace
CH_TXTATR_INWORD with nothing and CH_TXTATR_BREAKWORD with ZWSP.

Unfortunately there isn't yet a mode that can handle fieldmarks as they
are displayed in the layout.

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

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 3c0d8b2e8524..9c6228dffbf7 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -840,11 +840,16 @@ void SwEditShell::HandleCorrectionError(const OUString& 
aText, SwPosition aPos,
 SwRect& rSelectRect)
 {
 // save the start and end positions of the line and the starting point
+SwNode const& rNode(GetCursor()->GetPoint()->nNode.GetNode());
 Push();
 LeftMargin();
-const sal_Int32 nLineStart = GetCursor()->GetPoint()->nContent.GetIndex();
+const sal_Int32 nLineStart =  == 
()->GetPoint()->nNode.GetNode()
+? GetCursor()->GetPoint()->nContent.GetIndex()
+: 0;
 RightMargin();
-const sal_Int32 nLineEnd = GetCursor()->GetPoint()->nContent.GetIndex();
+const sal_Int32 nLineEnd =  == 
()->GetPoint()->nNode.GetNode()
+? GetCursor()->GetPoint()->nContent.GetIndex()
+: rNode.GetTextNode()->Len();
 Pop(PopMode::DeleteCurrent);
 
 // make sure the selection build later from the data below does
@@ -927,8 +932,14 @@ uno::Reference< XSpellAlternatives >
 if (pWrong->InWrongWord(nBegin, nLen) && !pNode->IsSymbolAt(nBegin))
 {
 const OUString aText(pNode->GetText().copy(nBegin, nLen));
-OUString aWord = 
aText.replaceAll(OUStringChar(CH_TXTATR_BREAKWORD), "")
-  .replaceAll(OUStringChar(CH_TXTATR_INWORD), 
"");
+// TODO: this doesn't handle fieldmarks properly
+ModelToViewHelper const aConversionMap(*pNode, GetLayout(),
+ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | 
ExpandMode::ReplaceMode
+| (GetLayout()->IsHideRedlines() ? ExpandMode::HideDeletions : 
ExpandMode(0))
+| (GetViewOptions()->IsShowHiddenChar() ? ExpandMode(0) : 
ExpandMode::HideInvisible));
+auto const 
nBeginView(aConversionMap.ConvertToViewPosition(nBegin));
+OUString const aWord(aConversionMap.getViewText().copy(nBeginView,
+aConversionMap.ConvertToViewPosition(nBegin+nLen) - 
nBeginView));
 
 uno::Reference< XSpellChecker1 >  xSpell( ::GetSpellChecker() );
 if( xSpell.is() )
commit d814941b31b4f9cc8b6e9bd4ddc5188015529707
Author: Michael Stahl 
AuthorDate: Tue Mar 8 13:54:08 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 9 10:42:53 2022 +0100

sw_redlinehide: get text from shell, not node in ExecSpellPopup()

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

diff --git a/sw/source/uibase/uiview/viewling.cxx 
b/sw/source/uibase/uiview/viewling.cxx
index 93b2d5577da9..854108274fbe 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -692,7 +692,14 @@ bool SwView::ExecSpellPopup(const Point& rPt)
 // get paragraph text
 OUString aParaText;
 if (pNode)
-aParaText = pNode->GetText();// this may include 
hidden text but that should be Ok
+{
+pCursorShell->Push();
+pCursorShell->MovePara(GoCurrPara, fnParaStart);
+pCursorShell->SetMark();
+pCursorShell->MovePara(GoCurrPara, fnParaEnd);
+aParaText = pCursorShell->GetSelText();
+pCursorShell->Pop(SwCursorShell::PopMode::DeleteCurrent);
+}
 else
 {
 OSL_FAIL("text node expected but not found" );


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

2022-03-04 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/ww8par.cxx   |8 ++--
 sw/source/ui/index/swuiidxmrk.cxx |5 +++--
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 80c0625995585a43f8dd4cbc7404df47f62dfae9
Author: Caolán McNamara 
AuthorDate: Fri Mar 4 14:59:41 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 4 22:35:39 2022 +0100

cid#1500652 silence Explicit null dereferenced

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

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index fb5ae141563c..02e9f20454c0 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1719,6 +1719,7 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
 ++nRightRow;
 bLeft = !bLeft;
 }
+assert(m_xTypeListBox && "this will exist after the loop");
 EnableHdl(*m_xTypeListBox);
 }
 
@@ -1726,13 +1727,13 @@ OUString  
SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons
 {
 if( AUTH_FIELD_AUTHORITY_TYPE == eField )
 {
-OSL_ENSURE(m_xTypeListBox, "No ListBox");
+assert(m_xTypeListBox && "No ListBox");
 return OUString::number(m_xTypeListBox->get_active());
 }
 
 if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
 {
-OSL_ENSURE(m_xIdentifierBox, "No ComboBox");
+assert(m_xIdentifierBox && "No ComboBox");
 return m_xIdentifierBox->get_active_text();
 }
 
commit 6b566ed9a32c5c0eb3bde7512733c0c11a479ecd
Author: Caolán McNamara 
AuthorDate: Fri Mar 4 14:55:22 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 4 22:35:25 2022 +0100

cid#1500666 Explicit null dereferenced

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 6614c5195f28..469118b61ebd 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -280,7 +280,9 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, 
SwDocShell const * pDocS
 // ANSI characters in ansiPath, including the terminating NULL 
character
 sal_uInt32 nUnits = 0;
 rStrm.ReadUInt32(nUnits);
-if (nUnits)
+if (!nUnits)
+xShortName.reset(new OUString);
+else
 {
 OString sStr(read_uInt8s_ToOString(rStrm, nUnits - 1));
 rStrm.SeekRel(sizeof(sal_uInt8)); // skip null-byte at end
@@ -312,7 +314,9 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, 
SwDocShell const * pDocS
 sal_uInt32 nStrLen(0);
 rStrm.ReadUInt32( nStrLen );
 nStrLen /= 2;
-if (nStrLen)
+if (!nStrLen)
+xLongName.reset(new OUString);
+else
 {
 xLongName.reset(new OUString(read_uInt16s_ToOUString(rStrm, 
nStrLen - 1)));
 rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end


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

2022-03-01 Thread Noel Grandin (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +-
 sw/source/filter/ww8/writerhelper.cxx|2 
 sw/source/filter/ww8/writerhelper.hxx|   91 ---
 sw/source/filter/ww8/writerwordglue.cxx  |3 
 sw/source/filter/ww8/wrtw8nds.cxx|   20 ++---
 sw/source/filter/ww8/wrtw8sty.cxx|4 -
 sw/source/filter/ww8/wrtww8.cxx  |2 
 sw/source/filter/ww8/ww8atr.cxx  |6 -
 sw/source/filter/ww8/ww8par.cxx  |4 -
 sw/source/filter/ww8/ww8par2.cxx |2 
 sw/source/filter/ww8/ww8par3.cxx |6 -
 sw/source/filter/ww8/ww8par5.cxx |6 -
 sw/source/filter/ww8/ww8par6.cxx |   12 +--
 13 files changed, 37 insertions(+), 131 deletions(-)

New commits:
commit 2d33c22e55b7af7481cc36a1fff979a33daf8519
Author: Noel Grandin 
AuthorDate: Tue Mar 1 19:20:44 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 2 08:31:49 2022 +0100

remove writerhelper::DefaultItemGet

the TypedWhichId template methods on SfxItemPool supercede this

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

diff --git a/sw/source/filter/ww8/writerhelper.hxx 
b/sw/source/filter/ww8/writerhelper.hxx
index e07c6759d9c6..a9bb8ce04a66 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -248,71 +248,6 @@ namespace sw
 return dynamic_cast(pItem);
 }
 
-/** Extract a default SfxPoolItem derived property from a SfxItemPool
-
-Writer's attributes are retrieved by passing a numeric identifier
-and receiving a SfxPoolItem reference which must then typically be
-cast back to its original type which is both tedious and verbose.
-
-DefaultItemGet returns a reference to the default property of a
-given SfxItemPool for a given property id, e.g. default fontsize
-
-DefaultItemGet uses item_cast () on the retrieved reference to test
-that the retrieved property is of the type that the developer 
thinks
-it is.
-
-@param rPool
-The SfxItemPool whose default property we want
-
-@param eType
-The numeric identifier of the default property to be retrieved
-
-@tplparam T
-A SfxPoolItem derived class of the retrieved property
-
-@exception std::bad_cast Thrown if the property was not a T
-
-@return The T requested
-*/
-template const T & DefaultItemGet(const SfxItemPool ,
-sal_uInt16 eType)
-{
-return item_cast(rPool.GetDefaultItem(eType));
-}
-
-/** Extract a default SfxPoolItem derived property from a SwDoc
-
-Writer's attributes are retrieved by passing a numeric identifier
-and receiving a SfxPoolItem reference which must then typically be
-cast back to its original type which is both tedious and verbose.
-
-DefaultItemGet returns a reference to the default property of a
-given SwDoc (Writer Document) for a given property id, e.g default
-fontsize
-
-DefaultItemGet uses item_cast () on the retrieved reference to test
-that the retrieved property is of the type that the developer 
thinks
-it is.
-
-@param rPool
-The SfxItemPool whose default property we want
-
-@param eType
-The numeric identifier of the default property to be retrieved
-
-@tplparam T
-A SfxPoolItem derived class of the retrieved property
-
-@exception std::bad_cast Thrown if the property was not a T
-
-@return The T requested
-*/
-template const T & DefaultItemGet(const SwDoc ,
-sal_uInt16 eType)
-{
-return DefaultItemGet(rDoc.GetAttrPool(), eType);
-}
-
 /** Get the Paragraph Styles of a SwDoc
 
 Writer's styles are in one of those dreaded macro based pre-STL
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index ff9304815f78..658cadabba08 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1706,7 +1706,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() 
const
 if (SfxItemState::SET != eState || !pRet || (!pRet->GetGraphic() &&
 pRet->GetColor() == COL_TRANSPARENT))
 {
-pRet = &(DefaultItemGet(m_rDoc,RES_BACKGROUND));
+pRet = _rDoc.GetAttrPool().GetDefaultItem(RES_BACKGROUND);
 }
 return pRet;
 }
@@ -3644,12 +3644,12 @@ WW8Ruby::WW8Ruby(const SwTextNode& rNode, const 
SwFormatRuby& rRuby, const MSWor
 pPool = pPool ? pPool : _rDoc.GetAttrPool();
 
 
-const 

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

2022-01-01 Thread Noel Grandin (via logerrit)
 sw/source/core/docnode/retrievedinputstreamdata.cxx |   13 +
 sw/source/core/docnode/threadmanager.cxx|   13 +++--
 sw/source/core/docnode/threadmanager.hxx|8 
 sw/source/core/inc/retrievedinputstreamdata.hxx |6 +++---
 4 files changed, 19 insertions(+), 21 deletions(-)

New commits:
commit 977e0bf1fc468976cf9b86df142807039623a71c
Author: Noel Grandin 
AuthorDate: Tue Dec 21 17:32:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 1 13:14:20 2022 +0100

osl::Mutex->std::mutex in ThreadManager

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

diff --git a/sw/source/core/docnode/threadmanager.cxx 
b/sw/source/core/docnode/threadmanager.cxx
index 311c88e75a4d..20d71e746aea 100644
--- a/sw/source/core/docnode/threadmanager.cxx
+++ b/sw/source/core/docnode/threadmanager.cxx
@@ -71,7 +71,7 @@ oslInterlockedCount ThreadManager::AddThread(
 const rtl::Reference< ObservableThread >& rThread )
 
 {
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
 // create new thread
 tThreadData aThreadData;
@@ -89,7 +89,7 @@ oslInterlockedCount ThreadManager::AddThread(
 
 // add thread to manager
 if ( maStartedThreads.size() < snStartedSize &&
- !StartingOfThreadsSuspended() )
+ !mbStartingOfThreadsSuspended )
 {
 // Try to start thread
 if ( !StartThread( aThreadData ) )
@@ -116,7 +116,7 @@ void ThreadManager::RemoveThread( const oslInterlockedCount 
nThreadID,
   const bool bThreadFinished )
 {
 // --> SAFE 
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
 std::deque< tThreadData >::iterator aIter =
 std::find_if( maStartedThreads.begin(), maStartedThreads.end(),
@@ -143,6 +143,7 @@ void ThreadManager::RemoveThread( const oslInterlockedCount 
nThreadID,
 }
 
 // Try to start thread from waiting ones
+aGuard.unlock();
 TryToStartNewThread( nullptr );
 }
 else
@@ -205,9 +206,9 @@ bool ThreadManager::StartThread( const tThreadData& 
rThreadData )
 
 IMPL_LINK_NOARG(ThreadManager, TryToStartNewThread, Timer *, void)
 {
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
-if ( StartingOfThreadsSuspended() )
+if ( mbStartingOfThreadsSuspended )
 return;
 
 // Try to start thread from waiting ones
@@ -225,7 +226,7 @@ IMPL_LINK_NOARG(ThreadManager, TryToStartNewThread, Timer 
*, void)
 
 void ThreadManager::ResumeStartingOfThreads()
 {
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
 mbStartingOfThreadsSuspended = false;
 
diff --git a/sw/source/core/docnode/threadmanager.hxx 
b/sw/source/core/docnode/threadmanager.hxx
index 87a3d8b0b93d..ace0bc03164b 100644
--- a/sw/source/core/docnode/threadmanager.hxx
+++ b/sw/source/core/docnode/threadmanager.hxx
@@ -20,7 +20,7 @@
 #pragma once
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,7 +79,7 @@ class ThreadManager final
 */
 void SuspendStartingOfThreads()
 {
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
 mbStartingOfThreadsSuspended = true;
 }
@@ -90,7 +90,7 @@ class ThreadManager final
 
 bool StartingOfThreadsSuspended()
 {
-osl::MutexGuard aGuard(maMutex);
+std::unique_lock aGuard(maMutex);
 
 return mbStartingOfThreadsSuspended;
 }
@@ -111,7 +111,7 @@ class ThreadManager final
 
 static const std::deque< tThreadData >::size_type snStartedSize;
 
-osl::Mutex maMutex;
+std::mutex maMutex;
 
 css::uno::WeakReference< css::util::XJobManager > mrThreadJoiner;
 
commit 34b67c5cb3338c4bd72f42df99a4b79ca1588071
Author: Noel Grandin 
AuthorDate: Tue Dec 21 17:40:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 1 13:14:06 2022 +0100

osl::Mutex->std::mutex in SwRetrievedInputStreamDataManager

drop the locking call in

IMPL_LINK( SwRetrievedInputStreamDataManager, LinkedInputStreamReady

because it doesn't actually touch any related data and the lock
is taken in the call to PopData.

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

diff --git a/sw/source/core/docnode/retrievedinputstreamdata.cxx 
b/sw/source/core/docnode/retrievedinputstreamdata.cxx
index 5612096c1fc4..311be07ca719 100644
--- a/sw/source/core/docnode/retrievedinputstreamdata.cxx
+++ b/sw/source/core/docnode/retrievedinputstreamdata.cxx
@@ -34,7 +34,7 @@ SwRetrievedInputStreamDataManager& 

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

2021-12-31 Thread Noel Grandin (via logerrit)
 sw/source/core/docnode/swthreadjoiner.cxx |6 +++---
 sw/source/core/unocore/unoframe.cxx   |   19 +--
 2 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 15314d2d28535d1baa9694f9d01cb8b34cf6f0d2
Author: Noel Grandin 
AuthorDate: Tue Dec 21 19:03:27 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 1 07:14:52 2022 +0100

osl::Mutex->std::mutex in SwXFrame

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

diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index da51bdc3455f..73f713b438aa 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -97,7 +97,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -109,7 +109,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1151,14 +1151,10 @@ bool SwOLEProperties_Impl::AnyToItemSet(
 
 class SwXFrame::Impl
 {
-private:
-::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
-
 public:
 uno::WeakReference m_wThis;
-::comphelper::OInterfaceContainerHelper3 
m_EventListeners;
-
-Impl() : m_EventListeners(m_Mutex) { }
+std::mutex m_Mutex; // just for OInterfaceContainerHelper4
+::comphelper::OInterfaceContainerHelper4 
m_EventListeners;
 };
 
 const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
@@ -2623,8 +2619,11 @@ void SwXFrame::DisposeInternal()
 {   // fdo#72695: if UNO object is already dead, don't revive it with event
 return;
 }
-lang::EventObject const ev(xThis);
-m_pImpl->m_EventListeners.disposeAndClear(ev);
+{
+lang::EventObject const ev(xThis);
+std::unique_lock aGuard(m_pImpl->m_Mutex);
+m_pImpl->m_EventListeners.disposeAndClear(aGuard, ev);
+}
 m_pFrameFormat = nullptr;
 EndListeningAll();
 }
commit 35c92336c5e1e81f87597350975296172bc36258
Author: Noel Grandin 
AuthorDate: Tue Dec 21 17:25:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 1 07:14:38 2022 +0100

osl::Mutex->std::mutex in SwThreadJoiner

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

diff --git a/sw/source/core/docnode/swthreadjoiner.cxx 
b/sw/source/core/docnode/swthreadjoiner.cxx
index d506bb7f115b..6ff198d7dda3 100644
--- a/sw/source/core/docnode/swthreadjoiner.cxx
+++ b/sw/source/core/docnode/swthreadjoiner.cxx
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 // Testing
 
@@ -33,8 +33,8 @@ uno::Reference pThreadJoiner;
 
 uno::Reference& SwThreadJoiner::GetThreadJoiner()
 {
-static osl::Mutex theJoinerMutex;
-osl::MutexGuard aGuard(theJoinerMutex);
+static std::mutex theJoinerMutex;
+std::unique_lock aGuard(theJoinerMutex);
 
 if (!pThreadJoiner.is())
 {


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

2021-12-31 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/unoftn.cxx |   16 
 sw/source/core/unocore/unoidx.cxx |   16 ++--
 2 files changed, 18 insertions(+), 14 deletions(-)

New commits:
commit 2d9d0b549e14f3a71414a573d67bd0f63f54dac2
Author: Noel Grandin 
AuthorDate: Tue Dec 21 20:18:33 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 31 17:57:25 2021 +0100

osl::Mutex->std::mutex in SwXDocumentIndexMark

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

diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index 370d41a177d9..e4276a618410 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -32,7 +32,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -1478,7 +1479,6 @@ lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
 class SwXDocumentIndexMark::Impl final: public SvtListener
 {
 private:
-::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
 SwXDocumentIndexMark & m_rThis;
 bool m_bInReplaceMark;
 
@@ -1487,7 +1487,8 @@ public:
 uno::WeakReference m_wThis;
 SfxItemPropertySet const& m_rPropSet;
 const TOXTypes m_eTOXType;
-::comphelper::OInterfaceContainerHelper3 
m_EventListeners;
+std::mutex m_Mutex; // just for OInterfaceContainerHelper4
+::comphelper::OInterfaceContainerHelper4 
m_EventListeners;
 bool m_bIsDescriptor;
 const SwTOXType* m_pTOXType;
 const SwTOXMark* m_pTOXMark;
@@ -1514,7 +1515,6 @@ public:
 , m_rPropSet(
 *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType)))
 , m_eTOXType(eType)
-, m_EventListeners(m_Mutex)
 , m_bIsDescriptor(nullptr == pMark)
 , m_pTOXType(pType)
 , m_pTOXMark(pMark)
@@ -1555,7 +1555,8 @@ public:
 OSL_FAIL("ReplaceTOXMark() failed!");
 lang::EventObject const ev(
 static_cast< ::cppu::OWeakObject&>(m_rThis));
-m_EventListeners.disposeAndClear(ev);
+std::unique_lock aGuard(m_Mutex);
+m_EventListeners.disposeAndClear(aGuard, ev);
 throw;
 }
 }
@@ -1573,7 +1574,8 @@ void SwXDocumentIndexMark::Impl::Invalidate()
 if (xThis.is())
 {
 lang::EventObject const ev(xThis);
-m_EventListeners.disposeAndClear(ev);
+std::unique_lock aGuard(m_Mutex);
+m_EventListeners.disposeAndClear(aGuard, ev);
 }
 }
 EndListeningAll();
@@ -1987,6 +1989,7 @@ SwXDocumentIndexMark::addEventListener(
 const uno::Reference< lang::XEventListener > & xListener)
 {
 // no need to lock here as m_pImpl is const and container threadsafe
+std::unique_lock aGuard(m_pImpl->m_Mutex);
 m_pImpl->m_EventListeners.addInterface(xListener);
 }
 
@@ -1995,6 +1998,7 @@ SwXDocumentIndexMark::removeEventListener(
 const uno::Reference< lang::XEventListener > & xListener)
 {
 // no need to lock here as m_pImpl is const and container threadsafe
+std::unique_lock aGuard(m_pImpl->m_Mutex);
 m_pImpl->m_EventListeners.removeInterface(xListener);
 }
 
commit dcd17b7a39608f7b962d330c3ac771e18ed75bc7
Author: Noel Grandin 
AuthorDate: Tue Dec 21 19:08:05 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 31 17:57:05 2021 +0100

osl::Mutex->std::mutex in SwXFootnote

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

diff --git a/sw/source/core/unocore/unoftn.cxx 
b/sw/source/core/unocore/unoftn.cxx
index c00100d440fc..82c7f2555243 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -19,12 +19,12 @@
 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -61,15 +61,13 @@ GetSupportedServiceNamesImpl(
 class SwXFootnote::Impl
 : public SvtListener
 {
-private:
-::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3
-
 public:
 
 SwXFootnote& m_rThis;
 uno::WeakReference m_wThis;
 const bool m_bIsEndnote;
-::comphelper::OInterfaceContainerHelper3 
m_EventListeners;
+std::mutex m_Mutex; // just for OInterfaceContainerHelper4
+::comphelper::OInterfaceContainerHelper4 
m_EventListeners;
 bool m_bIsDescriptor;
 SwFormatFootnote* m_pFormatFootnote;
 OUString m_sLabel;
@@ -79,7 +77,6 @@ public:
 const bool bIsEndnote)
 : m_rThis(rThis)
 , m_bIsEndnote(bIsEndnote)
-, m_EventListeners(m_Mutex)
 , m_bIsDescriptor(nullptr == pFootnote)
 , m_pFormatFootnote(pFootnote)
 {
@@ -115,7 +112,8 @@ void 

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

2021-12-29 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/unotbl.cxx |   74 --
 sw/source/uibase/dbui/dbmgr.cxx   |   10 ++---
 2 files changed, 45 insertions(+), 39 deletions(-)

New commits:
commit 3cb1da0e7bf86bd9bb12e3b8ace900caa4841ece
Author: Noel Grandin 
AuthorDate: Wed Dec 22 20:30:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 30 07:43:06 2021 +0100

osl::Mutex->std::mutex in SwDBManager

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

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 9323c52770b2..fd9add19834c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -103,7 +103,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -122,6 +121,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -293,7 +293,7 @@ struct SwDBManager::SwDBManager_Impl
 VclPtr  pMergeDialog;
 rtl::Reference 
m_xDisposeListener;
 rtl::Reference m_xDataSourceRemovedListener;
-osl::Mutexm_aAllEmailSendMutex;
+std::mutexm_aAllEmailSendMutex;
 uno::Reference< mail::XMailMessage> m_xLastMessage;
 
 explicit SwDBManager_Impl(SwDBManager& rDBManager)
@@ -1017,7 +1017,7 @@ public:
 
 virtual void mailDelivered( uno::Reference< mail::XMailMessage> xMessage ) 
override
 {
-osl::MutexGuard aGuard( m_rDBManager.m_pImpl->m_aAllEmailSendMutex );
+std::unique_lock aGuard( m_rDBManager.m_pImpl->m_aAllEmailSendMutex );
 if ( m_rDBManager.m_pImpl->m_xLastMessage == xMessage )
 m_rDBManager.m_pImpl->m_xLastMessage.clear();
 }
@@ -1025,7 +1025,7 @@ public:
 virtual void mailDeliveryError( ::rtl::Reference 
xMailDispatcher,
 uno::Reference< mail::XMailMessage>, const OUString& ) override
 {
-osl::MutexGuard aGuard( m_rDBManager.m_pImpl->m_aAllEmailSendMutex );
+std::unique_lock aGuard( m_rDBManager.m_pImpl->m_aAllEmailSendMutex );
 m_rDBManager.m_aMergeStatus = MergeStatus::Error;
 m_rDBManager.m_pImpl->m_xLastMessage.clear();
 xMailDispatcher->stop();
@@ -1479,7 +1479,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
 sMailEncoding, pStoreToFilter->GetMimeType() );
 if( xMessage.is() )
 {
-osl::MutexGuard aGuard( 
m_pImpl->m_aAllEmailSendMutex );
+std::unique_lock aGuard( 
m_pImpl->m_aAllEmailSendMutex );
 m_pImpl->m_xLastMessage.set( xMessage );
 xMailDispatcher->enqueueMailMessage( xMessage 
);
 if( !xMailDispatcher->isStarted() )
commit d11b7cca060f0df710248697dab6659d8d3ca01f
Author: Noel Grandin 
AuthorDate: Wed Dec 22 20:29:20 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 30 07:42:53 2021 +0100

osl::Mutex->std::mutex in SwXTextTable

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

diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index d6c24af4065c..7853d7ccbe2b 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -148,20 +148,10 @@ namespace
 
 void lcl_SendChartEvent(
 uno::Reference const& xSource,
-
::comphelper::OInterfaceContainerHelper3& 
rListeners)
+
::comphelper::OInterfaceContainerHelper4 
& rListeners)
 {
-rListeners.notifyEach(
-::XChartDataChangeEventListener::chartDataChanged,
-createChartEvent(xSource));
-}
-
-void lcl_SendChartEvent(
-uno::Reference const& xSource,
-::comphelper::OMultiTypeInterfaceContainerHelper2 const& 
rListeners)
-{
-auto 
pContainer(rListeners.getContainer(cppu::UnoType::get()));
-if (pContainer)
-pContainer->notifyEach(
+if (rListeners.getLength())
+rListeners.notifyEach(
 ::XChartDataChangeEventListener::chartDataChanged,
 createChartEvent(xSource));
 }
@@ -1905,11 +1895,12 @@ class SwXTextTable::Impl
 {
 private:
 SwFrameFormat* m_pFrameFormat;
-::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
 
 public:
 uno::WeakReference m_wThis;
-::comphelper::OMultiTypeInterfaceContainerHelper2 m_Listeners;
+std::mutex m_Mutex; // just for OInterfaceContainerHelper4
+::comphelper::OInterfaceContainerHelper4 
m_EventListeners;
+  

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

2021-12-29 Thread Szymon Kłos (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx |3 +++
 vcl/source/window/builder.cxx |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 2a881af4e93f8744bc6bea43f3a06fa531626c22
Author: Szymon Kłos 
AuthorDate: Sat Nov 6 15:47:08 2021 +0100
Commit: Szymon Kłos 
CommitDate: Wed Dec 29 13:23:36 2021 +0100

lok: no need to layout comments in writer

Annotations in writer use EditEngine what caused to
send cursor position from that EditEngine to online
and showing cursor in the top left corner of a document
after comment insertion.

We don't need to resize/update position comment windows
as we send only abstract description of the comments
and later rendering is handled by client.

Change-Id: I1df0e44f9500c438efd00942a372754c7fbaa170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124794
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127677
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index c10d205d3848..6981b422ca0e 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -805,6 +805,9 @@ void SwAnnotationWin::DoResize()
 
 void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
 {
+if (comphelper::LibreOfficeKit::isActive())
+return;
+
 InterimItemWindow::SetSizePixel(rNewSize);
 
 if (mpShadow)
commit d434be2d76febe3302047640a4c4f1820ecb8870
Author: Szymon Kłos 
AuthorDate: Wed Oct 27 13:04:47 2021 +0200
Commit: Szymon Kłos 
CommitDate: Wed Dec 29 13:23:25 2021 +0100

jsdialogs: use for MessageDialogs

Change-Id: Ie82558356cd9669f21afefd1ee88d769bf28eb8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124270
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127676
Tested-by: Szymon Kłos 

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 1e0e8a047f81..5aa38a038ea8 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -210,9 +210,9 @@ std::unique_ptr 
Application::CreateInterimBuilder(vcl::Window* pP
 
 weld::MessageDialog* Application::CreateMessageDialog(weld::Widget* pParent, 
VclMessageType eMessageType,
   VclButtonsType 
eButtonType, const OUString& rPrimaryMessage,
-  bool bMobile)
+  bool /*bMobile*/)
 {
-if (bMobile)
+if (comphelper::LibreOfficeKit::isActive())
 return JSInstanceBuilder::CreateMessageDialog(pParent, eMessageType, 
eButtonType, rPrimaryMessage);
 else
 return ImplGetSVData()->mpDefInst->CreateMessageDialog(pParent, 
eMessageType, eButtonType, rPrimaryMessage);


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

2021-12-21 Thread Caolán McNamara (via logerrit)
 sw/source/core/txtnode/fntcache.cxx |   16 
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit 3bcbec1fd0ba9953d445a4076114e4c6d027e45f
Author: Caolán McNamara 
AuthorDate: Tue Dec 21 12:10:39 2021 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 21 20:18:38 2021 +0100

move variable to where its set

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

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index e055d8ce3d39..ec871eacb73a 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1487,7 +1487,6 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 bBullet = false;
 std::vector aKernArray;
 CreateScrFont( *rInf.GetShell(), rInf.GetOut() );
-tools::Long nScrPos;
 
 // get screen array
 std::vector aScrArray;
@@ -1592,7 +1591,7 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 }
 }
 
-nScrPos = aScrArray[ 0 ];
+tools::Long nScrPos = aScrArray[ 0 ];
 
 if( bBullet )
 {
commit e240ce9a491e2f99d4a00e61a86a1fa46f44d75d
Author: Caolán McNamara 
AuthorDate: Tue Dec 21 12:03:57 2021 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 21 20:18:22 2021 +0100

format these two related blocks the same

no logic change intended

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

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index faf31191c7e8..e055d8ce3d39 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1689,7 +1689,6 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 for (sal_Int32 i = 1; i < sal_Int32(nCnt); ++i, nKernSum += 
rInf.GetKern())
 {
 sal_Unicode nCh = rInf.GetText()[sal_Int32(rInf.GetIdx()) + i];
-
 tools::Long nScr = aScrArray[ i ] - aScrArray[ i - 1 ];
 
 // If there is an (ex-)Space before us, position optimally,
@@ -1697,16 +1696,10 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // if we _are_ an ex-Space, position us left-aligned to the
 // printer position.
 if ( nCh == CH_BLANK )
-{
 nScrPos = aKernArray[i-1] + nScr;
-}
 else
 {
-if ( cChPrev == CH_BLANK )
-{
-nScrPos = aKernArray[i-1] + nScr;
-}
-else if ( cChPrev == '-' )
+if (cChPrev == CH_BLANK || cChPrev == '-')
 nScrPos = aKernArray[i-1] + nScr;
 else
 {
@@ -2049,11 +2042,11 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
 sal_Unicode nCh = rInf.GetText()[ sal_Int32(rInf.GetIdx()) + i 
];
 tools::Long nScr = aScrArray[ i ] - aScrArray[ i - 1 ];
 if ( nCh == CH_BLANK )
-nScrPos = aKernArray[i-1]+nScr;
+nScrPos = aKernArray[i-1] + nScr;
 else
 {
 if ( nChPrev == CH_BLANK || nChPrev == '-' )
-nScrPos = aKernArray[i-1]+nScr;
+nScrPos = aKernArray[i-1] + nScr;
 else
 {
 nScrPos += nScr;


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

2021-12-14 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 19f2054c6063177d08c818c5b7eeba7ab9178249
Author: Michael Stahl 
AuthorDate: Tue Dec 14 19:34:36 2021 +0100
Commit: Michael Stahl 
CommitDate: Tue Dec 14 20:43:35 2021 +0100

tdf#141175 sw_redlinehide: fix crash in lcl_DeleteRedlines()

The GetNext() returns itself if it's alone in the Ring.

(regression from 27aa4b16bf704d0246595750daf57b57ff2577b3)

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 75a365908d53..3ddcf13c698e 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -408,7 +408,8 @@ namespace
 *pDelPam->GetPoint(), nDelCount );
 }
 
-if (pDelPam->GetNext() && *pDelPam->GetNext()->End() 
== *pDelPam->Start())
+if (pDelPam->GetNext() != pDelPam.get()
+&& *pDelPam->GetNext()->End() == *pDelPam->Start())
 {
 *pDelPam->GetNext()->End() = *pDelPam->End();
 pDelPam.reset(pDelPam->GetNext());
commit d16c5f47600d236e911ae50d0e58a3f2256f5a61
Author: Michael Stahl 
AuthorDate: Tue Dec 14 17:32:28 2021 +0100
Commit: Michael Stahl 
CommitDate: Tue Dec 14 20:43:25 2021 +0100

tdf#136855 sw: fix ReplaceRangeImpl() restoring of rPam

This broke in CWS swrefactormarks2 (commit
df6d312ca537402463e4eb0530f22b956600fc02) but for spell-checking the
ReplaceRange() wasn't used until commit
e1629c210ad78310e3d48c0756723134a27b89df.

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index ab3bd4ca9cd8..75a365908d53 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4595,8 +4595,8 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
 m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
 
 *rPam.GetPoint() = pBkmk->GetMarkPos();
-if(pBkmk->IsExpanded())
-*rPam.GetMark() = pBkmk->GetOtherMarkPos();
+*rPam.GetMark() = pBkmk->IsExpanded() ? 
pBkmk->GetOtherMarkPos() : pBkmk->GetMarkPos();
+
 m_rDoc.getIDocumentMarkAccess()->deleteMark(pBkmk);
 }
 bJoinText = false;


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

2021-11-30 Thread Noel Grandin (via logerrit)
 sw/source/uibase/dochdl/swdtflvr.cxx |4 +
 ucb/source/cacher/contentresultsetwrapper.cxx|2 
 ucb/source/cacher/contentresultsetwrapper.hxx|4 -
 ucb/source/cacher/dynamicresultsetwrapper.cxx|2 
 ucb/source/cacher/dynamicresultsetwrapper.hxx|4 -
 ucb/source/core/ucb.cxx  |2 
 ucb/source/core/ucb.hxx  |5 --
 ucb/source/core/ucbstore.cxx |   11 +---
 ucb/source/core/ucbstore.hxx |6 +-
 ucb/source/sorter/sortdynres.cxx |2 
 ucb/source/sorter/sortdynres.hxx |7 --
 ucb/source/sorter/sortresult.cxx |2 
 ucb/source/sorter/sortresult.hxx |7 --
 ucb/source/ucp/file/bc.cxx   |   12 ++---
 ucb/source/ucp/file/bc.hxx   |8 +--
 ucb/source/ucp/file/filnot.cxx   |   55 ++-
 ucb/source/ucp/file/filnot.hxx   |   11 ++--
 ucb/source/ucp/file/filrset.cxx  |   28 +++
 ucb/source/ucp/file/filrset.hxx  |8 +--
 ucb/source/ucp/ftp/ftpresultsetbase.cxx  |6 +-
 ucb/source/ucp/ftp/ftpresultsetbase.hxx  |8 +--
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx |2 
 ucb/source/ucp/hierarchy/hierarchydatasource.hxx |4 -
 23 files changed, 79 insertions(+), 121 deletions(-)

New commits:
commit b6f35f5db701fbd31852fad937a38f81c5c817f0
Author: Noel Grandin 
AuthorDate: Sun Nov 28 20:49:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 30 09:51:25 2021 +0100

use more OInterfaceContainerHelper2 in ucb

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

diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx 
b/ucb/source/cacher/contentresultsetwrapper.cxx
index 0b1175e324f0..f9e504e2d933 100644
--- a/ucb/source/cacher/contentresultsetwrapper.cxx
+++ b/ucb/source/cacher/contentresultsetwrapper.cxx
@@ -408,7 +408,7 @@ void SAL_CALL ContentResultSetWrapper::addEventListener( 
const Reference< XEvent
 
 if ( !m_pDisposeEventListeners )
 m_pDisposeEventListeners.reset(
-new OInterfaceContainerHelper2( m_aContainerMutex ) );
+new OInterfaceContainerHelper3( 
m_aContainerMutex ) );
 
 m_pDisposeEventListeners->addInterface( Listener );
 }
diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx 
b/ucb/source/cacher/contentresultsetwrapper.hxx
index 254ab530606d..eda5b5e83e9d 100644
--- a/ucb/source/cacher/contentresultsetwrapper.hxx
+++ b/ucb/source/cacher/contentresultsetwrapper.hxx
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -86,7 +86,7 @@ private:
 boolm_bDisposed; ///Dispose call ready.
 boolm_bInDispose;///In dispose call
 osl::Mutex  m_aContainerMutex;
-std::unique_ptr
+
std::unique_ptr>
 m_pDisposeEventListeners;
 std::unique_ptr
 m_pPropertyChangeListeners;
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx 
b/ucb/source/cacher/dynamicresultsetwrapper.cxx
index e465bbe6da0c..fb37a5fa6864 100644
--- a/ucb/source/cacher/dynamicresultsetwrapper.cxx
+++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx
@@ -163,7 +163,7 @@ void SAL_CALL DynamicResultSetWrapper::addEventListener( 
const Reference< XEvent
 
 if ( !m_pDisposeEventListeners )
 m_pDisposeEventListeners.reset(
-new OInterfaceContainerHelper2( m_aContainerMutex ) );
+new OInterfaceContainerHelper3( 
m_aContainerMutex ) );
 
 m_pDisposeEventListeners->addInterface( Listener );
 }
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.hxx 
b/ucb/source/cacher/dynamicresultsetwrapper.hxx
index 3d0cb9e737b6..8f9c0473f072 100644
--- a/ucb/source/cacher/dynamicresultsetwrapper.hxx
+++ b/ucb/source/cacher/dynamicresultsetwrapper.hxx
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -42,7 +42,7 @@ private:
 boolm_bDisposed; ///Dispose call ready.
 boolm_bInDispose;///In dispose call
 osl::Mutex  m_aContainerMutex;
-std::unique_ptr
+
std::unique_ptr>
 m_pDisposeEventListeners;
 protected:
 rtl::Reference
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 450fa670e1ac..ed8ddce76525 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -265,7 +265,7 @@ void SAL_CALL UniversalContentBroker::addEventListener(
 const Reference< XEventListener >& Listener )
 {
 if ( !m_pDisposeEventListeners )
-m_pDisposeEventListeners.reset( new 

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

2021-10-12 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/itratr.cxx   |   34 +-
 sw/source/filter/ww8/ww8par6.cxx |7 +--
 2 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit a975a5f80fcb6bfa5d656e5647485832bb41d49e
Author: Caolán McNamara 
AuthorDate: Tue Oct 12 15:37:53 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 12 17:55:42 2021 +0200

ofz#39837 avoid timeout

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

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e6105c2ff5ad..2074983ee90c 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2730,8 +2730,11 @@ void SwWW8ImplReader::StopApo()
 
 aFlySet.ClearItem(RES_FRM_SIZE);
 
-CalculateFlySize(aFlySet, m_xSFlyPara->xMainTextPos->nNode,
-m_xSFlyPara->nWidth);
+if (!m_bFuzzing)
+{
+CalculateFlySize(aFlySet, m_xSFlyPara->xMainTextPos->nNode,
+m_xSFlyPara->nWidth);
+}
 
 nNewWidth = ItemGet(aFlySet, 
RES_FRM_SIZE).GetWidth();
 
commit bd5d16b5b3c6bdf139c04d6e8ca1310418512244
Author: Caolán McNamara 
AuthorDate: Tue Oct 12 15:24:30 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 12 17:55:27 2021 +0200

pass 2nd arg of lcl_MinMaxNode by reference

as a pointer it was never null

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

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 9571324f8dbe..d62fc192ebf2 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -878,7 +878,7 @@ public:
 
 }
 
-static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn )
+static void lcl_MinMaxNode(SwFrameFormat* pNd, SwMinMaxNodeArgs& rIn)
 {
 const SwFormatAnchor& rFormatA = pNd->GetAnchor();
 
@@ -889,8 +889,8 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, 
SwMinMaxNodeArgs* pIn )
 }
 
 const SwPosition *pPos = rFormatA.GetContentAnchor();
-OSL_ENSURE(pPos && pIn, "Unexpected NULL arguments");
-if (!pPos || !pIn || pIn->m_nIndex != pPos->nNode.GetIndex())
+OSL_ENSURE(pPos, "Unexpected NULL arguments");
+if (!pPos || rIn.m_nIndex != pPos->nNode.GetIndex())
 return;
 
 tools::Long nMin, nMax;
@@ -953,7 +953,7 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, 
SwMinMaxNodeArgs* pIn )
 
 if( css::text::WrapTextMode_THROUGH == pNd->GetSurround().GetSurround() )
 {
-pIn->Minimum( nMin );
+rIn.Minimum( nMin );
 return;
 }
 
@@ -966,33 +966,33 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, 
SwMinMaxNodeArgs* pIn )
 {
 if( nDiff )
 {
-pIn->m_nRightRest -= pIn->m_nRightDiff;
-pIn->m_nRightDiff = nDiff;
+rIn.m_nRightRest -= rIn.m_nRightDiff;
+rIn.m_nRightDiff = nDiff;
 }
 if( text::RelOrientation::FRAME != rOrient.GetRelationOrient() )
 {
-if (pIn->m_nRightRest > 0)
-pIn->m_nRightRest = 0;
+if (rIn.m_nRightRest > 0)
+rIn.m_nRightRest = 0;
 }
-pIn->m_nRightRest -= nMin;
+rIn.m_nRightRest -= nMin;
 break;
 }
 case text::HoriOrientation::LEFT:
 {
 if( nDiff )
 {
-pIn->m_nLeftRest -= pIn->m_nLeftDiff;
-pIn->m_nLeftDiff = nDiff;
+rIn.m_nLeftRest -= rIn.m_nLeftDiff;
+rIn.m_nLeftDiff = nDiff;
 }
-if (text::RelOrientation::FRAME != rOrient.GetRelationOrient() && 
pIn->m_nLeftRest < 0)
-pIn->m_nLeftRest = 0;
-pIn->m_nLeftRest -= nMin;
+if (text::RelOrientation::FRAME != rOrient.GetRelationOrient() && 
rIn.m_nLeftRest < 0)
+rIn.m_nLeftRest = 0;
+rIn.m_nLeftRest -= nMin;
 break;
 }
 default:
 {
-pIn->m_nMaxWidth += nMax;
-pIn->Minimum( nMin );
+rIn.m_nMaxWidth += nMax;
+rIn.Minimum(nMin);
 }
 }
 }
@@ -1041,7 +1041,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, 
sal_uLong& rMin, sal_uLong 
 {
 aNodeArgs.m_nIndex = nIndex;
 for( SwFrameFormat *pFormat : *pTmp )
-lcl_MinMaxNode( pFormat,  );
+lcl_MinMaxNode(pFormat, aNodeArgs);
 }
 }
 if (aNodeArgs.m_nLeftRest < 0)


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

2021-10-09 Thread Julien Nabet (via logerrit)
 sw/source/core/inc/bookmrk.hxx   |5 +
 sw/source/uibase/dochdl/swdtflvr.cxx |   12 ++--
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit df0592cfb16c28b22c0c0331306dd072e7678fce
Author: Julien Nabet 
AuthorDate: Sat Oct 9 20:34:00 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 9 21:35:59 2021 +0200

What's the interest to gain 1 letter? bDelBookmrk->bDelBookmark

At least, it'll be easier to search bookmark in whole code if there's a 
bookmark pb

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

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 17b7e37df224..8a3182e1e8c0 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -180,7 +180,7 @@ class SwTransferDdeLink : public ::sfx2::SvBaseLink
 SwTransferable& rTrnsfr;
 SwDocShell* pDocShell;
 sal_uLong nOldTimeOut;
-bool bDelBookmrk : 1;
+bool bDelBookmark : 1;
 bool bInDisconnect : 1;
 
 bool FindDocShell();
@@ -4215,7 +4215,7 @@ SwTransferDdeLink::SwTransferDdeLink( SwTransferable& 
rTrans, SwWrtShell& rSh )
 : rTrnsfr(rTrans)
 , pDocShell(nullptr)
 , nOldTimeOut(0)
-, bDelBookmrk(false)
+, bDelBookmark(false)
 , bInDisconnect(false)
 {
 // we only end up here with table- or text selection
@@ -4239,7 +4239,7 @@ SwTransferDdeLink::SwTransferDdeLink( SwTransferable& 
rTrans, SwWrtShell& rSh )
 if(pMark)
 {
 sName = pMark->GetName();
-bDelBookmrk = true;
+bDelBookmark = true;
 if( !bIsModified )
 rSh.ResetModified();
 }
@@ -4347,7 +4347,7 @@ bool SwTransferDdeLink::WriteData( SvStream& rStrm )
 rServerObject.SetDdeBookmark(*pNewMark);
 }
 
-bDelBookmrk = false;
+bDelBookmark = false;
 return true;
 }
 
@@ -4359,7 +4359,7 @@ void SwTransferDdeLink::Disconnect( bool 
bRemoveDataAdvise )
 bInDisconnect = true;
 
 // destroy the unused bookmark again (without Undo!)?
-if( bDelBookmrk && refObj.is() && FindDocShell() )
+if( bDelBookmark && refObj.is() && FindDocShell() )
 {
 SwDoc* pDoc = pDocShell->GetDoc();
 ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
@@ -4378,7 +4378,7 @@ void SwTransferDdeLink::Disconnect( bool 
bRemoveDataAdvise )
 // #i58448#
 pDoc->SetOle2Link( aSavedOle2Link );
 
-bDelBookmrk = false;
+bDelBookmark = false;
 }
 
 if( refObj.is() )
commit 84a4e281c1a552b002b3a7162adfaece47761e88
Author: Julien Nabet 
AuthorDate: Sat Oct 9 20:36:53 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 9 21:35:48 2021 +0200

tdf#143148 - Use pragma once instead of include guards

I changed this one only because the goal was above all to change filename
in a following patch to put bookmark.hxx instead

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

diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 397a68ac3cca..ed7d5ad82180 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SW_SOURCE_CORE_INC_BOOKMRK_HXX
-#define INCLUDED_SW_SOURCE_CORE_INC_BOOKMRK_HXX
+#pragma once
 
 #include 
 #include 
@@ -343,6 +342,4 @@ namespace sw::mark {
 bool IsFieldmarkOverlap(SwPaM const& rPaM);
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2021-09-28 Thread Noel Grandin (via logerrit)
 sw/source/core/text/atrhndl.hxx |   10 +-
 sw/source/core/text/atrstck.cxx |   16 ++--
 sw/source/core/text/inftxt.cxx  |   20 ++--
 sw/source/core/text/inftxt.hxx  |2 +-
 sw/source/core/text/txttab.cxx  |6 +++---
 5 files changed, 25 insertions(+), 29 deletions(-)

New commits:
commit 8156a8f87996e353f8d36935e0497624245f1ad1
Author: Noel Grandin 
AuthorDate: Tue Sep 28 15:01:45 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 28 18:25:48 2021 +0200

 no need to allocate SwFont separately in SwAttrHandler

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

diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx
index 8a3c438fd91d..92d0153eefc3 100644
--- a/sw/source/core/text/atrhndl.hxx
+++ b/sw/source/core/text/atrhndl.hxx
@@ -45,7 +45,7 @@ private:
 
 // This is the base font for the paragraph. It is stored in order to have
 // a template, if we have to restart the attribute evaluation
-std::unique_ptr m_pFnt;
+std::optional m_oFnt;
 
 bool m_bVertLayout;
 bool m_bVertLayoutLRBT;
@@ -104,14 +104,14 @@ public:
 
 inline void SwAttrHandler::ResetFont( SwFont& rFnt ) const
 {
-OSL_ENSURE(m_pFnt, "ResetFont without a font");
-if (m_pFnt)
-rFnt = *m_pFnt;
+OSL_ENSURE(m_oFnt, "ResetFont without a font");
+if (m_oFnt)
+rFnt = *m_oFnt;
 };
 
 inline const SwFont* SwAttrHandler::GetFont() const
 {
-return m_pFnt.get();
+return m_oFnt ? &*m_oFnt : nullptr;
 };
 
 
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 794390a63ede..79dc822361c6 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -322,14 +322,10 @@ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, 
const SwAttrSet* pAS,
 // SwTextFrame::FormatOnceMore situation or (since sw_redlinehide)
 // from SwAttrIter::Seek(); in the latter case SwTextSizeInfo::m_pFnt
 // is an alias of m_pFnt so it must not be deleted!
-if (m_pFnt)
-{
-*m_pFnt = rFnt;
-}
+if (m_oFnt)
+*m_oFnt = rFnt;
 else
-{
-m_pFnt.reset(new SwFont(rFnt));
-}
+m_oFnt.emplace(rFnt);
 }
 
 void SwAttrHandler::Reset( )
@@ -826,11 +822,11 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, 
SwFont& rFnt, bool bPush )
 void SwAttrHandler::GetDefaultAscentAndHeight( SwViewShell const * pShell, 
OutputDevice const & rOut,
sal_uInt16& nAscent, 
sal_uInt16& nHeight ) const
 {
-OSL_ENSURE(m_pFnt, "No font available for GetDefaultAscentAndHeight");
+OSL_ENSURE(m_oFnt, "No font available for GetDefaultAscentAndHeight");
 
-if (m_pFnt)
+if (m_oFnt)
 {
-SwFont aFont( *m_pFnt );
+SwFont aFont( *m_oFnt );
 nHeight = aFont.GetHeight( pShell, rOut );
 nAscent = aFont.GetAscent( pShell, rOut );
 }
commit 2d45cef3cd18c9d0198b9d302016a7598ce0484c
Author: Noel Grandin 
AuthorDate: Tue Sep 28 14:55:22 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 28 18:25:33 2021 +0200

no need to allocate SvxTabStopItem separately in SwLineInfo

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

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 26e7246a2a98..e3546c66db1a 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -99,7 +99,7 @@ SwLineInfo::~SwLineInfo()
 void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet,
const SwTextNode& rTextNode )
 {
-m_pRuler.reset( new SvxTabStopItem( rAttrSet.GetTabStops() ) );
+m_oRuler.emplace( rAttrSet.GetTabStops() );
 if ( rTextNode.GetListTabStopPosition( m_nListTabStopPosition ) )
 {
 m_bListTabStopIncluded = true;
@@ -107,15 +107,15 @@ void SwLineInfo::CtorInitLineInfo( const SwAttrSet& 
rAttrSet,
 // insert the list tab stop into SvxTabItem instance 
 const SvxTabStop aListTabStop( m_nListTabStopPosition,
SvxTabAdjust::Left );
-m_pRuler->Insert( aListTabStop );
+m_oRuler->Insert( aListTabStop );
 
 // remove default tab stops, which are before the inserted list tab 
stop
-for ( sal_uInt16 i = 0; i < m_pRuler->Count(); i++ )
+for ( sal_uInt16 i = 0; i < m_oRuler->Count(); i++ )
 {
-if ( (*m_pRuler)[i].GetTabPos() < m_nListTabStopPosition &&
- (*m_pRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
+if ( (*m_oRuler)[i].GetTabPos() < m_nListTabStopPosition &&
+ (*m_oRuler)[i].GetAdjustment() == SvxTabAdjust::Default )
 {

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

2021-09-18 Thread Caolán McNamara (via logerrit)
 sw/source/core/doc/DocumentLayoutManager.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit d8939cb46612d73e6406474006e6ae24fe58
Author: Caolán McNamara 
AuthorDate: Sat Sep 18 10:45:51 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sat Sep 18 15:32:46 2021 +0200

result of pDest->FindRealSdrObject() is already available

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

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index cb1ec6d98d27..17b5fb1e6923 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -509,11 +509,11 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 
 // Link FLY and DRAW formats, so it becomes a text box
 SdrObject* pNewObj = pDest->FindRealSdrObject();
-if (bIsGroupObj && pDest->FindRealSdrObject()
-&& pDest->FindRealSdrObject()->getChildrenOfSdrObject()
-&& 
(pDest->FindRealSdrObject()->getChildrenOfSdrObject()->GetObjCount() > it)
-&& 
pDest->FindRealSdrObject()->getChildrenOfSdrObject()->GetObj(it))
-pNewObj = 
pDest->FindRealSdrObject()->getChildrenOfSdrObject()->GetObj(it);
+if (bIsGroupObj && pNewObj
+&& pNewObj->getChildrenOfSdrObject()
+&& (pNewObj->getChildrenOfSdrObject()->GetObjCount() > 
it)
+&& pNewObj->getChildrenOfSdrObject()->GetObj(it))
+pNewObj = 
pNewObj->getChildrenOfSdrObject()->GetObj(it);
 pTextBoxNd->AddTextBox(pNewObj, pDestTextBox);
 pDestTextBox->SetOtherTextBoxFormat(pTextBoxNd);
 }
commit 4d34a538f1b05d994a3105f559b553af606cb89f
Author: Caolán McNamara 
AuthorDate: Sat Sep 18 10:44:09 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sat Sep 18 15:32:29 2021 +0200

cid#1491948 Dereference before null check

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

diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx 
b/sw/source/core/doc/DocumentLayoutManager.cxx
index 4cee8ad7c0b0..cb1ec6d98d27 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -509,7 +509,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
 
 // Link FLY and DRAW formats, so it becomes a text box
 SdrObject* pNewObj = pDest->FindRealSdrObject();
-if (bIsGroupObj && pDest && pDest->FindRealSdrObject()
+if (bIsGroupObj && pDest->FindRealSdrObject()
 && pDest->FindRealSdrObject()->getChildrenOfSdrObject()
 && 
(pDest->FindRealSdrObject()->getChildrenOfSdrObject()->GetObjCount() > it)
 && 
pDest->FindRealSdrObject()->getChildrenOfSdrObject()->GetObj(it))


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

2021-09-10 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx |2 -
 vcl/unx/gtk3/gtkinst.cxx   |   23 ++---
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit feae69bad70d637a92e6dbb7c18b756943858379
Author: Caolán McNamara 
AuthorDate: Fri Sep 10 12:28:58 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 10 18:57:17 2021 +0200

gtk4: complete child_grab_focus for gtk4

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 5a4270857919..79d3835f69db 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -5547,22 +5547,39 @@ public:
 virtual void child_grab_focus() override
 {
 gtk_widget_grab_focus(m_pWidget);
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+bool bHasFocusChild = 
gtk_widget_get_focus_child(GTK_WIDGET(m_pContainer));
+#else
 bool bHasFocusChild = gtk_container_get_focus_child(m_pContainer);
+#endif
 if (!bHasFocusChild)
 {
+#if GTK_CHECK_VERSION(4, 0, 0)
+if (GtkWidget* pChild = gtk_widget_get_first_child(m_pContainer))
+{
+gtk_widget_set_focus_child(m_pContainer, pChild);
+bHasFocusChild = true;
+}
+#else
 GList* pChildren = gtk_container_get_children(m_pContainer);
-for (GList* pChild = g_list_first(pChildren); pChild; pChild = 
g_list_next(pChild))
+if (GList* pChild = g_list_first(pChildren))
 {
 gtk_container_set_focus_child(m_pContainer, 
static_cast(pChild->data));
 bHasFocusChild = true;
-break;
 }
 g_list_free(pChildren);
+#endif
 }
+
 if (bHasFocusChild)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+gtk_widget_child_focus(gtk_widget_get_focus_child(m_pWidget), 
GTK_DIR_TAB_FORWARD);
+#else
 
gtk_widget_child_focus(gtk_container_get_focus_child(GTK_CONTAINER(m_pWidget)), 
GTK_DIR_TAB_FORWARD);
 #endif
+}
+
 }
 
 virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) 
override
commit 94c9c991d1fd0991961ee7bb2fd88991fe55f2f1
Author: Caolán McNamara 
AuthorDate: Fri Sep 10 13:58:13 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 10 18:57:01 2021 +0200

Resolves: tdf#143777 Exclude recipient is always greyed out

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

diff --git a/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx 
b/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
index 3f3ace7d801a..a97974f57f34 100644
--- a/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
+++ b/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
@@ -386,7 +386,7 @@ void MMExcludeEntryController::statusChanged(const 
frame::FeatureStateEvent& rEv
 }
 else
 {
-m_xExcludeCheckbox->set_sensitive(false);
+m_xExcludeCheckbox->set_sensitive(true);
 
m_xExcludeCheckbox->set_active(xConfigItem->IsRecordExcluded(xConfigItem->GetResultSetPosition()));
 }
 }


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

2021-08-13 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/ww8par.cxx |3 ++-
 vcl/backendtest/outputdevice/common.cxx |2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e7fe47fdea4ab7d226e752b11e21b178060ac870
Author: Caolán McNamara 
AuthorDate: Fri Aug 13 15:43:36 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 13 20:05:29 2021 +0200

cid#1490212 try and silence bogus divide by zero Untrusted divisor

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 851656dc8216..3cd81b1c95eb 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1022,8 +1022,9 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
 sal_uInt16 nNumElemVert(0), nNumElemMemVert(0), nElemSizeVert(0);
 rSt.ReadUInt16( nNumElemVert ).ReadUInt16( nNumElemMemVert 
).ReadUInt16( nElemSizeVert );
 bool bOk = false;
-if (nNumElemVert && ((nElemSizeVert == 8) || (nElemSizeVert == 4)))
+if (nNumElemVert && (nElemSizeVert == 8 || nElemSizeVert == 4))
 {
+assert(nElemSizeVert == 8 || nElemSizeVert == 4);
 //check if there is enough data in the file to make the
 //record sane
 bOk = rSt.remainingSize() / nElemSizeVert >= nNumElemVert;
commit 9b564e8b32be960b1be2caa377a52e84606270bb
Author: Caolán McNamara 
AuthorDate: Fri Aug 13 15:34:44 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 13 20:05:14 2021 +0200

cid#1490210 silence Arguments in wrong order

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

diff --git a/vcl/backendtest/outputdevice/common.cxx 
b/vcl/backendtest/outputdevice/common.cxx
index b5654c5c45e3..d205bf3b7488 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -745,6 +745,7 @@ TestResult OutputDeviceTestCommon::checkHalfEllipse(Bitmap& 
rBitmap, bool aEnabl
 {
 for (tools::Long y = 0; y < pAccess->Height(); ++y)
 {
+// coverity[swapped_arguments : FALSE] - this is in the correct 
order
 if (SetPixels[{ y, x }])
 {
 if (aEnableAA)
@@ -790,6 +791,7 @@ TestResult 
OutputDeviceTestCommon::checkClosedBezier(Bitmap& rBitmap)
 {
 for (tools::Long y = 0; y < pAccess->Height(); ++y)
 {
+// coverity[swapped_arguments : FALSE] - this is in the correct 
order
 if (SetPixels[{ y, x }])
 {
 checkValue(pAccess, x, y, constLineColor, nNumberOfQuirks, 
nNumberOfErrors, true);


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

2021-07-07 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx|5 +++--
 xmloff/source/transform/ActionMapTypesOASIS.hxx |2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit f62d2de95c3553e0615d3485645bf5061b97d520
Author: Caolán McNamara 
AuthorDate: Wed Jul 7 17:33:06 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 7 22:11:59 2021 +0200

WaE: Wodr type 'ActionMapTypesOOo' violates the C++ ODR

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

diff --git a/xmloff/source/transform/ActionMapTypesOASIS.hxx 
b/xmloff/source/transform/ActionMapTypesOASIS.hxx
index 1be989b340df..eb9753ab4e9d 100644
--- a/xmloff/source/transform/ActionMapTypesOASIS.hxx
+++ b/xmloff/source/transform/ActionMapTypesOASIS.hxx
@@ -19,7 +19,7 @@
 
 #pragma once
 
-enum ActionMapTypesOOo
+enum ActionMapTypesOasis
 {
 PROP_OASIS_GRAPHIC_ATTR_ACTIONS,
 PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS,
commit ed2d309b5ccdaa1a58f37f70a00ad74452e163cd
Author: Caolán McNamara 
AuthorDate: Wed Jul 7 17:12:50 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 7 22:11:44 2021 +0200

make code a little clearer to indicate that pAnchor isn't leaked

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index bbf4994a1d05..f5978957635c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6450,7 +6450,8 @@ void 
DocxAttributeOutput::WriteTextBox(uno::Reference xShape)
 SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(xShape);
 assert(pTextBox);
 const SwPosition* pAnchor = nullptr;
-if (pTextBox->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE) 
//tdf135711
+const bool bFlyAtPage = pTextBox->GetAnchor().GetAnchorId() == 
RndStdIds::FLY_AT_PAGE;
+if (bFlyAtPage) //tdf135711
 {
 auto pNdIdx = pTextBox->GetContent().GetContentIdx();
 if (pNdIdx) //Is that possible it is null?
@@ -6465,7 +6466,7 @@ void 
DocxAttributeOutput::WriteTextBox(uno::Reference xShape)
 {
 ww8::Frame aFrame(*pTextBox, *pAnchor);
 m_rExport.SdrExporter().writeDMLTextFrame(, m_anchorId++, 
/*bTextBoxOnly=*/true);
-if (pTextBox->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE)
+if (bFlyAtPage)
 {
 delete pAnchor;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-26 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/doccomp.cxx   |   97 +++
 sw/source/core/text/pormulti.cxx |7 +-
 2 files changed, 52 insertions(+), 52 deletions(-)

New commits:
commit 294eaac1113aa24ac65c254058007a9a489b28e6
Author: Noel Grandin 
AuthorDate: Wed May 26 09:33:13 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed May 26 11:19:29 2021 +0200

fix leak in BuildMultiPortion

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

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 0c3297e57207..dc83cbde6556 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1899,15 +1899,16 @@ bool SwTextFormatter::BuildMultiPortion( 
SwTextFormatInfo ,
 
 SeekAndChg( rInf );
 std::unique_ptr xFontSave;
+std::unique_ptr xTmpFont;
 if( rMulti.IsDouble() )
 {
-SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
+xTmpFont.reset(new SwFont( *rInf.GetFont() ));
 if( rMulti.IsDouble() )
 {
 SetPropFont( 50 );
-pTmpFnt->SetProportion( GetPropFont() );
+xTmpFont->SetProportion( GetPropFont() );
 }
-xFontSave.reset(new SwFontSave(rInf, pTmpFnt, this));
+xFontSave.reset(new SwFontSave(rInf, xTmpFont.get(), this));
 }
 
 SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() );
commit 284eb63624d2822f12e9216171da3c479e95f2d9
Author: Noel Grandin 
AuthorDate: Wed May 26 10:14:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed May 26 11:19:18 2021 +0200

fix leak of SwCompareLine in CompareData

(*) store the SwCompareLine as a vector, SwCompareLine contains a
single pointer, no need to allocate separately on heap
(*) which means we need to convert SwCompareLine::m_rNode to
m_pNode in order that SwCompareLine can have an assignment operator

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

diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index ac2b3c41d6bd..589f977e4937 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -56,11 +56,12 @@ using std::vector;
 
 namespace {
 
-class SwCompareLine
+class SwCompareLine final
 {
-const SwNode& m_rNode;
+const SwNode* m_pNode;
 public:
-explicit SwCompareLine( const SwNode& rNd ) : m_rNode( rNd ) {}
+explicit SwCompareLine( const SwNode& rNd ) : m_pNode(  ) {}
+SwCompareLine() : m_pNode( nullptr ) {}
 
 sal_uLong GetHashValue() const;
 bool Compare( const SwCompareLine& rLine ) const;
@@ -73,7 +74,7 @@ public:
 bool ChangesInLine( const SwCompareLine& rLine,
 std::unique_ptr& rpInsRing, 
std::unique_ptr& rpDelRing ) const;
 
-const SwNode& GetNode() const { return m_rNode; }
+const SwNode& GetNode() const { return *m_pNode; }
 
 const SwNode& GetEndNode() const;
 
@@ -95,7 +96,7 @@ private:
 static sal_uLong PrevIdx( const SwNode* pNd );
 static sal_uLong NextIdx( const SwNode* pNd );
 
-vector< SwCompareLine* > m_aLines;
+vector m_aLines;
 bool m_bRecordDiff;
 
 // Truncate beginning and end and add all others to the LinesArray
@@ -142,10 +143,10 @@ public:
 }
 
 size_t GetLineCount() const { return m_aLines.size(); }
-const SwCompareLine* GetLine( size_t nLine ) const
+const SwCompareLine& GetLine( size_t nLine ) const
 { return m_aLines[ nLine ]; }
-void InsertLine( SwCompareLine* pLine )
-{ m_aLines.push_back( pLine ); }
+void InsertLine( SwCompareLine aLine )
+{ m_aLines.push_back( aLine ); }
 
 void SetRedlinesToDoc( bool bUseDocInfo );
 };
@@ -185,10 +186,10 @@ class Hash
 struct HashData
 {
 sal_uLong nNext, nHash;
-const SwCompareLine* pLine;
+SwCompareLine aLine;
 
 HashData()
-: nNext( 0 ), nHash( 0 ), pLine(nullptr) {}
+: nNext( 0 ), nHash( 0 ) {}
 };
 
 std::unique_ptr m_pHashArr;
@@ -528,7 +529,6 @@ Hash::Hash( sal_uLong nSize )
 m_pDataArr.reset( new HashData[ nSize ] );
 m_pDataArr[0].nNext = 0;
 m_pDataArr[0].nHash = 0;
-m_pDataArr[0].pLine = nullptr;
 m_nPrime = primes[0];
 
 for( i = 0; primes[i] < nSize / 3;  i++)
@@ -549,9 +549,8 @@ void Hash::CalcHashValue( CompareData& rData )
 
 for( size_t n = 0; n < rData.GetLineCount(); ++n )
 {
-const SwCompareLine* pLine = rData.GetLine( n );
-OSL_ENSURE( pLine, "where is the line?" );
-sal_uLong nH = pLine->GetHashValue();
+const SwCompareLine aLine = rData.GetLine( n );
+sal_uLong nH = aLine.GetHashValue();
 
 sal_uLong* pFound = _pHashArr[ nH % 

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

2021-05-21 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/wrap.cxx   |   28 +
 sw/source/uibase/inc/wrap.hxx  |6 
 sw/uiconfig/swriter/ui/wrappage.ui |  580 ++---
 3 files changed, 382 insertions(+), 232 deletions(-)

New commits:
commit f654af56695197d11c277c424b0dd2b93195add9
Author: Caolán McNamara 
AuthorDate: Fri May 21 09:46:20 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 21 13:35:30 2021 +0200

move wrap icons outside radiobuttons

not possible in gtk4 to put an image in here anymore AFAICS,
this was always an odd case anyway

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

diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index a09c8475cdcd..bf4029269154 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -72,11 +72,17 @@ SwWrapTabPage::SwWrapTabPage(weld::Container* pPage, 
weld::DialogController* pCo
 , m_bHtmlMode(false)
 , m_bDrawMode(false)
 , m_bContourImage(false)
+, m_xNoWrapImg(m_xBuilder->weld_image("noneimg"))
 , m_xNoWrapRB(m_xBuilder->weld_radio_button("none"))
+, m_xWrapLeftImg(m_xBuilder->weld_image("beforeimg"))
 , m_xWrapLeftRB(m_xBuilder->weld_radio_button("before"))
+, m_xWrapRightImg(m_xBuilder->weld_image("afterimg"))
 , m_xWrapRightRB(m_xBuilder->weld_radio_button("after"))
+, m_xWrapParallelImg(m_xBuilder->weld_image("parallelimg"))
 , m_xWrapParallelRB(m_xBuilder->weld_radio_button("parallel"))
+, m_xWrapThroughImg(m_xBuilder->weld_image("throughimg"))
 , m_xWrapThroughRB(m_xBuilder->weld_radio_button("through"))
+, m_xIdealWrapImg(m_xBuilder->weld_image("optimalimg"))
 , m_xIdealWrapRB(m_xBuilder->weld_radio_button("optimal"))
 , m_xLeftMarginED(m_xBuilder->weld_metric_spin_button("left", 
FieldUnit::CM))
 , m_xRightMarginED(m_xBuilder->weld_metric_spin_button("right", 
FieldUnit::CM))
@@ -604,23 +610,23 @@ IMPL_LINK_NOARG(SwWrapTabPage, ContourHdl, 
weld::ToggleButton&, void)
 
 void SwWrapTabPage::SetImages()
 {
-m_xWrapThroughRB->set_from_icon_name(RID_BMP_WRAP_THROUGH);
+m_xWrapThroughImg->set_from_icon_name(RID_BMP_WRAP_THROUGH);
 bool bWrapOutline =  !m_xWrapOutlineCB->get_active();
 if (bWrapOutline)
 {
-m_xNoWrapRB->set_from_icon_name(RID_BMP_WRAP_NONE);
-m_xWrapLeftRB->set_from_icon_name(RID_BMP_WRAP_LEFT);
-m_xWrapRightRB->set_from_icon_name(RID_BMP_WRAP_RIGHT);
-m_xWrapParallelRB->set_from_icon_name(RID_BMP_WRAP_PARALLEL);
-m_xIdealWrapRB->set_from_icon_name(RID_BMP_WRAP_IDEAL);
+m_xNoWrapImg->set_from_icon_name(RID_BMP_WRAP_NONE);
+m_xWrapLeftImg->set_from_icon_name(RID_BMP_WRAP_LEFT);
+m_xWrapRightImg->set_from_icon_name(RID_BMP_WRAP_RIGHT);
+m_xWrapParallelImg->set_from_icon_name(RID_BMP_WRAP_PARALLEL);
+m_xIdealWrapImg->set_from_icon_name(RID_BMP_WRAP_IDEAL);
 }
 else
 {
-m_xNoWrapRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_NONE);
-m_xWrapLeftRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_LEFT);
-m_xWrapRightRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_RIGHT);
-m_xWrapParallelRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_PARALLEL);
-m_xIdealWrapRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_IDEAL);
+m_xNoWrapImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_NONE);
+m_xWrapLeftImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_LEFT);
+m_xWrapRightImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_RIGHT);
+m_xWrapParallelImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_PARALLEL);
+m_xIdealWrapImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_IDEAL);
 }
 }
 
diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx
index 3a69e43ff210..6ea3e192e6f3 100644
--- a/sw/source/uibase/inc/wrap.hxx
+++ b/sw/source/uibase/inc/wrap.hxx
@@ -48,11 +48,17 @@ class SwWrapTabPage: public SfxTabPage
 bool m_bContourImage;
 
 // WRAPPING
+std::unique_ptr m_xNoWrapImg;
 std::unique_ptr m_xNoWrapRB;
+std::unique_ptr m_xWrapLeftImg;
 std::unique_ptr m_xWrapLeftRB;
+std::unique_ptr m_xWrapRightImg;
 std::unique_ptr m_xWrapRightRB;
+std::unique_ptr m_xWrapParallelImg;
 std::unique_ptr m_xWrapParallelRB;
+std::unique_ptr m_xWrapThroughImg;
 std::unique_ptr m_xWrapThroughRB;
+std::unique_ptr m_xIdealWrapImg;
 std::unique_ptr m_xIdealWrapRB;
 
 // MARGIN
diff --git a/sw/uiconfig/swriter/ui/wrappage.ui 
b/sw/uiconfig/swriter/ui/wrappage.ui
index ed0f31b07279..ede6800d1837 100644
--- a/sw/uiconfig/swriter/ui/wrappage.ui
+++ b/sw/uiconfig/swriter/ui/wrappage.ui
@@ -50,154 +50,292 @@
 True
 True
 
-  
-_Wrap Off
+  
+  
 True
-True
-

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

2021-05-04 Thread Ayhan Yalçınsoy (via logerrit)
 sw/source/core/text/porfly.cxx  |1 +
 sw/uiconfig/swriter/ui/footendnotedialog.ui |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 42db696496c8e95ee7489d2800bd6a5400391959
Author: Ayhan Yalçınsoy 
AuthorDate: Sun May 2 09:14:42 2021 +0300
Commit: Heiko Tietze 
CommitDate: Tue May 4 11:09:54 2021 +0200

tdf#139713:Renamed Footnote/endnote settings dialog caption

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

diff --git a/sw/uiconfig/swriter/ui/footendnotedialog.ui 
b/sw/uiconfig/swriter/ui/footendnotedialog.ui
index 08c6bb924a65..832e55a6ac37 100644
--- a/sw/uiconfig/swriter/ui/footendnotedialog.ui
+++ b/sw/uiconfig/swriter/ui/footendnotedialog.ui
@@ -5,7 +5,7 @@
   
 False
 6
-Footnotes/Endnotes 
Settings
+Settings of Footnotes and 
Endnotes
 False
 True
 0
commit 61dbc8791b8d3afa524bfe89ebc99eca3a5c2030
Author: Caolán McNamara 
AuthorDate: Mon May 3 19:51:15 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 4 11:09:44 2021 +0200

cid#1478174 Uninitialized scalar field

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

diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 422e2ef36ee3..34edc3082b71 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -269,6 +269,7 @@ void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) 
const
  */
 SwFlyCntPortion::SwFlyCntPortion()
 : m_bMax(false)
+, m_bDeleted(false)
 , m_eAlign(sw::LineAlign::NONE)
 {
 mnLineLength = TextFrameIndex(1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-25 Thread Bayram Çiçek (via logerrit)
 sw/source/ui/misc/titlepage.cxx  |2 +-
 toolkit/source/awt/asynccallback.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 691f1cc959dab0418b28e7898825a6cae71b493e
Author: Bayram Çiçek 
AuthorDate: Thu Dec 24 13:11:04 2020 +
Commit: Julien Nabet 
CommitDate: Fri Dec 25 11:50:53 2020 +0100

tdf#88205: Adapt uses of css::uno::Sequence to use initializer_list ctor

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

diff --git a/toolkit/source/awt/asynccallback.cxx 
b/toolkit/source/awt/asynccallback.cxx
index d017b3e259bb..751647447092 100644
--- a/toolkit/source/awt/asynccallback.cxx
+++ b/toolkit/source/awt/asynccallback.cxx
@@ -76,7 +76,7 @@ sal_Bool SAL_CALL AsyncCallback::supportsService(OUString 
const & serviceName)
 
 css::uno::Sequence< OUString > SAL_CALL 
AsyncCallback::getSupportedServiceNames()
 {
-return css::uno::Sequence< OUString >{ "com.sun.star.awt.AsyncCallback" };
+return { "com.sun.star.awt.AsyncCallback" };
 }
 
 // css::awt::XRequestCallback:
commit b905937211154b0e923312641f09629e68ed7901
Author: Julien Nabet 
AuthorDate: Fri Dec 25 10:46:51 2020 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 25 11:50:43 2020 +0100

tdf#139218: Title Page: fix "Reset page number", put default at 1

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

diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 26fa4bdeb564..06767dbe3844 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -205,10 +205,10 @@ SwTitlePageDlg::SwTitlePageDlg(weld::Window *pParent)
 m_xDocumentStartRB->connect_toggled(aStartPageHdl);
 m_xPageStartRB->connect_toggled(aStartPageHdl);
 
+m_xRestartNumberingNF->set_value(nResetPage);
 if (bMaybeResetNumbering && nResetPage > 0)
 {
 m_xRestartNumberingCB->set_active(true);
-m_xRestartNumberingNF->set_value(nResetPage);
 }
 m_xRestartNumberingNF->set_sensitive(m_xRestartNumberingCB->get_active());
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-17 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/swcrsr.cxx  |   28 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   59 
 2 files changed, 61 insertions(+), 26 deletions(-)

New commits:
commit 00abbf7592fc5117fa2bd1c8812e2d2841e90df0
Author: Michael Stahl 
AuthorDate: Fri Nov 6 21:16:20 2020 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 17 22:20:17 2020 +0100

sw_fieldmarkhide: Copy: bookmarks before MakeFrames

DocumentContentOperationsManager::CopyWithFlyInFly() needs to copy
bookmarks before creating new layout frames.

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 1c848cb4d4b9..360b3fae7f9c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3468,13 +3468,45 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
 if (rRg.aStart != rRg.aEnd)
 {
 bool bEndIsEqualEndPos = rInsPos == rRg.aEnd;
-bool isRecreateEndNode(false);
 --aSavePos;
 SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 );
 
 // insert behind the already copied start node
 m_rDoc.GetNodes().CopyNodes( rRg, rInsPos, false, true );
 aRedlRest.Restore();
+
+if (bEndIsEqualEndPos)
+{
+const_cast(rRg.aEnd) = SwNodeIndex(aSavePos, +1);
+}
+}
+
+// Also copy all bookmarks
+// guess this must be done before the DelDummyNodes below as that
+// deletes nodes so would mess up the index arithmetic
+// sw_fieldmarkhide: also needs to be done before making frames
+if (m_rDoc.getIDocumentMarkAccess()->getAllMarksCount())
+{
+SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
+SwPosition targetPos(SwNodeIndex(aSavePos,
+ rRg.aStart != rRg.aEnd ? +1 : 0));
+if (pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->nNode)
+{
+// there is 1 (partially selected, maybe) paragraph before
+assert(SwNodeIndex(rRg.aStart, -1) == 
pCopiedPaM->first.Start()->nNode);
+// only use the passed in target SwPosition if the source PaM point
+// is on a different node; if it was the same node then the target
+// position was likely moved along by the copy operation and now
+// points to the end of the range!
+targetPos = pCopiedPaM->second;
+}
+
+sw::CopyBookmarks(pCopiedPaM ? pCopiedPaM->first : aRgTmp, targetPos);
+}
+
+if (rRg.aStart != rRg.aEnd)
+{
+bool isRecreateEndNode(false);
 if (bMakeNewFrames) // tdf#130685 only after aRedlRest
 {   // recreate from previous node (could be merged now)
 if (SwTextNode *const pNode = aSavePos.GetNode().GetTextNode())
@@ -3528,10 +3560,6 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
 ? 0 : +1);
 ::MakeFrames(, aSavePos, end);
 }
-if (bEndIsEqualEndPos)
-{
-const_cast(rRg.aEnd) = aSavePos;
-}
 }
 
 #if OSL_DEBUG_LEVEL > 0
@@ -3568,27 +3596,6 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
 
 SwNodeRange aCpyRange( aSavePos, rInsPos );
 
-// Also copy all bookmarks
-// guess this must be done before the DelDummyNodes below as that
-// deletes nodes so would mess up the index arithmetic
-if( m_rDoc.getIDocumentMarkAccess()->getAllMarksCount() )
-{
-SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
-SwPaM aCpyPaM(aCpyRange.aStart, aCpyRange.aEnd);
-if (pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->nNode)
-{
-// there is 1 (partially selected, maybe) paragraph before
-assert(SwNodeIndex(rRg.aStart, -1) == 
pCopiedPaM->first.Start()->nNode);
-// only use the passed in target SwPosition if the source PaM point
-// is on a different node; if it was the same node then the target
-// position was likely moved along by the copy operation and now
-// points to the end of the range!
-*aCpyPaM.GetPoint() = pCopiedPaM->second;
-}
-
-sw::CopyBookmarks(pCopiedPaM ? pCopiedPaM->first : aRgTmp, 
*aCpyPaM.Start());
-}
-
 if( bDelRedlines && ( RedlineFlags::DeleteRedlines & 
rDest.getIDocumentRedlineAccess().GetRedlineFlags() ))
 lcl_DeleteRedlines( rRg, aCpyRange );
 
commit 84d7a46aaeb5d112e1588bffdd5020f6245ba504
Author: Michael Stahl 
AuthorDate: Thu Nov 5 20:28:06 2020 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 17 22:20:01 2020 +0100

sw_fieldmarkhide: adapt cursor movement in SwCursor::LeftRight()

Jump over the 

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

2020-11-17 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/wsfrm.cxx  |   10 +-
 sw/source/core/text/redlnitr.cxx |  181 +--
 2 files changed, 162 insertions(+), 29 deletions(-)

New commits:
commit aacaa2aa91f705d64b929b5cff2872f160021b9f
Author: Michael Stahl 
AuthorDate: Tue Nov 3 22:11:59 2020 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 17 22:19:32 2020 +0100

sw_fieldmarkhide: let CheckParaRedlineMerge() hide fieldmarks

HideIterator finds the next delete redline or fieldmark, whichever is
closer.

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

diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 6727751c3576..a79ce4878a89 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -35,6 +35,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -47,14 +50,161 @@
 
 using namespace ::com::sun::star;
 
+namespace {
+
+class HideIterator
+{
+private:
+IDocumentRedlineAccess const& m_rIDRA;
+IDocumentMarkAccess const& m_rIDMA;
+bool const m_isHideRedlines;
+sw::FieldmarkMode const m_eFieldmarkMode;
+SwPosition const m_Start;
+/// next redline
+SwRedlineTable::size_type m_RedlineIndex;
+/// next fieldmark
+std::pair> 
m_Fieldmark;
+std::optional m_oNextFieldmarkHide;
+/// current start/end pair
+SwPosition const* m_pStartPos;
+SwPosition const* m_pEndPos;
+
+public:
+SwPosition const* GetStartPos() const { return m_pStartPos; }
+SwPosition const* GetEndPos() const { return m_pEndPos; }
+
+HideIterator(SwTextNode & rTextNode,
+bool const isHideRedlines, sw::FieldmarkMode const eMode)
+: m_rIDRA(rTextNode.getIDocumentRedlineAccess())
+, m_rIDMA(*rTextNode.getIDocumentMarkAccess())
+, m_isHideRedlines(isHideRedlines)
+, m_eFieldmarkMode(eMode)
+, m_Start(rTextNode, 0)
+, m_RedlineIndex(m_rIDRA.GetRedlinePos(rTextNode, RedlineType::Any))
+, m_pStartPos(nullptr)
+, m_pEndPos(_Start)
+{
+}
+
+// delete redlines and fieldmarks can't overlap, due to sw::CalcBreaks()
+// and no combining of adjacent redlines
+// -> dummy chars are delete-redlined *iff* entire fieldmark is
+// Note: caller is responsible for checking for immediately adjacent hides
+bool Next()
+{
+SwPosition const* pNextRedlineHide(nullptr);
+assert(m_pEndPos);
+if (m_isHideRedlines)
+{
+// position on current or next redline
+for (; m_RedlineIndex < m_rIDRA.GetRedlineTable().size(); 
++m_RedlineIndex)
+{
+SwRangeRedline const*const pRed = 
m_rIDRA.GetRedlineTable()[m_RedlineIndex];
+
+if (m_pEndPos->nNode.GetIndex() < 
pRed->Start()->nNode.GetIndex())
+break;
+
+if (pRed->GetType() != RedlineType::Delete)
+continue;
+
+SwPosition const*const pStart(pRed->Start());
+SwPosition const*const pEnd(pRed->End());
+if (*pStart == *pEnd)
+{   // only allowed while moving (either way?)
+//  
assert(IDocumentRedlineAccess::IsHideChanges(rIDRA.GetRedlineFlags()));
+continue;
+}
+if (pStart->nNode.GetNode().IsTableNode())
+{
+assert(pEnd->nNode == m_Start.nNode && 
pEnd->nContent.GetIndex() == 0);
+continue; // known pathology, ignore it
+}
+if (*m_pEndPos <= *pStart)
+{
+pNextRedlineHide = pStart;
+break; // the next one
+}
+}
+}
+
+// position on current or next fieldmark
+m_oNextFieldmarkHide.reset();
+if (m_eFieldmarkMode != sw::FieldmarkMode::ShowBoth)
+{
+sal_Unicode const magic(m_eFieldmarkMode == 
sw::FieldmarkMode::ShowResult
+? CH_TXT_ATR_FIELDSTART
+: CH_TXT_ATR_FIELDSEP);
+sal_Int32 const 
nPos(m_pEndPos->nNode.GetNode().GetTextNode()->GetText().indexOf(
+magic, m_pEndPos->nContent.GetIndex()));
+if (nPos != -1)
+{
+
m_oNextFieldmarkHide.emplace(*m_pEndPos->nNode.GetNode().GetTextNode(), nPos);
+sw::mark::IFieldmark const*const pFieldmark(
+m_eFieldmarkMode == sw::FieldmarkMode::ShowResult
+? m_rIDMA.getFieldmarkAt(*m_oNextFieldmarkHide)
+: m_rIDMA.getFieldmarkFor(*m_oNextFieldmarkHide));
+assert(pFieldmark);
+m_Fieldmark.first = pFieldmark;
+// for 

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

2020-08-21 Thread Noel Grandin (via logerrit)
 sw/source/filter/xml/xmlfmt.cxx |4 ++--
 xmloff/source/draw/ximpstyl.cxx |2 +-
 xmloff/source/draw/ximpstyl.hxx |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit af068c36c65f8ed482e774fcf5346704ae7a2717
Author: Noel Grandin 
AuthorDate: Thu Aug 20 21:37:56 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 21 08:13:27 2020 +0200

use fastparser in SdXMLStylesContext

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

diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 51058a1f36d1..6aee9df7f8ac 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -1076,7 +1076,7 @@ rtl::Reference< SvXMLImportPropertyMapper > 
SdXMLStylesContext::GetImportPropert
 
 // Process all style and object info
 
-void SdXMLStylesContext::EndElement()
+void SdXMLStylesContext::endFastElement(sal_Int32 )
 {
 if(mbIsAutoStyle)
 {
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
index 3885d405141b..d3922a8eb326 100644
--- a/xmloff/source/draw/ximpstyl.hxx
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -210,7 +210,7 @@ public:
 SdXMLImport& rImport,
 bool bIsAutoStyle);
 
-virtual void EndElement() override;
+virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 virtual rtl::Reference< SvXMLImportPropertyMapper > 
GetImportPropertyMapper(XmlStyleFamily nFamily) const override;
 
 void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const;
commit 8d3ccf54fe47be0167505afb11159fd2e1fa1d9f
Author: Noel Grandin 
AuthorDate: Thu Aug 20 21:34:54 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 21 08:13:16 2020 +0200

use fastparser in SwXMLMasterStylesContext_Impl

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

diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 559984a60ff2..5bd4debc2d27 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -993,7 +993,7 @@ public:
 
 SwXMLMasterStylesContext_Impl( SwXMLImport& rImport );
 
-virtual void EndElement() override;
+virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 };
 
 }
@@ -1018,7 +1018,7 @@ bool SwXMLMasterStylesContext_Impl::InsertStyleFamily( 
XmlStyleFamily nFamily )
 return bIns;
 }
 
-void SwXMLMasterStylesContext_Impl::EndElement()
+void SwXMLMasterStylesContext_Impl::endFastElement(sal_Int32 )
 {
 FinishStyles( !GetSwImport().IsInsertMode() );
 GetSwImport().FinishStyles();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   4   5   >