core.git: sc/source

2024-06-04 Thread Andrea Rosetti (via logerrit)
 sc/source/filter/excel/xeformula.cxx |   56 +++---
 sc/source/filter/excel/xelink.cxx|  323 +--
 sc/source/filter/inc/xelink.hxx  |   33 +--
 3 files changed, 207 insertions(+), 205 deletions(-)

New commits:
commit fbe8071e4f6be57d3e372d69a4c7cc4d37a83eb9
Author: Andrea Rosetti 
AuthorDate: Sat Oct 15 14:20:31 2022 +0200
Commit: Hossein 
CommitDate: Tue Jun 4 12:22:53 2024 +0200

refactor functions: return optional instead of bool

Change-Id: Ic4ff3ddaac161df13bf1e3e1372811a0685ec6c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141417
Reviewed-by: Jonathan Clark 
Reviewed-by: Hossein 
Tested-by: Jenkins

diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index 1d0ce72e9c36..688a9f147217 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1292,11 +1292,17 @@ void XclExpFmlaCompImpl::ProcessDdeLink( const 
XclExpScToken& rTokData )
 if( mxData->mbOk ) mxData->mbOk = !aApplic.isEmpty() && !aTopic.isEmpty() 
&& !aItem.isEmpty();
 if( mxData->mbOk )
 {
-sal_uInt16 nExtSheet(0), nExtName(0);
-if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertDde( nExtSheet, 
nExtName, aApplic, aTopic, aItem ) )
-AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces );
-else
-AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
+if ( mxData->mpLinkMgr )
+{
+const auto oResult = mxData->mpLinkMgr->InsertDde( aApplic, 
aTopic, aItem);
+
+if ( oResult ) {
+AppendNameXToken( oResult->first, oResult->second, 
rTokData.mnSpaces );
+}
+else {
+AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
+}
+}
 }
 }
 
@@ -2215,12 +2221,14 @@ void XclExpFmlaCompImpl::ProcessExternalName( const 
XclExpScToken& rTokData )
 }
 
 // insert the new external name and create the tNameX token
-sal_uInt16 nExtSheet = 0, nExtName = 0;
-const OUString* pFile = rExtRefMgr.getExternalFileName( nFileId );
-if( pFile && mxData->mpLinkMgr->InsertExtName( nExtSheet, 
nExtName, *pFile, aName, xArray ) )
-{
-AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces );
-return;
+if (const OUString* pFile = rExtRefMgr.getExternalFileName( 
nFileId )) {
+
+
+const auto oResult = mxData->mpLinkMgr->InsertExtName( *pFile, 
aName, xArray );
+if( oResult ) {
+AppendNameXToken( oResult->first, oResult->second, 
rTokData.mnSpaces );
+return;
+}
 }
 }
 }
@@ -2429,23 +2437,27 @@ void XclExpFmlaCompImpl::AppendAddInCallToken( const 
XclExpExtFuncData& rExtFunc
 OUString aXclFuncName;
 if( mxData->mpLinkMgr && ScGlobal::GetAddInCollection()->GetExcelName( 
rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) )
 {
-sal_uInt16 nExtSheet, nExtName;
-if( mxData->mpLinkMgr->InsertAddIn( nExtSheet, nExtName, aXclFuncName 
) )
-{
-AppendNameXToken( nExtSheet, nExtName );
-return;
-}
+const auto oResult = mxData->mpLinkMgr->InsertAddIn( aXclFuncName );
+AppendNameXToken(oResult->first, oResult->second);
+return;
+
 }
 AppendMacroCallToken( rExtFuncData );
 }
 
 void XclExpFmlaCompImpl::AppendEuroToolCallToken( const XclExpExtFuncData& 
rExtFuncData )
 {
-sal_uInt16 nExtSheet(0), nExtName(0);
-if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertEuroTool( nExtSheet, 
nExtName, rExtFuncData.maFuncName ) )
-AppendNameXToken( nExtSheet, nExtName );
-else
-AppendMacroCallToken( rExtFuncData );
+if ( mxData->mpLinkMgr )
+{
+const auto oResult = mxData->mpLinkMgr->InsertEuroTool( 
rExtFuncData.maFuncName );
+
+if ( oResult ) {
+AppendNameXToken( oResult->first, oResult->second );
+}
+else {
+AppendMacroCallToken( rExtFuncData );
+}
+}
 }
 
 void XclExpFmlaCompImpl::AppendOperatorTokenId( sal_uInt8 nTokenId, const 
XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces )
diff --git a/sc/source/filter/excel/xelink.cxx 
b/sc/source/filter/excel/xelink.cxx
index dd27be049429..dff69ed799ab 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -413,25 +413,24 @@ public:
 voidStoreCellRange( sal_uInt16 nFileId, const OUString& 
rTabName, const ScRange& rRange );
 
 /** Finds or inserts an EXTERNNAME record for an add-in function name.
-@param rnSupbook  Returns the index of the SUPBOOK record which 
contains the add-in function name.
-@param rnExtName  Returns the 1-based EXTERNNAME record index. */
-boolInsertAddIn(
-

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

2023-08-24 Thread Andrea Rosetti (via logerrit)
 cui/source/inc/grfpage.hxx  |3 ++
 cui/source/tabpages/grfpage.cxx |   28 +++
 cui/uiconfig/ui/croppage.ui |   48 
 3 files changed, 56 insertions(+), 23 deletions(-)

New commits:
commit 826300d55b8f18593c4b56fb448d09fac52820bd
Author: Andrea Rosetti 
AuthorDate: Wed Aug 2 11:40:25 2023 +0200
Commit: Heiko Tietze 
CommitDate: Fri Aug 25 07:37:33 2023 +0200

tdf#86628 Add reset crop function to dialog

Added a function that uncrops the image, keeping the modified size
(which can be restored using the already existing Original Size button)

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

diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index adfaebc33595..673062b7593a 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -80,6 +80,8 @@ class SvxGrfCropPage : public SfxTabPage
 std::unique_ptr m_xOrigSizeFT;
 std::unique_ptr m_xOrigSizePB;
 
+std::unique_ptr m_xUncropPB;
+
 // Example
 std::unique_ptr m_xExampleWN;
 
@@ -87,6 +89,7 @@ class SvxGrfCropPage : public SfxTabPage
 DECL_LINK(SizeHdl, weld::MetricSpinButton&, void);
 DECL_LINK(CropModifyHdl, weld::MetricSpinButton&, void);
 DECL_LINK(OrigSizeHdl, weld::Button&, void);
+DECL_LINK(UncropHdl, weld::Button&, void);
 
 voidCalcZoom();
 voidCalcMinMaxBorder();
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index aa49c2a7267c..fac0bfb6ab05 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -75,6 +75,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, 
weld::DialogController* p
 , m_xOrigSizeGrid(m_xBuilder->weld_widget("origsizegrid"))
 , m_xOrigSizeFT(m_xBuilder->weld_label("origsizeft"))
 , m_xOrigSizePB(m_xBuilder->weld_button("origsize"))
+, m_xUncropPB(m_xBuilder->weld_button("uncrop"))
 , m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN))
 {
 SetExchangeSupport();
@@ -104,6 +105,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, 
weld::DialogController* p
 m_xBottomMF->connect_value_changed( aLk );
 
 m_xOrigSizePB->connect_clicked(LINK(this, SvxGrfCropPage, OrigSizeHdl));
+m_xUncropPB->connect_clicked(LINK(this, SvxGrfCropPage, UncropHdl));
 }
 
 SvxGrfCropPage::~SvxGrfCropPage()
@@ -524,6 +526,32 @@ IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, 
weld::Button&, void)
 m_xHeightZoomMF->set_value(100, FieldUnit::NONE);
 m_bSetOrigSize = true;
 }
+
+/*
+description: reset crop
+ */
+
+IMPL_LINK_NOARG(SvxGrfCropPage, UncropHdl, weld::Button&, void)
+{
+SfxItemPool* pPool = GetItemSet().GetPool();
+DBG_ASSERT( pPool, "Where is the pool?" );
+
+m_xLeftMF->set_value(0, FieldUnit::NONE);
+m_xRightMF->set_value(0, FieldUnit::NONE);
+m_xTopMF->set_value(0, FieldUnit::NONE);
+m_xBottomMF->set_value(0, FieldUnit::NONE);
+
+m_aExampleWN.SetLeft(0);
+m_aExampleWN.SetRight(0);
+m_aExampleWN.SetTop(0);
+m_aExampleWN.SetBottom(0);
+
+m_aExampleWN.Invalidate();
+CalcMinMaxBorder();
+
+}
+
+
 /*
 description: compute scale
  */
diff --git a/cui/uiconfig/ui/croppage.ui b/cui/uiconfig/ui/croppage.ui
index b7fe3d8224a6..93f3eafe504a 100644
--- a/cui/uiconfig/ui/croppage.ui
+++ b/cui/uiconfig/ui/croppage.ui
@@ -1,5 +1,5 @@
 
-
+
 
   
   
@@ -51,7 +51,6 @@
 1
 10
   
-  
   
 True
 False
@@ -68,15 +67,14 @@
 0
 none
 
-  
   
 True
 False
+12
+6
 True
 6
 18
-12
-6
 
   
 Keep _scale
@@ -108,7 +106,6 @@
   
 
 
-  
   
 True
 False
@@ -133,8 +130,8 @@
 True
 True
 True
+True
 adjustment1
-True
 2
   
   
@@ -161,8 +158,8 @@
 True
 True
 True
+True
 adjustment7
-True
 2
   
   
@@ -177,7 +174,6 @@
   
 
 
-  
   
 True
 False
@@ -216,8 +212,8 @@

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

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

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

tdf#114441 Convert sal_uLong to a better type

Used sal_Int32 instead of sal_uLong

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

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

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

2022-10-07 Thread Andrea Rosetti (via logerrit)
 sw/source/uibase/app/docstyle.cxx |   52 +++---
 1 file changed, 26 insertions(+), 26 deletions(-)

New commits:
commit e005259a6d4e237411c1b4adfb1b63313bcc5980
Author: Andrea Rosetti 
AuthorDate: Fri Sep 23 13:42:57 2022 +0200
Commit: Julien Nabet 
CommitDate: Fri Oct 7 14:41:24 2022 +0200

tdf#145538 use range based for loops

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

diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index f8cdfecd1249..6c9fad20bb54 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1729,27 +1729,27 @@ static void lcl_SaveStyles( SfxStyleFamily nFamily, 
std::vector& rArr, Sw
 case SfxStyleFamily::Char:
 {
 const SwCharFormats& rTable = *rDoc.GetCharFormats();
-for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for(auto const& rChar: rTable)
 {
-rArr.push_back( rTable[ n ] );
+rArr.push_back(rChar);
 }
 }
 break;
 case SfxStyleFamily::Para:
 {
 const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
-for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for(auto const& rPara : rTable)
 {
-rArr.push_back( rTable[ n ] );
+rArr.push_back(rPara);
 }
 }
 break;
 case SfxStyleFamily::Frame:
 {
 const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
-for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for(auto const& rFrame: rTable)
 {
-rArr.push_back( rTable[ n ] );
+rArr.push_back(rFrame);
 }
 }
 break;
@@ -1766,9 +1766,9 @@ static void lcl_SaveStyles( SfxStyleFamily nFamily, 
std::vector& rArr, Sw
 case SfxStyleFamily::Pseudo:
 {
 const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
-for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for(auto const& rPseudo: rTable)
 {
-rArr.push_back( rTable[ n ] );
+rArr.push_back(rPseudo);
 }
 }
 break;
@@ -1795,8 +1795,8 @@ static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, 
std::vector con
 if( !lcl_Contains( rArr, rTable[ n ] ))
 aDelArr.push_front( n );
 }
-for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
-rDoc.DelCharFormat( aDelArr[ n ] );
+for(auto const& rDelArr: aDelArr)
+rDoc.DelCharFormat( rDelArr );
 }
 break;
 
@@ -1809,8 +1809,8 @@ static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, 
std::vector con
 if( !lcl_Contains( rArr, rTable[ n ] ))
 aDelArr.push_front( n );
 }
-for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
-rDoc.DelTextFormatColl( aDelArr[ n ] );
+for(auto const& rDelArr: aDelArr)
+rDoc.DelTextFormatColl( rDelArr );
 }
 break;
 
@@ -1818,13 +1818,13 @@ static void lcl_DeleteInfoStyles( SfxStyleFamily 
nFamily, std::vector con
 {
 std::deque aDelArr;
 const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
-for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for( auto const& rFrame: rTable )
 {
-if( !lcl_Contains( rArr, rTable[ n ] ))
-aDelArr.push_front( rTable[ n ] );
+if( !lcl_Contains( rArr, rFrame ))
+aDelArr.push_front( rFrame );
 }
-for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
-rDoc.DelFrameFormat( aDelArr[ n ] );
+for( auto const& rDelArr: aDelArr)
+rDoc.DelFrameFormat( rDelArr );
 }
 break;
 
@@ -1836,8 +1836,8 @@ static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, 
std::vector con
 if( !lcl_Contains( rArr, ( n ) ))
 aDelArr.push_front( n );
 }
-for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
-rDoc.DelPageDesc( aDelArr[ n ] );
+for( auto const& rDelArr: aDelArr )
+rDoc.DelPageDesc( rDelArr);
 }
 break;
 
@@ -1845,13 +1845,13 @@ static void lcl_DeleteInfoStyles( SfxStyleFamily 
nFamily, std::vector con
 {
 std::deque aDelArr;
 const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
-for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
+for( auto const& rPseudo: rTable)
 {
-if(