[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/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 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 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 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 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 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 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 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 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 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 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 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 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 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 include/editeng include/vcl vcl/inc vcl/source

2022-08-23 Thread Khaled Hosny (via logerrit)
 editeng/source/items/svxfont.cxx |   28 
 include/editeng/svxfont.hxx  |6 -
 include/vcl/font.hxx |3 ++
 include/vcl/rendercontext/SalLayoutFlags.hxx |3 +-
 vcl/inc/impfont.hxx  |1 
 vcl/source/font/font.cxx |   31 ++-
 vcl/source/gdi/CommonSalLayout.cxx   |6 -
 vcl/source/outdev/text.cxx   |3 ++
 vcl/source/text/ImplLayoutArgs.cxx   |1 
 9 files changed, 59 insertions(+), 23 deletions(-)

New commits:
commit b9f0caad5d9e628f82d5148dfc7d2436d32817e2
Author: Khaled Hosny 
AuthorDate: Tue Aug 23 04:13:28 2022 +0200
Commit: خالد حسني 
CommitDate: Tue Aug 23 09:24:52 2022 +0200

tdf#66819: Disable ligatures with character spacing

When character spacing is not zero, optional ligatures should be
disabled (e.g. this what CSS requires and what browsers implement:
https://drafts.csswg.org/css-text/#letter-spacing-property).

This disables both “liga” and “clig” OpenType features because they are
optional features and are enabled by default, it does not disable “rlig”
because it is for orthographically-required ligatures, nor “dlig” or
“hlig” because they are disabled by default.

The character spacing values (confusingly called kerning in the source
code) are moved from SvxFont to vcl::Font so it can’t be accessed in
OutputDevice and pass the relevant flag to SalLayout.

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

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index ac360873824a..868b830c63cc 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -42,7 +42,7 @@ static tools::Long GetTextArray( const OutputDevice* pOut, 
const OUString& rStr,
 
 SvxFont::SvxFont()
 {
-nKern = nEsc = 0;
+nEsc = 0;
 nPropr = 100;
 eCaseMap = SvxCaseMap::NotMapped;
 SetLanguage(LANGUAGE_SYSTEM);
@@ -51,7 +51,7 @@ SvxFont::SvxFont()
 SvxFont::SvxFont( const vcl::Font  )
 : Font( rFont )
 {
-nKern = nEsc = 0;
+nEsc = 0;
 nPropr = 100;
 eCaseMap = SvxCaseMap::NotMapped;
 SetLanguage(LANGUAGE_SYSTEM);
@@ -60,7 +60,6 @@ SvxFont::SvxFont( const vcl::Font  )
 SvxFont::SvxFont( const SvxFont  )
 : Font( rFont )
 {
-nKern = rFont.GetFixKerning();
 nEsc  = rFont.GetEscapement();
 nPropr = rFont.GetPropr();
 eCaseMap = rFont.GetCaseMap();
@@ -409,7 +408,7 @@ vcl::Font SvxFont::ChgPhysFont(OutputDevice& rOut) const
 Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, const OUString ,
  const sal_Int32 nIdx, const sal_Int32 nLen ) const
 {
-if ( !IsCaseMap() && !IsKern() )
+if ( !IsCaseMap() && !IsFixKerning() )
 return Size( pOut->GetTextWidth( rTxt, nIdx, nLen ),
  pOut->GetTextHeight() );
 
@@ -439,8 +438,9 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, 
const OUString ,
 aTxtSize.setWidth(nWidth);
 }
 
-if( IsKern() && ( nLen > 1 ) )
+if( IsFixKerning() && ( nLen > 1 ) )
 {
+auto nKern = GetFixKerning();
 std::vector aDXArray(nLen);
 GetTextArray(pOut, rTxt, , nIdx, nLen);
 tools::Long nOldValue = aDXArray[0];
@@ -461,7 +461,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, 
const OUString ,
 
 Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut )
 {
-if ( !IsCaseMap() && !IsKern() )
+if ( !IsCaseMap() && !IsFixKerning() )
 return Size( pOut->GetTextWidth( "" ), pOut->GetTextHeight() );
 
 Size aTxtSize;
@@ -477,14 +477,14 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut )
 Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString ,
  const sal_Int32 nIdx, const sal_Int32 nLen, 
std::vector* pDXArray ) const
 {
-if ( !IsCaseMap() && !IsKern() )
+if ( !IsCaseMap() && !IsFixKerning() )
 return Size( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ),
  pOut->GetTextHeight() );
 
 std::vector  aDXArray;
 
 // We always need pDXArray to count the number of kern spaces
-if (!pDXArray && IsKern() && nLen > 1)
+if (!pDXArray && IsFixKerning() && nLen > 1)
 {
 pDXArray = 
 aDXArray.reserve(nLen);
@@ -498,8 +498,9 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, 
const OUString ,
 aTxtSize.setWidth( GetTextArray( pOut, CalcCaseMap( rTxt ),
pDXArray, nIdx, nLen ) );
 
-if( IsKern() && ( nLen > 1 ) )
+if( IsFixKerning() && ( nLen > 1 ) )
 {
+auto nKern = GetFixKerning();
 tools::Long nOldValue = (*pDXArray)[0];
 tools::Long nSpaceSum = nKern;
 

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

2022-08-12 Thread Justin Luth (via logerrit)
 editeng/source/items/numitem.cxx |   18 ++
 include/editeng/numitem.hxx  |4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 835cda561217bd8c53af2de927158dd5712b06c0
Author: Justin Luth 
AuthorDate: Tue Aug 2 13:30:31 2022 -0400
Commit: Justin Luth 
CommitDate: Fri Aug 12 16:27:42 2022 +0200

related tdf#150197: use SetListFormat or SetPrefix/Suffix

GetListFormat DEPENDS on having managed prefix/suffix itself,
since it uses their getLength to modify the sListFormat.
So any modification via SetPrefix/Suffix
(potentially) invalidates the ListFormat.
I added some code to ensure this doesn't get out of sync.

One place that still uses PREFIX/SUFFIX is old ODT files.
After import they are updated, but during import they use
the old UNO properties, so I didn't add any assert here.

Change-Id: I3bab780fb8e8e985c3573075bc7aac9216d116d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138073
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
Reviewed-by: Justin Luth 

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 1239ea529126..e8c1c4d9a77c 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -559,6 +559,24 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 
nNo, bool bUpper )
   : sRet.makeStringAndClear().toAsciiLowerCase();
 }
 
+void SvxNumberFormat::SetPrefix(const OUString& rSet)
+{
+// ListFormat manages the prefix. If badly changed via this function, 
sListFormat is invalidated
+if (sListFormat && rSet.getLength() != sPrefix.getLength())
+sListFormat.reset();
+
+sPrefix = rSet;
+}
+
+void SvxNumberFormat::SetSuffix(const OUString& rSet)
+{
+// ListFormat manages the suffix. If badly changed via this function, 
sListFormat is invalidated
+if (sListFormat && rSet.getLength() != sSuffix.getLength())
+sListFormat.reset();
+
+sSuffix = rSet;
+}
+
 void SvxNumberFormat::SetListFormat(const OUString& rPrefix, const OUString& 
rSuffix, int nLevel)
 {
 sPrefix = rPrefix;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index baa6ad3204e1..aea72d86a7ed 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -167,9 +167,9 @@ public:
 
 voidSetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
 SvxAdjust   GetNumAdjust() const {return eNumAdjust;}
-voidSetPrefix(const OUString& rSet) { sPrefix = rSet;}
+voidSetPrefix(const OUString& rSet);
 const OUString& GetPrefix() const { return sPrefix;}
-voidSetSuffix(const OUString& rSet) { sSuffix = rSet;}
+voidSetSuffix(const OUString& rSet);
 const OUString& GetSuffix() const { return sSuffix;}
 // Based on prefix and suffix initialize them (for backward compatibility) 
and generate listformat string
 voidSetListFormat(const OUString& rPrefix, const OUString& 
rSuffix, int nLevel);


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

2022-08-02 Thread Justin Luth (via logerrit)
 editeng/source/uno/unotext.cxx  |   33 +++---
 include/editeng/unotext.hxx |3 -
 sd/qa/uitest/data/tdf148810_PARA_OUTLLEVEL.pptx |binary
 sd/qa/uitest/impress_tests/tdf148810.py |   55 
 4 files changed, 63 insertions(+), 28 deletions(-)

New commits:
commit f7b5eefc36f6a7627e867651bafe38bdeb2f9c00
Author: Justin Luth 
AuthorDate: Thu Jul 28 09:03:13 2022 -0400
Commit: Miklos Vajna 
CommitDate: Tue Aug 2 08:15:26 2022 +0200

tdf#148810 pptx import: Depth set by EE_PARA_OUTLLEVEL

It isn't enough to do Paragraph->SetDepth().
It must match the property EE_PARA_OUTLLEVEL.

So I was hoping that the only thing I needed was the
"set property" helper. But unit tests showed that I also needed
"get property" to return an empty aAny instead of a -1.

My confidence level on this one is fairly low.
This code is way too tangled and weird.
I'm sure the concept is right (that the property is the
most important thing) but all of the wonkiness around
the level means any changes to the implementation
will be fragile.

make UITest_impress_tests \
  UITEST_TEST_NAME=tdf148810.Tdf148810.test_Tdf148810

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

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e0ca965c5d3f..4f831a70a30f 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -507,7 +507,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const 
SfxItemPropertyMapEntry*
 return !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is());
 }
 
-case WID_NUMLEVEL:
+case EE_PARA_OUTLLEVEL:
 {
 SvxTextForwarder* pForwarder = pEditSource? 
pEditSource->GetTextForwarder() : nullptr;
 if(pForwarder && pSelection)
@@ -519,7 +519,8 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const 
SfxItemPropertyMapEntry*
 if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel 
) )
 throw lang::IllegalArgumentException();
 
-return true;
+// If valid, then not yet finished. Also needs to be added 
to paragraph props.
+return nLevel < -1 || nLevel > 9;
 }
 }
 }
@@ -684,7 +685,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper(  
SfxItemSet const & rSet, cons
 }
 break;
 
-case WID_NUMLEVEL:
+case EE_PARA_OUTLLEVEL:
 {
 SvxTextForwarder* pForwarder = pEditSource? 
pEditSource->GetTextForwarder() : nullptr;
 if(pForwarder && pSelection)
@@ -976,7 +977,6 @@ beans::PropertyState 
SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
 }
 break;
 
-case WID_NUMLEVEL:
 case WID_NUMBERINGSTARTVALUE:
 case WID_PARAISNUMBERINGRESTART:
 eItemState = SfxItemState::SET;
@@ -1110,7 +1110,6 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const 
SfxItemSet* pSet, const Sf
 }
 break;
 
-case WID_NUMLEVEL:
 case WID_NUMBERINGSTARTVALUE:
 case WID_PARAISNUMBERINGRESTART:
 eItemState = SfxItemState::SET;
@@ -1215,12 +1214,6 @@ void 
SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co
 {
 SvxUnoFontDescriptor::setPropertyToDefault( aSet );
 }
-else if( pMap->nWID == WID_NUMLEVEL )
-{
-// #101004# Call interface method instead of unsafe cast
-pForwarder->SetDepth( maSelection.nStartPara, -1 );
-return;
-}
 else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
 {
 pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
@@ -1263,7 +1256,7 @@ uno::Any SAL_CALL 
SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp
 case WID_FONTDESC:
 return SvxUnoFontDescriptor::getPropertyDefault( pPool );
 
-case WID_NUMLEVEL:
+case EE_PARA_OUTLLEVEL:
 {
 uno::Any aAny;
 return aAny;
@@ -1969,8 +1962,8 @@ static void SvxPropertyValuesToItemSet(
 SfxItemSet ,
 const uno::Sequence< beans::PropertyValue >& rPropertyValues,
 const SfxItemPropertySet *pPropSet,
-SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
-sal_Int32 nPara /*needed for WID_NUMLEVEL*/)
+SvxTextForwarder *pForwarder,
+sal_Int32 nPara)
 {
 for (const beans::PropertyValue& rProp : rPropertyValues)
 {
@@ -1993,18 +1986,6 @@ static void SvxPropertyValuesToItemSet(
 if (rProp.Value >>= aDesc)
 

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

2022-06-26 Thread Balazs Varga (via logerrit)
 editeng/source/items/frmitems.cxx |   12 +--
 include/editeng/brushitem.hxx |5 
 sc/qa/unit/data/xlsx/tdf148820.xlsx   |binary
 sc/qa/unit/subsequent_export_test2.cxx|   32 ++
 sc/source/filter/inc/stylesbuffer.hxx |2 +
 sc/source/filter/oox/autofilterbuffer.cxx |2 -
 sc/source/filter/oox/stylesbuffer.cxx |   17 +--
 7 files changed, 64 insertions(+), 6 deletions(-)

New commits:
commit 415dc3bb1c03dbdbc3cbca274bc435ac7557ba2d
Author: Balazs Varga 
AuthorDate: Fri Jun 17 16:51:22 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Sun Jun 26 22:15:02 2022 +0200

tdf#148820 sc: fix conditional formatted cell color

Store foreground color for color filtering, because in OOXML
the foreground color is used for color filtering and we overwrote
it with the background color which is used for conditional formatted cells 
too.

Regression from commit: 6f908b48373b71d45c8119b296b0504fb586f6f8
(tdf#143104 Fix xlsx import/export of color filter colors)

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 4bbca9a2c0c1..c4c79dc0428b 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2832,6 +2832,7 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew )
 SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich)
 : SfxPoolItem(_nWhich)
 , aColor(COL_TRANSPARENT)
+, aFilterColor(COL_TRANSPARENT)
 , nShadingValue(ShadingPattern::CLEAR)
 , nGraphicTransparency(0)
 , eGraphicPos(GPOS_NONE)
@@ -2842,6 +2843,7 @@ SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich)
 SvxBrushItem::SvxBrushItem(const Color& rColor, sal_uInt16 _nWhich)
 : SfxPoolItem(_nWhich)
 , aColor(rColor)
+, aFilterColor(COL_TRANSPARENT)
 , nShadingValue(ShadingPattern::CLEAR)
 , nGraphicTransparency(0)
 , eGraphicPos(GPOS_NONE)
@@ -2852,6 +2854,7 @@ SvxBrushItem::SvxBrushItem(const Color& rColor, 
sal_uInt16 _nWhich)
 SvxBrushItem::SvxBrushItem(const Graphic& rGraphic, SvxGraphicPosition ePos, 
sal_uInt16 _nWhich)
 : SfxPoolItem(_nWhich)
 , aColor(COL_TRANSPARENT)
+, aFilterColor(COL_TRANSPARENT)
 , nShadingValue(ShadingPattern::CLEAR)
 , xGraphicObject(new GraphicObject(rGraphic))
 , nGraphicTransparency(0)
@@ -2864,6 +2867,7 @@ SvxBrushItem::SvxBrushItem(const Graphic& rGraphic, 
SvxGraphicPosition ePos, sal
 SvxBrushItem::SvxBrushItem(const GraphicObject& rGraphicObj, 
SvxGraphicPosition ePos, sal_uInt16 _nWhich)
 : SfxPoolItem(_nWhich)
 , aColor(COL_TRANSPARENT)
+, aFilterColor(COL_TRANSPARENT)
 , nShadingValue(ShadingPattern::CLEAR)
 , xGraphicObject(new GraphicObject(rGraphicObj))
 , nGraphicTransparency(0)
@@ -2877,6 +2881,7 @@ SvxBrushItem::SvxBrushItem(OUString aLink, OUString 
aFilter,
SvxGraphicPosition ePos, sal_uInt16 _nWhich)
 : SfxPoolItem(_nWhich)
 , aColor(COL_TRANSPARENT)
+, aFilterColor(COL_TRANSPARENT)
 , nShadingValue(ShadingPattern::CLEAR)
 , nGraphicTransparency(0)
 , maStrLink(std::move(aLink))
@@ -2890,6 +2895,7 @@ SvxBrushItem::SvxBrushItem(OUString aLink, OUString 
aFilter,
 SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem)
 : SfxPoolItem(rItem)
 , aColor(rItem.aColor)
+, aFilterColor(rItem.aFilterColor)
 , nShadingValue(rItem.nShadingValue)
 , xGraphicObject(rItem.xGraphicObject ? new 
GraphicObject(*rItem.xGraphicObject) : nullptr)
 , nGraphicTransparency(rItem.nGraphicTransparency)
@@ -2903,6 +2909,7 @@ SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem)
 SvxBrushItem::SvxBrushItem(SvxBrushItem&& rItem)
 : SfxPoolItem(std::move(rItem))
 , aColor(std::move(rItem.aColor))
+, aFilterColor(std::move(rItem.aFilterColor))
 , nShadingValue(std::move(rItem.nShadingValue))
 , xGraphicObject(std::move(rItem.xGraphicObject))
 , nGraphicTransparency(std::move(rItem.nGraphicTransparency))
@@ -3157,8 +3164,8 @@ bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) 
const
 assert(SfxPoolItem::operator==(rAttr));
 
 const SvxBrushItem& rCmp = static_cast(rAttr);
-bool bEqual = ( aColor == rCmp.aColor && eGraphicPos == rCmp.eGraphicPos &&
-nGraphicTransparency == rCmp.nGraphicTransparency);
+bool bEqual = ( aColor == rCmp.aColor && aFilterColor == rCmp.aFilterColor 
&&
+eGraphicPos == rCmp.eGraphicPos && nGraphicTransparency == 
rCmp.nGraphicTransparency);
 
 if ( bEqual )
 {
@@ -3366,6 +3373,7 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBrushItem"));
 (void)xmlTextWriterWriteAttribute(pWriter, 

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

2022-06-08 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx  |   12 
 include/editeng/boxitem.hxx|2 
 sw/CppunitTest_sw_filter_ww8.mk|   75 +
 sw/Module_sw.mk|1 
 sw/qa/filter/ww8/data/negative-page-border.doc |binary
 sw/qa/filter/ww8/ww8.cxx   |   55 ++
 writerfilter/source/dmapper/PropertyMap.cxx|2 
 7 files changed, 135 insertions(+), 12 deletions(-)

New commits:
commit 51942eafdb4439559b6d59f3becd4afab45277f0
Author: Miklos Vajna 
AuthorDate: Wed Jun 8 09:08:27 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 8 12:07:48 2022 +0200

DOC import: allow negative page border distances

In case the margin (distance between body frame and page frame) is
smaller than the border spacing (distance between border and page
frame), then we can map that to a negative border distance during the
import of DOCX files since commit
1f127a2b9e1c1daab0972f98fc8708ecb7afa299 (sw layout: allow negative page
border distances, 2022-06-07), but DOC import had the same problem.

The above commit intentionally kept the default behavior of
BorderDistanceFromWord() unchanged to avoid side effects in other
clients of that function (not DOCX import), but means that DOC import
was still broken.

Given that it turns out there are only 2 callers of
BorderDistanceFromWord(), fix the problem by allowing negative border
distances unconditionally: this simplifies code & SetBorderDistance() in
the DOC import will now get the correct border distance out of the box.

DOC export works out of the box without any additional work.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 9780af4904c0..c1b9e66de5a7 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2452,7 +2452,7 @@ namespace editeng
 {
 
 void BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin, sal_Int32& 
nBorderDistance,
-sal_Int32 nBorderWidth, bool bAllowNegativeBorderDistance)
+sal_Int32 nBorderWidth)
 {
 // See 
https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
 
@@ -2479,15 +2479,7 @@ void BorderDistanceFromWord(bool bFromEdge, sal_Int32& 
nMargin, sal_Int32& nBord
 }
 else if (nNewBorderDistance < 0)
 {
-if (bAllowNegativeBorderDistance)
-{
-nNewMargin = nMargin;
-}
-else
-{
-nNewMargin = std::max(nMargin - nBorderWidth, 0);
-nNewBorderDistance = 0;
-}
+nNewMargin = nMargin;
 }
 
 nMargin = nNewMargin;
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
index 750993c91f7d..786821c02ff0 100644
--- a/include/editeng/boxitem.hxx
+++ b/include/editeng/boxitem.hxx
@@ -241,7 +241,7 @@ namespace editeng
 {
 
 void EDITENG_DLLPUBLIC BorderDistanceFromWord(bool bFromEdge, sal_Int32& 
nMargin,
-sal_Int32& nBorderDistance, sal_Int32 nBorderWidth, bool 
bAllowNegativeBorderDistance = false);
+sal_Int32& nBorderDistance, sal_Int32 nBorderWidth);
 
 struct EDITENG_DLLPUBLIC WordPageMargins final
 {
diff --git a/sw/CppunitTest_sw_filter_ww8.mk b/sw/CppunitTest_sw_filter_ww8.mk
new file mode 100644
index ..0452776478df
--- /dev/null
+++ b/sw/CppunitTest_sw_filter_ww8.mk
@@ -0,0 +1,75 @@
+# -*- 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,sw_filter_ww8))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_filter_ww8))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_filter_ww8, \
+sw/qa/filter/ww8/ww8 \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_filter_ww8, \
+comphelper \
+cppu \
+cppuhelper \
+editeng \
+sal \
+sfx \
+svl \
+svx \
+svxcore \
+sw \
+swqahelper \
+test \
+unotest \
+utl \
+vcl \
+tl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_filter_ww8,\
+boost_headers \
+libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_filter_ww8,\
+-I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
+-I$(SRCDIR)/sw/source/uibase/inc \
+-I$(SRCDIR)/sw/qa/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call 

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

2022-05-06 Thread Kohei Yoshida (via logerrit)
 editeng/source/editeng/editeng.cxx  |8 +++---
 editeng/source/editeng/editview.cxx |6 ++---
 editeng/source/editeng/edtspell.cxx |4 +--
 editeng/source/editeng/impedit.hxx  |2 -
 editeng/source/editeng/impedit3.cxx |4 +--
 editeng/source/editeng/impedit4.cxx |   43 +---
 editeng/source/editeng/textconv.cxx |2 -
 editeng/source/outliner/outlin2.cxx |2 -
 editeng/source/outliner/outlvw.cxx  |2 -
 editeng/source/uno/unofored.cxx |2 -
 include/editeng/editdata.hxx|   13 ++
 include/editeng/editeng.hxx |4 +--
 sc/source/ui/view/spelleng.cxx  |   29 +++-
 svx/source/dialog/weldeditview.cxx  |2 -
 14 files changed, 86 insertions(+), 37 deletions(-)

New commits:
commit f15e6293cf78d67963a6e512f60a11ae58da72c5
Author: Kohei Yoshida 
AuthorDate: Fri May 6 19:37:14 2022 -0400
Commit: Kohei Yoshida 
CommitDate: Sat May 7 04:52:50 2022 +0200

tdf#107765: Check the updated language and apply it to the cell.

During the normal spell-checking in Calc, the user may change the
language on the string segment with a spelling error, which is supposed
to be applied back to that segment in the cell, but was not. This change
should fix it.

In case the new language is applied to the entire cell string, we will
set the new lanuage to the cell as a cell attribute and keep the string
as a simple string.  Otherwise, the new language gets applied to the
edit engine string.

This commit also changes the return value of EditEngine::GetLanguage()
to include the string span information in addition to the language
value.

Change-Id: I713ec7aefe571f721321cd8ea687f616ab4dd61a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133966
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida 

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 4e87300fd006..5869bcdeeeb4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -478,16 +478,16 @@ SvtScriptType EditEngine::GetScriptType( const 
ESelection& rSelection ) const
 return pImpEditEngine->GetItemScriptType( aSel );
 }
 
-LanguageType EditEngine::GetLanguage(const EditPaM& rPaM) const
+editeng::LanguageSpan EditEngine::GetLanguage(const EditPaM& rPaM) const
 {
 return pImpEditEngine->GetLanguage(rPaM);
 }
 
-LanguageType EditEngine::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
+editeng::LanguageSpan EditEngine::GetLanguage( sal_Int32 nPara, sal_Int32 nPos 
) const
 {
 ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
 DBG_ASSERT( pNode, "GetLanguage - nPara is invalid!" );
-return pNode ? pImpEditEngine->GetLanguage( EditPaM( pNode, nPos ) ) : 
LANGUAGE_DONTKNOW;
+return pNode ? pImpEditEngine->GetLanguage( EditPaM( pNode, nPos ) ) : 
editeng::LanguageSpan{};
 }
 
 
@@ -1328,7 +1328,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, 
EditView* pEditView, v
 {
 OUString aComplete;
 
-LanguageType eLang = 
pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1));
+LanguageType eLang = 
pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), 
aStart.GetIndex()+1)).nLang;
 LanguageTag aLanguageTag( eLang);
 
 if 
(!pImpEditEngine->xLocaleDataWrapper.isInitialized())
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 8f199b79ea89..320fd52eab8c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1022,7 +1022,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, 
const Link  xSpellAlt =
-xSpeller->spell( aSelected, 
static_cast(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( 
aPaM2 )), aPropVals );
+xSpeller->spell( aSelected, 
static_cast(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( 
aPaM2 ).nLang), aPropVals );
 
 Reference< linguistic2::XLanguageGuessing >  xLangGuesser( 
EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
 
@@ -1102,7 +1102,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, 
const LinkgetDictionaries();
 pDic  = aDics.getConstArray();
-LanguageType nCheckedLanguage = 
pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
+LanguageType nCheckedLanguage = 
pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ).nLang;
 sal_uInt16 nDicCount = static_cast(aDics.getLength());
 for (sal_uInt16 i = 0; i < nDicCount; i++)
 {
@@ -1254,7 +1254,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, 
const LinkPutText( aSelected, aWord, 
pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ) );
+ 

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

2022-04-12 Thread Luboš Luňák (via logerrit)
 editeng/source/editeng/editeng.cxx  |5 +
 editeng/source/editeng/impedit.hxx  |3 +++
 editeng/source/editeng/impedit2.cxx |1 +
 editeng/source/editeng/impedit3.cxx |   21 -
 include/editeng/editeng.hxx |4 
 sc/source/ui/view/output2.cxx   |5 +
 6 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit e3830b06a9886620ed432a011d2de2abbb7a3a12
Author: Luboš Luňák 
AuthorDate: Tue Apr 12 18:21:35 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Apr 12 22:16:05 2022 +0200

don't FormatDoc() a whole long text if not necessary (tdf#144515)

The testcase has a very long text in a cell that is really high
enough to hold only one line of text, yet EditEngine formats and
wraps the entire string. Which can be expensive because of calling
into text layout to find out width of a text portion, and this
is done repeatedly for the yet-unformatted text, so pretty much
O(N^2). For top-aligned text it's enough to format only as much
as will fit and ignore the rest, so implement that and add
EditEngine::EnableSkipOutsideFormat() to enable the optimization.

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index eb7d1ad5a6fa..237c78264e72 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2856,6 +2856,11 @@ void EditEngine::DisableAttributeExpanding() {
 pImpEditEngine->GetEditDoc().DisableAttributeExpanding();
 }
 
+void EditEngine::EnableSkipOutsideFormat(bool set)
+{
+pImpEditEngine->EnableSkipOutsideFormat(set);
+}
+
 void EditEngine::SetLOKSpecialPaperSize(const Size& rSize)
 {
 pImpEditEngine->SetLOKSpecialPaperSize(rSize);
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 894bb822f676..e66988d60e0c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -604,6 +604,7 @@ private:
 boolbFirstWordCapitalization:1;   // specifies if 
auto-correction should capitalize the first word or not
 boolmbLastTryMerge:1;
 boolmbReplaceLeadingSingleQuotationMark:1;
+boolmbSkipOutsideFormat:1;
 
 boolmbNbspRunNext;  // can't be a bitfield as it is passed as 
bool&
 
@@ -1131,6 +1132,8 @@ public:
 /** Whether last AutoCorrect inserted a NO-BREAK SPACE that may need to be 
removed again. */
 boolIsNbspRunNext() const { return mbNbspRunNext; }
 
+void EnableSkipOutsideFormat(bool set) { mbSkipOutsideFormat = set; }
+
 void Dispose();
 void SetLOKSpecialPaperSize(const Size& rSize) { aLOKSpecialPaperSize = 
rSize; }
 const Size& GetLOKSpecialPaperSize() const { return aLOKSpecialPaperSize; }
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 4b7b3490d138..94cc2d479b36 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -123,6 +123,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* 
pItemPool ) :
 bFirstWordCapitalization(true),
 mbLastTryMerge(false),
 mbReplaceLeadingSingleQuotationMark(true),
+mbSkipOutsideFormat(false),
 mbNbspRunNext(false)
 {
 aStatus.GetControlWord() =  EEControlBits::USECHARATTRIBS | 
EEControlBits::DOIDLEFORMAT |
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index cdcc05100730..372237ff9c70 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -621,10 +621,18 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 return FinishCreateLines(  );
 }
 
+sal_Int64 nCurrentPosY = nStartPosY;
+// If we're allowed to skip parts outside and this cannot possibly fit in 
the given height,
+// bail out to avoid possibly formatting a lot of text that will not be 
used. For the first
+// paragraph still format at least a bit.
+if( mbSkipOutsideFormat && nPara != 0
+&& !aStatus.AutoPageHeight() && aPaperSize.Height() < nCurrentPosY )
+{
+return false;
+}
 
 // Initialization...
 
-
 // Always format for 100%:
 bool bMapChanged = ImpCheckRefMapMode();
 
@@ -1607,6 +1615,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 // as nEnd points to the last 
character!
 
 sal_Int32 nEndPortion = pLine->GetEndPortion();
+nCurrentPosY += pLine->GetHeight();
 
 // Next line or maybe a new line...
 pLine = nullptr;
@@ -1617,6 +1626,16 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 nDelFromLine = nLine;
  

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

2022-03-17 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleEditableTextPara.cxx |   36 +---
 include/editeng/AccessibleEditableTextPara.hxx  |4 +
 2 files changed, 19 insertions(+), 21 deletions(-)

New commits:
commit 0cdfe74271c1544e4b6bdc2bcd1ec087d672d81c
Author: Noel Grandin 
AuthorDate: Thu Mar 17 13:28:40 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 17 15:44:25 2022 +0100

use actual type in AccessibleEditableTextPara

instead of casting everywhere

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

diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index d074ddfd5a11..22576523f9e6 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -122,16 +122,15 @@ namespace accessibility
 try
 {
 // Create the state set.
-rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet  = new 
::utl::AccessibleStateSetHelper ();
-mxStateSet = pStateSet;
+mxStateSet  = new ::utl::AccessibleStateSetHelper ();
 
 // these are always on
-pStateSet->AddState( AccessibleStateType::MULTI_LINE );
-pStateSet->AddState( AccessibleStateType::FOCUSABLE );
-pStateSet->AddState( AccessibleStateType::VISIBLE );
-pStateSet->AddState( AccessibleStateType::SHOWING );
-pStateSet->AddState( AccessibleStateType::ENABLED );
-pStateSet->AddState( AccessibleStateType::SENSITIVE );
+mxStateSet->AddState( AccessibleStateType::MULTI_LINE );
+mxStateSet->AddState( AccessibleStateType::FOCUSABLE );
+mxStateSet->AddState( AccessibleStateType::VISIBLE );
+mxStateSet->AddState( AccessibleStateType::SHOWING );
+mxStateSet->AddState( AccessibleStateType::ENABLED );
+mxStateSet->AddState( AccessibleStateType::SENSITIVE );
 }
 catch (const uno::Exception&)
 {
@@ -573,22 +572,20 @@ namespace accessibility
 
 void AccessibleEditableTextPara::SetState( const sal_Int16 nStateId )
 {
-::utl::AccessibleStateSetHelper* pStateSet = static_cast< 
::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-if( pStateSet != nullptr &&
-!pStateSet->contains(nStateId) )
+if( mxStateSet != nullptr &&
+!mxStateSet->contains(nStateId) )
 {
-pStateSet->AddState( nStateId );
+mxStateSet->AddState( nStateId );
 FireEvent( AccessibleEventId::STATE_CHANGED, uno::makeAny( 
nStateId ) );
 }
 }
 
 void AccessibleEditableTextPara::UnSetState( const sal_Int16 nStateId )
 {
-::utl::AccessibleStateSetHelper* pStateSet = static_cast< 
::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-if( pStateSet != nullptr &&
-pStateSet->contains(nStateId) )
+if( mxStateSet != nullptr &&
+mxStateSet->contains(nStateId) )
 {
-pStateSet->RemoveState( nStateId );
+mxStateSet->RemoveState( nStateId );
 FireEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), 
uno::makeAny( nStateId ) );
 }
 }
@@ -941,9 +938,8 @@ namespace accessibility
 SolarMutexGuard aGuard;
 
 // Create a copy of the state set and return it.
-::utl::AccessibleStateSetHelper* pStateSet = static_cast< 
::utl::AccessibleStateSetHelper*>(mxStateSet.get());
 
-if( !pStateSet )
+if( !mxStateSet )
 return uno::Reference();
 uno::Reference xParentStates;
 if (getAccessibleParent().is())
@@ -953,9 +949,9 @@ namespace accessibility
 }
 if (xParentStates.is() && 
xParentStates->contains(AccessibleStateType::EDITABLE) )
 {
-pStateSet->AddState(AccessibleStateType::EDITABLE);
+mxStateSet->AddState(AccessibleStateType::EDITABLE);
 }
-return uno::Reference( new 
::utl::AccessibleStateSetHelper (*pStateSet) );
+return uno::Reference( new 
::utl::AccessibleStateSetHelper (*mxStateSet) );
 }
 
 lang::Locale SAL_CALL AccessibleEditableTextPara::getLocale()
diff --git a/include/editeng/AccessibleEditableTextPara.hxx 
b/include/editeng/AccessibleEditableTextPara.hxx
index 02f907704bdb..0d405094b933 100644
--- a/include/editeng/AccessibleEditableTextPara.hxx
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,7 @@ class MapMode;
 class SvxAccessibleTextAdapter;
 class SvxAccessibleTextEditViewAdapter;
 namespace accessibility { class AccessibleImageBullet; }
+namespace utl { 

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

2022-03-17 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleContextBase.cxx |   20 -
 include/editeng/AccessibleContextBase.hxx  |4 ++
 svx/source/accessibility/AccessibleControlShape.cxx|3 --
 svx/source/accessibility/AccessibleShape.cxx   |   18 
 svx/source/table/accessiblecell.cxx|   25 +++--
 5 files changed, 29 insertions(+), 41 deletions(-)

New commits:
commit 7fccffa78a26641053268b9c9e431156ce628552
Author: Noel Grandin 
AuthorDate: Thu Mar 17 13:24:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 17 15:44:09 2022 +0100

use actual type in AccessibleContextBase

instead of casting everywhere

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

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index ef09f28cde8c..1b8b41c10f3f 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -76,11 +76,9 @@ AccessibleContextBase::~AccessibleContextBase()
 bool AccessibleContextBase::SetState (sal_Int16 aState)
 {
 ::osl::ClearableMutexGuard aGuard (m_aMutex);
-::utl::AccessibleStateSetHelper* pStateSet =
-static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-if ((pStateSet != nullptr) && !pStateSet->contains(aState))
+if ((mxStateSet != nullptr) && !mxStateSet->contains(aState))
 {
-pStateSet->AddState (aState);
+mxStateSet->AddState (aState);
 // Clear the mutex guard so that it is not locked during calls to
 // listeners.
 aGuard.clear();
@@ -105,11 +103,9 @@ bool AccessibleContextBase::SetState (sal_Int16 aState)
 bool AccessibleContextBase::ResetState (sal_Int16 aState)
 {
 ::osl::ClearableMutexGuard aGuard (m_aMutex);
-::utl::AccessibleStateSetHelper* pStateSet =
-static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-if ((pStateSet != nullptr) && pStateSet->contains(aState))
+if ((mxStateSet != nullptr) && mxStateSet->contains(aState))
 {
-pStateSet->RemoveState (aState);
+mxStateSet->RemoveState (aState);
 // Clear the mutex guard so that it is not locked during calls to 
listeners.
 aGuard.clear();
 
@@ -129,10 +125,8 @@ bool AccessibleContextBase::ResetState (sal_Int16 aState)
 bool AccessibleContextBase::GetState (sal_Int16 aState)
 {
 ::osl::MutexGuard aGuard (m_aMutex);
-::utl::AccessibleStateSetHelper* pStateSet =
-static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-if (pStateSet != nullptr)
-return pStateSet->contains(aState);
+if (mxStateSet != nullptr)
+return mxStateSet->contains(aState);
 else
 // If there is no state set then return false as a default value.
 return false;
@@ -313,7 +307,7 @@ uno::Reference SAL_CALL
 else
 {
 // Create a copy of the state set and return it.
-pStateSet = static_cast< 
::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+pStateSet = mxStateSet;
 
 if (pStateSet != nullptr)
 pStateSet = new ::utl::AccessibleStateSetHelper (*pStateSet);
diff --git a/include/editeng/AccessibleContextBase.hxx 
b/include/editeng/AccessibleContextBase.hxx
index 3955a1bbfeee..6def5872c180 100644
--- a/include/editeng/AccessibleContextBase.hxx
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -28,10 +28,12 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::accessibility { class XAccessibleStateSet; }
 namespace com::sun::star::accessibility { class XAccessibleRelationSet; }
 namespace com::sun::star::accessibility { struct AccessibleEventObject; }
+namespace utl { class AccessibleStateSetHelper; }
 
 namespace accessibility {
 
@@ -259,7 +261,7 @@ public:
 protected:
 /** The state set.
 */
-css::uno::Reference< css::accessibility::XAccessibleStateSet> mxStateSet;
+rtl::Reference<::utl::AccessibleStateSetHelper> mxStateSet;
 
 /** The relation set.  Relations can be set or removed by calling the
 AddRelation and RemoveRelation 
methods.
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx 
b/svx/source/accessibility/AccessibleControlShape.cxx
index fb759ee57434..45b7edd75fe4 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -769,8 +769,7 @@ void AccessibleControlShape::initializeComposedState()
 return;
 
 // get our own state set implementation
-::utl::AccessibleStateSetHelper* pComposedStates =
-static_cast< ::utl::AccessibleStateSetHelper* >( mxStateSet.get() );
+::utl::AccessibleStateSetHelper* pComposedStates = mxStateSet.get();
 OSL_PRECOND( pComposedStates,
 

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

2022-03-15 Thread Luboš Luňák (via logerrit)
 editeng/source/editeng/impedit.hxx  |2 +
 editeng/source/editeng/impedit2.cxx |3 +-
 editeng/source/editeng/impedit3.cxx |   36 +++-
 editeng/source/items/svxfont.cxx|   40 +++-
 include/editeng/svxfont.hxx |7 --
 include/vcl/glyphitemcache.hxx  |   23 +---
 sc/source/ui/view/output2.cxx   |2 -
 vcl/source/gdi/impglyphitem.cxx |   30 +++
 8 files changed, 103 insertions(+), 40 deletions(-)

New commits:
commit 673a210b73716cf9ceb7b104b38e39987d0515af
Author: Luboš Luňák 
AuthorDate: Tue Mar 15 14:07:01 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 15 19:42:45 2022 +0100

use SalLayoutGlyphsCache in EditEngine/SvxFont (tdf#94677)

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

diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index eb8176561cb1..36480f26bc1c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -607,6 +608,7 @@ private:
 
 boolmbNbspRunNext;  // can't be a bitfield as it is passed as 
bool&
 
+SalLayoutGlyphsCache mGlyphsCache;
 
 // Methods...
 
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 36747c1c8666..402d606d8b57 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3438,7 +3438,8 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* 
pPortion, EditLine* pLine,
 SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
 aTmpFont.SetPhysFont(*GetRefDevice());
 ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage());
-nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), 
pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen() ).Width();
+nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(),
+pPortion->GetNode()->GetString(), nPos, 
rTextPortion.GetLen(), nullptr,  ).Width();
 }
 }
 break;
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 4bff8d26c94d..4f341fd65959 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -996,7 +996,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
 // Height needed...
 SeekCursor( pNode, nTmpPos+1, aTmpFont );
-pPortion->GetSize().setHeight( 
aTmpFont.QuickGetTextSize( GetRefDevice(), OUString(), 0, 0 ).Height() );
+pPortion->GetSize().setHeight(
+aTmpFont.QuickGetTextSize( GetRefDevice(), 
OUString(), 0, 0, nullptr,  ).Height() );
 
 DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab 
incorrectly calculated!" );
 
@@ -1041,7 +1042,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 OUString aFieldValue = static_cast(pNextFeature)->GetFieldValue();
 // get size, but also DXArray to allow length 
information in line breaking below
 std::vector aTmpDXArray;
-pPortion->GetSize() = 
aTmpFont.QuickGetTextSize(GetRefDevice(), aFieldValue, 0, 
aFieldValue.getLength(), );
+pPortion->GetSize() = 
aTmpFont.QuickGetTextSize(GetRefDevice(),
+aFieldValue, 0, aFieldValue.getLength(), 
, );
 
 // So no scrolling for oversized fields
 if ( pPortion->GetSize().Width() > nXWidth )
@@ -1146,7 +1148,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if (bContinueLastPortion)
 {
  Size aSize( aTmpFont.QuickGetTextSize( GetRefDevice(),
-rParaPortion.GetNode()->GetString(), nTmpPos, 
nPortionLen,  ));
+rParaPortion.GetNode()->GetString(), nTmpPos, 
nPortionLen, ,  ));
  pPortion->GetSize().AdjustWidth(aSize.Width() );
  if (pPortion->GetSize().Height() < aSize.Height())
  pPortion->GetSize().setHeight( aSize.Height() );
@@ -1154,7 +1156,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 else
 {
 pPortion->GetSize() = aTmpFont.QuickGetTextSize( 
GetRefDevice(),
-rParaPortion.GetNode()->GetString(), nTmpPos, 
nPortionLen,  );
+

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

2022-03-01 Thread Luboš Luňák (via logerrit)
 editeng/source/editeng/eehtml.cxx  |2 -
 editeng/source/rtf/svxrtf.cxx  |   15 +++--
 include/editeng/svxrtf.hxx |2 -
 include/o3tl/string_view.hxx   |6 +++
 include/svtools/htmltokn.h |7 ++--
 include/svtools/rtftoken.h |2 -
 include/svtools/svparser.hxx   |3 +
 o3tl/qa/test-string_view.cxx   |4 ++
 svtools/source/svhtml/htmlkywd.cxx |   13 
 svtools/source/svhtml/parhtml.cxx  |   57 ++---
 svtools/source/svrtf/parrtf.cxx|   10 +++---
 svtools/source/svrtf/rtfkeywd.cxx  |9 +++--
 svtools/source/svrtf/svparser.cxx  |2 -
 sw/source/filter/html/htmlbas.cxx  |4 +-
 sw/source/filter/html/htmlform.cxx |2 -
 sw/source/filter/html/swhtml.cxx   |   10 +++---
 16 files changed, 80 insertions(+), 68 deletions(-)

New commits:
commit b871d057c45fdd231aa5e1d2b94e7d0a039f4292
Author: Luboš Luňák 
AuthorDate: Tue Mar 1 12:07:47 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 1 21:32:11 2022 +0100

use OUStringBuffer for a string that's modified often (tdf#145862)

SvParser::aToken was OUString despite being a buffer where the parsed
result is collected.

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

diff --git a/editeng/source/editeng/eehtml.cxx 
b/editeng/source/editeng/eehtml.cxx
index a3de37005ffc..93740129e9df 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -179,7 +179,7 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken )
 if ( !bInPara )
 StartPara( false );
 
-OUString aText = aToken;
+OUString aText = aToken.toString();
 if ( aText.startsWith(" ") && ThrowAwayBlank() && !IsReadPRE() )
 aText = aText.copy( 1 );
 
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index f60c14cdbafa..cae8e4361ad0 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -166,7 +166,7 @@ void SvxRTFParser::NextToken( int nToken )
 case RTF_LDBLQUOTE: cCh = 0x201C;   goto INSINGLECHAR;
 case RTF_RDBLQUOTE: cCh = 0x201D;   goto INSINGLECHAR;
 INSINGLECHAR:
-aToken = OUString(cCh);
+aToken = OUStringChar(cCh);
 [[fallthrough]]; // aToken is set as Text
 case RTF_TEXTTOKEN:
 {
@@ -324,7 +324,8 @@ void SvxRTFParser::ReadStyleTable()
 case RTF_TEXTTOKEN:
 if (bHasStyleNo)
 {
-xStyle->sName = DelCharAtEnd( aToken, ';' );
+DelCharAtEnd( aToken, ';' );
+xStyle->sName = aToken.toString();
 
 if (!m_StyleTable.empty())
 {
@@ -581,15 +582,11 @@ void SvxRTFParser::ClearAttrStack()
 aAttrStack.clear();
 }
 
-OUString& SvxRTFParser::DelCharAtEnd( OUString& rStr, const sal_Unicode cDel )
+void SvxRTFParser::DelCharAtEnd( OUStringBuffer& rStr, const sal_Unicode cDel )
 {
-if( !rStr.isEmpty() && ' ' == rStr[ 0 ])
-rStr = comphelper::string::stripStart(rStr, ' ');
-if( !rStr.isEmpty() && ' ' == rStr[ rStr.getLength()-1 ])
-rStr = comphelper::string::stripEnd(rStr, ' ');
+rStr.strip(' ');
 if( !rStr.isEmpty() && cDel == rStr[ rStr.getLength()-1 ])
-rStr = rStr.copy( 0, rStr.getLength()-1 );
-return rStr;
+rStr.setLength( rStr.getLength()-1 );
 }
 
 
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index ec42c5045d07..e5ed1949bbb4 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -148,7 +148,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
 protected:
 virtual void InsertPara() = 0;
 
-static OUString& DelCharAtEnd( OUString& rStr, const sal_Unicode cDel );
+static void DelCharAtEnd( OUStringBuffer& rStr, const sal_Unicode cDel );
 
 // is called for each token that is recognized in CallParser
 virtual void NextToken( int nToken ) override;
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
index 74f15bf33b54..848143f189ed 100644
--- a/include/o3tl/string_view.hxx
+++ b/include/o3tl/string_view.hxx
@@ -31,6 +31,12 @@ inline bool equalsIgnoreAsciiCase(std::u16string_view s1, 
std::u16string_view s2
== 0;
 };
 
+// Like OUString::compareToIgnoreAsciiCase, but for two std::u16string_view:
+inline int compareToIgnoreAsciiCase(std::u16string_view s1, 
std::u16string_view s2)
+{
+return rtl_ustr_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), 
s2.data(), s2.size());
+};
+
 // Similar to OString::getToken, returning the first token of a 
std::string_view, starting at a
 // given position (and if needed, it can be turned into a template to also 
cover std::u16string_view
 // etc., or extended to return the n'th token instead of just the first, or 
support an 

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

2022-02-04 Thread Dennis Francis (via logerrit)
 editeng/source/editeng/editview.cxx |   27 ---
 editeng/source/editeng/impedit.cxx  |   16 +---
 editeng/source/editeng/impedit.hxx  |4 
 include/editeng/editview.hxx|4 
 sc/source/ui/view/gridwin4.cxx  |9 +++--
 svx/source/svdraw/svdedxv.cxx   |3 +++
 6 files changed, 55 insertions(+), 8 deletions(-)

New commits:
commit 226847e385d021bf2feacdfa796b3eb7023d6f0f
Author: Dennis Francis 
AuthorDate: Tue Jan 4 12:55:45 2022 +0530
Commit: Dennis Francis 
CommitDate: Fri Feb 4 19:21:53 2022 +0100

lokCalcRTL: fix editing of shape text

Inform editeng that negated document x coordinates are used in this case
and ensure that editeng generated invalidation rectangles always have
positive X coordinates.

Conflicts:
sc/source/ui/view/gridwin4.cxx

Change-Id: I2e450707ce02f7bcd8e4d299f857c37ebbd5e2c6
(cherry picked from commit 0fe02bb99e5dfa8379a49de75683fc350e4c4dbd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129360
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 0c2f8f43b2a9..c8d12f0388d3 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -195,20 +195,30 @@ tools::Rectangle EditView::GetInvalidateRect() const
 }
 }
 
+namespace {
+
+tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect)
+{
+return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), 
rRect.Bottom());
+}
+
+}
+
 void EditView::InvalidateWindow(const tools::Rectangle& rClipRect)
 {
+bool bNegativeX = IsNegativeX();
 if (EditViewCallbacks* pEditViewCallbacks = 
pImpEditView->getEditViewCallbacks())
 {
 // do not invalidate and trigger a global repaint, but forward
 // the need for change to the applied EditViewCallback, can e.g.
 // be used to visualize the active edit text in an OverlayObject
-pEditViewCallbacks->EditViewInvalidate(rClipRect);
+pEditViewCallbacks->EditViewInvalidate(bNegativeX ? 
lcl_negateRectX(rClipRect) : rClipRect);
 }
 else
 {
 // classic mode: invalidate and trigger full repaint
 // of the changed area
-GetWindow()->Invalidate(rClipRect);
+GetWindow()->Invalidate(bNegativeX ? lcl_negateRectX(rClipRect) : 
rClipRect);
 }
 }
 
@@ -216,10 +226,11 @@ void EditView::InvalidateOtherViewWindows( const 
tools::Rectangle& rInvRect )
 {
 if (comphelper::LibreOfficeKit::isActive())
 {
+bool bNegativeX = IsNegativeX();
 for (auto& pWin : pImpEditView->aOutWindowSet)
 {
 if (pWin)
-pWin->Invalidate( rInvRect );
+pWin->Invalidate( bNegativeX ? lcl_negateRectX(rInvRect) : 
rInvRect );
 }
 }
 }
@@ -1678,4 +1689,14 @@ bool EditView::IsSuppressLOKMessages() const
 return pImpEditView->IsSuppressLOKMessages();
 }
 
+void EditView::SetNegativeX(bool bSet)
+{
+pImpEditView->SetNegativeX(bSet);
+}
+
+bool EditView::IsNegativeX() const
+{
+return pImpEditView->IsNegativeX();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 1175c28661cd..cfd6eb5758dc 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -198,7 +198,8 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* 
pEng, vcl::Window* pWindo
 eAnchorMode(EEAnchorMode::TopLeft),
 mpEditViewCallbacks(nullptr),
 mbBroadcastLOKViewCursor(comphelper::LibreOfficeKit::isActive()),
-mbSuppressLOKMessages(false)
+mbSuppressLOKMessages(false),
+mbNegativeX(false)
 {
 aEditSelection.Min() = pEng->GetEditDoc().GetStartPaM();
 aEditSelection.Max() = pEng->GetEditDoc().GetEndPaM();
@@ -875,6 +876,15 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& 
rRect )
 SetScrollDiffX( static_cast(aOutArea.GetWidth()) * 2 / 10 );
 }
 
+namespace {
+
+tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect)
+{
+return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), 
rRect.Bottom());
+}
+
+}
+
 void ImpEditView::InvalidateAtWindow(const tools::Rectangle& rRect)
 {
 if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
@@ -882,13 +892,13 @@ void ImpEditView::InvalidateAtWindow(const 
tools::Rectangle& rRect)
 // do not invalidate and trigger a global repaint, but forward
 // the need for change to the applied EditViewCallback, can e.g.
 // be used to visualize the active edit text in an OverlayObject
-pCallbacks->EditViewInvalidate(rRect);
+pCallbacks->EditViewInvalidate(mbNegativeX ? lcl_negateRectX(rRect) : 
rRect);
 }
 else
 {
 // classic mode: invalidate and trigger full repaint
 // of the changed area
-

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

2021-12-20 Thread Justin Luth (via logerrit)
 editeng/source/outliner/outlvw.cxx |   29 +
 include/editeng/outliner.hxx   |5 +
 sd/source/ui/func/fuolbull.cxx |   13 +
 3 files changed, 47 insertions(+)

New commits:
commit 12832284318125b8649f6a67e3aa12aa953afdfb
Author: Justin Luth 
AuthorDate: Thu Dec 16 08:51:55 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Dec 21 08:30:40 2021 +0100

tdf#133713 sd: bullets and numbering should enable it

This fixes a LO 6.3 regression caused by re-working
the numbering dialog (switching from FuOutlineBullet
to the new FuBulletAndPosition).

When running uno:OutlineBullet, one expects to have
numbering applied to the selection. However, that part
was completely omitted from the new implementation.
I can't imagine why, since most everything else in the
nearby code was just a copy/paste from the old methods.

This patch restores some of the logic from the old function.
[Deleted in commit 5ff162bede44b77cb19e5ff6571b6e34f228d9fb
Author: Gül?ah Köse on Mon May 27 23:49:41 2019 +0300
tdf#120905 Remove old FuOutlineBullet dialog code.]

Partially revert loplugin:unusedmethods to recover EnableBullets()
from commit cae829e9c1394851fc88829d5197460929c2792a

This fixes Format -> Bullets and Numbering,
right-click pop-up Bullets and Numbering,
and sidebar's Toggle * List's "More Numbering".

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

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index e607698d5efe..bf11c742dfea 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -930,6 +930,35 @@ void OutlinerView::ToggleBulletsNumbering(
 }
 }
 
+void OutlinerView::EnsureNumberingIsOn()
+{
+pOwner->UndoActionStart(OLUNDO_DEPTH);
+
+ESelection aSel(pEditView->GetSelection());
+aSel.Adjust();
+
+const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout();
+pOwner->pEditEngine->SetUpdateLayout(false);
+
+for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++)
+{
+Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
+
+if (pPara && pOwner->GetDepth(nPara) == -1)
+pOwner->SetDepth(pPara, 0);
+}
+
+sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
+pOwner->ImplCheckParagraphs(aSel.nStartPara, nParaCount);
+
+const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
+pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.nStartPara, 0, 
nEndPara, 0));
+
+pOwner->pEditEngine->SetUpdateLayout(bUpdate);
+
+pOwner->UndoActionEnd();
+}
 
 void OutlinerView::ApplyBulletsNumbering(
 const bool bHandleBullets,
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index f34028496941..87fabb4ee45e 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -345,6 +345,11 @@ public:
 void SwitchOffBulletsNumbering(
 const bool bAtSelection = false );
 
+/** enables numbering for the selected paragraphs that are not enabled and 
ignore all selected
+paragraphs that already have numbering enabled.
+*/
+voidEnsureNumberingIsOn();
+
 boolIsCursorAtWrongSpelledWord();
 boolIsWrongSpelledWordAtPos( const Point& rPosPixel );
 voidExecuteSpellPopup(const Point& rPosPixel, const 
Link& rCallBack);
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index c661666f198c..0116b4b0e80f 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -91,6 +91,19 @@ void FuBulletAndPosition::DoExecute( SfxRequest& rReq )
 
 if( nResult == RET_OK )
 {
+OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+std::unique_ptr> aGuard;
+
+if (OutlineView* pOutlineView = dynamic_cast(pView))
+{
+pOLV = 
pOutlineView->GetViewByWindow(mpViewShell->GetActiveWindow());
+aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
+}
+
+if( pOLV )
+pOLV->EnsureNumberingIsOn();
+
 const SfxItemSet pOutputSet( *pDlg->GetOutputItemSet(  ) );
 pView->SetAttributes(pOutputSet, /*bReplaceAll=*/false, /*bSlide*/ 
pDlg->IsSlideScope(), /*bMaster=*/pDlg->IsApplyToMaster());
 }


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

2021-12-20 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unotext2.cxx |9 ++---
 include/editeng/unotext.hxx |8 
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 97d00de4afe9827ddaf299cfdfa8534425a11fe6
Author: Noel Grandin 
AuthorDate: Sat Dec 18 20:57:01 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 20 18:12:48 2021 +0100

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

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

diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 00b123468a5a..275319f3dfe7 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -118,7 +118,6 @@ SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& 
rText, sal_Int32 nPa
 :   SvxUnoTextRangeBase(rText)
 ,   mnParagraph(nPara)
 ,   mrParentText(rText)
-,   maDisposeListeners(maDisposeContainerMutex)
 ,   mbDisposing( false )
 {
 mxParentText = const_cast();
@@ -131,7 +130,6 @@ SvxUnoTextContent::SvxUnoTextContent( const 
SvxUnoTextContent& rContent ) noexce
 ,   lang::XTypeProvider()
 ,   cppu::OWeakAggObject()
 ,   mrParentText(rContent.mrParentText)
-,   maDisposeListeners(maDisposeContainerMutex)
 ,   mbDisposing( false )
 {
 mxParentText = rContent.mxParentText;
@@ -232,7 +230,10 @@ void SAL_CALL SvxUnoTextContent::dispose()
 
 lang::EventObject aEvt;
 aEvt.Source = *static_cast(this);
-maDisposeListeners.disposeAndClear(aEvt);
+{
+std::unique_lock aMutexGuard(maDisposeContainerMutex);
+maDisposeListeners.disposeAndClear(aMutexGuard, aEvt);
+}
 
 if( mxParentText.is() )
 mxParentText->removeTextContent( this );
@@ -240,11 +241,13 @@ void SAL_CALL SvxUnoTextContent::dispose()
 
 void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
 {
+std::unique_lock aGuard(maDisposeContainerMutex);
 maDisposeListeners.addInterface(xListener);
 }
 
 void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< 
lang::XEventListener >& aListener )
 {
+   std::unique_lock aGuard(maDisposeContainerMutex);
maDisposeListeners.removeInterface(aListener);
 }
 
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index d87bd38f98cc..87dc02a37c09 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -41,11 +41,11 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -522,8 +522,8 @@ private:
 const SvxUnoTextBase&   mrParentText;
 
 // for xComponent
-::osl::Mutex maDisposeContainerMutex;
-::comphelper::OInterfaceContainerHelper3 
maDisposeListeners;
+std::mutex maDisposeContainerMutex;
+::comphelper::OInterfaceContainerHelper4 
maDisposeListeners;
 bool mbDisposing;
 
 protected:


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

2021-12-06 Thread Samuel Mehrbrodt (via logerrit)
 editeng/source/editeng/editeng.cxx  |3 ++-
 editeng/source/editeng/impedit2.cxx |6 --
 include/editeng/editeng.hxx |3 ++-
 sc/inc/editutil.hxx |2 +-
 sc/source/core/tool/editutil.cxx|7 +--
 5 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit b9362e87a3646a6693b81fb0d40e28ce7813a251
Author: Samuel Mehrbrodt 
AuthorDate: Tue Nov 30 23:34:11 2021 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Dec 6 14:11:44 2021 +0100

tdf#145671 Don't open URL twice in cell edit mode

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index ae30e651b594..b557dd693d72 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2588,8 +2588,9 @@ OUString EditEngine::CalcFieldValue( const SvxFieldItem&, 
sal_Int32, sal_Int32,
 return OUString(' ');
 }
 
-void EditEngine::FieldClicked( const SvxFieldItem& )
+bool EditEngine::FieldClicked( const SvxFieldItem& )
 {
+return false;
 }
 
 
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 47672cb090f3..cbbfddff51c7 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -611,8 +611,11 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& 
rMEvt, EditView* pView )
 Point aLogicClick = rOutDev.PixelToLogic(rMEvt.GetPosPixel());
 if (const SvxFieldItem* pFld = pView->GetField(aLogicClick))
 {
+bool bUrlOpened = GetEditEnginePtr()->FieldClicked( *pFld );
+auto pUrlField = dynamic_cast(pFld->GetField());
+
 // tdf#121039 When in edit mode, editeng is responsible for 
opening the URL on mouse click
-if (auto pUrlField = dynamic_cast(pFld->GetField()))
+if (!bUrlOpened && pUrlField)
 {
 bool bCtrlClickHappened = rMEvt.IsMod1();
 bool bCtrlClickSecOption
@@ -627,7 +630,6 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, 
EditView* pView )
   
css::system::SystemShellExecuteFlags::DEFAULTS);
 }
 }
-GetEditEnginePtr()->FieldClicked( *pFld );
 }
 }
 }
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index fb109d7baa53..560f3be1a83a 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -516,7 +516,8 @@ public:
  const Color& rTextLineColor);
 virtual OUString  GetUndoComment( sal_uInt16 nUndoId ) const;
 virtual boolSpellNextDocument();
-virtual voidFieldClicked( const SvxFieldItem& rField );
+/** @return true, when click was consumed. false otherwise. */
+virtual boolFieldClicked( const SvxFieldItem& rField );
 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 
nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 
rFldColor );
 
 // override this if access to bullet information needs to be provided
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 1353544b96e3..04975b05ccc0 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -180,7 +180,7 @@ public:
 
 void SetExecuteURL(bool bSet){ bExecuteURL = bSet; }
 
-virtual voidFieldClicked( const SvxFieldItem& rField ) override;
+virtual boolFieldClicked( const SvxFieldItem& rField ) override;
 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 
nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 
rFldColor ) override;
 };
 
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 40957b3362b1..331f50af8b93 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -895,14 +895,17 @@ OUString ScFieldEditEngine::CalcFieldValue( const 
SvxFieldItem& rField,
 return ScEditUtil::GetCellFieldValue(*pFieldData, mpDoc, );
 }
 
-void ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField )
+bool ScFieldEditEngine::FieldClicked( const SvxFieldItem& rField )
 {
 if (!bExecuteURL)
-return;
+return false;
+
 if (const SvxURLField* pURLField = dynamic_cast(rField.GetField()))
 {
 ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
+return true;
 }
+return false;
 }
 
 ScNoteEditEngine::ScNoteEditEngine( SfxItemPool* pEnginePoolP,


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

2021-12-01 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unofield.cxx |   46 -
 editeng/source/xml/xmltxtexp.cxx|6 
 editeng/source/xml/xmltxtimp.cxx|6 
 include/editeng/unonames.hxx|   40 -
 include/editeng/unoprnms.hxx|  648 +---
 include/editeng/unotext.hxx |  114 ++--
 sc/source/ui/unoobj/cellsuno.cxx|2 
 sd/source/ui/inc/unoprnms.hxx   |3 
 sd/source/ui/unoidl/unopage.cxx |   17 
 sw/source/core/unocore/unomap.cxx   |   14 
 sw/source/core/unocore/unomap1.cxx  |   16 
 sw/source/core/unocore/unomapproperties.hxx |   92 +--
 sw/source/filter/ww8/docxexport.cxx |5 
 13 files changed, 501 insertions(+), 508 deletions(-)

New commits:
commit 42e56a3b4fd8372fae2bc6d768383ba1edf69918
Author: Noel Grandin 
AuthorDate: Wed Dec 1 11:10:38 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 1 17:22:35 2021 +0100

loplugin:stringliteraldefine in editeng

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

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 765a40349075..804e578f11b2 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -76,17 +76,17 @@ static const SfxItemPropertySet* 
ImplGetFieldItemPropertySet( sal_Int32 mnId )
 {
 static const SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
 {
-{ u"" UNO_TC_PROP_DATE_TIME, WID_DATE,  
::cppu::UnoType::get(), 0, 0 },
-{ u"" UNO_TC_PROP_IS_FIXED,  WID_BOOL1, cppu::UnoType::get(),
  0, 0 },
-{ u"" UNO_TC_PROP_IS_DATE,   WID_BOOL2, cppu::UnoType::get(),
  0, 0 },
-{ u"" UNO_TC_PROP_NUMFORMAT, WID_INT32, 
::cppu::UnoType::get(),  0, 0 },
+{ UNO_TC_PROP_DATE_TIME, WID_DATE,  
::cppu::UnoType::get(), 0, 0 },
+{ UNO_TC_PROP_IS_FIXED,  WID_BOOL1, cppu::UnoType::get(),
  0, 0 },
+{ UNO_TC_PROP_IS_DATE,   WID_BOOL2, cppu::UnoType::get(),
  0, 0 },
+{ UNO_TC_PROP_NUMFORMAT, WID_INT32, ::cppu::UnoType::get(), 
 0, 0 },
 { u"", 0, css::uno::Type(), 0, 0 }
 };
 static const SfxItemPropertySet 
aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
 
 static const SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
 {
-{ u"" UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType::get(), 0, 0 
},
+{ UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType::get(), 0, 0 },
 { u"", 0, css::uno::Type(), 0, 0 }
 };
 static const SfxItemPropertySet 
aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
@@ -94,10 +94,10 @@ static const SfxItemPropertySet* 
ImplGetFieldItemPropertySet( sal_Int32 mnId )
 static const SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
 {
 
-{ u"" UNO_TC_PROP_URL_FORMAT, WID_INT16,   
::cppu::UnoType::get(), 0, 0 },
-{ u"" UNO_TC_PROP_URL_REPRESENTATION, WID_STRING1, 
::cppu::UnoType::get(),  0, 0 },
-{ u"" UNO_TC_PROP_URL_TARGET, WID_STRING2, 
::cppu::UnoType::get(),  0, 0 },
-{ u"" UNO_TC_PROP_URL,WID_STRING3, 
::cppu::UnoType::get(),  0, 0 },
+{ UNO_TC_PROP_URL_FORMAT, WID_INT16,   
::cppu::UnoType::get(), 0, 0 },
+{ UNO_TC_PROP_URL_REPRESENTATION, WID_STRING1, 
::cppu::UnoType::get(),  0, 0 },
+{ UNO_TC_PROP_URL_TARGET, WID_STRING2, 
::cppu::UnoType::get(),  0, 0 },
+{ UNO_TC_PROP_URL,WID_STRING3, 
::cppu::UnoType::get(),  0, 0 },
 { u"", 0, css::uno::Type(), 0, 0 }
 };
 static const SfxItemPropertySet 
aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
@@ -110,38 +110,38 @@ static const SfxItemPropertySet* 
ImplGetFieldItemPropertySet( sal_Int32 mnId )
 
 static const SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
 {
-{ u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1,   
cppu::UnoType::get(), 0, 0 },
-{ u"" UNO_TC_PROP_FILE_FORMAT,  WID_INT16,   
::cppu::UnoType::get(), 0, 0 },
-{ u"" UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1, 
::cppu::UnoType::get(),  0, 0 },
+{ UNO_TC_PROP_IS_FIXED, WID_BOOL1,   
cppu::UnoType::get(), 0, 0 },
+{ UNO_TC_PROP_FILE_FORMAT,  WID_INT16,   
::cppu::UnoType::get(), 0, 0 },
+{ UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1, 
::cppu::UnoType::get(),  0, 0 },
 { u"", 0, css::uno::Type(), 0, 0 }
 };
 static const SfxItemPropertySet 
aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
 
 static const SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
 {
-{ u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1,  
cppu::UnoType::get(),  

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

2021-11-24 Thread Caolán McNamara (via logerrit)
 editeng/source/uno/unotext.cxx |   12 ++--
 include/editeng/unotext.hxx|4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit cd198a34113e8fa8d1060c815b0320a52b089059
Author: Caolán McNamara 
AuthorDate: Wed Nov 24 09:18:41 2021 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 24 20:19:16 2021 +0100

ofz#41345 Negative-size-param

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

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 92620d1951d3..5ae3ffac7522 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1327,13 +1327,13 @@ bool SvxUnoTextRangeBase::IsCollapsed() noexcept
  maSelection.nStartPos  == maSelection.nEndPos );
 }
 
-bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool Expand) noexcept
+bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept
 {
 CheckSelection( maSelection, mpEditSource.get() );
 
 //  #75098# use end position, as in Writer (start is anchor, end is cursor)
-sal_uInt16 nNewPos = maSelection.nEndPos;
-sal_Int32  nNewPar = maSelection.nEndPara;
+sal_Int32 nNewPos = maSelection.nEndPos;
+sal_Int32 nNewPar = maSelection.nEndPara;
 
 bool bOk = true;
 SvxTextForwarder* pForwarder = nullptr;
@@ -1365,15 +1365,15 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool 
Expand) noexcept
 return bOk;
 }
 
-bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, bool Expand)  noexcept
+bool SvxUnoTextRangeBase::GoRight(sal_Int32 nCount, bool Expand)  noexcept
 {
 SvxTextForwarder* pForwarder = mpEditSource ? 
mpEditSource->GetTextForwarder() : nullptr;
 if( pForwarder )
 {
 CheckSelection( maSelection, pForwarder );
 
-sal_Int32 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
-sal_Int32  nNewPar = maSelection.nEndPara;
+sal_Int32 nNewPos = maSelection.nEndPos + nCount;
+sal_Int32 nNewPar = maSelection.nEndPara;
 
 bool bOk = true;
 sal_Int32 nParCount = pForwarder->GetParagraphCount();
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index a2b4ae7e7181..bd41ffd16940 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -317,8 +317,8 @@ public:
 voidCollapseToStart() noexcept;
 voidCollapseToEnd() noexcept;
 boolIsCollapsed() noexcept;
-boolGoLeft(sal_Int16 nCount, bool Expand) noexcept;
-boolGoRight(sal_Int16 nCount, bool Expand) noexcept;
+boolGoLeft(sal_Int32 nCount, bool Expand) noexcept;
+boolGoRight(sal_Int32 nCount, bool Expand) noexcept;
 voidGotoStart(bool Expand) noexcept;
 voidGotoEnd(bool Expand) noexcept;
 


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

2021-11-24 Thread Miklos Vajna (via logerrit)
 editeng/source/items/textitem.cxx|   22 +++---
 include/editeng/colritem.hxx |4 +++-
 include/editeng/memberids.h  |1 +
 include/editeng/unoprnms.hxx |1 +
 include/editeng/unotext.hxx  |1 +
 include/oox/drawingml/color.hxx  |1 +
 oox/qa/unit/drawingml.cxx|8 
 oox/source/drawingml/color.cxx   |   16 
 oox/source/drawingml/textcharacterproperties.cxx |1 +
 oox/source/token/properties.txt  |1 +
 10 files changed, 52 insertions(+), 4 deletions(-)

New commits:
commit a557a1c4ac0b73668452f80169870bdfb204aeb6
Author: Miklos Vajna 
AuthorDate: Wed Nov 24 08:22:47 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 24 09:33:30 2021 +0100

PPTX import: implement native handling of a color's luminance offset

This was already handled in oox/ at import-time: this adds it to the doc
model, including UNO API and PPTX import.

This is a dependency PPTX export and UI, and also the last transform
which is easy to generate from the PowerPoint UI and we didn't import to
the doc model.

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 73ce5c3fd1f1..32c269480c5a 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1358,7 +1358,8 @@ SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 mColor( COL_BLACK ),
 maThemeIndex(-1),
 maTintShade(0),
-mnLumMod(1)
+mnLumMod(1),
+mnLumOff(0)
 {
 }
 
@@ -1367,7 +1368,8 @@ SvxColorItem::SvxColorItem( const Color& rCol, const 
sal_uInt16 nId ) :
 mColor( rCol ),
 maThemeIndex(-1),
 maTintShade(0),
-mnLumMod(1)
+mnLumMod(1),
+mnLumOff(0)
 {
 }
 
@@ -1383,7 +1385,8 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) 
const
 return mColor == rColorItem.mColor &&
maThemeIndex == rColorItem.maThemeIndex &&
maTintShade == rColorItem.maTintShade &&
-   mnLumMod == rColorItem.mnLumMod;
+   mnLumMod == rColorItem.mnLumMod &&
+   mnLumOff == rColorItem.mnLumOff;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1417,6 +1420,11 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= mnLumMod;
 break;
 }
+case MID_COLOR_LUM_OFF:
+{
+rVal <<= mnLumOff;
+break;
+}
 default:
 {
 rVal <<= mColor;
@@ -1471,6 +1479,14 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 mnLumMod = nLumMod;
 }
 break;
+case MID_COLOR_LUM_OFF:
+{
+sal_Int16 nLumOff = -1;
+if (!(rVal >>= nLumOff))
+return false;
+mnLumOff = nLumOff;
+}
+break;
 default:
 {
 return rVal >>= mColor;
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index 103c887fbdb6..cd223d2777bc 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -33,8 +33,10 @@ private:
 Color mColor;
 sal_Int16 maThemeIndex;
 sal_Int16 maTintShade;
-/// Luminance Modulation: 100th percentage, defaults to 1.
+/// Luminance Modulation: 100th percentage, defaults to 100%.
 sal_Int16 mnLumMod;
+/// Luminance Offset: 100th percentage, defaults to 0%.
+sal_Int16 mnLumOff;
 
 public:
 static SfxPoolItem* CreateDefault();
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 117c9e2873e1..1b50ab467229 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -184,6 +184,7 @@
 #define MID_COLOR_THEME_INDEX   4
 #define MID_COLOR_TINT_OR_SHADE 5
 #define MID_COLOR_LUM_MOD   6
+#define MID_COLOR_LUM_OFF   7
 
 
 #endif
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index e980acb9c8ec..f09afa09d487 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -330,6 +330,7 @@
 #define UNO_NAME_EDIT_CHAR_COLOR_THEME  "CharColorTheme"
 #define UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE  "CharColorTintOrShade"
 #define UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD"CharColorLumMod"
+#define UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF"CharColorLumOff"
 #define UNO_NAME_EDIT_CHAR_TRANSPARENCE "CharTransparence"
 #define UNO_NAME_EDIT_CHAR_CROSSEDOUT   "CharCrossedOut"
 #define UNO_NAME_EDIT_CHAR_STRIKEOUT"CharStrikeout"
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 

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

2021-11-23 Thread Miklos Vajna (via logerrit)
 editeng/source/items/textitem.cxx|   22 +++---
 include/editeng/colritem.hxx |2 ++
 include/editeng/memberids.h  |1 +
 include/editeng/unoprnms.hxx |1 +
 include/editeng/unotext.hxx  |1 +
 include/oox/drawingml/color.hxx  |1 +
 oox/qa/unit/data/theme.pptx  |binary
 oox/qa/unit/drawingml.cxx|7 +++
 oox/source/drawingml/color.cxx   |   17 +
 oox/source/drawingml/textcharacterproperties.cxx |1 +
 oox/source/token/properties.txt  |1 +
 11 files changed, 51 insertions(+), 3 deletions(-)

New commits:
commit ed662bcc20804e8b8d5946904f1b577a825f09de
Author: Miklos Vajna 
AuthorDate: Tue Nov 23 08:11:22 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 23 09:07:42 2021 +0100

PPTX import: implement native handling of a color's luminance modulation

This was already handled in oox/ at import-time: this adds it to the doc
model, including UNO API and PPTX import.

This is a dependency PPTX export and UI.

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 02f8d6a9be4e..73ce5c3fd1f1 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1357,7 +1357,8 @@ SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 SfxPoolItem(nId),
 mColor( COL_BLACK ),
 maThemeIndex(-1),
-maTintShade(0)
+maTintShade(0),
+mnLumMod(1)
 {
 }
 
@@ -1365,7 +1366,8 @@ SvxColorItem::SvxColorItem( const Color& rCol, const 
sal_uInt16 nId ) :
 SfxPoolItem( nId ),
 mColor( rCol ),
 maThemeIndex(-1),
-maTintShade(0)
+maTintShade(0),
+mnLumMod(1)
 {
 }
 
@@ -1380,7 +1382,8 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) 
const
 
 return mColor == rColorItem.mColor &&
maThemeIndex == rColorItem.maThemeIndex &&
-   maTintShade == rColorItem.maTintShade;
+   maTintShade == rColorItem.maTintShade &&
+   mnLumMod == rColorItem.mnLumMod;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1409,6 +1412,11 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= maTintShade;
 break;
 }
+case MID_COLOR_LUM_MOD:
+{
+rVal <<= mnLumMod;
+break;
+}
 default:
 {
 rVal <<= mColor;
@@ -1455,6 +1463,14 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 maTintShade = nTintShade;
 }
 break;
+case MID_COLOR_LUM_MOD:
+{
+sal_Int16 nLumMod = -1;
+if (!(rVal >>= nLumMod))
+return false;
+mnLumMod = nLumMod;
+}
+break;
 default:
 {
 return rVal >>= mColor;
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index ce51be7f3e30..103c887fbdb6 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -33,6 +33,8 @@ private:
 Color mColor;
 sal_Int16 maThemeIndex;
 sal_Int16 maTintShade;
+/// Luminance Modulation: 100th percentage, defaults to 1.
+sal_Int16 mnLumMod;
 
 public:
 static SfxPoolItem* CreateDefault();
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index c6d781da568a..117c9e2873e1 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -183,6 +183,7 @@
 //#define MID_GRAPHIC_TRANSPARENT 3 // used, but already defined above
 #define MID_COLOR_THEME_INDEX   4
 #define MID_COLOR_TINT_OR_SHADE 5
+#define MID_COLOR_LUM_MOD   6
 
 
 #endif
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 91273845fbd2..e980acb9c8ec 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -329,6 +329,7 @@
 #define UNO_NAME_EDIT_CHAR_COLOR"CharColor"
 #define UNO_NAME_EDIT_CHAR_COLOR_THEME  "CharColorTheme"
 #define UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE  "CharColorTintOrShade"
+#define UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD"CharColorLumMod"
 #define UNO_NAME_EDIT_CHAR_TRANSPARENCE "CharTransparence"
 #define UNO_NAME_EDIT_CHAR_CROSSEDOUT   "CharCrossedOut"
 #define UNO_NAME_EDIT_CHAR_STRIKEOUT"CharStrikeout"
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index c9c4b9580f72..0b38565f179f 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -89,6 +89,7 @@ struct SfxItemPropertyMapEntry;
 { u"" UNO_NAME_EDIT_CHAR_TRANSPARENCE,EE_CHAR_COLOR,  

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

2021-11-16 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/svxacorr.cxx |2 +-
 include/editeng/svxacorr.hxx |2 +-
 sw/source/core/edit/acorrect.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d5811039430e5a76643491c68fed75691969afbd
Author: Caolán McNamara 
AuthorDate: Tue Nov 16 14:54:07 2021 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 16 22:14:33 2021 +0100

WrtStt->WrdStt for consistency with the other word start abbrevs

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 6dfe778f2631..16d443dce4b5 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1680,7 +1680,7 @@ bool SvxAutoCorrect::AddCplSttException( const OUString& 
rNew,
 }
 
 // Adds a single word. The list will immediately be written to the file!
-bool SvxAutoCorrect::AddWrtSttException( const OUString& rNew,
+bool SvxAutoCorrect::AddWrdSttException( const OUString& rNew,
  LanguageType eLang )
 {
 SvxAutoCorrectLanguageLists* pLists = nullptr;
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 4d21049a9d3c..a0d85002d01a 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -392,7 +392,7 @@ public:
 const SvStringsISortDtor* GetWrdSttExceptList( LanguageType eLang )
 {   return GetLanguageList_( eLang ).GetWrdSttExceptList(); }
 // Adds a single word. The list will be immediately written to the file!
-bool AddWrtSttException( const OUString& rNew, LanguageType eLang);
+bool AddWrdSttException( const OUString& rNew, LanguageType eLang);
 
 // Search through the Languages for the entry
 bool FindInWrdSttExceptList( LanguageType eLang, const OUString& sWord );
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 1ad211fa4354..d937bf6b1798 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -624,7 +624,7 @@ void SwAutoCorrExceptWord::CheckChar( const SwPosition& 
rPos, sal_Unicode cChr )
 
 // then add to the list:
 if (ACFlags::CapitalStartWord & m_nFlags)
-pACorr->AddWrtSttException(m_sWord, m_eLanguage);
+pACorr->AddWrdSttException(m_sWord, m_eLanguage);
 else if (ACFlags::CapitalStartSentence & m_nFlags)
 pACorr->AddCplSttException(m_sWord, m_eLanguage);
 }


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

2021-11-16 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx |   43 +++---
 include/editeng/colritem.hxx  |   22 +++
 include/editeng/memberids.h   |8 +++-
 offapi/com/sun/star/style/CharacterProperties.idl |   12 ++
 4 files changed, 79 insertions(+), 6 deletions(-)

New commits:
commit 5006dfcbc370e80bd159a9e957254b0ce09a6cdd
Author: Tomaž Vajngerl 
AuthorDate: Sun Sep 20 19:20:59 2015 +0200
Commit: Miklos Vajna 
CommitDate: Tue Nov 16 14:19:40 2021 +0100

Theme color and tint/shade attribute for SvxColorItem

To support theme colors the SvxColorItem must be extended with
an optional attribute theme index to define the index to which
theme color current color belongs and an optional tint/shade
attribute define how much the color ha been additionally tinted
or shaded.

[ Miklos: left out the potentially breaking svx/sdi/svxitems.sdi
changes. ]

(cherry picked from commit ccdbf815e00dbe2ba21f7e86b6743df100b7401f,
from the feature/themesupport2 branch)

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 75470ff20e4a..8ecfa67584aa 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1354,14 +1354,18 @@ bool SvxContourItem::GetPresentation
 
 // class SvxColorItem 
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
-SfxPoolItem( nId ),
-mColor( COL_BLACK )
+SfxPoolItem(nId),
+mColor( COL_BLACK ),
+maThemeIndex(-1),
+maTintShade(0)
 {
 }
 
 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
 SfxPoolItem( nId ),
-mColor( rCol )
+mColor( rCol ),
+maThemeIndex(-1),
+maTintShade(0)
 {
 }
 
@@ -1372,8 +1376,11 @@ SvxColorItem::~SvxColorItem()
 bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
 {
 assert(SfxPoolItem::operator==(rAttr));
+const SvxColorItem& rColorItem = static_cast(rAttr);
 
-return  mColor == static_cast( rAttr ).mColor;
+return mColor == rColorItem.mColor &&
+   maThemeIndex == rColorItem.maThemeIndex &&
+   maTintShade == rColorItem.maTintShade;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1392,6 +1399,16 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= mColor.GetAlpha() == 0;
 break;
 }
+case MID_COLOR_THEME_INDEX:
+{
+rVal <<= maThemeIndex;
+break;
+}
+case MID_COLOR_TINT_OR_SHADE:
+{
+rVal <<= maTintShade;
+break;
+}
 default:
 {
 rVal <<= mColor;
@@ -1422,11 +1439,29 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 mColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 );
 return true;
 }
+case MID_COLOR_THEME_INDEX:
+{
+sal_Int16 nIndex = -1;
+if (!(rVal >>= nIndex))
+return false;
+maThemeIndex = nIndex;
+}
+break;
+case MID_COLOR_TINT_OR_SHADE:
+{
+sal_Int16 nTintShade = -1;
+if (!(rVal >>= nTintShade))
+return false;
+maTintShade = nTintShade;
+}
+break;
 default:
 {
 return rVal >>= mColor;
 }
+break;
 }
+return true;
 }
 
 SvxColorItem* SvxColorItem::Clone( SfxItemPool * ) const
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index afb1d9d15c18..ce51be7f3e30 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -31,6 +31,8 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public 
SfxPoolItem
 {
 private:
 Color mColor;
+sal_Int16 maThemeIndex;
+sal_Int16 maTintShade;
 
 public:
 static SfxPoolItem* CreateDefault();
@@ -57,6 +59,26 @@ public:
 }
 void SetValue(const Color& rNewColor);
 
+sal_Int16 GetThemeIndex() const
+{
+return maThemeIndex;
+}
+
+void SetThemeIndex(sal_Int16 nIndex)
+{
+maThemeIndex = nIndex;
+}
+
+sal_Int16 GetTintOrShade() const
+{
+return maTintShade;
+}
+
+void SetTintOrShade(sal_Int16 nTintOrShade)
+{
+maTintShade = nTintOrShade;
+}
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 8a6c9d0e7769..c6d781da568a 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -178,8 +178,12 @@
 #define MID_SHADOW_TRANSPARENCE 1
 
 // SvxColorItem
-#define MID_COLOR_RGB 0

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

2021-10-07 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit4.cxx  |2 +-
 editeng/source/editeng/misspellrange.cxx |4 ++--
 editeng/source/outliner/outliner.cxx |2 +-
 editeng/source/outliner/outlobj.cxx  |8 
 include/editeng/misspellrange.hxx|2 +-
 include/editeng/outlobj.hxx  |4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit a5a6071264d27b9dcfa47fe2f399951edd7301c2
Author: Noel Grandin 
AuthorDate: Wed Oct 6 21:01:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 7 16:22:48 2021 +0200

loplugin:moveparam in editeng

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

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 879274a2a667..d6071f2a355a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1359,7 +1359,7 @@ void ImpEditEngine::GetAllMisspellRanges( 
std::vector&
 if (!pWrongList)
 continue;
 
-aRanges.emplace_back(i, pWrongList->GetRanges());
+aRanges.emplace_back(i, std::vector(pWrongList->GetRanges()));
 }
 
 aRanges.swap(rRanges);
diff --git a/editeng/source/editeng/misspellrange.cxx 
b/editeng/source/editeng/misspellrange.cxx
index 40fe5dd1b76e..562a9905c27d 100644
--- a/editeng/source/editeng/misspellrange.cxx
+++ b/editeng/source/editeng/misspellrange.cxx
@@ -13,8 +13,8 @@ namespace editeng {
 
 MisspellRange::MisspellRange(size_t nStart, size_t nEnd) : mnStart(nStart), 
mnEnd(nEnd) {}
 
-MisspellRanges::MisspellRanges(sal_Int32 nParagraph, const 
std::vector& rRanges) :
-mnParagraph(nParagraph), maRanges(rRanges) {}
+MisspellRanges::MisspellRanges(sal_Int32 nParagraph, 
std::vector&& rRanges) :
+mnParagraph(nParagraph), maRanges(std::move(rRanges)) {}
 
 }
 
diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 4eacd5d76d82..c827b13a5937 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -381,7 +381,7 @@ std::optional 
Outliner::CreateParaObject( sal_Int32 nStartPa
 aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
 }
 
-OutlinerParaObject aPObj(std::move(xText), aParagraphDataVector, 
bIsEditDoc);
+OutlinerParaObject aPObj(std::move(xText), 
std::move(aParagraphDataVector), bIsEditDoc);
 aPObj.SetOutlinerMode(GetOutlinerMode());
 
 return aPObj;
diff --git a/editeng/source/outliner/outlobj.cxx 
b/editeng/source/outliner/outlobj.cxx
index 0c0050ebaded..e6dc6e691c6c 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -29,9 +29,9 @@
 #include 
 #include 
 
-OutlinerParaObjData::OutlinerParaObjData( std::unique_ptr 
pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool 
bIsEditDoc ) :
+OutlinerParaObjData::OutlinerParaObjData( std::unique_ptr 
pEditTextObject, ParagraphDataVector&& rParagraphDataVector, bool bIsEditDoc ) :
 mpEditTextObject(std::move(pEditTextObject)),
-maParagraphDataVector(rParagraphDataVector),
+maParagraphDataVector(std::move(rParagraphDataVector)),
 mbIsEditDoc(bIsEditDoc)
 {
 if( maParagraphDataVector.empty() && 
(mpEditTextObject->GetParagraphCount() != 0) )
@@ -62,8 +62,8 @@ bool OutlinerParaObjData::isWrongListEqual(const 
OutlinerParaObjData& rCompare)
 }
 
 OutlinerParaObject::OutlinerParaObject(
-std::unique_ptr xTextObj, const ParagraphDataVector& 
rParagraphDataVector, bool bIsEditDoc ) :
-mpImpl(OutlinerParaObjData(std::move(xTextObj), rParagraphDataVector, 
bIsEditDoc))
+std::unique_ptr xTextObj, ParagraphDataVector&& 
rParagraphDataVector, bool bIsEditDoc ) :
+mpImpl(OutlinerParaObjData(std::move(xTextObj), 
std::move(rParagraphDataVector), bIsEditDoc))
 {
 }
 
diff --git a/include/editeng/misspellrange.hxx 
b/include/editeng/misspellrange.hxx
index d67fc82f592c..f46c25e2261c 100644
--- a/include/editeng/misspellrange.hxx
+++ b/include/editeng/misspellrange.hxx
@@ -29,7 +29,7 @@ struct MisspellRanges
 sal_Int32 mnParagraph;
 std::vector maRanges;
 
-MisspellRanges(sal_Int32 nParagraph, const std::vector& 
rRanges);
+MisspellRanges(sal_Int32 nParagraph, std::vector&& rRanges);
 };
 }
 
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
index 8ba1dedb3f16..1703cf09cf34 100644
--- a/include/editeng/outlobj.hxx
+++ b/include/editeng/outlobj.hxx
@@ -44,7 +44,7 @@ struct EDITENG_DLLPUBLIC OutlinerParaObjData
 bool mbIsEditDoc;
 
 // constructor
-OutlinerParaObjData( std::unique_ptr pEditTextObject, 
const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc );
+OutlinerParaObjData( std::unique_ptr pEditTextObject, 
ParagraphDataVector&& rParagraphDataVector, bool bIsEditDoc );
 
 OutlinerParaObjData( const 

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

2021-09-22 Thread Stephan Bergmann (via logerrit)
 editeng/source/uno/unofield.cxx |   35 ---
 include/editeng/unofield.hxx|3 ++-
 2 files changed, 22 insertions(+), 16 deletions(-)

New commits:
commit 59646d3fa4fab037ccedc7ebe765de11d5016f3f
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 20:28:09 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 22 23:22:26 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: editeng

Change-Id: Ic275bbd167e69060f6442ceed6c4dd88733d5e1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122486
Tested-by: Stephan Bergmann 
Reviewed-by: Stephan Bergmann 

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 0e1dab6db253..765a40349075 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -17,8 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -893,57 +898,57 @@ sal_Bool SAL_CALL SvxUnoTextField::supportsService( const 
OUString& ServiceName
 return cppu::supportsService( this, ServiceName );
 }
 
-uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( const OUString& 
ServiceSpecifier )
+uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( 
std::u16string_view ServiceSpecifier )
 {
 uno::Reference< uno::XInterface > xRet;
 
 // #i93308# up to OOo 3.2 we used this wrong namespace name with the 
capital T & F. This is
 // fixed since OOo 3.2 but for compatibility we will still provide support 
for the wrong notation.
 
-OUString aFieldType;
-if( (ServiceSpecifier.startsWith( "com.sun.star.text.textfield.", 
 )) ||
-(ServiceSpecifier.startsWith( "com.sun.star.text.TextField.", 
 )) )
+std::u16string_view aFieldType;
+if( (o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.textfield.", 
 )) ||
+(o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.TextField.", 
 )) )
 {
 sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
 
-if ( aFieldType == "DateTime" )
+if ( aFieldType == u"DateTime" )
 {
 nId = text::textfield::Type::DATE;
 }
-else if ( aFieldType == "URL" )
+else if ( aFieldType == u"URL" )
 {
 nId = text::textfield::Type::URL;
 }
-else if ( aFieldType == "PageNumber" )
+else if ( aFieldType == u"PageNumber" )
 {
 nId = text::textfield::Type::PAGE;
 }
-else if ( aFieldType == "PageCount" )
+else if ( aFieldType == u"PageCount" )
 {
 nId = text::textfield::Type::PAGES;
 }
-else if ( aFieldType == "SheetName" )
+else if ( aFieldType == u"SheetName" )
 {
 nId = text::textfield::Type::TABLE;
 }
-else if ( aFieldType == "FileName" )
+else if ( aFieldType == u"FileName" )
 {
 nId = text::textfield::Type::EXTENDED_FILE;
 }
-else if (aFieldType == "docinfo.Title" ||
- aFieldType == "DocInfo.Title" )
+else if (aFieldType == u"docinfo.Title" ||
+ aFieldType == u"DocInfo.Title" )
 {
 nId = text::textfield::Type::DOCINFO_TITLE;
 }
-else if ( aFieldType == "Author" )
+else if ( aFieldType == u"Author" )
 {
 nId = text::textfield::Type::AUTHOR;
 }
-else if ( aFieldType == "Measure" )
+else if ( aFieldType == u"Measure" )
 {
 nId = text::textfield::Type::MEASURE;
 }
-else if (aFieldType == "DocInfo.Custom")
+else if (aFieldType == u"DocInfo.Custom")
 {
 nId = text::textfield::Type::DOCINFO_CUSTOM;
 }
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
index 3c0d1650f6cc..fe68cd95c060 100644
--- a/include/editeng/unofield.hxx
+++ b/include/editeng/unofield.hxx
@@ -29,6 +29,7 @@
 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::beans { class XPropertySetInfo; }
 
@@ -39,7 +40,7 @@ class SvxFieldData;
 /// @throws css::uno::Exception
 /// @throws css::uno::RuntimeException
 css::uno::Reference< css::uno::XInterface > EDITENG_DLLPUBLIC 
SvxUnoTextCreateTextField(
-const OUString& ServiceSpecifier );
+std::u16string_view ServiceSpecifier );
 
 class EDITENG_DLLPUBLIC SvxUnoTextField final : public cppu::BaseMutex,
 public ::cppu::OComponentHelper,


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

2021-09-11 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit.hxx  |   14 +++---
 editeng/source/editeng/impedit2.cxx |8 
 editeng/source/uno/unoedprx.cxx |4 ++--
 include/editeng/SpellPortions.hxx   |   36 ++--
 include/editeng/numitem.hxx |7 +++
 include/svx/svdlayer.hxx|2 +-
 include/svx/svdpage.hxx |   13 +
 svx/inc/textchain.hxx   |6 +++---
 svx/inc/textchaincursor.hxx |2 +-
 svx/inc/textchainflow.hxx   |   22 ++
 10 files changed, 54 insertions(+), 60 deletions(-)

New commits:
commit 77fca82aab16619a693d53e970ac717f54105e95
Author: Noel Grandin 
AuthorDate: Sat Sep 11 15:53:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 11 17:24:16 2021 +0200

clang:optin.performance.Padding in svx,editeng

Excessive padding in 'struct svx::SpellPortion' (18 padding bytes, where
2 is optimal).
Excessive padding in 'class SvxNumRule' (11 padding bytes, where 3 is
optimal).
Excessive padding in 'struct SpellInfo' (10 padding bytes, where 2 is
optimal).
Excessive padding in 'struct ImpEditEngine::LineAreaInfo' (14 padding
bytes, where 6 is optimal).
Excessive padding in 'class ImpChainLinkProperties' (5 padding bytes,
where 1 is optimal).
Excessive padding in 'class TextChainFlow' (20 padding bytes, where 4 is
optimal).
Excessive padding in 'class SdrObjList' (13 padding bytes, where 5 is
optimal).
Excessive padding in 'class SdrLayer' (12 padding bytes, where 4 is
optimal).

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

diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b894bd2153e6..a8f07741cc41 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -155,14 +155,14 @@ typedef std::vector  
SpellContentSelections;
 
 struct SpellInfo
 {
+EditPaM aCurSentenceStart;
+svx::SpellPortionsaLastSpellPortions;
+SpellContentSelections  aLastSpellContentSelections;
 EESpellStateeState;
 EPaMaSpellStart;
 EPaMaSpellTo;
-EditPaM aCurSentenceStart;
 boolbSpellToEnd;
 boolbMultipleDoc;
-svx::SpellPortionsaLastSpellPortions;
-SpellContentSelections  aLastSpellContentSelections;
 SpellInfo() : eState(EESpellState::Ok), bSpellToEnd(true), 
bMultipleDoc(false)
 { }
 };
@@ -1139,14 +1139,14 @@ public:
 };
 struct LineAreaInfo
 {
-sal_Int16 nColumn; // Column number; when overflowing, equal to total 
number of columns
 ParaPortion& rPortion; // Current ParaPortion
-sal_Int32 nPortion;
 EditLine* pLine; // Current line, or nullptr for paragraph start
-sal_Int32 nLine;
+tools::Long nHeightNeededToNotWrap;
 tools::Rectangle aArea; // The area for the line (or for rPortion's 
first line offset)
 // Bottom coordinate *does not* belong to the 
area
-tools::Long nHeightNeededToNotWrap;
+sal_Int32 nPortion;
+sal_Int32 nLine;
+sal_Int16 nColumn; // Column number; when overflowing, equal to total 
number of columns
 };
 using IterateLinesAreasFunc = std::function;
 enum IterFlag // bitmask
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 8173558a097f..6d27b50dfd68 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3124,13 +3124,13 @@ void ImpEditEngine::IterateLineAreas(const 
IterateLinesAreasFunc& f, IterFlag eO
 return;
 
 LineAreaInfo aInfo{
-nColumn, // nColumn
 rPortion, // rPortion
-n, // nPortion
 nullptr, // pLine
-0, // nLine
+0, // nHeightNeededToNotWrap
 { aLineStart, Size{ nColumnWidth, 
rPortion.GetFirstLineOffset() } }, // aArea
-0 // nHeightNeededToNotWrap
+n, // nPortion
+0, // nLine
+nColumn // nColumn
 };
 auto eResult = f(aInfo);
 if (eResult == CallbackResult::Stop)
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 8cf7d8e62417..161633a137a2 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -52,9 +52,9 @@ public:
 mnEEIndex(0),
 mnFieldOffset(0),
 mnFieldLen(0),
-mbInField(false),
 mnBulletOffset(0),
 mnBulletLen(0),
+mbInField(false),
 mbInBullet(false) {};
 
 // Get/Set current paragraph
@@ -111,9 +111,9 @@ private:
 sal_Int32 mnEEIndex;
 sal_Int32 

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

2021-09-10 Thread Caolán McNamara (via logerrit)
 editeng/source/items/borderline.cxx |   21 ++---
 include/editeng/borderline.hxx  |   17 +++--
 include/svtools/brwbox.hxx  |2 +-
 include/vcl/commandevent.hxx|5 ++---
 include/vcl/outdevstate.hxx |8 
 include/vcl/print.hxx   |6 +++---
 include/vcl/transfer.hxx|8 
 svtools/source/brwbox/datwin.cxx|2 +-
 8 files changed, 32 insertions(+), 37 deletions(-)

New commits:
commit 53ebbad48c8c2a71044917a5cbac9657126e5adc
Author: Caolán McNamara 
AuthorDate: Wed Sep 8 12:38:39 2021 +0100
Commit: Noel Grandin 
CommitDate: Fri Sep 10 14:18:09 2021 +0200

warning: Excessive padding in 'struct OutDevState'

experiment with optin.performance.Padding analyzer and tuning
AllowedPad to 2

with clang as compiler;
export ENVCFLAGSCXX="-Xclang -analyze -Xclang 
-analyzer-checker=optin.performance -Xclang -analyzer-config -Xclang 
optin.performance.Padding:AllowedPad=2"
and get a report of:

OutDevState (13 padding bytes, where 5 is optimal)
UIControlOptions (9 padding bytes, where 1 is optimal)

Change-Id: I174f6f62d6e32df057d5e0f21d4274166f6ed8c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121812
Tested-by: Jenkins
Tested-by: Noel Grandin 
Reviewed-by: Caolán McNamara 
Reviewed-by: Noel Grandin 

diff --git a/editeng/source/items/borderline.cxx 
b/editeng/source/items/borderline.cxx
index 1b06258b20a8..42d61b5daa43 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -98,22 +98,21 @@ Color SvxBorderLine::threeDMediumColor( Color aMain )
 SvxBorderLine::SvxBorderLine( const Color *pCol, tools::Long nWidth,
SvxBorderLineStyle nStyle,
Color (*pColorOutFn)( Color ), Color (*pColorInFn)( Color ) )
-: m_nWidth( nWidth )
-, m_bMirrorWidths( false )
-, m_aWidthImpl( SvxBorderLine::getWidthImpl( nStyle ) )
-, m_nMult( 1 )
-, m_nDiv( 1 )
-, m_nStyle( nStyle )
-, m_bUseLeftTop( false )
-, m_pColorOutFn( pColorOutFn )
-, m_pColorInFn( pColorInFn )
-, m_pColorGapFn( nullptr )
+: m_nWidth(nWidth)
+, m_nMult(1)
+, m_nDiv(1)
+, m_pColorOutFn(pColorOutFn)
+, m_pColorInFn(pColorInFn)
+, m_pColorGapFn(nullptr)
+, m_aWidthImpl(SvxBorderLine::getWidthImpl(nStyle))
+, m_nStyle(nStyle)
+, m_bMirrorWidths(false)
+, m_bUseLeftTop(false)
 {
 if ( pCol )
 aColor = *pCol;
 }
 
-
 SvxBorderLineStyle
 ConvertBorderStyleFromWord(int const nWordLineStyle)
 {
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
index e48b461a8b02..d22e0c586317 100644
--- a/include/editeng/borderline.hxx
+++ b/include/editeng/borderline.hxx
@@ -143,20 +143,17 @@ double EDITENG_DLLPUBLIC 
ConvertBorderWidthFromWord(SvxBorderLineStyle,
 
 class EDITENG_DLLPUBLIC SvxBorderLine final
 {
-Color  aColor;
-
 tools::Long m_nWidth;
-bool m_bMirrorWidths;
-BorderWidthImpl m_aWidthImpl;
 tools::Long m_nMult;
 tools::Long m_nDiv;
-
+Color (*m_pColorOutFn)(Color);
+Color (*m_pColorInFn)(Color);
+Color (*m_pColorGapFn)(Color);
+BorderWidthImpl m_aWidthImpl;
+Color aColor;
 SvxBorderLineStyle   m_nStyle;
-
-bool m_bUseLeftTop;
-Color(*m_pColorOutFn)( Color );
-Color(*m_pColorInFn)( Color );
-Color(*m_pColorGapFn)( Color );
+bool m_bMirrorWidths;
+bool m_bUseLeftTop;
 
 public:
 SvxBorderLine( const Color *pCol = nullptr,
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 1c7d6e5404cc..60e37de7d432 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -118,8 +118,8 @@ namespace o3tl
 class BrowseEvent
 {
 VclPtr pWin;
-sal_Int32   nRow;
 tools::RectangleaRect;
+sal_Int32   nRow;
 sal_uInt16  nCol;
 sal_uInt16  nColId;
 
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 9edcdb4d6f13..883147fad491 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -309,16 +309,15 @@ class VCL_DLLPUBLIC CommandGestureData
 public:
 double const mfX;
 double const mfY;
-GestureEventType const meEventType;
-
 double const mfOffset;
+GestureEventType const meEventType;
 PanningOrientation const meOrientation;
 
 CommandGestureData(double fX, double fY, GestureEventType eEventType, 
double fOffset, PanningOrientation eOrientation)
 : mfX(fX)
 , mfY(fY)
-, meEventType(eEventType)
 , mfOffset(fOffset)
+, meEventType(eEventType)
 , meOrientation(eOrientation)
 {}
 };
diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 60d12ac523f5..a80620f957b6 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -79,22 +79,22 @@ struct OutDevState
 

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

2021-09-09 Thread Miklos Vajna (via logerrit)
 editeng/source/items/textitem.cxx |   48 ++
 include/editeng/fontitem.hxx  |1 
 sw/source/filter/xml/xmlfonte.cxx |   18 
 xmloff/qa/unit/style.cxx  |   53 +-
 4 files changed, 108 insertions(+), 12 deletions(-)

New commits:
commit 7a8bb65e1b8dc7fdd7f89c8c546e71e4208da574
Author: Miklos Vajna 
AuthorDate: Thu Sep 9 13:04:01 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 9 14:27:52 2021 +0200

ODT export: order  elements inside 

This builds on top of commit 92471550b8c43d8ff0cef8b414884d697edf9e63
(ODF export: sort  elements based on the style:name
attribute, 2021-03-11), the additional problem was that the style:name
attribute already has number suffixes to have unique names for fonts
where the style name would match.

This means that even if we sort the container right before writing the
elements, which font gets the number suffix depends on the insert order.

Fix this by additionally sorting the font items before insertion, given
that a single call-site does all the insertion, at least for Writer
documents. This is required as SfxItemPool::GetItemSurrogates() exposes
a container which is based on SfxPoolItemArray_Impl, which uses an
o3tl::sorted_vector<> of pointers, so effectively unsorted, the order
depends on the pointer address of the font items.

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 64236dd542f1..22c86e4cabd1 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -153,6 +153,24 @@ bool SvxFontListItem::GetPresentation
 
 // class SvxFontItem -
 
+namespace
+{
+sal_Int32 CompareTo(sal_Int32 nA, sal_Int32 nB)
+{
+if (nA < nB)
+{
+return -1;
+}
+
+if (nA > nB)
+{
+return 1;
+}
+
+return 0;
+}
+}
+
 SvxFontItem::SvxFontItem( const sal_uInt16 nId ) :
 SfxPoolItem( nId )
 {
@@ -290,6 +308,36 @@ bool SvxFontItem::operator==( const SfxPoolItem& rAttr ) 
const
 return bRet;
 }
 
+bool SvxFontItem::operator<(const SfxPoolItem& rCmp) const
+{
+const auto& rOther = static_cast(rCmp);
+sal_Int32 nRet = GetFamilyName().compareTo(rOther.GetFamilyName());
+if (nRet != 0)
+{
+return nRet < 0;
+}
+
+nRet = GetStyleName().compareTo(rOther.GetStyleName());
+if (nRet != 0)
+{
+return nRet < 0;
+}
+
+nRet = CompareTo(GetFamily(), rOther.GetFamily());
+if (nRet != 0)
+{
+return nRet < 0;
+}
+
+nRet = CompareTo(GetPitch(), rOther.GetPitch());
+if (nRet != 0)
+{
+return nRet < 0;
+}
+
+return GetCharSet() < rOther.GetCharSet();
+}
+
 SvxFontItem* SvxFontItem::Clone( SfxItemPool * ) const
 {
 return new SvxFontItem( *this );
diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx
index 9a73a051f79e..2ccaade20121 100644
--- a/include/editeng/fontitem.hxx
+++ b/include/editeng/fontitem.hxx
@@ -46,6 +46,7 @@ public:
 
 // "pure virtual Methods" from SfxPoolItem
 virtual bool operator==(const SfxPoolItem& rItem) const override;
+bool operator<(const SfxPoolItem& rCmp) const override;
 virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override;
 virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) 
const override;
 virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) 
override;
diff --git a/sw/source/filter/xml/xmlfonte.cxx 
b/sw/source/filter/xml/xmlfonte.cxx
index ce415aeb41e5..b8c0f7730d57 100644
--- a/sw/source/filter/xml/xmlfonte.cxx
+++ b/sw/source/filter/xml/xmlfonte.cxx
@@ -46,21 +46,27 @@ 
SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(SwXMLExport& _rExport,
   RES_CHRATR_CTL_FONT };
 
 const SfxItemPool& rPool = _rExport.getDoc()->GetAttrPool();
+std::vector aFonts;
 for(sal_uInt16 nWhichId : aWhichIds)
 {
 const SvxFontItem& rFont =
 static_cast(rPool.GetDefaultItem( nWhichId ));
-Add( rFont.GetFamilyName(), rFont.GetStyleName(),
- rFont.GetFamily(), rFont.GetPitch(),
- rFont.GetCharSet() );
+aFonts.push_back();
 for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId))
 {
 auto pFont = static_cast(pItem);
-Add( pFont->GetFamilyName(), pFont->GetStyleName(),
- pFont->GetFamily(), pFont->GetPitch(),
- pFont->GetCharSet() );
+aFonts.push_back(pFont);
 }
 }
+
+std::sort(aFonts.begin(), aFonts.end(),
+  [](const SvxFontItem* pA, const SvxFontItem* 

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

2021-08-22 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/impedit.cxx |   10 +-
 editeng/source/editeng/impedit.hxx |2 +-
 editeng/source/misc/txtrange.cxx   |6 +++---
 include/editeng/txtrange.hxx   |2 +-
 sw/inc/ndnotxt.hxx |   12 ++--
 sw/source/core/docnode/ndnotxt.cxx |   12 ++--
 vcl/source/outdev/gradient.cxx |8 
 7 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 4c5e264df432f4e6836535cbac7231ab579af424
Author: Noel Grandin 
AuthorDate: Sat Aug 21 18:21:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 22 18:54:08 2021 +0200

no need to use unique_ptr for PolyPolygon

it is already a COW type

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

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 720e50e8a998..d1b00e478560 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -322,7 +322,7 @@ void ImpEditView::SelectionChanged()
 }
 
 // This function is also called when a text's font || size is changed. Because 
its highlight rectangle must be updated.
-void ImpEditView::lokSelectionCallback(const 
std::unique_ptr , bool bStartHandleVisible, bool 
bEndHandleVisible) {
+void ImpEditView::lokSelectionCallback(const std::optional 
, bool bStartHandleVisible, bool bEndHandleVisible) {
 VclPtr pParent = pOutWin->GetParentWithLOKNotifier();
 vcl::Region aRegion( *pPolyPoly );
 
@@ -487,7 +487,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 bool bClipRegion = rTarget.IsClipRegion();
 vcl::Region aOldRegion = rTarget.GetClipRegion();
 
-std::unique_ptr pPolyPoly;
+std::optional pPolyPoly;
 
 if ( !pRegion && !comphelper::LibreOfficeKit::isActive())
 {
@@ -511,7 +511,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 }
 
 if (comphelper::LibreOfficeKit::isActive() || pRegion)
-pPolyPoly.reset(new tools::PolyPolygon);
+pPolyPoly = tools::PolyPolygon();
 
 DBG_ASSERT( !pEditEngine->IsIdleFormatterActive(), "DrawSelectionXOR: Not 
formatted!" );
 aTmpSel.Adjust( pEditEngine->GetEditDoc() );
@@ -601,7 +601,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 aTmpRect.SetRight(aLineXPosStartEnd.Max());
 aTmpRect.Move(aLineOffset.Width(), 0);
 ImplDrawHighlightRect(rTarget, aTmpRect.TopLeft(), 
aTmpRect.BottomRight(),
-  pPolyPoly.get());
+  pPolyPoly ? &*pPolyPoly : nullptr);
 }
 else
 {
@@ -627,7 +627,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 aTmpRect.Move(aLineOffset.Width(), 0);
 
 ImplDrawHighlightRect(rTarget, aTmpRect.TopLeft(), 
aTmpRect.BottomRight(),
-  pPolyPoly.get());
+  pPolyPoly ? &*pPolyPoly : nullptr);
 nTmpStartIndex = nTmpEndIndex;
 }
 }
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 33504968bf18..216506c98828 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -307,7 +307,7 @@ private:
 return mpEditViewCallbacks;
 }
 
-void lokSelectionCallback(const std::unique_ptr 
, bool bStartHandleVisible, bool bEndHandleVisible);
+void lokSelectionCallback(const std::optional 
, bool bStartHandleVisible, bool bEndHandleVisible);
 
 void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks)
 {
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index dadc4fc6f315..6374747be3c9 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -54,7 +54,7 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& 
rPolyPolygon,
 if( pLinePolyPolygon )
 {
 nCount = pLinePolyPolygon->count();
-mpLinePolyPolygon.reset( new tools::PolyPolygon() );
+mpLinePolyPolygon = tools::PolyPolygon(nCount);
 
 for(sal_uInt32 i(0); i < nCount; i++)
 {
@@ -64,7 +64,7 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& 
rPolyPolygon,
 }
 }
 else
-mpLinePolyPolygon = nullptr;
+mpLinePolyPolygon.reset();
 }
 
 
@@ -647,7 +647,7 @@ std::deque* TextRanger::GetTextRanges( const 
Range& rRange )
 SvxBoundArgs aArg( this, &(rngCache.results), rRange );
 aArg.Calc( maPolyPolygon );
 if( mpLinePolyPolygon )
-aArg.Concat( mpLinePolyPolygon.get() );
+aArg.Concat( &*mpLinePolyPolygon );
 //Add new result to the cache
 

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

2021-08-14 Thread Noel Grandin (via logerrit)
 editeng/source/outliner/outliner.cxx   |   20 ++--
 editeng/source/outliner/overflowingtxt.cxx |4 ++--
 include/editeng/outliner.hxx   |7 +++
 include/editeng/overflowingtxt.hxx |9 +
 4 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 7322fb1ed21cefe9faecc8cd5d088a3476283b5a
Author: Noel Grandin 
AuthorDate: Fri Aug 13 22:27:34 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Aug 14 11:11:28 2021 +0200

flatten OFlowChainedText

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

diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index ff126e75446a..b30de5d206a0 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2013,7 +2013,7 @@ bool Outliner::IsPageOverflow()
 return pEditEngine->IsPageOverflow();
 }
 
-std::unique_ptr Outliner::GetNonOverflowingText() const
+std::optional Outliner::GetNonOverflowingText() const
 {
 /* XXX:
  * nCount should be the number of paragraphs of the non overflowing text
@@ -2021,7 +2021,7 @@ std::unique_ptr 
Outliner::GetNonOverflowingText() const
 */
 
 if ( GetParagraphCount() < 1 )
-return nullptr;
+return {};
 
 // last non-overflowing paragraph is before the first overflowing one
 sal_Int32 nCount = pEditEngine->GetOverflowingParaNum();
@@ -2032,14 +2032,14 @@ std::unique_ptr 
Outliner::GetNonOverflowingText() const
 SAL_INFO("editeng.chaining",
  "[Overflowing] Ops, trying to retrieve para "
  << nCount << " when max index is " << GetParagraphCount()-1 );
-return nullptr;
+return {};
 }
 
 if (nCount < 0)
 {
 SAL_INFO("editeng.chaining",
  "[Overflowing] No Overflowing text but GetNonOverflowinText 
called?!");
-return nullptr;
+return {};
 }
 
 // NOTE: We want the selection of the overflowing text from here
@@ -2077,7 +2077,7 @@ std::unique_ptr 
Outliner::GetNonOverflowingText() const
 ESelection aEmptySel(0,0,0,0);
 //EditTextObject *pTObj = pEditEngine->CreateTextObject(aEmptySel);
 bool const bLastParaInterrupted = true; // Last Para was interrupted 
since everything overflew
-return std::make_unique(aEmptySel, 
bLastParaInterrupted);
+return NonOverflowingText(aEmptySel, bLastParaInterrupted);
 } else { // Get the lines that of the overflowing para fit in the box
 
 sal_Int32 nOverflowingPara = nCount;
@@ -2114,7 +2114,7 @@ std::unique_ptr 
Outliner::GetNonOverflowingText() const
 bool bLastParaInterrupted =
 pEditEngine->GetOverflowingLineNum() > 0;
 
-return std::make_unique(aOverflowingTextSelection, 
bLastParaInterrupted);
+return NonOverflowingText(aOverflowingTextSelection, 
bLastParaInterrupted);
 }
 }
 
@@ -2126,10 +2126,10 @@ std::unique_ptr 
Outliner::GetEmptyParaObject() const
 return pPObj;
 }
 
-std::unique_ptr Outliner::GetOverflowingText() const
+std::optional Outliner::GetOverflowingText() const
 {
 if ( pEditEngine->GetOverflowingParaNum() < 0)
-return nullptr;
+return {};
 
 
 // Defensive check: overflowing para index beyond actual # of paragraphs?
@@ -2138,7 +2138,7 @@ std::unique_ptr 
Outliner::GetOverflowingText() const
  "[Overflowing] Ops, trying to retrieve para "
  << pEditEngine->GetOverflowingParaNum() << " when max index 
is "
  << GetParagraphCount()-1 );
-return nullptr;
+return {};
 }
 
 sal_Int32 nHeadPara = pEditEngine->GetOverflowingParaNum();
@@ -2157,7 +2157,7 @@ std::unique_ptr 
Outliner::GetOverflowingText() const
 sal_Int32 nLastParaLen = GetText(GetParagraph(nLastPara)).getLength();
 aOverflowingTextSel = ESelection(nOverflowingPara, nLen,
  nLastPara, nLastParaLen);
-return 
std::make_unique(pEditEngine->CreateTransferable(aOverflowingTextSel));
+return 
OverflowingText(pEditEngine->CreateTransferable(aOverflowingTextSel));
 
 }
 
diff --git a/editeng/source/outliner/overflowingtxt.cxx 
b/editeng/source/outliner/overflowingtxt.cxx
index 16be74813704..0c038dbfb311 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -173,7 +173,7 @@ ESelection OFlowChainedText::GetOverflowPointSel() const
 std::unique_ptr 
OFlowChainedText::InsertOverflowingText(Outliner *pOutliner, OutlinerParaObject 
const *pTextToBeMerged)
 {
 // Just return the roughly merged paras for now
-if (mpOverflowingTxt == nullptr)
+if (!mpOverflowingTxt)
 return nullptr;
 
 if (mbIsDeepMerge) {
@@ -188,7 +188,7 @@ std::unique_ptr 
OFlowChainedText::InsertOverflowingText(Outl
 
 

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

2021-08-10 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/eertfpar.cxx |   22 +++---
 editeng/source/rtf/svxrtf.cxx   |   26 +-
 include/editeng/svxrtf.hxx  |3 ++-
 3 files changed, 26 insertions(+), 25 deletions(-)

New commits:
commit 447cec188191e77c09ffc51cc42549def277255b
Author: Noel Grandin 
AuthorDate: Mon Aug 9 18:14:14 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 10 15:08:37 2021 +0200

no need to use unique_ptr for SvxRTFStyleType here

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

diff --git a/editeng/source/editeng/eertfpar.cxx 
b/editeng/source/editeng/eertfpar.cxx
index 278699dbfcb1..e3f7dba07249 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -374,8 +374,8 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType  
)
 auto const& pS = it->second;
 mpEditEngine->SetStyleSheet(
 EditSelection(aStartPaM, aEndPaM),
-
static_cast(mpEditEngine->GetStyleSheetPool()->Find(pS->sName, 
SfxStyleFamily::All)));
-nOutlLevel = pS->nOutlineNo;
+
static_cast(mpEditEngine->GetStyleSheetPool()->Find(pS.sName, 
SfxStyleFamily::All)));
+nOutlLevel = pS.nOutlineNo;
 }
 }
 
@@ -436,10 +436,10 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType 
 )
 SvxRTFStyleType* EditRTFParser::FindStyleSheet( std::u16string_view rName )
 {
 SvxRTFStyleTbl& rTable = GetStyleTbl();
-for (auto const& iter : rTable)
+for (auto & iter : rTable)
 {
-if (iter.second->sName == rName)
-return iter.second.get();
+if (iter.second.sName == rName)
+return 
 }
 return nullptr;
 }
@@ -458,9 +458,9 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( 
SvxRTFStyleType const * pRTFStyl
 SvxRTFStyleTbl::iterator it = GetStyleTbl().find( pRTFStyle->nBasedOn 
);
 if ( it != GetStyleTbl().end())
 {
-SvxRTFStyleType *const pS = it->second.get();
-if ( pS && ( pS !=pRTFStyle ) )
-aParent = pS->sName;
+SvxRTFStyleType const& rS = it->second;
+if (  != pRTFStyle )
+aParent = rS.sName;
 }
 }
 
@@ -492,10 +492,10 @@ void EditRTFParser::CreateStyleSheets()
 // the SvxRTFParser has now created the template...
 if (mpEditEngine->GetStyleSheetPool() && 
mpEditEngine->IsImportRTFStyleSheetsSet())
 {
-for (auto const& elem : GetStyleTbl())
+for (auto & elem : GetStyleTbl())
 {
-SvxRTFStyleType* pRTFStyle = elem.second.get();
-CreateStyleSheet( pRTFStyle );
+SvxRTFStyleType& rRTFStyle = elem.second;
+CreateStyleSheet(  );
 }
 }
 }
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 4b0fd66bb224..4157ca894aa5 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -274,8 +274,8 @@ void SvxRTFParser::ReadStyleTable()
 sal_uInt16 nStyleNo = 0;
 bool bHasStyleNo = false;
 int _nOpenBrakets = 1;  // the first was already detected earlier!!
-std::unique_ptr pStyle(new SvxRTFStyleType(*pAttrPool, 
aWhichMap));
-pStyle->aAttrSet.Put( GetRTFDefaults() );
+std::optional xStyle(SvxRTFStyleType(*pAttrPool, 
aWhichMap));
+xStyle->aAttrSet.Put( GetRTFDefaults() );
 
 bIsInReadStyleTab = true;
 bChkStyleAttr = false;  // Do not check Attribute against the Styles
@@ -310,10 +310,10 @@ void SvxRTFParser::ReadStyleTable()
 }
 break;
 
-case RTF_SBASEDON:  pStyle->nBasedOn = sal_uInt16(nTokenValue); break;
+case RTF_SBASEDON:  xStyle->nBasedOn = sal_uInt16(nTokenValue); break;
 case RTF_SNEXT: break;
 case RTF_OUTLINELEVEL:
-case RTF_SOUTLVL:   pStyle->nOutlineNo = sal_uInt8(nTokenValue);
break;
+case RTF_SOUTLVL:   xStyle->nOutlineNo = sal_uInt8(nTokenValue);
break;
 case RTF_S: nStyleNo = static_cast(nTokenValue);
 bHasStyleNo = true;
 break;
@@ -324,16 +324,16 @@ void SvxRTFParser::ReadStyleTable()
 case RTF_TEXTTOKEN:
 if (bHasStyleNo)
 {
-pStyle->sName = DelCharAtEnd( aToken, ';' );
+xStyle->sName = DelCharAtEnd( aToken, ';' );
 
 if (!m_StyleTable.empty())
 {
 m_StyleTable.erase(nStyleNo);
 }
 // All data from the font is available, so off to the table
-m_StyleTable.insert(std::make_pair(nStyleNo, 
std::move(pStyle)));
-pStyle.reset(new SvxRTFStyleType(*pAttrPool, aWhichMap));
-pStyle->aAttrSet.Put( GetRTFDefaults() );
+  

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

2021-07-30 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/hangulhanja.cxx |2 +-
 include/editeng/hangulhanja.hxx |2 +-
 sw/inc/hhcwrp.hxx   |2 +-
 sw/source/uibase/lingu/hhcwrp.cxx   |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit b7322c23a69d0727d0ecb3185d6516ca457e2f14
Author: Caolán McNamara 
AuthorDate: Fri Jul 30 11:37:40 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 30 16:41:27 2021 +0200

cid#1399290 silence Uncaught exception

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

diff --git a/editeng/source/misc/hangulhanja.cxx 
b/editeng/source/misc/hangulhanja.cxx
index c6057413d2d6..9ea8fba5d8ca 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -947,7 +947,7 @@ namespace editeng
 {
 }
 
-HangulHanjaConversion::~HangulHanjaConversion( )
+HangulHanjaConversion::~HangulHanjaConversion() COVERITY_NOEXCEPT_FALSE
 {
 }
 
diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx
index cbbeaef658f0..f2a5dcf9992f 100644
--- a/include/editeng/hangulhanja.hxx
+++ b/include/editeng/hangulhanja.hxx
@@ -117,7 +117,7 @@ namespace editeng
 bool _bIsInteractive
 );
 
-virtual ~HangulHanjaConversion( );
+virtual ~HangulHanjaConversion() COVERITY_NOEXCEPT_FALSE;
 
 // converts the whole document
 voidConvertDocument();
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx
index f565401d830c..2a6bcb688d27 100644
--- a/sw/inc/hhcwrp.hxx
+++ b/sw/inc/hhcwrp.hxx
@@ -91,7 +91,7 @@ public:
 sal_Int32 nConvOptions, bool bIsInteractive,
 bool bStart, bool bOther, bool bSelection );
 
-virtual ~SwHHCWrapper() override;
+virtual ~SwHHCWrapper() COVERITY_NOEXCEPT_FALSE override;
 
 voidConvert();
 };
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx 
b/sw/source/uibase/lingu/hhcwrp.cxx
index 7e78777fef51..fd0d7adee111 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -107,7 +107,7 @@ SwHHCWrapper::SwHHCWrapper(
 {
 }
 
-SwHHCWrapper::~SwHHCWrapper()
+SwHHCWrapper::~SwHHCWrapper() COVERITY_NOEXCEPT_FALSE
 {
 m_pConvArgs.reset();
 


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

2021-07-29 Thread Caolán McNamara (via logerrit)
 editeng/source/misc/hangulhanja.cxx |6 ++
 include/editeng/hangulhanja.hxx |1 +
 sw/inc/hhcwrp.hxx   |3 ---
 sw/source/uibase/lingu/hhcwrp.cxx   |4 +---
 4 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit a57ec3ca97b587c76dc082b75532cc62d423cc8d
Author: Caolán McNamara 
AuthorDate: Wed Jul 28 20:27:06 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jul 29 13:52:55 2021 +0200

use the parent as available from HangulHanjaConversion

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

diff --git a/editeng/source/misc/hangulhanja.cxx 
b/editeng/source/misc/hangulhanja.cxx
index 1908586240e8..c6057413d2d6 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -131,6 +131,7 @@ namespace editeng
 
 boolIsValid() const { return m_xConverter.is(); }
 
+weld::Widget* GetUIParent() const { return m_pUIParent; }
 LanguageType GetSourceLang() const   { return m_nSourceLang; }
 LanguageType GetTargetLang() const   { return m_nTargetLang; }
 const vcl::Font * GetTargetFont() const   { return m_pTargetFont; }
@@ -960,6 +961,11 @@ namespace editeng
 return m_bUseSavedValues;
 }
 
+weld::Widget* HangulHanjaConversion::GetUIParent() const
+{
+return m_pImpl->GetUIParent();
+}
+
 LanguageType HangulHanjaConversion::GetSourceLanguage( ) const
 {
 return m_pImpl->GetSourceLang();
diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx
index 25c7d0b1d354..cbbeaef658f0 100644
--- a/include/editeng/hangulhanja.hxx
+++ b/include/editeng/hangulhanja.hxx
@@ -122,6 +122,7 @@ namespace editeng
 // converts the whole document
 voidConvertDocument();
 
+weld::Widget*   GetUIParent() const; // the parent window for any UI 
we raise
 LanguageTypeGetSourceLanguage() const;
 LanguageTypeGetTargetLanguage() const;
 const vcl::Font* GetTargetFont() const;
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx
index accde1e11ba9..f565401d830c 100644
--- a/sw/inc/hhcwrp.hxx
+++ b/sw/inc/hhcwrp.hxx
@@ -21,8 +21,6 @@
 
 #include 
 #include 
-#include 
-#include 
 #include "swdllapi.h"
 
 class SwView;
@@ -33,7 +31,6 @@ class SwPaM;
 class SW_DLLPUBLIC SwHHCWrapper final : public editeng::HangulHanjaConversion
 {
 SwView *m_pView;
-VclPtr m_pWin;
 SwWrtShell _rWrtShell;
 
 std::unique_ptr m_pConvArgs;/**< object for 
arguments (and results) needed
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx 
b/sw/source/uibase/lingu/hhcwrp.cxx
index 03b36d197b65..7e78777fef51 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -93,7 +93,6 @@ SwHHCWrapper::SwHHCWrapper(
 nConvOptions,
 bIsInteractive )
 , m_pView( pSwView )
-, m_pWin( >GetEditWin() )
 , m_rWrtShell( pSwView->GetWrtShell() )
 , m_nLastPos( 0 )
 , m_nUnitOffset( 0 )
@@ -648,7 +647,7 @@ void SwHHCWrapper::FindConvText_impl()
 
 bool bFound = false;
 
-m_pWin->EnterWait();
+weld::WaitObject aWait(GetUIParent());
 bool bConv = true;
 
 while ( bConv )
@@ -664,7 +663,6 @@ void SwHHCWrapper::FindConvText_impl()
 bConv = ConvNext_impl();
 }
 }
-m_pWin->LeaveWait();
 }
 
 void SwHHCWrapper::ConvStart_impl( SwConversionArgs /* [out] */ 
*pConversionArgs, SvxSpellArea eArea )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-28 Thread Mike Kaganski (via logerrit)
 editeng/source/outliner/outliner.cxx   |   20 ++--
 editeng/source/outliner/outlvw.cxx |   24 
 include/editeng/outliner.hxx   |6 ++
 sd/source/core/drawdoc4.cxx|2 +-
 sd/source/core/sdpage.cxx  |4 ++--
 sd/source/ui/dlg/headerfooterdlg.cxx   |2 +-
 sd/source/ui/view/DocumentRenderer.cxx |4 ++--
 sd/source/ui/view/drtxtob.cxx  |2 +-
 sd/source/ui/view/drviews2.cxx |4 ++--
 sd/source/ui/view/drviewse.cxx |2 +-
 10 files changed, 34 insertions(+), 36 deletions(-)

New commits:
commit cc7ff6d890ab2cacc7f0273039b15689dad5e0dd
Author: Mike Kaganski 
AuthorDate: Wed Jul 28 15:20:51 2021 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jul 28 15:34:29 2021 +0200

Three identical functions for a class is a bit too much

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

diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 49ac38415987..7ffa2de88589 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -194,7 +194,7 @@ void Outliner::Init( OutlinerMode nMode )
 
 SetMaxDepth( 9 );
 
-switch ( ImplGetOutlinerMode() )
+switch ( GetOutlinerMode() )
 {
 case OutlinerMode::TextObject:
 case OutlinerMode::TitleObject:
@@ -249,7 +249,7 @@ void Outliner::SetDepth( Paragraph* pPara, sal_Int16 
nNewDepth )
 ImplInitDepth( nPara, nNewDepth, true );
 ImplCalcBulletText( nPara, false, false );
 
-if ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+if ( GetOutlinerMode() == OutlinerMode::OutlineObject )
 ImplSetLevelDependentStyleSheet( nPara );
 
 DepthChangedHdl(pPara, nPrevFlags);
@@ -374,7 +374,7 @@ std::unique_ptr 
Outliner::CreateParaObject( sal_Int32 nStart
 return nullptr;
 
 std::unique_ptr xText = pEditEngine->CreateTextObject( 
nStartPara, nCount );
-const bool bIsEditDoc(OutlinerMode::TextObject == ImplGetOutlinerMode());
+const bool bIsEditDoc(OutlinerMode::TextObject == GetOutlinerMode());
 ParagraphDataVector aParagraphDataVector(nCount);
 const sal_Int32 nLastPara(nStartPara + nCount - 1);
 
@@ -384,7 +384,7 @@ std::unique_ptr 
Outliner::CreateParaObject( sal_Int32 nStart
 }
 
 std::unique_ptr pPObj(new 
OutlinerParaObject(std::move(xText), aParagraphDataVector, bIsEditDoc));
-pPObj->SetOutlinerMode(GetMode());
+pPObj->SetOutlinerMode(GetOutlinerMode());
 
 return pPObj;
 }
@@ -443,8 +443,8 @@ void Outliner::SetText( const OUString& rText, Paragraph* 
pPara )
 
 // In the outliner mode, filter the tabs and set the indentation
 // about a LRSpaceItem. In EditEngine mode intend over old tabs
-if( ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject ) ||
-( ImplGetOutlinerMode() == OutlinerMode::OutlineView ) )
+if( ( GetOutlinerMode() == OutlinerMode::OutlineObject ) ||
+( GetOutlinerMode() == OutlinerMode::OutlineView ) )
 {
 // Extract Tabs
 sal_Int32 nTabs = 0;
@@ -686,7 +686,7 @@ void Outliner::ImplCheckNumBulletItem( sal_Int32 nPara )
 void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
 {
 
-DBG_ASSERT( ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject ) || ( 
ImplGetOutlinerMode() == OutlinerMode::OutlineView ), 
"SetLevelDependentStyleSheet: Wrong Mode!" );
+DBG_ASSERT( ( GetOutlinerMode() == OutlinerMode::OutlineObject ) || ( 
GetOutlinerMode() == OutlinerMode::OutlineView ), "SetLevelDependentStyleSheet: 
Wrong Mode!" );
 
 SfxStyleSheet* pStyle = GetStyleSheet( nPara );
 
@@ -1189,7 +1189,7 @@ void Outliner::ImpTextPasted( sal_Int32 nStartPara, 
sal_Int32 nCount )
 
 while( nCount && pPara )
 {
-if( ImplGetOutlinerMode() != OutlinerMode::TextObject )
+if( GetOutlinerMode() != OutlinerMode::TextObject )
 {
 nDepthChangedHdlPrevDepth = pPara->GetDepth();
 ParaFlag nPrevFlags = pPara->nFlags;
@@ -1240,7 +1240,7 @@ bool Outliner::ImpCanIndentSelectedPages( OutlinerView* 
pCurView )
 
 // If the first paragraph is on level 0 it can not indented in any case,
 // possible there might be indentations in the following on the 0 level.
-if ( ( mnFirstSelPage == 0 ) && ( ImplGetOutlinerMode() != 
OutlinerMode::TextObject ) )
+if ( ( mnFirstSelPage == 0 ) && ( GetOutlinerMode() != 
OutlinerMode::TextObject ) )
 {
 if ( nDepthChangedHdlPrevDepth == 1 )   // is the only page
 return false;
@@ -2123,7 +2123,7 @@ std::unique_ptr 
Outliner::GetEmptyParaObject() const
 {
 std::unique_ptr pEmptyText = 
pEditEngine->GetEmptyTextObject();
 std::unique_ptr pPObj( new OutlinerParaObject( 

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

2021-07-26 Thread Vasily Melenchuk (via logerrit)
 editeng/source/items/numitem.cxx|   21 ++
 include/editeng/numitem.hxx |1 
 sw/inc/chpfld.hxx   |1 
 sw/qa/core/fields/data/chapter_field_followedby.odt |binary
 sw/qa/core/fields/fields.cxx|   41 ++--
 sw/source/core/fields/chpfld.cxx|9 ++--
 sw/source/core/txtnode/ndtxt.cxx|   28 -
 7 files changed, 68 insertions(+), 33 deletions(-)

New commits:
commit b67b3e2be0c80c3667ad2cb633e7e932d51d63a8
Author: Vasily Melenchuk 
AuthorDate: Fri Jul 23 20:15:08 2021 +0300
Commit: Thorsten Behrens 
CommitDate: Mon Jul 26 15:21:39 2021 +0200

sw: use followby parameter of outline in Chapter field

When Chapter field with format "Chapter number and name" is used
it does not insert any delimiter between number and name. Best is
to use outline/list property LabelFollowBy.

But since it is done inside field we are limited with supported
characters, so practically only space and nothing are correctly
supported. Tab and newline are replaced by space.

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 2f30242b911a..12ee8dbe533d 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -483,6 +483,27 @@ void SvxNumberFormat::SetLabelFollowedBy( const 
LabelFollowedBy eLabelFollowedBy
 {
 meLabelFollowedBy = eLabelFollowedBy;
 }
+
+OUString SvxNumberFormat::GetLabelFollowedByAsString() const
+{
+switch (meLabelFollowedBy)
+{
+case LISTTAB:
+return "\t";
+case SPACE:
+return " ";
+case NEWLINE:
+return "\n";
+case NOTHING:
+// intentionally left blank.
+return OUString();
+default:
+SAL_WARN("editeng", "Unknown SvxNumberFormat::GetLabelFollowedBy() 
return value");
+assert(false);
+}
+return OUString();
+}
+
 void SvxNumberFormat::SetListtabPos( const tools::Long nListtabPos )
 {
 mnListtabPos = nListtabPos;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 1846e6a8739c..63e819edf27e 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -213,6 +213,7 @@ public:
 
 void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy );
 LabelFollowedBy GetLabelFollowedBy() const { return meLabelFollowedBy;}
+OUString GetLabelFollowedByAsString() const;
 void SetListtabPos( const tools::Long nListtabPos );
 tools::Long GetListtabPos() const { return mnListtabPos;}
 void SetFirstLineIndent( const tools::Long nFirstLineIndent );
diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx
index 305831911b5f..1032f19b4abe 100644
--- a/sw/inc/chpfld.hxx
+++ b/sw/inc/chpfld.hxx
@@ -55,6 +55,7 @@ class SW_DLLPUBLIC SwChapterField final : public SwField
 sal_uInt8 nLevel;
 OUString sTitle;
 OUString sNumber;
+OUString sLabelFollowedBy;
 OUString sPre;
 OUString sPost;
 State() : nLevel(0) {}
diff --git a/sw/qa/core/fields/data/chapter_field_followedby.odt 
b/sw/qa/core/fields/data/chapter_field_followedby.odt
new file mode 100644
index ..b2086f2591b3
Binary files /dev/null and 
b/sw/qa/core/fields/data/chapter_field_followedby.odt differ
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 7f59597831ea..a0c5a2c86c7e 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -84,9 +84,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424)
 
 // Field: Chapter Format: Chapter number and name
 xField.set(xFields->nextElement(), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 -Another title"), 
xField->getPresentation(false));
-//   ^^ seems here must be a separator
-// Please modify this testcase once this behavior will be fixed. For now I 
just fix and check this behavior
+CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 - Another title"), 
xField->getPresentation(false));
 
 // Field: Chapter Format: Chapter number
 xField.set(xFields->nextElement(), uno::UNO_QUERY);
@@ -96,6 +94,43 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424)
 xField.set(xFields->nextElement(), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("2"), xField->getPresentation(false));
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy)
+{
+createSwDoc(DATA_DIRECTORY, "chapter_field_followedby.odt");
+
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xFieldsAccess(
+xTextFieldsSupplier->getTextFields());
+uno::Reference 

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

2021-07-26 Thread Vasily Melenchuk (via logerrit)
 editeng/source/items/numitem.cxx |   10 ++
 include/editeng/numitem.hxx  |2 +-
 sw/qa/core/fields/data/tdf143424.odt |binary
 sw/qa/core/fields/fields.cxx |   34 ++
 sw/source/core/doc/number.cxx|3 ++-
 sw/source/filter/ww8/wrtw8num.cxx|2 +-
 6 files changed, 48 insertions(+), 3 deletions(-)

New commits:
commit d44730148a95933f4a45a70241cb6d1d0546f626
Author: Vasily Melenchuk 
AuthorDate: Wed Jul 21 12:21:07 2021 +0300
Commit: Thorsten Behrens 
CommitDate: Mon Jul 26 15:18:16 2021 +0200

tdf#143424: support for "Chapter number without separator"

If LO is using list format strings (this is default behavior since
aa5c6d12) it was not able to show just numbering without all formatting,
as it used in some fields.

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 41ee6e4cf952..2f30242b911a 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -608,6 +608,16 @@ void 
SvxNumberFormat::SetListFormat(std::optional oSet)
 sSuffix = sListFormat->copy(nLastReplacement);
 }
 
+OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) 
const
+{
+assert(sListFormat.has_value());
+
+if (bIncludePrefixSuffix)
+return *sListFormat;
+
+// Strip prefix & suffix from string
+return sListFormat->copy(sPrefix.getLength(), sListFormat->getLength() - 
sPrefix.getLength() - sSuffix.getLength());
+}
 
 OUString SvxNumberFormat::GetCharFormatName()const
 {
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index bbcbecdf4c79..1846e6a8739c 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -175,7 +175,7 @@ public:
 voidSetListFormat(const OUString& rPrefix, const OUString& 
rSuffix, int nLevel);
 voidSetListFormat(std::optional oSet = std::nullopt);
 boolHasListFormat() const { return sListFormat.has_value(); }
-const OUString& GetListFormat() const { return *sListFormat; }
+OUStringGetListFormat(bool bIncludePrefixSuffix = true) const;
 
 voidSetCharFormatName(const OUString& rSet){ 
sCharStyleName = rSet; }
 virtual OUStringGetCharFormatName()const;
diff --git a/sw/qa/core/fields/data/tdf143424.odt 
b/sw/qa/core/fields/data/tdf143424.odt
new file mode 100644
index ..d485267f12e4
Binary files /dev/null and b/sw/qa/core/fields/data/tdf143424.odt differ
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 74b94d7a3f8e..7f59597831ea 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -10,6 +10,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -26,6 +28,8 @@ class Test : public SwModelTestBase
 {
 };
 
+constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/fields/data/";
+
 CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
 {
 // Create a document with a bibliography reference in it.
@@ -62,6 +66,36 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
 // first inserting an empty bibliography table into the document.
 CPPUNIT_ASSERT_EQUAL(OUString("ARJ00: Ar, J, mytitle, 2020"), aTooltip);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf143424)
+{
+createSwDoc(DATA_DIRECTORY, "tdf143424.odt");
+
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xFieldsAccess(
+xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+
+// TODO: I have no idea why fields are enumerated in invalid order, not 
like in document
+
+// Field: Chapter Format: Chapter name
+uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Another title"), 
xField->getPresentation(false));
+
+// Field: Chapter Format: Chapter number and name
+xField.set(xFields->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 -Another title"), 
xField->getPresentation(false));
+//   ^^ seems here must be a separator
+// Please modify this testcase once this behavior will be fixed. For now I 
just fix and check this behavior
+
+// Field: Chapter Format: Chapter number
+xField.set(xFields->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 -"), 
xField->getPresentation(false));
+
+// Field: Chapter Format: Chapter number without separator
+xField.set(xFields->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("2"), xField->getPresentation(false));
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/number.cxx 

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

2021-07-20 Thread Mike Kaganski (via logerrit)
 editeng/source/editeng/editobj.cxx  |  208 ++--
 editeng/source/editeng/editobj2.hxx |   82 ++--
 editeng/source/editeng/fieldupdater.cxx |4 
 editeng/source/editeng/impedit4.cxx |   29 ++--
 include/editeng/editobj.hxx |   87 +
 include/editeng/fieldupdater.hxx|2 
 sc/source/core/data/column.cxx  |8 -
 sw/qa/extras/layout/layout.cxx  |2 
 8 files changed, 116 insertions(+), 306 deletions(-)

New commits:
commit 8e8d3f4db94e0069a1d84378d295268f5037b016
Author: Mike Kaganski 
AuthorDate: Tue Jul 20 12:31:57 2021 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 20 21:32:26 2021 +0200

EditTextObject: use virtual interface instead of pimpl

Makes it simpler, and avoids extra allocations

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

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 7dd9bdd2459d..cf4e474df6b6 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -206,197 +206,20 @@ bool ContentInfo::Equals(const ContentInfo& rCompare, 
bool bComparePool) const
&& maCharAttribs == rCompare.maCharAttribs;
 }
 
-EditTextObject::EditTextObject( SfxItemPool* pPool ) :
-mpImpl(new EditTextObjectImpl(this, pPool))
-{
-}
-
-EditTextObject::EditTextObject( const EditTextObject& r ) :
-mpImpl(new EditTextObjectImpl(this, *r.mpImpl))
-{
-}
-
-EditTextObject::~EditTextObject()
-{
-}
-
-sal_Int32 EditTextObject::GetParagraphCount() const
-{
-return mpImpl->GetParagraphCount();
-}
-
-OUString EditTextObject::GetText(sal_Int32 nPara) const
-{
-return mpImpl->GetText(nPara);
-}
-
-void EditTextObject::ClearPortionInfo()
-{
-mpImpl->ClearPortionInfo();
-}
-
-bool EditTextObject::HasOnlineSpellErrors() const
-{
-return mpImpl->HasOnlineSpellErrors();
-}
-
-void EditTextObject::GetCharAttribs( sal_Int32 nPara, 
std::vector& rLst ) const
-{
-mpImpl->GetCharAttribs(nPara, rLst);
-}
-
-bool EditTextObject::IsFieldObject() const
-{
-return mpImpl->IsFieldObject();
-}
-
-const SvxFieldItem* EditTextObject::GetField() const
-{
-return mpImpl->GetField();
-}
-
-const SvxFieldData* EditTextObject::GetFieldData(sal_Int32 nPara, size_t nPos, 
sal_Int32 nType) const
-{
-return mpImpl->GetFieldData(nPara, nPos, nType);
-}
-
-bool EditTextObject::HasField( sal_Int32 nType ) const
-{
-return mpImpl->HasField(nType);
-}
-
-const SfxItemSet& EditTextObject::GetParaAttribs(sal_Int32 nPara) const
-{
-return mpImpl->GetParaAttribs(nPara);
-}
-
-bool EditTextObject::RemoveCharAttribs( sal_uInt16 nWhich )
-{
-return mpImpl->RemoveCharAttribs(nWhich);
-}
-
-void EditTextObject::GetAllSections( std::vector& rAttrs ) 
const
-{
-mpImpl->GetAllSections(rAttrs);
-}
-
-void EditTextObject::GetStyleSheet(sal_Int32 nPara, OUString& rName, 
SfxStyleFamily& eFamily) const
-{
-mpImpl->GetStyleSheet(nPara, rName, eFamily);
-}
-
-void EditTextObject::SetStyleSheet(sal_Int32 nPara, const OUString& rName, 
const SfxStyleFamily& eFamily)
-{
-mpImpl->SetStyleSheet(nPara, rName, eFamily);
-}
-
-bool EditTextObject::ChangeStyleSheets(
-std::u16string_view rOldName, SfxStyleFamily eOldFamily, const OUString& 
rNewName, SfxStyleFamily eNewFamily)
-{
-return mpImpl->ChangeStyleSheets(rOldName, eOldFamily, rNewName, 
eNewFamily);
-}
-
-void EditTextObject::ChangeStyleSheetName(
-SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString& 
rNewName)
-{
-mpImpl->ChangeStyleSheetName(eFamily, rOldName, rNewName);
-}
-
-editeng::FieldUpdater EditTextObject::GetFieldUpdater() const
-{
-return mpImpl->GetFieldUpdater();
-}
-
-void EditTextObject::NormalizeString( svl::SharedStringPool& rPool )
-{
-mpImpl->NormalizeString(rPool);
-}
-
-std::vector EditTextObject::GetSharedStrings() const
-{
-return mpImpl->GetSharedStrings();
-}
-
-const SfxItemPool* EditTextObject::GetPool() const
-{
-return mpImpl->GetPool();
-}
-
-OutlinerMode EditTextObject::GetUserType() const
-{
-return mpImpl->GetUserType();
-}
-
-void EditTextObject::SetUserType( OutlinerMode n )
-{
-mpImpl->SetUserType(n);
-}
-
-bool EditTextObject::IsVertical() const
-{
-return mpImpl->IsVertical();
-}
-
-bool EditTextObject::GetDirectVertical() const
-{
-return mpImpl->GetDirectVertical();
-}
-
-bool EditTextObject::IsTopToBottom() const
-{
-return mpImpl->IsTopToBottom();
-}
-
-void EditTextObject::SetVertical( bool bVertical )
-{
-return mpImpl->SetVertical(bVertical);
-}
-
-void EditTextObject::SetRotation( TextRotation nRotation )
-{
-mpImpl->SetRotation(nRotation);
-}
-
-TextRotation EditTextObject::GetRotation() const
-{
-return mpImpl->GetRotation();
-}
+EditTextObject::~EditTextObject() = default;
 
-SvtScriptType 

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

2021-07-20 Thread Noel Grandin (via logerrit)
 editeng/source/rtf/rtfitem.cxx |4 +--
 editeng/source/rtf/svxrtf.cxx  |   54 +
 include/editeng/svxrtf.hxx |2 -
 3 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit 2ebde17fec5fa991bd211c56ca93b7e528eea5b8
Author: Noel Grandin 
AuthorDate: Tue Jul 20 15:11:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 20 19:23:16 2021 +0200

no need to allocate child array separately in SvxRTFItemStackType

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

diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index c7ea1d3f9ba6..2f7f2fde29de 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -214,7 +214,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
 if( RTF_PARD == nLastToken || RTF_PLAIN == nLastToken )
 break;
 
-if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList ||
+if (pCurrent->aAttrSet.Count() || 
!pCurrent->maChildList.empty() ||
 pCurrent->nStyleNo )
 {
 // Open a new Group
@@ -1670,7 +1670,7 @@ void SvxRTFParser::RTFPardPlain( bool const bPard, 
SfxItemSet** ppSet )
 RTF_PLAIN != nLastToken &&
 BRACELEFT != nLastToken )
 {
-if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList || 
pCurrent->nStyleNo)
+if (pCurrent->aAttrSet.Count() || !pCurrent->maChildList.empty() || 
pCurrent->nStyleNo)
 {
 // open a new group
 auto xNew(std::make_unique(*pCurrent, 
*mxInsertPosition, true));
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 7bbf46a6026c..4b0fd66bb224 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -694,7 +694,7 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, 
delete from Stack
 
 do {// middle check loop
 sal_Int32 nOldSttNdIdx = pOld->mxStartNodeIdx->GetIdx();
-if (!pOld->m_pChildList &&
+if (pOld->maChildList.empty() &&
 ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
 (nOldSttNdIdx == mxInsertPosition->GetNodeIdx() &&
 pOld->nSttCnt == mxInsertPosition->GetCntIdx() )))
@@ -715,7 +715,7 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, 
delete from Stack
 pItem = aIter.NextItem();
 } while (pItem);
 
-if (!pOld->aAttrSet.Count() && !pOld->m_pChildList &&
+if (!pOld->aAttrSet.Count() && pOld->maChildList.empty() &&
 !pOld->nStyleNo )
 break;
 }
@@ -815,7 +815,7 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, 
delete from Stack
 pCurrent->Add(std::move(pOld));
 // split up and create new entry, because it makes no sense
 // to create a "so long" depend list. Bug 95010
-if (bCrsrBack && 50 < pCurrent->m_pChildList->size())
+if (bCrsrBack && 50 < pCurrent->maChildList.size())
 {
 // at the beginning of a paragraph? Move back one position
 MovePos();
@@ -869,15 +869,14 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType  )
 if( !bIsSetDfltTab )
 SetDefault( RTF_DEFTAB, 720 );
 
-if (rSet.m_pChildList)
+if (!rSet.maChildList.empty())
 rSet.Compress( *this );
 if( rSet.aAttrSet.Count() || rSet.nStyleNo )
 SetAttrInDoc( rSet );
 
 // then process all the children
-if (rSet.m_pChildList)
-for (size_t n = 0; n < rSet.m_pChildList->size(); ++n)
-SetAttrSet( *(*rSet.m_pChildList)[ n ] );
+for (size_t n = 0; n < rSet.maChildList.size(); ++n)
+SetAttrSet( *(rSet.maChildList[ n ]) );
 }
 
 // Has no text been inserted yet? (SttPos from the top Stack entry!)
@@ -1019,7 +1018,7 @@ SvxRTFItemStackType::SvxRTFItemStackType(
 */
 void SvxRTFItemStackType::DropChildList()
 {
-if (!m_pChildList || m_pChildList->empty())
+if (maChildList.empty())
 return;
 
 std::vector bfs;
@@ -1030,9 +1029,9 @@ void SvxRTFItemStackType::DropChildList()
 {
 auto* front = aQueue.front();
 aQueue.pop();
-if (front->m_pChildList)
+if (!front->maChildList.empty())
 {
-for (const auto& a : *front->m_pChildList)
+for (const auto& a : front->maChildList)
 aQueue.push(a.get());
 bfs.push_back(front);
 }
@@ -1041,7 +1040,7 @@ void SvxRTFItemStackType::DropChildList()
 for (auto it = bfs.rbegin(); it != bfs.rend(); ++it)
 {
 SvxRTFItemStackType* pNode = *it;
-pNode->m_pChildList.reset();
+pNode->maChildList.clear();
 }
 }
 

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

2021-07-20 Thread Noel Grandin (via logerrit)
 editeng/source/items/xmlcnitm.cxx |   43 ++
 include/editeng/xmlcnitm.hxx  |5 +---
 include/xmloff/xmlcnimp.hxx   |3 ++
 xmloff/source/core/xmlcnimp.cxx   |   12 ++
 4 files changed, 38 insertions(+), 25 deletions(-)

New commits:
commit 3077399b156477963a22c6c89c432ff49583e2c3
Author: Noel Grandin 
AuthorDate: Tue Jul 20 15:28:39 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 20 18:57:10 2021 +0200

no need to store data separately in SvXMLAttrContainerItem

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

diff --git a/editeng/source/items/xmlcnitm.cxx 
b/editeng/source/items/xmlcnitm.cxx
index 5ee7c47e8d90..1e88121ee576 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -33,15 +33,14 @@ using namespace ::com::sun::star::xml;
 
 
 SvXMLAttrContainerItem::SvXMLAttrContainerItem( sal_uInt16 _nWhich ) :
-SfxPoolItem( _nWhich ),
-pImpl( new SvXMLAttrContainerData )
+SfxPoolItem( _nWhich )
 {
 }
 
 SvXMLAttrContainerItem::SvXMLAttrContainerItem(
 const SvXMLAttrContainerItem& rItem ) :
 SfxPoolItem( rItem ),
-pImpl( new SvXMLAttrContainerData( *rItem.pImpl ) )
+maContainerData( rItem.maContainerData )
 {
 }
 
@@ -52,7 +51,7 @@ SvXMLAttrContainerItem::~SvXMLAttrContainerItem()
 bool SvXMLAttrContainerItem::operator==( const SfxPoolItem& rItem ) const
 {
 return SfxPoolItem::operator==(rItem) &&
-*pImpl == *static_cast(rItem).pImpl;
+maContainerData == static_cast(rItem).maContainerData;
 }
 
 bool SvXMLAttrContainerItem::GetPresentation(
@@ -68,7 +67,7 @@ bool SvXMLAttrContainerItem::GetPresentation(
 bool SvXMLAttrContainerItem::QueryValue( css::uno::Any& rVal, sal_uInt8 
/*nMemberId*/ ) const
 {
 Reference xContainer
-= new 
SvUnoAttributeContainer(std::make_unique(*pImpl));
+= new 
SvUnoAttributeContainer(std::make_unique(maContainerData));
 
 rVal <<= xContainer;
 return true;
@@ -84,11 +83,11 @@ bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& 
rVal, sal_uInt8 /*nM
 
 if( pContainer )
 {
-pImpl.reset( new SvXMLAttrContainerData( * 
pContainer->GetContainerImpl() ) );
+maContainerData = *pContainer->GetContainerImpl();
 }
 else
 {
-std::unique_ptr pNewImpl(new 
SvXMLAttrContainerData);
+SvXMLAttrContainerData aNewImpl;
 
 try
 {
@@ -119,24 +118,24 @@ bool SvXMLAttrContainerItem::PutValue( const 
css::uno::Any& rVal, sal_uInt8 /*nM
 
 if( pData->Namespace.isEmpty() )
 {
-if( !pNewImpl->AddAttr( aPrefix, aLName, pData->Value 
) )
+if( !aNewImpl.AddAttr( aPrefix, aLName, pData->Value ) 
)
 break;
 }
 else
 {
-if( !pNewImpl->AddAttr( aPrefix, pData->Namespace, 
aLName, pData->Value ) )
+if( !aNewImpl.AddAttr( aPrefix, pData->Namespace, 
aLName, pData->Value ) )
 break;
 }
 }
 else
 {
-if( !pNewImpl->AddAttr( aName, pData->Value ) )
+if( !aNewImpl.AddAttr( aName, pData->Value ) )
 break;
 }
 }
 
 if( nAttr == nCount )
-pImpl = std::move(pNewImpl);
+maContainerData = std::move(aNewImpl);
 else
 return false;
 }
@@ -152,60 +151,60 @@ bool SvXMLAttrContainerItem::PutValue( const 
css::uno::Any& rVal, sal_uInt8 /*nM
 bool SvXMLAttrContainerItem::AddAttr( const OUString& rLName,
 const OUString& rValue )
 {
-return pImpl->AddAttr( rLName, rValue );
+return maContainerData.AddAttr( rLName, rValue );
 }
 
 bool SvXMLAttrContainerItem::AddAttr( const OUString& rPrefix,
   const OUString& rNamespace, const OUString& rLName,
   const OUString& rValue )
 {
-return pImpl->AddAttr( rPrefix, rNamespace, rLName, rValue );
+return maContainerData.AddAttr( rPrefix, rNamespace, rLName, rValue );
 }
 
 sal_uInt16 SvXMLAttrContainerItem::GetAttrCount() const
 {
-return static_cast(pImpl->GetAttrCount());
+return static_cast(maContainerData.GetAttrCount());
 }
 
 OUString SvXMLAttrContainerItem::GetAttrNamespace( sal_uInt16 i ) const
 {
-return pImpl->GetAttrNamespace( i );
+return maContainerData.GetAttrNamespace( i );
 }
 
 OUString SvXMLAttrContainerItem::GetAttrPrefix( sal_uInt16 i ) const
 {
-return pImpl->GetAttrPrefix( i );
+return maContainerData.GetAttrPrefix( i );
 }
 
 const OUString& 

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

2021-07-16 Thread Mike Kaganski (via logerrit)
 editeng/source/rtf/rtfitem.cxx|  334 +++---
 editeng/source/rtf/svxrtf.cxx |  155 ++-
 include/editeng/svxrtf.hxx|   84 
 sc/source/filter/rtf/rtfparse.cxx |8 
 svx/source/table/tablertfimporter.cxx |4 
 5 files changed, 231 insertions(+), 354 deletions(-)

New commits:
commit caac77e62fe44aa8d5ef282b63765ae05148548b
Author: Mike Kaganski 
AuthorDate: Fri Jul 16 12:08:26 2021 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jul 16 12:55:10 2021 +0200

Use WhichRangesContainer in editeng

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

diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index b6e0a93adee6..c7ea1d3f9ba6 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -81,33 +81,33 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, 
SfxItemSet& rSet,
 switch( rItem.Which() )
 {
 case SID_ATTR_CHAR_FONT:
-pNormal = 
-pCJK = 
-pCTL = 
+pNormal = [SID_ATTR_CHAR_FONT];
+pCJK = [SID_ATTR_CHAR_CJK_FONT];
+pCTL = [SID_ATTR_CHAR_CTL_FONT];
 break;
 
 case SID_ATTR_CHAR_FONTHEIGHT:
-pNormal = 
-pCJK = 
-pCTL = 
+pNormal = [SID_ATTR_CHAR_FONTHEIGHT];
+pCJK = [SID_ATTR_CHAR_CJK_FONTHEIGHT];
+pCTL = [SID_ATTR_CHAR_CTL_FONTHEIGHT];
 break;
 
 case SID_ATTR_CHAR_POSTURE:
-pNormal = 
-pCJK = 
-pCTL = 
+pNormal = [SID_ATTR_CHAR_POSTURE];
+pCJK = [SID_ATTR_CHAR_CJK_POSTURE];
+pCTL = [SID_ATTR_CHAR_CTL_POSTURE];
 break;
 
 case SID_ATTR_CHAR_WEIGHT:
-pNormal = 
-pCJK = 
-pCTL = 
+pNormal = [SID_ATTR_CHAR_WEIGHT];
+pCJK = [SID_ATTR_CHAR_CJK_WEIGHT];
+pCTL = [SID_ATTR_CHAR_CTL_WEIGHT];
 break;
 
 case SID_ATTR_CHAR_LANGUAGE:
-pNormal = 
-pCJK = 
-pCTL = 
+pNormal = [SID_ATTR_CHAR_LANGUAGE];
+pCJK = [SID_ATTR_CHAR_CJK_LANGUAGE];
+pCTL = [SID_ATTR_CHAR_CTL_LANGUAGE];
 break;
 
 case 0:
@@ -267,57 +267,55 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet 
)
 break;
 
 case RTF_KEEP:
-if( aPardMap.nSplit )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_SPLIT])
 {
-pSet->Put( SvxFormatSplitItem( false, aPardMap.nSplit ));
+pSet->Put(SvxFormatSplitItem(false, wid));
 }
 break;
 
 case RTF_KEEPN:
-if( aPardMap.nKeep )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_KEEP])
 {
-pSet->Put( SvxFormatKeepItem( true, aPardMap.nKeep ));
+pSet->Put(SvxFormatKeepItem(true, wid));
 }
 break;
 
 case RTF_LEVEL:
-if( aPardMap.nOutlineLvl )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_OUTLLEVEL])
 {
-pSet->Put( SfxInt16Item( aPardMap.nOutlineLvl,
-
static_cast(nTokenValue) ));
+pSet->Put(SfxInt16Item(wid, 
static_cast(nTokenValue)));
 }
 break;
 
 case RTF_QL:
-if( aPardMap.nAdjust )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
 {
-pSet->Put( SvxAdjustItem( SvxAdjust::Left, 
aPardMap.nAdjust ));
+pSet->Put(SvxAdjustItem(SvxAdjust::Left, wid));
 }
 break;
 case RTF_QR:
-if( aPardMap.nAdjust )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
 {
-pSet->Put( SvxAdjustItem( SvxAdjust::Right, 
aPardMap.nAdjust ));
+pSet->Put(SvxAdjustItem(SvxAdjust::Right, wid));
 }
 break;
 case RTF_QJ:
-if( aPardMap.nAdjust )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
 {
-pSet->Put( SvxAdjustItem( SvxAdjust::Block, 
aPardMap.nAdjust ));
+pSet->Put(SvxAdjustItem(SvxAdjust::Block, wid));
 }
 break;
 case RTF_QC:
-if( aPardMap.nAdjust )
+if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
 {
-pSet->Put( SvxAdjustItem( SvxAdjust::Center, 
aPardMap.nAdjust ));
+pSet->Put(SvxAdjustItem(SvxAdjust::Center, wid));
 }
 break;
 
 

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

2021-07-07 Thread Noel Grandin (via logerrit)
 editeng/source/accessibility/AccessibleParaManager.cxx |   11 ++
 include/editeng/AccessibleParaManager.hxx  |1 
 svx/source/accessibility/AccessibleTextHelper.cxx  |   29 +++--
 3 files changed, 18 insertions(+), 23 deletions(-)

New commits:
commit 4c76bcb5f35527283c6070fc8e3911a35734eba1
Author: Noel Grandin 
AuthorDate: Tue Jul 6 20:53:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 7 17:51:52 2021 +0200

tdf#132740 avoid some WeakReference cost in accessibility

reduces time by 20% for me

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

diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx 
b/editeng/source/accessibility/AccessibleParaManager.cxx
index 2fb3006da7b7..12aff3e2df63 100644
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -144,6 +144,17 @@ namespace accessibility
 }
 }
 
+bool AccessibleParaManager::HasCreatedChild( sal_Int32 nParagraphIndex ) 
const
+{
+if( 0 <= nParagraphIndex && maChildren.size() > 
o3tl::make_unsigned(nParagraphIndex) )
+{
+auto const & rChild = maChildren[ nParagraphIndex ];
+return rChild.second.Width != 0 || rChild.second.Height != 0;
+}
+else
+return false;
+}
+
 AccessibleParaManager::Child AccessibleParaManager::CreateChild( sal_Int32 
 nChild,
  const 
uno::Reference< XAccessible >&   xFrontEnd,
  
SvxEditSourceAdapter&  rEditSource,
diff --git a/include/editeng/AccessibleParaManager.hxx 
b/include/editeng/AccessibleParaManager.hxx
index d496be8afb28..5330e1100893 100644
--- a/include/editeng/AccessibleParaManager.hxx
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -138,6 +138,7 @@ namespace accessibility
sal_Int32   
nParagraphIndex );
 
 WeakChild GetChild( sal_Int32 nParagraphIndex ) const;
+bool HasCreatedChild( sal_Int32 nParagraphIndex ) const;
 
 // forwarder to all paragraphs
 /// Make all children active and editable (or off)
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx 
b/svx/source/accessibility/AccessibleTextHelper.cxx
index f8ff9013e929..9fbd897ea519 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -761,9 +761,7 @@ namespace accessibility
 if (mxFrontEnd.is() && bBroadcastEvents)
 {
 // child not yet created?
-::accessibility::AccessibleParaManager::WeakChild aChild( 
maParaManager.GetChild(nCurrPara) );
-if( aChild.second.Width == 0 &&
-aChild.second.Height == 0 )
+if (!maParaManager.HasCreatedChild(nCurrPara))
 {
 GotPropertyEvent( uno::makeAny( 
maParaManager.CreateChild( nCurrPara - mnFirstVisibleChild,

mxFrontEnd, GetEditSource(), nCurrPara ).first ),
@@ -787,15 +785,12 @@ namespace accessibility
 }
 }
 
-namespace {
-
-// functor for checking changes in paragraph bounding boxes (no 
stand-alone function, maybe not inlined)
-class AccessibleTextHelper_UpdateChildBounds
+void AccessibleTextHelper_Impl::UpdateBoundRect()
 {
-public:
-explicit AccessibleTextHelper_UpdateChildBounds() {}
-::accessibility::AccessibleParaManager::WeakChild operator()( const 
::accessibility::AccessibleParaManager::WeakChild& rChild )
+// send BOUNDRECT_CHANGED to affected children
+for(auto it = maParaManager.begin(); it != maParaManager.end(); ++it)
 {
+::accessibility::AccessibleParaManager::WeakChild& rChild = *it;
 // retrieve hard reference from weak one
 auto aHardRef( rChild.first.get() );
 
@@ -813,22 +808,10 @@ namespace accessibility
 aHardRef->FireEvent( AccessibleEventId::BOUNDRECT_CHANGED 
);
 
 // update internal bounds
-return ::accessibility::AccessibleParaManager::WeakChild( 
rChild.first, aNewRect );
+rChild = 
::accessibility::AccessibleParaManager::WeakChild( rChild.first, aNewRect );
 }
 }
-
-// identity transform
-return rChild;
 }
-};
-
-}
-
-void AccessibleTextHelper_Impl::UpdateBoundRect()
-{
-// send BOUNDRECT_CHANGED to 

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

2021-06-29 Thread Andrea Gelmini (via logerrit)
 editeng/source/items/numitem.cxx  |2 +-
 include/editeng/numitem.hxx   |2 +-
 sw/qa/extras/odfexport/odfexport2.cxx |4 ++--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 427e3180589574a495df5a3677aedf7da97e11f9
Author: Andrea Gelmini 
AuthorDate: Tue Jun 29 12:34:46 2021 +0200
Commit: Andrea Gelmini 
CommitDate: Tue Jun 29 20:53:06 2021 +0200

Fix typos

Change-Id: Ic943746614b894690768d0d6109123c1af819c52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118081
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Andrea Gelmini 

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 9c55ef1e401c..54bec9d892ea 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -572,7 +572,7 @@ void SvxNumberFormat::SetListFormat(const OUString& 
rPrefix, const OUString& rSu
 {
 int nLevelId = nLevel - nInclUpperLevels + i;
 if (nLevelId < 0)
-// There can be cases with curent level 1, but request to show 10 
upper levels. Trim it
+// There can be cases with current level 1, but request to show 10 
upper levels. Trim it
 continue;
 
 *sListFormat += "%";
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index f955ea15d008..2e2e660267e8 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -171,7 +171,7 @@ public:
 const OUString& GetPrefix() const { return sPrefix;}
 voidSetSuffix(const OUString& rSet) { sSuffix = rSet;}
 const OUString& GetSuffix() const { return sSuffix;}
-// Based on prefix and suffix ininialize them (for backward compatibility) 
and generate listformat string
+// Based on prefix and suffix initialize them (for backward compatibility) 
and generate listformat string
 voidSetListFormat(const OUString& rPrefix, const OUString& 
rSuffix, int nLevel);
 voidSetListFormat(std::optional oSet = std::nullopt);
 boolHasListFormat() const { return sListFormat.has_value(); }
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index bbe5d7f193e7..5269779a1690 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -52,7 +52,7 @@ DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx")
 
 DECLARE_ODFEXPORT_TEST(testListFormatDocx, "listformat.docx")
 {
-// Ensure in resulting ODT we also have not just prefix/suffux, but custom 
delimiters
+// Ensure in resulting ODT we also have not just prefix/suffix, but custom 
delimiters
 CPPUNIT_ASSERT_EQUAL(OUString(">1<"), 
getProperty(getParagraph(1), "ListLabelString"));
 CPPUNIT_ASSERT_EQUAL(OUString(">>1/1<<"), 
getProperty(getParagraph(2), "ListLabelString"));
 CPPUNIT_ASSERT_EQUAL(OUString(">>1/1/1<<"), 
getProperty(getParagraph(3), "ListLabelString"));
@@ -84,7 +84,7 @@ DECLARE_ODFEXPORT_TEST(testListFormatDocx, "listformat.docx")
 
 DECLARE_ODFEXPORT_TEST(testListFormatOdt, "listformat.odt")
 {
-// Ensure in resulting ODT we also have not just prefix/suffux, but custom 
delimiters
+// Ensure in resulting ODT we also have not just prefix/suffix, but custom 
delimiters
 CPPUNIT_ASSERT_EQUAL(OUString(">1<"), 
getProperty(getParagraph(1), "ListLabelString"));
 CPPUNIT_ASSERT_EQUAL(OUString(">>1.1<<"), 
getProperty(getParagraph(2), "ListLabelString"));
 CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.1<<"), 
getProperty(getParagraph(3), "ListLabelString"));
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 9e190389d938..ed4787f148f7 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1790,7 +1790,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
 {
 // we need to share a single theme across all the shapes, but we parse it
-// in ShapeContextHandler. So if it has been parsed there, propogate it to
+// in ShapeContextHandler. So if it has been parsed there, propagate it to
 // the document.
 if (mrShapeContext && mrShapeContext->getTheme() && 
!getDocument()->getTheme())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-03 Thread Caolán McNamara (via logerrit)
 editeng/source/rtf/svxrtf.cxx |   25 ++---
 include/editeng/svxrtf.hxx|3 +++
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit b30839cecd25b9f6f56fcf4b3d3e90ab23a3d0b7
Author: Caolán McNamara 
AuthorDate: Thu Jun 3 10:02:59 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 3 14:28:50 2021 +0200

use std::make_unique instead of new

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 43c6a8e6f8e5..9d5f3abe84ec 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -609,23 +609,34 @@ const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId )
 return *pDfltFont;
 }
 
+std::unique_ptr 
SvxRTFItemStackType::createSvxRTFItemStackType(
+SfxItemPool& rPool, const sal_uInt16* pWhichRange, const EditPosition& 
rEditPosition)
+{
+struct MakeUniqueEnabler : public SvxRTFItemStackType
+{
+MakeUniqueEnabler(SfxItemPool& rPool, const sal_uInt16* pWhichRange, 
const EditPosition& rEditPosition)
+: SvxRTFItemStackType(rPool, pWhichRange, rEditPosition)
+{
+}
+};
+return std::make_unique(rPool, pWhichRange, 
rEditPosition);
+}
+
 SvxRTFItemStackType* SvxRTFParser::GetAttrSet_()
 {
 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : 
aAttrStack.back().get();
-std::unique_ptr pNew;
+std::unique_ptr xNew;
 if( pCurrent )
-pNew.reset(new SvxRTFItemStackType( *pCurrent, *mxInsertPosition, 
false/*bCopyAttr*/ ));
+xNew = std::make_unique(*pCurrent, 
*mxInsertPosition, false/*bCopyAttr*/);
 else
-pNew.reset(new SvxRTFItemStackType( *pAttrPool, aWhichMap.data(),
-*mxInsertPosition ));
-pNew->SetRTFDefaults( GetRTFDefaults() );
+xNew = SvxRTFItemStackType::createSvxRTFItemStackType(*pAttrPool, 
aWhichMap.data(), *mxInsertPosition);
+xNew->SetRTFDefaults( GetRTFDefaults() );
 
-aAttrStack.push_back( std::move(pNew) );
+aAttrStack.push_back( std::move(xNew) );
 bNewGroup = false;
 return aAttrStack.back().get();
 }
 
-
 void SvxRTFParser::ClearStyleAttr_( SvxRTFItemStackType& rStkType )
 {
 // check attributes to the attributes of the stylesheet or to
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index d19c542885bf..d322b1823e2b 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -304,6 +304,9 @@ class SvxRTFItemStackType
 SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange,
 const EditPosition& );
 
+static std::unique_ptr createSvxRTFItemStackType(
+SfxItemPool&, const sal_uInt16* pWhichRange, const EditPosition&);
+
 void Add(std::unique_ptr);
 void Compress( const SvxRTFParser& );
 void DropChildList();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-01 Thread Stephan Bergmann (via logerrit)
 editeng/source/items/numitem.cxx |4 ++--
 include/editeng/numitem.hxx  |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fca96bf4b21ca47a98a2bd0114f7c22935acc54b
Author: Stephan Bergmann 
AuthorDate: Tue Jun 1 13:58:17 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Jun 1 16:26:08 2021 +0200

loplugin:noexceptmove

(not sure exactly why this started to only hit me now on macOS against LLVM 
13
trunk libc++)

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index ba935384eb31..2dd03a1877cf 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -638,7 +638,7 @@ SvxNumRule::SvxNumRule(const SvxNumRule& rCopy)
 }
 }
 
-SvxNumRule::SvxNumRule(SvxNumRule&& rCopy)
+SvxNumRule::SvxNumRule(SvxNumRule&& rCopy) noexcept
 {
 ++nRefCount;
 nLevelCount  = rCopy.nLevelCount ;
@@ -774,7 +774,7 @@ SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy )
 return *this;
 }
 
-SvxNumRule& SvxNumRule::operator=( SvxNumRule&& rCopy )
+SvxNumRule& SvxNumRule::operator=( SvxNumRule&& rCopy ) noexcept
 {
 if (this != )
 {
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 8b27c76c7dd1..b4b9e030fb2d 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -266,7 +266,7 @@ public:
 eDefaultNumberFormatPositionAndSpaceMode
 = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
 SvxNumRule(const SvxNumRule& rCopy);
-SvxNumRule(SvxNumRule&&);
+SvxNumRule(SvxNumRule&&) noexcept;
 SvxNumRule(SvStream );
 ~SvxNumRule();
 
@@ -274,7 +274,7 @@ public:
 booloperator!=( const SvxNumRule& rRule ) const 
{return !(*this == rRule);}
 
 SvxNumRule& operator=( const SvxNumRule&  );
-SvxNumRule& operator=( SvxNumRule&&  );
+SvxNumRule& operator=( SvxNumRule&&  ) noexcept;
 
 voidStore(SvStream );
 voiddumpAsXml(xmlTextWriterPtr pWriter) const;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-31 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/eertfpar.cxx |8 +++---
 editeng/source/editeng/eertfpar.hxx |2 -
 editeng/source/rtf/rtfitem.cxx  |2 -
 editeng/source/rtf/svxrtf.cxx   |   42 
 include/editeng/svxrtf.hxx  |   12 +-
 5 files changed, 31 insertions(+), 35 deletions(-)

New commits:
commit 2efe1e8977a83143696b8db49c7c26bbff91c04c
Author: Noel Grandin 
AuthorDate: Mon May 31 10:10:50 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 31 18:33:10 2021 +0200

no need to allocate EditNodeIdx separately

it is just two pointers

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

diff --git a/editeng/source/editeng/eertfpar.cxx 
b/editeng/source/editeng/eertfpar.cxx
index ecc1247c913d..278699dbfcb1 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -275,7 +275,7 @@ void EditRTFParser::MovePos( bool const bForward )
 aCurSel.Max(), i18n::CharacterIteratorMode::SKIPCHARACTER);
 }
 
-void EditRTFParser::SetEndPrevPara( EditNodeIdx*& rpNodePos,
+void EditRTFParser::SetEndPrevPara( std::optional& rpNodePos,
 sal_Int32& rCntPos )
 {
 // The Intention is to: determine the current insert position of the
@@ -289,7 +289,7 @@ void EditRTFParser::SetEndPrevPara( EditNodeIdx*& rpNodePos,
 nCurPara--;
 ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject( nCurPara );
 assert(pPrevNode && "pPrevNode = 0!");
-rpNodePos = new EditNodeIdx(mpEditEngine, pPrevNode);
+rpNodePos = EditNodeIdx(mpEditEngine, pPrevNode);
 rCntPos = pPrevNode->Len();
 }
 
@@ -612,9 +612,9 @@ sal_Int32 EditNodeIdx::GetIdx() const
 EditPosition::EditPosition(EditEngine* pEE, EditSelection* pSel) :
 mpEditEngine(pEE), mpCurSel(pSel) {}
 
-std::unique_ptr EditPosition::MakeNodeIdx() const
+EditNodeIdx EditPosition::MakeNodeIdx() const
 {
-return std::make_unique(mpEditEngine, 
mpCurSel->Max().GetNode());
+return EditNodeIdx(mpEditEngine, mpCurSel->Max().GetNode());
 }
 
 sal_Int32 EditPosition::GetNodeIdx() const
diff --git a/editeng/source/editeng/eertfpar.hxx 
b/editeng/source/editeng/eertfpar.hxx
index 582e46a68a81..19ce00ce3297 100644
--- a/editeng/source/editeng/eertfpar.hxx
+++ b/editeng/source/editeng/eertfpar.hxx
@@ -37,7 +37,7 @@ private:
 virtual voidInsertPara() override;
 virtual voidInsertText() override;
 virtual voidMovePos( bool bForward = true ) override;
-virtual voidSetEndPrevPara( EditNodeIdx*& rpNodePos,
+virtual voidSetEndPrevPara( std::optional& rpNodePos,
 sal_Int32& rCntPos ) override;
 
 virtual voidUnknownAttrToken( int nToken ) override;
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 699fe0834f7e..ef370d98995f 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -206,7 +206,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
 break;
 
 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : 
aAttrStack.back().get();
-if( !pCurrent || (pCurrent->pSttNd->GetIdx() == 
mxInsertPosition->GetNodeIdx() &&
+if( !pCurrent || (pCurrent->mxStartNodeIdx->GetIdx() == 
mxInsertPosition->GetNodeIdx() &&
 pCurrent->nSttCnt == mxInsertPosition->GetCntIdx() ))
 break;
 
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index df0f030f0c57..ac262af2e759 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -680,7 +680,7 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, 
delete from Stack
 SvxRTFItemStackType *pCurrent = aAttrStack.empty() ? nullptr : 
aAttrStack.back().get();
 
 do {// middle check loop
-sal_Int32 nOldSttNdIdx = pOld->pSttNd->GetIdx();
+sal_Int32 nOldSttNdIdx = pOld->mxStartNodeIdx->GetIdx();
 if (!pOld->m_pChildList &&
 ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
 (nOldSttNdIdx == mxInsertPosition->GetNodeIdx() &&
@@ -718,8 +718,8 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, 
delete from Stack
 bCrsrBack = nNd != mxInsertPosition->GetNodeIdx();
 }
 
-if( pOld->pSttNd->GetIdx() < mxInsertPosition->GetNodeIdx() ||
-( pOld->pSttNd->GetIdx() == mxInsertPosition->GetNodeIdx() &&
+if( pOld->mxStartNodeIdx->GetIdx() < mxInsertPosition->GetNodeIdx() ||
+( pOld->mxStartNodeIdx->GetIdx() == mxInsertPosition->GetNodeIdx() 
&&
   pOld->nSttCnt <= mxInsertPosition->GetCntIdx() ) )
 {
 if( !bCrsrBack )
@@ -756,7 +756,7 @@ void 

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

2021-05-31 Thread Noel Grandin (via logerrit)
 editeng/source/editeng/eertfpar.cxx |5 
 editeng/source/rtf/rtfitem.cxx  |   12 +-
 editeng/source/rtf/svxrtf.cxx   |   40 ++--
 include/editeng/svxrtf.hxx  |6 +
 4 files changed, 28 insertions(+), 35 deletions(-)

New commits:
commit 21ad3e6cbdf9568c1152a2eab8178e4219e40c33
Author: Noel Grandin 
AuthorDate: Mon May 31 09:49:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 31 18:32:39 2021 +0200

EditPosition does not need to be allocated separately

it's just two pointers big

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

diff --git a/editeng/source/editeng/eertfpar.cxx 
b/editeng/source/editeng/eertfpar.cxx
index 2be675266f36..ecc1247c913d 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -612,11 +612,6 @@ sal_Int32 EditNodeIdx::GetIdx() const
 EditPosition::EditPosition(EditEngine* pEE, EditSelection* pSel) :
 mpEditEngine(pEE), mpCurSel(pSel) {}
 
-std::unique_ptr EditPosition::Clone() const
-{
-return std::unique_ptr(new EditPosition(mpEditEngine, 
mpCurSel));
-}
-
 std::unique_ptr EditPosition::MakeNodeIdx() const
 {
 return std::make_unique(mpEditEngine, 
mpCurSel->Max().GetNode());
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index de9a66d8eddc..699fe0834f7e 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -206,8 +206,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
 break;
 
 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : 
aAttrStack.back().get();
-if( !pCurrent || (pCurrent->pSttNd->GetIdx() == 
pInsPos->GetNodeIdx() &&
-pCurrent->nSttCnt == pInsPos->GetCntIdx() ))
+if( !pCurrent || (pCurrent->pSttNd->GetIdx() == 
mxInsertPosition->GetNodeIdx() &&
+pCurrent->nSttCnt == mxInsertPosition->GetCntIdx() ))
 break;
 
 int nLastToken = GetStackPtr(-1)->nTokenId;
@@ -219,7 +219,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
 {
 // Open a new Group
 std::unique_ptr pNew(new 
SvxRTFItemStackType(
-*pCurrent, *pInsPos, true ));
+*pCurrent, *mxInsertPosition, 
true ));
 pNew->SetRTFDefaults( GetRTFDefaults() );
 
 // "Set" all valid attributes up until this point
@@ -232,7 +232,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
 }
 else
 // continue to use this entry as a new one
-pCurrent->SetStartPos( *pInsPos );
+pCurrent->SetStartPos( *mxInsertPosition );
 
 pSet = >aAttrSet;
 } while( false );
@@ -1704,7 +1704,7 @@ void SvxRTFParser::RTFPardPlain( bool const bPard, 
SfxItemSet** ppSet )
 if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList || 
pCurrent->nStyleNo)
 {
 // open a new group
-std::unique_ptr pNew(new SvxRTFItemStackType( 
*pCurrent, *pInsPos, true ));
+std::unique_ptr pNew(new SvxRTFItemStackType( 
*pCurrent, *mxInsertPosition, true ));
 pNew->SetRTFDefaults( GetRTFDefaults() );
 
 // Set all until here valid attributes
@@ -1717,7 +1717,7 @@ void SvxRTFParser::RTFPardPlain( bool const bPard, 
SfxItemSet** ppSet )
 else
 {
 // continue to use this entry as new
-pCurrent->SetStartPos( *pInsPos );
+pCurrent->SetStartPos( *mxInsertPosition );
 bNewStkEntry = false;
 }
 }
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 4bf5c3811bdc..df0f030f0c57 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -83,14 +83,14 @@ SvxRTFParser::~SvxRTFParser()
 
 void SvxRTFParser::SetInsPos( const EditPosition& rNew )
 {
-pInsPos = rNew.Clone();
+mxInsertPosition = rNew;
 }
 
 SvParserState SvxRTFParser::CallParser()
 {
-DBG_ASSERT( pInsPos, "no insertion position");
+DBG_ASSERT( mxInsertPosition, "no insertion position");
 
-if( !pInsPos )
+if( !mxInsertPosition )
 return SvParserState::Error;
 
 if( !maColorTable.empty() )
@@ -614,10 +614,10 @@ SvxRTFItemStackType* SvxRTFParser::GetAttrSet_()
 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : 
aAttrStack.back().get();
 std::unique_ptr pNew;
 if( pCurrent )
-pNew.reset(new SvxRTFItemStackType( *pCurrent, *pInsPos, 
false/*bCopyAttr*/ ));
+pNew.reset(new SvxRTFItemStackType( *pCurrent, *mxInsertPosition, 

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

2021-05-31 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unoipset.cxx |   16 
 include/editeng/unoipset.hxx|2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 7d34acfeec112ab5cdabba059d01d8876be4
Author: Noel Grandin 
AuthorDate: Sun May 30 13:03:38 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 31 11:20:55 2021 +0200

flatten SvxItemPropertySet a little

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

diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 8a4ad0c29bac..cdc1bac825df 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -54,10 +54,10 @@ SvxItemPropertySet::~SvxItemPropertySet()
 
 uno::Any* SvxItemPropertySet::GetUsrAnyForID(SfxItemPropertyMapEntry const & 
entry) const
 {
-for (auto const & pActual : aCombineList)
+for (auto const & rActual : aCombineList)
 {
-if( pActual->nWID == entry.nWID && pActual->memberId == 
entry.nMemberId )
-return >aAny;
+if( rActual.nWID == entry.nWID && rActual.memberId == entry.nMemberId )
+return const_cast();
 }
 return nullptr;
 }
@@ -66,11 +66,11 @@ uno::Any* 
SvxItemPropertySet::GetUsrAnyForID(SfxItemPropertyMapEntry const & ent
 void SvxItemPropertySet::AddUsrAnyForID(
 const uno::Any& rAny, SfxItemPropertyMapEntry const & entry)
 {
-std::unique_ptr pNew(new SvxIDPropertyCombine);
-pNew->nWID = entry.nWID;
-pNew->memberId = entry.nMemberId;
-pNew->aAny = rAny;
-aCombineList.push_back( std::move(pNew) );
+SvxIDPropertyCombine aNew;
+aNew.nWID = entry.nWID;
+aNew.memberId = entry.nMemberId;
+aNew.aAny = rAny;
+aCombineList.push_back( std::move(aNew) );
 }
 
 
diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx
index 10a0030aa75b..2c079a06b37f 100644
--- a/include/editeng/unoipset.hxx
+++ b/include/editeng/unoipset.hxx
@@ -34,7 +34,7 @@ class EDITENG_DLLPUBLIC SvxItemPropertySet
 {
 SfxItemPropertyMap  m_aPropertyMap;
 mutable css::uno::Reference m_xInfo;
-::std::vector< std::unique_ptr > aCombineList;
+::std::vector< SvxIDPropertyCombine > aCombineList;
 SfxItemPool&mrItemPool;
 
 public:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-31 Thread Noel Grandin (via logerrit)
 editeng/source/rtf/svxrtf.cxx |   36 +---
 include/editeng/svxrtf.hxx|2 +-
 2 files changed, 18 insertions(+), 20 deletions(-)

New commits:
commit 8371ae143ef31c332bdcf753ca1dff722a531229
Author: Noel Grandin 
AuthorDate: Sun May 30 17:04:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 31 10:35:08 2021 +0200

vcl::Font is already a copy-on-write structure

with an impl pointer, no need to use unique_ptr when storing in a map

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 17ef94553ec5..4bf5c3811bdc 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -442,13 +442,13 @@ void SvxRTFParser::ReadColorTable()
 void SvxRTFParser::ReadFontTable()
 {
 int _nOpenBrakets = 1;  // the first was already detected earlier!!
-std::unique_ptr pFont(new vcl::Font);
+vcl::Font aFont;
 short nFontNo(0), nInsFontNo (0);
 OUString sAltNm, sFntNm;
 bool bIsAltFntNm = false;
 
 rtl_TextEncoding nSystemChar = lcl_GetDefaultTextEncodingForRTF();
-pFont->SetCharSet( nSystemChar );
+aFont.SetCharSet( nSystemChar );
 SetEncoding( nSystemChar );
 
 while( _nOpenBrakets && IsParserWorking() )
@@ -487,33 +487,33 @@ void SvxRTFParser::ReadFontTable()
 ++_nOpenBrakets;
 break;
 case RTF_FROMAN:
-pFont->SetFamily( FAMILY_ROMAN );
+aFont.SetFamily( FAMILY_ROMAN );
 break;
 case RTF_FSWISS:
-pFont->SetFamily( FAMILY_SWISS );
+aFont.SetFamily( FAMILY_SWISS );
 break;
 case RTF_FMODERN:
-pFont->SetFamily( FAMILY_MODERN );
+aFont.SetFamily( FAMILY_MODERN );
 break;
 case RTF_FSCRIPT:
-pFont->SetFamily( FAMILY_SCRIPT );
+aFont.SetFamily( FAMILY_SCRIPT );
 break;
 case RTF_FDECOR:
-pFont->SetFamily( FAMILY_DECORATIVE );
+aFont.SetFamily( FAMILY_DECORATIVE );
 break;
 // for technical/symbolic font of the rtl_TextEncoding is changed!
 case RTF_FTECH:
-pFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
+aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
 [[fallthrough]];
 case RTF_FNIL:
-pFont->SetFamily( FAMILY_DONTKNOW );
+aFont.SetFamily( FAMILY_DONTKNOW );
 break;
 case RTF_FCHARSET:
 if (-1 != nTokenValue)
 {
 rtl_TextEncoding nrtl_TextEncoding = 
rtl_getTextEncodingFromWindowsCharset(
 static_cast(nTokenValue));
-pFont->SetCharSet(nrtl_TextEncoding);
+aFont.SetCharSet(nrtl_TextEncoding);
 //When we're in a font, the fontname is in the font
 //charset, except for symbol fonts I believe
 if (nrtl_TextEncoding == RTL_TEXTENCODING_SYMBOL)
@@ -525,10 +525,10 @@ void SvxRTFParser::ReadFontTable()
 switch( nTokenValue )
 {
 case 1:
-pFont->SetPitch( PITCH_FIXED );
+aFont.SetPitch( PITCH_FIXED );
 break;
 case 2:
-pFont->SetPitch( PITCH_VARIABLE );
+aFont.SetPitch( PITCH_VARIABLE );
 break;
 }
 break;
@@ -558,16 +558,14 @@ void SvxRTFParser::ReadFontTable()
 if (!sAltNm.isEmpty())
 sFntNm += ";" + sAltNm;
 
-pFont->SetFamilyName( sFntNm );
-m_FontTable.insert(std::make_pair(nInsFontNo, std::move(pFont)));
-pFont.reset(new vcl::Font);
-pFont->SetCharSet( nSystemChar );
+aFont.SetFamilyName( sFntNm );
+m_FontTable.insert(std::make_pair(nInsFontNo, aFont));
+aFont = vcl::Font();
+aFont.SetCharSet( nSystemChar );
 sAltNm.clear();
 sFntNm.clear();
 }
 }
-// the last one we have to delete manually
-pFont.reset();
 SkipToken();// the closing brace is evaluated "above"
 
 // set the default font in the Document
@@ -602,7 +600,7 @@ const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId )
 SvxRTFFontTbl::const_iterator it = m_FontTable.find( nId );
 if (it != m_FontTable.end())
 {
-return *it->second;
+return it->second;
 }
 const SvxFontItem& rDfltFont = static_cast(
 pAttrPool->GetDefaultItem( 

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

2021-05-26 Thread Gülşah Köse (via logerrit)
 editeng/source/items/textitem.cxx |   66 --
 include/editeng/colritem.hxx  |   24 -
 2 files changed, 78 insertions(+), 12 deletions(-)

New commits:
commit 350d40417fe2cb56e16116f12216d08b9f2705b0
Author: Gülşah Köse 
AuthorDate: Wed May 26 08:47:38 2021 +0300
Commit: Gülşah Köse 
CommitDate: Wed May 26 09:04:37 2021 +0200

Seperate SvxBackgroundColorItem from SvxColorItem

SvxBackgroundColorItem derivated from SfxPoolItem instead of
SvxColorItem.

Casting is common usage to control if object is this or not.
When we can cast SvxBackgroundColorItem to SvxColorItem we can not
seperate them anymore.

eg: Char color is a SvxColorItem and char background color is a
SvxBackgroundColorItem. They can be hold together and we should
understand they are different types.

Change-Id: I7b1879a1b00de26c0b8a2d9f8d658aa3aef75ecb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116135
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index ed4806159a04..d67bd02df5c1 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1313,26 +1313,32 @@ bool SvxContourItem::GetPresentation
 // class SvxBackgroundColorItem -
 
 SvxBackgroundColorItem::SvxBackgroundColorItem( const sal_uInt16 nId ) :
-SvxColorItem( nId )
+SfxPoolItem( nId ),
+mColor( COL_WHITE )
 {
 }
 
+SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol, const 
sal_uInt16 nId ) :
+SfxPoolItem( nId ),
+mColor( rCol )
+{
+}
 
-SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol,
-const sal_uInt16 nId ) :
-SvxColorItem( rCol, nId )
+SvxBackgroundColorItem::~SvxBackgroundColorItem()
 {
 }
 
-SvxBackgroundColorItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const
+bool SvxBackgroundColorItem::operator==( const SfxPoolItem& rAttr ) const
 {
-return new SvxBackgroundColorItem(*this);
+assert(SfxPoolItem::operator==(rAttr));
+
+return  mColor == static_cast( rAttr 
).mColor;
 }
 
 bool SvxBackgroundColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) 
const
 {
 nMemberId &= ~CONVERT_TWIPS;
-Color aColor = SvxColorItem::GetValue();
+Color aColor = SvxBackgroundColorItem::GetValue();
 
 switch( nMemberId )
 {
@@ -1354,27 +1360,67 @@ bool SvxBackgroundColorItem::PutValue( const uno::Any& 
rVal, sal_uInt8 nMemberId
 {
 nMemberId &= ~CONVERT_TWIPS;
 Color nColor;
-Color aColor = SvxColorItem::GetValue();
+Color aColor = SvxBackgroundColorItem::GetValue();
 
 switch( nMemberId )
 {
 case MID_GRAPHIC_TRANSPARENT:
 {
 aColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 );
-SvxColorItem::SetValue( aColor );
+SvxBackgroundColorItem::SetValue( aColor );
 break;
 }
 default:
 {
 if(!(rVal >>= nColor))
 return false;
-SvxColorItem::SetValue( nColor );
+SvxBackgroundColorItem::SetValue( nColor );
 break;
 }
 }
 return true;
 }
 
+SvxBackgroundColorItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const
+{
+return new SvxBackgroundColorItem(*this);
+}
+
+
+bool SvxBackgroundColorItem::GetPresentation
+(
+SfxItemPresentation /*ePres*/,
+MapUnit /*eCoreUnit*/,
+MapUnit /*ePresUnit*/,
+OUString&   rText, const IntlWrapper& /*rIntl*/
+)   const
+{
+rText = ::GetColorString( mColor );
+return true;
+}
+
+void SvxBackgroundColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+(void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("SvxBackgroundColorItem"));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), 
BAD_CAST(OString::number(Which()).getStr()));
+
+std::stringstream ss;
+ss << mColor;
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), 
BAD_CAST(ss.str().c_str()));
+
+OUString aStr;
+IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
+GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, 
MapUnit::Map100thMM, aStr, aIntlWrapper);
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), 
BAD_CAST(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr()));
+(void)xmlTextWriterEndElement(pWriter);
+}
+
+void SvxBackgroundColorItem::SetValue( const Color& rNewCol )
+{
+mColor = rNewCol;
+}
+
+
 // class SvxColorItem 
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 SfxPoolItem( nId ),
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index 1eab79723577..8e081fc6aab1 100644
--- a/include/editeng/colritem.hxx
+++ 

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

2021-05-19 Thread Caolán McNamara (via logerrit)
 editeng/source/accessibility/AccessibleStringWrap.cxx |2 
 editeng/source/editeng/impedit2.cxx   |2 
 editeng/source/editeng/impedit3.cxx   |   40 +++
 editeng/source/items/svxfont.cxx  |   46 --
 include/editeng/svxfont.hxx   |8 +--
 svx/source/dialog/fntctrl.cxx |6 +-
 svx/source/styles/CommonStylePreviewRenderer.cxx  |2 
 sw/source/ui/chrdlg/drpcps.cxx|2 
 8 files changed, 52 insertions(+), 56 deletions(-)

New commits:
commit 5d8ac801c00fbf1dc16ee8dbfe8167baf7ea0ce0
Author: Caolán McNamara 
AuthorDate: Tue May 18 17:05:14 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 19 15:03:36 2021 +0200

SetPhysFont always dereferences its OutputDevice* arg

which is also the case for
ChgPhysFont and GetTextSize

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

diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx 
b/editeng/source/accessibility/AccessibleStringWrap.cxx
index de11c4a0732c..77149d1df70d 100644
--- a/editeng/source/accessibility/AccessibleStringWrap.cxx
+++ b/editeng/source/accessibility/AccessibleStringWrap.cxx
@@ -43,7 +43,7 @@ void AccessibleStringWrap::GetCharacterBounds( sal_Int32 
nIndex, tools::Rectangl
 DBG_ASSERT(nIndex >= 0,
"SvxAccessibleStringWrap::GetCharacterBounds: index value 
overflow");
 
-mrFont.SetPhysFont(  );
+mrFont.SetPhysFont(mrDev);
 
 // #108900# Handle virtual position one-past-the end of the string
 if( nIndex >= maText.getLength() )
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index dbf4017542cb..76285d237fd8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3186,7 +3186,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* 
pPortion, EditLine* pLine,
 {
 SvxFont aTmpFont( 
pPortion->GetNode()->GetCharAttribs().GetDefFont() );
 SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
-aTmpFont.SetPhysFont( GetRefDevice() );
+aTmpFont.SetPhysFont(*GetRefDevice());
 ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage());
 nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), 
pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen() ).Width();
 }
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 907b7493d403..454f65286416 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -829,7 +829,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if ( !bSameLineAgain )
 {
 SeekCursor( pNode, nTmpPos+1, aTmpFont );
-aTmpFont.SetPhysFont( GetRefDevice() );
+aTmpFont.SetPhysFont(*GetRefDevice());
 ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage());
 
 if ( IsFixedCellHeight() )
@@ -1042,7 +1042,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 case EE_FEATURE_FIELD:
 {
 SeekCursor( pNode, nTmpPos+1, aTmpFont );
-aTmpFont.SetPhysFont( GetRefDevice() );
+aTmpFont.SetPhysFont(*GetRefDevice());
 ImplInitDigitMode(*GetRefDevice(), 
aTmpFont.GetLanguage());
 
 OUString aFieldValue = static_cast(pNextFeature)->GetFieldValue();
@@ -1145,7 +1145,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 {
 DBG_ASSERT( nPortionLen || bProcessingEmptyLine, "Empty 
Portion - Extra Space?!" );
 SeekCursor( pNode, nTmpPos+1, aTmpFont );
-aTmpFont.SetPhysFont( GetRefDevice() );
+aTmpFont.SetPhysFont(*GetRefDevice());
 ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage());
 
 if (!bContinueLastPortion)
@@ -1371,7 +1371,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if ( aTextSize.Height() == 0 )
 {
 SeekCursor( pNode, pLine->GetStart()+1, aTmpFont );
-aTmpFont.SetPhysFont( pRefDev );
+aTmpFont.SetPhysFont(*pRefDev);
 ImplInitDigitMode(*pRefDev, aTmpFont.GetLanguage());
 
 if ( IsFixedCellHeight() )
@@ -1393,7 +1393,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if ( rTP.GetKind() != PortionKind::LINEBREAK )
 {
 SeekCursor( pNode, nTPos+1, 

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

2021-05-02 Thread Noel Grandin (via logerrit)
 editeng/source/items/textitem.cxx   |2 +-
 include/editeng/fhgtitem.hxx|3 +--
 sc/source/filter/excel/fontbuff.cxx |2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 9c930c4f3109d123c0831d0fcecf9c8b32e5bbc7
Author: Noel Grandin 
AuthorDate: Sun May 2 18:52:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun May 2 21:26:09 2021 +0200

sal_uLong->sal_uInt32 in SvxFontHeightItem

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

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 776d1210450c..051c1418d4fc 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -558,7 +558,7 @@ void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 
 // class SvxFontHeightItem ---
 
-SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
+SvxFontHeightItem::SvxFontHeightItem( const sal_uInt32 nSz,
   const sal_uInt16 nPrp,
   const sal_uInt16 nId ) :
 SfxPoolItem( nId )
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
index f5b8ac3f9672..efaad86bdfa8 100644
--- a/include/editeng/fhgtitem.hxx
+++ b/include/editeng/fhgtitem.hxx
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 // class SvxFontHeightItem ---
@@ -49,7 +48,7 @@ private:
 public:
 static SfxPoolItem* CreateDefault();
 
-SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 
nPropHeight /*= 100*/,
+SvxFontHeightItem( const sal_uInt32 nSz /*= 240*/, const sal_uInt16 
nPropHeight /*= 100*/,
const sal_uInt16 nId  );
 
 // "pure virtual Methods" from SfxPoolItem
diff --git a/sc/source/filter/excel/fontbuff.cxx 
b/sc/source/filter/excel/fontbuff.cxx
index bb25f6409b43..5f5a0f099ae6 100644
--- a/sc/source/filter/excel/fontbuff.cxx
+++ b/sc/source/filter/excel/fontbuff.cxx
@@ -84,7 +84,7 @@ void LotusFontBuffer::SetHeight( const sal_uInt16 nIndex, 
const sal_uInt16 nHeig
 {
 OSL_ENSURE( nIndex < nSize, "*LotusFontBuffer::SetHeight(): Array too 
small!" );
 if( nIndex < nSize )
-pData[ nIndex ].Height( std::make_unique( 
static_cast(nHeight) * 20, 100, ATTR_FONT_HEIGHT ) );
+pData[ nIndex ].Height( std::make_unique( 
static_cast(nHeight) * 20, 100, ATTR_FONT_HEIGHT ) );
 }
 
 void LotusFontBuffer::SetType( const sal_uInt16 nIndex, const sal_uInt16 nType 
)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-02 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx |7 ++-
 editeng/source/outliner/outlvw.cxx  |2 +-
 include/editeng/editview.hxx|2 +-
 include/editeng/outliner.hxx|2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit f4c8a7d47398f353f26828d049aec29e5738750d
Author: Caolán McNamara 
AuthorDate: Sat May 1 20:47:09 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 2 21:10:35 2021 +0200

finally 'Change return value to Rectangle in next incompatible build'

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 5184a5cedc6f..08223368ea20 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -389,12 +389,9 @@ void EditView::SetVisArea( const tools::Rectangle& rRect )
 pImpEditView->SetVisDocStartPos( rRect.TopLeft() );
 }
 
-const tools::Rectangle& EditView::GetVisArea() const
+tools::Rectangle EditView::GetVisArea() const
 {
-// Change return value to Rectangle in next incompatible build !!!
-static tools::Rectangle aRect;
-aRect = pImpEditView->GetVisDocArea();
-return aRect;
+return pImpEditView->GetVisDocArea();
 }
 
 void EditView::SetOutputArea( const tools::Rectangle& rRect )
diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index 6423094e793b..da1b2f6d51ec 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -571,7 +571,7 @@ void OutlinerView::AdjustHeight( tools::Long nDY )
 pEditView->MoveParagraphs( nDY );
 }
 
-tools::Rectangle const & OutlinerView::GetVisArea() const
+tools::Rectangle OutlinerView::GetVisArea() const
 {
 return pEditView->GetVisArea();
 }
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 41cf529a81a2..cbc65bf93e1c 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -218,7 +218,7 @@ public:
 // Document position.
 // A size change also affects the VisArea
 voidSetVisArea( const tools::Rectangle& rRect );
-const tools::Rectangle&GetVisArea() const;
+tools::RectangleGetVisArea() const;
 
 PointerStyleGetPointer() const;
 
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 86cca91d9db9..411ab2d891cb 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -231,7 +231,7 @@ public:
 voidSetOutputArea( const tools::Rectangle& rRect );
 tools::Rectangle const & GetOutputArea() const;
 
-tools::Rectangle const & GetVisArea() const;
+tools::Rectangle GetVisArea() const;
 
 voidCreateSelectionList (std::vector ) ;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-02 Thread Noel Grandin (via logerrit)
 editeng/source/items/numitem.cxx |2 +-
 include/editeng/numitem.hxx  |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 85af593eac9d40cc715f87a94d390e9e8f48b880
Author: Noel Grandin 
AuthorDate: Sun May 2 18:49:44 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun May 2 20:51:05 2021 +0200

sal_uLong->sal_Int32 in SvxNumberFormat

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 0c48262f323f..66e7824d278a 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -514,7 +514,7 @@ Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* 
pGraphic)
 return aRetSize;
 }
 
-OUString SvxNumberFormat::CreateRomanString( sal_uLong nNo, bool bUpper )
+OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, bool bUpper )
 {
 nNo %= 4000;// more can not be displayed
 //  i, ii, iii, iv, v, vi, vii, vii, viii, ix
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 992f07b08241..52ca43b256f7 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -20,7 +20,6 @@
 #define INCLUDED_EDITENG_NUMITEM_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -220,7 +219,7 @@ public:
 tools::Long GetIndentAt() const { return mnIndentAt;}
 
 static Size GetGraphicSizeMM100(const Graphic* pGraphic);
-static OUString CreateRomanString( sal_uLong nNo, bool bUpper );
+static OUString CreateRomanString( sal_Int32 nNo, bool bUpper );
 };
 
 //Feature-Flags (only sal_uInt16!)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-02 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unoedhlp.cxx |2 +-
 include/editeng/unoedhlp.hxx|3 +--
 include/vcl/textdata.hxx|7 +++
 vcl/source/edit/textdata.cxx|2 +-
 vcl/source/edit/textdoc.cxx |2 +-
 5 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit f52d165c887076d6f6ccf928c2be585cfc06058a
Author: Noel Grandin 
AuthorDate: Sun May 2 18:24:43 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun May 2 20:46:08 2021 +0200

sal_uLong->sal_Int32 in TextHint

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

diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 9b5b98fc6df2..2a1b1e2bd54f 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -33,7 +33,7 @@ SvxEditSourceHint::SvxEditSourceHint( SfxHintId _nId ) :
 {
 }
 
-SvxEditSourceHint::SvxEditSourceHint( SfxHintId _nId, sal_uLong nValue, 
sal_Int32 nStart, sal_Int32 nEnd ) :
+SvxEditSourceHint::SvxEditSourceHint( SfxHintId _nId, sal_Int32 nValue, 
sal_Int32 nStart, sal_Int32 nEnd ) :
 TextHint( _nId, nValue ),
 mnStart( nStart),
 mnEnd( nEnd )
diff --git a/include/editeng/unoedhlp.hxx b/include/editeng/unoedhlp.hxx
index 24a9105453da..5b70de35ca55 100644
--- a/include/editeng/unoedhlp.hxx
+++ b/include/editeng/unoedhlp.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_EDITENG_UNOEDHLP_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -43,7 +42,7 @@ private:
 
 public:
 SvxEditSourceHint( SfxHintId nId );
-SvxEditSourceHint( SfxHintId nId, sal_uLong nValue, sal_Int32 
nStart, sal_Int32 nEnd );
+SvxEditSourceHint( SfxHintId nId, sal_Int32 nValue, sal_Int32 
nStart, sal_Int32 nEnd );
 
 using TextHint::GetValue;
 sal_Int32   GetStartValue() const { return mnStart;}
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index 2e595fb8995e..907a6fdd8852 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_TEXTDATA_HXX
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -115,13 +114,13 @@ inline bool TextSelection::operator != ( const 
TextSelection& rSel ) const
 class VCL_DLLPUBLIC TextHint : public SfxHint
 {
 private:
-sal_uLong   mnValue;
+sal_Int32   mnValue;
 
 public:
 TextHint( SfxHintId nId );
-TextHint( SfxHintId nId, sal_uLong nValue );
+TextHint( SfxHintId nId, sal_Int32 nValue );
 
-sal_uLong   GetValue() const{ return mnValue; }
+sal_Int32   GetValue() const{ return mnValue; }
 };
 
 struct TEIMEInfos
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 79ddb8442d09..5c00cd5ebf0f 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -312,7 +312,7 @@ TextHint::TextHint( SfxHintId Id ) : SfxHint( Id ), 
mnValue(0)
 {
 }
 
-TextHint::TextHint( SfxHintId Id, sal_uLong nValue ) : SfxHint( Id ), 
mnValue(nValue)
+TextHint::TextHint( SfxHintId Id, sal_Int32 nValue ) : SfxHint( Id ), 
mnValue(nValue)
 {
 }
 
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index cba52bc5d22d..2be8c372c273 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -504,7 +504,7 @@ TextPaM TextDoc::ConnectParagraphs( TextNode* pLeft, const 
TextNode* pRight )
 maTextNodes.erase( std::find_if( maTextNodes.begin(), maTextNodes.end(),
  [&] (std::unique_ptr const & p) 
{ return p.get() == pRight; } ) );
 
-sal_uLong nLeft = ::std::find_if( maTextNodes.begin(), maTextNodes.end(),
+sal_Int32 nLeft = ::std::find_if( maTextNodes.begin(), maTextNodes.end(),
   [&] (std::unique_ptr const & 
p) { return p.get() == pLeft; } )
 - maTextNodes.begin();
 TextPaM aPaM( nLeft, nPrevLen );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-02 Thread Noel Grandin (via logerrit)
 editeng/source/outliner/outlin2.cxx |2 +-
 include/editeng/outliner.hxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5c5aaf2b0907006334942fa178a8a254ac2f789c
Author: Noel Grandin 
AuthorDate: Sun May 2 12:41:05 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun May 2 17:59:44 2021 +0200

sal_uLong->sal_uInt32 in Outliner

to match the underlying call to EditEngine.

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

diff --git a/editeng/source/outliner/outlin2.cxx 
b/editeng/source/outliner/outlin2.cxx
index df2e50389d3f..b00878c874a0 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -98,7 +98,7 @@ bool Outliner::IsModified() const
 return pEditEngine->IsModified();
 }
 
-sal_uLong Outliner::GetTextHeight() const
+sal_uInt32 Outliner::GetTextHeight() const
 {
 return pEditEngine->GetTextHeight();
 }
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 08ebce36e2da..86cca91d9db9 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -907,7 +907,7 @@ public:
 voidSetRefDevice( OutputDevice* pRefDev );
 OutputDevice*   GetRefDevice() const;
 
-sal_uLong   GetTextHeight() const;
+sal_uInt32  GetTextHeight() const;
 tools::Rectangle GetParaBounds( sal_Int32 nParagraph ) const;
 Point   GetDocPos( const Point& rPaperPos ) const;
 boolIsTextPos( const Point& rPaperPos, sal_uInt16 nBorder );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: editeng/source include/editeng include/svl include/svx linguistic/source reportdesign/source sc/inc sc/source sd/inc sd/source sfx2/source svl/source svx/source sw/inc

2021-04-15 Thread Noel Grandin (via logerrit)
 editeng/source/uno/unofield.cxx|4 
 editeng/source/uno/unoipset.cxx|   14 +--
 editeng/source/uno/unotext.cxx |   34 +++
 include/editeng/unoipset.hxx   |   14 +--
 include/editeng/unotext.hxx|   16 +--
 include/svl/itemprop.hxx   |   38 +---
 include/svx/unoshape.hxx   |   64 +++---
 linguistic/source/lngopt.cxx   |   14 +--
 reportdesign/source/ui/misc/UITools.cxx|   22 ++--
 sc/inc/cellsuno.hxx|   27 +++---
 sc/inc/styleuno.hxx|5 -
 sc/source/ui/unoobj/afmtuno.cxx|4 
 sc/source/ui/unoobj/cellsuno.cxx   |   60 ++---
 sc/source/ui/unoobj/condformatuno.cxx  |   24 ++---
 sc/source/ui/unoobj/defltuno.cxx   |   10 +-
 sc/source/ui/unoobj/optuno.cxx |4 
 sc/source/ui/unoobj/styleuno.cxx   |   24 ++---
 sc/source/ui/unoobj/textuno.cxx|4 
 sc/source/ui/view/viewfunc.cxx |8 -
 sd/inc/stlsheet.hxx|3 
 sd/source/core/stlsheet.cxx|   12 +-
 sd/source/ui/inc/unokywds.hxx  |   29 +++---
 sd/source/ui/slideshow/slideshow.cxx   |4 
 sd/source/ui/unoidl/unolayer.cxx   |4 
 sd/source/ui/unoidl/unomodel.cxx   |4 
 sd/source/ui/unoidl/unoobj.cxx |4 
 sd/source/ui/unoidl/unopage.cxx|   15 +--
 sd/source/ui/unoidl/unopback.cxx   |   32 +++
 sd/source/ui/unoidl/unopback.hxx   |4 
 sd/source/ui/unoidl/unosrch.cxx|4 
 sfx2/source/doc/iframe.cxx |4 
 svl/source/items/itemprop.cxx  |  112 
 svx/source/inc/cell.hxx|2 
 svx/source/table/cell.cxx  |   12 +-
 svx/source/unodraw/shapeimpl.hxx   |   16 +--
 svx/source/unodraw/tableshape.cxx  |4 
 svx/source/unodraw/unoshap2.cxx|   10 +-
 svx/source/unodraw/unoshap3.cxx|   24 ++---
 svx/source/unodraw/unoshap4.cxx|   20 ++--
 svx/source/unodraw/unoshape.cxx|   48 +-
 sw/inc/unocrsrhelper.hxx   |7 -
 sw/source/core/access/accpara.cxx  |   18 ++--
 sw/source/core/inc/unoport.hxx |2 
 sw/source/core/unocore/SwXTextDefaults.cxx |   10 +-
 sw/source/core/unocore/unocrsrhelper.cxx   |   18 ++--
 sw/source/core/unocore/unodraw.cxx |   10 +-
 sw/source/core/unocore/unofield.cxx|6 -
 sw/source/core/unocore/unoframe.cxx|   10 +-
 sw/source/core/unocore/unoidx.cxx  |8 -
 sw/source/core/unocore/unomap.cxx  |2 
 sw/source/core/unocore/unoobj.cxx  |   22 ++--
 sw/source/core/unocore/unoparagraph.cxx|   24 ++---
 sw/source/core/unocore/unoport.cxx |   10 +-
 sw/source/core/unocore/unosect.cxx |   10 +-
 sw/source/core/unocore/unosett.cxx |   16 +--
 sw/source/core/unocore/unosrch.cxx |6 -
 sw/source/core/unocore/unostyle.cxx|  130 ++---
 sw/source/core/unocore/unotbl.cxx  |   16 +--
 sw/source/core/unocore/unotext.cxx |2 
 sw/source/uibase/uno/unoatxt.cxx   |4 
 sw/source/uibase/uno/unomailmerge.cxx  |8 -
 sw/source/uibase/uno/unotxdoc.cxx  |   10 +-
 sw/source/uibase/uno/unotxvw.cxx   |4 
 vcl/source/uitest/uno/uiobject_uno.cxx |1 
 vcl/source/uitest/uno/uitest_uno.cxx   |1 
 65 files changed, 582 insertions(+), 530 deletions(-)

New commits:
commit 6c934d0feb6a391fda0939e8db5d12aafeb93cc6
Author: Noel Grandin 
AuthorDate: Mon Apr 12 09:21:42 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 15 15:53:25 2021 +0200

store ptr to the original entries in SfxItemPropertyMap

instead of copying them to a new data structure that
is practically identical.
Helps startup time since we build a ton of these when
loading documents.

And use o3tl::sorted_vector as a dense map data
structure to reduce allocations and improve cache
friendliness, since this is a build-once thing.

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

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index da56f0fcac7b..389856b4a5ef 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -705,7 +705,7 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const 
OUString& aPropertyName,
 return;
 }
 
-const SfxItemPropertySimpleEntry* pMap = 
mpPropSet->getPropertyMap().getByName( aPropertyName );
+const SfxItemPropertyMapEntry* pMap = 
mpPropSet->getPropertyMap().getByName( aPropertyName );
 if ( !pMap )
 throw 

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

2021-04-06 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx  |   44 ++-
 editeng/source/outliner/outlvw.cxx   |4 +-
 include/editeng/editview.hxx |2 -
 include/editeng/outliner.hxx |2 -
 sc/source/ui/view/gridwin.cxx|2 -
 sd/source/ui/view/drviews4.cxx   |2 -
 sd/source/ui/view/outlnvsh.cxx   |2 -
 sw/source/uibase/docvw/SidebarTxtControl.cxx |2 -
 sw/source/uibase/uiview/viewdraw.cxx |2 -
 9 files changed, 20 insertions(+), 42 deletions(-)

New commits:
commit 84a4da19ae0f5e092a0deb7007a34d2ee78d5da7
Author: Caolán McNamara 
AuthorDate: Tue Apr 6 14:45:46 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 6 21:28:03 2021 +0200

ExecuteSpellPopup never called with a null spelling callback

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 5f3fb49e7a08..7cc5e123db35 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -958,7 +958,7 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, 
LanguageType nGuessLa
 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
aStream.str().c_str());
 }
 
-void EditView::ExecuteSpellPopup( const Point& rPosPixel, 
Link const * pCallBack )
+void EditView::ExecuteSpellPopup(const Point& rPosPixel, const 
Link )
 {
 OutputDevice& rDevice = pImpEditView->GetOutputDevice();
 Point aPos(rDevice.PixelToLogic(rPosPixel));
@@ -1165,11 +1165,8 @@ void EditView::ExecuteSpellPopup( const Point& 
rPosPixel, LinkSpellIgnoreWord();
-if ( pCallBack )
-{
-SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
-pCallBack->Call( aInf );
-}
+SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
+rCallBack.Call(aInf);
 SetSelection( aOldSel );
 }
 else if (sId == "wordlanguage" || sId == "paralanguage")
@@ -1194,35 +1191,19 @@ void EditView::ExecuteSpellPopup( const Point& 
rPosPixel, LinkpEditEngine->pImpEditEngine->StartOnlineSpellTimer();
 
-if ( pCallBack )
-{
-SpellCallbackInfo aInf( (sId == "wordlanguage") ? 
SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE );
-pCallBack->Call( aInf );
-}
+SpellCallbackInfo aInf((sId == "wordlanguage") ? 
SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE);
+rCallBack.Call(aInf);
 SetSelection( aOldSel );
 }
 else if (sId == "check")
 {
-if ( !pCallBack )
-{
-// Set Cursor before word...
-EditPaM aCursor = pImpEditView->GetEditSelection().Min();
-pImpEditView->DrawSelectionXOR();
-pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) 
);
-pImpEditView->DrawSelectionXOR();
-// Crashes when no SfxApp
-pImpEditView->pEditEngine->pImpEditEngine->Spell( this, false );
-}
-else
-{
-SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, 
OUString() );
-pCallBack->Call( aInf );
-}
+SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, 
OUString() );
+rCallBack.Call(aInf);
 }
-else if (sId == "autocorrectdlg" && pCallBack)
+else if (sId == "autocorrectdlg")
 {
 SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, 
OUString() );
-pCallBack->Call( aInf );
+rCallBack.Call(aInf);
 }
 else if ( sId.toInt32() >= MN_DICTSTART || sId == "add")
 {
@@ -1249,11 +1230,8 @@ void EditView::ExecuteSpellPopup( const Point& 
rPosPixel, LinkGetWrongList()->ResetInvalidRange(0, 
aPaM.GetNode()->Len());
 pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
 
-if ( pCallBack )
-{
-SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, 
aSelected );
-pCallBack->Call( aInf );
-}
+SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, 
aSelected );
+rCallBack.Call(aInf);
 SetSelection( aOldSel );
 }
 else if ( sId.toInt32() >= MN_AUTOSTART )
diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index f74689f91ded..7201bf840f24 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1346,9 +1346,9 @@ bool OutlinerView::IsWrongSpelledWordAtPos( const Point& 
rPosPixel )
 return pEditView->IsWrongSpelledWordAtPos( rPosPixel, 
/*bMarkIfWrong*/false );
 }
 
-void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, 
Link const * pStartDlg )
+void 

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

2021-03-26 Thread Tibor Nagy (via logerrit)
 editeng/source/items/svxfont.cxx   |   74 +++--
 include/editeng/svxfont.hxx|7 ++-
 sc/inc/fillinfo.hxx|4 -
 sc/qa/unit/data/xlsx/tdf119292.xlsx|binary
 sc/qa/unit/subsequent_filters-test.cxx |   41 --
 sc/source/ui/inc/output.hxx|7 +--
 sc/source/ui/view/output.cxx   |   44 +++
 sc/source/ui/view/output2.cxx  |   64 
 8 files changed, 171 insertions(+), 70 deletions(-)

New commits:
commit 967e0cc303c7be4a88905b327b9d02ba12f5e375
Author: Tibor Nagy 
AuthorDate: Thu Mar 4 14:30:21 2021 +0100
Commit: László Németh 
CommitDate: Fri Mar 26 14:41:03 2021 +0100

tdf#119292 sc layout: fix overlapping wrapped cell texts

if rotated by 90 or 270 degrees using clipping to
cell boundaries, like MSO does. E.g. this avoid of
importing MSO documents with unreadable header cells.

Note: it's possible to improve the patch extending
clipping for the neighboring empty area instead of
clipping all text exceeding the cell boundary
(as in the case of the non-rotated, non-wrapped text).

Co-authored-by: Attila Szűcs (NISZ)

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

diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index f5d0e2d79a26..61039b316ac6 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -86,32 +86,62 @@ void SvxFont::SetNonAutoEscapement(short nNewEsc, const 
OutputDevice* pOutDev)
 nEsc = -MAX_ESC_POS;
 }
 
-void SvxFont::DrawArrow( OutputDevice , const tools::Rectangle& rRect,
-const Size& rSize, const Color& rCol, bool bLeft )
+tools::Polygon SvxFont::DrawArrow( OutputDevice , const tools::Rectangle& 
rRect,
+const Size& rSize, const Color& rCol, bool bLeftOrTop, bool bVertical )
 {
-tools::Long nLeft = ( rRect.Left() + rRect.Right() - rSize.Width() )/ 2;
-tools::Long nRight = nLeft + rSize.Width();
-tools::Long nMid = ( rRect.Top() + rRect.Bottom() ) / 2;
-tools::Long nTop = nMid - rSize.Height() / 2;
-tools::Long nBottom = nTop + rSize.Height();
-if( nLeft < rRect.Left() )
+tools::Polygon aPoly;
+Point aTmp;
+Point aNxt;
+if (bVertical)
 {
-nLeft = rRect.Left();
-nRight = rRect.Right();
+tools::Long nLeft = ((rRect.Left() + rRect.Right()) / 2) - 
(rSize.Height() / 2);
+tools::Long nRight = ((rRect.Left() + rRect.Right()) / 2) + 
(rSize.Height() / 2);
+tools::Long nMid = (rRect.Left() + rRect.Right()) / 2;
+tools::Long nTop = ((rRect.Top() + rRect.Bottom()) / 2) - 
(rSize.Height() / 2);
+tools::Long nBottom = nTop + rSize.Height();
+if (nTop < rRect.Top())
+{
+if (bLeftOrTop)
+{
+nTop = rRect.Top();
+nBottom = rRect.Bottom();
+}
+else
+{
+nTop = rRect.Bottom();
+nBottom = rRect.Bottom() - (rSize.Height() / 2);
+}
+}
+aTmp.setX(nRight);
+aTmp.setY(nBottom);
+aNxt.setX(nMid);
+aNxt.setY(nTop);
+aPoly.Insert(0, aTmp);
+aPoly.Insert(0, aNxt);
+aTmp.setX(nLeft);
+aPoly.Insert(0, aTmp);
 }
-if( nTop < rRect.Top() )
+else
 {
-nTop = rRect.Top();
-nBottom = rRect.Bottom();
+tools::Long nLeft = (rRect.Left() + rRect.Right() - rSize.Width()) / 2;
+tools::Long nRight = nLeft + rSize.Width();
+tools::Long nMid = (rRect.Top() + rRect.Bottom()) / 2;
+tools::Long nTop = nMid - rSize.Height() / 2;
+tools::Long nBottom = nTop + rSize.Height();
+if (nLeft < rRect.Left())
+{
+nLeft = rRect.Left();
+nRight = rRect.Right();
+}
+aTmp.setX(bLeftOrTop ? nLeft : nRight);
+aTmp.setY(nMid);
+aNxt.setX(bLeftOrTop ? nRight : nLeft);
+aNxt.setY(nTop);
+aPoly.Insert(0, aTmp);
+aPoly.Insert(0, aNxt);
+aNxt.setY(nBottom);
+aPoly.Insert(0, aNxt);
 }
-tools::Polygon aPoly;
-Point aTmp( bLeft ? nLeft : nRight, nMid );
-Point aNxt( bLeft ? nRight : nLeft, nTop );
-aPoly.Insert( 0, aTmp );
-aPoly.Insert( 0, aNxt );
-aNxt.setY( nBottom );
-aPoly.Insert( 0, aNxt );
-aPoly.Insert( 0, aTmp );
 Color aOldLineColor = rOut.GetLineColor();
 Color aOldFillColor = rOut.GetFillColor();
 rOut.SetFillColor( rCol );
@@ -120,9 +150,9 @@ void SvxFont::DrawArrow( OutputDevice , const 
tools::Rectangle& rRect,
 rOut.DrawLine( aTmp, aNxt );
 rOut.SetLineColor( aOldLineColor );
 rOut.SetFillColor( aOldFillColor );
+return aPoly;
 }
 
-
 OUString 

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

2021-03-21 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editobj.cxx  |5 +
 editeng/source/editeng/impedit5.cxx |5 +
 editeng/source/uno/unoedhlp.cxx |8 ++--
 include/editeng/editdata.hxx|6 ++
 4 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit eb8b769f8e5ee6383e04e08cfde4aa345a24e4c1
Author: Caolán McNamara 
AuthorDate: Sun Mar 21 14:50:21 2021 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 21 20:46:06 2021 +0100

cid#1473926 Uninitialized scalar variable

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

diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index af80e2845bd6..2cb69858510b 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -715,10 +715,7 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, 
std::vector&
 for (const auto & i : rAttrs)
 {
 const EditCharAttrib& rAttr = *i;
-EECharAttrib aEEAttr;
-aEEAttr.pAttr = rAttr.GetItem();
-aEEAttr.nStart = rAttr.GetStart();
-aEEAttr.nEnd = rAttr.GetEnd();
+EECharAttrib aEEAttr(rAttr.GetStart(), rAttr.GetEnd(), 
rAttr.GetItem());
 rLst.push_back(aEEAttr);
 }
 }
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 19e14fcfc50a..9b5b98fc6df2 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -100,9 +100,7 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& 
nStartIndex, sal_Int32& nE
 {
 if (nIndex2 < aTempCharAttribs[nAttr].nStart)
 {
-EECharAttrib aEEAttr;
-aEEAttr.nStart = nIndex2;
-aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart;
+EECharAttrib aEEAttr(nIndex2, aTempCharAttribs[nAttr].nStart);
 aCharAttribs.insert(aCharAttribs.begin() + nAttr, aEEAttr);
 }
 nIndex2 = aTempCharAttribs[nAttr].nEnd;
@@ -110,9 +108,7 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& 
nStartIndex, sal_Int32& nE
 }
 if ( nIndex2 != nParaLen )
 {
-EECharAttrib aEEAttr;
-aEEAttr.nStart = nIndex2;
-aEEAttr.nEnd = nParaLen;
+EECharAttrib aEEAttr(nIndex2, nParaLen);
 aCharAttribs.push_back(aEEAttr);
 }
 }
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index 40c74cb2b8c6..5ed618fc7b80 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -274,6 +274,12 @@ struct EECharAttrib
 
 sal_Int32   nStart;
 sal_Int32   nEnd;
+EECharAttrib(sal_Int32 nSt, sal_Int32 nE, const SfxPoolItem* pA = nullptr)
+: pAttr(pA)
+, nStart(nSt)
+, nEnd(nE)
+{
+}
 };
 
 struct MoveParagraphsInfo
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-02-24 Thread Pranam Lashkari (via logerrit)
 editeng/source/editeng/editview.cxx |9 ++---
 include/editeng/editview.hxx|2 +-
 sc/source/ui/app/inputhdl.cxx   |7 +--
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 01f86c59531b29cd06dd53a7a6e4556fb97cbb24
Author: Pranam Lashkari 
AuthorDate: Wed Feb 24 00:59:17 2021 +0530
Commit: Pranam Lashkari 
CommitDate: Wed Feb 24 15:36:53 2021 +0100

avoid LOK text selection update when reference cell is in different tab

Change-Id: I511b9c5a27f97b6e14e9a844179c27a96997abe1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111315
Tested-by: Jenkins
Reviewed-by: Pranam Lashkari 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 7f0a0bb7a809..5ae9c1770e64 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -415,11 +415,13 @@ vcl::Cursor* EditView::GetCursor() const
 return pImpEditView->pCursor.get();
 }
 
-void EditView::InsertText( const OUString& rStr, bool bSelect )
+void EditView::InsertText( const OUString& rStr, bool bSelect, bool 
bLOKShowSelect )
 {
 
 EditEngine* pEE = pImpEditView->pEditEngine;
-pImpEditView->DrawSelectionXOR();
+
+if (bLOKShowSelect)
+pImpEditView->DrawSelectionXOR();
 
 EditPaM aPaM1;
 if ( bSelect )
@@ -441,7 +443,8 @@ void EditView::InsertText( const OUString& rStr, bool 
bSelect )
 else
 pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) );
 
-pEE->FormatAndUpdate( this );
+if (bLOKShowSelect)
+pEE->FormatAndUpdate( this );
 }
 
 bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * 
pFrameWin )
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 05e59a4753fd..3876a9a75d05 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -222,7 +222,7 @@ public:
 
 vcl::Cursor*GetCursor() const;
 
-voidInsertText( const OUString& rNew, bool bSelect = false );
+voidInsertText( const OUString& rNew, bool bSelect = false , 
bool bLOKShowSelect = true);
 voidInsertParaBreak();
 
 boolPostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const 
* pFrameWin = nullptr );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 7465205fa089..540d342728ac 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3473,13 +3473,16 @@ void ScInputHandler::SetReference( const ScRange& rRef, 
const ScDocument& rDoc )
 else
 aRefStr = rRef.Format(rDoc, ScRefFlags::VALID, aAddrDetails);
 }
+bool bLOKShowSelect = true;
+if(comphelper::LibreOfficeKit::isActive() && 
pRefViewSh->GetViewData().GetRefTabNo() != pRefViewSh->GetViewData().GetTabNo())
+bLOKShowSelect = false;
 
 if (pTableView || pTopView)
 {
 if (pTableView)
-pTableView->InsertText( aRefStr, true );
+pTableView->InsertText( aRefStr, true, bLOKShowSelect );
 if (pTopView)
-pTopView->InsertText( aRefStr, true );
+pTopView->InsertText( aRefStr, true, bLOKShowSelect );
 
 DataChanged();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-02-15 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx |   12 +++-
 include/editeng/editview.hxx|3 +++
 include/svx/svdedxv.hxx |1 +
 include/svx/weldeditview.hxx|2 ++
 include/vcl/customweld.hxx  |1 +
 include/vcl/weld.hxx|2 ++
 svx/source/dialog/weldeditview.cxx  |5 +
 svx/source/svdraw/svdedxv.cxx   |2 ++
 vcl/inc/salvtables.hxx  |2 ++
 vcl/source/app/salvtables.cxx   |5 +
 vcl/unx/gtk3/gtk3gtkinst.cxx|   11 +++
 11 files changed, 41 insertions(+), 5 deletions(-)

New commits:
commit 5c89695f3885ec2e7cd00eaf56a46a7f00c44883
Author: Caolán McNamara 
AuthorDate: Mon Feb 15 11:06:33 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 15 15:07:34 2021 +0100

tdf#140414 add getting mouse pos to EditViewCallbacks

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 1a3f17e61d34..4849b81b6898 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1322,11 +1322,13 @@ const SvxFieldItem* EditView::GetField( const Point& 
rPos, sal_Int32* pPara, sal
 
 const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, 
sal_Int32& nPos ) const
 {
-auto pWin = pImpEditView->GetWindow();
-if (!pWin)
-return nullptr;
-Point aPos = pWin->GetPointerPosPixel();
-aPos = pImpEditView->GetWindow()->PixelToLogic( aPos );
+Point aPos;
+if (EditViewCallbacks* pEditViewCallbacks = 
pImpEditView->getEditViewCallbacks())
+aPos = pEditViewCallbacks->EditViewPointerPosPixel();
+else
+aPos = pImpEditView->GetWindow()->GetPointerPosPixel();
+OutputDevice& rDevice = pImpEditView->GetOutputDevice();
+aPos = rDevice.PixelToLogic(aPos);
 return GetField( aPos, ,  );
 }
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 9fdb08ebc1d9..05e59a4753fd 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -114,6 +114,9 @@ public:
 return nullptr;
 }
 
+// return the Mouse Position
+virtual Point EditViewPointerPosPixel() const = 0;
+
 // Triggered to update InputEngine context information
 virtual void EditViewInputContext(const InputContext& rInputContext) = 0;
 
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 36763ea01656..2d50d1f3e6fa 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -68,6 +68,7 @@ class SVXCORE_DLLPUBLIC SdrObjEditView : public 
SdrGlueEditView, public EditView
 virtual void EditViewInvalidate(const tools::Rectangle& rRect) override;
 virtual void EditViewSelectionChange() override;
 virtual OutputDevice& EditViewOutputDevice() const override;
+virtual Point EditViewPointerPosPixel() const override;
 virtual css::uno::Reference 
GetDropTarget() override;
 virtual void EditViewInputContext(const InputContext& rInputContext) 
override;
 virtual void EditViewCursorRect(const tools::Rectangle& rRect, int 
nExtTextInputWidth) override;
diff --git a/include/svx/weldeditview.hxx b/include/svx/weldeditview.hxx
index 930573f97856..d3697ad3ffb0 100644
--- a/include/svx/weldeditview.hxx
+++ b/include/svx/weldeditview.hxx
@@ -78,6 +78,8 @@ protected:
 return GetDrawingArea()->get_ref_device();
 }
 
+virtual Point EditViewPointerPosPixel() const override;
+
 virtual void EditViewInputContext(const InputContext& rInputContext) 
override
 {
 SetInputContext(rInputContext);
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index b19b64bf980e..0bbfd46f4f94 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -90,6 +90,7 @@ public:
 }
 void CaptureMouse() { m_pDrawingArea->grab_add(); }
 bool IsMouseCaptured() const { return m_pDrawingArea->has_grab(); }
+Point GetPointerPosPixel() const { return 
m_pDrawingArea->get_pointer_position(); }
 void EnableRTL(bool bEnable) { m_pDrawingArea->set_direction(bEnable); }
 bool IsRTLEnabled() const { return m_pDrawingArea->get_direction(); }
 void ReleaseMouse() { m_pDrawingArea->grab_remove(); }
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 29f20ffef966..6f734be32b6d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2180,6 +2180,8 @@ public:
 
 virtual void set_cursor(PointerStyle ePointerStyle) = 0;
 
+virtual Point get_pointer_position() const = 0;
+
 virtual void set_input_context(const InputContext& rInputContext) = 0;
 virtual void im_context_set_cursor_location(const tools::Rectangle& 
rCursorRect,
 int nExtTextInputWidth)
diff --git a/svx/source/dialog/weldeditview.cxx 

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

2021-02-15 Thread Caolán McNamara (via logerrit)
 editeng/source/rtf/svxrtf.cxx |   48 +++---
 include/editeng/svxrtf.hxx|4 +--
 2 files changed, 15 insertions(+), 37 deletions(-)

New commits:
commit 08b82fa3ee915666ef8b60aeb670c38f64553630
Author: Caolán McNamara 
AuthorDate: Mon Feb 15 10:48:53 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 15 13:18:26 2021 +0100

Revert "ofz#29461 flatten SetAttrSet recursion"

Compress deletes nodes so the flat list becomes invalid

This reverts commit d1b3571fba171279d70ccaa0dfec1871f04439af.

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 7c1d885323e3..17ef94553ec5 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -848,42 +848,14 @@ void SvxRTFParser::SetAllAttrOfStk()// end all 
Attr. and set it into doc
 for (size_t n = m_AttrSetList.size(); n; )
 {
 auto const& pStkSet = m_AttrSetList[--n];
-
-/*
-   ofz#29461 SetAttrSet recursively calls SetAttrSet on pStkSet's
-   m_pChildList. The recurse depth can grow sufficiently to trigger
-   asan.
-
-   So breadth-first iterate through the nodes and make a flat vector of
-   them which can be iterated through linearly
-*/
-auto bfs = pStkSet->GetBreadthFirstList();
-for (auto it = bfs.begin(); it != bfs.end(); ++it)
-{
-SvxRTFItemStackType* pNode = *it;
-SetAttrSet(*pNode, false);
-}
-
-/*
-   ofz#13491 SvxRTFItemStackType dtor recursively calls the dtor of its
-   m_pChildList. The recurse depth can grow sufficiently to trigger
-   asan.
-
-   iterate through flat-view of those nodes in order of most distant
-   from root first and release them linearly
-*/
-for (auto it = bfs.rbegin(); it != bfs.rend(); ++it)
-{
-SvxRTFItemStackType* pNode = *it;
-pNode->m_pChildList.reset();
-}
-
+SetAttrSet( *pStkSet );
+pStkSet->DropChildList();
 m_AttrSetList.pop_back();
 }
 }
 
 // sets all the attributes that are different from the current
-void SvxRTFParser::SetAttrSet(SvxRTFItemStackType , bool bRecurse)
+void SvxRTFParser::SetAttrSet( SvxRTFItemStackType  )
 {
 // Was DefTab never read? then set to default
 if( !bIsSetDfltTab )
@@ -895,7 +867,7 @@ void SvxRTFParser::SetAttrSet(SvxRTFItemStackType , 
bool bRecurse)
 SetAttrInDoc( rSet );
 
 // then process all the children
-if (bRecurse && rSet.m_pChildList)
+if (rSet.m_pChildList)
 for (size_t n = 0; n < rSet.m_pChildList->size(); ++n)
 SetAttrSet( *(*rSet.m_pChildList)[ n ] );
 }
@@ -991,10 +963,12 @@ SvxRTFItemStackType::SvxRTFItemStackType(
distant from root first and release
their children linearly
 */
-std::vector SvxRTFItemStackType::GetBreadthFirstList()
+void SvxRTFItemStackType::DropChildList()
 {
-std::vector bfs;
+if (!m_pChildList || m_pChildList->empty())
+return;
 
+std::vector bfs;
 std::queue aQueue;
 aQueue.push(this);
 
@@ -1010,7 +984,11 @@ std::vector 
SvxRTFItemStackType::GetBreadthFirstList()
 }
 }
 
-return bfs;
+for (auto it = bfs.rbegin(); it != bfs.rend(); ++it)
+{
+SvxRTFItemStackType* pNode = *it;
+pNode->m_pChildList.reset();
+}
 }
 
 SvxRTFItemStackType::~SvxRTFItemStackType()
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index 70e996068459..faff107c1496 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -197,7 +197,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
 void ClearStyleAttr_( SvxRTFItemStackType& rStkType );
 
 // Sets all the attributes that are different from the current
-void SetAttrSet(SvxRTFItemStackType , bool bRecurse = true);
+void SetAttrSet( SvxRTFItemStackType  );
 void SetDefault( int nToken, int nValue );
 
 // Execute pard / plain
@@ -309,7 +309,7 @@ class SvxRTFItemStackType
 
 void Add(std::unique_ptr);
 void Compress( const SvxRTFParser& );
-std::vector GetBreadthFirstList();
+void DropChildList();
 
 public:
 SvxRTFItemStackType(const SvxRTFItemStackType&, const EditPosition&,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-02-13 Thread Caolán McNamara (via logerrit)
 editeng/source/rtf/svxrtf.cxx |   48 ++
 include/editeng/svxrtf.hxx|4 +--
 2 files changed, 37 insertions(+), 15 deletions(-)

New commits:
commit d1b3571fba171279d70ccaa0dfec1871f04439af
Author: Caolán McNamara 
AuthorDate: Fri Feb 12 16:41:11 2021 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 13 20:03:18 2021 +0100

ofz#29461 flatten SetAttrSet recursion

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 17ef94553ec5..7c1d885323e3 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -848,14 +848,42 @@ void SvxRTFParser::SetAllAttrOfStk()// end all 
Attr. and set it into doc
 for (size_t n = m_AttrSetList.size(); n; )
 {
 auto const& pStkSet = m_AttrSetList[--n];
-SetAttrSet( *pStkSet );
-pStkSet->DropChildList();
+
+/*
+   ofz#29461 SetAttrSet recursively calls SetAttrSet on pStkSet's
+   m_pChildList. The recurse depth can grow sufficiently to trigger
+   asan.
+
+   So breadth-first iterate through the nodes and make a flat vector of
+   them which can be iterated through linearly
+*/
+auto bfs = pStkSet->GetBreadthFirstList();
+for (auto it = bfs.begin(); it != bfs.end(); ++it)
+{
+SvxRTFItemStackType* pNode = *it;
+SetAttrSet(*pNode, false);
+}
+
+/*
+   ofz#13491 SvxRTFItemStackType dtor recursively calls the dtor of its
+   m_pChildList. The recurse depth can grow sufficiently to trigger
+   asan.
+
+   iterate through flat-view of those nodes in order of most distant
+   from root first and release them linearly
+*/
+for (auto it = bfs.rbegin(); it != bfs.rend(); ++it)
+{
+SvxRTFItemStackType* pNode = *it;
+pNode->m_pChildList.reset();
+}
+
 m_AttrSetList.pop_back();
 }
 }
 
 // sets all the attributes that are different from the current
-void SvxRTFParser::SetAttrSet( SvxRTFItemStackType  )
+void SvxRTFParser::SetAttrSet(SvxRTFItemStackType , bool bRecurse)
 {
 // Was DefTab never read? then set to default
 if( !bIsSetDfltTab )
@@ -867,7 +895,7 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType  )
 SetAttrInDoc( rSet );
 
 // then process all the children
-if (rSet.m_pChildList)
+if (bRecurse && rSet.m_pChildList)
 for (size_t n = 0; n < rSet.m_pChildList->size(); ++n)
 SetAttrSet( *(*rSet.m_pChildList)[ n ] );
 }
@@ -963,12 +991,10 @@ SvxRTFItemStackType::SvxRTFItemStackType(
distant from root first and release
their children linearly
 */
-void SvxRTFItemStackType::DropChildList()
+std::vector SvxRTFItemStackType::GetBreadthFirstList()
 {
-if (!m_pChildList || m_pChildList->empty())
-return;
-
 std::vector bfs;
+
 std::queue aQueue;
 aQueue.push(this);
 
@@ -984,11 +1010,7 @@ void SvxRTFItemStackType::DropChildList()
 }
 }
 
-for (auto it = bfs.rbegin(); it != bfs.rend(); ++it)
-{
-SvxRTFItemStackType* pNode = *it;
-pNode->m_pChildList.reset();
-}
+return bfs;
 }
 
 SvxRTFItemStackType::~SvxRTFItemStackType()
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index faff107c1496..70e996068459 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -197,7 +197,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
 void ClearStyleAttr_( SvxRTFItemStackType& rStkType );
 
 // Sets all the attributes that are different from the current
-void SetAttrSet( SvxRTFItemStackType  );
+void SetAttrSet(SvxRTFItemStackType , bool bRecurse = true);
 void SetDefault( int nToken, int nValue );
 
 // Execute pard / plain
@@ -309,7 +309,7 @@ class SvxRTFItemStackType
 
 void Add(std::unique_ptr);
 void Compress( const SvxRTFParser& );
-void DropChildList();
+std::vector GetBreadthFirstList();
 
 public:
 SvxRTFItemStackType(const SvxRTFItemStackType&, const EditPosition&,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-02-08 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx  |5 +
 include/editeng/lrspitem.hxx   |4 
 sw/qa/core/layout/layout.cxx   |   31 +++
 sw/source/core/layout/frmtool.cxx  |   13 +
 sw/source/core/layout/pagedesc.cxx |1 +
 sw/source/core/layout/paintfrm.cxx |   21 +++--
 6 files changed, 69 insertions(+), 6 deletions(-)

New commits:
commit ffe7fd5c3f3de474b201fbb1e25b8251cb13574d
Author: Miklos Vajna 
AuthorDate: Mon Feb 8 16:49:45 2021 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 8 17:53:27 2021 +0100

tdf#91920 sw page gutter margin: handle mirrored margins

- SwPageDesc::Mirror: generate "right gutter margin" from gutter margin
  for mirrored pages, we just lost the gutter margin here previously

- SwBorderAttrs::CalcRight: handle right gutter margin, so gutter
increases the right margin, not the left margin on mirrored pages

- lcl_CalcBorderRect: similar to left and top margins, compensate for
  right margin gutter as well, so borders are independent from the gutter
  margin (Word compat)

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index c6b26c1c03a5..6e963e91cbaa 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -290,6 +290,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
 nLeftMargin ( 0 ),
 nRightMargin( 0 ),
 m_nGutterMargin(0),
+m_nRightGutterMargin(0),
 nPropFirstLineOffset( 100 ),
 nPropLeftMargin( 100 ),
 nPropRightMargin( 100 ),
@@ -310,6 +311,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const tools::Long nLeft, 
const tools::Long nRigh
 nLeftMargin ( nLeft ),
 nRightMargin( nRight ),
 m_nGutterMargin(0),
+m_nRightGutterMargin(0),
 nPropFirstLineOffset( 100 ),
 nPropLeftMargin( 100 ),
 nPropRightMargin( 100 ),
@@ -484,6 +486,7 @@ bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) 
const
 nFirstLineOffset == rOther.GetTextFirstLineOffset() &&
 nTxtLeft == rOther.GetTextLeft() &&
 m_nGutterMargin == rOther.GetGutterMargin() &&
+m_nRightGutterMargin == rOther.GetRightGutterMargin() &&
 nLeftMargin == rOther.GetLeft()  &&
 nRightMargin == rOther.GetRight() &&
 nPropFirstLineOffset == rOther.GetPropTextFirstLineOffset() &&
@@ -608,6 +611,8 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRightMargin"), 
BAD_CAST(OString::number(nRightMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
 
BAD_CAST(OString::number(m_nGutterMargin).getStr()));
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nRightGutterMargin"),
+
BAD_CAST(OString::number(m_nRightGutterMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropFirstLineOffset"), 
BAD_CAST(OString::number(nPropFirstLineOffset).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropLeftMargin"), 
BAD_CAST(OString::number(nPropLeftMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropRightMargin"), 
BAD_CAST(OString::number(nPropRightMargin).getStr()));
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index 9b3ec7734a8e..0510ee47d521 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -53,6 +53,8 @@ class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public 
SfxPoolItem
 tools::LongnRightMargin;   // The unproblematic right edge
 /// The amount of extra space added to the left margin.
 tools::Longm_nGutterMargin;
+/// The amount of extra space added to the right margin, on mirrored pages.
+tools::Longm_nRightGutterMargin;
 
 sal_uInt16  nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin;
 short   nFirstLineOffset; // First-line indent _always_ relative to 
nTxtLeft
@@ -120,6 +122,8 @@ public:
 { nFirstLineOffset = nValue; }
 void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = 
nGutterMargin; }
 tools::Long GetGutterMargin() const { return m_nGutterMargin; }
+void SetRightGutterMargin(const tools::Long nRightGutterMargin) { 
m_nRightGutterMargin = nRightGutterMargin; }
+tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; }
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 virtual boost::property_tree::ptree dumpAsJSON() const override;
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index ebf7f816b918..a9a738f26e1d 100644
--- a/sw/qa/core/layout/layout.cxx
+++ 

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

2021-02-04 Thread Noel (via logerrit)
 editeng/source/uno/unofield.cxx |4 ++--
 include/editeng/mutxhelp.hxx|   36 
 include/editeng/unofield.hxx|4 ++--
 include/svx/unopage.hxx |9 +
 svx/source/unodraw/unopage.cxx  |2 +-
 5 files changed, 10 insertions(+), 45 deletions(-)

New commits:
commit 011d0d0078841a8ccebfdd1b360172314493c750
Author: Noel 
AuthorDate: Thu Feb 4 10:43:10 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 4 14:29:36 2021 +0100

remove svx/mutxhelp.hxx

which is a clone of cppu::BaseMutex

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

diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 59772b594490..081ccec809db 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -249,7 +249,7 @@ sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const 
css::uno::Sequence< sal_
 }
 
 SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
-:   OComponentHelper( getMutex() )
+:   OComponentHelper( m_aMutex )
 ,   mpPropSet(nullptr)
 ,   mnServiceId(nServiceId)
 ,   mpImpl( new SvxUnoFieldData_Impl )
@@ -315,7 +315,7 @@ SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) 
throw()
 }
 
 SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > const & 
xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) throw()
-:   OComponentHelper( getMutex() )
+:   OComponentHelper( m_aMutex )
 ,   mxAnchor( xAnchor )
 ,   mpPropSet(nullptr)
 ,   mnServiceId(text::textfield::Type::UNSPECIFIED)
diff --git a/include/editeng/mutxhelp.hxx b/include/editeng/mutxhelp.hxx
deleted file mode 100644
index 7487fee48e46..
--- a/include/editeng/mutxhelp.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_EDITENG_MUTXHELP_HXX
-#define INCLUDED_EDITENG_MUTXHELP_HXX
-
-#include 
-
-class SvxMutexHelper
-{
-private:
-::osl::Mutex maMutex;
-
-public:
-::osl::Mutex& getMutex() { return maMutex; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
index 8eb521066347..173bb4b11121 100644
--- a/include/editeng/unofield.hxx
+++ b/include/editeng/unofield.hxx
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 namespace com::sun::star::beans { class XPropertySetInfo; }
@@ -41,7 +41,7 @@ class SvxFieldData;
 css::uno::Reference< css::uno::XInterface > EDITENG_DLLPUBLIC 
SvxUnoTextCreateTextField(
 const OUString& ServiceSpecifier );
 
-class EDITENG_DLLPUBLIC SvxUnoTextField final : public SvxMutexHelper,
+class EDITENG_DLLPUBLIC SvxUnoTextField final : public cppu::BaseMutex,
 public ::cppu::OComponentHelper,
 public css::text::XTextField,
 public css::beans::XPropertySet,
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
index a428254f6af7..bff0aa5fd5e3 100644
--- a/include/svx/unopage.hxx
+++ b/include/svx/unopage.hxx
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -52,14 +52,15 @@ enum class SdrInventor : sal_uInt32;
 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
 
-class SVXCORE_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper7< 
css::drawing::XDrawPage,
+class SVXCORE_DLLPUBLIC SvxDrawPage : protected cppu::BaseMutex,
+public ::cppu::WeakAggImplHelper7< 
css::drawing::XDrawPage,
css::drawing::XShapeGrouper,
css::drawing::XShapes2,
css::drawing::XShapes3,
css::lang::XServiceInfo,
css::lang::XUnoTunnel,
-

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

2021-02-02 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx|9 +
 include/editeng/memberids.h  |1 +
 offapi/com/sun/star/style/PageProperties.idl |7 +++
 sw/inc/unoprnms.hxx  |1 +
 sw/source/core/unocore/unomap1.cxx   |1 +
 5 files changed, 19 insertions(+)

New commits:
commit 947277146e4c1ff7544371095fcc6bd5842b2d98
Author: Miklos Vajna 
AuthorDate: Tue Feb 2 15:49:16 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 2 19:30:33 2021 +0100

sw page gutter margin: add UNO API

SvxLRSpaceItem is used for all sorts of left/right margins, but gutter
only makes sense for pages, so only expose the gutter margin in the page
properties.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index e1520735d804..c6b26c1c03a5 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -372,6 +372,11 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= IsAutoFirst();
 break;
 
+case MID_GUTTER_MARGIN:
+rVal <<= static_cast(bConvert ? 
convertTwipToMm100(m_nGutterMargin)
+ : m_nGutterMargin);
+break;
+
 default:
 bRet = false;
 // 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?
@@ -447,6 +452,10 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 SetAutoFirst( Any2Bool(rVal) );
 break;
 
+case MID_GUTTER_MARGIN:
+SetGutterMargin(bConvert ? convertMm100ToTwip(nVal) : nVal);
+break;
+
 default:
 OSL_FAIL("unknown MemberId");
 return false;
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index a857d7593afb..8a6c9d0e7769 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -129,6 +129,7 @@
 #define MID_FIRST_LINE_REL_INDENT   9
 #define MID_FIRST_AUTO  10
 #define MID_TXT_LMARGIN 11
+#define MID_GUTTER_MARGIN 12
 
 //ProtectItem
 #define MID_PROTECT_CONTENT 0
diff --git a/offapi/com/sun/star/style/PageProperties.idl 
b/offapi/com/sun/star/style/PageProperties.idl
index 73242f230f90..dccd63f20b04 100644
--- a/offapi/com/sun/star/style/PageProperties.idl
+++ b/offapi/com/sun/star/style/PageProperties.idl
@@ -487,6 +487,13 @@ published service PageProperties
 @since LibreOffice 6.1
  */
 [optional, property, maybevoid] com::sun::star::graphic::XGraphic 
FooterBackGraphic;
+
+/** determines the gutter margin of the page.
+
+@since LibreOffice 7.2
+ */
+[optional, property] long GutterMargin;
+
 };
 
 }; }; }; };
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 8fc67fdf5206..9cceac0f8d0f 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -66,6 +66,7 @@
 #define UNO_NAME_PARA_HYPHENATION_NO_CAPS "ParaHyphenationNoCaps"
 #define UNO_NAME_LEFT_MARGIN "LeftMargin"
 #define UNO_NAME_RIGHT_MARGIN "RightMargin"
+#define UNO_NAME_GUTTER_MARGIN "GutterMargin"
 #define UNO_NAME_HEADER_LEFT_MARGIN "HeaderLeftMargin"
 #define UNO_NAME_HEADER_RIGHT_MARGIN "HeaderRightMargin"
 #define UNO_NAME_FOOTER_LEFT_MARGIN "FooterLeftMargin"
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index d3fb8b909608..253da09f67f1 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -445,6 +445,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetPageStylePropertyMa
 { u"" UNO_NAME_BACK_GRAPHIC_LOCATION, RES_BACKGROUND, 
cppu::UnoType::get(), PROPERTY_NONE 
,MID_GRAPHIC_POSITION},
 { u"" UNO_NAME_LEFT_MARGIN, RES_LR_SPACE, 
cppu::UnoType::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
 { u"" UNO_NAME_RIGHT_MARGIN, RES_LR_SPACE,
cppu::UnoType::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+{ u"" UNO_NAME_GUTTER_MARGIN, RES_LR_SPACE, 
cppu::UnoType::get(), PROPERTY_NONE, MID_GUTTER_MARGIN | 
CONVERT_TWIPS},
 { u"" UNO_NAME_BACK_TRANSPARENT, RES_BACKGROUND,  
cppu::UnoType::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT  
 },
 { u"" UNO_NAME_LEFT_BORDER, RES_BOX,  
cppu::UnoType::get(),  0, LEFT_BORDER  |CONVERT_TWIPS },
 { u"" UNO_NAME_RIGHT_BORDER, RES_BOX, 
cppu::UnoType::get(),  0, RIGHT_BORDER |CONVERT_TWIPS },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

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

2021-02-02 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx |5 +
 include/editeng/lrspitem.hxx  |4 
 2 files changed, 9 insertions(+)

New commits:
commit 48829edfb148ff61d1e03319547151380899ba63
Author: Miklos Vajna 
AuthorDate: Tue Feb 2 12:22:15 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 2 14:17:28 2021 +0100

sw page gutter margin: add doc model

The page gutter defines the amount of extra space added to the specified
margin, above any existing margin values. This can be helpful in case of
printed books: e.g. 1cm left margin, 1cm right margin, then some
additional gutter margin on the left can mean that once the book is
printed and binding consumes its space, the remaining left/right margin
is matching.

This is just the doc model, other parts will come in follow-up commits.

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 184bf21cd994..e1520735d804 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -289,6 +289,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
 nTxtLeft( 0 ),
 nLeftMargin ( 0 ),
 nRightMargin( 0 ),
+m_nGutterMargin(0),
 nPropFirstLineOffset( 100 ),
 nPropLeftMargin( 100 ),
 nPropRightMargin( 100 ),
@@ -308,6 +309,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const tools::Long nLeft, 
const tools::Long nRigh
 nTxtLeft( nTLeft ),
 nLeftMargin ( nLeft ),
 nRightMargin( nRight ),
+m_nGutterMargin(0),
 nPropFirstLineOffset( 100 ),
 nPropLeftMargin( 100 ),
 nPropRightMargin( 100 ),
@@ -472,6 +474,7 @@ bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) 
const
 return (
 nFirstLineOffset == rOther.GetTextFirstLineOffset() &&
 nTxtLeft == rOther.GetTextLeft() &&
+m_nGutterMargin == rOther.GetGutterMargin() &&
 nLeftMargin == rOther.GetLeft()  &&
 nRightMargin == rOther.GetRight() &&
 nPropFirstLineOffset == rOther.GetPropTextFirstLineOffset() &&
@@ -594,6 +597,8 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nTxtLeft"), 
BAD_CAST(OString::number(nTxtLeft).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeftMargin"), 
BAD_CAST(OString::number(nLeftMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRightMargin"), 
BAD_CAST(OString::number(nRightMargin).getStr()));
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
+
BAD_CAST(OString::number(m_nGutterMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropFirstLineOffset"), 
BAD_CAST(OString::number(nPropFirstLineOffset).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropLeftMargin"), 
BAD_CAST(OString::number(nPropLeftMargin).getStr()));
 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropRightMargin"), 
BAD_CAST(OString::number(nPropRightMargin).getStr()));
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index b04944326407..9b3ec7734a8e 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -51,6 +51,8 @@ class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public 
SfxPoolItem
 tools::LongnTxtLeft;   // We spend a sal_uInt16
 tools::LongnLeftMargin;// nLeft or the negative first-line 
indent
 tools::LongnRightMargin;   // The unproblematic right edge
+/// The amount of extra space added to the left margin.
+tools::Longm_nGutterMargin;
 
 sal_uInt16  nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin;
 short   nFirstLineOffset; // First-line indent _always_ relative to 
nTxtLeft
@@ -116,6 +118,8 @@ public:
 { return nPropFirstLineOffset; }
 void SetTextFirstLineOffsetValue( const short nValue )
 { nFirstLineOffset = nValue; }
+void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = 
nGutterMargin; }
+tools::Long GetGutterMargin() const { return m_nGutterMargin; }
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 virtual boost::property_tree::ptree dumpAsJSON() const override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-01-21 Thread Henry Castro (via logerrit)
 editeng/source/editeng/editview.cxx   |5 +
 editeng/source/outliner/outlvw.cxx|5 +
 include/editeng/editview.hxx  |1 +
 include/editeng/outliner.hxx  |1 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |   12 ++--
 5 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit aadfeaff158316af1a868c66fa2fd78fb473c802
Author: Henry Castro 
AuthorDate: Fri Jan 15 10:14:50 2021 -0400
Commit: Henry Castro 
CommitDate: Thu Jan 21 12:49:35 2021 +0100

lok: fix incorrect invalidate cursor position

When the comment is created and it's shown in the "Writer"
application, it creates an initial output area:

mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );

Unfortunately, it causes that send to client side cursor position
and scroll to the beginning of the document.

Change-Id: I13e21c71328b7f05781e7cdeed082d6cc2b9d679
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109371
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 
(cherry picked from commit 4618849a1cbba4e249ee13c3b6412337160a2816)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109732
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index f044671e1c17..901e29e756c6 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -701,6 +701,11 @@ void EditView::RegisterViewShell(OutlinerViewShell* 
pViewShell)
 pImpEditView->RegisterViewShell(pViewShell);
 }
 
+const OutlinerViewShell* EditView::GetViewShell()
+{
+return pImpEditView->GetViewShell();
+}
+
 void EditView::RegisterOtherShell(OutlinerViewShell* pOtherShell)
 {
 pImpEditView->RegisterOtherShell(pOtherShell);
diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index 8ba3a28c87f0..487431995636 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1382,6 +1382,11 @@ void OutlinerView::RegisterViewShell(OutlinerViewShell* 
pViewShell)
 pEditView->RegisterViewShell(pViewShell);
 }
 
+const OutlinerViewShell* OutlinerView::GetViewShell()
+{
+return pEditView->GetViewShell();
+}
+
 Color const & OutlinerView::GetBackgroundColor() const
 {
 return pEditView->GetBackgroundColor();
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index debc7b6efe71..bcf031559bed 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -258,6 +258,7 @@ public:
 
 /// Informs this edit view about which view shell contains it.
 void RegisterViewShell(OutlinerViewShell* pViewShell);
+const OutlinerViewShell* GetViewShell();
 /// Informs this edit view about which other shell listens to it.
 void RegisterOtherShell(OutlinerViewShell* pOtherShell);
 
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 0ffa5721c203..cfcfe85191d6 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -258,6 +258,7 @@ public:
 
 /// Informs this edit view about which view shell contains it.
 void RegisterViewShell(OutlinerViewShell* pViewShell);
+const OutlinerViewShell* GetViewShell();
 
 SfxItemSet  GetAttribs();
 
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 3fe30564cc44..9a067038d773 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -530,12 +530,6 @@ void SwAnnotationWin::InitControls()
 
 mpOutlinerView->SetAttribs(DefaultItem());
 
-if (comphelper::LibreOfficeKit::isActive())
-{
-// If there is a callback already registered, inform the new outliner 
view about it.
-mpOutlinerView->RegisterViewShell();
-}
-
 //create Scrollbars
 mpVScrollbar = VclPtr::Create(*this, WB_3DLOOK 
|WB_VSCROLL|WB_DRAG, mrView);
 mpVScrollbar->EnableNativeWidget(false);
@@ -931,6 +925,12 @@ void SwAnnotationWin::DoResize()
 }
 
 mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+
+if (comphelper::LibreOfficeKit::isActive() && 
!mpOutlinerView->GetViewShell())
+{
+mpOutlinerView->RegisterViewShell();
+}
+
 if (!mpVScrollbar->IsVisible())
 {   // if we do not have a scrollbar anymore, we want to see the complete 
text
 mpOutlinerView->SetVisArea( PixelToLogic( 
tools::Rectangle(0,0,aWidth,aHeight) ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-01-06 Thread Noel Grandin (via logerrit)
 editeng/source/items/borderline.cxx |   11 ++-
 editeng/source/items/frmitems.cxx   |   29 +++--
 editeng/source/items/textitem.cxx   |5 +++--
 include/editeng/itemtype.hxx|   12 +---
 include/tools/bigint.hxx|3 +++
 svx/source/svdraw/svdattr.cxx   |6 +-
 svx/source/svdraw/svdtrans.cxx  |   16 +++-
 svx/source/xoutdev/xattr.cxx|   24 
 tools/source/generic/bigint.cxx |   16 
 9 files changed, 52 insertions(+), 70 deletions(-)

New commits:
commit 2298b055cab8cf8d0268ee1375a5c6e416bf1332
Author: Noel Grandin 
AuthorDate: Wed Jan 6 10:10:39 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Jan 6 11:38:01 2021 +0100

move the bigint based Scale() implementations to one central place

Picking the best looking one in the process.

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

diff --git a/editeng/source/items/borderline.cxx 
b/editeng/source/items/borderline.cxx
index 6a33b4bbcfc5..08261ed7165f 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::table::BorderLineStyle;
 
@@ -496,23 +497,23 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderLineStyle 
nStyle, sal_uInt16 nOut
 
 sal_uInt16 SvxBorderLine::GetOutWidth() const
 {
-sal_uInt16 nOut = static_cast(Scale( m_aWidthImpl.GetLine1( 
m_nWidth ), m_nMult, m_nDiv ));
+sal_uInt16 nOut = static_cast(BigInt::Scale( 
m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ));
 if ( m_bMirrorWidths )
-nOut = static_cast(Scale( m_aWidthImpl.GetLine2( m_nWidth 
), m_nMult, m_nDiv ));
+nOut = static_cast(BigInt::Scale( m_aWidthImpl.GetLine2( 
m_nWidth ), m_nMult, m_nDiv ));
 return nOut;
 }
 
 sal_uInt16 SvxBorderLine::GetInWidth() const
 {
-sal_uInt16 nIn = static_cast(Scale( m_aWidthImpl.GetLine2( 
m_nWidth ), m_nMult, m_nDiv ));
+sal_uInt16 nIn = static_cast(BigInt::Scale( 
m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ));
 if ( m_bMirrorWidths )
-nIn = static_cast(Scale( m_aWidthImpl.GetLine1( m_nWidth 
), m_nMult, m_nDiv ));
+nIn = static_cast(BigInt::Scale( m_aWidthImpl.GetLine1( 
m_nWidth ), m_nMult, m_nDiv ));
 return nIn;
 }
 
 sal_uInt16 SvxBorderLine::GetDistance() const
 {
-return static_cast(Scale( m_aWidthImpl.GetGap( m_nWidth ), 
m_nMult, m_nDiv ));
+return static_cast(BigInt::Scale( m_aWidthImpl.GetGap( 
m_nWidth ), m_nMult, m_nDiv ));
 }
 
 
diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 4f365da2b7de..43a9be8e4635 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -270,8 +271,8 @@ bool SvxSizeItem::GetPresentation
 
 void SvxSizeItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-m_aSize.setWidth( Scale( m_aSize.Width(), nMult, nDiv ) );
-m_aSize.setHeight( Scale( m_aSize.Height(), nMult, nDiv ) );
+m_aSize.setWidth( BigInt::Scale( m_aSize.Width(), nMult, nDiv ) );
+m_aSize.setHeight( BigInt::Scale( m_aSize.Height(), nMult, nDiv ) );
 }
 
 
@@ -572,10 +573,10 @@ bool SvxLRSpaceItem::GetPresentation
 
 void SvxLRSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-nFirstLineOffset = static_cast(Scale( nFirstLineOffset, nMult, nDiv 
));
-nTxtLeft = Scale( nTxtLeft, nMult, nDiv );
-nLeftMargin = Scale( nLeftMargin, nMult, nDiv );
-nRightMargin = Scale( nRightMargin, nMult, nDiv );
+nFirstLineOffset = static_cast(BigInt::Scale( nFirstLineOffset, 
nMult, nDiv ));
+nTxtLeft = BigInt::Scale( nTxtLeft, nMult, nDiv );
+nLeftMargin = BigInt::Scale( nLeftMargin, nMult, nDiv );
+nRightMargin = BigInt::Scale( nRightMargin, nMult, nDiv );
 }
 
 
@@ -824,8 +825,8 @@ bool SvxULSpaceItem::GetPresentation
 
 void SvxULSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-nUpper = static_cast(Scale( nUpper, nMult, nDiv ));
-nLower = static_cast(Scale( nLower, nMult, nDiv ));
+nUpper = static_cast(BigInt::Scale( nUpper, nMult, nDiv ));
+nLower = static_cast(BigInt::Scale( nLower, nMult, nDiv ));
 }
 
 
@@ -1222,7 +1223,7 @@ bool SvxShadowItem::GetPresentation
 
 void SvxShadowItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv )
 {
-nWidth = static_cast(Scale( nWidth, nMult, nDiv ));
+nWidth = static_cast(BigInt::Scale( nWidth, nMult, nDiv ));
 }
 
 
@@ -1862,10 +1863,10 @@ void SvxBoxItem::ScaleMetrics( tools::Long nMult, 
tools::Long nDiv )
 if ( pBottom )  pBottom->ScaleMetrics( nMult, nDiv );
 if ( pLeft )pLeft->ScaleMetrics( nMult, nDiv );
 if ( pRight )   

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

2021-01-05 Thread Miklos Vajna (via logerrit)
 editeng/source/items/frmitems.cxx |8 
 include/editeng/keepitem.hxx  |2 ++
 2 files changed, 10 insertions(+)

New commits:
commit da348a4740267592c36902ac6295302e7c9647a7
Author: Miklos Vajna 
AuthorDate: Mon Jan 4 21:45:10 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 5 09:03:28 2021 +0100

sw doc model xml dump: improve keep-with-next output

From: 
To: 

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

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index cb3c4a14a136..4f365da2b7de 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2643,6 +2643,14 @@ bool SvxFormatKeepItem::GetPresentation
 return true;
 }
 
+void SvxFormatKeepItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFormatKeepItem"));
+
+SfxBoolItem::dumpAsXml(pWriter);
+
+xmlTextWriterEndElement(pWriter);
+}
 
 SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
 SfxPoolItem ( nId )
diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx
index 6d511d04b0a2..c108560ce3aa 100644
--- a/include/editeng/keepitem.hxx
+++ b/include/editeng/keepitem.hxx
@@ -46,6 +46,8 @@ public:
   MapUnit eCoreMetric,
   MapUnit ePresMetric,
   OUString , const IntlWrapper& ) const 
override;
+
+void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 inline SvxFormatKeepItem::SvxFormatKeepItem( const bool bKeep, const 
sal_uInt16 _nWhich ) :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-23 Thread Stephan Bergmann (via logerrit)
 editeng/source/misc/svxacorr.cxx |7 ++-
 include/editeng/svxacorr.hxx |4 ++--
 2 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit c386994e78f69cb2e9babf42bb54bdfa1f8bd28e
Author: Stephan Bergmann 
AuthorDate: Wed Dec 23 10:48:30 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 23 14:54:20 2020 +0100

Directly pass in OUString instances

All the passed-in pStrmName are either pXMLImplCplStt_ExcptLstStr or
pXMLImplWrdStt_ExcptLstStr, both of which are ASCII-only, so using
RTL_TEXTENCODING_MS_1252 wasn't relevant.

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

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e6fd6ec459cb..3b9da426dc64 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2181,7 +2181,7 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp()
 
 void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
 std::unique_ptr& 
rpLst,
-const char* pStrmName,
+const OUString& sStrmName,
 tools::SvRef& rStg)
 {
 if( rpLst )
@@ -2190,8 +2190,6 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
 rpLst.reset( new SvStringsISortDtor );
 
 {
-const OUString sStrmName( pStrmName, strlen(pStrmName), 
RTL_TEXTENCODING_MS_1252 );
-
 if( rStg.is() && rStg->IsStream( sStrmName ) )
 {
 tools::SvRef xStrm = rStg->OpenSotStream( 
sStrmName,
@@ -2254,14 +2252,13 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
 
 void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
 const SvStringsISortDtor& rLst,
-const char* pStrmName,
+const OUString& sStrmName,
 tools::SvRef const ,
 bool bConvert )
 {
 if( !rStg.is() )
 return;
 
-OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 
);
 if( rLst.empty() )
 {
 rStg->Remove( sStrmName );
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 4e5d929405f0..d386a6888f9a 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -196,10 +196,10 @@ class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
 
 bool IsFileChanged_Imp();
 void LoadXMLExceptList_Imp( std::unique_ptr& rpLst,
-const char* pStrmName,
+const OUString& sStrmName,
 tools::SvRef& rStg);
 static void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
-const char* pStrmName,
+const OUString& sStrmName,
 tools::SvRef const & rStg,
 bool bConvert = false);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-18 Thread Noel (via logerrit)
 editeng/source/uno/unoipset.cxx |2 +-
 editeng/source/uno/unotext.cxx  |2 +-
 include/editeng/unoipset.hxx|2 +-
 include/editeng/unotext.hxx |2 +-
 include/svl/itemprop.hxx|4 ++--
 sc/inc/optuno.hxx   |4 ++--
 sc/inc/styleuno.hxx |   10 +-
 sc/source/ui/unoobj/optuno.cxx  |4 ++--
 sc/source/ui/unoobj/styleuno.cxx|   18 +-
 sd/inc/stlsheet.hxx |2 +-
 sd/source/core/stlsheet.cxx |2 +-
 sd/source/ui/unoidl/unopback.cxx|2 +-
 sd/source/ui/unoidl/unopback.hxx|2 +-
 svl/source/items/itemprop.cxx   |6 +++---
 sw/source/core/unocore/unofield.cxx |2 +-
 15 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit 27d585cd2d0a0157896c4af11f2463f0197e3eb2
Author: Noel 
AuthorDate: Fri Dec 18 20:23:40 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 19 08:02:56 2020 +0100

use more string_view in SfxItemPropertyMap

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

diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index c9d54c83e972..523b29794461 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -246,7 +246,7 @@ void SvxItemPropertySet::setPropertyValue( const 
SfxItemPropertySimpleEntry* pMa
 }
 
 
-const SfxItemPropertySimpleEntry* 
SvxItemPropertySet::getPropertyMapEntry(const OUString ) const
+const SfxItemPropertySimpleEntry* 
SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const
 {
 return m_aPropertyMap.getByName( rName );
  }
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 6761f8b8b622..9476ba7659c7 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1017,7 +1017,7 @@ beans::PropertyState 
SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
 throw beans::UnknownPropertyException();
 }
 
-beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const OUString& 
PropertyName, sal_Int32 nPara /* = -1 */)
+beans::PropertyState 
SvxUnoTextRangeBase::_getPropertyState(std::u16string_view PropertyName, 
sal_Int32 nPara /* = -1 */)
 {
 SolarMutexGuard aGuard;
 
diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx
index c05ff656ee9c..0a4d8c2fe3ad 100644
--- a/include/editeng/unoipset.hxx
+++ b/include/editeng/unoipset.hxx
@@ -59,7 +59,7 @@ public:
 
 css::uno::Reference< css::beans::XPropertySetInfo > const & 
getPropertySetInfo() const;
 const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;}
-const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString 
) const;
+const SfxItemPropertySimpleEntry* getPropertyMapEntry(std::u16string_view 
rName) const;
 };
 
 /** converts the given any with a metric to 100th/mm if needed */
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 86841fbb0d56..a07a8cf059e1 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -274,7 +274,7 @@ protected:
 css::beans::PropertyState _getPropertyState( const 
SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 );
 /// @throws css::beans::UnknownPropertyException
 /// @throws css::uno::RuntimeException
-css::beans::PropertyState _getPropertyState( const OUString& PropertyName, 
sal_Int32 nPara = -1 );
+css::beans::PropertyState _getPropertyState(  std::u16string_view 
PropertyName, sal_Int32 nPara = -1 );
 /// @throws css::beans::UnknownPropertyException
 /// @throws css::uno::RuntimeException
 css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const 
css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1  );
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
index e985977f265a..67cedb7a64b6 100644
--- a/include/svl/itemprop.hxx
+++ b/include/svl/itemprop.hxx
@@ -124,11 +124,11 @@ public:
 SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
 ~SfxItemPropertyMap();
 
-const SfxItemPropertySimpleEntry*  getByName( const OUString  ) 
const;
+const SfxItemPropertySimpleEntry*  getByName( std::u16string_view rName ) 
const;
 css::uno::Sequence< css::beans::Property > const & getProperties() const;
 /// @throws css::beans::UnknownPropertyException
 css::beans::Property getPropertyByName( const OUString & rName ) const;
-bool hasPropertyByName( const OUString& rName ) const;
+bool hasPropertyByName( std::u16string_view rName ) const;
 
 void mergeProperties( const css::uno::Sequence< css::beans::Property >& 
rPropSeq );
 PropertyEntryVector_t getPropertyEntries() const;
diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx
index 35e7ad28e3d5..8ce6d9c149d1 100644
--- a/sc/inc/optuno.hxx
+++ 

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

2020-12-18 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx |4 ++--
 editeng/source/editeng/impedit.cxx  |4 ++--
 editeng/source/editeng/impedit.hxx  |4 ++--
 editeng/source/editeng/impedit2.cxx |8 ++--
 editeng/source/outliner/outlvw.cxx  |6 ++
 include/editeng/editview.hxx|2 +-
 include/editeng/outliner.hxx|2 +-
 include/vcl/seleng.hxx  |2 +-
 svx/source/dialog/weldeditview.cxx  |3 +--
 vcl/source/window/seleng.cxx|7 ---
 10 files changed, 22 insertions(+), 20 deletions(-)

New commits:
commit 2a91637ed9a312471afe7a2201371eb9ae7f33c7
Author: Caolán McNamara 
AuthorDate: Fri Dec 18 10:46:03 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 18 21:39:05 2020 +0100

add a return to EditView::Command to indicate if the command was consumed

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 7b70f98b6ef7..a17f76d6d492 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -471,9 +471,9 @@ bool EditView::MouseMove( const MouseEvent& rMouseEvent )
 return pImpEditView->MouseMove( rMouseEvent );
 }
 
-void EditView::Command( const CommandEvent& rCEvt )
+bool EditView::Command(const CommandEvent& rCEvt)
 {
-pImpEditView->Command( rCEvt );
+return pImpEditView->Command(rCEvt);
 }
 
 void EditView::SetBroadcastLOKViewCursor(bool bSet)
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 20dce95424a9..bd2f0bf24218 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1705,10 +1705,10 @@ bool ImpEditView::MouseMove( const MouseEvent& 
rMouseEvent )
 return pEditEngine->pImpEditEngine->MouseMove( rMouseEvent, 
GetEditViewPtr() );
 }
 
-void ImpEditView::Command( const CommandEvent& rCEvt )
+bool ImpEditView::Command(const CommandEvent& rCEvt)
 {
 pEditEngine->CheckIdleFormatter();  // If fast typing and mouse button down
-pEditEngine->pImpEditEngine->Command( rCEvt, GetEditViewPtr() );
+return pEditEngine->pImpEditEngine->Command(rCEvt, GetEditViewPtr());
 }
 
 
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 45088dc9bedf..a874a51699e3 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -368,7 +368,7 @@ public:
 boolMouseButtonDown( const MouseEvent& rMouseEvent );
 voidReleaseMouse();
 boolMouseMove( const MouseEvent& rMouseEvent );
-voidCommand( const CommandEvent& rCEvt );
+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 );
@@ -841,7 +841,7 @@ public:
 boolMouseButtonDown( const MouseEvent& rMouseEvent, 
EditView* pView );
 voidReleaseMouse();
 boolMouseMove( const MouseEvent& rMouseEvent, EditView* 
pView );
-voidCommand( const CommandEvent& rCEvt, EditView* 
pView );
+boolCommand(const CommandEvent& rCEvt, EditView* 
pView);
 
 EditSelectionEngine&GetSelEngine() { return aSelEngine; }
 OUStringGetSelected( const EditSelection& rSel ) const;
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 2c83c1165856..d2596ebd9065 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -331,8 +331,10 @@ bool ImpEditEngine::MouseButtonDown( const MouseEvent& 
rMEvt, EditView* pView )
 return true;
 }
 
-void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
+bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
 {
+bool bConsumed = true;
+
 GetSelEngine().SetCurView( pView );
 SetActiveView( pView );
 if ( rCEvt.GetCommand() == CommandEventId::StartExtTextInput )
@@ -555,8 +557,10 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, 
EditView* pView )
 }
 }
 }
+else
+bConsumed = false;
 
-GetSelEngine().Command( rCEvt );
+return GetSelEngine().Command(rCEvt) || bConsumed;
 }
 
 bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView )
diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index aff9992d8b4c..8ba3a28c87f0 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -773,13 +773,11 @@ void OutlinerView::ImpPasted( sal_Int32 nStart, sal_Int32 

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

2020-12-18 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx |5 +
 include/editeng/editview.hxx|1 +
 2 files changed, 6 insertions(+)

New commits:
commit 69f1f7f61506131ca203e43b799e7422e98b82a5
Author: Caolán McNamara 
AuthorDate: Fri Dec 18 09:34:48 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Dec 18 16:47:23 2020 +0100

add GetOutputDevice to EditView

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 877c59f1c520..99e3f67730d5 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -348,6 +348,11 @@ vcl::Window* EditView::GetWindow() const
 return pImpEditView->pOutWin;
 }
 
+OutputDevice& EditView::GetOutputDevice() const
+{
+return pImpEditView->GetOutputDevice();
+}
+
 bool EditView::HasOtherViewWindow( vcl::Window* pWin )
 {
 OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 5552e05b1313..7189f40d63ff 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -166,6 +166,7 @@ public:
 
 voidSetWindow( vcl::Window* pWin );
 vcl::Window*GetWindow() const;
+OutputDevice&   GetOutputDevice() const;
 
 boolHasOtherViewWindow( vcl::Window* pWin );
 boolAddOtherViewWindow( vcl::Window* pWin );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-27 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx   |   11 +++
 editeng/source/outliner/outlvw.cxx|6 +-
 include/editeng/editview.hxx  |1 
 include/editeng/outliner.hxx  |1 
 include/vcl/layout.hxx|6 ++
 include/vcl/toolkit/edit.hxx  |1 
 include/vcl/window.hxx|1 
 sd/source/ui/annotations/annotationwindow.cxx |7 ++
 sd/source/ui/annotations/annotationwindow.hxx |1 
 sd/source/ui/inc/Window.hxx   |2 
 sd/source/ui/view/sdwindow.cxx|   17 +
 svx/source/dialog/weldeditview.cxx|   15 +
 sw/source/uibase/docvw/SidebarTxtControl.cxx  |7 ++
 sw/source/uibase/docvw/SidebarTxtControl.hxx  |1 
 vcl/inc/salvtables.hxx|1 
 vcl/inc/salwtype.hxx  |1 
 vcl/source/app/salvtables.cxx |7 ++
 vcl/source/control/edit.cxx   |   10 +++
 vcl/source/window/layout.cxx  |   20 --
 vcl/source/window/window.cxx  |   60 
 vcl/source/window/winproc.cxx |   20 ++
 vcl/unx/gtk3/gtk3gtkframe.cxx |   78 +-
 vcl/unx/gtk3/gtk3gtkinst.cxx  |2 
 23 files changed, 205 insertions(+), 71 deletions(-)

New commits:
commit b9405fbc4e19901c78d136895c5ab0437d8450ac
Author: Caolán McNamara 
AuthorDate: Sun Oct 25 15:27:58 2020 +
Commit: Caolán McNamara 
CommitDate: Tue Oct 27 17:00:59 2020 +0100

Resolves: tdf#137620 add DeleteSurroundingText at vcl::Window level

a) give it a default implementation based on the current one
b) re-use code introduced for WeldEditView::DeleteSurroundingText
   for the EditView containing vcl::Window in impress/draw and
   various similar Annotation windows

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 94012cf70651..3133126ba638 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1549,6 +1549,17 @@ Selection EditView::GetSurroundingTextSelection() const
 }
 }
 
+bool EditView::DeleteSurroundingText(const Selection& rRange)
+{
+ESelection aSel(GetSelection());
+aSel.nEndPara = aSel.nStartPara;
+aSel.nStartPos = rRange.Min();
+aSel.nEndPos = rRange.Max();
+SetSelection(aSel);
+DeleteSelected();
+return true;
+}
+
 void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, 
bool bClearMark)
 {
 Point aDocPos(pImpEditView->GetDocPos(rPosition));
diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index 525559720eac..aff9992d8b4c 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1409,8 +1409,12 @@ Selection OutlinerView::GetSurroundingTextSelection() 
const
 return pEditView->GetSurroundingTextSelection();
 }
 
-// = some code for thesaurus sub menu within context menu
+bool OutlinerView::DeleteSurroundingText(const Selection& rSelection)
+{
+return pEditView->DeleteSurroundingText(rSelection);
+}
 
+// = some code for thesaurus sub menu within context menu
 
 namespace {
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index f75b5ca1228b..e89cd356be72 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -309,6 +309,7 @@ public:
 
 OUStringGetSurroundingText() const;
 Selection   GetSurroundingTextSelection() const;
+boolDeleteSurroundingText(const Selection& rRange);
 
 /** Tries to determine the language of 'rText', returning a matching known
 locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 3ea2fd9b2631..f06bd9a7448d 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -354,6 +354,7 @@ public:
 
 OUStringGetSurroundingText() const;
 Selection   GetSurroundingTextSelection() const;
+boolDeleteSurroundingText(const Selection& rRange);
 
 voidSetEndCutPasteLinkHdl(const Link ) 
{ aEndCutPasteLink = rLink; }
 };
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 60a7f44825e4..d67ab24ffb21 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -648,6 +648,7 @@ private:
 Link m_aCommandHdl;
 Link m_aQueryTooltipHdl;
 Link m_aGetSurroundingHdl;
+Link m_aDeleteSurroundingHdl;
 Link m_aStartDragHdl;
 
 virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override
@@ -748,6 +749,7 @@ public:
 }
 virtual 

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

2020-10-26 Thread Noel (via logerrit)
 editeng/source/rtf/svxrtf.cxx |   20 +++-
 include/editeng/svxrtf.hxx|   14 ++
 2 files changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 39ae9d29be0b4308b6e6ab7ee52c3fe6d6dc7d0c
Author: Noel 
AuthorDate: Mon Oct 26 10:17:14 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 26 13:01:53 2020 +0100

std::unique_ptr -> std::optional

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

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index affc44b8f5f2..17ef94553ec5 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -72,13 +72,11 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& 
rIn )
 , bIsInReadStyleTab( false)
 {
 pDfltFont.reset( new vcl::Font );
-pDfltColor.reset( new Color );
+mxDefaultColor = Color();
 }
 
 SvxRTFParser::~SvxRTFParser()
 {
-if( !aColorTbl.empty() )
-ClearColorTbl();
 if( !aAttrStack.empty() )
 ClearAttrStack();
 }
@@ -95,7 +93,7 @@ SvParserState SvxRTFParser::CallParser()
 if( !pInsPos )
 return SvParserState::Error;
 
-if( !aColorTbl.empty() )
+if( !maColorTable.empty() )
 ClearColorTbl();
 m_FontTable.clear();
 m_StyleTable.clear();
@@ -422,11 +420,11 @@ void SvxRTFParser::ReadColorTable()
 {
 // one color is finished, fill in the table
 // try to map the values to SV internal names
-Color* pColor = new Color( nRed, nGreen, nBlue );
-if( aColorTbl.empty() &&
+Color aColor( nRed, nGreen, nBlue );
+if( maColorTable.empty() &&
 sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && 
sal_uInt8(-1) == nBlue )
-*pColor = COL_AUTO;
-aColorTbl.push_back( pColor );
+aColor = COL_AUTO;
+maColorTable.push_back( aColor );
 nRed = 0;
 nGreen = 0;
 nBlue = 0;
@@ -579,11 +577,7 @@ void SvxRTFParser::ReadFontTable()
 
 void SvxRTFParser::ClearColorTbl()
 {
-while ( !aColorTbl.empty() )
-{
-delete aColorTbl.back();
-aColorTbl.pop_back();
-}
+maColorTable.clear();
 }
 
 void SvxRTFParser::ClearAttrStack()
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index 2069abb48877..5457cf9765ae 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -23,16 +23,15 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
 
 namespace vcl { class Font; }
-class Color;
 struct SvxRTFStyleType;
 class SvxRTFItemStackType;
 class SvxRTFItemStackList : public 
std::vector> {};
@@ -160,7 +159,7 @@ struct RTFPardAttrMapIds
 
 class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
 {
-std::deque< Color* >  aColorTbl;
+std::vectormaColorTable;
 SvxRTFFontTbl m_FontTable;
 SvxRTFStyleTblm_StyleTable;
 std::deque< std::unique_ptr >  aAttrStack;
@@ -172,7 +171,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
 
 std::unique_ptr pInsPos;
 SfxItemPool* pAttrPool;
-std::unique_ptr  pDfltColor;
+std::optional  mxDefaultColor;
 std::unique_ptr   pDfltFont;
 std::unique_ptr pRTFDefaults;
 
@@ -339,10 +338,9 @@ public:
 
 inline const Color& SvxRTFParser::GetColor( size_t nId ) const
 {
-Color* pColor = pDfltColor.get();
-if( nId < aColorTbl.size() )
-pColor = aColorTbl[ nId ];
-return *pColor;
+if( nId < maColorTable.size() )
+return maColorTable[ nId ];
+return *mxDefaultColor;
 }
 
 inline SfxItemSet& SvxRTFParser::GetAttrSet()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sc/uiconfig sc/UIConfig_scalc.mk solenv/sanitizers

2020-10-16 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editview.cxx |5 
 include/editeng/editview.hxx|1 
 sc/UIConfig_scalc.mk|1 
 sc/source/ui/Accessibility/AccessibleEditObject.cxx |   10 
 sc/source/ui/Accessibility/AccessibleText.cxx   |   88 --
 sc/source/ui/app/inputhdl.cxx   |   10 
 sc/source/ui/app/inputwin.cxx   |  815 +---
 sc/source/ui/inc/AccessibleEditObject.hxx   |   10 
 sc/source/ui/inc/AccessibleText.hxx |6 
 sc/source/ui/inc/inputwin.hxx   |   99 +-
 sc/source/ui/pagedlg/tphfedit.cxx   |4 
 sc/uiconfig/scalc/ui/inputbar.ui|  122 ++
 solenv/sanitizers/ui/modules/scalc.suppr|2 
 13 files changed, 639 insertions(+), 534 deletions(-)

New commits:
commit e087e25f05e689091cbf1c4f91b6e93878ac17ec
Author: Caolán McNamara 
AuthorDate: Mon Oct 5 14:19:05 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 16 12:54:14 2020 +0200

weld InputBar

this also restores that DnD of a selection from the inputbar is pasted as 
plain
text not rich text formatted with the happenstance formatting of the 
inputbar's
EditEngine

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

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index ed8bd065dca2..6b897a3bdb5c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -309,6 +309,11 @@ bool EditView::HasSelection() const
 return pImpEditView->HasSelection();
 }
 
+bool EditView::IsSelectionAtPoint(const Point& rPointPixel)
+{
+return pImpEditView->IsSelectionAtPoint(rPointPixel);
+}
+
 void EditView::DeleteSelected()
 {
 pImpEditView->DeleteSelected();
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 97b77609fe60..093e0d851ab6 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -185,6 +185,7 @@ public:
 boolHasSelection() const;
 ESelection  GetSelection() const;
 voidSetSelection( const ESelection& rNewSel );
+boolIsSelectionAtPoint(const Point& rPointPixel);
 voidSelectCurrentWord( sal_Int16 nWordType = 
css::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
 /// Returns the rectangles of the current selection in TWIPs.
 void GetSelectionRectangles(std::vector& rLogicRects) 
const;
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index b2485054ab45..f1a6f4fe902f 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -144,6 +144,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/headerfootercontent \
sc/uiconfig/scalc/ui/headerfooterdialog \
sc/uiconfig/scalc/ui/imoptdialog \
+   sc/uiconfig/scalc/ui/inputbar \
sc/uiconfig/scalc/ui/inputstringdialog \
sc/uiconfig/scalc/ui/insertcells \
sc/uiconfig/scalc/ui/insertname \
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx 
b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index e93e6dbdb289..d0afd2c8196c 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -63,17 +63,19 @@ ScAccessibleEditObject::ScAccessibleEditObject(
 : ScAccessibleContextBase(rxParent, AccessibleRole::TEXT_FRAME)
 , mpEditView(pEditView)
 , mpWindow(pWin)
+, mpTextWnd(nullptr)
 , meObjectType(eObjectType)
 , mbHasFocus(false)
 , m_pScDoc(nullptr)
 {
-InitAcc(rxParent, pEditView, pWin, rName, rDescription);
+InitAcc(rxParent, pEditView, pWin, nullptr, rName, rDescription);
 }
 
 ScAccessibleEditObject::ScAccessibleEditObject(EditObjectType eObjectType)
 : ScAccessibleContextBase(nullptr, AccessibleRole::TEXT_FRAME)
 , mpEditView(nullptr)
 , mpWindow(nullptr)
+, mpTextWnd(nullptr)
 , meObjectType(eObjectType)
 , mbHasFocus(false)
 , m_pScDoc(nullptr)
@@ -82,12 +84,14 @@ 
ScAccessibleEditObject::ScAccessibleEditObject(EditObjectType eObjectType)
 
 void ScAccessibleEditObject::InitAcc(
 const uno::Reference& rxParent,
-EditView* pEditView, vcl::Window* pWin, const OUString& rName,
+EditView* pEditView, vcl::Window* pWin,
+ScTextWnd* pTxtWnd, const OUString& rName,
 const OUString& rDescription)
 {
 SetParent(rxParent);
 mpEditView = pEditView;
 mpWindow = pWin;
+mpTextWnd = pTxtWnd;
 
 CreateTextHelper();
 SetName(rName);
@@ -366,7 +370,7 @@ void ScAccessibleEditObject::CreateTextHelper()
 else
 {
 pAccessibleTextData.reset
-(new ScAccessibleEditLineTextData(nullptr, 
GetOutputDeviceForView()));
+

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

2020-10-10 Thread Caolán McNamara (via logerrit)
 editeng/source/outliner/outlobj.cxx |5 -
 include/editeng/outlobj.hxx |1 -
 2 files changed, 6 deletions(-)

New commits:
commit 4b988449101998b37f4c47a9eea63dc3d46472e9
Author: Caolán McNamara 
AuthorDate: Sat Oct 10 19:33:43 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 10 22:20:17 2020 +0200

drop newly unused OutlinerParaObject ctor variant

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

diff --git a/editeng/source/outliner/outlobj.cxx 
b/editeng/source/outliner/outlobj.cxx
index 61b0a40d6b98..c8a589911079 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -67,11 +67,6 @@ OutlinerParaObject::OutlinerParaObject(
 {
 }
 
-OutlinerParaObject::OutlinerParaObject( const EditTextObject& rTextObj ) :
-mpImpl(OutlinerParaObjData(rTextObj.Clone(), ParagraphDataVector(), true))
-{
-}
-
 OutlinerParaObject::OutlinerParaObject( std::unique_ptr 
pTextObj ) :
 mpImpl(OutlinerParaObjData(std::move(pTextObj), ParagraphDataVector(), 
true))
 {
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
index 5c11180d27de..2d95a39c1a4f 100644
--- a/include/editeng/outlobj.hxx
+++ b/include/editeng/outlobj.hxx
@@ -69,7 +69,6 @@ class EDITENG_DLLPUBLIC OutlinerParaObject
 public:
 // constructors/destructor
 OutlinerParaObject(std::unique_ptr, const 
ParagraphDataVector&, bool bIsEditDoc);
-OutlinerParaObject( const EditTextObject&);
 OutlinerParaObject( std::unique_ptr );
 OutlinerParaObject( const OutlinerParaObject&);
 ~OutlinerParaObject();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-10 Thread Caolán McNamara (via logerrit)
 editeng/source/outliner/outliner.cxx |4 ++--
 editeng/source/outliner/outlobj.cxx  |4 ++--
 include/editeng/outlobj.hxx  |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit fb8973f31f111229be5184f4e4223e963ced2c7b
Author: Caolán McNamara 
AuthorDate: Sat Oct 10 19:21:38 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 10 22:19:25 2020 +0200

ofz#23492 the only user of this ctor throws away the original of the clone

so we can take ownership of the original instead

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

diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 5684c64a44a7..2fba66dc2d4e 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -373,7 +373,7 @@ std::unique_ptr 
Outliner::CreateParaObject( sal_Int32 nStart
 if (nCount <= 0)
 return nullptr;
 
-std::unique_ptr pText = pEditEngine->CreateTextObject( 
nStartPara, nCount );
+std::unique_ptr xText = pEditEngine->CreateTextObject( 
nStartPara, nCount );
 const bool bIsEditDoc(OutlinerMode::TextObject == ImplGetOutlinerMode());
 ParagraphDataVector aParagraphDataVector(nCount);
 const sal_Int32 nLastPara(nStartPara + nCount - 1);
@@ -383,7 +383,7 @@ std::unique_ptr 
Outliner::CreateParaObject( sal_Int32 nStart
 aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
 }
 
-std::unique_ptr pPObj(new OutlinerParaObject(*pText, 
aParagraphDataVector, bIsEditDoc));
+std::unique_ptr pPObj(new 
OutlinerParaObject(std::move(xText), aParagraphDataVector, bIsEditDoc));
 pPObj->SetOutlinerMode(GetMode());
 
 return pPObj;
diff --git a/editeng/source/outliner/outlobj.cxx 
b/editeng/source/outliner/outlobj.cxx
index 48c7aa02ab08..61b0a40d6b98 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -62,8 +62,8 @@ bool OutlinerParaObjData::isWrongListEqual(const 
OutlinerParaObjData& rCompare)
 }
 
 OutlinerParaObject::OutlinerParaObject(
-const EditTextObject& rTextObj, const ParagraphDataVector& 
rParagraphDataVector, bool bIsEditDoc ) :
-mpImpl(OutlinerParaObjData(rTextObj.Clone(), rParagraphDataVector, 
bIsEditDoc))
+std::unique_ptr xTextObj, const ParagraphDataVector& 
rParagraphDataVector, bool bIsEditDoc ) :
+mpImpl(OutlinerParaObjData(std::move(xTextObj), rParagraphDataVector, 
bIsEditDoc))
 {
 }
 
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
index 98414deda072..5c11180d27de 100644
--- a/include/editeng/outlobj.hxx
+++ b/include/editeng/outlobj.hxx
@@ -68,7 +68,7 @@ class EDITENG_DLLPUBLIC OutlinerParaObject
 
 public:
 // constructors/destructor
-OutlinerParaObject( const EditTextObject&, const ParagraphDataVector&, 
bool bIsEditDoc);
+OutlinerParaObject(std::unique_ptr, const 
ParagraphDataVector&, bool bIsEditDoc);
 OutlinerParaObject( const EditTextObject&);
 OutlinerParaObject( std::unique_ptr );
 OutlinerParaObject( const OutlinerParaObject&);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-08 Thread Caolán McNamara (via logerrit)
 editeng/source/editeng/editeng.cxx  |4 +++-
 editeng/source/editeng/impedit.cxx  |   12 
 editeng/source/editeng/impedit.hxx  |2 ++
 editeng/source/editeng/impedit3.cxx |9 +
 include/editeng/editview.hxx|5 +
 5 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit e67a755e6d4e3241360c75c3362f90a3af5999ac
Author: Caolán McNamara 
AuthorDate: Thu Oct 8 10:47:34 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 8 14:29:30 2020 +0200

add EditViewCallbacks handler to support updating scrollbar state

the problem is that since...

commit 319d8be9dad248a3ced5ac311e0b20ec3ed4cef7
Date:   Tue Nov 22 16:21:20 2011 +

tweak experimental gsoc multiline input bar, better resizing, enable 
scroll

that uses SetNofifyHdl to try and keep its scrollbar up to date, but that
SetNotifyHdl is also used by a11y to listen to the editengine and only one 
can
be set at a time, so with a11y enabled (the gtk default case) either a11y 
works
or the multiline scroll doesn't or vice versa.

Seeing as the a11y case is the very complicated case, leave a11y alone and
plot a route to disentangle the straightforward calc multiline edit from 
a11y.

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 15b140cd97a3..03836af7b511 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2501,13 +2501,15 @@ void EditEngine::StyleSheetChanged( SfxStyleSheet* /* 
pStyle */ )
 
 void EditEngine::ParagraphHeightChanged( sal_Int32 nPara )
 {
-
 if ( GetNotifyHdl().IsSet() )
 {
 EENotify aNotify( EE_NOTIFY_TextHeightChanged );
 aNotify.nParagraph = nPara;
 pImpEditEngine->GetNotifyHdl().Call( aNotify );
 }
+
+for (EditView* pView : pImpEditEngine->aEditViews)
+pView->pImpEditView->ScrollStateChange();
 }
 
 OUString EditEngine::GetUndoComment( sal_uInt16 nId ) const
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 2fc7252c5f23..8b61a4aee975 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1428,6 +1428,15 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 }
 }
 
+// call this so users of EditViewCallbacks can update their scrollbar state
+// so called when we have either scrolled to a new location
+// or the size of document has changed
+void ImpEditView::ScrollStateChange()
+{
+if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+pCallbacks->EditViewScrollStateChange();
+}
+
 Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
 {
 DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not 
formatted!" );
@@ -1561,6 +1570,9 @@ Pair ImpEditView::Scroll( long ndX, long ndY, 
ScrollRangeCheck nRangeCheck )
 pEditEngine->pImpEditEngine->GetNotifyHdl().Call( aNotify );
 }
 
+if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+pCallbacks->EditViewScrollStateChange();
+
 if (comphelper::LibreOfficeKit::isActive())
 {
 DrawSelectionXOR();
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 59db76fea44d..da33598365dd 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -390,6 +390,8 @@ public:
 voidDrawSelectionXOR( EditSelection, vcl::Region* pRegion = 
nullptr, OutputDevice* pTargetDevice = nullptr );
 void GetSelectionRectangles(EditSelection aTmpSel, 
std::vector& rLogicRects);
 
+void ScrollStateChange();
+
 vcl::Window*GetWindow() const   { return pOutWin; }
 
 voidSetSelectionMode( EESelectionMode eMode );
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 3b362a7704d4..0d88eeba800d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -399,7 +399,16 @@ void ImpEditEngine::FormatDoc()
 }
 bGrow = true;
 if ( IsCallParaInsertedOrDeleted() )
+{
 GetEditEnginePtr()->ParagraphHeightChanged( nPara );
+
+for (EditView* pView : aEditViews)
+{
+ImpEditView* pImpView = pView->pImpEditView.get();
+pImpView->ScrollStateChange();
+}
+
+}
 pParaPortion->SetMustRepaint( false );
 }
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index ccc2be551ca9..97b77609fe60 100644
--- 

  1   2   3   >