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

2023-02-27 Thread Mike Kaganski (via logerrit)
 cui/source/inc/autocdlg.hxx|4 ++--
 cui/source/tabpages/autocdlg.cxx   |   37 -
 hwpfilter/source/hwpeq.cxx |   19 ---
 sw/source/core/edit/edglss.cxx |6 +-
 sw/source/uibase/envelp/envimg.cxx |   10 +++---
 5 files changed, 30 insertions(+), 46 deletions(-)

New commits:
commit 4805a1348bb3749d468656a4e648064dabe1fd04
Author: Mike Kaganski 
AuthorDate: Mon Feb 27 09:30:46 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Feb 27 09:54:20 2023 +

Optional may be avoided here, too

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

diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 8e31011e7a33..7b4842314779 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -166,7 +166,7 @@ private:
 std::set  aFormatText;
 std::map
 aDoubleStringTable;
-std::optional  moCompareClass;
+CollatorWrapper maCompareClass;
 std::unique_ptrpCharClass;
 LanguageTypeeLang;
 
@@ -227,7 +227,7 @@ class OfaAutocorrExceptPage : public SfxTabPage
 {
 private:
 StringsTableaStringsTable;
-std::optional moCompareClass;
+CollatorWrapper maCompareClass;
 LanguageTypeeLang;
 
 std::unique_ptr m_xAbbrevED;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index f8c4a16d0c6e..446775c6abad 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -667,6 +667,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, 
weld::Button&, void)
 OfaAutocorrReplacePage::OfaAutocorrReplacePage(weld::Container* pPage, 
weld::DialogController* pController,
const SfxItemSet& rSet)
 : SfxTabPage(pPage, pController, "cui/ui/acorreplacepage.ui", 
"AcorReplacePage", )
+, maCompareClass(comphelper::getProcessComponentContext())
 , eLang(eLastDialogLanguage)
 , bHasSelectionText(false)
 , bFirstSelect(true)
@@ -698,8 +699,7 @@ 
OfaAutocorrReplacePage::OfaAutocorrReplacePage(weld::Container* pPage, weld::Dia
 bSWriter = pMod == SfxModule::GetActiveModule();
 
 LanguageTag aLanguageTag( eLastDialogLanguage );
-moCompareClass.emplace( comphelper::getProcessComponentContext() );
-moCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
+maCompareClass.loadDefaultCollator( aLanguageTag.getLocale(), 0 );
 pCharClass.reset( new CharClass( std::move(aLanguageTag) ) );
 
 auto nColWidth = m_xReplaceTLB->get_approximate_digit_width() * 32;
@@ -722,7 +722,6 @@ OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
 aDoubleStringTable.clear();
 aChangesTable.clear();
 
-moCompareClass.reset();
 pCharClass.reset();
 }
 
@@ -904,8 +903,8 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet)
 eLastDialogLanguage = eSet;
 
 LanguageTag aLanguageTag( eLastDialogLanguage );
-moCompareClass.emplace( comphelper::getProcessComponentContext() );
-moCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
+maCompareClass = CollatorWrapper( 
comphelper::getProcessComponentContext() );
+maCompareClass.loadDefaultCollator( aLanguageTag.getLocale(), 0 );
 pCharClass.reset( new CharClass( std::move(aLanguageTag) ) );
 ModifyHdl(*m_xShortED);
 }
@@ -919,7 +918,7 @@ IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, 
weld::TreeView&, rBox, void)
 OUString sTmpShort(rBox.get_text(nEntry, 0));
 // if the text is set via ModifyHdl, the cursor is always at the 
beginning
 // of a word, although you're editing here
-bool bSameContent = 0 == moCompareClass->compareString(sTmpShort, 
m_xShortED->get_text());
+bool bSameContent = 0 == maCompareClass.compareString(sTmpShort, 
m_xShortED->get_text());
 int nStartPos, nEndPos;
 m_xShortED->get_selection_bounds(nStartPos, nEndPos);
 if (m_xShortED->get_text() != sTmpShort)
@@ -1057,7 +1056,7 @@ bool OfaAutocorrReplacePage::NewDelHdl(const 
weld::Widget* pBtn)
 int nCount = m_xReplaceTLB->n_children();
 for (j = 0; j < nCount; ++j)
 {
-if (0 >= moCompareClass->compareString(sEntry, 
m_xReplaceTLB->get_text(j, 0)))
+if (0 >= maCompareClass.compareString(sEntry, 
m_xReplaceTLB->get_text(j, 0)))
 break;
 }
 nPos = j;
@@ -1110,7 +1109,7 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, 
weld::Entry&, rEdt, void)
 , ,
 , ](weld::TreeIter& 
rIter){
 OUString aTestStr = m_xReplaceTLB->get_text(rIter, 0);
-

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

2018-08-21 Thread Libreoffice Gerrit user
 cui/source/factory/dlgfact.cxx |   50 ++--
 cui/source/factory/dlgfact.hxx |   72 -
 hwpfilter/source/hiodev.cxx|2 -
 hwpfilter/source/hiodev.h  |2 -
 hwpfilter/source/hwpfile.cxx   |8 ++--
 hwpfilter/source/hwpfile.h |4 +-
 hwpfilter/source/hwpreader.cxx |4 +-
 7 files changed, 71 insertions(+), 71 deletions(-)

New commits:
commit c4558e4b7b3defe7a128e16781eaececc416195a
Author: Noel Grandin 
AuthorDate: Mon Aug 20 13:49:28 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 21 12:11:18 2018 +0200

loplugin:useuniqueptr in HStreamIODev

Change-Id: I81ab91bce2a83603b25922593c1fd764b5c0b003
Reviewed-on: https://gerrit.libreoffice.org/59358
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx
index fcdc98b24109..7fd808906c69 100644
--- a/hwpfilter/source/hiodev.cxx
+++ b/hwpfilter/source/hiodev.cxx
@@ -89,7 +89,7 @@ size_t HIODev::read4b(void *ptr, size_t nmemb)
 
 
 // hfileiodev class
-HStreamIODev::HStreamIODev(HStream * stream):_stream(stream)
+HStreamIODev::HStreamIODev(std::unique_ptr 
stream):_stream(std::move(stream))
 {
 init();
 }
diff --git a/hwpfilter/source/hiodev.h b/hwpfilter/source/hiodev.h
index 5f12454da99e..b6f2c7aa2be7 100644
--- a/hwpfilter/source/hiodev.h
+++ b/hwpfilter/source/hiodev.h
@@ -78,7 +78,7 @@ class HStreamIODev final: public HIODev
 std::unique_ptr _stream;
 gz_stream *_gzfp;
 public:
-explicit HStreamIODev(HStream* stream);
+explicit HStreamIODev(std::unique_ptr stream);
 virtual ~HStreamIODev() override;
 /**
  * Check whether the stream is available
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index d3bd660e77fd..a61b3e08921b 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -65,9 +65,9 @@ HWPFile::~HWPFile()
 hiodev.reset();
 }
 
-int HWPFile::ReadHwpFile(HStream * stream)
+int HWPFile::ReadHwpFile(std::unique_ptr stream)
 {
-if (Open(stream) != HWP_NoError)
+if (Open(std::move(stream)) != HWP_NoError)
 return State();
 InfoRead();
 FontRead();
@@ -92,9 +92,9 @@ int detect_hwp_version(const char *str)
 
 // HIODev wrapper
 
-int HWPFile::Open(HStream * stream)
+int HWPFile::Open(std::unique_ptr stream)
 {
-HStreamIODev *hstreamio = new HStreamIODev(stream);
+HStreamIODev *hstreamio = new HStreamIODev(std::move(stream));
 
 if (!hstreamio->open())
 {
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 4f68543f5b13..36655105a9f5 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -111,7 +111,7 @@ class DLLEXPORT HWPFile
  * @returns 0 if success, otherwise error code
  * @see State()
  */
-int Open( HStream * );
+int Open( std::unique_ptr );
 
 /**
  * Say current state
@@ -170,7 +170,7 @@ class DLLEXPORT HWPFile
 /**
  * Reads all information of hwp file from stream
  */
-int ReadHwpFile( HStream *);
+int ReadHwpFile( std::unique_ptr );
 /**
  * Reads document information of hwp file from HIODev
  */
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index b3e8ba9f7d8b..947d00affb4f 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -132,7 +132,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream 
)
 }
 
 HWPFile hwpfile;
-if (hwpfile.ReadHwpFile(stream.release()))
+if (hwpfile.ReadHwpFile(std::move(stream)))
 return false;
 }
 catch (...)
@@ -164,7 +164,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& 
rDescriptor)
 
 if( nTotal == 0 ) return false;
 
-if (hwpfile.ReadHwpFile(stream.release()))
+if (hwpfile.ReadHwpFile(std::move(stream)))
   return false;
 
 if (m_rxDocumentHandler.is())
commit 079abbaefa0ce600958e8e6a2b15c58deec14990
Author: Noel Grandin 
AuthorDate: Mon Aug 20 13:49:09 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 21 12:11:10 2018 +0200

loplugin:useuniqueptr in cui

Change-Id: I7afe964a65950c25e3255eba72970fa9da0a0df9
Reviewed-on: https://gerrit.libreoffice.org/59357
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index ff973f402668..8874dedd834e 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -995,7 +995,7 @@ VclPtr 
AbstractDialogFactory_Impl::CreateTextTabDialog(wel
 const SfxItemSet* pAttrSet,
 SdrView* pView)
 {
-return VclPtr::Create(new 
SvxTextTabDialog(pParent, pAttrSet, pView));
+return 
VclPtr::Create(o3tl::make_unique(pParent,
 pAttrSet, pView));
 }
 
 // TabDialog that use functionality of the drawing layer and add