[Libreoffice-commits] core.git: editeng/source solenv/gbuild sw/Module_sw.mk sw/qa sw/UITest_writer_tests8.mk

2023-11-25 Thread Matt K (via logerrit)
 editeng/source/misc/svxacorr.cxx  |   11 ++-
 solenv/gbuild/UITest.mk   |2 
 sw/Module_sw.mk   |1 
 sw/UITest_writer_tests8.mk|   20 +++
 sw/qa/uitest/writer_tests8/tdf156243.py   |   39 ++
 sw/qa/uitest/writer_tests8_data/registrymodifications.xcu |   12 
 6 files changed, 79 insertions(+), 6 deletions(-)

New commits:
commit b6e273aaaf597b60f78c1dd3db8676eea958a9f5
Author: Matt K 
AuthorDate: Thu Nov 23 21:47:34 2023 -0600
Commit: Mike Kaganski 
CommitDate: Sat Nov 25 12:41:49 2023 +0100

tdf#156243 Fix off-by-one bug for autocorrect

This change removes the "-1" from the code
that applies the autocorrection so that the entire
string to be autocorrected is replaced, instead
of leaving off the last character.  Also,
the starting character of the string is
preserved (i.e. non-bold if changing to bold)
by adding 1 to the start position; this is
for the case when the user cancels the
autocorrect dialog.

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 094ee2130f67..4c4b6883f247 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -833,37 +833,38 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& 
rDoc, const OUString& rT
 // of an empty hint in SetAttr which would be removed by Delete
 // (fdo#62536, AUTOFMT in Writer)
 rDoc.Delete( nEndPos, nEndPos + 1 );
-rDoc.Delete( nFndPos, nFndPos + 1 );
+
 // Span the Attribute over the area
 // the end.
 if( '*' == cInsChar )   // Bold
 {
 SvxWeightItem aSvxWeightItem( WEIGHT_BOLD, SID_ATTR_CHAR_WEIGHT );
-rDoc.SetAttr( nFndPos, nEndPos - 1,
+rDoc.SetAttr( nFndPos + 1, nEndPos,
   SID_ATTR_CHAR_WEIGHT,
   aSvxWeightItem);
 }
 else if( '/' == cInsChar )   // Italic
 {
 SvxPostureItem aSvxPostureItem( ITALIC_NORMAL, 
SID_ATTR_CHAR_POSTURE );
-rDoc.SetAttr( nFndPos, nEndPos - 1,
+rDoc.SetAttr( nFndPos + 1, nEndPos,
   SID_ATTR_CHAR_POSTURE,
   aSvxPostureItem);
 }
 else if( '-' == cInsChar )   // Strikeout
 {
 SvxCrossedOutItem aSvxCrossedOutItem( STRIKEOUT_SINGLE, 
SID_ATTR_CHAR_STRIKEOUT );
-rDoc.SetAttr( nFndPos, nEndPos - 1,
+rDoc.SetAttr( nFndPos + 1, nEndPos,
   SID_ATTR_CHAR_STRIKEOUT,
   aSvxCrossedOutItem);
 }
 else// Underline
 {
 SvxUnderlineItem aSvxUnderlineItem( LINESTYLE_SINGLE, 
SID_ATTR_CHAR_UNDERLINE );
-rDoc.SetAttr( nFndPos, nEndPos - 1,
+rDoc.SetAttr( nFndPos + 1, nEndPos,
   SID_ATTR_CHAR_UNDERLINE,
   aSvxUnderlineItem);
 }
+rDoc.Delete( nFndPos, nFndPos + 1 );
 }
 
 return -1 != nFndPos;
diff --git a/solenv/gbuild/UITest.mk b/solenv/gbuild/UITest.mk
index 5859b9e56de4..65bc37c1d1bf 100644
--- a/solenv/gbuild/UITest.mk
+++ b/solenv/gbuild/UITest.mk
@@ -64,7 +64,7 @@ else
$(if $(gb_UITest__interactive),, \
rm -fr $@.core && mkdir -p $(dir $(call 
gb_UITest_get_target,$*))user/ && mkdir $@.core && cd $@.core && ) \
$(if $(gb_UITest_use_config), \
-   cp $(gb_UITest_use_config) $(dir $(call 
gb_UITest_get_target,$*))user/. && ) \
+   cp $(gb_UITest_use_config) $(dir $(call 
gb_UITest_get_target,$*))user/user && ) \
$(call gb_CppunitTest_coredumpctl_setup,$@) \
($(gb_UITest_PRECOMMAND) \
$(if $(G_SLICE),G_SLICE=$(G_SLICE)) \
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 9ef1c80c84f7..22cea818178a 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -212,6 +212,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\
UITest_writer_tests5 \
UITest_writer_tests6 \
UITest_writer_tests7 \
+   UITest_writer_tests8 \
UITest_sw_table \
UITest_sw_chart \
UITest_sw_fieldDialog \
diff --git a/sw/UITest_writer_tests8.mk b/sw/UITest_writer_tests8.mk
new file mode 100644
index ..a33fdedbe255
--- /dev/null
+++ b/sw/UITest_writer_tests8.mk
@@ -0,0 +1,20 @@
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# 

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

2023-11-19 Thread Stephan Bergmann (via logerrit)
 editeng/source/editeng/editview.cxx  |4 ++--
 editeng/source/editeng/impedit.cxx   |4 ++--
 editeng/source/items/CustomPropertyField.cxx |2 +-
 editeng/source/items/flditem.cxx |   16 
 4 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit c860e7cc974c306961c421be1eb034c78c6c244f
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 22:04:58 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 20 07:55:09 2023 +0100

Extended loplugin:ostr: editeng

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index adf135b8e7f6..df9f193ebfe6 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -535,7 +535,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor, bool bActivat
 
 static const OString aPayload = OString::boolean(true);
 
pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE,
 aPayload);
-
pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, 
"visible", aPayload);
+
pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, 
"visible"_ostr, aPayload);
 }
 }
 
@@ -553,7 +553,7 @@ void EditView::HideCursor(bool bDeactivate)
 
 OString aPayload = OString::boolean(false);
 
pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE,
 aPayload);
-
pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, 
"visible", aPayload);
+
pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, 
"visible"_ostr, aPayload);
 }
 }
 
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 393a208703b4..851e63c0453d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -439,12 +439,12 @@ void ImpEditView::lokSelectionCallback(const 
std::optional &
 {
 // Another shell wants to know about our existing selection.
 if (mpViewShell != mpOtherShell)
-mpViewShell->NotifyOtherView(mpOtherShell, 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRectangle);
+mpViewShell->NotifyOtherView(mpOtherShell, 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, sRectangle);
 }
 else
 {
 
mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
sRectangle);
-mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, 
"selection", sRectangle);
+mpViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, 
"selection"_ostr, sRectangle);
 }
 
 pOutWin->GetOutDev()->Pop();
diff --git a/editeng/source/items/CustomPropertyField.cxx 
b/editeng/source/items/CustomPropertyField.cxx
index 939a6af0c0d9..eaad4c4c4db8 100644
--- a/editeng/source/items/CustomPropertyField.cxx
+++ b/editeng/source/items/CustomPropertyField.cxx
@@ -45,7 +45,7 @@ bool CustomPropertyField::operator==(const SvxFieldData& 
rOther) const
 
 MetaAction* CustomPropertyField::createBeginComment() const
 {
-return new MetaCommentAction("FIELD_SEQ_BEGIN");
+return new MetaCommentAction("FIELD_SEQ_BEGIN"_ostr);
 }
 
 OUString 
CustomPropertyField::GetFormatted(uno::Reference 
const & xDocumentProperties)
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 1f6a9d9cc485..b501d40ba968 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -266,12 +266,12 @@ bool SvxFieldData::operator==( const SvxFieldData& rFld ) 
const
 
 MetaAction* SvxFieldData::createBeginComment() const
 {
-return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
+return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr );
 }
 
 MetaAction* SvxFieldData::createEndComment()
 {
-return new MetaCommentAction( "FIELD_SEQ_END" );
+return new MetaCommentAction( "FIELD_SEQ_END"_ostr );
 }
 
 
@@ -428,7 +428,7 @@ OUString SvxDateField::GetFormatted( Date const & aDate, 
SvxDateFormat eFormat,
 
 MetaAction* SvxDateField::createBeginComment() const
 {
-return new MetaCommentAction( "FIELD_SEQ_BEGIN" );
+return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr );
 }
 
 SvxURLField::SvxURLField()
@@ -466,7 +466,7 @@ bool SvxURLField::operator==( const SvxFieldData& rOther ) 
const
 MetaAction* SvxURLField::createBeginComment() const
 {
 // #i46618# Adding target URL to metafile comment
-return new MetaCommentAction( "FIELD_SEQ_BEGIN",
+return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr,
   0,
   reinterpret_cast(aURL.getStr()),
   

[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source

2023-11-15 Thread Justin Luth (via logerrit)
 editeng/source/outliner/outlvw.cxx   |4 ++--
 include/editeng/outliner.hxx |2 +-
 sc/source/ui/drawfunc/drtxtob.cxx|4 +++-
 sc/source/ui/view/editsh.cxx |4 +++-
 sd/source/ui/view/drviews2.cxx   |4 +++-
 sw/source/uibase/shells/drwtxtex.cxx |4 +++-
 6 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit aaca48eb12357fa5cf23054fe77554bcfff74e95
Author: Justin Luth 
AuthorDate: Mon Nov 6 13:41:05 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Nov 15 20:04:37 2023 +0100

tdf#158031 editeng SID_COPY_HYPERLINK: use AlsoCheckBeforeCursor

This patch depends on prior patches for this bug report.

This fixes nothing being copied if the mouse was right-clicked
over that second half of the hyperlink (since a "smart" positioning
set the cursor after the field instead of before it).

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

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index adf75cc54afa..2649e865d6d7 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1340,9 +1340,9 @@ const SvxFieldItem* 
OutlinerView::GetFieldUnderMousePointer() const
 return pEditView->GetFieldUnderMousePointer();
 }
 
-const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
+const SvxFieldItem* OutlinerView::GetFieldAtSelection(bool 
bAlsoCheckBeforeCursor) const
 {
-return pEditView->GetFieldAtSelection();
+return pEditView->GetFieldAtSelection(bAlsoCheckBeforeCursor);
 }
 
 const SvxFieldData* OutlinerView::GetFieldAtCursor() const
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index cc921f4cd0af..4f8d41e21b9b 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -306,7 +306,7 @@ public:
 
 voidInsertField( const SvxFieldItem& rFld );
 const SvxFieldItem* GetFieldUnderMousePointer() const;
-const SvxFieldItem* GetFieldAtSelection() const;
+const SvxFieldItem* GetFieldAtSelection(bool bAlsoCheckBeforeCursor = 
false) const;
 /// Return the field at the current cursor position or nullptr if no field 
found
 const SvxFieldData* GetFieldAtCursor() const;
 /// Select the field at the current cursor position
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx 
b/sc/source/ui/drawfunc/drtxtob.cxx
index ec527db045ac..65da5aac262c 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -311,7 +311,9 @@ void ScDrawTextObjectBar::Execute( SfxRequest  )
 
 case SID_COPY_HYPERLINK_LOCATION:
 {
-const SvxFieldData* pField = pOutView->GetFieldAtCursor();
+const SvxFieldItem* pFieldItem
+= 
pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
+const SvxFieldData* pField = pFieldItem ? 
pFieldItem->GetField() : nullptr;
 if (const SvxURLField* pURLField = dynamic_cast(pField))
 {
 uno::Reference 
xClipboard
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 3393ca3ad090..ba76f89c4651 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -655,7 +655,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
 break;
 case SID_COPY_HYPERLINK_LOCATION:
 {
-const SvxFieldData* pField = pEditView->GetFieldAtCursor();
+const SvxFieldItem* pFieldItem
+= 
pEditView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
+const SvxFieldData* pField = pFieldItem ? 
pFieldItem->GetField() : nullptr;
 if (const SvxURLField* pURLField = dynamic_cast(pField))
 {
 uno::Reference 
xClipboard
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b49e7bfc497a..fab59b59f00a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2280,7 +2280,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
 if ( pOutView )
 {
-const SvxFieldData* pField = pOutView->GetFieldAtCursor();
+const SvxFieldItem* pFieldItem
+= 
pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
+const SvxFieldData* pField = pFieldItem ? 
pFieldItem->GetField() : nullptr;
 if (const SvxURLField* pURLField = dynamic_cast(pField))
 {
 uno::Reference 
xClipboard
diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index db76755474e4..dc10ba46f143 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ 

[Libreoffice-commits] core.git: editeng/source include/editeng sc/source

2023-11-10 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleContextBase.cxx |9 +++--
 include/editeng/AccessibleContextBase.hxx  |6 --
 sc/source/ui/Accessibility/AccessibleDocument.cxx  |4 ++--
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit b048814f5eb2ed58c302a880a2eabf69473955e0
Author: Noel Grandin 
AuthorDate: Wed Nov 8 14:43:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 10 12:35:58 2023 +0100

loplugin:fieldcast in accessibility::AccessibleContextBase

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

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index 7143b7151bcf..df52b70e78a4 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -128,7 +128,7 @@ bool AccessibleContextBase::GetState (sal_Int64 aState)
 
 
 void AccessibleContextBase::SetRelationSet (
-const uno::Reference& rxNewRelationSet)
+const rtl::Reference& rxNewRelationSet)
 {
 // Try to emit some meaningful events indicating differing relations in
 // both sets.
@@ -268,12 +268,9 @@ uno::Reference SAL_CALL
 ThrowIfDisposed ();
 
 // Create a copy of the relation set and return it.
-::utl::AccessibleRelationSetHelper* pRelationSet =
-static_cast< ::utl::AccessibleRelationSetHelper*>(mxRelationSet.get());
-if (pRelationSet != nullptr)
+if (mxRelationSet)
 {
-return uno::Reference (
-new ::utl::AccessibleRelationSetHelper (*pRelationSet));
+return new ::utl::AccessibleRelationSetHelper(*mxRelationSet);
 }
 else
 return uno::Reference(nullptr);
diff --git a/include/editeng/AccessibleContextBase.hxx 
b/include/editeng/AccessibleContextBase.hxx
index d2152a9a4026..25f3ab8ceb55 100644
--- a/include/editeng/AccessibleContextBase.hxx
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -28,9 +28,11 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::accessibility { class XAccessibleRelationSet; }
 namespace com::sun::star::accessibility { struct AccessibleEventObject; }
+namespace utl { class AccessibleRelationSetHelper; }
 
 namespace accessibility {
 
@@ -157,7 +159,7 @@ public:
 @throws css::uno::RuntimeException
 */
 void SetRelationSet (
-const css::uno::Reference< 
css::accessibility::XAccessibleRelationSet>& rxRelationSet);
+const rtl::Reference< utl::AccessibleRelationSetHelper>& 
rxRelationSet);
 
 
 //=  XAccessible  =
@@ -263,7 +265,7 @@ protected:
 /** The relation set.  Relations can be set or removed by calling the
 AddRelation and RemoveRelation 
methods.
 */
-css::uno::Reference< css::accessibility::XAccessibleRelationSet> 
mxRelationSet;
+rtl::Reference mxRelationSet;
 
 // This method is called from the component helper base class while 
disposing.
 virtual void SAL_CALL disposing() override;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 3222cc289ed8..c309f1b1fe66 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -267,7 +267,7 @@ private:
 bool FindSelectedShapesChanges(const 
css::uno::Reference& xShapes) const;
 
 std::optional GetAnchor(const uno::Reference& 
xShape) const;
-uno::Reference GetRelationSet(const 
ScAccessibleShapeData* pData) const;
+rtl::Reference GetRelationSet(const 
ScAccessibleShapeData* pData) const;
 void SetAnchor(const uno::Reference& xShape, 
ScAccessibleShapeData* pData) const;
 void AddShape(const uno::Reference& xShape, bool 
bCommitChange) const;
 void RemoveShape(const uno::Reference& xShape) const;
@@ -1125,7 +1125,7 @@ std::optional 
ScChildrenShapes::GetAnchor(const uno::Reference();
 }
 
-uno::Reference ScChildrenShapes::GetRelationSet(const 
ScAccessibleShapeData* pData) const
+rtl::Reference 
ScChildrenShapes::GetRelationSet(const ScAccessibleShapeData* pData) const
 {
 rtl::Reference pRelationSet = new 
utl::AccessibleRelationSetHelper();
 


[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source

2023-11-10 Thread Oliver Specht (via logerrit)
 editeng/source/editeng/editeng.cxx   |4 ++--
 editeng/source/editeng/editview.cxx  |4 ++--
 editeng/source/editeng/impedit.cxx   |4 ++--
 editeng/source/editeng/impedit.hxx   |4 ++--
 editeng/source/editeng/impedit2.cxx  |   32 +---
 editeng/source/outliner/outlvw.cxx   |8 
 include/editeng/editeng.hxx  |4 +++-
 include/editeng/editview.hxx |3 ++-
 include/editeng/outliner.hxx |5 +++--
 sc/source/ui/drawfunc/drtxtob1.cxx   |3 ++-
 sd/source/ui/func/fuinsert.cxx   |1 +
 sd/source/ui/view/sdview3.cxx|   30 ++
 sw/source/uibase/shells/drwtxtex.cxx |3 ++-
 13 files changed, 84 insertions(+), 21 deletions(-)

New commits:
commit 87be89ac27023f48f68a873b37df31aa0453d6fa
Author: Oliver Specht 
AuthorDate: Mon Oct 30 13:26:49 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Nov 10 09:52:28 2023 +0100

tdf#157363 add HTML format when pasting into draw text

adds HTML to paste(special) in draw text in impress/draw/calc/writer

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 6cb28954aedc..728609cd94e2 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -849,9 +849,9 @@ EditSelection EditEngine::InsertText(const EditTextObject& 
rTextObject, const Ed
 
 EditSelection EditEngine::InsertText(
 uno::Reference const & rxDataObj,
-const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial)
+const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial, 
SotClipboardFormatId format)
 {
-return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial);
+return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial, 
format);
 }
 
 EditPaM EditEngine::EndOfWord(const EditPaM& rPaM)
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index a50dc9ebc6fe..d73cb24ef452 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -685,10 +685,10 @@ void EditView::Paste()
 pImpEditView->Paste( aClipBoard );
 }
 
-void EditView::PasteSpecial()
+void EditView::PasteSpecial(SotClipboardFormatId format)
 {
 Reference 
aClipBoard(GetClipboard());
-pImpEditView->Paste(aClipBoard, true );
+pImpEditView->Paste(aClipBoard, true, format );
 }
 
 Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph )
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 8813376dacdd..393a208703b4 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1946,7 +1946,7 @@ void ImpEditView::CutCopy( css::uno::Reference< 
css::datatransfer::clipboard::XC
 }
 }
 
-void ImpEditView::Paste( css::uno::Reference< 
css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool 
bUseSpecial )
+void ImpEditView::Paste( css::uno::Reference< 
css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool 
bUseSpecial, SotClipboardFormatId format)
 {
 if ( !rxClipboard.is() )
 return;
@@ -2006,7 +2006,7 @@ void ImpEditView::Paste( css::uno::Reference< 
css::datatransfer::clipboard::XCli
 // paragraphs. Collect and broadcast when done instead.
 aSel = pEditEngine->InsertText(
 xDataObj, OUString(), aSel.Min(),
-bUseSpecial && 
pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
+bUseSpecial && 
pEditEngine->GetInternalEditStatus().AllowPasteSpecial(), format);
 }
 
 aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( 
aSel.Max().GetNode() );
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index df7a11c97dcb..6fcb58dc 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -377,7 +377,7 @@ public:
 boolCommand(const CommandEvent& rCEvt);
 
 voidCutCopy( css::uno::Reference< 
css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bCut );
-voidPaste( css::uno::Reference< 
css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool 
bUseSpecial = false );
+voidPaste( css::uno::Reference< 
css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool 
bUseSpecial = false, SotClipboardFormatId format = SotClipboardFormatId::NONE);
 
 voidSetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = 
rPos; }
 
@@ -644,7 +644,7 @@ private:
 std::unique_ptr
 CreateTextObject(EditSelection aSelection, 
SfxItemPool*, bool bAllowBigObjects = false, sal_Int32 nBigObjStart = 0);
 EditSelection   InsertTextObject( const 

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

2023-11-07 Thread Vasily Melenchuk (via logerrit)
 editeng/source/editeng/eertfpar.cxx |1 
 include/svtools/rtfkeywd.hxx|1 
 include/svtools/rtftoken.h  |1 
 svtools/source/svrtf/rtfkeywd.cxx   |1 
 sw/source/core/doc/docfmt.cxx   |6 +---
 sw/source/filter/ww8/rtfexport.cxx  |   48 
 sw/source/filter/ww8/rtfexport.hxx  |2 -
 7 files changed, 2 insertions(+), 58 deletions(-)

New commits:
commit b6a7d8201bdb6c28e18472326b2328507a6b1e4e
Author: Vasily Melenchuk 
AuthorDate: Mon Nov 6 13:05:47 2023 +0300
Commit: Miklos Vajna 
CommitDate: Tue Nov 7 14:59:46 2023 +0100

tdf#158083: RTF: drop export for \pgdsctbl

This table is not standard extension to RTF format. It is not
described in RTF specification and even is not used by Writer
on import these days.

Change-Id: I52f27dfd30877d461ad535b7847f40dd4c6f4ea5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158986
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 
Reviewed-by: Miklos Vajna 

diff --git a/editeng/source/editeng/eertfpar.cxx 
b/editeng/source/editeng/eertfpar.cxx
index a5737b4c923a..948216f33dbe 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -203,7 +203,6 @@ void EditRTFParser::NextToken( int nToken )
 SkipGroup();
 }
 break;
-case RTF_PGDSCTBL: // #i29453# ignore \*\pgdsctbl destination
 case RTF_LISTTEXT:
 {
 SkipGroup();
diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
index fa6346922437..44bbd12a4454 100644
--- a/include/svtools/rtfkeywd.hxx
+++ b/include/svtools/rtfkeywd.hxx
@@ -1110,7 +1110,6 @@
 #define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle"
 #define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol"
 #define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol"
-#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl"
 #define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc"
 #define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse"
 #define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt"
diff --git a/include/svtools/rtftoken.h b/include/svtools/rtftoken.h
index f530c8e5ba33..ab637a4e1fb8 100644
--- a/include/svtools/rtftoken.h
+++ b/include/svtools/rtftoken.h
@@ -1234,7 +1234,6 @@ enum RTF_TOKEN_IDS {
 RTF_SHDW_STYLE,
 RTF_SHDW_COL,
 RTF_SHDW_FCOL,
-RTF_PGDSCTBL,
 RTF_PGDSC,
 RTF_PGDSCUSE,
 RTF_PGDSCNXT,
diff --git a/svtools/source/svrtf/rtfkeywd.cxx 
b/svtools/source/svrtf/rtfkeywd.cxx
index e805b3cd9359..91f2669ea98d 100644
--- a/svtools/source/svrtf/rtfkeywd.cxx
+++ b/svtools/source/svrtf/rtfkeywd.cxx
@@ -1120,7 +1120,6 @@ static RTF_TokenEntry aRTFTokenTab[] = {
 
 {std::u16string_view(u"" OOO_STRING_SVTOOLS_RTF_FLYINPARA), 
RTF_FLY_INPARA},
 
-{std::u16string_view(u"" OOO_STRING_SVTOOLS_RTF_PGDSCTBL),  
RTF_PGDSCTBL},
 {std::u16string_view(u"" OOO_STRING_SVTOOLS_RTF_PGDSC), 
RTF_PGDSC},
 {std::u16string_view(u"" OOO_STRING_SVTOOLS_RTF_PGDSCUSE),  
RTF_PGDSCUSE},
 {std::u16string_view(u"" OOO_STRING_SVTOOLS_RTF_PGDSCNXT),  
RTF_PGDSCNXT},
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index edacd4455b70..c7deb91478b9 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1562,12 +1562,10 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool 
bIncludePageStyles )
 ::MakeTextFormatColl_, *mpDfltTextFormatColl );
 
 //To-Do:
-//  a) in rtf export don't export our hideous pgdsctbl
-//  extension to rtf anymore
-//  b) in sd rtf import (View::InsertData) don't use
+//  a) in sd rtf import (View::InsertData) don't use
 //  a super-fragile test for mere presence of \trowd to
 //  indicate import of rtf into a table
-//  c) then drop use of bIncludePageStyles
+//  b) then drop use of bIncludePageStyles
 if (bIncludePageStyles)
 {
 // and now the page templates
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 278e9c271e0e..616533b4dd5a 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -729,51 +729,6 @@ void RtfExport::WriteDocVars()
 }
 }
 
-void RtfExport::WritePageDescTable()
-{
-// Write page descriptions (page styles)
-std::size_t nSize = m_rDoc.GetPageDescCnt();
-if (!nSize)
-return;
-
-Strm().WriteOString(SAL_NEWLINE_STRING);
-m_bOutPageDescs = true;
-Strm()
-.WriteChar('{')
-.WriteOString(OOO_STRING_SVTOOLS_RTF_IGNORE)
-.WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSCTBL);
-for (std::size_t n = 0; n < nSize; ++n)
-{
-const SwPageDesc& rPageDesc = m_rDoc.GetPageDesc(n);
-
-Strm()
-.WriteOString(SAL_NEWLINE_STRING)
-.WriteChar('{')
-.WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSC);
-

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

2023-11-02 Thread Justin Luth (via logerrit)
 editeng/source/editeng/editview.cxx |   31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit a09b59cdbde2ab926737337b74a7a62b17f1
Author: Justin Luth 
AuthorDate: Thu Nov 2 12:29:47 2023 -0400
Commit: Justin Luth 
CommitDate: Fri Nov 3 03:19:06 2023 +0100

NFC related tdf#158031 editeng: flatten and simplify the code

No Functional Change intended.
Just some slight optimizing that leads to some nice flattening.

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 72411fab6588..a50dc9ebc6fe 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1346,26 +1346,29 @@ const SvxFieldItem* 
EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_I
 
 const SvxFieldItem* EditView::GetFieldAtSelection() const
 {
+// a field is a dummy character - so it cannot span nodes or be a 
selection larger than 1
 EditSelection aSel( pImpEditView->GetEditSelection() );
+if (aSel.Min().GetNode() != aSel.Max().GetNode())
+return nullptr;
+
+// normalize: min < max
 aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
+
+const sal_Int32 nMinIndex =  aSel.Min().GetIndex();
+const sal_Int32 nMaxIndex =  aSel.Max().GetIndex();
+if (nMaxIndex > nMinIndex + 1)
+return nullptr;
+
 // Only when cursor is in font of field, no selection,
 // or only selecting field
-if ( ( aSel.Min().GetNode() == aSel.Max().GetNode() ) &&
- ( ( aSel.Max().GetIndex() == aSel.Min().GetIndex() ) ||
-   ( aSel.Max().GetIndex() == aSel.Min().GetIndex()+1 ) ) )
+const CharAttribList::AttribsType& rAttrs = 
aSel.Min().GetNode()->GetCharAttribs().GetAttribs();
+for (const auto& rAttr: rAttrs)
 {
-EditPaM aPaM = aSel.Min();
-const CharAttribList::AttribsType& rAttrs = 
aPaM.GetNode()->GetCharAttribs().GetAttribs();
-const sal_Int32 nXPos = aPaM.GetIndex();
-for (size_t nAttr = rAttrs.size(); nAttr; )
+if (rAttr->Which() == EE_FEATURE_FIELD)
 {
-const EditCharAttrib& rAttr = *rAttrs[--nAttr];
-if (rAttr.GetStart() == nXPos)
-if (rAttr.Which() == EE_FEATURE_FIELD)
-{
-DBG_ASSERT(dynamic_cast(rAttr.GetItem() ) != nullptr, "No FieldItem...");
-return static_cast(rAttr.GetItem());
-}
+DBG_ASSERT(dynamic_cast(rAttr->GetItem()), 
"No FieldItem...");
+if (rAttr->GetStart() == nMinIndex)
+return static_cast(rAttr->GetItem());
 }
 }
 return nullptr;


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

2023-10-21 Thread Caolán McNamara (via logerrit)
 editeng/source/items/textitem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dffe85aaf3443ab2286eb9990c1c7faa692ec96f
Author: Caolán McNamara 
AuthorDate: Sat Oct 21 16:15:53 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 21 20:45:33 2023 +0200

ofz#63406 Timeouts with huge fonts

reduce limit further when fuzzing

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 813f907fb784..cac394c119c4 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -813,7 +813,7 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 if (fPoint < 0. || fPoint > 1.)
 return false;
 static bool bFuzzing = utl::ConfigManager::IsFuzzing();
-if (bFuzzing && fPoint > 500)
+if (bFuzzing && fPoint > 240)
 {
 SAL_WARN("editeng.items", "SvxFontHeightItem ignoring font 
size of " << fPoint << " for performance");
 return false;


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

2023-10-19 Thread Stephan Bergmann (via logerrit)
 editeng/source/editeng/impedit3.cxx |2 +-
 editeng/source/items/numitem.cxx|4 ++--
 editeng/source/misc/svxacorr.cxx|   10 +-
 editeng/source/misc/unolingu.cxx|2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 30c4d857612ec3ba6c252d6da70b0195e0e1d902
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:12 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 21:08:25 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: editeng

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

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7ed7423bbded..7402487120e1 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -88,7 +88,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::linguistic2;
 
-constexpr OUStringLiteral CH_HYPH = u"-";
+constexpr OUString CH_HYPH = u"-"_ustr;
 
 constexpr tools::Long WRONG_SHOW_MIN = 5;
 
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 97f857547029..983eff2779e2 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -140,8 +140,8 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const 
css::lang::Locale& rLoca
 else
 {
 SvxNumType nActType = !bIsLegal || 
isArabicNumberingType(nNumType) ? nNumType : SVX_NUM_ARABIC;
-static constexpr OUStringLiteral sNumberingType = 
u"NumberingType";
-static constexpr OUStringLiteral sValue = u"Value";
+static constexpr OUString sNumberingType = 
u"NumberingType"_ustr;
+static constexpr OUString sValue = u"Value"_ustr;
 Sequence< PropertyValue > aProperties
 {
 comphelper::makePropertyValue(sNumberingType, 
static_cast(nActType)),
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 7959b9c2ba83..094ee2130f67 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -97,9 +97,9 @@ namespace o3tl {
 }
 const sal_Unicode cNonBreakingSpace = 0xA0; // UNICODE code for no break space
 
-constexpr OUStringLiteral pXMLImplWordStart_ExcptLstStr = 
u"WordExceptList.xml";
-constexpr OUStringLiteral pXMLImplCplStt_ExcptLstStr = 
u"SentenceExceptList.xml";
-constexpr OUStringLiteral pXMLImplAutocorr_ListStr = u"DocumentList.xml";
+constexpr OUString pXMLImplWordStart_ExcptLstStr = u"WordExceptList.xml"_ustr;
+constexpr OUString pXMLImplCplStt_ExcptLstStr = u"SentenceExceptList.xml"_ustr;
+constexpr OUString pXMLImplAutocorr_ListStr = u"DocumentList.xml"_ustr;
 
 // tdf#54409 check also typographical quotation marks in the case of skipped 
ASCII quotation marks
 // Curious, why these \u0083\u0084\u0089\u0091\u0092\u0093\u0094 are handled 
as "begin characters"?
@@ -304,8 +304,8 @@ ACFlags SvxAutoCorrect::GetDefaultFlags()
 
 constexpr sal_Unicode cEmDash = 0x2014;
 constexpr sal_Unicode cEnDash = 0x2013;
-constexpr OUStringLiteral sEmDash(u"\u2014");
-constexpr OUStringLiteral sEnDash(u"\u2013");
+constexpr OUString sEmDash(u"\u2014"_ustr);
+constexpr OUString sEnDash(u"\u2013"_ustr);
 constexpr sal_Unicode cApostrophe = 0x2019;
 constexpr sal_Unicode cLeftDoubleAngleQuote = 0xAB;
 constexpr sal_Unicode cRightDoubleAngleQuote = 0xBB;
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index b8b5676099f1..1e7b69a25f27 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -633,7 +633,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard()
 if (!xTmpDicList.is())
 return nullptr;
 
-static constexpr OUStringLiteral aDicName( u"standard.dic" );
+static constexpr OUString aDicName( u"standard.dic"_ustr );
 uno::Reference< XDictionary > xDic = xTmpDicList->getDictionaryByName( 
aDicName );
 if (!xDic.is())
 {


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

2023-10-19 Thread Willian Pessoa (via logerrit)
 editeng/source/items/textitem.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit fec4d0fb9992811d1217624d8eda95eac6da4220
Author: Willian Pessoa 
AuthorDate: Thu Oct 12 17:34:10 2023 -0300
Commit: Ilmari Lauhakangas 
CommitDate: Thu Oct 19 14:18:59 2023 +0200

tdf#147021 Use std::size() in editeng

Change-Id: Id6496b34a3601fb021af2894fbf7f876b444145f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157895
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index e4c1cdbe14cc..813f907fb784 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -552,7 +552,7 @@ OUString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos )
 RID_SVXITEMS_WEIGHT_BLACK
 };
 
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_WEIGHTS) - 1 == WEIGHT_BLACK, 
"must match");
+static_assert(std::size(RID_SVXITEMS_WEIGHTS) - 1 == WEIGHT_BLACK, "must 
match");
 assert(nPos <= sal_uInt16(WEIGHT_BLACK) && "enum overflow!" );
 return EditResId(RID_SVXITEMS_WEIGHTS[nPos]);
 }
@@ -1123,7 +1123,7 @@ OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 
nPos ) const
 RID_SVXITEMS_UL_BOLDDASHDOTDOT,
 RID_SVXITEMS_UL_BOLDWAVE
 };
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_UL) - 1 == LINESTYLE_BOLDWAVE, 
"must match");
+static_assert(std::size(RID_SVXITEMS_UL) - 1 == LINESTYLE_BOLDWAVE, "must 
match");
 assert(nPos <= sal_uInt16(LINESTYLE_BOLDWAVE) && "enum overflow!");
 return EditResId(RID_SVXITEMS_UL[nPos]);
 }
@@ -1164,7 +1164,7 @@ OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 
nPos ) const
 RID_SVXITEMS_OL_BOLDDASHDOTDOT,
 RID_SVXITEMS_OL_BOLDWAVE
 };
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_OL) - 1 == LINESTYLE_BOLDWAVE, 
"must match");
+static_assert(std::size(RID_SVXITEMS_OL) - 1 == LINESTYLE_BOLDWAVE, "must 
match");
 assert(nPos <= sal_uInt16(LINESTYLE_BOLDWAVE) && "enum overflow!");
 return EditResId(RID_SVXITEMS_OL[nPos]);
 }
@@ -1229,7 +1229,7 @@ OUString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 
nPos )
 RID_SVXITEMS_STRIKEOUT_SLASH,
 RID_SVXITEMS_STRIKEOUT_X
 };
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_STRIKEOUT) - 1 == STRIKEOUT_X, 
"must match");
+static_assert(std::size(RID_SVXITEMS_STRIKEOUT) - 1 == STRIKEOUT_X, "must 
match");
 assert(nPos <= sal_uInt16(STRIKEOUT_X) && "enum overflow!");
 return EditResId(RID_SVXITEMS_STRIKEOUT[nPos]);
 }
@@ -1761,7 +1761,7 @@ OUString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 
nPos )
 RID_SVXITEMS_CASEMAP_SMALLCAPS
 };
 
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_CASEMAP) == 
size_t(SvxCaseMap::End), "must match");
+static_assert(std::size(RID_SVXITEMS_CASEMAP) == size_t(SvxCaseMap::End), 
"must match");
 assert(nPos < sal_uInt16(SvxCaseMap::End) && "enum overflow!");
 return EditResId(RID_SVXITEMS_CASEMAP[nPos]);
 }
@@ -1881,7 +1881,7 @@ OUString SvxEscapementItem::GetValueTextByPos( sal_uInt16 
nPos )
 RID_SVXITEMS_ESCAPEMENT_SUB
 };
 
-static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_ESCAPEMENT) == 
size_t(SvxEscapement::End), "must match");
+static_assert(std::size(RID_SVXITEMS_ESCAPEMENT) == 
size_t(SvxEscapement::End), "must match");
 assert(nPos < sal_uInt16(SvxEscapement::End) && "enum overflow!");
 return EditResId(RID_SVXITEMS_ESCAPEMENT[nPos]);
 }
@@ -2554,13 +2554,13 @@ static TranslateId RID_SVXITEMS_RELIEF[] =
 
 OUString SvxCharReliefItem::GetValueTextByPos(sal_uInt16 nPos)
 {
-assert(nPos < SAL_N_ELEMENTS(RID_SVXITEMS_RELIEF) && "enum overflow");
+assert(nPos < std::size(RID_SVXITEMS_RELIEF) && "enum overflow");
 return EditResId(RID_SVXITEMS_RELIEF[nPos]);
 }
 
 sal_uInt16 SvxCharReliefItem::GetValueCount() const
 {
-return SAL_N_ELEMENTS(RID_SVXITEMS_RELIEF) - 1;
+return std::size(RID_SVXITEMS_RELIEF) - 1;
 }
 
 bool SvxCharReliefItem::GetPresentation


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

2023-10-11 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/editeng.cxx  |   22 +--
 editeng/source/editeng/impedit.hxx  |  166 +++
 editeng/source/editeng/impedit2.cxx |  252 ++--
 editeng/source/editeng/impedit3.cxx |  156 +++---
 editeng/source/editeng/impedit4.cxx |  158 +++---
 editeng/source/editeng/impedit5.cxx |  114 
 6 files changed, 432 insertions(+), 436 deletions(-)

New commits:
commit b63f768941ca870f0930ff400e3bc6ff829bea4a
Author: Tomaž Vajngerl 
AuthorDate: Sat Sep 30 22:56:27 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 12 01:28:05 2023 +0200

prefix some members of ImpEditEngine

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 0dd24c941069..6cb28954aedc 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -588,7 +588,7 @@ sal_Int32 EditEngine::GetTextLen() const
 
 sal_Int32 EditEngine::GetParagraphCount() const
 {
-return pImpEditEngine->aEditDoc.Count();
+return pImpEditEngine->maEditDoc.Count();
 }
 
 sal_Int32 EditEngine::GetLineCount( sal_Int32 nParagraph ) const
@@ -994,7 +994,7 @@ const EditSelectionEngine& EditEngine::GetSelectionEngine() 
const
 
 void EditEngine::SetInSelectionMode(bool b)
 {
-pImpEditEngine->bInSelection = b;
+pImpEditEngine->mbInSelection = b;
 }
 
 bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, 
vcl::Window const * pFrameWin )
@@ -1863,28 +1863,28 @@ void EditEngine::SetFlatMode( bool bFlat)
 
 bool EditEngine::IsFlatMode() const
 {
-return !( pImpEditEngine->aStatus.UseCharAttribs() );
+return !( pImpEditEngine->GetStatus().UseCharAttribs() );
 }
 
 void EditEngine::SetSingleLine(bool bValue)
 {
-if (bValue == pImpEditEngine->aStatus.IsSingleLine())
+if (bValue == pImpEditEngine->GetStatus().IsSingleLine())
 return;
 
 if (bValue)
-pImpEditEngine->aStatus.TurnOnFlags(EEControlBits::SINGLELINE);
+pImpEditEngine->GetStatus().TurnOnFlags(EEControlBits::SINGLELINE);
 else
-pImpEditEngine->aStatus.TurnOffFlags(EEControlBits::SINGLELINE);
+pImpEditEngine->GetStatus().TurnOffFlags(EEControlBits::SINGLELINE);
 }
 
 void EditEngine::SetControlWord( EEControlBits nWord )
 {
 
-if ( nWord == pImpEditEngine->aStatus.GetControlWord() )
+if ( nWord == pImpEditEngine->GetStatus().GetControlWord() )
 return;
 
-EEControlBits nPrev = pImpEditEngine->aStatus.GetControlWord();
-pImpEditEngine->aStatus.GetControlWord() = nWord;
+EEControlBits nPrev = pImpEditEngine->GetStatus().GetControlWord();
+pImpEditEngine->GetStatus().GetControlWord() = nWord;
 
 EEControlBits nChanges = nPrev ^ nWord;
 if ( pImpEditEngine->IsFormatted() )
@@ -1952,7 +1952,7 @@ void EditEngine::SetControlWord( EEControlBits nWord )
 
 EEControlBits EditEngine::GetControlWord() const
 {
-return pImpEditEngine->aStatus.GetControlWord();
+return pImpEditEngine->GetStatus().GetControlWord();
 }
 
 tools::Long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph )
@@ -2437,7 +2437,7 @@ EPosition EditEngine::FindDocPosition( const Point& 
rDocPos ) const
 EditPaM aPaM = const_cast(this)->pImpEditEngine->GetPaM( 
rDocPos, false );
 if ( aPaM.GetNode() )
 {
-aPos.nPara = pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
+aPos.nPara = pImpEditEngine->maEditDoc.GetPos( aPaM.GetNode() );
 aPos.nIndex = aPaM.GetIndex();
 }
 return aPos;
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 2fba7bd778f4..df7a11c97dcb 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -494,17 +494,13 @@ class ImpEditEngine : public SfxListener, public 
svl::StyleSheetUser
 private:
 std::shared_ptr pSharedVCL;
 
-
-// Data ...
-
-
 // Document Specific data ...
-ParaPortionList aParaPortionList;   // Formatting
-SizeaPaperSize; // Layout
-SizeaMinAutoPaperSize;  // Layout ?
-SizeaMaxAutoPaperSize;  // Layout ?
+ParaPortionList maParaPortionList; // Formatting
+Size maPaperSize; // Layout
+Size maMinAutoPaperSize; // Layout ?
+Size maMaxAutoPaperSize; // Layout ?
 tools::Long mnMinColumnWrapHeight = 0; // Corresponds to graphic object 
height
-EditDoc aEditDoc;   // Document content
+EditDoc maEditDoc; // Document content
 
 // Engine Specific data ...
 EditEngine* pEditEngine;
@@ -540,11 +536,11 @@ private:
 double mfSpacingScaleY;
 bool mbRoundToNearestPt;
 
-CharCompressTypenAsianCompressionMode;
+CharCompressType 

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

2023-10-09 Thread Caolán McNamara (via logerrit)
 editeng/source/accessibility/AccessibleStaticTextBase.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5c5c0633b4477d03569bbefc7c9f61e499055d41
Author: Caolán McNamara 
AuthorDate: Mon Oct 9 08:39:48 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 9 12:33:24 2023 +0200

cid#1547102 Uninitialized pointer field

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

diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx 
b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 85082bc4cb21..f7fd934dfc90 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -176,8 +176,9 @@ namespace accessibility
 // AccessibleStaticTextBase_Impl implementation
 
 
-AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl() :
-mxTextParagraph( new AccessibleEditableTextPara(nullptr) )
+AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl()
+: mpThis(nullptr)
+, mxTextParagraph(new AccessibleEditableTextPara(nullptr))
 {
 
 // TODO: this is still somewhat of a hack, all the more since


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

2023-10-08 Thread Caolán McNamara (via logerrit)
 editeng/source/items/textitem.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 52f50ffd67de9d2e2253226b2d7f590fe45c7313
Author: Caolán McNamara 
AuthorDate: Sun Oct 8 15:27:42 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 8 19:09:35 2023 +0200

ofz#62236 avoid Timeout

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 77f95f6de9ee..e4c1cdbe14cc 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -808,8 +809,15 @@ bool SvxFontHeightItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 return false;
 fPoint = static_cast(nValue);
 }
-if(fPoint < 0. || fPoint > 1.)
-return false;
+
+if (fPoint < 0. || fPoint > 1.)
+return false;
+static bool bFuzzing = utl::ConfigManager::IsFuzzing();
+if (bFuzzing && fPoint > 500)
+{
+SAL_WARN("editeng.items", "SvxFontHeightItem ignoring font 
size of " << fPoint << " for performance");
+return false;
+}
 
 nHeight = static_cast( fPoint * 20.0 + 0.5 );
// Twips
 if (!bConvert)


[Libreoffice-commits] core.git: editeng/source sc/CppunitTest_sc_a11y.mk sc/qa sc/source

2023-10-07 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleStaticTextBase.cxx |   15 +--
 sc/CppunitTest_sc_a11y.mk |1 
 sc/qa/extras/accessibility/basics.cxx |   18 
 sc/source/ui/Accessibility/AccessibleContextBase.cxx  |   56 +-
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx  |   10 --
 sc/source/ui/inc/AccessibleContextBase.hxx|   18 +---
 sc/source/ui/inc/AccessibleSpreadsheet.hxx|3 
 7 files changed, 71 insertions(+), 50 deletions(-)

New commits:
commit 8e886993f32b7db11a99bdecf06451e6de6c3842
Author: Noel Grandin 
AuthorDate: Sat Oct 7 11:42:40 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 7 16:14:54 2023 +0200

tdf#157568 After deleting the content of a cell by pressing the delete..

.. key, Orca still speaks the content.

this reverts
commit f22cb3dfab413a2917cd810b8e1b8f644a016327
Author: Noel Grandin 
Date:   Mon Jun 12 20:02:19 2023 +0200
tdf#155376 weakly cache ScAccessibleCell

which was a nice idea, but means that we would need to have
some way of updating the ScAccessibleCell when the associated
cell data changes. Which is likely to be complicated.

So return to creating new ScAccessibleCell objects all the time,
but fix them to not leak.

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

diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx 
b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 954117189798..85082bc4cb21 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -121,8 +121,7 @@ namespace accessibility
 
 void SetEventSource( const uno::Reference< XAccessible >& rInterface )
 {
-
-mxThis = rInterface;
+mpThis = rInterface.get();
 }
 
 void SetOffset( const Point& );
@@ -163,8 +162,8 @@ namespace accessibility
 
 // our frontend class (the one implementing the actual
 // interface). That's not necessarily the one containing the impl
-// pointer
-uno::Reference< XAccessible > mxThis;
+// pointer. Note that this is not an uno::Reference to prevent 
ref-counting cycles and leaks.
+XAccessible* mpThis;
 
 // implements our functionality, we're just an adapter (guarded by 
solar mutex)
 mutable rtl::Reference mxTextParagraph;
@@ -207,7 +206,7 @@ namespace accessibility
 mxTextParagraph->Dispose();
 
 // drop references
-mxThis = nullptr;
+mpThis = nullptr;
 mxTextParagraph.clear();
 }
 
@@ -215,7 +214,7 @@ namespace accessibility
 {
 
 if( !mxTextParagraph.is() )
-throw lang::DisposedException ("object has been already disposed", 
mxThis );
+throw lang::DisposedException ("object has been already disposed", 
mpThis );
 
 // TODO: Have a different method on AccessibleEditableTextPara
 // that does not care about state changes
@@ -273,7 +272,7 @@ namespace accessibility
 
 if( nFlatIndex < 0 )
 throw 
lang::IndexOutOfBoundsException("AccessibleStaticTextBase_Impl::Index2Internal: 
character index out of bounds",
-  mxThis);
+  mpThis);
 // gratuitously accepting larger indices here, 
AccessibleEditableTextPara will throw eventually
 
 sal_Int32 nCurrPara, nCurrIndex, nParas, nCurrCount;
@@ -305,7 +304,7 @@ namespace accessibility
 
 // not found? Out of bounds
 throw 
lang::IndexOutOfBoundsException("AccessibleStaticTextBase_Impl::Index2Internal: 
character index out of bounds",
-  mxThis);
+  mpThis);
 }
 
 bool AccessibleStaticTextBase_Impl::SetSelection( sal_Int32 nStartPara, 
sal_Int32 nStartIndex,
diff --git a/sc/CppunitTest_sc_a11y.mk b/sc/CppunitTest_sc_a11y.mk
index e013beb987cc..3418f2fd4c44 100644
--- a/sc/CppunitTest_sc_a11y.mk
+++ b/sc/CppunitTest_sc_a11y.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_a11y, \
 $(eval $(call gb_CppunitTest_use_libraries,sc_a11y, \
sal \
cppu \
+   cppuhelper \
subsequenttest \
test \
tl \
diff --git a/sc/qa/extras/accessibility/basics.cxx 
b/sc/qa/extras/accessibility/basics.cxx
index 8e04c87dacda..06cce36ded49 100644
--- a/sc/qa/extras/accessibility/basics.cxx
+++ b/sc/qa/extras/accessibility/basics.cxx
@@ -108,5 +108,23 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, 
Test64BitChildIndices)
 CPPUNIT_ASSERT_EQUAL(nCol, xTable->getAccessibleColumn(nChildIndex));
 }
 

[Libreoffice-commits] core.git: editeng/source embeddedobj/source extensions/source

2023-09-13 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unofield.cxx|1 +
 editeng/source/uno/unotext2.cxx|3 +++
 embeddedobj/source/msole/olemisc.cxx   |9 +
 extensions/source/bibliography/framectr.cxx|3 +++
 extensions/source/propctrlr/genericpropertyhandler.cxx |   17 -
 extensions/source/propctrlr/propcontroller.cxx |3 +++
 extensions/source/propctrlr/propertyhandler.cxx|   17 -
 extensions/source/propctrlr/sqlcommanddesign.cxx   |2 ++
 8 files changed, 53 insertions(+), 2 deletions(-)

New commits:
commit fa0e4fa0154b15fa1c04495562d08b4490ec984b
Author: Noel Grandin 
AuthorDate: Tue Sep 12 14:59:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 13 09:45:44 2023 +0200

loplugin:unodispose in editeng..extensions

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

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index c9b1adc90fe4..6f2e84a9577d 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -650,6 +650,7 @@ uno::Reference< text::XTextRange > SAL_CALL 
SvxUnoTextField::getAnchor()
 void SAL_CALL SvxUnoTextField::dispose()
 {
 OComponentHelper::dispose();
+mxAnchor.clear();
 }
 
 void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 79706cad2d2e..54714027b388 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -239,7 +239,10 @@ void SAL_CALL SvxUnoTextContent::dispose()
 }
 
 if( mxParentText.is() )
+{
 mxParentText->removeTextContent( this );
+mxParentText.clear();
+}
 }
 
 void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
diff --git a/embeddedobj/source/msole/olemisc.cxx 
b/embeddedobj/source/msole/olemisc.cxx
index 6d371d428fd6..4f50aedeba5f 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -289,6 +289,15 @@ void OleEmbeddedObject::Dispose()
 }
 
 m_xParentStorage.clear();
+m_xClientSite.clear();
+m_xClosePreventer.clear();
+m_xNewCachedVisRepl.clear();
+m_xNewParentStorage.clear();
+m_xNewObjectStream.clear();
+m_xCachedVisualRepresentation.clear();
+m_xWrappedObject.clear();
+m_xParent.clear();
+m_pOleComponent.clear();
 
 m_bDisposed = true;
 }
diff --git a/extensions/source/bibliography/framectr.cxx 
b/extensions/source/bibliography/framectr.cxx
index 9159e001eae0..758c8b3484c2 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -228,12 +228,15 @@ void BibFrameController_Impl::dispose()
 
 if (xFrame.is())
 xFrame->removeFrameActionListener( m_xImpl );
+m_xFrame.clear();
 
 aObject.Source = static_cast(this);
 m_xImpl->aLC.disposeAndClear(aObject);
 m_xDatMan.clear();
 m_aStatusListeners.clear();
 m_xLastQueriedFocusWin.clear();
+m_xWindow.clear();
+m_xImpl.clear();
 }
 
 void BibFrameController_Impl::addEventListener( const uno::Reference< 
lang::XEventListener > & aListener )
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx 
b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 54bfb31de359..cf359bc152d8 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -605,7 +605,22 @@ namespace pcr
 // at this handler instance
 }
 
-IMPLEMENT_FORWARD_XCOMPONENT( GenericPropertyHandler, 
GenericPropertyHandler_Base );
+void SAL_CALL GenericPropertyHandler::dispose(  )
+{
+GenericPropertyHandler_Base::WeakComponentImplHelperBase::dispose();
+m_xComponentIntrospectionAccess.clear();
+m_xComponent.clear();
+m_xTypeConverter.clear();
+m_xPropertyState.clear();
+}
+void SAL_CALL GenericPropertyHandler::addEventListener( const 
css::uno::Reference< css::lang::XEventListener >& Listener )
+{
+
GenericPropertyHandler_Base::WeakComponentImplHelperBase::addEventListener( 
Listener );
+}
+void SAL_CALL GenericPropertyHandler::removeEventListener( const 
css::uno::Reference< css::lang::XEventListener >& Listener )
+{
+
GenericPropertyHandler_Base::WeakComponentImplHelperBase::removeEventListener( 
Listener );
+}
 
 }   // namespace pcr
 
diff --git a/extensions/source/propctrlr/propcontroller.cxx 
b/extensions/source/propctrlr/propcontroller.cxx
index 01a0395594f5..836f5844e38d 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -490,6 +490,9 @@ 

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

2023-09-07 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unonrule.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e59516e8b31f0a1880de153229f5b193a447fb60
Author: Noel Grandin 
AuthorDate: Thu Sep 7 12:11:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 7 15:54:20 2023 +0200

SvxUnoNumberingRulesCompare does not need to implement XAggreggation

Checked on jenkins using 'make check' and

+void SAL_CALL setDelegator(css::uno::Reference 
const &) final { assert(false); }
+

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

diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 055fce8d5d4a..95c0a04daf0f 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -485,7 +485,7 @@ css::uno::Reference< css::container::XIndexReplace > 
SvxCreateNumRule(const SvxN
 
 namespace {
 
-class SvxUnoNumberingRulesCompare : public ::cppu::WeakAggImplHelper1< 
XAnyCompare >
+class SvxUnoNumberingRulesCompare : public ::cppu::WeakImplHelper< XAnyCompare 
>
 {
 public:
 virtual sal_Int16 SAL_CALL compare( const Any& Any1, const Any& Any2 ) 
override;


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

2023-08-26 Thread Xisco Fauli (via logerrit)
 editeng/source/editeng/impedit5.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 8bb505d3e16deed2c7bb5636cfd765013ec23965
Author: Xisco Fauli 
AuthorDate: Fri Aug 25 14:22:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Aug 26 08:19:03 2023 +0200

editeng: fix crash in EditDoc::FindAttribs

check pNode before calling EditDoc::FindAttribs.
This is the only place where EditDoc::FindAttribs is called from

See 
https://crashreport.libreoffice.org/stats/signature/EditDoc::FindAttribs(ContentNode%20*,long,long,SfxItemSet%20&)

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

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index afb1b424d907..1282111afc08 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -321,7 +321,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, 
EditEngineAttribs nOnl
 for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ )
 {
 ContentNode* pNode = aEditDoc.GetObject( nNode );
-DBG_ASSERT( aEditDoc.GetObject( nNode ), "Node not found: GetAttrib" );
+assert( pNode && "Node not found: GetAttrib" );
 
 const sal_Int32 nStartPos = nNode==nStartNode ? aSel.Min().GetIndex() 
: 0;
 const sal_Int32 nEndPos = nNode==nEndNode ? aSel.Max().GetIndex() : 
pNode->Len(); // Can also be == nStart!
@@ -332,7 +332,8 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, 
EditEngineAttribs nOnl
 // 2) Examine Style and paragraph attributes only when OFF...
 
 // First the very hard formatting...
-EditDoc::FindAttribs( pNode, nStartPos, nEndPos, aCurSet );
+if (pNode)
+EditDoc::FindAttribs( pNode, nStartPos, nEndPos, aCurSet );
 
 if( nOnlyHardAttrib != EditEngineAttribs::OnlyHard )
 {


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

2023-08-21 Thread Caolán McNamara (via logerrit)
 editeng/source/items/svxfont.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 19281c62b5e315da422318dbc9d4ba619a6eeab5
Author: Caolán McNamara 
AuthorDate: Mon Aug 21 13:19:36 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 21 16:14:29 2023 +0200

character preview is drawing two overlines for Small Caps

we already handle the underline and strikethrough case, so add
the overline case here too

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

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 75359251fe56..544d80c7d4a9 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -825,8 +825,10 @@ void SvxDoDrawCapital::Do( const OUString &_rTxt, const 
sal_Int32 _nIdx,
 
 // Set the desired font
 FontLineStyle eUnder = pFont->GetUnderline();
+FontLineStyle eOver = pFont->GetOverline();
 FontStrikeout eStrike = pFont->GetStrikeout();
 pFont->SetUnderline( LINESTYLE_NONE );
+pFont->SetOverline( LINESTYLE_NONE );
 pFont->SetStrikeout( STRIKEOUT_NONE );
 if ( !bUpper )
 {
@@ -847,6 +849,7 @@ void SvxDoDrawCapital::Do( const OUString &_rTxt, const 
sal_Int32 _nIdx,
 
 // Restore Font
 pFont->SetUnderline( eUnder );
+pFont->SetOverline( eOver );
 pFont->SetStrikeout( eStrike );
 if ( !bUpper )
 pFont->SetPropr( nProp );


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

2023-08-15 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 751104215e6c4b42b68dd255e48d771e319555b4
Author: Noel Grandin 
AuthorDate: Mon Aug 14 14:04:38 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 15 08:09:14 2023 +0200

fix crash in LOK

ImpEditView::lokSelectionCallback(std::optional
const&, bool, bool)
  editeng/source/editeng/impedit.cxx:446
ImpEditView::DrawSelectionXOR(EditSelection, vcl::Region*,
OutputDevice*)
  editeng/source/editeng/impedit.cxx:642
ImpEditEngine::Paint(ImpEditView*, tools::Rectangle const&,
OutputDevice*)
  editeng/source/editeng/impedit3.cxx:4164
ScGridWindow::DrawContent(OutputDevice&, ScTableInfo const&,
ScOutputData&, bool)
  sc/source/ui/view/gridwin4.cxx:1226 (discriminator 1)
ScGridWindow::PaintTile(VirtualDevice&, int, int, int, int, long, long,
short, int)
  sc/source/ui/view/gridwin4.cxx:1700
ScModelObj::paintTile(VirtualDevice&, int, int, int, int, long, long)

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

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 2ccb892ab690..f69b0d1cad82 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -350,7 +350,7 @@ void ImpEditView::lokSelectionCallback(const 
std::optional &
 aItems.emplace_back("endHandleVisible", 
OString::boolean(bEndHandleVisible));
 pNotifier->notifyWindow(pParent->GetLOKWindowId(), "text_selection", 
aItems);
 }
-else
+else if (mpViewShell)
 {
 pOutWin->GetOutDev()->Push(vcl::PushFlags::MAPMODE);
 if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip)


[Libreoffice-commits] core.git: editeng/source include/sal

2023-07-31 Thread Patrick Luby (via logerrit)
 editeng/source/items/svxfont.cxx |9 -
 include/sal/log-areas.dox|1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit ccc31ed4d96bada134d08046f22f64c095a29041
Author: Patrick Luby 
AuthorDate: Sun Jul 30 15:03:56 2023 -0400
Commit: Patrick Luby 
CommitDate: Mon Jul 31 18:11:53 2023 +0200

tdf#156470 add SAL_INFO calls for debugging

In the verious LibreOffice samples attached to tdf#156470, it appears
that LibreOffice spends a lot of time the GetTextArray() calls in
SvxFont::QuickGetTextSize(). So add logging to determine if any of
the GetTextArray() calls are returning unusual sizes.

Change-Id: Ie6f0fcc85396b47342b6a93180d4bc9873420931
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155072
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index ef6197f85778..75359251fe56 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -478,8 +478,13 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, 
const OUString ,
  const sal_Int32 nIdx, const sal_Int32 nLen, 
KernArray* pDXArray ) const
 {
 if ( !IsCaseMap() && !IsFixKerning() )
-return Size( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ),
+{
+SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize before 
GetTextArray(): Case map: " << IsCaseMap() << " Fix kerning: " << 
IsFixKerning());
+Size aTxtSize( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ),
  pOut->GetTextHeight() );
+SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize after 
GetTextArray(): Text length: " << nLen << " Text size: " << aTxtSize.Width() << 
"x" << aTxtSize.Height());
+return aTxtSize;
+}
 
 KernArray aDXArray;
 
@@ -492,11 +497,13 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, 
const OUString ,
 
 Size aTxtSize;
 aTxtSize.setHeight( pOut->GetTextHeight() );
+SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize before 
GetTextArray(): Case map: " << IsCaseMap() << " Fix kerning: " << 
IsFixKerning());
 if ( !IsCaseMap() )
 aTxtSize.setWidth( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ) );
 else
 aTxtSize.setWidth( GetTextArray( pOut, CalcCaseMap( rTxt ),
pDXArray, nIdx, nLen ) );
+SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize after 
GetTextArray(): Text length: " << nLen << " Text size: " << aTxtSize.Width() << 
"x" << aTxtSize.Height());
 
 if( IsFixKerning() && ( nLen > 1 ) )
 {
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index f209b6244f5f..275f33e1d073 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -197,6 +197,7 @@ certain functionality.
 @li @c editeng
 @li @c editeng.chaining
 @li @c editeng.items
+@li @c editeng.quicktextsize
 
 @section embeddedobj
 


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

2023-07-31 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit2.cxx  |3 +--
 sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt |1 +
 sw/qa/core/text/text.cxx |   13 +++--
 sw/source/core/text/porlay.cxx   |2 +-
 4 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 5526c523bc9fda890e15eacd45f280b0827f8ea0
Author: Khaled Hosny 
AuthorDate: Sat Jul 29 01:01:58 2023 +0300
Commit: Michael Stahl 
CommitDate: Mon Jul 31 12:32:17 2023 +0200

Fix surrogate pairs handling when tweaking script info

Followup to:

commit 3af30bafbedb8eb481024efb35cb7876c63d26dc
Author: Khaled Hosny 
Date:   Thu Jul 27 19:03:28 2023 +0300

sw: Handle surrogate pairs when tweaking script info

and:

commit d6efe8c302b81886706e18640148c51cf7883bbf
Author: Khaled Hosny 
Date:   Thu Jul 27 20:39:22 2023 +0300

tdf#112594: Group NNBSP with the Mongolian characters after it

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

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index d67c49b072b8..8d4960069cc8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1742,8 +1742,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
 (nPrevChar == 0x202F /* NNBSP, tdf#112594 */ &&
  u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == 
USCRIPT_MONGOLIAN))
 {
---nPos;
-rTypes.back().nEndPos--;
+rTypes.back().nEndPos = nPos = nPrevPos;
 break;
 }
 }
diff --git a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt 
b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
index c14997a80741..5b54fc9e8601 100644
--- a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
+++ b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt
@@ -287,6 +287,7 @@
 

11◌໽
+   11퐀َ
   
  
 
\ No newline at end of file
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 9d9e99f8d99b..123be460df8c 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1475,9 +1475,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testScriptinfosurrogatePairs)
 // Without the fix it fails with:
 // - Expected: 11
 // - Actual  : 11◌
-assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[1]", 
"portion", u"11");
-assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[2]", 
"portion",
+assertXPath(pXmlDoc, 
"//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11");
+assertXPath(pXmlDoc, 
"//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion",
 u"\u25CC\U00010EFD");
+
+// Without the fix this would crash because we got a lone surrogate that
+// can’t be converted to UTF-8, but if it were not for that it might fail
+// with something like:
+// - Expected: 11
+// - Actual  : 11퐀
+assertXPath(pXmlDoc, 
"//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11");
+assertXPath(pXmlDoc, 
"//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion",
+u"\U0001D400\u064E");
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594)
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 7d406a86df0c..567026d5b77a 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1457,7 +1457,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode,
 (nPrevChar == CHAR_NNBSP &&
  u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == 
USCRIPT_MONGOLIAN))
 {
---nPos;
+nPos = nPrevPos;
 }
 }
 m_ScriptChanges.emplace_back(TextFrameIndex(nPos), nScript);


[Libreoffice-commits] core.git: editeng/source officecfg/registry sw/qa

2023-07-28 Thread Baole Fang (via logerrit)
 editeng/source/misc/swafopt.cxx|2 
 officecfg/registry/schema/org/openoffice/Office/Writer.xcs |2 
 sw/qa/uitest/data/tdf156165.odt|binary
 sw/qa/uitest/writer_tests/tdf156165.py |   80 +
 4 files changed, 82 insertions(+), 2 deletions(-)

New commits:
commit e26aeb882dd236adf19679d5df9b7ba5da1ed226
Author: Baole Fang 
AuthorDate: Thu Jul 6 12:03:31 2023 -0400
Commit: Mike Kaganski 
CommitDate: Sat Jul 29 03:53:28 2023 +0200

tdf#156165: Fix replace custom styles while typing

Originally, Replace Custom Styles changes styles to text body by entering 
BuiltText. Since styles change to text body is removed from BuiltTest, it is 
converted independently.

Now, conversion is applied even during typing because m_aFlags.bChgUserColl 
is true (its default value) during typing. Therefore, its default value is 
changed to false.

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

diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx
index f6de4098d2e4..f5f79a45be97 100644
--- a/editeng/source/misc/swafopt.cxx
+++ b/editeng/source/misc/swafopt.cxx
@@ -27,7 +27,6 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags()
 bAutoCorrect =
 bCapitalStartSentence =
 bCapitalStartWord =
-bChgUserColl =
 bChgEnumNum =
 bAddNonBrkSpace =
 bChgOrdinalNumber =
@@ -42,6 +41,7 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags()
 bAFormatByInpDelSpacesAtSttEnd =
 bAFormatByInpDelSpacesBetweenLines = true;
 
+bChgUserColl =
 bReplaceStyles =
 bDelEmptyNode =
 bWithRedlining =
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 5ac39808f1d0..ad2f1497a561 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -4235,7 +4235,7 @@
   Specifies whether user-defined styles applied in the 
document are replaced by predefined text document styles.
   Replace user-defined styles
 
-true
+false
   
   
 
diff --git a/sw/qa/uitest/data/tdf156165.odt b/sw/qa/uitest/data/tdf156165.odt
new file mode 100644
index ..aabcfef91499
Binary files /dev/null and b/sw/qa/uitest/data/tdf156165.odt differ
diff --git a/sw/qa/uitest/writer_tests/tdf156165.py 
b/sw/qa/uitest/writer_tests/tdf156165.py
new file mode 100644
index ..69d1928bb8ce
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf156165.py
@@ -0,0 +1,80 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from time import sleep
+
+class tdf156165(UITestCase):
+
+   def test_tdf156165(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf156165.odt")):
+xMainWindow = self.xUITest.getTopFocusWindow()
+writer_edit = xMainWindow.getChild("writer_edit")
+style=xMainWindow.getChild('applystyle')
+
+with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "2")
+options=xDialog.getChild('list')
+checkbox=options.getChild("16")
+self.assertEqual("Replace Custom Styles", 
get_state_as_dict(checkbox)["Text"])
+
+# Replace Custom Styles is default to be false
+self.assertEqual("false", 
get_state_as_dict(checkbox)["IsChecked"])
+
+# Replace Custom Styles when applying manully with it disabled, 
should not change style
+writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"0", "START_POS": "12"}))
+self.xUITest.executeCommand(".uno:AutoFormatApply")
+sleep(1)
+self.assertEqual(get_state_as_dict(style)["Text"], "eSelah")
+
+# Replace Custom Styles when typing with it disabled, should not 
change style
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"12", "START_POS": "12"}))
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+  

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

2023-07-27 Thread Mike Kaganski (via logerrit)
 editeng/source/misc/acorrcfg.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 89ccdd1b7be48461a33200c43b2fd340e646df8b
Author: Mike Kaganski 
AuthorDate: Thu Jul 27 15:00:52 2023 +0200
Commit: Mike Kaganski 
CommitDate: Thu Jul 27 15:48:34 2023 +0200

tdf#156482: fix order in SvxBaseAutoCorrCfg::ImplCommit

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

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 74d97d5a41f9..d07dbf0caa30 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -338,7 +338,6 @@ void SvxBaseAutoCorrCfg::ImplCommit()
  css::uno::Any(bool(nFlags & ACFlags::ChgWeightUnderl)),
 // "ChangeUnderlineWeight"
  css::uno::Any(bool(nFlags & ACFlags::SetINetAttr)), // 
"SetInetAttribute"
- css::uno::Any(bool(nFlags & ACFlags::SetDOIAttr)), // "SetDOIAttr"
  css::uno::Any(bool(nFlags & ACFlags::ChgOrdinalNumber)),
 // "ChangeOrdinalNumber"
  css::uno::Any(bool(nFlags & ACFlags::AddNonBrkSpace)), // 
"AddNonBreakingSpace"
@@ -359,9 +358,10 @@ void SvxBaseAutoCorrCfg::ImplCommit()
 // "CorrectAccidentalCapsLock"
  css::uno::Any(bool(nFlags & ACFlags::TransliterateRTL)),
 // "TransliterateRTL"
-css::uno::Any(bool(nFlags & ACFlags::ChgAngleQuotes))});
+ css::uno::Any(bool(nFlags & ACFlags::ChgAngleQuotes)),
 // "ChangeAngleQuotes"
-
+ css::uno::Any(bool(nFlags & ACFlags::SetDOIAttr)), // 
"SetDOIAttribute"
+});
 }
 
 void SvxBaseAutoCorrCfg::Notify( const Sequence& /* aPropertyNames 
*/)


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

2023-07-23 Thread Khaled Hosny (via logerrit)
 editeng/source/items/svxfont.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4e8b4a34c49d700cfebd3baeb0f2430e879cc236
Author: Khaled Hosny 
AuthorDate: Sun Jul 23 09:14:49 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 23 14:06:21 2023 +0200

editeng: Don’t unintentionally set KernArray.mnSubUnitFactor

The first (and only) argument to KernArray constructor is nSubUnitFactor
not array length as the code here seems to imply.

Change-Id: Ie89c41d07f1aa13be595ead604df82ad775df433
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154799
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index b57449f3c359..ef6197f85778 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -441,7 +441,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, 
const OUString ,
 if( IsFixKerning() && ( nLen > 1 ) )
 {
 auto nKern = GetFixKerning();
-KernArray aDXArray(nLen);
+KernArray aDXArray;
 GetTextArray(pOut, rTxt, , nIdx, nLen);
 tools::Long nOldValue = aDXArray[0];
 sal_Int32 nSpaceCount = 0;


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

2023-07-16 Thread Dr. David Alan Gilbert (via logerrit)
 editeng/source/editeng/impedit3.cxx |   32 ++--
 1 file changed, 6 insertions(+), 26 deletions(-)

New commits:
commit ab42fe0c09a4f5fefe9ba46b3be11dff4deff472
Author: Dr. David Alan Gilbert 
AuthorDate: Thu Jul 13 15:25:29 2023 +0100
Commit: Noel Grandin 
CommitDate: Sun Jul 16 12:55:52 2023 +0200

editeng: Use RotateAround rather than another copy

Replace lcl_ImplCalcRotatedPos by Tools::Point's RotateAround.

Signed-off-by: Dr. David Alan Gilbert 
Change-Id: Id1d8baebafb019f1bc574acc71078150442f20dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154394
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index dff400a5517d..0052fb5e720d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -226,22 +226,6 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev,
 }
 }
 
-static Point lcl_ImplCalcRotatedPos( Point rPos, Point rOrigin, double nSin, 
double nCos )
-{
-Point aRotatedPos;
-// Translation...
-Point aTranslatedPos( rPos);
-aTranslatedPos -= rOrigin;
-
-aRotatedPos.setX( static_cast( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
-aRotatedPos.setY( static_cast(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
-aTranslatedPos = aRotatedPos;
-// Translation...
-aTranslatedPos += rOrigin;
-
-return aTranslatedPos;
-}
-
 // For Kashidas from sw/source/core/text/porlay.cxx
 
 #define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), 
UCHAR_JOINING_GROUP ) == U_JG_##g )
@@ -3327,13 +3311,6 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 // un-scrolled.
 // The rectangle is infinite.
 const Point aOrigin( aStartPos );
-double nCos = 0.0, nSin = 0.0;
-if ( nOrientation )
-{
-double nRealOrientation = toRadians(nOrientation);
-nCos = cos( nRealOrientation );
-nSin = sin( nRealOrientation );
-}
 
 // #110496# Added some more optional metafile comments. This
 // change: factored out some duplicated code.
@@ -3797,7 +3774,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 aTmpFont.SetEscapement( 0 );
 }
 
-aOutPos = lcl_ImplCalcRotatedPos( 
aOutPos, aOrigin, nSin, nCos );
+aOrigin.RotateAround(aOutPos, 
nOrientation);
 aTmpFont.SetOrientation( 
aTmpFont.GetOrientation()+nOrientation );
 aTmpFont.SetPhysFont(rOutDev);
 
@@ -3845,7 +3822,10 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 
comphelper::string::padToLength( aBlanks, nTextLen, ' ' );
 Point aUnderlinePos( aOutPos );
 if ( nOrientation )
-aUnderlinePos = 
lcl_ImplCalcRotatedPos( aTmpPos, aOrigin, nSin, nCos );
+{
+aUnderlinePos = aTmpPos;
+
aOrigin.RotateAround(aUnderlinePos, nOrientation);
+}
 rOutDev.DrawStretchText( 
aUnderlinePos, aSz.Width(), aBlanks.makeStringAndClear(), 0, nTextLen );
 
 aTmpFont.SetUnderline( 
LINESTYLE_NONE );
@@ -3879,7 +3859,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 Point aTopLeft( aTmpPos );
 aTopLeft.AdjustY( 
-(pLine->GetMaxAscent()) );
 if ( nOrientation )
-aTopLeft = 
lcl_ImplCalcRotatedPos( aTopLeft, aOrigin, nSin, nCos );
+aOrigin.RotateAround(aTopLeft, 
nOrientation);
 tools::Rectangle aRect( aTopLeft, 
rTextPortion.GetSize() );
 rOutDev.DrawRect( aRect );
 }


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

2023-07-16 Thread Dr. David Alan Gilbert (via logerrit)
 editeng/source/outliner/outliner.cxx |   14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

New commits:
commit 80b4e90e055825e3fef6fa11796bf4f40627c478
Author: Dr. David Alan Gilbert 
AuthorDate: Thu Jul 13 14:52:07 2023 +0100
Commit: Noel Grandin 
CommitDate: Sun Jul 16 12:55:19 2023 +0200

editeng/Outliner: Use RotateAround rather than open coding

In PaintBullet, use Tools::Point's RotateAround instead of open coding.

Signed-off-by: Dr. David Alan Gilbert 
Change-Id: I4f5a50a70d8fcadd2e5af60e365de80f2e9a271e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154393
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 04f55eb7dbdb..5af4573bf659 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -945,18 +945,8 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& 
rStartPos, const Point&
 {
 // Both TopLeft and bottom left is not quite correct,
 // since in EditEngine baseline ...
-double nRealOrientation = toRadians(nOrientation);
-double nCos = cos( nRealOrientation );
-double nSin = sin( nRealOrientation );
-Point aRotatedPos;
-// Translation...
-aTextPos -= rOrigin;
-// Rotation...
-aRotatedPos.setX(static_cast(nCos*aTextPos.X() + 
nSin*aTextPos.Y()) );
-aRotatedPos.setY(static_cast(- (nSin*aTextPos.X() 
- nCos*aTextPos.Y())) );
-aTextPos = aRotatedPos;
-// Translation...
-aTextPos += rOrigin;
+rOrigin.RotateAround(aTextPos, nOrientation);
+
 vcl::Font aRotatedFont( aBulletFont );
 aRotatedFont.SetOrientation( nOrientation );
 rOutDev.SetFont( aRotatedFont );


[Libreoffice-commits] core.git: editeng/source include/tools slideshow/Library_OGLTrans.mk vcl/CppunitTest_vcl_animation.mk

2023-07-16 Thread Dr. David Alan Gilbert (via logerrit)
 editeng/source/editeng/editeng.cxx  |2 +-
 editeng/source/editeng/impedit.hxx  |1 -
 editeng/source/editeng/impedit3.cxx |   26 ++
 include/tools/gen.hxx   |3 ++-
 slideshow/Library_OGLTrans.mk   |1 +
 vcl/CppunitTest_vcl_animation.mk|1 +
 6 files changed, 7 insertions(+), 27 deletions(-)

New commits:
commit 38372f103aa5035ec32570972e55656e07647791
Author: Dr. David Alan Gilbert 
AuthorDate: Thu Jul 13 14:32:44 2023 +0100
Commit: Noel Grandin 
CommitDate: Sun Jul 16 12:54:58 2023 +0200

editeng: Use Tools::Point::RotateAround instead of our own

Remove our own Rotate function by calls to Tools::Point's
RotateAround method.
Add a comment on RotateAround to emphasise that the point rotated
is the parameter and the This object is used as the origin.

Using TOOLS_DLLPUBLIC to fix link error (as suggested by Arnaud)
Added tl to slideshow (from Neil)

Signed-off-by: Dr. David Alan Gilbert 
Change-Id: I296bbdf910d262401bfa18f0fc4f431b9e79b8f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154392
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 19ed11229645..9e6696cd5546 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -217,7 +217,7 @@ void EditEngine::Draw( OutputDevice& rOutDev, const Point& 
rStartPos, Degree10 n
 if ( IsEffectivelyVertical() )
 {
 aStartPos.AdjustX(GetPaperSize().Width() );
-aStartPos = Rotate( aStartPos, nOrientation, rStartPos );
+rStartPos.RotateAround(aStartPos, nOrientation);
 }
 pImpEditEngine->Paint(rOutDev, aBigRect, aStartPos, false, nOrientation);
 if( rOutDev.GetConnectMetaFile() )
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b59d934beadf..815c42328ba8 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1360,7 +1360,6 @@ inline vcl::Cursor* ImpEditView::GetCursor()
 void ConvertItem( std::unique_ptr& rPoolItem, MapUnit 
eSourceUnit, MapUnit eDestUnit );
 void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const 
MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr );
 AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar );
-Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin 
);
 
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ba7c2ed04ae3..dff400a5517d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -114,28 +114,6 @@ struct TabInfo
 
 }
 
-Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin 
)
-{
-double nRealOrientation = toRadians(nOrientation);
-double nCos = cos( nRealOrientation );
-double nSin = sin( nRealOrientation );
-
-Point aRotatedPos;
-Point aTranslatedPos( rPoint );
-
-// Translation
-aTranslatedPos -= rOrigin;
-
-// Rotation...
-aRotatedPos.setX( static_cast( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
-aRotatedPos.setY( static_cast(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
-aTranslatedPos = aRotatedPos;
-
-// Translation...
-aTranslatedPos += rOrigin;
-return aTranslatedPos;
-}
-
 AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar )
 {
 switch ( cChar )
@@ -231,8 +209,8 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev,
 
 if (nOrientation)
 {
-aPoint1 = Rotate(aPoint1, nOrientation, rOrigin);
-aPoint2 = Rotate(aPoint2, nOrientation, rOrigin);
+rOrigin.RotateAround(aPoint1, nOrientation);
+rOrigin.RotateAround(aPoint2, nOrientation);
 }
 
 {
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 11d26b0372f2..c6372d7c92dc 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -74,7 +74,7 @@ inline bool equal(Pair const & p1, Pair const & p2)
 // Point
 
 class Size;
-class SAL_WARN_UNUSED UNLESS_MERGELIBS(SAL_DLLPUBLIC_EXPORT) Point final : 
protected Pair
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Point final : protected Pair
 {
 public:
 constexpr Point() {}
@@ -88,6 +88,7 @@ public:
 tools::LongAdjustX( tools::Long nHorzMove ) { mnA += 
nHorzMove; return mnA; }
 tools::LongAdjustY( tools::Long nVertMove ) { mnB += 
nVertMove; return mnB; }
 
+// Rotate parameter point using This as origin; store result back into 
parameter point
 voidRotateAround( tools::Long& rX, tools::Long& rY, 
Degree10 nOrientation ) const;
 voidRotateAround( Point&, Degree10 nOrientation ) const;
 
diff --git a/slideshow/Library_OGLTrans.mk 

[Libreoffice-commits] core.git: editeng/source include/editeng include/xmloff offapi/com schema/libreoffice sw/inc sw/qa sw/source writerfilter/source xmloff/source

2023-07-11 Thread Mike Kaganski (via logerrit)
 editeng/source/items/numitem.cxx|   17 +--
 include/editeng/numitem.hxx |7 ++-
 include/xmloff/xmltoken.hxx |1 
 offapi/com/sun/star/style/NumberingLevel.idl|6 ++
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   15 ++
 sw/inc/unoprnms.hxx |1 
 sw/qa/extras/odfexport/data/IsLegal.fodt|   28 
 sw/qa/extras/odfexport/odfexport2.cxx   |   22 +
 sw/qa/extras/ooxmlexport/data/listWithLgl.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx  |   20 
 sw/source/core/doc/number.cxx   |4 -
 sw/source/core/unocore/unosett.cxx  |8 +++
 sw/source/filter/ww8/attributeoutputbase.hxx|3 -
 sw/source/filter/ww8/docxattributeoutput.cxx|7 ++-
 sw/source/filter/ww8/docxattributeoutput.hxx|3 -
 sw/source/filter/ww8/rtfattributeoutput.cxx |2 
 sw/source/filter/ww8/rtfattributeoutput.hxx |   14 +++---
 sw/source/filter/ww8/wrtw8num.cxx   |5 +-
 sw/source/filter/ww8/ww8attributeoutput.hxx |3 -
 writerfilter/source/dmapper/NumberingManager.cxx|6 ++
 writerfilter/source/dmapper/NumberingManager.hxx|1 
 writerfilter/source/dmapper/PropertyIds.cxx |1 
 writerfilter/source/dmapper/PropertyIds.hxx |1 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/style/xmlnume.cxx |   10 
 xmloff/source/style/xmlnumi.cxx |8 +++
 xmloff/source/token/tokens.txt  |1 
 27 files changed, 173 insertions(+), 22 deletions(-)

New commits:
commit fd64b426bc6175841143714ccc16bad181fd088f
Author: Mike Kaganski 
AuthorDate: Fri Jun 30 18:19:27 2023 +0300
Commit: Miklos Vajna 
CommitDate: Tue Jul 11 14:02:19 2023 +0200

tdf#150408: Implement "Legal" numbering (all levels using Arabic numbers)

Enabling this feature on a list level makes all numbered sublevels, that
constitute the number of this level, to use Arabic numerals. This doesn't
change the labels of other levels: e.g., if level 1 uses A,B,C; level 2
uses i,ii,iii; level 3 uses a,b,c, and is "Legal"; and level 4 uses 1,2,3;
then a list may look like

  A. Something
A.i. Some subitem
A.ii. Another subitem
  1.2.1. This is a "Legal" sub-subitem
A.ii.a.1. And its child

This improves interoperability with Word.

This change introduces document model, ODF and OOXML import and export.
In ODF, a new boolean attribute of 'text:outline-level-style' element,
'loext:is-legal', is introduced; its default value is "false".

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index e8c1c4d9a77c..97f857547029 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -113,7 +113,13 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo ) const
 return GetNumStr( nNo, aLang.getLocale() );
 }
 
-OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& 
rLocale ) const
+static bool isArabicNumberingType(SvxNumType t)
+{
+return t == SVX_NUM_ARABIC || t == SVX_NUM_ARABIC_ZERO || t == 
SVX_NUM_ARABIC_ZERO3
+   || t == SVX_NUM_ARABIC_ZERO4 || t == SVX_NUM_ARABIC_ZERO5;
+}
+
+OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& 
rLocale, bool bIsLegal ) const
 {
 lcl_getFormatter(xFormatter);
 if(!xFormatter.is())
@@ -133,11 +139,12 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const 
css::lang::Locale& rLoca
 return OUString('0');
 else
 {
+SvxNumType nActType = !bIsLegal || 
isArabicNumberingType(nNumType) ? nNumType : SVX_NUM_ARABIC;
 static constexpr OUStringLiteral sNumberingType = 
u"NumberingType";
 static constexpr OUStringLiteral sValue = u"Value";
 Sequence< PropertyValue > aProperties
 {
-comphelper::makePropertyValue(sNumberingType, 
static_cast(nNumType)),
+comphelper::makePropertyValue(sNumberingType, 
static_cast(nActType)),
 comphelper::makePropertyValue(sValue, nNo)
 };
 
@@ -366,6 +373,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( 

[Libreoffice-commits] core.git: editeng/source officecfg/registry

2023-07-04 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/acorrcfg.cxx   |2 +-
 officecfg/registry/schema/org/openoffice/Office/Writer.xcs |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2559baf56eed67dd97183d8852360866b5fe9d4e
Author: Caolán McNamara 
AuthorDate: Tue Jul 4 10:15:53 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 4 17:15:29 2023 +0200

32bit is enough for the word completion limit

and we don't have to change the xcs in that case

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

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 4ff15f1bfc2d..74d97d5a41f9 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -524,7 +524,7 @@ void SvxSwAutoCorrCfg::Load(bool bInit)
 break; // "Completion/MinWordLen",
 case  35:
 {
-sal_Int64 nVal = 0; pValues[nProp] >>= nVal;
+sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
 rSwFlags.nAutoCmpltListLen =
 sal::static_int_cast< sal_uInt32 >(nVal);
 }
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index dd880f51cfa4..0f684bb2eea9 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -4464,7 +4464,7 @@
   
   8
 
-
+
   
   
 Sets the maximum number of words to be recalled.


[Libreoffice-commits] core.git: editeng/source sc/source test/source

2023-06-29 Thread Balazs Varga (via logerrit)
 editeng/source/uno/unotext.cxx   |   38 +++-
 sc/source/core/data/postit.cxx   |   84 +++
 test/source/sheet/xsheetannotationanchor.cxx |2 
 3 files changed, 97 insertions(+), 27 deletions(-)

New commits:
commit da8dead8e9282010893cbd12519e107baf03cd1a
Author: Balazs Varga 
AuthorDate: Tue Jun 20 19:26:50 2023 +0200
Commit: Balazs Varga 
CommitDate: Thu Jun 29 09:29:34 2023 +0200

tdf#73537 - sc: show author and creation date in calc comments

in temporory mode. Show the author and creation/modification
date of the the comment only in temporory mode. In edit mode, or
visible mode, shows only the original text.

Change-Id: I2c5856e4c6a813dbef4ad55de319f922daa57f67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153358
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 
Reviewed-by: Balazs Varga 

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 881cfa32cd89..ee66097f7ec9 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -2117,11 +2117,43 @@ uno::Reference< text::XTextRange > SAL_CALL 
SvxUnoTextBase::finishParagraph(
 }
 
 uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
-const OUString& /*rText*/,
-const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
-const uno::Reference< text::XTextRange>& /*rTextRange*/ )
+const OUString& rText,
+const uno::Sequence< beans::PropertyValue >& rCharAndParaProps,
+const uno::Reference< text::XTextRange>& rTextRange )
 {
+SolarMutexGuard aGuard;
+
 uno::Reference< text::XTextRange > xRet;
+
+if (!rTextRange.is())
+return xRet;
+
+SvxUnoTextRangeBase* pRange = 
comphelper::getFromUnoTunnel(rTextRange);
+if (!pRange)
+return xRet;
+
+SvxEditSource *pEditSource = GetEditSource();
+SvxTextForwarder *pTextForwarder = pEditSource ? 
pEditSource->GetTextForwarder() : nullptr;
+
+if (pTextForwarder)
+{
+pRange->setString(rText);
+
+ESelection aSelection(pRange->GetSelection());
+
+pTextForwarder->RemoveAttribs(aSelection);
+pEditSource->UpdateData();
+
+SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
+SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
+ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, 
aSelection.nStartPara );
+pTextForwarder->QuickSetAttribs( aItemSet, aSelection);
+rtl::Reference pNewRange = new SvxUnoTextRange( *this 
);
+xRet = pNewRange;
+pNewRange->SetSelection(aSelection);
+for( const beans::PropertyValue& rProp : rCharAndParaProps )
+pNewRange->setPropertyValue( rProp.Name, rProp.Value );
+}
 return xRet;
 }
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index dd1a023445e2..106a249e5666 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -57,6 +57,13 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace com::sun::star;
 
@@ -493,8 +500,10 @@ void ScPostIt::SetAuthor( const OUString& rAuthor )
 
 void ScPostIt::AutoStamp()
 {
-maNoteData.maDate = ScGlobal::getLocaleData().getDate( Date( Date::SYSTEM 
) );
-maNoteData.maAuthor = SvtUserOptions().GetID();
+maNoteData.maDate = ScGlobal::getLocaleData().getDate( Date( Date::SYSTEM 
) ) + " " +
+ScGlobal::getLocaleData().getTime(DateTime(DateTime::SYSTEM), false);
+const OUString aAuthor = SvtUserOptions().GetFullName();
+maNoteData.maAuthor = !aAuthor.isEmpty() ? aAuthor : 
ScResId(STR_CHG_UNKNOWN_AUTHOR);
 }
 
 const OutlinerParaObject* ScPostIt::GetOutlinerObject() const
@@ -793,25 +802,55 @@ void ScPostIt::RemoveCaption()
 }
 }
 
+static void lcl_FormatAndInsertAuthorAndDatepara(SdrCaptionObj* pCaption, 
OUStringBuffer& aUserData, bool bUserWithTrackText)
+{
+uno::Reference xShape = pCaption->getUnoShape();
+uno::Reference xText(xShape, uno::UNO_QUERY);
+uno::Reference xBodyTextAppend(xText, uno::UNO_QUERY);
+
+if (xBodyTextAppend.is())
+{
+uno::Sequence< beans::PropertyValue > aArgs;
+if (bUserWithTrackText)
+{
+xBodyTextAppend->insertTextPortion(aUserData.makeStringAndClear(), 
aArgs, xText->getStart());
+}
+else
+{
+xBodyTextAppend->insertTextPortion("\n\n", aArgs, 
xText->getStart());
+aArgs = {
+comphelper::makePropertyValue("CharWeight", 
uno::Any(awt::FontWeight::BOLD)),
+};
+xBodyTextAppend->insertTextPortion(aUserData.makeStringAndClear(), 
aArgs, xText->getStart());
+}
+}
+}
+
 rtl::Reference ScNoteUtil::CreateTempCaption(
 ScDocument& rDoc, const ScAddress& rPos, SdrPage& rDrawPage,
 

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

2023-06-23 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |6 --
 sw/qa/core/text/data/tdf129810.odt  |binary
 sw/qa/core/text/text.cxx|   33 +
 sw/source/core/text/porlay.cxx  |3 +++
 4 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 4a92323b54e7d63a8bc0b8e62fdc6b31760dcd05
Author: Khaled Hosny 
AuthorDate: Fri Jun 23 19:10:49 2023 +0300
Commit: خالد حسني 
CommitDate: Sat Jun 24 01:01:18 2023 +0200

tdf#129810: Compress fullwidth CJK punctuation

When compressions CJK punctuation, compress also full width versions to
match Word behaviour.

Change-Id: Ic35cfcbacca1974b7241d657f078148bac06478e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153530
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7a82359e8851..510ab1624319 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -142,14 +142,16 @@ AsianCompressionFlags GetCharTypeForCompression( 
sal_Unicode cChar )
 {
 case 0x3008: case 0x300A: case 0x300C: case 0x300E:
 case 0x3010: case 0x3014: case 0x3016: case 0x3018:
-case 0x301A: case 0x301D:
+case 0x301A: case 0x301D: case 0xFF09: case 0xFF3D:
+case 0xFF5D:
 {
 return AsianCompressionFlags::PunctuationRight;
 }
 case 0x3001: case 0x3002: case 0x3009: case 0x300B:
 case 0x300D: case 0x300F: case 0x3011: case 0x3015:
 case 0x3017: case 0x3019: case 0x301B: case 0x301E:
-case 0x301F:
+case 0x301F: case 0xFF08: case 0xFF0C: case 0xFF0E:
+case 0xFF1A: case 0xFF1B: case 0xFF3B: case 0xFF5B:
 {
 return AsianCompressionFlags::PunctuationLeft;
 }
diff --git a/sw/qa/core/text/data/tdf129810.odt 
b/sw/qa/core/text/data/tdf129810.odt
new file mode 100644
index ..b5a482b52caf
Binary files /dev/null and b/sw/qa/core/text/data/tdf129810.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 96ffbf4e74a3..0997d64725b8 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -18,6 +18,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1424,6 +1425,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testParaUpperMarginFlyIntersect)
 CPPUNIT_ASSERT_EQUAL(521, nHeight);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
+{
+// Load the document, which embeds a CJK font.
+createSwDoc("tdf129810.odt");
+
+// Render the document to a metafile.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwDocShell* pShell = pTextDoc->GetDocShell();
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+CPPUNIT_ASSERT(xMetaFile);
+
+// Find the fist text array action
+for (size_t nAction = 0; nAction < xMetaFile->GetActionSize(); nAction++)
+{
+auto pAction = xMetaFile->GetAction(nAction);
+if (pAction->GetType() == MetaActionType::TEXTARRAY)
+{
+auto pTextArrayAction = static_cast(pAction);
+auto pDXArray = pTextArrayAction->GetDXArray();
+
+// There should be 13 chars on the first line
+CPPUNIT_ASSERT_GREATER(size_t(13), pDXArray.size());
+
+// Assert we are using the expected width for uncompressed chars
+CPPUNIT_ASSERT_EQUAL(sal_Int32(720), pDXArray[0]);
+// Assert we are using the expected width for compressed chars
+CPPUNIT_ASSERT_EQUAL(sal_Int32(500), pDXArray[6] - pDXArray[5]);
+break;
+}
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 14ac23395dcf..4f15fbcccbf7 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1481,6 +1481,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode,
 case 0x3008: case 0x300A: case 0x300C: case 0x300E:
 case 0x3010: case 0x3014: case 0x3016: case 0x3018:
 case 0x301A: case 0x301D:
+case 0xFF08: case 0xFF3B: case 0xFF5B:
 eState = SPECIAL_LEFT;
 break;
 // Right punctuation found
@@ -1488,9 +1489,11 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& 
rNode,
 case 0x300D: case 0x300F: case 0x3011: case 0x3015:
 case 0x3017: case 0x3019: case 0x301B: case 0x301E:
 case 0x301F:
+case 0xFF09: case 0xFF3D: case 0xFF5D:
 eState = SPECIAL_RIGHT;
 break;
 case 0x3001: case 0x3002:   // Fullstop or comma
+case 0xFF0C: case 0xFF0E: case 0xFF1A: case 0xFF1B:
 eState = SPECIAL_MIDDLE ;
 break;
 

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

2023-06-21 Thread Henry Castro (via logerrit)
 editeng/source/editeng/impedit2.cxx |3 ++-
 editeng/source/editeng/impedit3.cxx |   16 
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit a6535604dea24c1907c24bfe6be22f79f1d85d56
Author: Henry Castro 
AuthorDate: Tue Jan 31 16:10:08 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Jun 21 21:16:04 2023 +0200

editeng: ignore line breaks

Add option to ignore line breaks, and
draw the paragraph as single line.

Signed-off-by: Henry Castro 
Change-Id: I957c3462f6dabe7c1a3322dcbe6753c0c5adc851
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148001
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153400
Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 000c0b39a1f6..a2f88c7a5c5d 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2740,7 +2740,8 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& 
aCurSel, const OUStrin
 sal_Int32 nStart = 0;
 while ( nStart < aText.getLength() )
 {
-sal_Int32 nEnd = aText.indexOf( LINE_SEP, nStart );
+sal_Int32 nEnd = !aStatus.IsSingleLine() ?
+aText.indexOf( LINE_SEP, nStart ) : -1;
 if ( nEnd == -1 )
 nEnd = aText.getLength(); // not dereference!
 
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index a521d59ef1c1..7a82359e8851 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1429,7 +1429,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 else if ( !bEOL && !bContinueLastPortion )
 {
 DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == 
pPortion->GetLen()), "However, another portion?!" );
-tools::Long nRemainingWidth = nMaxLineWidth - nTmpWidth;
+tools::Long nRemainingWidth = !aStatus.IsSingleLine() ?
+nMaxLineWidth - nTmpWidth : 
pLine->GetCharPosArray()[pLine->GetCharPosArray().size() - 1] + 1;
 bool bCanHyphenate = ( aTmpFont.GetCharSet() != 
RTL_TEXTENCODING_SYMBOL );
 if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && 
pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
 {
@@ -2005,9 +2006,16 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
 aUserOptions.allowPunctuationOutsideMargin = 
bAllowPunctuationOutsideMargin;
 aUserOptions.allowHyphenateEnglish = false;
 
-i18n::LineBreakResults aLBR = _xBI->getLineBreak(
-pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, 
aHyphOptions, aUserOptions );
-nBreakPos = aLBR.breakIndex;
+if (!aStatus.IsSingleLine())
+{
+i18n::LineBreakResults aLBR = _xBI->getLineBreak(
+pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, 
aHyphOptions, aUserOptions );
+nBreakPos = aLBR.breakIndex;
+}
+else
+{
+nBreakPos = nMaxBreakPos;
+}
 
 // BUG in I18N - under special condition (break behind field, 
#87327#) breakIndex is < nMinBreakPos
 if ( nBreakPos < nMinBreakPos )


[Libreoffice-commits] core.git: editeng/source include/editeng

2023-06-21 Thread Henry Castro (via logerrit)
 editeng/source/editeng/editeng.cxx |   11 +++
 include/editeng/editeng.hxx|2 ++
 2 files changed, 13 insertions(+)

New commits:
commit ba38ef8f7733a8fcfdc9228c5cf746c3130976c7
Author: Henry Castro 
AuthorDate: Tue Feb 28 09:42:16 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Jun 21 17:18:40 2023 +0200

editeng: add setter function SingleLine

Signed-off-by: Henry Castro 
Change-Id: I66cad37e1d3728369f0a08195bf85e6c0d50f0ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148000
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153399
Tested-by: Jenkins

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 12e52b27331a..c766328fd667 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1872,6 +1872,17 @@ bool EditEngine::IsFlatMode() const
 return !( pImpEditEngine->aStatus.UseCharAttribs() );
 }
 
+void EditEngine::SetSingleLine(bool bValue)
+{
+if (bValue == pImpEditEngine->aStatus.IsSingleLine())
+return;
+
+if (bValue)
+pImpEditEngine->aStatus.TurnOnFlags(EEControlBits::SINGLELINE);
+else
+pImpEditEngine->aStatus.TurnOffFlags(EEControlBits::SINGLELINE);
+}
+
 void EditEngine::SetControlWord( EEControlBits nWord )
 {
 
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index b31b77160ad5..85accc9d36e3 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -404,6 +404,8 @@ public:
 boolIsFlatMode() const;
 voidSetFlatMode( bool bFlat );
 
+voidSetSingleLine( bool bValue );
+
 voidSetControlWord( EEControlBits nWord );
 EEControlBits   GetControlWord() const;
 


[Libreoffice-commits] core.git: editeng/source include/editeng

2023-06-21 Thread Henry Castro (via logerrit)
 editeng/source/editeng/editstt2.hxx |3 +++
 include/editeng/editstat.hxx|3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 7c5b6a07b4b7d85c011730c74749fd767c19c957
Author: Henry Castro 
AuthorDate: Tue Jan 31 16:01:08 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Jun 21 16:25:33 2023 +0200

editeng: add flag EEControlBits::SINGLELINE

The purpose of this flag is to draw a paragraph
into a single line ignoring line breaks

Signed-off-by: Henry Castro 
Change-Id: I0a01e6d4db51d43707f7cdd0ab9d9cf3288e2221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147999
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153391
Tested-by: Jenkins

diff --git a/editeng/source/editeng/editstt2.hxx 
b/editeng/source/editeng/editstt2.hxx
index 4474df8b429b..334622b23495 100644
--- a/editeng/source/editeng/editstt2.hxx
+++ b/editeng/source/editeng/editstt2.hxx
@@ -91,6 +91,9 @@ public:
 
 boolULSpaceSummation() const
 { return bool( nControlBits & EEControlBits::ULSPACESUMMATION 
); }
+
+boolIsSingleLine() const
+{ return bool( nControlBits & EEControlBits::SINGLELINE ); }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
index eec50ea67c20..29653d5eec4f 100644
--- a/include/editeng/editstat.hxx
+++ b/include/editeng/editstat.hxx
@@ -50,10 +50,11 @@ enum class EEControlBits
 AUTOPAGESIZE   = (AUTOPAGESIZEX | AUTOPAGESIZEY),
 FORMAT100  = 0x0100,  // Always format to 100%
 ULSPACESUMMATION   = 0x0200,  // MS Compat: sum SA and SB, not maximum 
value
+SINGLELINE = 0x0400,  // One line for all text
 };
 namespace o3tl
 {
-template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 
 enum class EVControlBits


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

2023-06-20 Thread Henry Castro (via logerrit)
 editeng/source/editeng/impedit.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a4677551e8c3a7774f039a8344616e5e5b6e402f
Author: Henry Castro 
AuthorDate: Mon May 8 09:17:10 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Jun 20 21:39:32 2023 +0200

editeng: fix assertion uninitialized enum

constexpr typename o3tl::typed_flags::Wrap operator&(E, E) [with E = 
LOKSpecialFlags; typename o3tl::typed_flags::Wrap = 
o3tl::is_typed_flags::Wrap]: Assertion 
`o3tl::detail::isNonNegative( o3tl::to_underlying(lhs))' failed.

Signed-off-by: Henry Castro 
Change-Id: I8617c877ad2d705988f4dea0e54442e5002a43be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151533
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit cce4ad3dd4d678e1cc6bf7523f5375e10b100147)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151516
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153362
Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index ae98b778f4da..2ccb892ab690 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -70,7 +70,8 @@ LOKSpecialPositioning::LOKSpecialPositioning(const 
ImpEditView& rImpEditView, Ma
  mrImpEditView(rImpEditView),
  maOutArea(rOutputArea),
  maVisDocStartPos(rVisDocStartPos),
- meUnit(eUnit)
+ meUnit(eUnit),
+ meFlags(LOKSpecialFlags::NONE)
 {
 }
 


[Libreoffice-commits] core.git: editeng/source sc/source

2023-06-20 Thread Henry Castro (via logerrit)
 editeng/source/editeng/impedit.cxx |5 +++--
 sc/source/ui/view/viewdata.cxx |4 
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit c318f7bf20f21ea0e61b7069e4879868265b70c7
Author: Henry Castro 
AuthorDate: Wed Apr 19 09:50:56 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Jun 20 18:50:12 2023 +0200

lok: sc: fix layout RTL

The function "IsRightToLeft" fails in Hebrew language
when Calc has a layout RTL, add additional condition
to check the layout.

Signed-off-by: Henry Castro 
Change-Id: If3972b80770a7aa6073881487e411a34cc6871d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150758
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151973
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153350
Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 98ac03aceab6..ae98b778f4da 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -524,7 +524,8 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 
 bool bStartHandleVisible = false;
 bool bEndHandleVisible = false;
-bool bLOKCalcRTL = mpLOKSpecialPositioning && 
pEditEngine->IsRightToLeft(nStartPara);
+bool bLOKCalcRTL = mpLOKSpecialPositioning &&
+(mpLOKSpecialPositioning->IsLayoutRTL() || 
pEditEngine->IsRightToLeft(nStartPara));
 
 auto DrawHighlight = [&, nStartLine = sal_Int32(0), nEndLine = 
sal_Int32(0)](
  const ImpEditEngine::LineAreaInfo& rInfo) mutable 
{
@@ -1355,7 +1356,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 Point aRefPointLogical = GetOutputArea().TopLeft();
 // Get the relative coordinates w.r.t refpoint in display hmm.
 aCursorRectPureLogical.Move(-aRefPointLogical.X(), 
-aRefPointLogical.Y());
-if (pEditEngine->IsRightToLeft(nPara))
+if (pEditEngine->IsRightToLeft(nPara) || 
mpLOKSpecialPositioning->IsLayoutRTL())
 {
 tools::Long nMirrorW = GetOutputArea().GetWidth();
 tools::Long nLeft = aCursorRectPureLogical.Left(), nRight 
= aCursorRectPureLogical.Right();
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index f9ad7cae805c..db90c7f207a6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1527,6 +1527,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 bool bLOKActive = comphelper::LibreOfficeKit::isActive();
 bool bLOKPrintTwips = bLOKActive && 
comphelper::LibreOfficeKit::isCompatFlagSet(
 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
+bool bLOKLayoutRTL = bLOKActive && bLayoutRTL;
 
 bool bWasThere = false;
 if (pEditView[eWhich])
@@ -1625,6 +1626,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 pEditView[eWhich]->SetLOKSpecialOutputArea(aPTwipsRect);
 }
 
+if (bLOKLayoutRTL)
+pEditView[eWhich]->SetLOKSpecialFlags(LOKSpecialFlags::LayoutRTL);
+
 tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, 
GetLogicMode() );
 pEditView[eWhich]->SetOutputArea( aOutputArea );
 


[Libreoffice-commits] core.git: editeng/source include/editeng

2023-06-20 Thread Henry Castro (via logerrit)
 editeng/source/editeng/editview.cxx |5 +
 editeng/source/editeng/impedit.cxx  |6 ++
 editeng/source/editeng/impedit.hxx  |6 ++
 include/editeng/editview.hxx|   12 
 4 files changed, 29 insertions(+)

New commits:
commit baf500ba9abed7f32439a1be60a1c51cc10f9d67
Author: Henry Castro 
AuthorDate: Thu Apr 27 15:59:43 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Jun 20 14:37:35 2023 +0200

lok: editeng: add LOK special flags

The function "IsRightToLeft" fails in Hebrew language
when Calc has a layout RTL, create a special flag to handle.

Signed-off-by: Henry Castro 
Change-Id: I661f49dc5990f39807c6dba10970dea8c502643c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151145
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151971
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153322
Tested-by: Jenkins

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index f6c90309747c..72e9aec2dc3d 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1727,6 +1727,11 @@ bool EditView::HasLOKSpecialPositioning() const
 return pImpEditView->HasLOKSpecialPositioning();
 }
 
+void EditView::SetLOKSpecialFlags(LOKSpecialFlags eFlags)
+{
+pImpEditView->SetLOKSpecialFlags(eFlags);
+}
+
 void EditView::SuppressLOKMessages(bool bSet)
 {
 pImpEditView->SuppressLOKMessages(bSet);
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 3074ca53d1ad..98ac03aceab6 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -2749,4 +2749,10 @@ bool ImpEditView::HasLOKSpecialPositioning() const
 return bool(mpLOKSpecialPositioning);
 }
 
+void ImpEditView::SetLOKSpecialFlags(LOKSpecialFlags eFlags)
+{
+assert(mpLOKSpecialPositioning);
+mpLOKSpecialPositioning->SetFlags(eFlags);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index a5e2e3c89593..1a8f7fdc48f4 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -233,6 +233,9 @@ public:
 PointGetWindowPos(const Point& rDocPos, MapUnit eDocPosUnit) 
const;
 tools::Rectangle GetWindowPos(const tools::Rectangle& rDocRect, MapUnit 
eDocRectUnit) const;
 
+void SetFlags(LOKSpecialFlags eFlags) { meFlags = eFlags; }
+bool IsLayoutRTL() { return bool(meFlags & LOKSpecialFlags::LayoutRTL); }
+
 Point GetRefPoint() const;
 
 private:
@@ -243,6 +246,7 @@ private:
 tools::Rectangle maOutArea;
 Point maVisDocStartPos;
 MapUnit meUnit;
+LOKSpecialFlags meFlags;
 };
 
 
@@ -466,6 +470,8 @@ public:
 tools::Rectangle GetLOKSpecialVisArea() const;
 bool HasLOKSpecialPositioning() const;
 
+void SetLOKSpecialFlags(LOKSpecialFlags eFlags);
+
 void SuppressLOKMessages(bool bSet) { mbSuppressLOKMessages = bSet; }
 bool IsSuppressLOKMessages() const { return mbSuppressLOKMessages; }
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 73d4c23f49a9..1ea777eb7d91 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -86,6 +86,16 @@ enum class ScrollRangeCheck
 PaperWidthTextSize = 2,   // VisArea must be within paper width, Text Size
 };
 
+enum class LOKSpecialFlags {
+NONE   = 0x,
+LayoutRTL  = 0x0001,
+};
+
+namespace o3tl
+{
+template<> struct typed_flags : 
is_typed_flags {};
+}
+
 // Helper class that allows to set a callback at the EditView. When
 // set, Invalidates and repaints are suppressed at the EditView, but
 // EditViewInvalidate() will be triggered to allow the consumer to
@@ -377,6 +387,8 @@ public:
 tools::Rectangle GetLOKSpecialVisArea() const;
 bool HasLOKSpecialPositioning() const;
 
+void SetLOKSpecialFlags(LOKSpecialFlags eFlags);
+
 void SuppressLOKMessages(bool bSet);
 bool IsSuppressLOKMessages() const;
 


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

2023-06-18 Thread Mike Kaganski (via logerrit)
 editeng/source/accessibility/AccessibleContextBase.cxx  |2 
 editeng/source/accessibility/AccessibleEditableTextPara.cxx |   52 +++-
 editeng/source/accessibility/AccessibleImageBullet.cxx  |   28 ++
 editeng/source/uno/unofield.cxx |2 
 editeng/source/uno/unotext.cxx  |6 -
 editeng/source/xml/xmltxtexp.cxx|4 
 6 files changed, 33 insertions(+), 61 deletions(-)

New commits:
commit 678cb270a68efac78db790f6509ae4774e1d25bc
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:13:31 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 18 09:21:14 2023 +0200

Use getXWeak in editeng

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

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index 8dad5b1344b4..7143b7151bcf 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -494,7 +494,7 @@ void AccessibleContextBase::ThrowIfDisposed()
 if (rBHelper.bDisposed || rBHelper.bInDispose)
 {
 throw lang::DisposedException ("object has been already disposed",
-static_cast(this));
+getXWeak());
 }
 }
 
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 9ad4ce46de5a..d1e9e5baab52 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -351,16 +351,14 @@ namespace accessibility
 {
 if( nIndex < 0 || nIndex >= getCharacterCount() )
 throw lang::IndexOutOfBoundsException("AccessibleEditableTextPara: 
character index out of bounds",
-  uno::Reference< 
uno::XInterface >
-  ( static_cast< 
::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy
+  getXWeak() );
 }
 
 void AccessibleEditableTextPara::CheckPosition( sal_Int32 nIndex )
 {
 if( nIndex < 0 || nIndex > getCharacterCount() )
 throw lang::IndexOutOfBoundsException("AccessibleEditableTextPara: 
character position out of bounds",
-  uno::Reference< 
uno::XInterface >
-  ( static_cast< 
::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy
+  getXWeak() );
 }
 
 void AccessibleEditableTextPara::CheckRange( sal_Int32 nStart, sal_Int32 
nEnd )
@@ -426,9 +424,7 @@ namespace accessibility
 {
 if( !mpEditSource )
 throw uno::RuntimeException("No edit source, object is defunct",
-uno::Reference< uno::XInterface >
-( static_cast< ::cppu::OWeakObject* >
-  ( const_cast< 
AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
+ const_cast< 
AccessibleEditableTextPara* > (this)->getXWeak() );
 return *mpEditSource;
 }
 
@@ -439,15 +435,11 @@ namespace accessibility
 
 if( !pTextForwarder )
 throw uno::RuntimeException("Unable to fetch text forwarder, 
object is defunct",
-uno::Reference< uno::XInterface >
-( static_cast< ::cppu::OWeakObject* >
-  ( const_cast< 
AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
+const_cast< 
AccessibleEditableTextPara* > (this)->getXWeak() );
 
 if( !pTextForwarder->IsValid() )
 throw uno::RuntimeException("Text forwarder is invalid, object is 
defunct",
-uno::Reference< uno::XInterface >
-( static_cast< ::cppu::OWeakObject* >
-  ( const_cast< 
AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy
+const_cast< 
AccessibleEditableTextPara* > (this)->getXWeak() );
 return *pTextForwarder;
 }
 
@@ -459,16 +451,12 @@ namespace accessibility
 if( !pViewForwarder )
 {
 throw uno::RuntimeException("Unable to fetch view forwarder, 
object is defunct",
-uno::Reference< uno::XInterface >
-( static_cast< ::cppu::OWeakObject* >
-  

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

2023-06-15 Thread Maxim Monastirsky (via logerrit)
 editeng/source/outliner/outlvw.cxx|   12 +
 include/editeng/outliner.hxx  |2 
 sw/inc/AnnotationWin.hxx  |5 --
 sw/inc/fmtfld.hxx |3 -
 sw/source/core/fields/textapi.cxx |4 +
 sw/source/core/text/txtfld.cxx|5 --
 sw/source/uibase/docvw/AnnotationWin.cxx  |   18 ---
 sw/source/uibase/docvw/AnnotationWin2.cxx |   72 --
 sw/source/uibase/docvw/PostItMgr.cxx  |   29 
 9 files changed, 20 insertions(+), 130 deletions(-)

New commits:
commit 6cb6f76095d2df07102ffd3da7accf7d075df90b
Author: Maxim Monastirsky 
AuthorDate: Thu Jun 15 11:39:25 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Jun 16 00:49:09 2023 +0200

tdf#103064 sw: use the comment style by default instead of DF

As part of that, language changes in the document's body are
no longer applied to comments, as that would be a DF. Instead,
the default language of comments is controlled via the style
(see tdf#153805 for the use case).

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

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index 705b5e10b06b..382d1d63f7da 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -715,6 +715,18 @@ void OutlinerView::CreateSelectionList 
(std::vector )
 }
 }
 
+void OutlinerView::SetStyleSheet(const OUString& rStyleName)
+{
+ParaRange aParas = ImpGetSelectedParagraphs(false);
+
+auto pStyle = pOwner->GetStyleSheetPool()->Find(rStyleName, 
SfxStyleFamily::Para);
+if (!pStyle)
+return;
+
+for (sal_Int32 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; 
nPara++)
+pOwner->SetStyleSheet(nPara, static_cast(pStyle));
+}
+
 const SfxStyleSheet* OutlinerView::GetStyleSheet() const
 {
 return pEditView->GetStyleSheet();
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 7622138271ee..0b9b06395dba 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -267,6 +267,8 @@ public:
 voidPaste( bool bUseSpecial = false );
 voidPasteSpecial();
 
+void SetStyleSheet(const OUString& rStyleName);
+
 const SfxStyleSheet*  GetStyleSheet() const;
 SfxStyleSheet*  GetStyleSheet();
 
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index c3d556085a03..f7ac7b301d46 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -171,8 +171,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 
 bool IsMouseOverSidebarWin() const { return mbMouseOver; }
 
-void SetLanguage(const SvxLanguageItem& rNewItem);
-
 void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
 virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
 
@@ -216,7 +214,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 virtual voidDataChanged( const DataChangedEvent& rDCEvt ) override;
 
 voidSetSizePixel( const Size& rNewSize ) override;
-SfxItemSet  DefaultItem();
 
 DECL_DLLPRIVATE_LINK(ModifyHdl, LinkParamNone*, void);
 DECL_DLLPRIVATE_LINK(ScrollHdl, weld::ScrolledWindow&, void);
@@ -228,8 +225,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 
 sal_uInt32 CountFollowing();
 
-SvxLanguageItem GetLanguage() const;
-
 void SetMenuButtonColors();
 
 SwPostItMgr&mrMgr;
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 6f5811539b17..4c4c1ea91293 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -178,8 +178,7 @@ enum class SwFormatFieldHintWhich
 REMOVED= 2,
 FOCUS  = 3,
 CHANGED= 4,
-LANGUAGE   = 5,
-RESOLVED   = 6
+RESOLVED   = 5
 };
 
 class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint
diff --git a/sw/source/core/fields/textapi.cxx 
b/sw/source/core/fields/textapi.cxx
index 88520065c7e3..6dcdc99d3b47 100644
--- a/sw/source/core/fields/textapi.cxx
+++ b/sw/source/core/fields/textapi.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -189,6 +190,9 @@ void SwTextAPIEditSource::SetString( const OUString& rText )
 m_pImpl->mpOutliner->Clear();
 
 EnsureOutliner();
+
+if (auto pStyle = 
m_pImpl->mpOutliner->GetStyleSheetPool()->Find(SwResId(STR_POOLCOLL_COMMENT), 
SfxStyleFamily::Para))
+m_pImpl->mpOutliner->SetStyleSheet(0, 
static_cast(pStyle));
 m_pImpl->mpOutliner->Insert( rText );
 }
 
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 004a2bc17c09..aa8fef7331c5 100644
--- a/sw/source/core/text/txtfld.cxx
+++ 

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

2023-06-15 Thread Maxim Monastirsky (via logerrit)
 editeng/source/editeng/editattr.cxx |2 +-
 editeng/source/editeng/editdoc.cxx  |7 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9474ff4cc0abbd16f91ea582050c2332bdad88a3
Author: Maxim Monastirsky 
AuthorDate: Wed May 31 21:59:06 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jun 15 22:37:16 2023 +0200

tdf#103064 editeng: fix handling of char highlighting

Transparency should be set to false if a color is present, but not
with COL_TRANSPARENT. Compare with what is done for shape text in
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D.

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

diff --git a/editeng/source/editeng/editattr.cxx 
b/editeng/source/editeng/editattr.cxx
index 3277ed0916ba..42e5f20206ba 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -230,7 +230,7 @@ 
EditCharAttribBackgroundColor::EditCharAttribBackgroundColor(
 void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* )
 {
 Color aColor = static_cast(GetItem())->GetValue();
-rFont.SetTransparent(false);
+rFont.SetTransparent(aColor == COL_TRANSPARENT);
 rFont.SetFillColor(aColor);
 }
 
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 9fff222d9368..08750a94fcd2 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1976,7 +1976,6 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 {
 vcl::Font aPrevFont( rFont );
 rFont.SetAlignment( ALIGN_BASELINE );
-rFont.SetTransparent( true );
 
 sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, 
nScriptType );
 sal_uInt16 nWhich_Language = GetScriptItemId( EE_CHAR_LANGUAGE, 
nScriptType );
@@ -1997,7 +1996,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_COLOR ) == 
SfxItemState::SET ) )
 rFont.SetColor( rSet.Get( EE_CHAR_COLOR ).GetValue() );
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
-rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() );
+{
+auto& aColor = rSet.Get( EE_CHAR_BKGCOLOR ).GetValue();
+rFont.SetTransparent(aColor == COL_TRANSPARENT);
+rFont.SetFillColor(aColor);
+}
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
 rFont.SetFontSize( Size( rFont.GetFontSize().Width(), 
static_cast(rSet.Get( nWhich_FontHeight ) 
).GetHeight() ) );
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == 
SfxItemState::SET ) )


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

2023-06-15 Thread Maxim Monastirsky (via logerrit)
 editeng/source/editeng/impedit5.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit c89d6d690ba4b48c235752a6193aa77d9ecb7384
Author: Maxim Monastirsky 
AuthorDate: Thu Jun 15 11:16:29 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jun 15 19:33:48 2023 +0200

tdf#103064 editeng: invalidate spelling results on style change

Because a style might define a different langauge. This is
similar to what we do for DF in SetAttribs/SetParaAttribs.
See also alternative approach in SwLangHelper::SetLanguageStatus
or SwAnnotationWin::SetLanguage.

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

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 3a87c4b5bfb7..8438f0be7632 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -87,6 +87,9 @@ void ImpEditEngine::SetStyleSheet( sal_Int32 nPara, 
SfxStyleSheet* pStyle )
 pNode->SetStyleSheet( pStyle, aStatus.UseCharAttribs() );
 if ( pStyle )
 StartListening(*pStyle, DuplicateHandling::Prevent);
+
+if (pNode->GetWrongList())
+pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
 ParaAttribsChanged( pNode );
 }
 if (IsUpdateLayout())
@@ -110,6 +113,8 @@ void ImpEditEngine::UpdateParagraphsWithStyleSheet( 
SfxStyleSheet* pStyle )
 else
 pNode->SetStyleSheet( pStyle, false );
 
+if (pNode->GetWrongList())
+pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
 ParaAttribsChanged( pNode );
 }
 }


[Libreoffice-commits] core.git: editeng/source include/sfx2 include/svtools sc/source sd/source sfx2/source sw/inc sw/source

2023-06-14 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/impedit3.cxx |   24 
 include/sfx2/viewsh.hxx |3 +++
 include/svtools/colorcfg.hxx|2 +-
 sc/source/ui/inc/tabvwsh.hxx|2 ++
 sc/source/ui/view/tabvwshc.cxx  |   20 
 sd/source/ui/inc/ViewShellBase.hxx  |2 ++
 sd/source/ui/view/ViewShellBase.cxx |   27 +++
 sfx2/source/view/viewsh.cxx |6 ++
 sw/inc/view.hxx |2 ++
 sw/source/uibase/uiview/viewprt.cxx |   27 +++
 10 files changed, 110 insertions(+), 5 deletions(-)

New commits:
commit 069c7dc4e9706b40ca12d83d83f90f41cec948f8
Author: Paris Oplopoios 
AuthorDate: Tue Jun 13 20:36:48 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 22:12:21 2023 +0200

Add editengine view separation in tiled rendering

Editengine now gets the background color from the current view instead
from a global variable

Change-Id: I98a0fccf4d0c83f4dabf8e534a9228b8a5e271d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152996
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 7baa475342b67c10537e11da37b8862648679b02)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153073
Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index bcf0c044872f..e18562d3113f 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -52,6 +52,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,6 +68,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4686,15 +4688,29 @@ Reference < i18n::XExtendedInputSequenceChecker > const 
& ImpEditEngine::ImplGet
 
 Color ImpEditEngine::GetAutoColor() const
 {
-Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+Color aColor;
 
-if ( GetBackgroundColor() != COL_AUTO )
+if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
 {
-if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+// Get document background color from current view instead
+aColor = 
SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR);
+if (aColor.IsDark())
 aColor = COL_WHITE;
-else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+else
 aColor = COL_BLACK;
 }
+else
+{
+aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+
+if ( GetBackgroundColor() != COL_AUTO )
+{
+if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+aColor = COL_WHITE;
+else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+aColor = COL_BLACK;
+}
+}
 
 return aColor;
 }
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index b805f1cf99d4..08bc6cecc8cb 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -74,6 +74,7 @@ namespace com::sun::star::ui { class XContextMenuInterceptor; 
}
 namespace com::sun::star::ui { struct ContextMenuExecuteEvent; }
 namespace com::sun::star::view { class XRenderable; }
 namespace tools { class Rectangle; }
+namespace svtools { enum ColorConfigEntry : int; }
 
 enum class SfxPrinterChangeFlags
 {
@@ -428,6 +429,8 @@ public:
 virtual void afterCallbackRegistered();
 /// See OutlinerViewShell::GetEditWindowForActiveOLEObj().
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
+/// Get a color config color from this view
+virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index de16f18eab13..9810aac0393d 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -27,7 +27,7 @@
 
 
 namespace svtools{
-enum ColorConfigEntry
+enum ColorConfigEntry : int
 {
 DOCCOLOR,
 DOCBOUNDARIES   ,
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a670c4429d53..d8434af53bc6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -395,6 +395,8 @@ public:
 void afterCallbackRegistered() override;
 /// See SfxViewShell::NotifyCursor().
 void NotifyCursor(SfxViewShell* pViewShell) const override;
+/// See SfxViewShell::GetColorConfigColor().
+::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool 

[Libreoffice-commits] core.git: editeng/source include/editeng oox/source sw/qa sw/source writerfilter/source

2023-06-11 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/frmitems.cxx|   97 +++-
 include/editeng/boxitem.hxx  |7 
 oox/source/token/properties.txt  |4 
 sw/qa/extras/ooxmlexport/data/Test_ThemeBorderColor.docx |binary
 sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx   |   30 ++
 sw/qa/inc/swmodeltestbase.hxx|9 
 sw/source/core/unocore/unomap1.cxx   |   12 -
 sw/source/core/unocore/unomapproperties.hxx  |8 
 sw/source/filter/ww8/docxattributeoutput.cxx |  180 +++
 writerfilter/source/dmapper/BorderHandler.cxx|   34 ++
 writerfilter/source/dmapper/BorderHandler.hxx|8 
 writerfilter/source/dmapper/DomainMapper.cxx |   40 ++-
 writerfilter/source/dmapper/PropertyIds.cxx  |8 
 writerfilter/source/dmapper/PropertyIds.hxx  |   11 
 writerfilter/source/dmapper/TDefTableHandler.cxx |   22 +
 writerfilter/source/dmapper/TDefTableHandler.hxx |   12 -
 16 files changed, 370 insertions(+), 112 deletions(-)

New commits:
commit 92fc0ace46398eeb6c9238c8292459cc78db6694
Author: Tomaž Vajngerl 
AuthorDate: Sat Jun 10 22:25:43 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jun 12 03:54:48 2023 +0200

ooxml: import and export border theme colors for various props.

This adds support to import and export various border (lines)
theme color properties.

SvxBoxItem needed to be fixed, because it can happen that the
BorderLine is not yet initialised and we already set the border's
ComplexColor. Now there is a maTempComplexColor inside SvxBoxItem,
which stores the ComplexColor until the specific BorderLine is
initialized.

In addition add roundtrip test for import and export cycle.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 77c497079634..94b7704303ba 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2301,6 +2301,7 @@ SvxBoxItem::SvxBoxItem(const SvxBoxItem& rCopy)
 , mnBottomDistance(rCopy.mnBottomDistance)
 , mnLeftDistance(rCopy.mnLeftDistance)
 , mnRightDistance(rCopy.mnRightDistance)
+, maTempComplexColors(rCopy.maTempComplexColors)
 , mbRemoveAdjCellBorder(rCopy.mbRemoveAdjCellBorder)
 {
 }
@@ -2369,6 +2370,7 @@ bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) 
const
 (mnLeftDistance == rBoxItem.mnLeftDistance) &&
 (mnRightDistance == rBoxItem.mnRightDistance) &&
 (mbRemoveAdjCellBorder == rBoxItem.mbRemoveAdjCellBorder ) &&
+(maTempComplexColors == rBoxItem.maTempComplexColors) &&
 CompareBorderLine(mpTopBorderLine, rBoxItem.GetTop()) &&
 CompareBorderLine(mpBottomBorderLine, rBoxItem.GetBottom()) &&
 CompareBorderLine(mpLeftBorderLine, rBoxItem.GetLeft()) &&
@@ -2462,8 +2464,11 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 {
 if (mpBottomBorderLine)
 {
-auto xComplexColor = 
model::color::createXComplexColor(mpBottomBorderLine->getComplexColor());
-rVal <<= xComplexColor;
+rVal <<= 
model::color::createXComplexColor(mpBottomBorderLine->getComplexColor());
+}
+else if 
(maTempComplexColors[size_t(SvxBoxItemLine::BOTTOM)].getType() != 
model::ColorType::Unused)
+{
+rVal <<= 
model::color::createXComplexColor(maTempComplexColors[size_t(SvxBoxItemLine::BOTTOM)]);
 }
 return true;
 }
@@ -2471,8 +2476,11 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 {
 if (mpLeftBorderLine)
 {
-auto xComplexColor = 
model::color::createXComplexColor(mpLeftBorderLine->getComplexColor());
-rVal <<= xComplexColor;
+rVal <<= 
model::color::createXComplexColor(mpLeftBorderLine->getComplexColor());
+}
+else if 
(maTempComplexColors[size_t(SvxBoxItemLine::LEFT)].getType() != 
model::ColorType::Unused)
+{
+rVal <<= 
model::color::createXComplexColor(maTempComplexColors[size_t(SvxBoxItemLine::LEFT)]);
 }
 return true;
 }
@@ -2480,8 +2488,11 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 {
 if (mpRightBorderLine)
 {
-auto xComplexColor = 
model::color::createXComplexColor(mpRightBorderLine->getComplexColor());
-rVal <<= xComplexColor;
+rVal <<= 
model::color::createXComplexColor(mpRightBorderLine->getComplexColor());
+  

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

2023-06-02 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/editview.cxx  |1 
 sc/inc/docuno.hxx|3 ++
 sc/inc/viewopti.hxx  |   10 
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   31 +++
 sc/source/core/data/patattr.cxx  |   29 -
 sc/source/core/tool/viewopti.cxx |4 +++
 sc/source/ui/app/scmod.cxx   |   27 +++
 sc/source/ui/unoobj/docuno.cxx   |   17 ++
 sc/source/ui/view/gridwin4.cxx   |   17 +-
 9 files changed, 132 insertions(+), 7 deletions(-)

New commits:
commit 53d5cc538d9c274cc4d7dfe38229f0f54706b403
Author: Paris Oplopoios 
AuthorDate: Tue May 23 03:50:30 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Fri Jun 2 18:22:34 2023 +0200

Add Calc view separation for tiled rendering

Calc now uses different colors based on the current view theme to paint
tiles when using tiled rendering

Change-Id: I1ca84371141ff026ad49ec362518ca13c59c7c6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152137
Tested-by: Paris Oplopoios 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f4eb56b8b9ff3492e0a02fb76eb4ea7b851f4774)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152440
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index cc03a135cdcd..f6c90309747c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -719,6 +719,7 @@ void EditView::MoveParagraphs( tools::Long nDiff )
 void EditView::SetBackgroundColor( const Color& rColor )
 {
 pImpEditView->SetBackgroundColor( rColor );
+pImpEditView->pEditEngine->SetBackgroundColor( rColor );
 }
 
 Color const & EditView::GetBackgroundColor() const
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 837f93ec3558..23de1dad63ce 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -394,6 +394,9 @@ public:
 
 /// @see vcl::ITiledRenderable::completeFunction().
 virtual void completeFunction(const OUString& rFunctionName) override;
+
+/// @see vcl::ITiledRenderable::getViewRenderState().
+OString getViewRenderState() override;
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 52b23c86b978..489a3e8c81da 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -95,6 +95,12 @@ public:
 voidSetGridOptions( const ScGridOptions& rNew ) { 
aGridOpt = rNew; }
 std::unique_ptr CreateGridItem() const;
 
+const OUString& GetColorSchemeName() const { return sColorSchemeName; }
+void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = 
rName; }
+
+const Color& GetDocColor() const { return aDocCol; }
+void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; }
+
 ScViewOptions&  operator=  ( const ScViewOptions& rCpy );
 booloperator== ( const ScViewOptions& rOpt ) const;
 booloperator!= ( const ScViewOptions& rOpt ) const { 
return !(operator==(rOpt)); }
@@ -105,6 +111,10 @@ private:
 Color   aGridCol;
 OUStringaGridColName;
 ScGridOptions   aGridOpt;
+// The name of the color scheme
+OUString sColorSchemeName = "Default";
+// The background color of the document
+Color aDocCol;
 };
 
 // Item for the options dialog - View
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 5968cfc8fdd6..6eb2aa134e69 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3056,6 +3056,37 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testUndoReorderingMulti)
 CPPUNIT_ASSERT_EQUAL(OUString("DD"), pDoc->GetString(ScAddress(0, 3, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState)
+{
+// Add an empty dark scheme to avoid a warning
+svtools::EditableColorConfig aColorConfig;
+aColorConfig.AddScheme(u"Dark");
+
+ScModelObj* pModelObj = createDoc("empty.ods");
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Create a second view
+SfxLokHelper::createView();
+ViewCallback aView2;
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Set second view to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString(";Dark"), pModelObj->getViewRenderState());
+
+// 

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

2023-05-23 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit2.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c43e39a7b7f4b0ed6165af966cce8057a93eb22f
Author: Caolán McNamara 
AuthorDate: Tue May 23 19:58:39 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 23 22:09:44 2023 +0200

tdf#155350 Do AutoCorrect of Input Method text

for all of SvxAutoCorrect::IsAutoCorrectChar() chars not just
quotes

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

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 98dcf70f186f..254e5e194898 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -375,8 +375,9 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, 
EditView* pView )
 // #102812# convert quotes in IME text
 // works on the last input character, this is especially in 
Korean text often done
 // quotes that are inside of the string are not replaced!
+// See also tdf#155350
 const sal_Unicode nCharCode = aSel.Min().GetNode()->GetChar( 
aSel.Min().GetIndex() );
-if ( ( GetStatus().DoAutoCorrect() ) && ( ( nCharCode == '\"' 
) || ( nCharCode == '\'' ) ) )
+if ( ( GetStatus().DoAutoCorrect() ) && 
SvxAutoCorrect::IsAutoCorrectChar(nCharCode) )
 {
 aSel = DeleteSelected( aSel );
 aSel = AutoCorrect( aSel, nCharCode, 
mpIMEInfos->bWasCursorOverwrite );


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

2023-05-20 Thread Mike Kaganski (via logerrit)
 editeng/source/misc/svxacorr.cxx|  102 
 sw/qa/extras/uiwriter/uiwriter6.cxx |   24 
 2 files changed, 82 insertions(+), 44 deletions(-)

New commits:
commit 075ecc1c31199d0fd0f930cf1b803b04a3b17ce8
Author: Mike Kaganski 
AuthorDate: Fri May 19 14:01:02 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat May 20 13:31:21 2023 +0200

tdf#155407: fix the second replacement in FnChgToEnEmDash

It was broken from the beginning. The second replacement could
look into a wrong string when checking if the characters around
the "--" are eligible; it could use obsolete indices in the
document, ignoring the previous replacement that changed the
lendth of the text.

This also replaces a use of char* to hold Unicode codepoints to
pass to lcl_IsInAsciiArr, with an array of sal_Unicode (because
all the checked values fit into it).

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index dfb1e6c0d726..318da6536df9 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -100,11 +100,13 @@ constexpr OUStringLiteral pXMLImplWordStart_ExcptLstStr = 
u"WordExceptList.xml";
 constexpr OUStringLiteral pXMLImplCplStt_ExcptLstStr = 
u"SentenceExceptList.xml";
 constexpr OUStringLiteral pXMLImplAutocorr_ListStr = u"DocumentList.xml";
 
-const char
+// tdf#54409 check also typographical quotation marks in the case of skipped 
ASCII quotation marks
+// Curious, why these \u0083\u0084\u0089\u0091\u0092\u0093\u0094 are handled 
as "begin characters"?
+constexpr std::u16string_view
 /* also at these beginnings - Brackets and all kinds of begin characters */
-sImplSttSkipChars[] = "\"\'([{\x83\x84\x89\x91\x92\x93\x94",
+sImplSttSkipChars = 
u"\"'([{\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094",
 /* also at these ends - Brackets and all kinds of begin characters */
-sImplEndSkipChars[] = "\"\')]}\x83\x84\x89\x91\x92\x93\x94";
+sImplEndSkipChars = 
u"\"')]}\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094";
 
 static OUString EncryptBlockName_Imp(std::u16string_view rName);
 
@@ -171,20 +173,12 @@ static bool lcl_IsSymbolChar( CharClass const & rCC, 
const OUString& rTxt,
 return false;
 }
 
-static bool lcl_IsInAsciiArr( const char* pArr, const sal_Unicode c )
+static bool lcl_IsInArr(std::u16string_view arr, const sal_uInt32 c)
 {
-// tdf#54409 check also typographical quotation marks in the case of 
skipped ASCII quotation marks
-if ( 0x2018 <= c && c <= 0x201F && (pArr == sImplSttSkipChars || pArr == 
sImplEndSkipChars) )
-return true;
-
-bool bRet = false;
-for( ; *pArr; ++pArr )
-if( *pArr == c )
-{
-bRet = true;
-break;
-}
-return bRet;
+for (const auto c1 : arr)
+if (c1 == c)
+return true;
+return false;
 }
 
 SvxAutoCorrDoc::~SvxAutoCorrDoc()
@@ -312,6 +306,8 @@ ACFlags SvxAutoCorrect::GetDefaultFlags()
 
 constexpr sal_Unicode cEmDash = 0x2014;
 constexpr sal_Unicode cEnDash = 0x2013;
+constexpr OUStringLiteral sEmDash(u"\u2014");
+constexpr OUStringLiteral sEnDash(u"\u2013");
 constexpr sal_Unicode cApostrophe = 0x2019;
 constexpr sal_Unicode cLeftDoubleAngleQuote = 0xAB;
 constexpr sal_Unicode cRightDoubleAngleQuote = 0xBB;
@@ -485,10 +481,10 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
 CharClass& rCC = GetCharClass(eLang);
 
 for (; nSttPos < nEndPos; ++nSttPos)
-if (!lcl_IsInAsciiArr(sImplSttSkipChars, rTxt[nSttPos]))
+if (!lcl_IsInArr(sImplSttSkipChars, rTxt[nSttPos]))
 break;
 for (; nSttPos < nEndPos; --nEndPos)
-if (!lcl_IsInAsciiArr(sImplEndSkipChars, rTxt[nEndPos - 1]))
+if (!lcl_IsInArr(sImplEndSkipChars, rTxt[nEndPos - 1]))
 break;
 
 
@@ -558,6 +554,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
 // rTxt may refer to the frame text that will change in the calls to 
rDoc.Delete / rDoc.Insert;
 // keep a local copy for later use
 OUString aOrigTxt = rTxt;
+sal_Int32 nFirstReplacementTextLengthChange = 0;
 
 // replace " - " or " --" with "enDash"
 if( 1 < nSttPos && 1 <= nEndPos - nSttPos )
@@ -570,7 +567,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
 '-' == rTxt[ nSttPos+1 ])
 {
 sal_Int32 n;
-for( n = nSttPos+2; n < nEndPos && lcl_IsInAsciiArr(
+for( n = nSttPos+2; n < nEndPos && lcl_IsInArr(
 sImplSttSkipChars,(cCh = rTxt[ n ]));
 ++n )
 ;
@@ -578,7 +575,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
 

[Libreoffice-commits] core.git: editeng/source include/editeng

2023-05-19 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/borderline.cxx |   40 ++--
 include/editeng/borderline.hxx  |6 ++---
 2 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 028c974cf2fcb9494f42267edf1427cb45342f39
Author: Tomaž Vajngerl 
AuthorDate: Wed May 17 14:27:49 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 20 04:38:36 2023 +0200

prefix SvxBorderLine aColor attribute

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

diff --git a/editeng/source/items/borderline.cxx 
b/editeng/source/items/borderline.cxx
index 42d61b5daa43..698fd2b964b0 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -109,8 +109,8 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, 
tools::Long nWidth,
 , m_bMirrorWidths(false)
 , m_bUseLeftTop(false)
 {
-if ( pCol )
-aColor = *pCol;
+if (pCol)
+m_aColor = *pCol;
 }
 
 SvxBorderLineStyle
@@ -518,15 +518,15 @@ sal_uInt16 SvxBorderLine::GetDistance() const
 
 bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const
 {
-return ( ( aColor== rCmp.aColor )&&
- ( m_nWidth == rCmp.m_nWidth )   &&
- ( m_bMirrorWidths  == rCmp.m_bMirrorWidths )  &&
- ( m_aWidthImpl  == rCmp.m_aWidthImpl )  &&
- ( m_nStyle == rCmp.GetBorderLineStyle()) &&
- ( m_bUseLeftTop == rCmp.m_bUseLeftTop ) &&
- ( m_pColorOutFn == rCmp.m_pColorOutFn ) &&
- ( m_pColorInFn == rCmp.m_pColorInFn )   &&
- ( m_pColorGapFn == rCmp.m_pColorGapFn ) );
+return (m_aColor == rCmp.m_aColor &&
+m_nWidth == rCmp.m_nWidth &&
+m_bMirrorWidths == rCmp.m_bMirrorWidths &&
+m_aWidthImpl == rCmp.m_aWidthImpl &&
+m_nStyle == rCmp.GetBorderLineStyle() &&
+m_bUseLeftTop == rCmp.m_bUseLeftTop &&
+m_pColorOutFn == rCmp.m_pColorOutFn &&
+m_pColorInFn == rCmp.m_pColorInFn &&
+m_pColorGapFn == rCmp.m_pColorGapFn);
 }
 
 void SvxBorderLine::SetBorderLineStyle( SvxBorderLineStyle nNew )
@@ -571,14 +571,14 @@ void SvxBorderLine::SetBorderLineStyle( 
SvxBorderLineStyle nNew )
 
 Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const
 {
-Color aResult = aColor;
+Color aResult = m_aColor;
 
 if ( m_aWidthImpl.IsDouble() && m_pColorOutFn != nullptr )
 {
 if ( !bLeftOrTop && m_bUseLeftTop )
-aResult = (*m_pColorInFn)( aColor );
+aResult = (*m_pColorInFn)(m_aColor);
 else
-aResult = (*m_pColorOutFn)( aColor );
+aResult = (*m_pColorOutFn)(m_aColor);
 }
 
 return aResult;
@@ -586,14 +586,14 @@ Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const
 
 Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const
 {
-Color aResult = aColor;
+Color aResult = m_aColor;
 
 if ( m_aWidthImpl.IsDouble() && m_pColorInFn != nullptr )
 {
 if ( !bLeftOrTop && m_bUseLeftTop )
-aResult = (*m_pColorOutFn)( aColor );
+aResult = (*m_pColorOutFn)(m_aColor);
 else
-aResult = (*m_pColorInFn)( aColor );
+aResult = (*m_pColorInFn)(m_aColor);
 }
 
 return aResult;
@@ -601,11 +601,11 @@ Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const
 
 Color SvxBorderLine::GetColorGap( ) const
 {
-Color aResult = aColor;
+Color aResult = m_aColor;
 
 if ( m_aWidthImpl.IsDouble() && m_pColorGapFn != nullptr )
 {
-aResult = (*m_pColorGapFn)( aColor );
+aResult = (*m_pColorGapFn)(m_aColor);
 }
 
 return aResult;
@@ -642,7 +642,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit,
 RID_DASH_DOT,
 RID_DASH_DOT_DOT
 };
-OUString aStr = "(" + ::GetColorString( aColor ) + cpDelim;
+OUString aStr = "(" + ::GetColorString(m_aColor) + cpDelim;
 
 if ( static_cast(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) )
 {
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
index 6cf1c45120be..affd513e853e 100644
--- a/include/editeng/borderline.hxx
+++ b/include/editeng/borderline.hxx
@@ -153,7 +153,7 @@ class EDITENG_DLLPUBLIC SvxBorderLine final
 Color (*m_pColorInFn)(Color);
 Color (*m_pColorGapFn)(Color);
 BorderWidthImpl m_aWidthImpl;
-Color aColor;
+Color m_aColor;
 SvxBorderLineStyle   m_nStyle;
 bool m_bMirrorWidths;
 bool m_bUseLeftTop;
@@ -165,7 +165,7 @@ public:
 Color (*pColorOutFn)( Color ) = ,
 Color (*pColorInFn)( Color ) =  );
 
-const Color&GetColor() const { return aColor; }
+const Color&GetColor() const { return m_aColor; }
 Color   GetColorOut( bool bLeftOrTop = true ) const;
 Color   GetColorIn( bool bLeftOrTop = true ) const;
 

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

2023-05-18 Thread Mike Kaganski (via logerrit)
 editeng/source/misc/svxacorr.cxx |   12 
 include/editeng/svxacorr.hxx |2 +-
 sw/source/core/edit/edws.cxx |4 
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 971c9945825db02a4809538d26fff3ae77d16866
Author: Mike Kaganski 
AuthorDate: Thu May 18 20:06:21 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri May 19 07:08:46 2023 +0200

Fix "AddressSanitizer: heap-use-after-free"

https://github.com/CollaboraOnline/online/issues/6380

Commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a (sw_redlinehide_4a:
SwEditShell::AutoCorrect() etc., 2018-11-28) explicitly relied upon
the reference to the node text being updated on editing operations.

Commit 14f6700fefa945c4cf995c09af9326c2a022f886 (use more string_view
in editeng, 2022-04-14) converted the argument of FnChgToEnEmDash to
a string view, which means that any change in the underlying OUString
frees the memory referenced by the view.

But in this method, we really don't want to have the text updated;
so use a local OUString copy for later reference.

Partially revert commit 14f6700fefa945c4cf995c09af9326c2a022f886.

And copy mst's commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a
message to document the assumptions in SwEditShell::AutoCorrect.

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 6b759415b52b..dfb1e6c0d726 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -545,7 +545,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
 
 // Replace dashes
 bool SvxAutoCorrect::FnChgToEnEmDash(
-SvxAutoCorrDoc& rDoc, std::u16string_view rTxt,
+SvxAutoCorrDoc& rDoc, const OUString& rTxt,
 sal_Int32 nSttPos, sal_Int32 nEndPos,
 LanguageType eLang )
 {
@@ -555,6 +555,10 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
 eLang = GetAppLang().getLanguageType();
 bool bAlwaysUseEmDash = (eLang == LANGUAGE_RUSSIAN || eLang == 
LANGUAGE_UKRAINIAN);
 
+// rTxt may refer to the frame text that will change in the calls to 
rDoc.Delete / rDoc.Insert;
+// keep a local copy for later use
+OUString aOrigTxt = rTxt;
+
 // replace " - " or " --" with "enDash"
 if( 1 < nSttPos && 1 <= nEndPos - nSttPos )
 {
@@ -631,14 +635,14 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
 bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH);
 if( 4 <= nEndPos - nSttPos )
 {
-OUString sTmp( rTxt.substr( nSttPos, nEndPos - nSttPos ) );
+OUString sTmp( aOrigTxt.subView( nSttPos, nEndPos - nSttPos ) );
 sal_Int32 nFndPos = sTmp.indexOf("--");
 if( nFndPos != -1 && nFndPos &&
 nFndPos + 2 < sTmp.getLength() &&
 ( rCC.isLetterNumeric( sTmp, nFndPos - 1 ) ||
-  lcl_IsInAsciiArr( sImplEndSkipChars, rTxt[ nFndPos - 1 ] )) &&
+  lcl_IsInAsciiArr( sImplEndSkipChars, aOrigTxt[ nFndPos - 1 ] )) 
&&
 ( rCC.isLetterNumeric( sTmp, nFndPos + 2 ) ||
-lcl_IsInAsciiArr( sImplSttSkipChars, rTxt[ nFndPos + 2 ] )))
+lcl_IsInAsciiArr( sImplSttSkipChars, aOrigTxt[ nFndPos + 2 ] )))
 {
 nSttPos = nSttPos + nFndPos;
 rDoc.Delete( nSttPos, nSttPos + 2 );
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index fcb5f97aca2b..a5e43032a78f 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -408,7 +408,7 @@ public:
 bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&,
 sal_Int32 nSttPos, sal_Int32 nEndPos,
 LanguageType eLang );
-bool FnChgToEnEmDash( SvxAutoCorrDoc&, std::u16string_view,
+bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&,
 sal_Int32 nSttPos, sal_Int32 nEndPos,
 LanguageType eLang );
 bool FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view,
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index abbb920afdc5..4e46ae2daf5a 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -272,6 +272,10 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, 
bool bInsert,
 // something - so first normalize cursor point to end of redline so that
 // point will then be moved forward when something is inserted.
 *pCursor->GetPoint() = pFrame->MapViewToModelPos(nPos);
+// The hope is that the AutoCorrect never deletes nodes, hence never
+// deletes SwTextFrames, hence we can pass in the SwTextFrame::GetText()
+// result and it will be 

[Libreoffice-commits] core.git: editeng/source include/editeng

2023-05-13 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/frmitems.cxx |  333 ++
 include/editeng/boxitem.hxx   |  116 +++--
 2 files changed, 231 insertions(+), 218 deletions(-)

New commits:
commit ef106661fcc40cfdd406064cbf73fd62477d0e79
Author: Tomaž Vajngerl 
AuthorDate: Fri May 12 16:05:36 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 13 16:12:18 2023 +0200

prefix members and cleanup SvxBoxItem, SvxBoxInfoItem

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 250b61e33753..ad0977fab753 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2289,29 +2289,23 @@ void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 
 // class SvxBoxItem --
 
-SvxBoxItem::SvxBoxItem( const SvxBoxItem& rCpy ) :
-
-SfxPoolItem ( rCpy ),
-pTop( rCpy.pTop ? new SvxBorderLine( *rCpy.pTop ): nullptr 
),
-pBottom ( rCpy.pBottom  ? new SvxBorderLine( *rCpy.pBottom ) : nullptr 
),
-pLeft   ( rCpy.pLeft? new SvxBorderLine( *rCpy.pLeft )   : nullptr 
),
-pRight  ( rCpy.pRight   ? new SvxBorderLine( *rCpy.pRight )  : nullptr 
),
-nTopDist( rCpy.nTopDist ),
-nBottomDist ( rCpy.nBottomDist ),
-nLeftDist   ( rCpy.nLeftDist ),
-nRightDist  ( rCpy.nRightDist ),
-bRemoveAdjCellBorder ( rCpy.bRemoveAdjCellBorder )
+SvxBoxItem::SvxBoxItem(const SvxBoxItem& rCopy)
+: SfxPoolItem (rCopy)
+, mpTopBorderLine(rCopy.mpTopBorderLine ? new 
SvxBorderLine(*rCopy.mpTopBorderLine) : nullptr)
+, mpBottomBorderLine(rCopy.mpBottomBorderLine ? new 
SvxBorderLine(*rCopy.mpBottomBorderLine) : nullptr)
+, mpLeftBorderLine(rCopy.mpLeftBorderLine ? new 
SvxBorderLine(*rCopy.mpLeftBorderLine) : nullptr)
+, mpRightBorderLine(rCopy.mpRightBorderLine ? new 
SvxBorderLine(*rCopy.mpRightBorderLine) : nullptr)
+, mnTopDistance(rCopy.mnTopDistance)
+, mnBottomDistance(rCopy.mnBottomDistance)
+, mnLeftDistance(rCopy.mnLeftDistance)
+, mnRightDistance(rCopy.mnRightDistance)
+, mbRemoveAdjCellBorder(rCopy.mbRemoveAdjCellBorder)
 {
 }
 
 
-SvxBoxItem::SvxBoxItem( const sal_uInt16 nId ) :
-SfxPoolItem( nId ),
-nTopDist( 0 ),
-nBottomDist ( 0 ),
-nLeftDist   ( 0 ),
-nRightDist  ( 0 ),
-bRemoveAdjCellBorder ( false )
+SvxBoxItem::SvxBoxItem(const sal_uInt16 nId)
+: SfxPoolItem(nId)
 {
 }
 
@@ -2324,13 +2318,13 @@ void SvxBoxItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBoxItem"));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("top-dist"),
-  
BAD_CAST(OString::number(nTopDist).getStr()));
+  
BAD_CAST(OString::number(mnTopDistance).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bottom-dist"),
-  
BAD_CAST(OString::number(nBottomDist).getStr()));
+  
BAD_CAST(OString::number(mnBottomDistance).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("left-dist"),
-  
BAD_CAST(OString::number(nLeftDist).getStr()));
+  
BAD_CAST(OString::number(mnLeftDistance).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("right-dist"),
-  
BAD_CAST(OString::number(nRightDist).getStr()));
+  
BAD_CAST(OString::number(mnRightDistance).getStr()));
 SfxPoolItem::dumpAsXml(pWriter);
 (void)xmlTextWriterEndElement(pWriter);
 }
@@ -2352,7 +2346,7 @@ boost::property_tree::ptree SvxBoxItem::dumpAsJSON() const
 }
 
 
-static bool CmpBrdLn( const std::unique_ptr & pBrd1, const 
SvxBorderLine* pBrd2 )
+static bool CompareBorderLine(const std::unique_ptr & pBrd1, 
const SvxBorderLine* pBrd2)
 {
 if( pBrd1.get() == pBrd2 )
 return true;
@@ -2368,15 +2362,15 @@ bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) 
const
 
 const SvxBoxItem& rBoxItem = static_cast(rAttr);
 return (
-( nTopDist == rBoxItem.nTopDist ) &&
-( nBottomDist == rBoxItem.nBottomDist )   &&
-( nLeftDist == rBoxItem.nLeftDist )   &&
-( nRightDist == rBoxItem.nRightDist ) &&
-( bRemoveAdjCellBorder == rBoxItem.bRemoveAdjCellBorder ) &&
-CmpBrdLn( pTop, rBoxItem.GetTop() )   &&
-CmpBrdLn( pBottom, rBoxItem.GetBottom() ) &&
-CmpBrdLn( pLeft, rBoxItem.GetLeft() ) &&
-CmpBrdLn( pRight, rBoxItem.GetRight() ) );
+(mnTopDistance == rBoxItem.mnTopDistance) &&
+(mnBottomDistance == 

[Libreoffice-commits] core.git: editeng/source sd/source svx/source

2023-05-11 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleContextBase.cxx|2 ++
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx |2 ++
 svx/source/accessibility/AccessibleShape.cxx  |4 
 svx/source/accessibility/AccessibleShapeTreeInfo.cxx  |7 +--
 4 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit d309298d1f70f4ffbf699b1aa1b2bfe08be8c4ef
Author: Noel Grandin 
AuthorDate: Thu May 11 09:27:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu May 11 10:50:03 2023 +0200

tdf#155235 Draw crashes on close: SIGSEGV in SalInstance:GetYieldMutex()

This is a regression from
commit 3b7db802731826b6cc3b55100470b0c61c1f2dfa
Author: Noel Grandin 
Date:   Thu May 4 10:06:14 2023 +0200
tdf#105404 [API CHANGE] add index to accessiblity change event

The list of children in DocumentFocusListener is getting out of sync
because something is not sending add/remove events for accessible
objects, a problem which was hidden before the commit above.

I can't find the add/remove problem, so do the next best thing - fix the
dispose methods of various accessible objects so that they clear
references to other objects, which results in the relevant objects being
destructed in an order which does not lead to crashes.

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

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index 6ef2fe654548..8dad5b1344b4 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -404,6 +404,8 @@ void SAL_CALL AccessibleContextBase::disposing()
 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( 
mnClientId, *this );
 mnClientId =  0;
 }
+mxParent.clear();
+mxRelationSet.clear();
 }
 
 
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx 
b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index 410d75deabe2..61d4bd154ee3 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -480,6 +480,8 @@ void AccessibleDocumentViewBase::impl_dispose()
 mxController = nullptr;
 
 maShapeTreeInfo.SetDocumentWindow (nullptr);
+maShapeTreeInfo.dispose();
+mxAccessibleOLEObject.clear();
 }
 
 //=  XEventListener  ==
diff --git a/svx/source/accessibility/AccessibleShape.cxx 
b/svx/source/accessibility/AccessibleShape.cxx
index ec9ba6efa410..e3116a9762b7 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -887,6 +887,10 @@ void AccessibleShape::disposing (const lang::EventObject& 
aEvent)
 {
 TOOLS_WARN_EXCEPTION("svx", "caught exception while disposing");
 }
+mpChildrenManager.reset();
+mxShape.clear();
+maShapeTreeInfo.dispose();
+mpText.reset();
 }
 
 // document::XShapeEventListener
diff --git a/svx/source/accessibility/AccessibleShapeTreeInfo.cxx 
b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
index df6136f94528..70fd6e44d820 100644
--- a/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
+++ b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
@@ -74,8 +74,11 @@ AccessibleShapeTreeInfo& AccessibleShapeTreeInfo::operator= 
(const AccessibleSha
 
 AccessibleShapeTreeInfo::~AccessibleShapeTreeInfo()
 {
-SolarMutexGuard g;
-mpWindow.reset();
+if (mpWindow)
+{
+SolarMutexGuard g;
+mpWindow.reset();
+}
 }
 
 void AccessibleShapeTreeInfo::SetDocumentWindow (


[Libreoffice-commits] core.git: editeng/source include/editeng sd/CppunitTest_sd_textfitting_tests.mk sd/Module_sd.mk sd/qa svx/source

2023-05-06 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/editeng.cxx |   16 +++
 include/editeng/editeng.hxx|5 -
 sd/CppunitTest_sd_textfitting_tests.mk |   79 
 sd/Module_sd.mk|1 
 sd/qa/unit/TextFittingTest.cxx |  154 +
 sd/qa/unit/data/TextFitting.odp|binary
 svx/source/svdraw/svdotext.cxx |   20 +++-
 7 files changed, 272 insertions(+), 3 deletions(-)

New commits:
commit 6c042848b688f64b3c56d65dd9dc5fe85412660a
Author: Tomaž Vajngerl 
AuthorDate: Fri May 5 15:34:38 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 6 14:38:32 2023 +0200

Change text auto-fit alg. to also increase the scaling

When in edit mode, the text can be deleted, so the text box size
can become smaller, but the auto-fit algorithm didn't take into
account.
In this case we already have the font and spacing scaling already
set to a specific value and we need to find a scaling value where
the margin is the smallest.

This change also adds a test for the issue.

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 5b70a2c2288b..d263363253e1 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2275,11 +2275,27 @@ void EditEngine::getGlobalSpacingScale(double& rX, 
double& rY) const
 pImpEditEngine->getSpacingScale(rX, rY);
 }
 
+basegfx::B2DTuple EditEngine::getGlobalSpacingScale() const
+{
+double x = 0.0;
+double y = 0.0;
+pImpEditEngine->getSpacingScale(x, y);
+return {x, y};
+}
+
 void EditEngine::getGlobalFontScale(double& rX, double& rY) const
 {
 pImpEditEngine->getFontScale(rX, rY);
 }
 
+basegfx::B2DTuple EditEngine::getGlobalFontScale() const
+{
+double x = 0.0;
+double y = 0.0;
+pImpEditEngine->getFontScale(x, y);
+return {x, y};
+}
+
 void EditEngine::setRoundFontSizeToPt(bool bRound) const
 {
 pImpEditEngine->setRoundToNearestPt(bRound);
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index b3d67c1c472e..b31b77160ad5 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -16,7 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-// MyEDITENG, due to exported EditEng
+
 #ifndef INCLUDED_EDITENG_EDITENG_HXX
 #define INCLUDED_EDITENG_EDITENG_HXX
 
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -418,7 +419,9 @@ public:
 void setGlobalScale(double fFontScaleX, double fFontScaleY, double 
fSpacingScaleX, double fSpacingScaleY);
 
 void getGlobalSpacingScale(double& rX, double& rY) const;
+basegfx::B2DTuple getGlobalSpacingScale() const;
 void getGlobalFontScale(double& rX, double& rY) const;
+basegfx::B2DTuple getGlobalFontScale() const;
 
 void setRoundFontSizeToPt(bool bRound) const;
 
diff --git a/sd/CppunitTest_sd_textfitting_tests.mk 
b/sd/CppunitTest_sd_textfitting_tests.mk
new file mode 100644
index ..20e302d86793
--- /dev/null
+++ b/sd/CppunitTest_sd_textfitting_tests.mk
@@ -0,0 +1,79 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sd_textfitting_tests))
+
+$(eval $(call gb_CppunitTest_use_externals,sd_textfitting_tests,\
+boost_headers \
+libxml2 \
+))
+
+$(eval $(call 
gb_CppunitTest_use_common_precompiled_header,sd_textfitting_tests))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_textfitting_tests, \
+sd/qa/unit/TextFittingTest \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_textfitting_tests, \
+basegfx \
+comphelper \
+cppu \
+cppuhelper \
+drawinglayer \
+editeng \
+for \
+forui \
+i18nlangtag \
+msfilter \
+oox \
+sal \
+salhelper \
+sax \
+sd \
+sfx \
+sot \
+subsequenttest \
+svl \
+svt \
+svx \
+svxcore \
+test \
+tl \
+tk \
+ucbhelper \
+unotest \
+utl \
+vcl \
+xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sd_textfitting_tests,\
+-I$(SRCDIR)/sd/source/ui/inc \
+-I$(SRCDIR)/sd/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_textfitting_tests))
+$(eval $(call 

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

2023-04-27 Thread Julien Nabet (via logerrit)
 editeng/source/items/paraitem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1f36f5dedf8d313e6f29bb1fcf8ac6744624952d
Author: Julien Nabet 
AuthorDate: Wed Apr 26 17:05:41 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Apr 27 20:14:55 2023 +0200

0 is ok for ParaTabStopDefaultDistance

since introduction of ParaTabStopDefaultDistance 
cced51a1ed7c140276aabfe857510afb974fcef5
tdf#102261: introduce editeng paragraph tab stop default distance

Adds mnDefaultDistance to SvxTabStopItem that if defined
will set a paragraph wide tab stop default distance and
override the document wide setting.

Also makes editeng consider mnDefaultDistance while getting
tab stop default distance.

The goal is to avoid:
warn:xmloff:580503:580503:xmloff/source/core/xmlerror.cxx:163: An error or 
a warning has occurred during XML import/export!
Error-Id: 0x20040001
Flags: 2 ERROR
Class: 4 API
Number: 1
Parameters:
0: ParaTabStopDefaultDistance
Exception-Message: at 
/home/julien/lo/libreoffice/svx/source/unodraw/unopool.cxx:190
Position:
Public Identifier:
System Identifier:
Row, Column: 2,12943

To reproduce this:
Open a new Writer document.
Go to Form → Text Box.
Draw a text box.
Right mouse click on the box → Control properties.
General → Border Color: Set to something like "Green" (not: Default).
Save the file and close the file.
Reopen the file

(from https://bugs.documentfoundation.org/show_bug.cgi?id=155029
Form control: Border color of Text controls won't be saved)

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

diff --git a/editeng/source/items/paraitem.cxx 
b/editeng/source/items/paraitem.cxx
index f67ddf599b06..054fc586d1e3 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -977,7 +977,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 return false;
 if (bConvert)
 nNewDefaultDistance = o3tl::toTwips(nNewDefaultDistance, 
o3tl::Length::mm100);
-if (nNewDefaultDistance <= 0)
+if (nNewDefaultDistance < 0)
 return false;
 mnDefaultDistance = nNewDefaultDistance;
 break;


[Libreoffice-commits] core.git: editeng/source include/basegfx vcl/unx

2023-04-23 Thread buldi (via logerrit)
 editeng/source/misc/txtrange.cxx |7 ---
 include/basegfx/color/bcolor.hxx |2 +-
 vcl/unx/generic/app/saldisp.cxx  |5 +
 3 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit c6755955aeaddb14bd3ad231f78cda47a0a5aeaa
Author: buldi 
AuthorDate: Sun Apr 2 18:16:10 2023 +0200
Commit: Hossein 
CommitDate: Mon Apr 24 00:52:19 2023 +0200

tdf#147906 Use std::hypot for Pythagorean addition

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

diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 6374747be3c9..2f02a1150f91 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -192,11 +192,12 @@ tools::Long SvxBoundArgs::CalcMax( const Point& rPt1, 
const Point& rPt2,
 }
 else
 nB = nStart;
-nB *= nB;
-nB += nDa * nDa;
-nB = sqrt( nB );
+
+nB = std::hypot(nB, nDa);
+
 if (nB == 0) // avoid div / 0
 return 0;
+
 nB = nRange + nDa * ( nFarRange - nRange ) / nB;
 
 bool bNote;
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
index d8788b1cfef1..de3452fad128 100644
--- a/include/basegfx/color/bcolor.hxx
+++ b/include/basegfx/color/bcolor.hxx
@@ -136,7 +136,7 @@ namespace basegfx
 const double fDistG(getDistanceGreen(rColor));
 const double fDistB(getDistanceBlue(rColor));
 
-return sqrt(fDistR * fDistR + fDistG * fDistG + fDistB * fDistB);
+return std::hypot(fDistR, fDistG, fDistB);
 }
 
 double getMaximumDistance(const BColor& rColor) const
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 6d7737cb3224..3e2e58d9c319 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -80,9 +80,6 @@ static const char *KeyStr( KeySym n ) { return Null( 
XKeysymToString( n ) ); }
 
 static const char *GetAtomName( Display *d, Atom a )
 { return Null( XGetAtomName( d, a ) ); }
-
-static double Hypothenuse( tools::Long w, tools::Long h )
-{ return sqrt( static_cast((w*w)+(h*h)) ); }
 #endif
 
 static int ColorDiff( int r, int g, int b )
@@ -2207,7 +2204,7 @@ void SalDisplay::PrintInfo() const
 SAL_INFO( "vcl", "Screen" );
 SAL_INFO( "vcl", "\tResolution/Size   \t" << aResolution_.A() << "*" << 
aResolution_.B()
 << " " << 
m_aScreens[m_nXDefaultScreen.getXScreen()].m_aSize.Width() << "*" << 
m_aScreens[m_nXDefaultScreen.getXScreen()].m_aSize.Height()
-<< " " << (Hypothenuse( DisplayWidthMM ( pDisp_, 
m_nXDefaultScreen.getXScreen() ),
+<< " " << (std::hypot( DisplayWidthMM ( pDisp_, 
m_nXDefaultScreen.getXScreen() ),
   DisplayHeightMM( pDisp_, 
m_nXDefaultScreen.getXScreen() ) ) / 25.4 ) << "\"" );
 SAL_INFO( "vcl", "\tBlack   \t" << 
GetColormap(m_nXDefaultScreen).GetBlackPixel() << " "
 << GetColormap(m_nXDefaultScreen).GetWhitePixel() );


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

2023-04-17 Thread Stephan Bergmann (via logerrit)
 editeng/source/items/frmitems.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit e7617af8b463e31faabde6e409cc347c0c648364
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:16:34 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 18:59:14 2023 +0200

Silence clang-cl -Werror,-Wunused-but-set-parameter

...in work-in-progress code (see the comments starting at


"editeng: split SvxLRSpaceItem into 1 class per attribute")

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 75f48150465a..0c72c9d95d7b 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1388,6 +1388,8 @@ bool SvxGutterRightMarginItem::QueryValue(uno::Any& 
/*rVal*/, sal_uInt8 nMemberI
 // SfxDispatchController_Impl::StateChanged calls this with 
hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type 
would it have?
 OSL_FAIL("unknown MemberId");
 }
+#else
+(void) nMemberId;
 #endif
 return bRet;
 }
@@ -1406,6 +1408,8 @@ bool SvxGutterRightMarginItem::PutValue(const uno::Any& 
/*rVal*/, sal_uInt8 nMem
 OSL_FAIL("unknown MemberId");
 return false;
 }
+#else
+(void) nMemberId;
 #endif
 return true;
 }


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

2023-04-14 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unotext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 25d0ae95d6e7695a33cb67b1cb3626c338cf92a9
Author: Noel Grandin 
AuthorDate: Fri Apr 14 13:32:53 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 14 17:28:32 2023 +0200

fix check in SvxUnoTextBase::insertTextContent

looks like copy/paste error in
commit aac15b638410f181133dc15343136b4e9a1675ba
Author: Kohei Yoshida 
Date:   Mon May 7 15:22:54 2012 -0400
Set anchor to XTextContent using UNO API.

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

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 2bbae05a56b2..54fd7126dbd4 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1886,7 +1886,7 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const 
uno::Reference< text::XTe
 GetEditSource()->UpdateData();
 
 uno::Reference xPropSetContent(xContent, 
uno::UNO_QUERY);
-if (!xContent.is())
+if (!xPropSetContent.is())
 throw lang::IllegalArgumentException();
 
 xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::Any(xRange));


[Libreoffice-commits] core.git: editeng/source include/editeng include/oox include/svx oox/inc oox/source sd/qa sd/source svx/source

2023-03-26 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/editeng.cxx   |   23 ++-
 editeng/source/editeng/editobj.cxx   |   11 +
 editeng/source/editeng/editobj2.hxx  |   14 +-
 editeng/source/editeng/impedit.hxx   |   98 +++
 editeng/source/editeng/impedit2.cxx  |   29 ++--
 editeng/source/editeng/impedit3.cxx  |  148 ++-
 editeng/source/editeng/impedit4.cxx  |   24 +++
 editeng/source/outliner/outlin2.cxx  |   14 +-
 editeng/source/outliner/outliner.cxx |   23 ++-
 include/editeng/editeng.hxx  |8 -
 include/editeng/outliner.hxx |6 
 include/oox/export/drawingml.hxx |2 
 include/svx/sdtfsitm.hxx |   20 +--
 include/svx/svdotext.hxx |6 
 include/svx/unoshprp.hxx |2 
 oox/inc/drawingml/textparagraph.hxx  |3 
 oox/inc/drawingml/textparagraphproperties.hxx|1 
 oox/source/drawingml/diagram/diagram.cxx |6 
 oox/source/drawingml/textbody.cxx|4 
 oox/source/drawingml/textparagraph.cxx   |4 
 oox/source/drawingml/textparagraphproperties.cxx |   10 -
 oox/source/export/drawingml.cxx  |   45 +++---
 sd/qa/unit/export-tests-ooxml2.cxx   |   16 +-
 sd/qa/unit/export-tests-ooxml3.cxx   |   11 -
 sd/qa/unit/import-tests-smartart.cxx |8 -
 sd/qa/unit/import-tests2.cxx |   14 +-
 sd/source/ui/view/drtxtob.cxx|   10 -
 svx/source/svdraw/svdotext.cxx   |  137 +++--
 svx/source/svdraw/svdotextdecomposition.cxx  |2 
 svx/source/svdraw/svdoutl.cxx|2 
 svx/source/unodraw/unoshape.cxx  |9 -
 31 files changed, 452 insertions(+), 258 deletions(-)

New commits:
commit 628275acb1b9652e65b8c5c013549dce5ad6f5bf
Author: Tomaž Vajngerl 
AuthorDate: Thu Mar 23 11:24:30 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Mar 26 15:07:39 2023 +

tdf#90407 Change the auto-fit alg. to match better with OOXML

The auto-fit algorithm has been tweaked to be more in-line with
the expectations of OOXML. This means a couple of changes to what
properties are scaled by the algorithm have been made:
- most properties that influence the X axis position or size (for
example indent) are not scaled down or changed by scaling.
- properties that influence y axis position and size are scaled
by a separate parameter (like in the OOXML). This is used in the
auto-fit algorithm in a different way.
- if line spacing is proportional, it is now scaled with the
spacing parameter. Fixed line spacing doesn't get scaled.
- the main scaling X,Y parameter only scales the fonts.
- trying hard to scale the fonts to the nearest pt (point) value

With this change the scaling is much more stable than it was
before - for example it doesn't matter what the unscaled font
size is, when it is scaled down to the text box size, it (should)
always look the same (for example scaling from 32pt -> 10pt or
64pt -> 10pt or even 999pt -> 10pt).

The algorithm is also rewritten to be better at finding a fit and
is also better at find a good fit, but it can take more iterations
by doing so (there are ways to improve it however). Previous
algorithm used a linear search to converge to the best fit in less
iterations, but the issue with that was that it could in some cases
miss a solution (especially since change to floating point scaling
parameter). The new algorithm now uses a binary search - always
trying the middle of the search space.

OOXML export and import was also changed to take advantage of the
font scaling and spacing scaling parameters. The additional
scaling at export that was needed to have consistent OOXML support
was removed.

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 32fad4d8fc35..69fef679c7f3 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2006,14 +2006,13 @@ Point EditEngine::GetDocPosTopLeft( sal_Int32 
nParagraph )
 else
 {
 const SvxLRSpaceItem& rLRItem = pImpEditEngine->GetLRSpaceItem( 
pPPortion->GetNode() );
-// TL_NF_LR aPoint.X() = pImpEditEngine->GetXValue( 
(short)(rLRItem.GetTextLeft() + rLRItem.GetTextFirstLineOffset()) );
 sal_Int32 nSpaceBefore = 0;
 pImpEditEngine->GetSpaceBeforeAndMinLabelWidth( 
pPPortion->GetNode(),  );
 short nX = static_cast(rLRItem.GetTextLeft()
   

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

2023-03-25 Thread Mike Kaganski (via logerrit)
 editeng/source/editeng/editdbg.cxx |  334 +++--
 1 file changed, 173 insertions(+), 161 deletions(-)

New commits:
commit 71d4049dd0f37cbc23180d11f6bb65de4a59155d
Author: Mike Kaganski 
AuthorDate: Sat Mar 25 15:15:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Mar 25 14:22:14 2023 +

Simplify DbgOutItem

Use SfxPoolItem::StaticWhichCast instead of static_casts;
have type-specific append overloads for the different item
types to remove duplication and differentiate output for
similar but distinct items, like EE_CHAR_LANGUAGE/CJK/CTL;
and drop numeric type casts when calling OString::number.

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

diff --git a/editeng/source/editeng/editdbg.cxx 
b/editeng/source/editeng/editdbg.cxx
index 308d4af93794..31ec9d09306d 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -58,241 +58,253 @@
 
 #if defined( DBG_UTIL ) || ( OSL_DEBUG_LEVEL > 1 )
 
+namespace
+{
+struct DebOutBuffer
+{
+OStringBuffer str;
+void append(std::string_view descr, const SfxEnumItemInterface& rItem)
+{
+str.append(descr + OString::number(rItem.GetEnumValue()));
+}
+void append(std::string_view descr, const SvxLRSpaceItem& rItem)
+{
+str.append(OString::Concat(descr) + "FI=" + 
OString::number(rItem.GetTextFirstLineOffset())
+   + ", LI=" + OString::number(rItem.GetTextLeft())
+   + ", RI=" + OString::number(rItem.GetRight()));
+}
+void append(std::string_view descr, const SvxNumBulletItem& rItem)
+{
+str.append(descr);
+for (sal_uInt16 nLevel = 0; nLevel < 3; nLevel++)
+{
+str.append("Level" + OString::number(nLevel) + "=");
+const SvxNumberFormat* pFmt = rItem.GetNumRule().Get(nLevel);
+if (pFmt)
+{
+str.append("(" + OString::number(pFmt->GetFirstLineOffset()) + 
","
+   + OString::number(pFmt->GetAbsLSpace()) + ",");
+if (pFmt->GetNumberingType() == SVX_NUM_BITMAP)
+str.append("Bitmap");
+else if (pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL)
+str.append("Number");
+else
+{
+str.append("Char=[" + 
OString::number(pFmt->GetBulletChar()) + "]");
+}
+str.append(") ");
+}
+}
+}
+void append(std::string_view descr, const SfxBoolItem& rItem)
+{
+str.append(descr + 
OString::number(static_cast(rItem.GetValue(;
+}
+void append(std::string_view descr, const SfxInt16Item& rItem)
+{
+str.append(descr + OString::number(rItem.GetValue()));
+}
+void append(std::string_view descr, const SfxUInt16Item& rItem)
+{
+str.append(descr + OString::number(rItem.GetValue()));
+}
+void append(const SvxULSpaceItem& rItem)
+{
+str.append("SB=" + OString::number(rItem.GetUpper())
+   + ", SA=" + OString::number(rItem.GetLower()));
+}
+void append(std::string_view descr, const SvxLineSpacingItem& rItem)
+{
+str.append(descr);
+if (rItem.GetLineSpaceRule() == SvxLineSpaceRule::Min)
+{
+str.append("Min: " + OString::number(rItem.GetInterLineSpace()));
+}
+else if (rItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop)
+{
+str.append("Prop: " + OString::number(rItem.GetPropLineSpace()));
+}
+else
+str.append("Unsupported Type!");
+}
+void append(const SvxTabStopItem& rTabs)
+{
+str.append("Tabs: " + OString::number(rTabs.Count()));
+if (rTabs.Count())
+{
+str.append("( ");
+for (sal_uInt16 i = 0; i < rTabs.Count(); ++i)
+{
+const SvxTabStop& rTab = rTabs[i];
+str.append(OString::number(rTab.GetTabPos()) + " ");
+}
+str.append(')');
+}
+}
+void append(std::string_view descr, const SvxColorItem& rItem)
+{
+Color aColor(rItem.GetValue());
+str.append(descr + OString::number(aColor.GetRed()) + ", "
+   + OString::number(aColor.GetGreen()) + ", " + 
OString::number(aColor.GetBlue()));
+}
+void append(std::string_view descr, const SvxFontItem& rItem)
+{
+str.append(descr + OUStringToOString(rItem.GetFamilyName(), 
RTL_TEXTENCODING_ASCII_US)
+   + " (CharSet: " + OString::number(rItem.GetCharSet()) + 
")");
+}
+void append(std::string_view descr, const SvxEscapementItem& rItem)
+{
+str.append(descr + OString::number(rItem.GetEsc()) + ", "
+   + 

[Libreoffice-commits] core.git: editeng/source extensions/source filter/source forms/source framework/source

2023-03-25 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/editdbg.cxx  |  235 
--
 extensions/source/logging/csvformatter.cxx  |9 
 extensions/source/logging/plaintextformatter.cxx|9 
 extensions/source/propctrlr/eventhandler.cxx|6 
 extensions/source/propctrlr/formcomponenthandler.cxx|9 
 extensions/source/propctrlr/standardcontrol.cxx |4 
 extensions/source/propctrlr/stringrepresentation.cxx|3 
 filter/source/msfilter/rtfutil.cxx  |   14 
 filter/source/svg/svgwriter.cxx |8 
 forms/source/component/DatabaseForm.cxx |   10 
 forms/source/component/Filter.cxx   |   14 
 forms/source/xforms/model_ui.cxx|3 
 forms/source/xforms/submission/submission_get.cxx   |3 
 framework/source/fwe/helper/titlehelper.cxx |3 
 framework/source/fwi/classes/converter.cxx  |   11 
 framework/source/recording/dispatchrecorder.cxx |   36 -
 framework/source/services/urltransformer.cxx|7 
 framework/source/uielement/headermenucontroller.cxx |   11 
 framework/source/uielement/langselectionstatusbarcontroller.cxx |3 
 framework/source/uielement/recentfilesmenucontroller.cxx|3 
 20 files changed, 184 insertions(+), 217 deletions(-)

New commits:
commit 3a0c5b782001fc398740b46f2adc9e07055505d6
Author: Noel Grandin 
AuthorDate: Fri Mar 24 19:12:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Mar 25 07:27:34 2023 +

loplugin:stringadd in editeng..framework

after my patch to merge the bufferadd loplugin into stringadd

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

diff --git a/editeng/source/editeng/editdbg.cxx 
b/editeng/source/editeng/editdbg.cxx
index e3c8f5a2bff8..308d4af93794 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -64,83 +64,83 @@ static OString DbgOutItem(const SfxItemPool& rPool, const 
SfxPoolItem& rItem)
 switch ( rItem.Which() )
 {
 case EE_PARA_WRITINGDIR:
-aDebStr.append("WritingDir=");
-aDebStr.append(static_cast(static_cast(rItem).GetValue()));
+aDebStr.append("WritingDir="
++ OString::number(static_cast(static_cast(rItem).GetValue(;
 break;
 case EE_PARA_OUTLLRSPACE:
 case EE_PARA_LRSPACE:
-aDebStr.append("FI=");
-aDebStr.append(static_cast(static_cast(rItem).GetTextFirstLineOffset()));
-aDebStr.append(", LI=");
-aDebStr.append(static_cast(static_cast(rItem).GetTextLeft()));
-aDebStr.append(", RI=");
-aDebStr.append(static_cast(static_cast(rItem).GetRight()));
+aDebStr.append("FI="
++ OString::number(static_cast(static_cast(rItem).GetTextFirstLineOffset()))
++ ", LI="
++ OString::number(static_cast(static_cast(rItem).GetTextLeft()))
++ ", RI="
++ OString::number(static_cast(static_cast(rItem).GetRight(;
 break;
 case EE_PARA_NUMBULLET:
 aDebStr.append("NumItem ");
 for ( sal_uInt16 nLevel = 0; nLevel < 3; nLevel++ )
 {
-aDebStr.append("Level");
-aDebStr.append(static_cast(nLevel));
-aDebStr.append('=');
+aDebStr.append("Level"
++ OString::number(static_cast(nLevel))
++ "=");
 const SvxNumberFormat* pFmt = static_cast(rItem).GetNumRule().Get( nLevel );
 if ( pFmt )
 {
-aDebStr.append('(');
-aDebStr.append(pFmt->GetFirstLineOffset());
-aDebStr.append(',');
-aDebStr.append(pFmt->GetAbsLSpace());
-aDebStr.append(',');
+aDebStr.append("("
++ OString::number(pFmt->GetFirstLineOffset())
++ ","
++ OString::number(pFmt->GetAbsLSpace())
++ ",");
 if ( pFmt->GetNumberingType() == SVX_NUM_BITMAP )
 aDebStr.append("Bitmap");
 else if( pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL )
 aDebStr.append("Number");
 else
 {
-aDebStr.append("Char=[");
-
aDebStr.append(static_cast(pFmt->GetBulletChar()));
-aDebStr.append(']');
+aDebStr.append("Char=["
+ 

[Libreoffice-commits] core.git: editeng/source include/editeng

2023-03-16 Thread Sarper Akdemir (via logerrit)
 editeng/source/editeng/editdoc.cxx |   11 +++
 editeng/source/items/paraitem.cxx  |   32 
 include/editeng/memberids.h|1 +
 include/editeng/tstpitem.hxx   |3 +++
 include/editeng/unoprnms.hxx   |1 +
 include/editeng/unotext.hxx|1 +
 6 files changed, 49 insertions(+)

New commits:
commit cced51a1ed7c140276aabfe857510afb974fcef5
Author: Sarper Akdemir 
AuthorDate: Tue Feb 28 16:13:48 2023 +0300
Commit: Miklos Vajna 
CommitDate: Thu Mar 16 11:20:48 2023 +

tdf#102261: introduce editeng paragraph tab stop default distance

Adds mnDefaultDistance to SvxTabStopItem that if defined
will set a paragraph wide tab stop default distance and
override the document wide setting.

Also makes editeng consider mnDefaultDistance while getting
tab stop default distance.

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

diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 1fbf46de184b..9fff222d9368 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -857,6 +857,13 @@ void ConvertItem( std::unique_ptr& rPoolItem, 
MapUnit eSourceUnit,
 assert(dynamic_cast(rPoolItem.get()) != 
nullptr);
 SvxTabStopItem& rItem = static_cast(*rPoolItem);
 SvxTabStopItem* pNewItem(new SvxTabStopItem(EE_PARA_TABS));
+
+if (sal_Int32 nDefTabDistance = rItem.GetDefaultDistance())
+{
+pNewItem->SetDefaultDistance(
+OutputDevice::LogicToLogic(nDefTabDistance, eSourceUnit, 
eDestUnit));
+}
+
 for ( sal_uInt16 i = 0; i < rItem.Count(); i++ )
 {
 const SvxTabStop& rTab = rItem[i];
@@ -1821,6 +1828,10 @@ SvxTabStop ContentAttribs::FindTabStop( sal_Int32 
nCurPos, sal_uInt16 nDefTab )
 return rTab;
 }
 
+// if there's a default tab size defined for this item use that instead
+if (rTabs.GetDefaultDistance())
+nDefTab = rTabs.GetDefaultDistance();
+
 // Determine DefTab ...
 SvxTabStop aTabStop;
 const sal_Int32 x = nCurPos / nDefTab + 1;
diff --git a/editeng/source/items/paraitem.cxx 
b/editeng/source/items/paraitem.cxx
index 9368dfdf3c2a..f67ddf599b06 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -821,6 +821,15 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) 
const
 return it != maTabStops.end() ? it - maTabStops.begin() : SVX_TAB_NOTFOUND;
 }
 
+void SvxTabStopItem::SetDefaultDistance(sal_Int32 nDefaultDistance)
+{
+mnDefaultDistance = nDefaultDistance;
+}
+
+sal_Int32 SvxTabStopItem::GetDefaultDistance() const
+{
+return mnDefaultDistance;
+}
 
 bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
 {
@@ -859,6 +868,11 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= static_cast(bConvert ? 
convertTwipToMm100(rTab.GetTabPos()) : rTab.GetTabPos());
 break;
 }
+case MID_TABSTOP_DEFAULT_DISTANCE:
+{
+rVal <<= static_cast(bConvert ? 
convertTwipToMm100(mnDefaultDistance) : mnDefaultDistance);
+break;
+}
 }
 return true;
 }
@@ -956,6 +970,18 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 Insert( aNewTab );
 break;
 }
+case MID_TABSTOP_DEFAULT_DISTANCE:
+{
+sal_Int32 nNewDefaultDistance = 0;
+if (!(rVal >>= nNewDefaultDistance))
+return false;
+if (bConvert)
+nNewDefaultDistance = o3tl::toTwips(nNewDefaultDistance, 
o3tl::Length::mm100);
+if (nNewDefaultDistance <= 0)
+return false;
+mnDefaultDistance = nNewDefaultDistance;
+break;
+}
 }
 return true;
 }
@@ -967,6 +993,9 @@ bool SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) 
const
 
 const SvxTabStopItem& rTSI = static_cast(rAttr);
 
+if ( mnDefaultDistance != rTSI.GetDefaultDistance() )
+return false;
+
 if ( Count() != rTSI.Count() )
 return false;
 
@@ -990,6 +1019,7 @@ bool SvxTabStopItem::GetPresentation
 )   const
 {
 rText.clear();
+// TODO also consider mnDefaultTabDistance here
 
 bool bComma = false;
 
@@ -1038,6 +1068,8 @@ void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs )
 void SvxTabStopItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxTabStopItem"));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mnDefaultDistance"),
+  
BAD_CAST(OString::number(mnDefaultDistance).getStr()));
 for 

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

2023-03-07 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/eehtml.cxx   |   16 
 editeng/source/editeng/eehtml.hxx   |4 ++--
 editeng/source/editeng/impedit.hxx  |2 +-
 editeng/source/editeng/impedit5.cxx |   14 +++---
 4 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 48fad5ddb1d65568ba1cb6539a19821fd1fbc6d1
Author: Noel Grandin 
AuthorDate: Tue Mar 7 10:14:50 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 7 15:48:59 2023 +

no need to allocate these separately

they are all one or two words in size

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

diff --git a/editeng/source/editeng/eehtml.cxx 
b/editeng/source/editeng/eehtml.cxx
index cc26360df6a2..b3ed28395506 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -184,9 +184,9 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken )
 if ( aText.startsWith(" ") && ThrowAwayBlank() && !IsReadPRE() )
 aText = aText.copy( 1 );
 
-if ( pCurAnchor )
+if ( moCurAnchor )
 {
-pCurAnchor->aText += aText;
+moCurAnchor->aText += aText;
 }
 else
 {
@@ -739,7 +739,7 @@ bool EditHTMLParser::HasTextInCurrentPara()
 void EditHTMLParser::AnchorStart()
 {
 // ignore anchor in anchor
-if ( pCurAnchor )
+if ( moCurAnchor )
 return;
 
 const HTMLOptions& aOptions = GetOptions();
@@ -762,20 +762,20 @@ void EditHTMLParser::AnchorStart()
 aRootURL.GetNewAbsURL( aRef,  );
 aURL = aTargetURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
 }
-pCurAnchor.reset( new AnchorInfo );
-pCurAnchor->aHRef = aURL;
+moCurAnchor.emplace();
+moCurAnchor->aHRef = aURL;
 }
 
 void EditHTMLParser::AnchorEnd()
 {
-if ( !pCurAnchor )
+if ( !moCurAnchor )
 return;
 
 // Insert as URL-Field...
-SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, 
SvxURLFormat::Repr ), EE_FEATURE_FIELD  );
+SvxFieldItem aFld( SvxURLField( moCurAnchor->aHRef, moCurAnchor->aText, 
SvxURLFormat::Repr ), EE_FEATURE_FIELD  );
 aCurSel = mpEditEngine->InsertField(aCurSel, aFld);
 bFieldsInserted = true;
-pCurAnchor.reset();
+moCurAnchor.reset();
 
 if (mpEditEngine->IsHtmlImportHandlerSet())
 {
diff --git a/editeng/source/editeng/eehtml.hxx 
b/editeng/source/editeng/eehtml.hxx
index ebcb4def0e02..fddd567ac6ba 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,8 +41,7 @@ private:
 EditSelection   aCurSel;
 OUStringaBaseURL;
 EditEngine* mpEditEngine;
-std::unique_ptr
-pCurAnchor;
+std::optional moCurAnchor;
 
 boolbInPara:1;
 boolbWasInPara:1; // Remember bInPara before 
HeadingStart, because afterwards it will be gone.
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index f75e71b7f509..fd8ff61f66ca 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -517,7 +517,7 @@ private:
 
 mutable std::unique_ptr pEmptyItemSet;
 EditUndoManager*pUndoManager;
-std::unique_ptr pUndoMarkSelection;
+std::optional moUndoMarkSelection;
 
 std::unique_ptr mpIMEInfos;
 
diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 9a02ca4c4557..3a87c4b5bfb7 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -233,8 +233,8 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const 
ESelection& aSel )
 if ( IsUndoEnabled() && !IsInUndo() )
 {
 GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( 
nId ), OUString(), nId, CreateViewShellId() );
-DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
-pUndoMarkSelection.reset(new ESelection( aSel ));
+DBG_ASSERT( !moUndoMarkSelection, "UndoAction SelectionMarker?" );
+moUndoMarkSelection = aSel;
 }
 }
 
@@ -243,7 +243,7 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId )
 if ( IsUndoEnabled() && !IsInUndo() )
 {
 GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( 
nId ), OUString(), nId, CreateViewShellId() );
-DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
+DBG_ASSERT( !moUndoMarkSelection, "UndoAction SelectionMarker?" );
 }
 }
 
@@ -252,17 +252,17 @@ void ImpEditEngine::UndoActionEnd()
 if ( IsUndoEnabled() && !IsInUndo() )
 {
 GetUndoManager().LeaveListAction();
-pUndoMarkSelection.reset();
+

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

2023-02-19 Thread Caolán McNamara (via logerrit)
 editeng/source/items/frmitems.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0eab1adad76919cbe3243ffd92df088f5259f074
Author: Caolán McNamara 
AuthorDate: Sun Feb 19 19:23:13 2023 +
Commit: Caolán McNamara 
CommitDate: Sun Feb 19 20:11:33 2023 +

downgrade assert to warning

list of documents that assert here from crashtesting is known, so
turn into a warning for now

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 01a2f7d70879..b3b71522ee0e 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -72,6 +72,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -465,7 +466,7 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 void SvxLRSpaceItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp)
 {
 nLeftMargin = (nL * nProp) / 100;
-assert(nFirstLineOffset == 0); // probably call SetTextLeft instead? looks 
inconsistent otherwise
+SAL_WARN_IF(nFirstLineOffset != 0, "editeng", "probably call SetTextLeft 
instead? looks inconsistent otherwise");
 nPropLeftMargin = nProp;
 }
 


[Libreoffice-commits] core.git: editeng/source framework/source i18npool/source io/source lingucomponent/source package/source

2023-02-15 Thread Gabor Kelemen (via logerrit)
 editeng/source/uno/unonrule.cxx  |1 -
 framework/source/fwe/classes/addonsoptions.cxx   |1 -
 framework/source/helper/oframes.cxx  |1 -
 i18npool/source/localedata/saxparser.cxx |3 +--
 io/source/stm/odata.cxx  |3 +--
 io/source/stm/omark.cxx  |   17 -
 lingucomponent/source/languageguessing/guesslang.cxx |   11 +--
 package/source/manifest/ManifestReader.cxx   |3 +--
 8 files changed, 16 insertions(+), 24 deletions(-)

New commits:
commit 259ae22056b34f3477fc7ac0f31666dec41bf8ea
Author: Gabor Kelemen 
AuthorDate: Tue Feb 14 23:25:40 2023 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Feb 15 18:39:38 2023 +

Drop 'using namespace ::std' in dirs [e-p]*

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

diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 04403cf19a69..055fce8d5d4a 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -50,7 +50,6 @@ using ::com::sun::star::util::XCloneable;
 using ::com::sun::star::ucb::XAnyCompare;
 
 
-using namespace ::std;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
diff --git a/framework/source/fwe/classes/addonsoptions.cxx 
b/framework/source/fwe/classes/addonsoptions.cxx
index b97a7eac6099..5aa0638481e8 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -43,7 +43,6 @@
 
 //  namespaces
 
-using namespace ::std;
 using namespace ::utl;
 using namespace ::osl;
 using namespace ::com::sun::star::uno;
diff --git a/framework/source/helper/oframes.cxx 
b/framework/source/helper/oframes.cxx
index a58949852d43..2fd43c8a52a3 100644
--- a/framework/source/helper/oframes.cxx
+++ b/framework/source/helper/oframes.cxx
@@ -32,7 +32,6 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 using namespace ::cppu;
 using namespace ::osl;
-using namespace ::std;
 
 //  constructor
 
diff --git a/i18npool/source/localedata/saxparser.cxx 
b/i18npool/source/localedata/saxparser.cxx
index d13e99bb7345..8cad894951a1 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -40,7 +40,6 @@
 
 #include "LocaleNode.hxx"
 
-using namespace ::std;
 using namespace ::cppu;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -183,7 +182,7 @@ public: // Error handler
 public: // ExtendedDocumentHandler
 
 
-stack currentNode ;
+std::stack currentNode ;
 LocaleNode * rootNode;
 
 virtual void SAL_CALL startDocument() override
diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 7d39a5835852..6b19585da942 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -40,7 +40,6 @@
 
 using namespace ::cppu;
 using namespace ::osl;
-using namespace ::std;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -1039,7 +1038,7 @@ private:
 Reference < XComponentContext > m_rCxt;
 boolm_bValidMarkable;
 Reference < XMarkableStream > m_rMarkable;
-vector < Reference<  XPersistObject > > m_aPersistVector;
+std::vector < Reference<  XPersistObject > > m_aPersistVector;
 
 };
 
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index d4bf6c74169a..3e6127d7310e 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 
-using namespace ::std;
 using namespace ::cppu;
 using namespace ::osl;
 using namespace ::com::sun::star::io;
@@ -116,7 +115,7 @@ private:
 bool m_bValidStream;
 
 MemRingBuffer m_aRingBuffer;
-map > m_mapMarks;
+std::map > m_mapMarks;
 sal_Int32 m_nCurrentPos;
 sal_Int32 m_nCurrentMark;
 
@@ -204,7 +203,7 @@ sal_Int32 OMarkableOutputStream::createMark()
 void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
 {
 std::unique_lock guard( m_mutex );
-map >::iterator ii = m_mapMarks.find( 
Mark );
+std::map >::iterator ii = 
m_mapMarks.find( Mark );
 
 if( ii == m_mapMarks.end() ) {
 throw IllegalArgumentException(
@@ -218,7 +217,7 @@ void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
 void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
 {
 std::unique_lock guard( m_mutex );
-map >::iterator ii = m_mapMarks.find( 
nMark );
+std::map >::iterator ii = 
m_mapMarks.find( nMark );
 
 if( ii == m_mapMarks.end() ) {
 throw IllegalArgumentException(
@@ -239,7 +238,7 @@ sal_Int32 OMarkableOutputStream::offsetToMark(sal_Int32 
nMark)
 {
 
 std::unique_lock guard( m_mutex );
-map >::const_iterator ii = 

[Libreoffice-commits] core.git: editeng/source include/editeng sc/source

2023-02-06 Thread Szymon Kłos (via logerrit)
 editeng/source/editeng/editview.cxx |   47 
 include/editeng/editview.hxx|8 ++
 sc/source/ui/app/inputhdl.cxx   |   24 +-
 sc/source/ui/app/inputwin.cxx   |   10 ---
 sc/source/ui/inc/inputhdl.hxx   |2 -
 5 files changed, 79 insertions(+), 12 deletions(-)

New commits:
commit ec93446f703746ec45a16846b291e5a002a788e7
Author: Szymon Kłos 
AuthorDate: Wed Jan 25 14:39:34 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Feb 6 15:01:41 2023 +

lok: formulabar: fix URL fields selection

field is calculated as 1 character by selection getter
let's unfold fields and send real length

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 4096e0e18bf8..f243d6d8feb6 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1394,6 +1394,53 @@ const SvxFieldData* EditView::GetFieldAtCursor() const
 return pFieldItem ? pFieldItem->GetField() : nullptr;
 }
 
+sal_Int32 EditView::countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPos, bool 
bCanOverflow) const
+{
+if (!pImpEditView || !pImpEditView->pEditEngine)
+return 0;
+
+int nOffset = 0;
+
+for (int nCurrentPara = 0; nCurrentPara <= nPara; nCurrentPara++)
+{
+int nFields = pImpEditView->pEditEngine->GetFieldCount( nCurrentPara );
+for (int nField = 0; nField < nFields; nField++)
+{
+EFieldInfo aFieldInfo
+= pImpEditView->pEditEngine->GetFieldInfo( nCurrentPara, 
nField );
+
+bool bLastPara = nCurrentPara == nPara;
+sal_Int32 nFieldPos = aFieldInfo.aPosition.nIndex;
+
+if (bLastPara && nFieldPos >= nPos)
+break;
+
+sal_Int32 nFieldLen = aFieldInfo.aCurrentText.getLength();
+
+// position in the middle of a field
+if (!bCanOverflow && bLastPara && nFieldPos + nFieldLen > nPos)
+nFieldLen = nPos - nFieldPos;
+
+nOffset += nFieldLen - 1;
+}
+}
+
+return nOffset;
+}
+
+sal_Int32 EditView::GetPosNoField(sal_Int32 nPara, sal_Int32 nPos) const
+{
+sal_Int32 nOffset = countFieldsOffsetSum(nPara, nPos, false);
+assert(nPos >= nOffset);
+return nPos - nOffset;
+}
+
+sal_Int32 EditView::GetPosWithField(sal_Int32 nPara, sal_Int32 nPos) const
+{
+sal_Int32 nOffset = countFieldsOffsetSum(nPara, nPos, true);
+return nPos + nOffset;
+}
+
 void EditView::SetInvalidateMore( sal_uInt16 nPixel )
 {
 pImpEditView->SetInvalidateMore( nPixel );
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 17ed1bb4e7ac..73d4c23f49a9 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -160,6 +160,10 @@ private:
 EditView( const EditView& ) = delete;
 EditView&   operator=( const EditView& ) = delete;
 
+// counts how many characters take unfolded fields
+// bCanOverflow - count field length without trim to the selected pos
+sal_Int32   countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPo, bool 
bCanOverflow) const;
+
 public:
 EditView( EditEngine* pEng, vcl::Window* pWindow );
 ~EditView();
@@ -316,6 +320,10 @@ public:
 /// Select and return the field at the current cursor position
 const SvxFieldData* GetFieldAtCursor() const;
 void SelectFieldAtCursor();
+/// Converts position in paragraph to logical position without unfolding 
fields
+sal_Int32   GetPosNoField(sal_Int32 nPara, sal_Int32 nPos) const;
+/// Converts logical position in paragraph to position with unfolded fields
+sal_Int32   GetPosWithField(sal_Int32 nPara, sal_Int32 nPos) const;
 
 voidSetInvalidateMore( sal_uInt16 nPixel );
 sal_uInt16  GetInvalidateMore() const;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 75655d807b73..f80b6c1b49a8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1781,13 +1781,23 @@ void ScInputHandler::LOKPasteFunctionData(const 
OUString& rFunctionName)
 }
 }
 
-void ScInputHandler::LOKSendFormulabarUpdate(const SfxViewShell* pActiveViewSh,
+void ScInputHandler::LOKSendFormulabarUpdate(EditView* pActiveView,
+ const SfxViewShell* pActiveViewSh,
  const OUString& rText,
  const ESelection& rSelection)
 {
-OUString aSelection =
-OUString::number(rSelection.nStartPos) + ";" + 

[Libreoffice-commits] core.git: editeng/source include/editeng

2023-01-13 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unonrule.cxx |8 +++-
 include/editeng/unonrule.hxx|   10 +++---
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit ce4193e3398e30c25ec28310a8034b4ca5513d7a
Author: Noel Grandin 
AuthorDate: Thu Jan 12 12:03:59 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 13 12:34:03 2023 +

XUnoTunnel->dynamic_cast in SvxUnoNumberingRules

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

diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 5bd84cc10b42..04403cf19a69 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -89,8 +89,6 @@ static unsigned short ConvertUnoAdjust( SvxAdjust eAdjust )
 return aSvxToUnoAdjust[eAdjust];
 }
 
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoNumberingRules );
-
 SvxUnoNumberingRules::SvxUnoNumberingRules(SvxNumRule aRule)
 : maRule(std::move( aRule ))
 {
@@ -474,7 +472,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const 
Sequence const & xRule )
 {
-SvxUnoNumberingRules* pRule = 
comphelper::getFromUnoTunnel( xRule );
+SvxUnoNumberingRules* pRule = dynamic_cast( 
xRule.get() );
 if( pRule == nullptr )
 throw IllegalArgumentException();
 
@@ -510,10 +508,10 @@ sal_Int16 SvxUnoNumberingRules::Compare( const Any& Any1, 
const Any& Any2 )
 if( x1.get() == x2.get() )
 return 0;
 
-SvxUnoNumberingRules* pRule1 = 
comphelper::getFromUnoTunnel( x1 );
+SvxUnoNumberingRules* pRule1 = dynamic_cast( 
x1.get() );
 if( !pRule1 )
 return -1;
-SvxUnoNumberingRules* pRule2 = 
comphelper::getFromUnoTunnel( x2 );
+SvxUnoNumberingRules* pRule2 = dynamic_cast( 
x2.get() );
 if( !pRule2 )
 return -1;
 
diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx
index d0e89ffdc33b..3e793877907d 100644
--- a/include/editeng/unonrule.hxx
+++ b/include/editeng/unonrule.hxx
@@ -23,12 +23,10 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 namespace com::sun::star::beans { struct PropertyValue; }
 
@@ -38,8 +36,8 @@ css::uno::Reference< css::container::XIndexReplace > 
SvxCreateNumRule();
 const SvxNumRule& SvxGetNumRule( css::uno::Reference< 
css::container::XIndexReplace > const & xRule );
 EDITENG_DLLPUBLIC css::uno::Reference< css::ucb::XAnyCompare > 
SvxCreateNumRuleCompare() noexcept;
 
-class SvxUnoNumberingRules final : public ::cppu::WeakAggImplHelper5< 
css::container::XIndexReplace, css::ucb::XAnyCompare,
-css::lang::XUnoTunnel, css::util::XCloneable, css::lang::XServiceInfo >
+class SvxUnoNumberingRules final : public ::cppu::WeakAggImplHelper4< 
css::container::XIndexReplace, css::ucb::XAnyCompare,
+css::util::XCloneable, css::lang::XServiceInfo >
 {
 private:
 SvxNumRule maRule;
@@ -47,8 +45,6 @@ public:
 SvxUnoNumberingRules(SvxNumRule aRule);
 virtual ~SvxUnoNumberingRules() noexcept override;
 
-UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules )
-
 //XIndexReplace
 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const 
css::uno::Any& Element ) override;
 


[Libreoffice-commits] core.git: editeng/source include/editeng

2023-01-13 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unofield.cxx |   12 
 include/editeng/unofield.hxx|7 +--
 2 files changed, 1 insertion(+), 18 deletions(-)

New commits:
commit c89f9fe8fa0c0985af1997d3b65089a6ed0fd35e
Author: Noel Grandin 
AuthorDate: Thu Jan 12 12:00:04 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 13 12:17:19 2023 +

remove XUnoTunnel from SvxUnoTextField

nothing seems to be using it

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

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 022386fe3f0b..0264e52f0319 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -223,17 +223,6 @@ static tools::Time setTime( util::DateTime const & rDate )
 
 
 
-const css::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() 
noexcept
-{
-static const comphelper::UnoIdInit theSvxUnoTextFieldUnoTunnelId;
-return theSvxUnoTextFieldUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const css::uno::Sequence< 
sal_Int8 >& rId )
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
 SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) noexcept
 :   OComponentHelper( m_aMutex )
 ,   mpPropSet(nullptr)
@@ -547,7 +536,6 @@ uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const 
uno::Type & rType )
 else QUERYINT( text::XTextContent );
 else QUERYINT( text::XTextField );
 else QUERYINT( lang::XServiceInfo );
-else QUERYINT( lang::XUnoTunnel );
 else
 return OComponentHelper::queryAggregation( rType );
 
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
index 740a25a5bdb5..62a702904b08 100644
--- a/include/editeng/unofield.hxx
+++ b/include/editeng/unofield.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_EDITENG_UNOFIELD_HXX
 #define INCLUDED_EDITENG_UNOFIELD_HXX
 
-#include 
 #include 
 #include 
 #include 
@@ -46,8 +45,7 @@ class EDITENG_DLLPUBLIC SvxUnoTextField final : public 
cppu::BaseMutex,
 public ::cppu::OComponentHelper,
 public css::text::XTextField,
 public css::beans::XPropertySet,
-public css::lang::XServiceInfo,
-public css::lang::XUnoTunnel
+public css::lang::XServiceInfo
 {
 css::uno::Reference< css::text::XTextRange > mxAnchor;
 const SfxItemPropertySet*   mpPropSet;
@@ -63,9 +61,6 @@ public:
 // Internal
 std::unique_ptr CreateFieldData() const noexcept;
 
-static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
 // css::uno::XInterface
 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & 
rType ) override;
 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;


[Libreoffice-commits] core.git: editeng/source forms/qa include/editeng include/svx oox/Library_oox.mk oox/qa oox/source sd/qa sd/source svx/qa svx/source sw/qa sw/source writerfilter/Library_writerfi

2023-01-12 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx |   19 +++
 editeng/source/uno/unotext.cxx|6 +
 forms/qa/unoapi/knownissues.xcl   |2 
 include/editeng/memberids.h   |1 
 include/editeng/unoprnms.hxx  |3 
 include/editeng/unotext.hxx   |1 
 include/svx/unoshprp.hxx  |1 
 oox/Library_oox.mk|1 
 oox/qa/unit/drawingml.cxx |   71 +++--
 oox/qa/unit/shape.cxx |   11 +-
 oox/source/drawingml/fillproperties.cxx   |   21 +++
 oox/source/drawingml/textcharacterproperties.cxx  |   23 +++-
 oox/source/export/drawingml.cxx   |   99 --
 oox/source/token/properties.txt   |2 
 sd/qa/unit/uiimpress.cxx  |   61 +--
 sd/source/core/stlsheet.cxx   |9 +
 svx/qa/unit/styles.cxx|   43 ---
 svx/qa/unit/xoutdev.cxx   |   47 
 svx/source/styles/ColorSets.cxx   |   62 ---
 svx/source/table/cell.cxx |9 +
 svx/source/unodraw/unoprov.cxx|1 
 svx/source/unodraw/unoshap2.cxx   |1 
 svx/source/unodraw/unoshape.cxx   |9 +
 svx/source/xoutdev/xattr.cxx  |   15 ++
 sw/qa/core/theme/ThemeTest.cxx|9 +
 sw/source/core/unocore/unomap.cxx |1 
 sw/source/core/unocore/unomap1.cxx|2 
 sw/source/core/unocore/unomapproperties.hxx   |3 
 writerfilter/Library_writerfilter.mk  |1 
 writerfilter/source/dmapper/DomainMapper.cxx  |  119 --
 writerfilter/source/dmapper/PropertyIds.cxx   |3 
 writerfilter/source/dmapper/PropertyIds.hxx   |3 
 writerfilter/source/dmapper/TDefTableHandler.cxx  |   38 +++
 writerfilter/source/dmapper/TDefTableHandler.hxx  |4 
 writerfilter/source/dmapper/ThemeColorHandler.hxx |   68 
 35 files changed, 488 insertions(+), 281 deletions(-)

New commits:
commit 197e5f81213d14fdcbff40edf73385ecd4cd9815
Author: Tomaž Vajngerl 
AuthorDate: Sun Jan 1 23:25:38 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 00:49:24 2023 +

introduce {Char,Fill}ColorThemeReference which uses XThemeColor

Adds a unified UNO property for theme colors *ColorTheme
(CharColorTheme and FillColorTheme) which uses XThemeColor, that
replaces the properties *Theme, *TintOrShade, *LumOff, *LumMod.
The properties are still present for backwards compatibility and
to keep ODF support working in tests as that needs a bigger change.

Reactor the code and tests to accomodate for this change.

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index bf6017cdcf6d..5a53d6a8e14c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -1435,6 +1436,12 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= nValue;
 break;
 }
+   case MID_COLOR_THEME_REFERENCE:
+{
+auto xThemeColor = model::theme::createXThemeColor(maThemeColor);
+rVal <<= xThemeColor;
+break;
+}
 default:
 {
 rVal <<= mColor;
@@ -1509,6 +1516,18 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 maThemeColor.addTransformation({model::TransformationType::LumOff, 
nLumOff});
 }
 break;
+case MID_COLOR_THEME_REFERENCE:
+{
+css::uno::Reference xThemeColor;
+if (!(rVal >>= xThemeColor))
+return false;
+
+if (xThemeColor.is())
+{
+model::theme::setFromXThemeColor(maThemeColor, xThemeColor);
+}
+}
+break;
 default:
 {
 return rVal >>= mColor;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e5877a7d2e5a..82a399f00e26 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1175,6 +1175,12 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const 
SfxItemSet* pSet, const Sf
 }
 break;
 }
+case MID_COLOR_THEME_REFERENCE:
+if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+

[Libreoffice-commits] core.git: editeng/source include/vcl vcl/inc vcl/source

2023-01-03 Thread Andrea Rosetti (via logerrit)
 editeng/source/items/svxfont.cxx  |2 +-
 include/vcl/outdev.hxx|2 +-
 include/vcl/pdfwriter.hxx |2 +-
 vcl/inc/pdf/pdfwriter_impl.hxx|2 +-
 vcl/source/gdi/pdfwriter.cxx  |2 +-
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 vcl/source/outdev/text.cxx|2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit d3a5a97f77378421f17b1fa43d0b88dde8bc686a
Author: Andrea Rosetti 
AuthorDate: Wed Nov 30 15:32:25 2022 +0100
Commit: Hossein 
CommitDate: Tue Jan 3 22:42:13 2023 +

tdf#114441 Convert sal_uLong to a better type

Used sal_Int32 instead of sal_uLong

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

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index b484a645a7f6..b57449f3c359 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -789,7 +789,7 @@ void SvxDoDrawCapital::DoSpace( const bool bDraw )
 if ( !(bDraw || pFont->IsWordLineMode()) )
 return;
 
-sal_uLong nDiff = static_cast(aPos.X() - aSpacePos.X());
+sal_Int32 nDiff = static_cast(aPos.X() - aSpacePos.X());
 if ( nDiff )
 {
 bool bWordWise = pFont->IsWordLineMode();
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b2053f412b49..d550ecfce293 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1050,7 +1050,7 @@ public:
 voidGetCaretPositions( const OUString&, sal_Int32* 
pCaretXArray,
   sal_Int32 nIndex, sal_Int32 nLen,
   const SalLayoutGlyphs* pGlyphs = 
nullptr ) const;
-voidDrawStretchText( const Point& rStartPt, 
sal_uLong nWidth,
+voidDrawStretchText( const Point& rStartPt, 
sal_Int32 nWidth,
  const OUString& rStr,
  sal_Int32 nIndex = 0, 
sal_Int32 nLen = -1);
 sal_Int32   GetTextBreak( const OUString& rStr, 
tools::Long nTextWidth,
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 8aeade99f504..f98f2c231261 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -769,7 +769,7 @@ The following structure describes the permissions used in 
PDF security
o3tl::span pKashidaAry,
sal_Int32 nIndex,
sal_Int32 nLen );
-voidDrawStretchText( const Point& rStartPt, sal_uLong 
nWidth,
+voidDrawStretchText( const Point& rStartPt, sal_Int32 
nWidth,
  const OUString& rStr,
  sal_Int32 nIndex, sal_Int32 nLen );
 voidDrawText( const tools::Rectangle& rRect,
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index e8ce5163177f..ea7c3d3462ab 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -1231,7 +1231,7 @@ public:
 /* actual drawing functions */
 void drawText( const Point& rPos, const OUString& rText, sal_Int32 nIndex, 
sal_Int32 nLen, bool bTextLines = true );
 void drawTextArray( const Point& rPos, const OUString& rText, 
KernArraySpan pDXArray, o3tl::span pKashidaArray, sal_Int32 
nIndex, sal_Int32 nLen );
-void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& 
rText,
+void drawStretchText( const Point& rPos, sal_Int32 nWidth, const OUString& 
rText,
   sal_Int32 nIndex, sal_Int32 nLen  );
 void drawText( const tools::Rectangle& rRect, const OUString& rOrigStr, 
DrawTextFlags nStyle );
 void drawTextLine( const Point& rPos, tools::Long nWidth, FontStrikeout 
eStrikeout, FontLineStyle eUnderline, FontLineStyle eOverline, bool 
bUnderlineAbove );
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 8b206debfbc1..294d071db154 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -91,7 +91,7 @@ void PDFWriter::DrawTextArray(
 
 void PDFWriter::DrawStretchText(
 const Point& rStartPt,
-sal_uLong nWidth,
+sal_Int32 nWidth,
 const OUString& rStr,
 sal_Int32 nIndex,
 sal_Int32 nLen )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d95a74aeb6af..99c1b1e27e84 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6990,7 +6990,7 @@ void PDFWriterImpl::drawTextArray( const Point& 

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

2022-12-29 Thread Tor Lillqvist (via logerrit)
 editeng/source/misc/acorrcfg.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3998ccfe14dab2e0a9b31cebe08534aa41177ce5
Author: Tor Lillqvist 
AuthorDate: Thu Dec 29 13:50:00 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Dec 29 13:27:03 2022 +

Make two TOOLS_WARN_EXCEPTION messages a bit more informative

Change-Id: I614f44cfb94a214baace420f94f18991f368b953
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144859
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 53a43cff3f22..787663a96f22 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -97,7 +97,7 @@ static void scanAutoCorrectDirForLanguageTags( const 
OUString& rURL )
 }
 catch (const uno::Exception&)
 {
-TOOLS_WARN_EXCEPTION("editeng", "Unable to get 
directory entry.");
+TOOLS_WARN_EXCEPTION("editeng", "Unable to get a 
directory entry from '" << rURL << "'");
 }
 }
 }
@@ -105,7 +105,7 @@ static void scanAutoCorrectDirForLanguageTags( const 
OUString& rURL )
 }
 catch (const uno::Exception&)
 {
-TOOLS_WARN_EXCEPTION("editeng", "Unable to iterate directory.");
+TOOLS_WARN_EXCEPTION("editeng", "Unable to iterate directory '" << 
rURL << "'");
 }
 }
 


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

2022-12-25 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx   |   25 +
 include/editeng/colritem.hxx|   26 ++
 sw/source/uibase/sidebar/ThemePanel.cxx |2 +-
 3 files changed, 28 insertions(+), 25 deletions(-)

New commits:
commit 6fb682487e355933d79a8ef74560ecf318b4f705
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 5 13:59:22 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Dec 25 13:25:25 2022 +

editeng: move "tint or shade" variable into SvxThemeColor

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 147fa301d548..30b780f1b855 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1354,9 +1354,10 @@ bool SvxContourItem::GetPresentation
 }
 
 SvxThemeColor::SvxThemeColor()
-: maThemeIndex(-1),
-mnLumMod(1),
-mnLumOff(0)
+: maThemeIndex(-1)
+, mnLumMod(1)
+, mnLumOff(0)
+, mnTintOrShade(0)
 {
 }
 
@@ -1364,7 +1365,8 @@ bool SvxThemeColor::operator==(const SvxThemeColor& 
rThemeColor) const
 {
 return maThemeIndex == rThemeColor.maThemeIndex &&
 mnLumMod == rThemeColor.mnLumMod &&
-mnLumOff == rThemeColor.mnLumOff;
+mnLumOff == rThemeColor.mnLumOff &&
+mnTintOrShade  == rThemeColor.mnTintOrShade;
 }
 
 void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -1377,6 +1379,8 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
   
BAD_CAST(OString::number(mnLumMod).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"),
   
BAD_CAST(OString::number(mnLumOff).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"),
+  
BAD_CAST(OString::number(mnTintOrShade).getStr()));
 
 (void)xmlTextWriterEndElement(pWriter);
 }
@@ -1384,15 +1388,13 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 // class SvxColorItem 
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 SfxPoolItem(nId),
-mColor( COL_BLACK ),
-maTintShade(0)
+mColor( COL_BLACK )
 {
 }
 
 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
 SfxPoolItem( nId ),
-mColor( rCol ),
-maTintShade(0)
+mColor( rCol )
 {
 }
 
@@ -1406,8 +1408,7 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) 
const
 const SvxColorItem& rColorItem = static_cast(rAttr);
 
 return mColor == rColorItem.mColor &&
-   maThemeColor == rColorItem.maThemeColor &&
-   maTintShade == rColorItem.maTintShade;
+   maThemeColor == rColorItem.maThemeColor;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1433,7 +1434,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 }
 case MID_COLOR_TINT_OR_SHADE:
 {
-rVal <<= maTintShade;
+rVal <<= maThemeColor.GetTintOrShade();
 break;
 }
 case MID_COLOR_LUM_MOD:
@@ -1489,7 +1490,7 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 sal_Int16 nTintShade = -1;
 if (!(rVal >>= nTintShade))
 return false;
-maTintShade = nTintShade;
+maThemeColor.SetTintOrShade(nTintShade);
 }
 break;
 case MID_COLOR_LUM_MOD:
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index cbd52844b059..05a7183c8582 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -34,6 +34,8 @@ class EDITENG_DLLPUBLIC SvxThemeColor
 /// Luminance Offset: 100th percentage, defaults to 0%.
 sal_Int16 mnLumOff;
 
+sal_Int16 mnTintOrShade;
+
 public:
 explicit SvxThemeColor();
 bool operator==(const SvxThemeColor& rThemeColor) const;
@@ -46,8 +48,8 @@ public:
 void SetThemeIndex(sal_Int16 nIndex)
 {
 maThemeIndex = nIndex;
-}
 
+}
 void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; }
 
 sal_Int16 GetLumMod() const { return mnLumMod; }
@@ -56,6 +58,16 @@ public:
 
 sal_Int16 GetLumOff() const { return mnLumOff; }
 
+sal_Int16 GetTintOrShade() const
+{
+return mnTintOrShade;
+}
+
+void SetTintOrShade(sal_Int16 nTintOrShade)
+{
+mnTintOrShade = nTintOrShade;
+}
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
@@ -66,7 +78,7 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public 
SfxPoolItem
 private:
 Color mColor;
 SvxThemeColor maThemeColor;
-sal_Int16 maTintShade;
+
 
 public:
 static SfxPoolItem* CreateDefault();
@@ -93,16 +105,6 @@ public:
  

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

2022-12-21 Thread Andras Timar (via logerrit)
 editeng/source/editeng/impedit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 17a8cb1573c5b75e5b7a6c480e09c681edcc26c0
Author: Andras Timar 
AuthorDate: Wed Dec 21 20:14:11 2022 +0100
Commit: Eike Rathke 
CommitDate: Thu Dec 22 00:56:50 2022 +

check for null pointer

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

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 1223d717f5e5..7d378af4da14 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1419,7 +1419,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 EditView* pActiveView = GetEditViewPtr();
 
 boost::property_tree::ptree aHyperlinkTree;
-if (URLFieldHelper::IsCursorAtURLField(*pActiveView))
+if (pActiveView && 
URLFieldHelper::IsCursorAtURLField(*pActiveView))
 {
 if (const SvxFieldItem* pFld = GetField(aPos, nullptr, 
nullptr))
 if (auto pUrlField = dynamic_cast(pFld->GetField()))


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

2022-12-20 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit3.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit d35d01937ac77a12b06c1884dae2ec53998cf088
Author: Noel Grandin 
AuthorDate: Tue Dec 20 11:10:03 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 20 12:14:40 2022 +

editeng: avoid divide by zero

Prevent mnColumns from ending up in a zero state.

See

https://crashreport.libreoffice.org/stats/signature/ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion%20*)

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

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 2ce9a60f3eee..3191b7a874e7 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2832,8 +2832,14 @@ void ImpEditEngine::SetRotation(TextRotation nRotation)
 
 void ImpEditEngine::SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
 {
+assert(nColumns >= 1);
 if (mnColumns != nColumns || mnColumnSpacing != nSpacing)
 {
+if (nColumns == 0)
+{
+SAL_WARN("editeng", "bad nColumns value, ignoring");
+nColumns = 1;
+}
 mnColumns = nColumns;
 mnColumnSpacing = nSpacing;
 if (IsFormatted())


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

2022-12-14 Thread Gülşah Köse (via logerrit)
 editeng/source/editeng/impedit.cxx |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit e9356f9ced3167cd927e98617bab54048cc63073
Author: Gülşah Köse 
AuthorDate: Mon Dec 12 14:22:53 2022 +0300
Commit: Dennis Francis 
CommitDate: Wed Dec 14 12:15:12 2022 +

tdf#152483 Fix the insert hyperlink behaviour on Calc

Cursor invalidation message shouldn't carry a hyperlink info to online
side if there is no hyperlink under the cursor

Change-Id: Ibdb6e32d029e101212d03bc117a5a14a712822ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143986
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 1a425cbe64f4..1223d717f5e5 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1415,19 +1416,17 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 // is cursor at a misspelled word ?
 Reference< linguistic2::XSpellChecker1 >  xSpeller( 
pEditEngine->pImpEditEngine->GetSpeller() );
 bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, 
/*bMarkIfWrong*/ false);
+EditView* pActiveView = GetEditViewPtr();
 
 boost::property_tree::ptree aHyperlinkTree;
-if (const SvxFieldItem* pFld = GetField(aPos, nullptr, 
nullptr))
+if (URLFieldHelper::IsCursorAtURLField(*pActiveView))
 {
-if (auto pUrlField = dynamic_cast(pFld->GetField()))
-{
-aHyperlinkTree = 
getHyperlinkPropTree(pUrlField->GetRepresentation(), pUrlField->GetURL());
-}
+if (const SvxFieldItem* pFld = GetField(aPos, nullptr, 
nullptr))
+if (auto pUrlField = dynamic_cast(pFld->GetField()))
+aHyperlinkTree = 
getHyperlinkPropTree(pUrlField->GetRepresentation(), pUrlField->GetURL());
 }
 else if (GetEditSelection().HasRange())
 {
-EditView* pActiveView = GetEditViewPtr();
-
 if (pActiveView)
 {
 const SvxFieldItem* pFieldItem = 
pActiveView->GetFieldAtSelection();


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

2022-12-08 Thread Patrick Luby (via logerrit)
 editeng/source/editeng/impedit2.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 60d2dd11a73bf7a1269896f15b1ec7c98507571e
Author: Patrick Luby 
AuthorDate: Wed Dec 7 16:12:11 2022 -0500
Commit: Caolán McNamara 
CommitDate: Thu Dec 8 09:32:32 2022 +

Related: tdf#82115 Fix crash when handling input method events

The nodes in mpIMEInfos may be deleted in ImpEditEngine::Clear() which 
causes a crash in the CommandEventId::ExtTextInput and 
CommandEventId::EndExtTextInput event handlers.

This crash occurs on Windows or macOS using the following steps:
- Enter uncommitted text (enter "aaa" with a Japanese Hiragana input 
method) in a comment in a Writer document
- Switch to another empty Writer document without committing the text in 
the first Writer document
- Switch back to the first Writer document

The above steps may need to be repeated a few times but it will eventually 
crash with the following stack trace:

(lldb) bt 25
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program 
assert
frame #0: 0x0001b928ad98 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x0001b92bfee0 libsystem_pthread.dylib`pthread_kill + 288
frame #2: 0x0001b91fa340 libsystem_c.dylib`abort + 168
  * frame #3: 0x0001b91f9754 libsystem_c.dylib`__assert_rtn + 272
frame #4: 0x00010374a09c 
libeditenglo.dylib`ImpEditEngine::ImpRemoveParagraph(this=0x00011a684e00, 
nPara=-2147483648) at impedit2.cxx:2512:5
frame #5: 0x000103739658 
libeditenglo.dylib`ImpEditEngine::ImpDeleteSelection(this=0x00011a684e00, 
rCurSel=0x00016fdf7250) at impedit2.cxx:2473:9
frame #6: 0x000103739328 
libeditenglo.dylib`ImpEditEngine::DeleteSelected(this=0x00011a684e00, 
rSel=0x00016fdf7250) at impedit2.cxx:259:19
frame #7: 0x00010373aac4 
libeditenglo.dylib`ImpEditEngine::Command(this=0x00011a684e00, 
rCEvt=0x00016fdf7698, pView=0x60169e10) at impedit2.cxx:408:24
frame #8: 0x000103721744 
libeditenglo.dylib`ImpEditView::Command(this=0x0002e3f8b7b0, 
rCEvt=0x00016fdf7698) at impedit.cxx:1757:41
frame #9: 0x0001036d7df4 
libeditenglo.dylib`EditView::Command(this=0x60169e10, 
rCEvt=0x00016fdf7698) at editview.cxx:495:26
frame #10: 0x00010b1d2420 
libsvxlo.dylib`WeldEditView::Command(this=0x62b11e30, 
rCEvt=0x00016fdf7698) at weldeditview.cxx:312:23
frame #11: 0x0002ea78dd50 
libswlo.dylib`sw::sidebarwindows::SidebarTextControl::Command(this=0x62b11e30,
 rCEvt=0x00016fdf7698) at SidebarTxtControl.cxx:461:26
frame #12: 0x00011656f3d4 
libvcllo.dylib`weld::CustomWeld::DoCommand(this=0x6016a740, 
rPos=0x00016fdf7698) at customweld.cxx:93:32
frame #13: 0x00011656ee7c 
libvcllo.dylib`weld::CustomWeld::LinkStubDoCommand(instance=0x6016a740, 
data=0x00016fdf7698) at customweld.cxx:91:1
frame #14: 0x000115ca1dd4 libvcllo.dylib`Link::Call(this=0x0002e3f8bc48, data=0x00016fdf7698) const at 
link.hxx:111:45
frame #15: 0x0001165b1658 
libvcllo.dylib`SalInstanceDrawingArea::CommandHdl(this=0x0002e3f8bb50, 
rEvent=0x00016fdf7698) at salvtables.cxx:6473:26
frame #16: 0x0001165af588 
libvcllo.dylib`SalInstanceDrawingArea::LinkStubCommandHdl(instance=0x0002e3f8bb50,
 data=0x00016fdf7698) at salvtables.cxx:6471:1
frame #17: 0x000115ca1dd4 libvcllo.dylib`Link::Call(this=0x0002e3f90208, data=0x00016fdf7698) const at 
link.hxx:111:45
frame #18: 0x000115d047d0 
libvcllo.dylib`VclDrawingArea::Command(this=0x0002e3f90080, 
rEvent=0x00016fdf7698) at layout.hxx:685:27
frame #19: 0x000115e2e2bc 
libvcllo.dylib`ImplCallCommand(pChild=0x00016fdf77c8, nEvt=ExtTextInput, 
pData=0x00016fdf77d8, bMouse=false, pPos=0x) at 
winproc.cxx:229:17
frame #20: 0x000115e34458 
libvcllo.dylib`ImplHandleExtTextInput(pWindow=0x62aa8930, 
rText=0x00016fdf8290, pTextAttr=0x60018710, nCursorPos=4, 
nCursorFlags=1) at winproc.cxx:1424:13
frame #21: 0x000115e30dc8 
libvcllo.dylib`ImplWindowFrameProc(_pWindow=0x62aa8930, 
nEvent=ExtTextInput, pEvent=0x00016fdf8290) at winproc.cxx:2863:20
frame #22: 0x00011b0424e0 
libvclplug_osxlo.dylib`SalFrame::CallCallback(this=0x0001378ffb40, 
nEvent=ExtTextInput, pEvent=0x00016fdf8290) const at salframe.hxx:306:29
frame #23: 0x00011b0ef8f4 libvclplug_osxlo.dylib`-[SalFrameView 
setMarkedText:selectedRange:replacementRange:](self=0x0002c4b0d980, 
_cmd="setMarkedText:selectedRange:replacementRange:", aString="嗚呼嗚呼", 
selRange=location=4, length=0, replacementRange=location=9223372036854775807, 
length=0) at salframeview.mm:1595:18
frame #24: 0x0001bc8d6a2c 

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

2022-11-25 Thread Fred Kruse (via logerrit)
 editeng/source/misc/svxacorr.cxx  |   39 +++-
 sw/qa/extras/uiwriter/data/tdf151801.fodt |  260 ++
 sw/qa/extras/uiwriter/uiwriter8.cxx   |   49 +
 3 files changed, 339 insertions(+), 9 deletions(-)

New commits:
commit 5f249506ff2eddeaac47d521509bf1dde0b58d01
Author: Fred Kruse 
AuthorDate: Sun Nov 13 18:37:31 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 25 11:08:12 2022 +0100

tdf#151801 solves bug for autocorrect non default quotes

Regards German and some other languages. A bug in the mechanism to 
distingish between apostroph and single end quote is solved.
Now, it works also for user defined quotes, like a single angle quote 
('French' quote).

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index cf5d7474e49d..5e229ba10d24 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1280,7 +1280,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & 
rDoc, sal_Int32 nInsPo
 
 // search preceding opening quote in the paragraph before the insert position
 static bool lcl_HasPrecedingChar( std::u16string_view rTxt, sal_Int32 nPos,
-const sal_Unicode sPrecedingChar, const sal_Unicode* 
aStopChars )
+const sal_Unicode sPrecedingChar, const sal_Unicode sStopChar, 
const sal_Unicode* aStopChars )
 {
 sal_Unicode cTmpChar;
 
@@ -1289,6 +1289,9 @@ static bool lcl_HasPrecedingChar( std::u16string_view 
rTxt, sal_Int32 nPos,
 if ( cTmpChar == sPrecedingChar )
 return true;
 
+if ( cTmpChar == sStopChar )
+return false;
+
 for ( const sal_Unicode* pCh = aStopChars; *pCh; ++pCh )
 if ( cTmpChar == *pCh )
 return false;
@@ -1358,13 +1361,15 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& 
rDoc, const OUString& rTxt,
 ( ( eLang == LANGUAGE_HUNGARIAN &&
 lcl_HasPrecedingChar( rTxt, nInsPos,
 bSttQuote ? aStopDoubleAngleQuoteStart[0] : 
aStopDoubleAngleQuoteEnd[0],
-bSttQuote ? aStopDoubleAngleQuoteStart + 1 : 
aStopDoubleAngleQuoteEnd + 1 ) ) ||
+bSttQuote ? aStopDoubleAngleQuoteStart[1] : 
aStopDoubleAngleQuoteEnd[1],
+bSttQuote ? aStopDoubleAngleQuoteStart + 1 : 
aStopDoubleAngleQuoteEnd + 2 ) ) ||
   ( eLang.anyOf(
 LANGUAGE_ROMANIAN,
 LANGUAGE_ROMANIAN_MOLDOVA ) &&
 lcl_HasPrecedingChar( rTxt, nInsPos,
 bSttQuote ? aStopDoubleAngleQuoteStart[0] : 
aStopDoubleAngleQuoteEndRo[0],
-bSttQuote ? aStopDoubleAngleQuoteStart + 1 : 
aStopDoubleAngleQuoteEndRo + 1 ) ) ) )
+bSttQuote ? aStopDoubleAngleQuoteStart[1] : 
aStopDoubleAngleQuoteEndRo[1],
+bSttQuote ? aStopDoubleAngleQuoteStart + 1 : 
aStopDoubleAngleQuoteEndRo + 2 ) ) ) )
 {
 LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang 
);
 // only if the opening double quotation mark is the 
default one
@@ -1375,7 +1380,7 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, 
const OUString& rTxt,
 // tdf#128860 use apostrophe outside of second level 
quotation in Czech, German, Icelandic,
 // Slovak and Slovenian instead of the – in this case, 
bad – closing quotation mark U+2018.
 // tdf#123786 the same for Russian and Ukrainian
-( ( eLang.anyOf (
+( eLang.anyOf (
  LANGUAGE_CZECH,
  LANGUAGE_GERMAN,
  LANGUAGE_GERMAN_SWISS,
@@ -1384,17 +1389,33 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& 
rDoc, const OUString& rTxt,
  LANGUAGE_GERMAN_LIECHTENSTEIN,
  LANGUAGE_ICELANDIC,
  LANGUAGE_SLOVAK,
- LANGUAGE_SLOVENIAN ) &&
-!lcl_HasPrecedingChar( rTxt, nInsPos, 
aStopSingleQuoteEnd[0],  aStopSingleQuoteEnd + 1 ) ) ||
+ LANGUAGE_SLOVENIAN ) ) )
+{
+sal_Unicode sStartChar = GetStartSingleQuote();
+sal_Unicode sEndChar = GetEndSingleQuote();
+if ( !sStartChar || !sEndChar ) {
+LocaleDataWrapper& rLcl = GetLocaleDataWrapper( 

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

2022-11-21 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit4.cxx |3 +++
 vcl/source/gdi/metaact.cxx  |1 +
 2 files changed, 4 insertions(+)

New commits:
commit ff0d0d0797701e38afb4f6d48486c5cd45f142cf
Author: Caolán McNamara 
AuthorDate: Mon Nov 21 09:55:48 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 21 20:49:35 2022 +0100

add some checks for OpenSymbol

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

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 9f2b617428fa..5affeff55455 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -363,7 +363,10 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
 // on export what encoding we claim to use for these
 // fonts.
 if (IsOpenSymbol(pFontItem->GetFamilyName()))
+{
+SAL_WARN_IF(eChrSet == RTL_TEXTENCODING_SYMBOL, "editeng", 
"OpenSymbol should not have charset of RTL_TEXTENCODING_SYMBOL in new 
documents");
 eChrSet = RTL_TEXTENCODING_UTF8;
+}
 DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" );
 if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
 eChrSet = osl_getThreadTextEncoding();
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index cc92677c72b7..ef32bc0f3fb3 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1686,6 +1686,7 @@ MetaFontAction::MetaFontAction( vcl::Font aFont ) :
 if ( IsOpenSymbol( maFont.GetFamilyName() )
 && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) )
 {
+SAL_WARN_IF(maFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL, "vcl", 
"OpenSymbol should not have charset of RTL_TEXTENCODING_SYMBOL in new 
documents");
 maFont.SetCharSet( RTL_TEXTENCODING_UNICODE );
 }
 }


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

2022-11-18 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/swafopt.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f4b5ecb54dbe216677b3eeb9a03f63da7df8223f
Author: Caolán McNamara 
AuthorDate: Fri Nov 18 11:41:45 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 18 21:28:25 2022 +0100

use OpenSymbol as bullet font instead of StarSymbol

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

diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx
index 126a54bb1f90..293554589438 100644
--- a/editeng/source/misc/swafopt.cxx
+++ b/editeng/source/misc/swafopt.cxx
@@ -22,7 +22,7 @@
 #include 
 
 SvxSwAutoFormatFlags::SvxSwAutoFormatFlags()
-: aBulletFont( "StarSymbol", Size( 0, 14 ) )
+: aBulletFont( "OpenSymbol", Size( 0, 14 ) )
 {
 bAutoCorrect =
 bCapitalStartSentence =


[Libreoffice-commits] core.git: editeng/source include/unotools oox/source sd/source svtools/source sw/source unotools/source vcl/qt5 vcl/source vcl/unx vcl/win writerfilter/source

2022-11-18 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit4.cxx|2 +-
 editeng/source/items/legacyitem.cxx|2 +-
 include/unotools/fontdefs.hxx  |8 
 oox/source/export/drawingml.cxx|2 +-
 sd/source/filter/eppt/pptx-text.cxx|2 +-
 svtools/source/misc/sampletext.cxx |4 ++--
 sw/source/core/txtnode/fntcache.cxx|2 +-
 sw/source/filter/ww8/writerwordglue.cxx|2 +-
 sw/source/filter/ww8/wrtw8num.cxx  |2 +-
 unotools/source/misc/fontcvt.cxx   |2 +-
 unotools/source/misc/fontdefs.cxx  |2 +-
 vcl/qt5/QtFontFace.cxx |4 ++--
 vcl/source/filter/wmf/wmfwr.cxx|2 +-
 vcl/source/font/PhysicalFontFace.cxx   |4 ++--
 vcl/source/gdi/metaact.cxx |4 ++--
 vcl/unx/generic/fontmanager/fontsubst.cxx  |8 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 ++--
 vcl/win/gdi/salfont.cxx|2 +-
 writerfilter/source/dmapper/FontTable.cxx  |4 ++--
 19 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 003c837e9d029a671ea95f76da45573bbc260eea
Author: Caolán McNamara 
AuthorDate: Fri Nov 18 11:34:13 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 18 14:55:12 2022 +0100

rename IsStarSymbol to IsOpenSymbol

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

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 85b771bc5a29..9f2b617428fa 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -362,7 +362,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
 // of RTL_TEXTENCODING_MS_1252 and pay no attention
 // on export what encoding we claim to use for these
 // fonts.
-if (IsStarSymbol(pFontItem->GetFamilyName()))
+if (IsOpenSymbol(pFontItem->GetFamilyName()))
 eChrSet = RTL_TEXTENCODING_UTF8;
 DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" );
 if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
diff --git a/editeng/source/items/legacyitem.cxx 
b/editeng/source/items/legacyitem.cxx
index 786b86c917ab..96742f46fcae 100644
--- a/editeng/source/items/legacyitem.cxx
+++ b/editeng/source/items/legacyitem.cxx
@@ -107,7 +107,7 @@ namespace legacy
 
 SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16)
 {
-const bool bToBats(IsStarSymbol(rItem.GetFamilyName()));
+const bool bToBats(IsOpenSymbol(rItem.GetFamilyName()));
 
 
rStrm.WriteUChar(rItem.GetFamily()).WriteUChar(rItem.GetPitch()).WriteUChar(bToBats
 ?
 RTL_TEXTENCODING_SYMBOL :
diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
index aff10c860122..ef03e8887a4b 100644
--- a/include/unotools/fontdefs.hxx
+++ b/include/unotools/fontdefs.hxx
@@ -96,15 +96,15 @@ UNOTOOLS_DLLPUBLIC OUString GetEnglishSearchFontName( 
std::u16string_view rName
 */
 UNOTOOLS_DLLPUBLIC OUString StripScriptFromName(const OUString& rName);
 
-/** Determine if the font is the special Star|Open Symbol font
+/** Determine if the font is the special Open|Star Symbol font
 
 @param rFontName
-The FontName to test for being Star|Open Symbol
+The FontName to test for being Open|Star Symbol
 
-@return true if this is Star|Open Symbol
+@return true if this is Open|Star Symbol
 */
 // FIXME It's quite possible that code using this should instead check for 
RTL_TEXTENCODING_SYMBOL.
-UNOTOOLS_DLLPUBLIC bool IsStarSymbol(std::u16string_view rFontName);
+UNOTOOLS_DLLPUBLIC bool IsOpenSymbol(std::u16string_view rFontName);
 
 #endif // INCLUDED_UNOTOOLS_FONTDEFS_HXX
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7c996be1d892..f7bf0ffdb6fe 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4892,7 +4892,7 @@ void DrawingML::WriteConnectorConnections( sal_Int32 
nStartGlueId, sal_Int32 nEn
 
 sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, 
css::awt::FontDescriptor& rFontDesc )
 {
-if ( IsStarSymbol(rFontDesc.Name) )
+if ( IsOpenSymbol(rFontDesc.Name) )
 {
 rtl_TextEncoding eCharSet = rFontDesc.CharSet;
 cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, 
eCharSet, rFontDesc.Name);
diff --git a/sd/source/filter/eppt/pptx-text.cxx 
b/sd/source/filter/eppt/pptx-text.cxx
index 85c37f77d729..d42d80590984 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -890,7 +890,7 @@ void ParagraphObj::ImplGetNumberingLevel( 
PPTExBulletProvider* pBuProv, sal_Int1
 
 case SVX_NUM_CHAR_SPECIAL :   

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

2022-11-18 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit4.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit a4a865a85cfc922e75ed2ad5188e45a76bca92aa
Author: Caolán McNamara 
AuthorDate: Fri Nov 18 11:22:17 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 18 14:54:53 2022 +0100

tdf#47679 explicitly don't write fcharset2 for text in OpenSymbol

we don't convert to the charsets we claim the fonts are in when
we write our text so rtf imports mangle this dubious output.

cheapest thing is to just write default fcharset0 for OpenSymbol

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

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index bc83fc412c75..85b771bc5a29 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -357,6 +357,13 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
 rOutput.WriteUInt32AsString( nVal );
 
 rtl_TextEncoding eChrSet = pFontItem->GetCharSet();
+// tdf#47679 OpenSymbol is not encoded in Symbol Encoding
+// and anyway we always attempt to write as eDestEnc
+// of RTL_TEXTENCODING_MS_1252 and pay no attention
+// on export what encoding we claim to use for these
+// fonts.
+if (IsStarSymbol(pFontItem->GetFamilyName()))
+eChrSet = RTL_TEXTENCODING_UTF8;
 DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" );
 if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
 eChrSet = osl_getThreadTextEncoding();


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

2022-11-13 Thread Caolán McNamara (via logerrit)
 editeng/source/rtf/svxrtf.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 66d5ab895b75f0b81742d9c7806837cdd1acec74
Author: Caolán McNamara 
AuthorDate: Sun Nov 13 16:59:28 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 13 20:50:18 2022 +0100

ofz#53182 Timeout

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 5849b0ad486d..123020bf8203 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -629,7 +629,7 @@ SvxRTFItemStackType* SvxRTFParser::GetAttrSet_()
 
 aAttrStack.push_back( std::move(xNew) );
 
-if (aAttrStack.size() > 128 && utl::ConfigManager::IsFuzzing())
+if (aAttrStack.size() > 96 && utl::ConfigManager::IsFuzzing())
 throw std::range_error("ecStackOverflow");
 
 bNewGroup = false;


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

2022-11-03 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit3.cxx |2 ++
 include/vcl/commandevent.hxx|   19 ++-
 sw/source/core/text/redlnitr.cxx|2 ++
 vcl/source/control/edit.cxx |2 ++
 vcl/source/edit/texteng.cxx |2 ++
 vcl/unx/gtk3/gtkframe.cxx   |   13 +++--
 6 files changed, 29 insertions(+), 11 deletions(-)

New commits:
commit d1cd19b56d5fefaa6f41a4d70e748331525820a4
Author: Caolán McNamara 
AuthorDate: Thu Nov 3 10:21:59 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 3 20:48:37 2022 +0100

Related: tdf#149932 honour PANGO_UNDERLINE_DOUBLE for preedit underline

we already have support for double underline so that's an easy add

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

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index f932fd0df8ed..2d2a339658df 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3061,6 +3061,8 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
 ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - 
mpIMEInfos->aPos.GetIndex() - 1 ];
 if ( nAttr & ExtTextInputAttr::Underline )
 rFont.SetUnderline( LINESTYLE_SINGLE );
+else if ( nAttr & ExtTextInputAttr::DoubleUnderline )
+rFont.SetUnderline( LINESTYLE_DOUBLE );
 else if ( nAttr & ExtTextInputAttr::BoldUnderline )
 rFont.SetUnderline( LINESTYLE_BOLD );
 else if ( nAttr & ExtTextInputAttr::DottedUnderline )
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index d5b043ddb97a..fc6ba290793f 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -48,18 +48,19 @@ enum class CommandEventId;
 
 enum class ExtTextInputAttr {
 NONE  = 0x,
-GrayWaveline  = 0x0100,
-Underline = 0x0200,
-BoldUnderline = 0x0400,
-DottedUnderline   = 0x0800,
-DashDotUnderline  = 0x1000,
-Highlight = 0x2000,
-RedText   = 0x4000,
-HalfToneText  = 0x8000
+GrayWaveline  = 0x0010,
+Underline = 0x0020,
+BoldUnderline = 0x0040,
+DottedUnderline   = 0x0080,
+DashDotUnderline  = 0x0100,
+DoubleUnderline   = 0x0200,
+Highlight = 0x0400,
+RedText   = 0x0800,
+HalfToneText  = 0x1000
 };
 namespace o3tl
 {
-template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 
 #define EXTTEXTINPUT_CURSOR_INVISIBLE   (sal_uInt16(0x0001))
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 2b8c11693d20..2b77d86aa350 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -1049,6 +1049,8 @@ void SwExtend::ActualizeFont( SwFont , 
ExtTextInputAttr nAttr )
 {
 if ( nAttr & ExtTextInputAttr::Underline )
 rFnt.SetUnderline( LINESTYLE_SINGLE );
+else if ( nAttr & ExtTextInputAttr::DoubleUnderline )
+rFnt.SetUnderline( LINESTYLE_DOUBLE );
 else if ( nAttr & ExtTextInputAttr::BoldUnderline )
 rFnt.SetUnderline( LINESTYLE_BOLD );
 else if ( nAttr & ExtTextInputAttr::DottedUnderline )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 1554f846ba95..a072a42ec467 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -639,6 +639,8 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, 
const tools::Rectangl
 vcl::Font aFont = rRenderContext.GetFont();
 if (nAttr & ExtTextInputAttr::Underline)
 aFont.SetUnderline(LINESTYLE_SINGLE);
+else if (nAttr & ExtTextInputAttr::DoubleUnderline)
+aFont.SetUnderline(LINESTYLE_DOUBLE);
 else if (nAttr & ExtTextInputAttr::BoldUnderline)
 aFont.SetUnderline( LINESTYLE_BOLD);
 else if (nAttr & ExtTextInputAttr::DottedUnderline)
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 75d6085859e3..90140a58df11 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1382,6 +1382,8 @@ void TextEngine::SeekCursor( sal_uInt32 nPara, sal_Int32 
nPos, vcl::Font& rFont,
 ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - 
mpIMEInfos->aPos.GetIndex() - 1 ];
 if ( nAttr & ExtTextInputAttr::Underline )
 rFont.SetUnderline( LINESTYLE_SINGLE );
+else if ( nAttr & ExtTextInputAttr::DoubleUnderline )
+rFont.SetUnderline( LINESTYLE_DOUBLE );
 else if ( nAttr & ExtTextInputAttr::BoldUnderline )
 rFont.SetUnderline( 

[Libreoffice-commits] core.git: editeng/source sc/source sd/qa

2022-11-03 Thread Stephan Bergmann (via logerrit)
 editeng/source/accessibility/AccessibleEditableTextPara.cxx |3 +--
 sc/source/ui/drawfunc/drtxtob.cxx   |3 ++-
 sc/source/ui/view/editsh.cxx|3 ++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx|8 
 4 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit e0121b2478526d803681d57d59af0cbf9cf602b4
Author: Stephan Bergmann 
AuthorDate: Thu Nov 3 09:14:18 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 3 13:58:13 2022 +0100

-Werror=dangling-reference

In


"c++: Implement -Wdangling-reference [PR106393]" grew a new warning, 
included in
-Wall, and based on some more-or-less shaky heuristics, that warns about
"possibly dangling reference to a temporary".  It produces quite a number of
false positives, but for these uses of SfxItemSet::Get it does look 
plausible
that the returned item references could, at least in theory, point at data 
that
is destroyed along with the temporary SfxItemSet.

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

diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index aacb01522f51..ee2f47254765 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1505,8 +1505,7 @@ namespace accessibility
 // NumberingLevel
 if (rRes.Name == "NumberingLevel")
 {
-const SvxNumBulletItem& rNumBullet = 
rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET);
-if(rNumBullet.GetNumRule().GetLevelCount()==0)
+
if(rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET).GetNumRule().GetLevelCount()==0)
 {
 rRes.Value <<= sal_Int16(-1);
 rRes.Handle = -1;
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx 
b/sc/source/ui/drawfunc/drtxtob.cxx
index ec796f4a8521..5d2e5a2e4019 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -205,7 +205,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest  )
 
 case SID_CHARMAP:
 {
-const SvxFontItem& rItem = 
pOutView->GetAttribs().Get(EE_CHAR_FONTINFO);
+auto const attribs = pOutView->GetAttribs();
+const SvxFontItem& rItem = attribs.Get(EE_CHAR_FONTINFO);
 
 OUString aString;
 std::shared_ptr 
aNewItem(std::make_shared(EE_CHAR_FONTINFO));
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 0fd33f62ed6d..bdd0d32d551b 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -383,8 +383,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
 sal_uInt16 nFontWhich = ( nScript == SvtScriptType::ASIAN ) ? 
EE_CHAR_FONTINFO_CJK :
 ( ( nScript == SvtScriptType::COMPLEX ) ? 
EE_CHAR_FONTINFO_CTL :
 
EE_CHAR_FONTINFO );
+auto const attribs = pTableView->GetAttribs();
 const SvxFontItem& rItem = static_cast(
-pTableView->GetAttribs().Get(nFontWhich));
+attribs.Get(nFontWhich));
 
 OUString aString;
 std::shared_ptr 
aNewItem(std::make_shared(EE_CHAR_FONTINFO));
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 3529290162c9..a7e9095ed950 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1490,8 +1490,8 @@ void SdTiledRenderingTest::testTdf102223()
 EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
 rEditView.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, 
end para, end char.
 CPPUNIT_ASSERT_EQUAL(OUString("Red"), rEditView.GetSelected());
-const SvxFontHeightItem& rItem = 
rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT);
-CPPUNIT_ASSERT_EQUAL(int(1411), static_cast(rItem.GetHeight()));
+CPPUNIT_ASSERT_EQUAL(
+int(1411), 
static_cast(rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT).GetHeight()));
 
 // cut contents of cell
 uno::Sequence aArgs;
@@ -1502,8 +1502,8 @@ void SdTiledRenderingTest::testTdf102223()
 CPPUNIT_ASSERT(pView->GetTextEditObject());
 EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView();
 rEditView2.SetSelection(ESelection(0, 0, 0, 1)); // start para, start 
char, end para, end char.
-const SvxFontHeightItem& 

[Libreoffice-commits] core.git: editeng/source include/editeng sd/qa sd/source svx/source

2022-11-03 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/editeng.cxx  |4 -
 editeng/source/editeng/editobj.cxx  |6 -
 editeng/source/editeng/editobj2.hxx |   10 +-
 editeng/source/editeng/impedit.hxx  |   30 +++
 editeng/source/editeng/impedit2.cxx |4 -
 editeng/source/editeng/impedit3.cxx |   41 --
 editeng/source/editeng/impedit4.cxx |6 -
 editeng/source/outliner/outlin2.cxx |7 -
 editeng/source/outliner/outliner.cxx|   12 +--
 include/editeng/editeng.hxx |4 -
 include/editeng/outliner.hxx|4 -
 sd/qa/unit/import-tests2.cxx|4 -
 sd/source/ui/view/drtxtob.cxx   |6 -
 svx/source/svdraw/svdotext.cxx  |  110 ++--
 svx/source/svdraw/svdotextdecomposition.cxx |2 
 15 files changed, 139 insertions(+), 111 deletions(-)

New commits:
commit 4c349be1d74c669e5804c3c43f3f0a3960c88bc5
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 31 13:28:27 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 3 07:24:22 2022 +0100

fix rendering of text when "fit to frame" is enabled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..f75e71b7f509 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void   

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

2022-11-02 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit5.cxx |   41 +++-
 1 file changed, 18 insertions(+), 23 deletions(-)

New commits:
commit 1a4151dcdf45a0fa946b6ddf5e1b5cca37d24619
Author: Noel Grandin 
AuthorDate: Wed Nov 2 16:12:58 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 2 19:47:02 2022 +0100

tdf#54857 elide more dynamic_cast

re-arrange so we do the cheap checks before the expensive dynamic_cast

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

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 79825dc4d752..9a02ca4c4557 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -141,37 +141,32 @@ void ImpEditEngine::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 // So that not a lot of unnecessary formatting is done when destructing:
 if ( !bDowning )
 {
-
-const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast();
-if ( pStyleSheetHint )
+SfxHintId nId = rHint.GetId();
+if ( ( nId == SfxHintId::StyleSheetInDestruction ) ||
+ ( nId == SfxHintId::StyleSheetErased ) )
 {
-DBG_ASSERT( dynamic_cast< const SfxStyleSheet* 
>(pStyleSheetHint->GetStyleSheet()) != nullptr, "No SfxStyleSheet!" );
+const SfxStyleSheetHint* pStyleSheetHint = static_cast();
 SfxStyleSheet* pStyle = static_cast( 
pStyleSheetHint->GetStyleSheet() );
-SfxHintId nId = pStyleSheetHint->GetId();
-if ( ( nId == SfxHintId::StyleSheetInDestruction ) ||
- ( nId == SfxHintId::StyleSheetErased ) )
-{
-RemoveStyleFromParagraphs( pStyle );
-}
-else if ( nId == SfxHintId::StyleSheetModified )
-{
-UpdateParagraphsWithStyleSheet( pStyle );
-}
+RemoveStyleFromParagraphs( pStyle );
 }
-else if ( auto pStyle = dynamic_cast< SfxStyleSheet* >() )
+else if ( nId == SfxHintId::StyleSheetModified )
 {
-SfxHintId nId = rHint.GetId();
-if ( nId == SfxHintId::Dying )
-{
+const SfxStyleSheetHint* pStyleSheetHint = static_cast();
+SfxStyleSheet* pStyle = static_cast( 
pStyleSheetHint->GetStyleSheet() );
+UpdateParagraphsWithStyleSheet( pStyle );
+}
+else if ( nId == SfxHintId::Dying )
+{
+if ( auto pStyle = dynamic_cast< SfxStyleSheet* >() )
 RemoveStyleFromParagraphs( pStyle );
-}
-else if ( nId == SfxHintId::DataChanged )
-{
+}
+else if ( nId == SfxHintId::DataChanged )
+{
+if ( auto pStyle = dynamic_cast< SfxStyleSheet* >() )
 UpdateParagraphsWithStyleSheet( pStyle );
-}
 }
 }
-if(dynamic_cast() != nullptr && rHint.GetId() 
== SfxHintId::Dying)
+if (rHint.GetId() == SfxHintId::Dying && dynamic_cast())
 Dispose();
 }
 


[Libreoffice-commits] core.git: editeng/source embedserv/source

2022-11-02 Thread sahilbutoal08 (via logerrit)
 editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx |6 +-
 embedserv/source/inc/docholder.hxx   |5 +
 embedserv/source/inc/embeddoc.hxx|5 +
 embedserv/source/inc/iipaobj.hxx |5 +
 embedserv/source/inc/intercept.hxx   |5 +
 embedserv/source/inc/servprov.hxx|5 +
 embedserv/source/inprocserv/advisesink.hxx   |5 +
 7 files changed, 7 insertions(+), 29 deletions(-)

New commits:
commit ac90933dde68c6daf1eeebabb55de6e361eb4995
Author: sahilbutoal08 
AuthorDate: Sun Oct 30 15:30:11 2022 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Wed Nov 2 18:44:39 2022 +0100

tdf#143148 Use of #pragma once instead of include guards.

Change-Id: I975ad0a41dbcf39121b266e99b466193386d6b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142046
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Jenkins

diff --git a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx 
b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx
index 352f77385a67..df913dbe6b01 100644
--- a/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx
+++ b/editeng/source/misc/SvXMLAutoCorrectTokenHandler.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef EDITENG_SOURCE_MISC_SVXMLAUTOCORRECTTOKENHANDLER_HXX
-#define EDITENG_SOURCE_MISC_SVXMLAUTOCORRECTTOKENHANDLER_HXX
+#pragma once
 
 #include 
 #include 
@@ -43,7 +42,4 @@ public:
 virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) 
const override;
 };
 
-#endif // EDITENG_SOURCE_MISC_SVXMLAUTOCORRECTTOKENHANDLER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-
diff --git a/embedserv/source/inc/docholder.hxx 
b/embedserv/source/inc/docholder.hxx
index 0c0816cc625f..844435e3de83 100644
--- a/embedserv/source/inc/docholder.hxx
+++ b/embedserv/source/inc/docholder.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDSERV_SOURCE_INC_DOCHOLDER_HXX
-#define INCLUDED_EMBEDSERV_SOURCE_INC_DOCHOLDER_HXX
+#pragma once
 
 #include "common.h"
 #include 
@@ -248,6 +247,4 @@ public:
 ) override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inc/embeddoc.hxx 
b/embedserv/source/inc/embeddoc.hxx
index 34d2bba1bfd0..1ff0ed338cf4 100644
--- a/embedserv/source/inc/embeddoc.hxx
+++ b/embedserv/source/inc/embeddoc.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDSERV_SOURCE_INC_EMBEDDOC_HXX
-#define INCLUDED_EMBEDSERV_SOURCE_INC_EMBEDDOC_HXX
+#pragma once
 
 #include "common.h"
 #include 
@@ -191,6 +190,4 @@ public:
 }
 };
 
-#endif // INCLUDED_EMBEDSERV_SOURCE_INC_EMBEDDOC_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inc/iipaobj.hxx b/embedserv/source/inc/iipaobj.hxx
index de91f6b854a9..a6851e1277cb 100644
--- a/embedserv/source/inc/iipaobj.hxx
+++ b/embedserv/source/inc/iipaobj.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDSERV_SOURCE_INC_IIPAOBJ_HXX
-#define INCLUDED_EMBEDSERV_SOURCE_INC_IIPAOBJ_HXX
+#pragma once
 
 #include "stdafx.h"
 #include 
@@ -59,6 +58,4 @@ private:
 ::rtl::Reference< DocumentHolder >  m_rDocHolder;
 };
 
-
-#endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inc/intercept.hxx 
b/embedserv/source/inc/intercept.hxx
index c8435ec481fc..665f26aa82b9 100644
--- a/embedserv/source/inc/intercept.hxx
+++ b/embedserv/source/inc/intercept.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDSERV_SOURCE_INC_INTERCEPT_HXX
-#define INCLUDED_EMBEDSERV_SOURCE_INC_INTERCEPT_HXX
+#pragma once
 
 #include 
 #include 
@@ -146,6 +145,4 @@ private:
 bool m_bLink;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inc/servprov.hxx 
b/embedserv/source/inc/servprov.hxx
index 790769fe32b1..f2b30fb6ccaa 100644
--- a/embedserv/source/inc/servprov.hxx
+++ b/embedserv/source/inc/servprov.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDSERV_SOURCE_INC_SERVPROV_HXX
-#define INCLUDED_EMBEDSERV_SOURCE_INC_SERVPROV_HXX
+#pragma once
 
 #include "common.h"
 #include 
@@ -77,6 +76,4 @@ protected:
 css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embedserv/source/inprocserv/advisesink.hxx 
b/embedserv/source/inprocserv/advisesink.hxx
index 03c81f1ff18f..525a655087c8 100644
--- a/embedserv/source/inprocserv/advisesink.hxx
+++ b/embedserv/source/inprocserv/advisesink.hxx
@@ -17,8 +17,7 @@
  *   the License at 

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

2022-11-01 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/impedit3.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8ec62a84c84d818d01cd3e6dcb874e1a801512c7
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:20:47 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 1 07:31:19 2022 +0100

editeng: rename aBuf to aCharPositionArray

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

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 3b69ff6cf66e..3f0418dc7505 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -838,7 +838,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 EditLine aSaveLine( *pLine );
 SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
 
-std::vector aBuf( pNode->Len() );
+std::vector aCharPositionArray(pNode->Len());
 
 bool bSameLineAgain = false;// For TextRanger, if the height changes.
 TabInfo aCurrentTab;
@@ -1234,14 +1234,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if (bContinueLastPortion)
 {
  Size aSize( aTmpFont.QuickGetTextSize( GetRefDevice(),
-pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen,  ));
+pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen,  ));
  pPortion->adjustSize(aSize.Width(), 0);
  if (pPortion->GetSize().Height() < aSize.Height())
  pPortion->setHeight(aSize.Height());
 }
 else
 {
-auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, );
+auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, 
);
 pPortion->SetSize(aSize);
 }
 
@@ -1256,7 +1256,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 // => Always simply quick inserts.
 size_t nPos = nTmpPos - pLine->GetStart();
 EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
-rArray.insert( rArray.begin() + nPos, aBuf.data(), aBuf.data() 
+ nPortionLen);
+rArray.insert( rArray.begin() + nPos, 
aCharPositionArray.data(), aCharPositionArray.data() + nPortionLen);
 
 // And now check for Compression:
 if ( !bContinueLastPortion && nPortionLen && 
GetAsianCompressionMode() != CharCompressType::NONE )


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

2022-10-31 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 07f8666254e459bcd880b5bc4314b1af404d0a6e
Author: Noel Grandin 
AuthorDate: Mon Oct 31 15:45:47 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 31 17:28:24 2022 +0100

fix regression from "editeng: don't use GetSize to set the size"

Params are swapped since

commit 190cd40e01bd36e99b265ef5da36a382199f18b9 (HEAD, master)
Date:   Tue Oct 18 21:14:41 2022 +0200
editeng: don't use GetSize to set the size

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

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ed560fb0e138..3b69ff6cf66e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2169,7 +2169,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
 SvxFont aFont;
 SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont );
 aFont.SetPhysFont(*GetRefDevice());
-pHyphPortion->SetSize(Size(GetRefDevice()->GetTextHeight(), 
GetRefDevice()->GetTextWidth(CH_HYPH)));
+pHyphPortion->SetSize(Size(GetRefDevice()->GetTextWidth(CH_HYPH), 
GetRefDevice()->GetTextHeight()));
 
 pParaPortion->GetTextPortions().Insert(++nEndPortion, pHyphPortion);
 }


[Libreoffice-commits] core.git: editeng/source i18nlangtag/qa i18nlangtag/source include/i18nlangtag

2022-10-04 Thread Eike Rathke (via logerrit)
 editeng/source/misc/acorrcfg.cxx   |   16 
 i18nlangtag/qa/cppunit/test_languagetag.cxx|2 ++
 i18nlangtag/source/isolang/isolang.cxx |2 ++
 i18nlangtag/source/isolang/mslangid.cxx|6 +++---
 i18nlangtag/source/languagetag/languagetag.cxx |6 +++---
 include/i18nlangtag/mslangid.hxx   |5 +++--
 6 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 437abb3abbc506c1e20c6fec8e574abfe3487842
Author: Eike Rathke 
AuthorDate: Tue Oct 4 11:14:38 2022 +0200
Commit: Eike Rathke 
CommitDate: Tue Oct 4 19:15:45 2022 +0200

Check acor_langtag for language-script fallback instead of only language

A tag with script could be added for which we don't have locale
data but for the same language in another script. Do not fall back
to that.

With that the share/autocorr/acor_zh-{CN,TW}.dat files created
additional Asian language listbox entries
"Chinese (Simplified, China) {zh-Hans-CN}"
"Chinese (Traditional, Taiwan) {zh-Hant-TW}"
because those are the canonicalized language tags.
Prefer the known legacy zh-CN and zh-TW tags instead.
Could also had happened with any document import.

Which again revealed a flaw in the handling of mapping overrides
where converting from a LanguageType LCID to Locale could yield a
different mapping than from BCP47 to LCID, which in the case of
a fallback for locale data lead to odd side effects.

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

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 5806179bc5f0..53a43cff3f22 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -75,20 +75,20 @@ static void scanAutoCorrectDirForLanguageTags( const 
OUString& rURL )
 if (SvtLanguageTable::HasLanguageType( 
aLanguageTag.getLanguageType()))
 continue;
 
-// Insert language-only tags only if there is no known
-// matching fallback locale, otherwise we'd end up with
-// unwanted entries where a language autocorrection
-// file covers several locales. We do know a few
-// art-x-... though so exclude those and any other
-// private-use tag (which should not fallback, but
-// avoid).
+// Insert language(-script)-only tags only if there is
+// no known matching fallback locale, otherwise we'd
+// end up with unwanted entries where a language
+// autocorrection file covers several locales. We do
+// know a few art-x-... though so exclude those and any
+// other private-use tag (which should not fallback,
+// but avoid).
 if (aLanguageTag.getCountry().isEmpty()
 && LanguageTag::isValidBcp47( aCanonicalized, 
nullptr,
 LanguageTag::PrivateUse::DISALLOW))
 {
 LanguageTag aFallback( aLanguageTag);
 aFallback.makeFallback();
-if (aFallback.getLanguage() == 
aLanguageTag.getLanguage())
+if (aFallback.getLanguageAndScript() == 
aLanguageTag.getLanguageAndScript())
 continue;
 }
 
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx 
b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index 4a211012e80d..f7864d6104fd 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -753,6 +753,8 @@ bool checkMapping( std::u16string_view rStr1, 
std::u16string_view rStr2 )
 if (rStr1 == u"kw-UK"   ) return rStr2 == u"kw-GB";
 if (rStr1 == u"oc-FR"   ) return rStr2 == u"oc-FR-lengadoc";
 if (rStr1 == u"oc-ES"   ) return rStr2 == u"oc-ES-aranes";
+if (rStr1 == u"zh-Hans-CN"  ) return rStr2 == u"zh-CN";
+if (rStr1 == u"zh-Hant-TW"  ) return rStr2 == u"zh-TW";
 return rStr1 == rStr2;
 }
 
diff --git a/i18nlangtag/source/isolang/isolang.cxx 
b/i18nlangtag/source/isolang/isolang.cxx
index d20014e67f4b..4287fe247cb4 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -754,6 +754,8 @@ IsoLanguageScriptCountryEntry const 
aImplIsoLangScriptEntries[] =
 { LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA,"bs-Latn", "BA", kSAME },  
 // MS, though Latn is suppress-script
 { LANGUAGE_BOSNIAN_LATIN_LSO,   "bs-Latn", ""  , 
LANGUAGE_BOSNIAN_LSO },   // MS, 

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

2022-10-02 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 9063d99ff5ee43cc1239fc1dbb5d9897bdda1c9b
Author: Khaled Hosny 
AuthorDate: Sun Oct 2 22:45:24 2022 +0200
Commit: خالد حسني 
CommitDate: Mon Oct 3 01:39:56 2022 +0200

tdf#137528: Fix skipping Kashida in fonts with bogus ones

There was a typo in the check, and we also want to fallback to using
blanks if no Kashidas were found, so check for Kashida positions first.

Change-Id: I64cc3bf5c76ecc01764073bb5a2302520157fad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140896
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index cf30aada8448..6efc74d95cfe 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2190,14 +2190,19 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
 
 // Search blanks or Kashidas...
 std::vector aPositions;
+
+// Kashidas ?
+ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions );
+auto nKashidas = aPositions.size();
+
 sal_uInt16 nLastScript = i18n::ScriptType::LATIN;
 for ( sal_Int32 nChar = nFirstChar; nChar <= nLastChar; nChar++ )
 {
 EditPaM aPaM( pNode, nChar+1 );
 LanguageType eLang = GetLanguage(aPaM).nLang;
 sal_uInt16 nScript = GetI18NScriptType(aPaM);
-if ( MsLangId::getPrimaryLanguage( eLang) == 
LANGUAGE_ARABIC_PRIMARY_ONLY )
-// Arabic script is handled later.
+// Arabic script is handled above, but if no Kashida positions are 
found, use blanks.
+if (MsLangId::getPrimaryLanguage(eLang) == 
LANGUAGE_ARABIC_PRIMARY_ONLY && nKashidas)
 continue;
 
 if ( pNode->GetChar(nChar) == ' ' )
@@ -2223,13 +2228,6 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
 nLastScript = nScript;
 }
 
-// Save the number of blanks, we will use it below when marking Kashida
-// positions.
-auto nBlankSize = aPositions.size();
-
-// Kashidas ?
-ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions );
-
 if ( aPositions.empty() )
 return;
 
@@ -2268,10 +2266,10 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
 
 // Mark Kashida positions, so that VCL knows where to insert Kashida and
 // where to only expand the width.
-if (aPositions.size() > nBlankSize)
+if (nKashidas)
 {
 pLine->GetKashidaArray().resize(pLine->GetCharPosArray().size(), 
false);
-for (auto i = nBlankSize; i < aPositions.size(); i++)
+for (size_t i = 0; i < nKashidas; i++)
 {
 auto nChar = aPositions[i];
 if ( nChar < nLastChar )
@@ -2316,7 +2314,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
 void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, 
sal_Int32 nEnd, std::vector& rArray )
 {
 // Kashida glyph looks suspicious, skip Kashida justification
-if (GetRefDevice()->GetMinKashida() < 0)
+if (GetRefDevice()->GetMinKashida() <= 0)
 return;
 
 std::vector aKashidaArray;


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

2022-09-25 Thread Khaled Hosny (via logerrit)
 editeng/source/items/svxfont.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 79152891824581ad765dc8518150027c417bb9a2
Author: Khaled Hosny 
AuthorDate: Sat Sep 24 22:58:20 2022 +0200
Commit: خالد حسني 
CommitDate: Sun Sep 25 09:11:32 2022 +0200

tdf#83581: Improve caret travelling in in Edit Engine

This uses the same caret positioning array introduced in:

commit 8cb4db941f91cc234dd18c61f8b1e51f65360d1f
Author: Khaled Hosny 
Date:   Fri Aug 26 22:20:55 2022 +0200

tdf#30731: Improve caret travelling in Writer

But unlike the Writer change, this is used unconditionally not only when
calculating caret (cursor) position. This might break something, so lets
find out.

Change-Id: Ia285197b7ee41f01ccd37101436be86b476c0272
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140557
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 65191cab8ed7..9911beec85b0 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -37,7 +37,7 @@ static tools::Long GetTextArray( const OutputDevice* pOut, 
const OUString& rStr,
 
 {
 const SalLayoutGlyphs* layoutGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(pOut, rStr, nIndex, nLen);
-return pOut->GetTextArray( rStr, pDXAry, nIndex, nLen, false, nullptr, 
layoutGlyphs);
+return pOut->GetTextArray( rStr, pDXAry, nIndex, nLen, true, nullptr, 
layoutGlyphs);
 }
 
 SvxFont::SvxFont()


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

2022-09-20 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/impedit.hxx  |1 +
 editeng/source/editeng/impedit2.cxx |5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e37cb88b51e3ab0da687278b3c846140b507e00b
Author: Caolán McNamara 
AuthorDate: Tue Sep 20 12:28:57 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 20 14:50:29 2022 +0200

ofz#51471 Timeout

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

diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index d11ee008c135..b761e3bc4135 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -605,6 +605,7 @@ private:
 boolmbLastTryMerge:1;
 boolmbReplaceLeadingSingleQuotationMark:1;
 boolmbSkipOutsideFormat:1;
+boolmbFuzzing:1;
 
 boolmbNbspRunNext;  // can't be a bitfield as it is passed as 
bool&
 
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 3f655c10bc8e..19b6c72e0536 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -124,6 +124,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* 
pItemPool ) :
 mbLastTryMerge(false),
 mbReplaceLeadingSingleQuotationMark(true),
 mbSkipOutsideFormat(false),
+mbFuzzing(utl::ConfigManager::IsFuzzing()),
 mbNbspRunNext(false)
 {
 aStatus.GetControlWord() =  EEControlBits::USECHARATTRIBS | 
EEControlBits::DOIDLEFORMAT |
@@ -1948,7 +1949,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 
nPara )
 WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos;
 rInfos.clear();
 
-if (pParaPortion->GetNode()->Len())
+if (pParaPortion->GetNode()->Len() && !mbFuzzing)
 {
 const OUString aText = pParaPortion->GetNode()->GetString();
 
@@ -2722,7 +2723,7 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& 
aCurSel, const OUStrin
 aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD );
 
 OUString aText(convertLineEnd(rStr, LINEEND_LF));
-if (utl::ConfigManager::IsFuzzing())//tab expansion performance in 
editeng is appalling
+if (mbFuzzing)//tab expansion performance in editeng is appalling
 aText = aText.replaceAll("\t","-");
 SfxVoidItem aTabItem( EE_FEATURE_TAB );
 


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

2022-09-19 Thread Mike Kaganski (via logerrit)
 editeng/source/editeng/impedit2.cxx |   44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 8a713c3b46a9b476b92f848451472e4a2618e4ef
Author: Mike Kaganski 
AuthorDate: Mon Sep 19 09:22:33 2022 +0300
Commit: Mike Kaganski 
CommitDate: Mon Sep 19 09:12:36 2022 +0200

OSL_ENSURE->assert where we would crash if not true

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

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index ffa8913b0c75..3f655c10bc8e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -280,8 +280,8 @@ OUString ImpEditEngine::GetSelected( const EditSelection& 
rSel  ) const
 // iterate over the paragraphs ...
 for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ )
 {
-OSL_ENSURE( aEditDoc.GetObject( nNode ), "Node not found: GetSelected" 
);
 const ContentNode* pNode = aEditDoc.GetObject( nNode );
+assert(pNode);
 
 const sal_Int32 nStartPos = nNode==nStartNode ? aSel.Min().GetIndex() 
: 0;
 const sal_Int32 nEndPos = nNode==nEndNode ? aSel.Max().GetIndex() : 
pNode->Len(); // can also be == nStart!
@@ -774,7 +774,7 @@ void ImpEditEngine::ParaAttribsChanged( ContentNode const * 
pNode, bool bIgnoreU
 bFormatted = false;
 
 ParaPortion* pPortion = FindParaPortion( pNode );
-OSL_ENSURE( pPortion, "ParaAttribsChanged: Portion?" );
+assert(pPortion);
 pPortion->MarkSelectionInvalid( 0 );
 
 sal_Int32 nPara = aEditDoc.GetPos( pNode );
@@ -1261,7 +1261,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, 
EditView const * pView )
 assert(pView && "No View - No Cursor Movement!");
 
 const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
-OSL_ENSURE( pPPortion, "No matching portion found: CursorUp ");
+assert(pPPortion);
 sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
 const EditLine& rLine = pPPortion->GetLines()[nLine];
 
@@ -1302,10 +1302,10 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, 
EditView const * pView )
 
 EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView const * pView 
)
 {
-OSL_ENSURE( pView, "No View - No Cursor Movement!" );
+assert(pView);
 
 const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
-OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" );
+assert(pPPortion);
 sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
 
 tools::Long nX;
@@ -1348,7 +1348,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, 
EditView const * pView )
 EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM )
 {
 const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
-OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
+assert(pCurPortion);
 sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
 const EditLine& rLine = pCurPortion->GetLines()[nLine];
 
@@ -1360,7 +1360,7 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& 
rPaM )
 EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM )
 {
 const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
-OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" );
+assert(pCurPortion);
 sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() );
 const EditLine& rLine = pCurPortion->GetLines()[nLine];
 
@@ -2289,7 +2289,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* 
pLeft, ContentNode* pR
 
 // First search for Portions since pRight is gone after ConnectParagraphs.
 ParaPortion* pLeftPortion = FindParaPortion( pLeft );
-OSL_ENSURE( pLeftPortion, "Blind Portion in ImpConnectParagraphs(1)" );
+assert(pLeftPortion);
 
 if ( GetStatus().DoOnlineSpelling() )
 {
@@ -2464,7 +2464,7 @@ EditPaM ImpEditEngine::ImpDeleteSelection(const 
EditSelection& rCurSel)
 // The Rest of the StartNodes...
 ImpRemoveChars( aStartPaM, aStartPaM.GetNode()->Len() - 
aStartPaM.GetIndex() );
 ParaPortion* pPortion = FindParaPortion( aStartPaM.GetNode() );
-OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(3)" );
+assert(pPortion);
 pPortion->MarkSelectionInvalid( aStartPaM.GetIndex() );
 
 // The beginning of the EndNodes...
@@ -2472,7 +2472,7 @@ EditPaM ImpEditEngine::ImpDeleteSelection(const 
EditSelection& rCurSel)
 aEndPaM.SetIndex( 0 );
 ImpRemoveChars( aEndPaM, nChars );
 pPortion = FindParaPortion( aEndPaM.GetNode() );
-OSL_ENSURE( pPortion, "Blind Portion in ImpDeleteSelection(4)" );
+assert(pPortion);
 pPortion->MarkSelectionInvalid( 0 );
 // Join together...
 aStartPaM = ImpConnectParagraphs( 

[Libreoffice-commits] core.git: editeng/source include/editeng include/svx include/xmloff offapi/com oox/inc oox/source schema/libreoffice sc/qa sd/qa svx/source sw/qa sw/source writerfilter/source xm

2022-09-14 Thread Regina Henschel (via logerrit)
 editeng/source/items/frmitems.cxx   |9 +
 include/editeng/editrids.hrc|1 
 include/editeng/frmdir.hxx  |5 
 include/editeng/frmdiritem.hxx  |2 
 include/svx/svddef.hxx  |7 
 include/svx/unoshprp.hxx|3 
 include/xmloff/xmltoken.hxx |1 
 offapi/com/sun/star/text/WritingMode2.idl   |   10 +
 oox/inc/drawingml/customshapeproperties.hxx |4 
 oox/inc/drawingml/textbodyproperties.hxx|2 
 oox/source/drawingml/customshapeproperties.cxx  |8 -
 oox/source/drawingml/shape.cxx  |9 -
 oox/source/drawingml/textbodyproperties.cxx |4 
 oox/source/drawingml/textbodypropertiescontext.cxx  |   22 ++
 oox/source/export/drawingml.cxx |   89 
 oox/source/export/vmlexport.cxx |   12 -
 oox/source/shape/WpsContext.cxx |   45 +++---
 sc/qa/unit/subsequent_filters_test2.cxx |   22 +-
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |1 
 sd/qa/unit/data/xml/n902652_0.xml   |4 
 sd/qa/unit/export-tests.cxx |   63 ++--
 sd/qa/unit/import-tests2.cxx|   26 +--
 svx/source/sdr/properties/customshapeproperties.cxx |1 
 svx/source/svdraw/svdattr.cxx   |5 
 svx/source/svdraw/svdoashp.cxx  |   31 +++-
 svx/source/unodraw/unoshape.cxx |   10 +
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |   12 -
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx   |4 
 sw/source/core/doc/textboxhelper.cxx|   11 +
 sw/source/core/layout/wsfrm.cxx |6 
 sw/source/filter/ww8/docxattributeoutput.cxx|   12 +
 sw/source/filter/ww8/docxsdrexport.cxx  |5 
 sw/source/filter/xml/xmlexpit.cxx   |   13 +
 sw/source/filter/xml/xmlimpit.cxx   |7 
 writerfilter/source/dmapper/DomainMapper.cxx|   37 +++-
 xmloff/inc/xmlsdtypes.hxx   |2 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/draw/sdpropls.cxx |   37 
 xmloff/source/draw/shapeexport.cxx  |   30 +++-
 xmloff/source/style/prhdlfac.cxx|3 
 xmloff/source/style/xmlexppr.cxx|3 
 xmloff/source/token/tokens.txt  |1 
 42 files changed, 436 insertions(+), 144 deletions(-)

New commits:
commit c70ee4a6b9071468255e5d4fdb893e9c9bdf4fad
Author: Regina Henschel 
AuthorDate: Wed Aug 17 02:31:44 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 14 08:32:08 2022 +0200

tdf#149551 use 'WritingMode' instead of TextPreRotateAngle

Commit 7e23cbdbb6ec0247a29ed8a8f744c01e10963ea0 changed the code so,
that TextPreRotateAngle is used to track ooxml vert attribute. This
patch changes it so, that the style attribute WritingMode is used.
Now text direction can be written in 'writing-mode' attribute in the
graphic properties in ODF, same for shapes as for frames.

The needed conversion from WritingMode BT-LR and TB_LR90 to
TextPreRotateAngle for rendering of text in custom shapes is now in
one place in class SdrObjectCustomshape. The shape edit engine
cannot yet render it itself.

Some unit tests are adapted to use WritingMode property instead of
TextPreRotateAngle.

The value text::WritingMode2::TB_RL90 is introduced, corresponding to
vert='vert' and textDirection='tbRl' or ='rl' in OOXML. It is used
for frames too, so that the original text direction is preserved and
vert='eaVert' can be distinguished from vert='vert'.

TextPreRotateAngle is currently still used in SmartArt import for
'upr' and 'grav' and in emulating 'upright' but no longer to
emulate text direction.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 35e1be7b094c..890d74a75510 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3411,7 +3411,8 @@ TranslateId getFrmDirResId(size_t nIndex)
 RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT,
 RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT,
 

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

2022-09-05 Thread Julien Nabet (via logerrit)
 editeng/source/editeng/eehtml.cxx |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit 273ddb469abade5505ea919de77d2a18bc35f0c9
Author: Julien Nabet 
AuthorDate: Sun Sep 4 16:15:06 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 5 15:54:20 2022 +0200

Simplify by using replace instead of replaceAt in loop in editeng

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

diff --git a/editeng/source/editeng/eehtml.cxx 
b/editeng/source/editeng/eehtml.cxx
index 0820c48dfd83..cc26360df6a2 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -192,14 +192,7 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken )
 {
 // Only written until HTML with 319?
 if ( IsReadPRE() )
-{
-sal_Int32 nTabPos = aText.indexOf( '\t');
-while ( nTabPos != -1 )
-{
-aText = aText.replaceAt( nTabPos, 1, u"" );
-nTabPos = aText.indexOf( '\t', nTabPos+8 );
-}
-}
+aText = aText.replaceAll(u"\t", u"");
 ImpInsertText( aText );
 }
 }


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

2022-09-02 Thread Andrea Gelmini (via logerrit)
 editeng/source/misc/svxacorr.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 81a7c2543e04eb6792fccece01f514bf653a5ad0
Author: Andrea Gelmini 
AuthorDate: Fri Sep 2 15:26:45 2022 +0200
Commit: Julien Nabet 
CommitDate: Fri Sep 2 17:02:55 2022 +0200

Removed duplicated include

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 14c4236f0d28..bdfc4708f19d 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: editeng/source include/editeng

2022-09-02 Thread Noel Grandin (via logerrit)
 editeng/source/misc/svxacorr.cxx |   75 ---
 include/editeng/svxacorr.hxx |2 -
 2 files changed, 40 insertions(+), 37 deletions(-)

New commits:
commit b467c7a12bd5e5e2862a8c018a2135635dcc50cb
Author: Noel Grandin 
AuthorDate: Thu Sep 1 19:02:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 2 12:39:08 2022 +0200

no need to use unique_ptr for this map in SvxAutoCorrect

map is already a node based data structure, so the values will stay
in the same place in memory

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 4ee4f61a0d33..14c4236f0d28 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1633,14 +1634,14 @@ SvxAutoCorrectLanguageLists& 
SvxAutoCorrect::GetLanguageList_(
 LanguageTag aLanguageTag( eLang);
 if (m_aLangTable.find(aLanguageTag) == m_aLangTable.end())
 (void)CreateLanguageFile(aLanguageTag);
-return *(m_aLangTable.find(aLanguageTag)->second);
+return m_aLangTable.find(aLanguageTag)->second;
 }
 
 void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang )
 {
 auto const iter = m_aLangTable.find(LanguageTag(eLang));
-if (iter != m_aLangTable.end() && iter->second)
-iter->second->SaveCplSttExceptList();
+if (iter != m_aLangTable.end())
+iter->second.SaveCplSttExceptList();
 else
 {
 SAL_WARN("editeng", "Save an empty list? ");
@@ -1650,8 +1651,8 @@ void SvxAutoCorrect::SaveCplSttExceptList( LanguageType 
eLang )
 void SvxAutoCorrect::SaveWordStartExceptList(LanguageType eLang)
 {
 auto const iter = m_aLangTable.find(LanguageTag(eLang));
-if (iter != m_aLangTable.end() && iter->second)
-iter->second->SaveWordStartExceptList();
+if (iter != m_aLangTable.end())
+iter->second.SaveWordStartExceptList();
 else
 {
 SAL_WARN("editeng", "Save an empty list? ");
@@ -1666,15 +1667,15 @@ bool SvxAutoCorrect::AddCplSttException( const 
OUString& rNew,
 // either the right language is present or it will be this in the general 
list
 auto iter = m_aLangTable.find(LanguageTag(eLang));
 if (iter != m_aLangTable.end())
-pLists = iter->second.get();
+pLists = >second;
 else
 {
 LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
 iter = m_aLangTable.find(aLangTagUndetermined);
 if (iter != m_aLangTable.end())
-pLists = iter->second.get();
+pLists = >second;
 else if(CreateLanguageFile(aLangTagUndetermined))
-pLists = m_aLangTable.find(aLangTagUndetermined)->second.get();
+pLists = _aLangTable.find(aLangTagUndetermined)->second;
 }
 OSL_ENSURE(pLists, "No auto correction data");
 return pLists && pLists->AddToCplSttExceptList(rNew);
@@ -1688,15 +1689,15 @@ bool SvxAutoCorrect::AddWordStartException( const 
OUString& rNew,
 //either the right language is present or it is set in the general list
 auto iter = m_aLangTable.find(LanguageTag(eLang));
 if (iter != m_aLangTable.end())
-pLists = iter->second.get();
+pLists = >second;
 else
 {
 LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
 iter = m_aLangTable.find(aLangTagUndetermined);
 if (iter != m_aLangTable.end())
-pLists = iter->second.get();
+pLists = >second;
 else if(CreateLanguageFile(aLangTagUndetermined))
-pLists = m_aLangTable.find(aLangTagUndetermined)->second.get();
+pLists = _aLangTable.find(aLangTagUndetermined)->second;
 }
 OSL_ENSURE(pLists, "No auto correction file!");
 return pLists && pLists->AddToWordStartExceptList(rNew);
@@ -1799,9 +1800,10 @@ bool SvxAutoCorrect::CreateLanguageFile( const 
LanguageTag& rLanguageTag, bool b
 if( bNewFile )
 {
 sShareDirFile = sUserDirFile;
-pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, 
sUserDirFile );
-LanguageTag aTmp(rLanguageTag); // this insert() needs a 
non-const reference
-m_aLangTable.insert(std::make_pair(aTmp, 
std::unique_ptr(pLists)));
+auto itBool = m_aLangTable.emplace(std::piecewise_construct,
+std::forward_as_tuple(rLanguageTag),
+std::forward_as_tuple(*this, sShareDirFile, 
sUserDirFile));
+pLists = >second;
 aLastFileTable.erase(nFndPos);
 }
 }
@@ -1815,9 +1817,10 @@ bool SvxAutoCorrect::CreateLanguageFile( const 
LanguageTag& rLanguageTag, bool b
 ( sShareDirFile = sUserDirFile, bNewFile )
   )
 {
-

[Libreoffice-commits] core.git: editeng/source i18nlangtag/qa i18nlangtag/source include/i18nlangtag svx/source

2022-08-31 Thread Eike Rathke (via logerrit)
 editeng/source/misc/acorrcfg.cxx   |3 ++-
 i18nlangtag/qa/cppunit/test_languagetag.cxx|6 +++---
 i18nlangtag/source/languagetag/languagetag.cxx |5 +++--
 include/i18nlangtag/languagetag.hxx|   17 -
 svx/source/dialog/langbox.cxx  |2 +-
 5 files changed, 21 insertions(+), 12 deletions(-)

New commits:
commit 2c2e0568e89942cc8463c0da9aa7a3d177667178
Author: Eike Rathke 
AuthorDate: Wed Aug 31 14:08:26 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Aug 31 20:49:46 2022 +0200

Related: tdf#150370 Convert isValidBcp47() bool to enum 
LanguageTag::PrivateUse

... to prepare for more finegrained private-use control.

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

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index a97e5077ccb6..5806179bc5f0 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -83,7 +83,8 @@ static void scanAutoCorrectDirForLanguageTags( const 
OUString& rURL )
 // private-use tag (which should not fallback, but
 // avoid).
 if (aLanguageTag.getCountry().isEmpty()
-&& LanguageTag::isValidBcp47( aCanonicalized, 
nullptr, true))
+&& LanguageTag::isValidBcp47( aCanonicalized, 
nullptr,
+LanguageTag::PrivateUse::DISALLOW))
 {
 LanguageTag aFallback( aLanguageTag);
 aFallback.makeFallback();
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx 
b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index 5b73b3cbf714..4a211012e80d 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -668,11 +668,11 @@ void TestLanguageTag::testAllTags()
 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", ) );
 CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized );
 CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "unreg-and-bad", 
) );
-CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", , 
true) );
+CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", , 
LanguageTag::PrivateUse::DISALLOW) );
 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aCanonicalized );
-CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", 
, true) );
+CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", 
, LanguageTag::PrivateUse::DISALLOW) );
 CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aCanonicalized );
-CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", , 
true) );
+CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", , 
LanguageTag::PrivateUse::DISALLOW) );
 CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized );
 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", 
) );
 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aCanonicalized );
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index 6d20c7304639..0b1ab1ac5a3e 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -2838,7 +2838,8 @@ LanguageType 
LanguageTag::convertToLanguageTypeWithFallback( const css::lang::Lo
 
 
 // static
-bool LanguageTag::isValidBcp47( const OUString& rString, OUString* 
o_pCanonicalized, bool bDisallowPrivate )
+bool LanguageTag::isValidBcp47( const OUString& rString, OUString* 
o_pCanonicalized,
+LanguageTag::PrivateUse ePrivateUse )
 {
 bool bValid = false;
 
@@ -2865,7 +2866,7 @@ bool LanguageTag::isValidBcp47( const OUString& rString, 
OUString* o_pCanonicali
 if (pTag)
 {
 bValid = true;
-if (bDisallowPrivate)
+if (ePrivateUse != PrivateUse::ALLOW)
 {
 const lt_string_t* pPrivate = lt_tag_get_privateuse( 
aVar.mpLangtag);
 if (pPrivate && lt_string_length( pPrivate) > 0)
diff --git a/include/i18nlangtag/languagetag.hxx 
b/include/i18nlangtag/languagetag.hxx
index 3b5fb3d6d445..5b9a43c05d81 100644
--- a/include/i18nlangtag/languagetag.hxx
+++ b/include/i18nlangtag/languagetag.hxx
@@ -515,6 +515,13 @@ public:
  */
 static LanguageType convertToLanguageTypeWithFallback( const 
css::lang::Locale& rLocale );
 
+/** Enums to be used with isValidBcp47(). */
+enum PrivateUse
+{
+ALLOW = 0,
+DISALLOW
+};
+
 /** If rString represents a valid BCP 47 language tag.
 
 Never resolves an empty tag to the system locale, in fact an empty
@@ -527,13 +534,13 @@ public:
 original string even if that was a valid tag. If rString is not
 a valid tag, nothing is assigned.
 
-

[Libreoffice-commits] core.git: editeng/source include/vcl osx/soffice.xcodeproj sw/source vcl/inc vcl/qa vcl/source

2022-08-31 Thread Khaled Hosny (via logerrit)
 editeng/source/items/svxfont.cxx  |2 
 include/vcl/outdev.hxx|2 
 include/vcl/vcllayout.hxx |6 +-
 osx/soffice.xcodeproj/project.pbxproj |7 ++
 sw/source/core/inc/drawfont.hxx   |   13 +
 sw/source/core/text/inftxt.cxx|   12 
 sw/source/core/text/inftxt.hxx|4 +
 sw/source/core/text/itrcrsr.cxx   |   29 ++--
 sw/source/core/txtnode/fntcache.cxx   |   41 +++--
 sw/source/core/txtnode/swfont.cxx |   16 ++
 vcl/inc/sallayout.hxx |7 +-
 vcl/qa/cppunit/complextext.cxx|   82 ++
 vcl/source/gdi/CommonSalLayout.cxx|   50 ++--
 vcl/source/gdi/sallayout.cxx  |   18 ---
 vcl/source/outdev/text.cxx|8 +--
 15 files changed, 253 insertions(+), 44 deletions(-)

New commits:
commit 8cb4db941f91cc234dd18c61f8b1e51f65360d1f
Author: Khaled Hosny 
AuthorDate: Fri Aug 26 22:20:55 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 31 08:29:49 2022 +0200

tdf#30731: Improve caret travelling in Writer

Previously, when measuring caret position, Writer would measure the
width of the substring before the caret (i.e. layout it independent of
the text after the caret and measure its width).

This is incorrect, though. It assumes cutting the string laying it out
would result in the same width as when laid out as part of a bigger
string, which is invalid assumption when e.g. cutting inside a ligature
or between letters that have different shapes when next to each other,
etc.

This appears to work when the width of the substring laid out alone is
close enough to its width when laid out with the full text. But in cases
where is widths are largely different, like the extreme case in the bug
report, the caret will be jumping around as it is positioned based on
the unligated glyphs not the ligated, rendered glyphs.

This change introduces a special mode of measuring text width for caret
positioning, that will layout the whole string that return the width of
the requested substring.

Fields and small caps text are trickier to handle, so old behaviour is
retained for them. Now one will probably notice but if they do, it can
be dealt with then.

This also tries to be conservative and keep other pleases using the
existing behaviour which might be desirable (e.g. when measuring text
width for line breaking, we want the unligated width), but there might
be other places that should use the new behaviour.

To handle caret inside ligatures, the grapheme clusters in the ligature
are counted and the width of the whole ligature is distributed on them
evenly. A further improvement would be using HarfBuzz API to get
ligature caret positions for fonts that provide them, which helps when
the ligature components have different widths.

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

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 868b830c63cc..65191cab8ed7 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -37,7 +37,7 @@ static tools::Long GetTextArray( const OutputDevice* pOut, 
const OUString& rStr,
 
 {
 const SalLayoutGlyphs* layoutGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(pOut, rStr, nIndex, nLen);
-return pOut->GetTextArray( rStr, pDXAry, nIndex, nLen, nullptr, 
layoutGlyphs);
+return pOut->GetTextArray( rStr, pDXAry, nIndex, nLen, false, nullptr, 
layoutGlyphs);
 }
 
 SvxFont::SvxFont()
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 27e7650e8f72..1162ef3c116e 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1043,7 +1043,7 @@ public:
SalLayoutFlags flags = 
SalLayoutFlags::NONE,
const SalLayoutGlyphs* 
pLayoutCache = nullptr);
 tools::LongGetTextArray( const OUString& rStr, 
std::vector* pDXAry,
-  sal_Int32 nIndex = 0, sal_Int32 
nLen = -1,
+  sal_Int32 nIndex = 0, sal_Int32 
nLen = -1, bool bCaret = false,
   vcl::text::TextLayoutCache 
const* = nullptr,
   SalLayoutGlyphs const*const 
pLayoutCache = nullptr) const;
 
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index e63d365b49c4..cb88760cd98e 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 
@@ -94,8 +95,8 @@ public:
 
 // methods using 

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

2022-08-29 Thread Stanislav Lopatin (via logerrit)
 editeng/source/editeng/editobj.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 91f91815124c00727eefdd92fbed2d927faaf60b
Author: Stanislav Lopatin 
AuthorDate: Sat Aug 13 11:40:24 2022 +0500
Commit: Mike Kaganski 
CommitDate: Tue Aug 30 06:36:06 2022 +0200

tdf#145538 Change common loops to range based.

Just convert some loops to range based.

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

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index ce39e37d3d83..6d57c7497c2b 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -150,12 +150,12 @@ void ContentInfo::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 (void)xmlTextWriterWriteString(pWriter, BAD_CAST(aText.replaceAll("\x01", 
"").toUtf8().getStr()));
 (void)xmlTextWriterEndElement(pWriter);
 aParaAttribs.dumpAsXml(pWriter);
-for (size_t i=0; idumpAsXml(pWriter);
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("start"), 
"%" SAL_PRIdINT32, rCharAttribs.GetStart());
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("end"), "%" 
SAL_PRIdINT32, rCharAttribs.GetEnd());
+rCharAttribs.GetItem()->dumpAsXml(pWriter);
 (void)xmlTextWriterEndElement(pWriter);
 }
 (void)xmlTextWriterEndElement(pWriter);


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

2022-08-26 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editdoc.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b4339ccd5e161ec156d67babd4095a1b55f315fc
Author: Caolán McNamara 
AuthorDate: Fri Aug 26 08:56:04 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 26 11:12:04 2022 +0200

cid#1500704 silence Resource leak

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

diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 41a8cf20f1b8..c3777f111783 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2121,6 +2121,7 @@ void EditDoc::Release(sal_Int32 nPos)
 SAL_WARN( "editeng", "EditDoc::Release - out of bounds pos " << nPos);
 return;
 }
+// coverity[leaked_storage] - this is on purpose, ownership should be 
transferred to undo/redo
 (void)maContents[nPos].release();
 maContents.erase(maContents.begin() + nPos);
 }


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

2022-08-26 Thread Eike Rathke (via logerrit)
 editeng/source/misc/acorrcfg.cxx |   75 +++
 1 file changed, 75 insertions(+)

New commits:
commit ae975b3ddab520906ead4314cef1752be999ad6f
Author: Eike Rathke 
AuthorDate: Thu Aug 25 20:51:10 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Aug 26 10:08:07 2022 +0200

Resolves: tdf#150371 Scan autocorr dirs for language tags to add to list

Such that dropping an acor_art-x-mylang.dat file or with any other
valid language tag creates a language list entry if none exists
yet, so it can be chosen in character attribution and the
autocorrection data be used.

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

diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 4508a1f6e7a9..a97e5077ccb6 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -22,9 +22,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -34,6 +38,76 @@ using namespace com::sun::star;
 using namespace com::sun::star::uno;
 
 
+/** An autocorrection file dropped into such directory may create a language
+list entry if one didn't exist already.
+ */
+static void scanAutoCorrectDirForLanguageTags( const OUString& rURL )
+{
+// Silently ignore all errors.
+try
+{
+::ucbhelper::Content aContent( rURL,
+uno::Reference(), 
comphelper::getProcessComponentContext());
+if (aContent.isFolder())
+{
+// Title is file name here.
+uno::Reference xResultSet = 
aContent.createCursor(
+{"Title"}, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY);
+uno::Reference xRow( xResultSet, UNO_QUERY);
+if (xResultSet.is() && xRow.is())
+{
+while (xResultSet->next())
+{
+try
+{
+const OUString aTitle( xRow->getString(1));
+if (aTitle.getLength() <= 9 || 
!(aTitle.startsWith("acor_") && aTitle.endsWith(".dat")))
+continue;
+
+const OUString aBcp47( aTitle.copy( 5, 
aTitle.getLength() - 9));
+OUString aCanonicalized;
+// Ignore invalid langtags and canonicalize for good,
+// allow private-use tags.
+if (!LanguageTag::isValidBcp47( aBcp47, 
))
+continue;
+
+const LanguageTag aLanguageTag( aCanonicalized);
+if (SvtLanguageTable::HasLanguageType( 
aLanguageTag.getLanguageType()))
+continue;
+
+// Insert language-only tags only if there is no known
+// matching fallback locale, otherwise we'd end up with
+// unwanted entries where a language autocorrection
+// file covers several locales. We do know a few
+// art-x-... though so exclude those and any other
+// private-use tag (which should not fallback, but
+// avoid).
+if (aLanguageTag.getCountry().isEmpty()
+&& LanguageTag::isValidBcp47( aCanonicalized, 
nullptr, true))
+{
+LanguageTag aFallback( aLanguageTag);
+aFallback.makeFallback();
+if (aFallback.getLanguage() == 
aLanguageTag.getLanguage())
+continue;
+}
+
+// Finally add this one.
+SvtLanguageTable::AddLanguageTag( aLanguageTag);
+}
+catch (const uno::Exception&)
+{
+TOOLS_WARN_EXCEPTION("editeng", "Unable to get 
directory entry.");
+}
+}
+}
+}
+}
+catch (const uno::Exception&)
+{
+TOOLS_WARN_EXCEPTION("editeng", "Unable to iterate directory.");
+}
+}
+
 SvxAutoCorrCfg::SvxAutoCorrCfg() :
 aBaseConfig(*this),
 aSwConfig(*this),
@@ -60,6 +134,7 @@ SvxAutoCorrCfg::SvxAutoCorrCfg() :
 for( OUString* pS : { ,  } )
 {
 INetURLObject aPath( *pS );
+scanAutoCorrectDirForLanguageTags( 
aPath.GetMainURL(INetURLObject::DecodeMechanism::ToIUri));
 aPath.insertName(u"acor");
 *pS = aPath.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
 }


  1   2   3   4   5   6   7   8   9   10   >